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,GACT,GACA,MAAA,CAAO,CAAA,EACX,GAEA,OADA,IAAI,CAAC,KAAL,GACO,MAAM,CACf,CACF,C,G,c,Q,mC","sources":["<anon>","token-variants/applications/overlayConfig.js","token-variants/scripts/models.js","token-variants/scripts/hooks/effectMappingHooks.js","token-variants/scripts/settings.js","token-variants/scripts/utils.js","token-variants/token-variants.mjs","token-variants/applications/artSelect.js","token-variants/applications/tokenCustomConfig.js","token-variants/scripts/token/overlay.js","token-variants/scripts/sprite/TVAOverlay.js","token-variants/scripts/hooks/overlayHooks.js","token-variants/scripts/sprite/HTMLOverlay.js","token-variants/scripts/hooks/hooks.js","token-variants/scripts/hooks/effectIconHooks.js","token-variants/scripts/hooks/artSelectButtonHooks.js","token-variants/scripts/hooks/hudHooks.js","token-variants/applications/tileHUD.js","token-variants/applications/flagsConfig.js","token-variants/scripts/search.js","token-variants/scripts/fuse/fuse.js","token-variants/applications/userList.js","token-variants/applications/tokenHUD.js","token-variants/applications/effectMappingForm.js","token-variants/applications/configJsonEdit.js","token-variants/applications/configScriptEdit.js","token-variants/applications/dialogs.js","token-variants/scripts/mappingTemplates.js","token-variants/applications/templates.js","token-variants/applications/randomizerConfig.js","token-variants/scripts/hooks/userMappingHooks.js","token-variants/scripts/hooks/wildcardHooks.js","token-variants/scripts/hooks/popUpRandomizeHooks.js","token-variants/scripts/wrappers/wrappers.js","token-variants/scripts/wrappers/effectIconWrappers.js","token-variants/scripts/wrappers/hideElementWrappers.js","token-variants/scripts/wrappers/hudWrappers.js","token-variants/scripts/reticle.js","token-variants/scripts/wrappers/userMappingWrappers.js","token-variants/applications/compendiumMap.js","token-variants/applications/configureSettings.js","token-variants/applications/missingImageConfig.js","token-variants/applications/forgeSearchPaths.js","token-variants/applications/tokenHUDClientSettings.js","token-variants/applications/importExport.js"],"sourcesContent":["function $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $parcel$global =\ntypeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire84b7\"];\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire84b7\"] = parcelRequire;\n}\nparcelRequire.register(\"4rd87\", function(module, exports) {\n\n$parcel$export(module.exports, \"OverlayConfig\", () => OverlayConfig);\n$parcel$export(module.exports, \"FILTERS\", () => FILTERS);\n\nvar $ce8jp = parcelRequire(\"ce8jp\");\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\n\nvar $bFZU7 = parcelRequire(\"bFZU7\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $eYkM9 = parcelRequire(\"eYkM9\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $bZ3HW = parcelRequire(\"bZ3HW\");\nclass OverlayConfig extends FormApplication {\n constructor(config11, callback11, id11, token11){\n super({}, {});\n this.config = config11 ?? {};\n this.config.id = id11;\n this.callback = callback11;\n this.token = canvas.tokens.get(token11._id);\n this.previewConfig = deepClone(this.config);\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-overlay-config\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/overlayConfig.html\",\n resizable: false,\n minimizable: false,\n title: \"Overlay Settings\",\n width: 500,\n height: \"auto\",\n //tabs: [{ navSelector: '.sheet-tabs', contentSelector: '.content', initial: 'misc' }, ],\n tabs: [\n {\n navSelector: '.tabs[data-group=\"main\"]',\n contentSelector: \"form\",\n initial: \"misc\"\n },\n {\n navSelector: '.tabs[data-group=\"html\"]',\n contentSelector: '.tab[data-tab=\"html\"]',\n initial: \"template\"\n }\n ]\n });\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.find(\".reticle\").on(\"click\", (event11)=>{\n const icons11 = this.getPreviewIcons();\n if (icons11.length) (0, $bZ3HW.Reticle).activate({\n tvaOverlay: icons11[0].icon,\n app: this,\n config: this.previewConfig\n });\n });\n const imgLinkDisable = function(disabled11) {\n html.find(\".img-link-disable\").prop(\"disabled\", disabled11);\n };\n html.find(\".image-link\").on(\"click\", (event11)=>{\n const chkBox11 = $(event11.target).closest(\".form-group\").find('[name=\"imgLinked\"]');\n const button11 = $(event11.target).closest(\"button\");\n if (chkBox11.is(\":checked\")) {\n chkBox11.prop(\"checked\", false);\n button11.removeClass(\"active\");\n imgLinkDisable(false);\n } else {\n chkBox11.prop(\"checked\", true);\n button11.addClass(\"active\");\n imgLinkDisable(true);\n }\n });\n imgLinkDisable(Boolean(this.config.imgLinked));\n html.find(\".repeat\").on(\"change\", (event11)=>{\n const fieldset11 = $(event11.target).closest(\"fieldset\");\n const content11 = fieldset11.find(\".content\");\n if (event11.target.checked) {\n content11.show();\n fieldset11.addClass(\"active\");\n } else {\n content11.hide();\n fieldset11.removeClass(\"active\");\n }\n this.setPosition();\n });\n // Insert Controls to the Shape Legend\n const shapeLegends = html.find(\".shape-legend\");\n let config = this.config;\n shapeLegends.each(function(i31) {\n const legend11 = $(this);\n legend11.append(` <a class=\"cloneShape\" data-index=\"${i31}\" title=\"Clone\"><i class=\"fas fa-clone\"></i></a>\r\n <a class=\"deleteShape\" data-index=\"${i31}\" title=\"Remove\"><i class=\"fas fa-trash-alt\"></i></a>`);\n if (i31 != 0) legend11.append(` <a class=\"moveShapeUp\" data-index=\"${i31}\" title=\"Move Up\"><i class=\"fas fa-arrow-up\"></i></a>`);\n if (i31 != shapeLegends.length - 1) legend11.append(` <a class=\"moveShapeDown\" data-index=\"${i31}\" title=\"Move Down\"><i class=\"fas fa-arrow-down\"></i></a>`);\n legend11.append(`<input class=\"shape-legend-input\" type=\"text\" name=\"shapes.${i31}.label\" value=\"${config.shapes?.[i31]?.label ?? \"\"}\">`);\n });\n // Shape listeners\n html.find(\".addShape\").on(\"click\", this._onAddShape.bind(this));\n html.find(\".addEvent\").on(\"click\", this._onAddEvent.bind(this));\n html.find(\".deleteShape\").on(\"click\", this._onDeleteShape.bind(this));\n html.find(\".deleteEvent\").on(\"click\", this._onDeleteEvent.bind(this));\n html.find(\".moveShapeUp\").on(\"click\", this._onMoveShapeUp.bind(this));\n html.find(\".moveShapeDown\").on(\"click\", this._onMoveShapeDown.bind(this));\n html.find(\".cloneShape\").on(\"click\", this._onCloneShape.bind(this));\n html.find(\"input,select\").on(\"change\", this._onInputChange.bind(this));\n html.find(\"textarea\").on(\"change\", this._onInputChange.bind(this));\n const parentId = html.find('[name=\"parentID\"]');\n parentId.on(\"change\", (event11)=>{\n if (event11.target.value === \"TOKEN\") html.find(\".token-specific-fields\").show();\n else html.find(\".token-specific-fields\").hide();\n this.setPosition();\n });\n parentId.trigger(\"change\");\n html.find('[name=\"ui\"]').on(\"change\", (event11)=>{\n if (parentId.val() === \"TOKEN\") {\n if (event11.target.checked) html.find(\".ui-hide\").hide();\n else html.find(\".ui-hide\").show();\n this.setPosition();\n }\n }).trigger(\"change\");\n html.find('[name=\"filter\"]').on(\"change\", (event11)=>{\n html.find(\".filterOptions\").empty();\n const filterOptions11 = $(genFilterOptionControls(event11.target.value));\n html.find(\".filterOptions\").append(filterOptions11);\n this.setPosition({\n height: \"auto\"\n });\n this.activateListeners(filterOptions11);\n });\n html.find(\".token-variants-image-select-button\").click((event11)=>{\n (0, $coMHP.showArtSelect)(this.token?.name ?? \"overlay\", {\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n callback: (imgSrc11, imgName11)=>{\n if (imgSrc11) $(event11.target).closest(\".form-group\").find(\"input\").val(imgSrc11).trigger(\"change\");\n }\n });\n });\n html.find(\".presetImport\").on(\"click\", (event11)=>{\n const presetName11 = $(event11.target).closest(\".form-group\").find(\".tmfxPreset\").val();\n if (presetName11) {\n const preset11 = TokenMagic.getPreset(presetName11);\n if (preset11) $(event11.target).closest(\".form-group\").find(\"textarea\").val(JSON.stringify(preset11, null, 2)).trigger(\"input\");\n }\n });\n // Controls for locking scale sliders together\n let scaleState = {\n locked: true\n };\n // Range inputs need to be triggered when slider moves to initiate preview\n html.find(\".range-value\").siblings('[type=\"range\"]').on(\"change\", (event11)=>{\n $(event11.target).siblings(\".range-value\").val(event11.target.value).trigger(\"change\");\n });\n const lockButtons = $(html).find(\".scaleLock > a\");\n const sliderScaleWidth = $(html).find('[name=\"scaleX\"]');\n const sliderScaleHeight = $(html).find('[name=\"scaleY\"]');\n const sliderWidth = html.find(\".scaleX\");\n const sliderHeight = html.find(\".scaleY\");\n lockButtons.on(\"click\", function() {\n scaleState.locked = !scaleState.locked;\n lockButtons.html(scaleState.locked ? '<i class=\"fas fa-link\"></i>' : '<i class=\"fas fa-unlink\"></i>');\n });\n sliderScaleWidth.on(\"change\", function() {\n if (scaleState.locked && sliderScaleWidth.val() !== sliderScaleHeight.val()) {\n sliderScaleHeight.val(sliderScaleWidth.val()).trigger(\"change\");\n sliderHeight.val(sliderScaleWidth.val());\n }\n });\n sliderScaleHeight.on(\"change\", function() {\n if (scaleState.locked && sliderScaleWidth.val() !== sliderScaleHeight.val()) {\n sliderScaleWidth.val(sliderScaleHeight.val()).trigger(\"change\");\n sliderWidth.val(sliderScaleHeight.val());\n }\n });\n html.on(\"change\", \".scaleX\", ()=>{\n sliderScaleWidth.trigger(\"change\");\n });\n html.on(\"change\", \".scaleY\", ()=>{\n sliderScaleHeight.trigger(\"change\");\n });\n html.find(\".me-edit-json\").on(\"click\", async (event)=>{\n const textarea = $(event.target).closest(\".form-group\").find(\"textarea\");\n let params;\n try {\n params = eval(textarea.val());\n } catch (e) {\n console.warn(\"TVA |\", e);\n }\n if (params) {\n let param;\n if (Array.isArray(params)) {\n if (params.length === 1) param = params[0];\n else {\n let i = await promptParamChoice(params);\n if (i < 0) return;\n param = params[i];\n }\n } else param = params;\n if (param) game.modules.get(\"multi-token-edit\").api.showGenericForm(param, param.filterType ?? \"TMFX\", {\n inputChangeCallback: (selected11)=>{\n mergeObject(param, selected11, {\n inplace: true\n });\n textarea.val(JSON.stringify(params, null, 2)).trigger(\"input\");\n }\n });\n }\n });\n const underlay = html.find('[name=\"underlay\"]');\n const top = html.find('[name=\"top\"]');\n const bottom = html.find('[name=\"bottom\"]');\n underlay.change(function() {\n if (this.checked) top.prop(\"checked\", false);\n else bottom.prop(\"checked\", false);\n });\n top.change(function() {\n if (this.checked) {\n underlay.prop(\"checked\", false);\n bottom.prop(\"checked\", false);\n }\n });\n bottom.change(function() {\n if (this.checked) {\n underlay.prop(\"checked\", true);\n top.prop(\"checked\", false);\n }\n });\n const linkScale = html.find('[name=\"linkScale\"]');\n const linkDimensions = html.find('[name=\"linkDimensionsX\"], [name=\"linkDimensionsY\"]');\n const linkStageScale = html.find('[name=\"linkStageScale\"]');\n linkScale.change(function() {\n if (this.checked) {\n linkDimensions.prop(\"checked\", false);\n linkStageScale.prop(\"checked\", false);\n }\n });\n linkDimensions.change(function() {\n if (this.checked) {\n linkScale.prop(\"checked\", false);\n linkStageScale.prop(\"checked\", false);\n }\n });\n linkStageScale.change(function() {\n if (this.checked) {\n linkScale.prop(\"checked\", false);\n linkDimensions.prop(\"checked\", false);\n }\n });\n // Setting border color for property expression\n const limitOnProperty = html.find('[name=\"limitOnProperty\"]');\n limitOnProperty.on(\"input\", (event11)=>{\n const input11 = $(event11.target);\n if (input11.val() === \"\") {\n input11.removeClass(\"tvaValid\");\n input11.removeClass(\"tvaInvalid\");\n } else if (input11.val().match((0, $dmUqi.VALID_EXPRESSION))) {\n input11.addClass(\"tvaValid\");\n input11.removeClass(\"tvaInvalid\");\n } else {\n input11.addClass(\"tvaInvalid\");\n input11.removeClass(\"tvaValid\");\n }\n });\n limitOnProperty.trigger(\"input\");\n html.find(\".create-variable\").on(\"click\", this._onCreateVariable.bind(this));\n html.find(\".delete-variable\").on(\"click\", this._onDeleteVariable.bind(this));\n }\n _onDeleteVariable(event11) {\n let index11 = $(event11.target).closest(\"tr\").data(\"index\");\n if (index11 != null) {\n this.config = this._getSubmitData();\n if (!this.config.variables) this.config.variables = [];\n this.config.variables.splice(index11, 1);\n this.render(true);\n }\n }\n _onCreateVariable(event11) {\n this.config = this._getSubmitData();\n if (!this.config.variables) this.config.variables = [];\n this.config.variables.push({\n name: \"\",\n value: \"\"\n });\n this.render(true);\n }\n _onAddShape(event11) {\n let shape11 = $(event11.target).siblings(\"select\").val();\n shape11 = deepClone((0, $ce8jp.OVERLAY_SHAPES)[shape11]);\n shape11 = mergeObject(deepClone((0, $ce8jp.CORE_SHAPE)), {\n shape: shape11\n });\n this.config = this._getSubmitData();\n if (!this.config.shapes) this.config.shapes = [];\n this.config.shapes.push(shape11);\n this.render(true);\n }\n _onAddEvent(event11) {\n let listener11 = $(event11.target).siblings(\"select\").val();\n this.config = this._getSubmitData();\n if (!this.config.interactivity) this.config.interactivity = [];\n this.config.interactivity.push({\n listener: listener11,\n macro: \"\",\n script: \"\"\n });\n this.render(true);\n }\n _onDeleteShape(event11) {\n const index11 = $(event11.target).closest(\".deleteShape\").data(\"index\");\n if (index11 == null) return;\n this.config = this._getSubmitData();\n if (!this.config.shapes) this.config.shapes = [];\n this.config.shapes.splice(index11, 1);\n this.render(true);\n }\n _onDeleteEvent(event11) {\n const index11 = $(event11.target).closest(\".deleteEvent\").data(\"index\");\n if (index11 == null) return;\n this.config = this._getSubmitData();\n if (!this.config.interactivity) this.config.interactivity = [];\n this.config.interactivity.splice(index11, 1);\n this.render(true);\n }\n _onCloneShape(event11) {\n const index11 = $(event11.target).closest(\".cloneShape\").data(\"index\");\n if (!index11 && index11 != 0) return;\n this.config = this._getSubmitData();\n if (!this.config.shapes) return;\n const nShape11 = deepClone(this.config.shapes[index11]);\n if (nShape11.label) nShape11.label = nShape11.label + \" - Copy\";\n this.config.shapes.push(nShape11);\n this.render(true);\n }\n _onMoveShapeUp(event11) {\n const index11 = $(event11.target).closest(\".moveShapeUp\").data(\"index\");\n if (!index11) return;\n this.config = this._getSubmitData();\n if (!this.config.shapes) this.config.shapes = [];\n if (this.config.shapes.length >= 2) this._swapShapes(index11, index11 - 1);\n this.render(true);\n }\n _onMoveShapeDown(event11) {\n const index11 = $(event11.target).closest(\".moveShapeDown\").data(\"index\");\n if (!index11 && index11 != 0) return;\n this.config = this._getSubmitData();\n if (!this.config.shapes) this.config.shapes = [];\n if (this.config.shapes.length >= 2) this._swapShapes(index11, index11 + 1);\n this.render(true);\n }\n _swapShapes(i111, i211) {\n let temp11 = this.config.shapes[i111];\n this.config.shapes[i111] = this.config.shapes[i211];\n this.config.shapes[i211] = temp11;\n }\n _convertColor(colString11) {\n try {\n const c11 = Color.fromString(colString11);\n const rgba11 = c11.rgb;\n rgba11.push(1);\n return rgba11;\n } catch (e11) {\n return [\n 1,\n 1,\n 1,\n 1\n ];\n }\n }\n async _onInputChange(event11) {\n this.previewConfig = this._getSubmitData();\n if (event11.target.type === \"color\") {\n const color11 = $(event11.target).siblings(\".color\");\n color11.val(event11.target.value).trigger(\"change\");\n return;\n }\n this._applyPreviews();\n }\n getPreviewIcons() {\n if (!this.config.id) return [];\n const tokens11 = this.token ? [\n this.token\n ] : canvas.tokens.placeables;\n const previewIcons11 = [];\n for (const tkn11 of tokens11)if (tkn11.tvaOverlays) {\n for (const c11 of tkn11.tvaOverlays)if (c11.overlayConfig && c11.overlayConfig.id === this.config.id) {\n // Effect icon found, however if we're in global preview then we need to take into account\n // a token/actor specific mapping which may override the global one\n if (this.token) previewIcons11.push({\n token: tkn11,\n icon: c11\n });\n else if (!(0, $9IngI.getFlagMappings)(tkn11).find((m11)=>m11.id === this.config.id)) previewIcons11.push({\n token: tkn11,\n icon: c11\n });\n }\n }\n return previewIcons11;\n }\n async _applyPreviews() {\n const targets11 = this.getPreviewIcons();\n for (const target11 of targets11){\n const preview11 = (0, $bFZU7.evaluateOverlayExpressions)(deepClone(this.previewConfig), target11.token, {\n overlayConfig: this.previewConfig\n });\n target11.icon.refresh(preview11, {\n preview: true,\n previewTexture: await (0, $bFZU7.genTexture)(target11.token, preview11)\n });\n }\n }\n async _removePreviews() {\n const targets11 = this.getPreviewIcons();\n for (const target11 of targets11)target11.icon.refresh();\n }\n async getData(options11) {\n const data11 = super.getData(options11);\n data11.filters = Object.keys(PIXI.filters);\n data11.filters.push(\"OutlineOverlayFilter\");\n data11.filters.sort();\n data11.tmfxActive = game.modules.get(\"tokenmagic\")?.active;\n if (data11.tmfxActive) {\n data11.tmfxPresets = TokenMagic.getPresets().map((p11)=>p11.name);\n data11.filters.unshift(\"Token Magic FX\");\n }\n data11.filters.unshift(\"NONE\");\n const settings11 = mergeObject((0, $ce8jp.DEFAULT_OVERLAY_CONFIG), this.config, {\n inplace: false\n });\n data11.ceActive = game.modules.get(\"dfreds-convenient-effects\")?.active;\n if (data11.ceActive) data11.ceEffects = game.dfreds.effects.all.map((ef11)=>ef11.name);\n data11.macros = game.macros.map((m11)=>m11.name);\n if (settings11.filter !== \"NONE\") {\n const filterOptions11 = genFilterOptionControls(settings11.filter, settings11.filterOptions);\n if (filterOptions11) settings11.filterOptions = filterOptions11;\n else settings11.filterOptions = null;\n } else settings11.filterOptions = null;\n data11.users = game.users.map((u11)=>{\n return {\n id: u11.id,\n name: u11.name,\n selected: settings11.limitedUsers.includes(u11.id)\n };\n });\n data11.fonts = Object.keys(CONFIG.fontDefinitions);\n const allMappings11 = (0, $dmUqi.getAllEffectMappings)(this.token, true).filter((m11)=>m11.id !== this.config.id);\n const [_11, groupedMappings11] = (0, $eYkM9.sortMappingsToGroups)(allMappings11);\n data11.parents = groupedMappings11;\n if (!data11.parentID) data11.parentID = \"TOKEN\";\n if (!data11.anchor) data11.anchor = {\n x: 0.5,\n y: 0.5\n };\n // Cache Partials\n for (const shapeName11 of Object.keys((0, $ce8jp.OVERLAY_SHAPES)))await getTemplate(`modules/token-variants/templates/partials/shape${shapeName11}.html`);\n await getTemplate(\"modules/token-variants/templates/partials/repeating.html\");\n await getTemplate(\"modules/token-variants/templates/partials/interpolateColor.html\");\n data11.allShapes = Object.keys((0, $ce8jp.OVERLAY_SHAPES));\n data11.textAlignmentOptions = [\n {\n value: \"left\",\n label: \"Left\"\n },\n {\n value: \"center\",\n label: \"Center\"\n },\n {\n value: \"right\",\n label: \"Right\"\n },\n {\n value: \"justify\",\n label: \"Justify\"\n }\n ];\n // linkDimensions has been converted to linkDimensionsX and linkDimensionsY\n // Make sure we're using the latest fields\n // 20/07/2023\n if (!(\"linkDimensionsX\" in settings11) && settings11.linkDimensions) {\n settings11.linkDimensionsX = true;\n settings11.linkDimensionsY = true;\n }\n return mergeObject(data11, settings11);\n }\n _getHeaderButtons() {\n const buttons11 = super._getHeaderButtons();\n buttons11.unshift({\n label: \"Core Variables\",\n class: \".core-variables\",\n icon: \"fas fa-file-import fa-fw\",\n onclick: ()=>{\n let content11 = `\r\n <table>\r\n <tr><th>Variable</th><th>Description</th></tr>\r\n <tr><td>@hp</td><td>Actor Health</td></tr>\r\n <tr><td>@hpMax</td><td>Actor Health (Max)</td></tr>\r\n <tr><td>@gridSize</td><td>Grid Size (Pixels)</td></tr>\r\n <tr><td>@label</td><td>Mapping's Label Field</td></tr>\r\n </table>\r\n `;\n new Dialog({\n title: `Core Variables`,\n content: content11,\n buttons: {}\n }).render(true);\n }\n });\n return buttons11;\n }\n async close(options11 = {}) {\n super.close(options11);\n this._removePreviews();\n }\n _getSubmitData() {\n let formData11 = super._getSubmitData();\n formData11 = expandObject(formData11);\n if (!formData11.repeating) delete formData11.repeat;\n if (!formData11.text.repeating) delete formData11.text.repeat;\n if (formData11.shapes) {\n formData11.shapes = Object.values(formData11.shapes);\n formData11.shapes.forEach((shape11)=>{\n if (!shape11.repeating) delete shape11.repeat;\n });\n }\n if (formData11.interactivity) formData11.interactivity = Object.values(formData11.interactivity).map((e11)=>{\n e11.macro = e11.macro.trim();\n e11.script = e11.script.trim();\n if (e11.tmfxPreset) e11.tmfxPreset = e11.tmfxPreset.trim();\n if (e11.ceEffect) e11.ceEffect = e11.ceEffect.trim();\n return e11;\n }).filter((e11)=>e11.macro || e11.script || e11.ceEffect || e11.tmfxPreset);\n else formData11.interactivity = [];\n if (formData11.variables) {\n formData11.variables = Object.values(formData11.variables);\n formData11.variables = formData11.variables.filter((v11)=>v11.name.trim() && v11.value.trim());\n }\n if (formData11.limitedUsers) {\n if (getType(formData11.limitedUsers) === \"string\") formData11.limitedUsers = [\n formData11.limitedUsers\n ];\n formData11.limitedUsers = formData11.limitedUsers.filter((uid11)=>uid11);\n } else formData11.limitedUsers = [];\n formData11.limitOnEffect = formData11.limitOnEffect.trim();\n formData11.limitOnProperty = formData11.limitOnProperty.trim();\n if (formData11.parentID === \"TOKEN\") formData11.parentID = \"\";\n if (formData11.filter === \"OutlineOverlayFilter\" && \"filterOptions.outlineColor\" in formData11) formData11[\"filterOptions.outlineColor\"] = this._convertColor(formData11[\"filterOptions.outlineColor\"]);\n else if (formData11.filter === \"BevelFilter\") {\n if (\"filterOptions.lightColor\" in formData11) formData11[\"filterOptions.lightColor\"] = Number(Color.fromString(formData11[\"filterOptions.lightColor\"]));\n if (\"filterOptions.shadowColor\" in formData11) formData11[\"filterOptions.shadowColor\"] = Number(Color.fromString(formData11[\"filterOptions.shadowColor\"]));\n } else if ([\n \"DropShadowFilter\",\n \"GlowFilter\",\n \"OutlineFilter\",\n \"FilterFire\"\n ].includes(formData11.filter)) {\n if (\"filterOptions.color\" in formData11) formData11[\"filterOptions.color\"] = Number(Color.fromString(formData11[\"filterOptions.color\"]));\n }\n return formData11;\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event11, formData11) {\n if (this.callback) this.callback(formData11);\n }\n}\nconst FILTERS = {\n OutlineOverlayFilter: {\n defaultValues: {\n outlineColor: [\n 0,\n 0,\n 0,\n 1\n ],\n trueThickness: 1,\n animate: false\n },\n controls: [\n {\n type: \"color\",\n name: \"outlineColor\"\n },\n {\n type: \"range\",\n label: \"Thickness\",\n name: \"trueThickness\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"boolean\",\n label: \"Oscillate\",\n name: \"animate\"\n }\n ],\n argType: \"args\"\n },\n AlphaFilter: {\n defaultValues: {\n alpha: 1\n },\n controls: [\n {\n type: \"range\",\n name: \"alpha\",\n min: 0,\n max: 1,\n step: 0.01\n }\n ],\n argType: \"args\"\n },\n BlurFilter: {\n defaultValues: {\n strength: 8,\n quality: 4\n },\n controls: [\n {\n type: \"range\",\n name: \"strength\",\n min: 0,\n max: 20,\n step: 1\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 20,\n step: 1\n }\n ],\n argType: \"args\"\n },\n BlurFilterPass: {\n defaultValues: {\n horizontal: false,\n strength: 8,\n quality: 4\n },\n controls: [\n {\n type: \"boolean\",\n name: \"horizontal\"\n },\n {\n type: \"range\",\n name: \"strength\",\n min: 0,\n max: 20,\n step: 1\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 20,\n step: 1\n }\n ],\n argType: \"args\"\n },\n NoiseFilter: {\n defaultValues: {\n noise: 0.5,\n seed: 4475160954091\n },\n controls: [\n {\n type: \"range\",\n name: \"noise\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"seed\",\n min: 0,\n max: 100000,\n step: 1\n }\n ],\n argType: \"args\"\n },\n AdjustmentFilter: {\n defaultValues: {\n gamma: 1,\n saturation: 1,\n contrast: 1,\n brightness: 1,\n red: 1,\n green: 1,\n blue: 1,\n alpha: 1\n },\n controls: [\n {\n type: \"range\",\n name: \"gamma\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"saturation\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"contrast\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"brightness\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"red\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"green\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"blue\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"alpha\",\n min: 0,\n max: 1,\n step: 0.01\n }\n ],\n argType: \"options\"\n },\n AdvancedBloomFilter: {\n defaultValues: {\n threshold: 0.5,\n bloomScale: 1,\n brightness: 1,\n blur: 8,\n quality: 4\n },\n controls: [\n {\n type: \"range\",\n name: \"threshold\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"bloomScale\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"brightness\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"blur\",\n min: 0,\n max: 20,\n step: 1\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 20,\n step: 1\n }\n ],\n argType: \"options\"\n },\n AsciiFilter: {\n defaultValues: {\n size: 8\n },\n controls: [\n {\n type: \"range\",\n name: \"size\",\n min: 0,\n max: 20,\n step: 0.01\n }\n ],\n argType: \"args\"\n },\n BevelFilter: {\n defaultValues: {\n rotation: 45,\n thickness: 2,\n lightColor: 0xffffff,\n lightAlpha: 0.7,\n shadowColor: 0x000000,\n shadowAlpha: 0.7\n },\n controls: [\n {\n type: \"range\",\n name: \"rotation\",\n min: 0,\n max: 360,\n step: 1\n },\n {\n type: \"range\",\n name: \"thickness\",\n min: 0,\n max: 20,\n step: 0.01\n },\n {\n type: \"color\",\n name: \"lightColor\"\n },\n {\n type: \"range\",\n name: \"lightAlpha\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"color\",\n name: \"shadowColor\"\n },\n {\n type: \"range\",\n name: \"shadowAlpha\",\n min: 0,\n max: 1,\n step: 0.01\n }\n ],\n argType: \"options\"\n },\n BloomFilter: {\n defaultValues: {\n blur: 2,\n quality: 4\n },\n controls: [\n {\n type: \"range\",\n name: \"blur\",\n min: 0,\n max: 20,\n step: 1\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 20,\n step: 1\n }\n ],\n argType: \"args\"\n },\n BulgePinchFilter: {\n defaultValues: {\n radius: 100,\n strength: 1\n },\n controls: [\n {\n type: \"range\",\n name: \"radius\",\n min: 0,\n max: 500,\n step: 1\n },\n {\n type: \"range\",\n name: \"strength\",\n min: -1,\n max: 1,\n step: 0.01\n }\n ],\n argType: \"options\"\n },\n CRTFilter: {\n defaultValues: {\n curvature: 1,\n lineWidth: 1,\n lineContrast: 0.25,\n verticalLine: false,\n noise: 0.3,\n noiseSize: 1,\n seed: 0,\n vignetting: 0.3,\n vignettingAlpha: 1,\n vignettingBlur: 0.3,\n time: 0\n },\n controls: [\n {\n type: \"range\",\n name: \"curvature\",\n min: 0,\n max: 20,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"lineWidth\",\n min: 0,\n max: 20,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"lineContrast\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"boolean\",\n name: \"verticalLine\"\n },\n {\n type: \"range\",\n name: \"noise\",\n min: 0,\n max: 2,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"noiseSize\",\n min: 0,\n max: 20,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"seed\",\n min: 0,\n max: 100000,\n step: 1\n },\n {\n type: \"range\",\n name: \"vignetting\",\n min: 0,\n max: 20,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"vignettingAlpha\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"vignettingBlur\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"time\",\n min: 0,\n max: 10000,\n step: 1\n }\n ],\n argType: \"options\"\n },\n DotFilter: {\n defaultValues: {\n scale: 1,\n angle: 5\n },\n controls: [\n {\n type: \"range\",\n name: \"scale\",\n min: 0,\n max: 50,\n step: 1\n },\n {\n type: \"range\",\n name: \"angle\",\n min: 0,\n max: 360,\n step: 0.1\n }\n ],\n argType: \"args\"\n },\n DropShadowFilter: {\n defaultValues: {\n rotation: 45,\n distance: 5,\n color: 0x000000,\n alpha: 0.5,\n shadowOnly: false,\n blur: 2,\n quality: 3\n },\n controls: [\n {\n type: \"range\",\n name: \"rotation\",\n min: 0,\n max: 360,\n step: 0.1\n },\n {\n type: \"range\",\n name: \"distance\",\n min: 0,\n max: 100,\n step: 0.1\n },\n {\n type: \"color\",\n name: \"color\"\n },\n {\n type: \"range\",\n name: \"alpha\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"boolean\",\n name: \"shadowOnly\"\n },\n {\n type: \"range\",\n name: \"blur\",\n min: 0,\n max: 20,\n step: 0.1\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 20,\n step: 1\n }\n ],\n argType: \"options\"\n },\n EmbossFilter: {\n defaultValues: {\n strength: 5\n },\n controls: [\n {\n type: \"range\",\n name: \"strength\",\n min: 0,\n max: 20,\n step: 1\n }\n ],\n argType: \"args\"\n },\n GlitchFilter: {\n defaultValues: {\n slices: 5,\n offset: 100,\n direction: 0,\n fillMode: 0,\n seed: 0,\n average: false,\n minSize: 8,\n sampleSize: 512\n },\n controls: [\n {\n type: \"range\",\n name: \"slices\",\n min: 0,\n max: 50,\n step: 1\n },\n {\n type: \"range\",\n name: \"distance\",\n min: 0,\n max: 1000,\n step: 1\n },\n {\n type: \"range\",\n name: \"direction\",\n min: 0,\n max: 360,\n step: 0.1\n },\n {\n type: \"select\",\n name: \"fillMode\",\n options: [\n {\n value: 0,\n label: \"TRANSPARENT\"\n },\n {\n value: 1,\n label: \"ORIGINAL\"\n },\n {\n value: 2,\n label: \"LOOP\"\n },\n {\n value: 3,\n label: \"CLAMP\"\n },\n {\n value: 4,\n label: \"MIRROR\"\n }\n ]\n },\n {\n type: \"range\",\n name: \"seed\",\n min: 0,\n max: 10000,\n step: 1\n },\n {\n type: \"boolean\",\n name: \"average\"\n },\n {\n type: \"range\",\n name: \"minSize\",\n min: 0,\n max: 500,\n step: 1\n },\n {\n type: \"range\",\n name: \"sampleSize\",\n min: 0,\n max: 1024,\n step: 1\n }\n ],\n argType: \"options\"\n },\n GlowFilter: {\n defaultValues: {\n distance: 10,\n outerStrength: 4,\n innerStrength: 0,\n color: 0xffffff,\n quality: 0.1,\n knockout: false\n },\n controls: [\n {\n type: \"range\",\n name: \"distance\",\n min: 1,\n max: 50,\n step: 1\n },\n {\n type: \"range\",\n name: \"outerStrength\",\n min: 0,\n max: 20,\n step: 1\n },\n {\n type: \"range\",\n name: \"innerStrength\",\n min: 0,\n max: 20,\n step: 1\n },\n {\n type: \"color\",\n name: \"color\"\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 5,\n step: 0.1\n },\n {\n type: \"boolean\",\n name: \"knockout\"\n }\n ],\n argType: \"options\"\n },\n GodrayFilter: {\n defaultValues: {\n angle: 30,\n gain: 0.5,\n lacunarity: 2.5,\n parallel: true,\n time: 0,\n alpha: 1.0\n },\n controls: [\n {\n type: \"range\",\n name: \"angle\",\n min: 0,\n max: 360,\n step: 0.1\n },\n {\n type: \"range\",\n name: \"gain\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"lacunarity\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"boolean\",\n name: \"parallel\"\n },\n {\n type: \"range\",\n name: \"time\",\n min: 0,\n max: 10000,\n step: 1\n },\n {\n type: \"range\",\n name: \"alpha\",\n min: 0,\n max: 1,\n step: 0.01\n }\n ],\n argType: \"options\"\n },\n KawaseBlurFilter: {\n defaultValues: {\n blur: 4,\n quality: 3,\n clamp: false\n },\n controls: [\n {\n type: \"range\",\n name: \"blur\",\n min: 0,\n max: 20,\n step: 0.1\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 20,\n step: 1\n },\n {\n type: \"boolean\",\n name: \"clamp\"\n }\n ],\n argType: \"args\"\n },\n OldFilmFilter: {\n defaultValues: {\n sepia: 0.3,\n noise: 0.3,\n noiseSize: 1.0,\n scratch: 0.5,\n scratchDensity: 0.3,\n scratchWidth: 1.0,\n vignetting: 0.3,\n vignettingAlpha: 1.0,\n vignettingBlur: 0.3\n },\n controls: [\n {\n type: \"range\",\n name: \"sepia\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"noise\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"noiseSize\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"scratch\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"scratchDensity\",\n min: 0,\n max: 5,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"scratchWidth\",\n min: 0,\n max: 20,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"vignetting\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"vignettingAlpha\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"vignettingBlur\",\n min: 0,\n max: 5,\n step: 0.01\n }\n ],\n argType: \"options\"\n },\n OutlineFilter: {\n defaultValues: {\n thickness: 1,\n color: 0x000000,\n quality: 0.1\n },\n controls: [\n {\n type: \"range\",\n name: \"thickness\",\n min: 0,\n max: 20,\n step: 0.1\n },\n {\n type: \"color\",\n name: \"color\"\n },\n {\n type: \"range\",\n name: \"quality\",\n min: 0,\n max: 1,\n step: 0.01\n }\n ],\n argType: \"args\"\n },\n PixelateFilter: {\n defaultValues: {\n size: 1\n },\n controls: [\n {\n type: \"range\",\n name: \"size\",\n min: 1,\n max: 100,\n step: 1\n }\n ],\n argType: \"args\"\n },\n RGBSplitFilter: {\n defaultValues: {\n red: [\n -10,\n 0\n ],\n green: [\n 0,\n 10\n ],\n blue: [\n 0,\n 0\n ]\n },\n controls: [\n {\n type: \"point\",\n name: \"red\",\n min: 0,\n max: 50,\n step: 1\n },\n {\n type: \"point\",\n name: \"green\",\n min: 0,\n max: 50,\n step: 1\n },\n {\n type: \"point\",\n name: \"blue\",\n min: 0,\n max: 50,\n step: 1\n }\n ],\n argType: \"args\"\n },\n RadialBlurFilter: {\n defaultValues: {\n angle: 0,\n center: [\n 0,\n 0\n ],\n radius: -1\n },\n controls: [\n {\n type: \"range\",\n name: \"angle\",\n min: 0,\n max: 360,\n step: 1\n },\n {\n type: \"point\",\n name: \"center\",\n min: 0,\n max: 1000,\n step: 1\n },\n {\n type: \"range\",\n name: \"radius\",\n min: -1,\n max: 1000,\n step: 1\n }\n ],\n argType: \"args\"\n },\n ReflectionFilter: {\n defaultValues: {\n mirror: true,\n boundary: 0.5,\n amplitude: [\n 0,\n 20\n ],\n waveLength: [\n 30,\n 100\n ],\n alpha: [\n 1,\n 1\n ],\n time: 0\n },\n controls: [\n {\n type: \"boolean\",\n name: \"mirror\"\n },\n {\n type: \"range\",\n name: \"boundary\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"point\",\n name: \"amplitude\",\n min: 0,\n max: 100,\n step: 1\n },\n {\n type: \"point\",\n name: \"waveLength\",\n min: 0,\n max: 500,\n step: 1\n },\n {\n type: \"point\",\n name: \"alpha\",\n min: 0,\n max: 1,\n step: 0.01\n },\n {\n type: \"range\",\n name: \"time\",\n min: 0,\n max: 10000,\n step: 1\n }\n ],\n argType: \"options\"\n },\n DisplacementFilter: {\n defaultValues: {\n sprite: \"\",\n textureScale: 1,\n displacementScale: 1\n },\n controls: [\n {\n type: \"text\",\n name: \"sprite\"\n },\n {\n type: \"range\",\n name: \"textureScale\",\n min: 0,\n max: 100,\n step: 0.1\n },\n {\n type: \"range\",\n name: \"displacementScale\",\n min: 0,\n max: 100,\n step: 0.1\n }\n ],\n argType: \"options\"\n },\n \"Token Magic FX\": {\n defaultValues: {\n params: []\n },\n controls: [\n {\n type: \"tmfxPreset\",\n name: \"tmfxPreset\"\n },\n {\n type: \"json\",\n name: \"params\"\n }\n ]\n }\n};\nfunction genFilterOptionControls(filterName11, filterOptions11 = {}) {\n if (!(filterName11 in FILTERS)) return;\n const options11 = mergeObject(FILTERS[filterName11].defaultValues, filterOptions11);\n const values11 = getControlValues(filterName11, options11);\n const controls11 = FILTERS[filterName11].controls;\n let controlsHTML11 = \"<fieldset><legend>Options</legend>\";\n for (const control11 of controls11)controlsHTML11 += genControl(control11, values11);\n controlsHTML11 += \"</fieldset>\";\n return controlsHTML11;\n}\nfunction getControlValues(filterName11, options11) {\n if (filterName11 === \"OutlineOverlayFilter\") options11.outlineColor = Color.fromRGB(options11.outlineColor).toString();\n else if (filterName11 === \"BevelFilter\") {\n options11.lightColor = Color.from(options11.lightColor).toString();\n options11.shadowColor = Color.from(options11.shadowColor).toString();\n } else if ([\n \"DropShadowFilter\",\n \"GlowFilter\",\n \"OutlineFilter\"\n ].includes(filterName11)) options11.color = Color.from(options11.color).toString();\n return options11;\n}\nfunction genControl(control11, values11) {\n const val11 = values11[control11.name];\n const name11 = control11.name;\n const label11 = control11.label ?? name11.charAt(0).toUpperCase() + name11.slice(1);\n const type11 = control11.type;\n if (type11 === \"color\") return `\r\n<div class=\"form-group\">\r\n <label>${label11}</label>\r\n <div class=\"form-fields\">\r\n <input class=\"color\" type=\"text\" name=\"filterOptions.${name11}\" value=\"${val11}\">\r\n <input type=\"color\" value=\"${val11}\" data-edit=\"filterOptions.${name11}\">\r\n </div>\r\n</div>\r\n`;\n else if (type11 === \"range\") return `\r\n<div class=\"form-group\">\r\n <label>${label11}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"range\" name=\"filterOptions.${name11}\" value=\"${val11}\" min=\"${control11.min}\" max=\"${control11.max}\" step=\"${control11.step}\">\r\n <span class=\"range-value\">${val11}</span>\r\n </div>\r\n</div>\r\n`;\n else if (type11 === \"boolean\") return `\r\n<div class=\"form-group\">\r\n <label>${label11}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"filterOptions.${name11}\" data-dtype=\"Boolean\" value=\"${val11}\" ${val11 ? \"checked\" : \"\"}>\r\n </div>\r\n</div>\r\n `;\n else if (type11 === \"select\") {\n let select11 = `\r\n <div class=\"form-group\">\r\n <label>${label11}</label>\r\n <div class=\"form-fields\">\r\n <select name=\"${name11}\">\r\n`;\n for (const opt11 of control11.options)select11 += `<option value=\"${opt11.value}\" ${val11 === opt11.value ? 'selected=\"selected\"' : \"\"}>${opt11.label}</option>`;\n select11 += `</select></div></div>`;\n return select11;\n } else if (type11 === \"point\") return `\r\n<div class=\"form-group\">\r\n <label>${label11}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"range\" name=\"filterOptions.${name11}\" value=\"${val11[0]}\" min=\"${control11.min}\" max=\"${control11.max}\" step=\"${control11.step}\">\r\n <span class=\"range-value\">${val11[0]}</span>\r\n </div>\r\n <div class=\"form-fields\">\r\n <input type=\"range\" name=\"filterOptions.${name11}\" value=\"${val11[1]}\" min=\"${control11.min}\" max=\"${control11.max}\" step=\"${control11.step}\">\r\n <span class=\"range-value\">${val11[1]}</span>\r\n </div>\r\n</div>\r\n`;\n else if (type11 === \"json\") {\n let control11 = `\r\n<div class=\"form-group\">\r\n <label>${label11}</label>\r\n <div class=\"form-fields\">\r\n <textarea style=\"width: 450px; height: 200px;\" name=\"filterOptions.${name11}\">${val11}</textarea>\r\n </div>`;\n if (game.modules.get(\"multi-token-edit\")?.api.showGenericForm) control11 += `\r\n <div style=\"text-align: right; color: orangered;\">\r\n <a> <i class=\"me-edit-json fas fa-edit\" title=\"Show Generic Form\"></i></a>\r\n </div>`;\n control11 += `</div>`;\n return control11;\n } else if (type11 === \"text\") return `\r\n<div class=\"form-group\">\r\n <label>${label11}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"filterOptions.${name11}\" value=\"${val11}\">\r\n </div>\r\n</div>\r\n`;\n else if (type11 === \"tmfxPreset\" && game.modules.get(\"tokenmagic\")?.active) return `\r\n <div class=\"form-group\">\r\n <label>Preset <span class=\"units\">(TMFX)</span></label>\r\n <div class=\"form-fields\">\r\n <input list=\"tmfxPresets\" class=\"tmfxPreset\">\r\n <button type=\"button\" class=\"presetImport\"><i class=\"fas fa-download\"></i></button>\r\n </div>\r\n `;\n return \"\";\n}\nasync function promptParamChoice(params11) {\n return new Promise((resolve11, reject11)=>{\n const buttons11 = {};\n for(let i31 = 0; i31 < params11.length; i31++){\n const label11 = params11[i31].filterType ?? params11[i31].filterId;\n buttons11[label11] = {\n label: label11,\n callback: ()=>{\n resolve11(i31);\n }\n };\n }\n const dialog11 = new Dialog({\n title: \"Select Filter To Edit\",\n content: \"\",\n buttons: buttons11,\n close: ()=>resolve11(-1)\n });\n dialog11.render(true);\n });\n}\n\n});\nparcelRequire.register(\"ce8jp\", function(module, exports) {\n\n$parcel$export(module.exports, \"DEFAULT_ACTIVE_EFFECT_CONFIG\", () => $8e6d3d7077a33868$export$49d6e2dab8292a11);\n$parcel$export(module.exports, \"DEFAULT_OVERLAY_CONFIG\", () => $8e6d3d7077a33868$export$c702aa0e0c4769fd);\n$parcel$export(module.exports, \"OVERLAY_SHAPES\", () => $8e6d3d7077a33868$export$7ce049e9aaa9e189);\n$parcel$export(module.exports, \"CORE_SHAPE\", () => $8e6d3d7077a33868$export$90019cfa1f313e2c);\nconst $8e6d3d7077a33868$export$49d6e2dab8292a11 = {\n id: \"\",\n label: \"\",\n expression: \"\",\n codeExp: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: null,\n overlay: false,\n alwaysOn: false,\n tokens: undefined,\n disabled: false,\n overlayConfig: null,\n targetActors: null,\n group: \"Default\"\n};\nconst $8e6d3d7077a33868$export$c702aa0e0c4769fd = {\n img: \"\",\n imgLinked: false,\n alpha: 1,\n scaleX: 1,\n scaleY: 1,\n offsetX: 0,\n offsetY: 0,\n angle: 0,\n filter: \"NONE\",\n filterOptions: {},\n inheritTint: false,\n top: false,\n bottom: false,\n underlay: false,\n linkRotation: true,\n linkMirror: true,\n linkOpacity: false,\n linkScale: true,\n linkDimensionX: false,\n linkDimensionY: false,\n linkStageScale: false,\n mirror: false,\n tint: null,\n loop: true,\n playOnce: false,\n animation: {\n rotate: false,\n duration: 5000,\n clockwise: true,\n relative: false\n },\n limitedUsers: [],\n limitedToOwner: false,\n limitOnProperty: \"\",\n alwaysVisible: false,\n text: {\n text: \"\",\n align: CONFIG.canvasTextStyle.align,\n fontSize: CONFIG.canvasTextStyle.fontSize,\n fontFamily: CONFIG.canvasTextStyle.fontFamily,\n fill: CONFIG.canvasTextStyle.fill,\n dropShadow: CONFIG.canvasTextStyle.dropShadow,\n strokeThickness: CONFIG.canvasTextStyle.strokeThickness,\n stroke: CONFIG.canvasTextStyle.stroke,\n curve: {\n angle: 0,\n radius: 0,\n invert: false\n },\n letterSpacing: CONFIG.canvasTextStyle.letterSpacing,\n repeating: false,\n wordWrap: false,\n wordWrapWidth: 200,\n breakWords: false,\n maxHeight: 0\n },\n parentID: \"\",\n id: null,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n shapes: [],\n variables: [],\n interactivity: [],\n ui: false\n};\nconst $8e6d3d7077a33868$export$7ce049e9aaa9e189 = {\n Rectangle: {\n type: \"rectangle\",\n x: 0,\n y: 0,\n width: 100,\n height: 100,\n radius: 0,\n repeating: false\n },\n Ellipse: {\n type: \"ellipse\",\n x: 0,\n y: 0,\n width: 50,\n height: 50,\n repeating: false\n },\n Polygon: {\n type: \"polygon\",\n x: 0,\n y: 0,\n points: \"0,1,0.95,0.31,0.59,-0.81,-0.59,-0.81,-0.95,0.31\",\n scale: 50,\n repeating: false\n },\n Torus: {\n type: \"torus\",\n x: 0,\n y: 0,\n innerRadius: 50,\n outerRadius: 100,\n startAngle: 0,\n endAngle: 180,\n repeating: false\n }\n};\nconst $8e6d3d7077a33868$export$90019cfa1f313e2c = {\n line: {\n width: 1,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#ffffff\",\n color2: \"\",\n prc: \"\",\n alpha: 1\n }\n};\n\n});\n\nparcelRequire.register(\"dmUqi\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerEffectMappingHooks\", () => registerEffectMappingHooks);\n$parcel$export(module.exports, \"updateWithEffectMapping\", () => updateWithEffectMapping);\n$parcel$export(module.exports, \"getTokenEffects\", () => getTokenEffects);\n$parcel$export(module.exports, \"getAllEffectMappings\", () => getAllEffectMappings);\n$parcel$export(module.exports, \"setOverlayVisibility\", () => setOverlayVisibility);\n$parcel$export(module.exports, \"toggleTemplate\", () => toggleTemplate);\n$parcel$export(module.exports, \"toggleTemplateOnSelected\", () => toggleTemplateOnSelected);\n$parcel$export(module.exports, \"getTokenHP\", () => getTokenHP);\n$parcel$export(module.exports, \"VALID_EXPRESSION\", () => VALID_EXPRESSION);\n$parcel$export(module.exports, \"evaluateComparator\", () => evaluateComparator);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $bFZU7 = parcelRequire(\"bFZU7\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\n\nvar $hClLE = parcelRequire(\"hClLE\");\nconst EXPRESSION_MATCH_RE = /(\\\\\\()|(\\\\\\))|(\\|\\|)|(\\&\\&)|(\\\\\\!)/g;\nconst PF2E_ITEM_TYPES = [\n \"condition\",\n \"effect\",\n \"weapon\",\n \"equipment\"\n];\nconst ITEM_TYPES = [\n \"equipment\",\n \"weapon\"\n];\nconst feature_id = \"EffectMappings\";\nfunction registerEffectMappingHooks() {\n if (!(0, $9IngI.FEATURE_CONTROL)[feature_id]) {\n [\n \"canvasReady\",\n \"createActiveEffect\",\n \"deleteActiveEffect\",\n \"preUpdateActiveEffect\",\n \"updateActiveEffect\",\n \"createCombatant\",\n \"deleteCombatant\",\n \"preUpdateCombat\",\n \"updateCombat\",\n \"deleteCombat\",\n \"preUpdateToken\",\n \"preUpdateActor\",\n \"updateActor\",\n \"updateToken\",\n \"createToken\",\n \"preUpdateItem\",\n \"updateItem\",\n \"createItem\",\n \"deleteItem\"\n ].forEach((name11)=>(0, $e9LRe.unregisterHook)(feature_id, name11));\n return;\n }\n if (game.user.isGM) {\n (0, $e9LRe.registerHook)(feature_id, \"canvasReady\", _refreshTokenMappings);\n _refreshTokenMappings();\n }\n (0, $e9LRe.registerHook)(feature_id, \"createActiveEffect\", (activeEffect11, options11, userId11)=>{\n if (!activeEffect11.parent || activeEffect11.disabled || game.userId !== userId11) return;\n const effectName11 = activeEffect11.name ?? activeEffect11.label;\n _updateImageOnEffectChange(effectName11, activeEffect11.parent, true);\n });\n (0, $e9LRe.registerHook)(feature_id, \"deleteActiveEffect\", (activeEffect11, options11, userId11)=>{\n if (!activeEffect11.parent || activeEffect11.disabled || game.userId !== userId11) return;\n const effectName11 = activeEffect11.name ?? activeEffect11.label;\n _updateImageOnEffectChange(effectName11, activeEffect11.parent, false);\n });\n (0, $e9LRe.registerHook)(feature_id, \"preUpdateActiveEffect\", _preUpdateActiveEffect);\n (0, $e9LRe.registerHook)(feature_id, \"updateActiveEffect\", _updateActiveEffect);\n (0, $e9LRe.registerHook)(feature_id, \"preUpdateToken\", _preUpdateToken);\n (0, $e9LRe.registerHook)(feature_id, \"preUpdateActor\", _preUpdateActor);\n (0, $e9LRe.registerHook)(feature_id, \"updateActor\", _updateActor);\n (0, $e9LRe.registerHook)(feature_id, \"updateToken\", _updateToken);\n (0, $e9LRe.registerHook)(feature_id, \"createToken\", _createToken);\n (0, $e9LRe.registerHook)(feature_id, \"createCombatant\", _createCombatant);\n (0, $e9LRe.registerHook)(feature_id, \"deleteCombatant\", (combatant11, options11, userId11)=>{\n if (game.userId !== userId11) return;\n _deleteCombatant(combatant11);\n });\n (0, $e9LRe.registerHook)(feature_id, \"preUpdateCombat\", _preUpdateCombat);\n (0, $e9LRe.registerHook)(feature_id, \"updateCombat\", _updateCombat);\n (0, $e9LRe.registerHook)(feature_id, \"deleteCombat\", (combat11, options11, userId11)=>{\n if (game.userId !== userId11) return;\n combat11.combatants.forEach((combatant11)=>{\n _deleteCombatant(combatant11);\n });\n });\n const applicable_item_types11 = game.system.id === \"pf2e\" ? PF2E_ITEM_TYPES : ITEM_TYPES;\n // Want to track condition/effect previous name so that the config can be reverted for it\n (0, $e9LRe.registerHook)(feature_id, \"preUpdateItem\", (item11, change11, options11, userId11)=>{\n if (game.user.id === userId11 && applicable_item_types11.includes(item11.type)) options11[\"token-variants-old-name\"] = item11.name;\n _preUpdateAssign(item11.parent, change11, options11);\n });\n (0, $e9LRe.registerHook)(feature_id, \"createItem\", (item11, options11, userId11)=>{\n if (game.userId !== userId11 || !applicable_item_types11.includes(item11.type) || !item11.parent) return;\n _updateImageOnEffectChange(item11.name, item11.parent, true);\n });\n (0, $e9LRe.registerHook)(feature_id, \"deleteItem\", (item11, options11, userId11)=>{\n if (game.userId !== userId11 || !applicable_item_types11.includes(item11.type) || !item11.parent || item11.disabled) return;\n _updateImageOnEffectChange(item11.name, item11.parent, false);\n });\n // Status Effects can be applied \"stealthily\" on item equip/un-equip\n (0, $e9LRe.registerHook)(feature_id, \"updateItem\", _updateItem);\n}\nasync function _refreshTokenMappings() {\n for (const tkn11 of canvas.tokens.placeables)await updateWithEffectMapping(tkn11);\n}\nfunction _createCombatant(combatant11, options11, userId11) {\n if (game.userId !== userId11) return;\n const token11 = combatant11._token || canvas.tokens.get(combatant11.tokenId);\n if (!token11 || !token11.actor) return;\n updateWithEffectMapping(token11, {\n added: [\n \"token-variants-combat\"\n ]\n });\n}\nfunction _preUpdateActiveEffect(activeEffect11, change11, options11, userId11) {\n if (!activeEffect11.parent || game.userId !== userId11) return;\n if (\"label\" in change11) options11[\"token-variants-old-name\"] = activeEffect11.label;\n}\nfunction _updateActiveEffect(activeEffect11, change11, options11, userId11) {\n if (!activeEffect11.parent || game.userId !== userId11) return;\n const added11 = [];\n const removed11 = [];\n if (\"disabled\" in change11) {\n if (change11.disabled) removed11.push(activeEffect11.label);\n else added11.push(activeEffect11.label);\n }\n if (\"label\" in change11) {\n removed11.push(options11[\"token-variants-old-name\"]);\n added11.push(change11.label);\n }\n if (added11.length || removed11.length) _updateImageOnMultiEffectChange(activeEffect11.parent, added11, removed11);\n}\nfunction _preUpdateToken(token11, change11, options11, userId11) {\n if (game.user.id !== userId11 || change11.actorId) return;\n const preUpdateEffects11 = getTokenEffects(token11, true);\n if (preUpdateEffects11.length) setProperty(options11, \"token-variants.preUpdateEffects\", preUpdateEffects11);\n if (game.system.id === \"dnd5e\" && token11.actor?.isPolymorphed) setProperty(options11, \"token-variants.wasPolymorphed\", true);\n}\nasync function _updateToken(token11, change11, options11, userId11) {\n if (game.user.id !== userId11 || change11.actorId) return;\n // TODO\n token11.object?.tvaOverlays?.forEach((ov11)=>ov11.htmlOverlay?.render());\n const addedEffects11 = [];\n const removedEffects11 = [];\n const preUpdateEffects11 = getProperty(options11, \"token-variants.preUpdateEffects\") || [];\n const postUpdateEffects11 = getTokenEffects(token11, true);\n (0, $eeGZt.determineAddedRemovedEffects)(addedEffects11, removedEffects11, postUpdateEffects11, preUpdateEffects11);\n if (addedEffects11.length || removedEffects11.length || \"actorLink\" in change11) updateWithEffectMapping(token11, {\n added: addedEffects11,\n removed: removedEffects11\n });\n else if (getProperty(options11, \"token-variants.wasPolymorphed\") && !token11.actor?.isPolymorphed) updateWithEffectMapping(token11);\n if (game.userId === userId11 && \"hidden\" in change11) updateWithEffectMapping(token11, {\n added: change11.hidden ? [\n \"token-variants-visibility\"\n ] : [],\n removed: !change11.hidden ? [\n \"token-variants-visibility\"\n ] : []\n });\n}\nfunction _preUpdateActor(actor11, change11, options11, userId11) {\n if (game.user.id !== userId11) return;\n _preUpdateAssign(actor11, change11, options11);\n}\nasync function _updateActor(actor11, change11, options11, userId11) {\n if (game.user.id !== userId11) return;\n if (\"flags\" in change11 && \"token-variants\" in change11.flags) {\n const tokenVariantFlags11 = change11.flags[\"token-variants\"];\n if (\"effectMappings\" in tokenVariantFlags11 || \"-=effectMappings\" in tokenVariantFlags11) {\n const tokens11 = actor11.token ? [\n actor11.token\n ] : (0, $eeGZt.getAllActorTokens)(actor11, true, !(0, $9IngI.TVA_CONFIG).mappingsCurrentSceneOnly);\n tokens11.forEach((tkn11)=>updateWithEffectMapping(tkn11));\n for (const tkn11 of tokens11)if (tkn11.object && (0, $9IngI.TVA_CONFIG).filterEffectIcons) await tkn11.object.drawEffects();\n }\n }\n _preUpdateCheck(actor11, options11);\n}\nfunction _preUpdateAssign(actor11, change11, options11) {\n if (!actor11) return;\n // Determine which comparators are applicable so that we can compare after the\n // actor update\n const tokens11 = actor11.token ? [\n actor11.token\n ] : (0, $eeGZt.getAllActorTokens)(actor11, true, !(0, $9IngI.TVA_CONFIG).mappingsCurrentSceneOnly);\n if ((0, $9IngI.TVA_CONFIG).internalEffects.hpChange.enabled && tokens11.length) applyHpChangeEffect(actor11, change11, tokens11);\n for (const tkn11 of tokens11){\n const preUpdateEffects11 = getTokenEffects(tkn11, true);\n if (preUpdateEffects11.length) setProperty(options11, \"token-variants.\" + tkn11.id + \".preUpdateEffects\", preUpdateEffects11);\n }\n}\nfunction _preUpdateCheck(actor11, options11, pAdded11 = [], pRemoved11 = []) {\n if (!actor11) return;\n const tokens11 = actor11.token ? [\n actor11.token\n ] : (0, $eeGZt.getAllActorTokens)(actor11, true, !(0, $9IngI.TVA_CONFIG).mappingsCurrentSceneOnly);\n for (const tkn11 of tokens11){\n // Check if effects changed by comparing them against the ones calculated in preUpdate*\n const added11 = [\n ...pAdded11\n ];\n const removed11 = [\n ...pRemoved11\n ];\n const postUpdateEffects11 = getTokenEffects(tkn11, true);\n const preUpdateEffects11 = getProperty(options11, \"token-variants.\" + tkn11.id + \".preUpdateEffects\") ?? [];\n (0, $eeGZt.determineAddedRemovedEffects)(added11, removed11, postUpdateEffects11, preUpdateEffects11);\n if (added11.length || removed11.length) updateWithEffectMapping(tkn11, {\n added: added11,\n removed: removed11\n });\n }\n}\nfunction _createToken(token11, options11, userId11) {\n if (userId11 && userId11 === game.user.id) updateWithEffectMapping(token11);\n}\nfunction _preUpdateCombat(combat11, round11, options11, userId11) {\n if (game.userId !== userId11) return;\n options11[\"token-variants\"] = {\n combatantId: combat11?.combatant?.token?.id,\n nextCombatantId: combat11?.nextCombatant?.token?.id\n };\n}\nfunction _updateCombat(combat11, round11, options11, userId11) {\n if (game.userId !== userId11) return;\n const previousCombatantId11 = options11[\"token-variants\"]?.combatantId;\n const previousNextCombatantId11 = options11[\"token-variants\"]?.nextCombatantId;\n const currentCombatantId11 = combat11?.combatant?.token?.id;\n const currentNextCombatantId11 = combat11?.nextCombatant?.token?.id;\n const updateCombatant11 = function(id11, added11 = [], removed11 = []) {\n if (game.user.isGM) {\n const token11 = canvas.tokens.get(id11);\n if (token11) updateWithEffectMapping(token11, {\n added: added11,\n removed: removed11\n });\n } else {\n const message11 = {\n handlerName: \"effectMappings\",\n args: {\n tokenId: id11,\n sceneId: canvas.scene.id,\n added: added11,\n removed: removed11\n },\n type: \"UPDATE\"\n };\n game.socket?.emit(\"module.token-variants\", message11);\n }\n };\n if (previousCombatantId11 !== currentCombatantId11) {\n if (previousCombatantId11) updateCombatant11(previousCombatantId11, [], [\n \"combat-turn\"\n ]);\n if (currentCombatantId11) updateCombatant11(currentCombatantId11, [\n \"combat-turn\"\n ], []);\n }\n if (previousNextCombatantId11 !== currentNextCombatantId11) {\n if (previousNextCombatantId11) updateCombatant11(previousNextCombatantId11, [], [\n \"combat-turn-next\"\n ]);\n if (currentNextCombatantId11) updateCombatant11(currentNextCombatantId11, [\n \"combat-turn-next\"\n ], []);\n }\n}\nfunction _updateItem(item11, change11, options11, userId11) {\n const added11 = [];\n const removed11 = [];\n if (game.user.id === userId11) {\n // Handle condition/effect name change\n if (options11[\"token-variants-old-name\"] !== item11.name) {\n added11.push(item11.name);\n removed11.push(options11[\"token-variants-old-name\"]);\n }\n _preUpdateCheck(item11.parent, options11, added11, removed11);\n }\n}\nlet EFFECT_M_QUEUES = {};\nlet EFFECT_M_TIMER;\nasync function updateWithEffectMapping(token11, { added: added11 = [], removed: removed11 = [] } = {}) {\n const callUpdateWithEffectMapping11 = function() {\n for (const id11 of Object.keys(EFFECT_M_QUEUES)){\n const m11 = EFFECT_M_QUEUES[id11];\n _updateWithEffectMapping(m11.token, m11.opts.added, m11.opts.removed);\n }\n EFFECT_M_QUEUES = {};\n };\n clearTimeout(EFFECT_M_TIMER);\n if (token11.id in EFFECT_M_QUEUES) {\n const opts11 = EFFECT_M_QUEUES[token11.id].opts;\n added11.forEach((a11)=>opts11.added.add(a11));\n removed11.forEach((a11)=>opts11.removed.add(a11));\n } else EFFECT_M_QUEUES[token11.id] = {\n token: token11,\n opts: {\n added: new Set(added11),\n removed: new Set(removed11)\n }\n };\n EFFECT_M_TIMER = setTimeout(callUpdateWithEffectMapping11, 100);\n}\nasync function _updateWithEffectMapping(token11, added11, removed11) {\n const placeable11 = token11.object ?? token11._object ?? token11;\n token11 = token11.document ?? token11;\n const tokenImgName11 = token11.getFlag(\"token-variants\", \"name\") || (0, $eeGZt.getFileName)(token11.texture.src);\n let tokenDefaultImg11 = token11.getFlag(\"token-variants\", \"defaultImg\");\n const animate11 = !(0, $9IngI.TVA_CONFIG).disableTokenUpdateAnimation;\n const tokenUpdateObj11 = {};\n const hadActiveHUD11 = token11.object?.hasActiveHUD;\n const toggleStatus11 = canvas.tokens.hud.object?.id === token11.id ? canvas.tokens.hud._statusEffects : false;\n let effects11 = getTokenEffects(token11);\n // If effect is included in `added` or `removed` we need to:\n // 1. Insert it into `effects` if it's not there in case of 'added' and place it on top of the list\n // 2. Remove it in case of 'removed'\n for (const ef31 of added11){\n const i31 = effects11.findIndex((s11)=>s11 === ef31);\n if (i31 === -1) effects11.push(ef31);\n else if (i31 < effects11.length - 1) {\n effects11.splice(i31, 1);\n effects11.push(ef31);\n }\n }\n for (const ef31 of removed11){\n const i31 = effects11.findIndex((s11)=>s11 === ef31);\n if (i31 !== -1) effects11.splice(i31, 1);\n }\n const mappings11 = getAllEffectMappings(token11);\n // 3. Configurations may contain effect names in a form of a logical expressions\n // We need to evaluate them and insert them into effects/added/removed if needed\n for (const mapping11 of mappings11)evaluateMappingExpression(mapping11, effects11, token11, added11, removed11);\n // Accumulate all scripts that will need to be run after the update\n const executeOnCallback11 = [];\n const deferredUpdateScripts11 = [];\n for (const ef31 of removed11){\n const script11 = mappings11.find((m11)=>m11.id === ef31)?.config?.tv_script;\n if (script11) {\n if (script11.onRemove) {\n if (script11.onRemove.includes(\"tvaUpdate\")) deferredUpdateScripts11.push(script11.onRemove);\n else executeOnCallback11.push({\n script: script11.onRemove,\n token: token11\n });\n }\n if (script11.tmfxPreset) executeOnCallback11.push({\n tmfxPreset: script11.tmfxPreset,\n token: token11,\n action: \"remove\"\n });\n if (script11.ceEffect?.name) executeOnCallback11.push({\n ceEffect: script11.ceEffect,\n token: token11,\n action: \"remove\"\n });\n if (script11.macroOnApply) executeOnCallback11.push({\n macro: script11.macroOnApply,\n token: token11\n });\n }\n }\n for (const ef31 of added11){\n const script11 = mappings11.find((m11)=>m11.id === ef31)?.config?.tv_script;\n if (script11) {\n if (script11.onApply) {\n if (script11.onApply.includes(\"tvaUpdate\")) deferredUpdateScripts11.push(script11.onApply);\n else executeOnCallback11.push({\n script: script11.onApply,\n token: token11\n });\n }\n if (script11.tmfxPreset) executeOnCallback11.push({\n tmfxPreset: script11.tmfxPreset,\n token: token11,\n action: \"apply\"\n });\n if (script11.ceEffect?.name) executeOnCallback11.push({\n ceEffect: script11.ceEffect,\n token: token11,\n action: \"apply\"\n });\n if (script11.macroOnRemove) executeOnCallback11.push({\n macro: script11.macroOnRemove,\n token: token11\n });\n }\n }\n // Next we're going to determine what configs need to be applied and in what order\n // Filter effects that do not have a mapping and sort based on priority\n effects11 = mappings11.filter((m11)=>effects11.includes(m11.id)).sort((ef111, ef211)=>ef111.priority - ef211.priority);\n // Check if image update should be prevented based on module settings\n let disableImageUpdate11 = false;\n if ((0, $9IngI.TVA_CONFIG).disableImageChangeOnPolymorphed && token11.actor?.isPolymorphed) disableImageUpdate11 = true;\n else if ((0, $9IngI.TVA_CONFIG).disableImageUpdateOnNonPrototype && token11.actor?.prototypeToken?.texture?.src !== token11.texture.src) {\n disableImageUpdate11 = true;\n const tknImg11 = token11.texture.src;\n for (const m11 of mappings11)if (m11.imgSrc === tknImg11) {\n disableImageUpdate11 = false;\n break;\n }\n }\n if (disableImageUpdate11) tokenDefaultImg11 = \"\";\n let updateCall11;\n if (effects11.length > 0) {\n // Some effect mappings may not have images, find a mapping with one if it exists\n const newImg11 = {\n imgSrc: \"\",\n imgName: \"\"\n };\n if (!disableImageUpdate11) {\n for(let i31 = effects11.length - 1; i31 >= 0; i31--)if (effects11[i31].imgSrc) {\n let iSrc11 = effects11[i31].imgSrc;\n if (iSrc11.includes(\"*\") || iSrc11.includes(\"{\") && iSrc11.includes(\"}\")) // wildcard image, if this effect hasn't been newly applied we do not want to randomize the image again\n {\n if (!added11.has(effects11[i31].overlayConfig?.effect)) {\n newImg11.imgSrc = token11.texture.src;\n newImg11.imgName = (0, $eeGZt.getFileName)(newImg11.imgSrc);\n break;\n }\n }\n newImg11.imgSrc = effects11[i31].imgSrc;\n newImg11.imgName = effects11[i31].imgName;\n break;\n }\n }\n // Collect custom configs to be applied to the token\n let config11;\n if ((0, $9IngI.TVA_CONFIG).stackStatusConfig) {\n config11 = {};\n for (const ef31 of effects11)config11 = mergeObject(config11, ef31.config);\n } else {\n for(let i31 = effects11.length - 1; i31 >= 0; i31--)if (effects11[i31].config && Object.keys(effects11[i31].config).length !== 0) {\n config11 = effects11[i31].config;\n break;\n }\n }\n // Use or update the default (original) token image\n if (!newImg11.imgSrc && tokenDefaultImg11) {\n delete tokenUpdateObj11.flags?.[\"token-variants\"]?.defaultImg;\n setProperty(tokenUpdateObj11, \"flags.token-variants.-=defaultImg\", null);\n newImg11.imgSrc = tokenDefaultImg11.imgSrc;\n newImg11.imgName = tokenDefaultImg11.imgName;\n } else if (!tokenDefaultImg11 && newImg11.imgSrc) setProperty(tokenUpdateObj11, \"flags.token-variants.defaultImg\", {\n imgSrc: token11.texture.src,\n imgName: tokenImgName11\n });\n updateCall11 = ()=>(0, $eeGZt.updateTokenImage)(newImg11.imgSrc ?? null, {\n token: token11,\n imgName: newImg11.imgName ? newImg11.imgName : tokenImgName11,\n tokenUpdate: tokenUpdateObj11,\n callback: _postTokenUpdateProcessing.bind(null, token11, hadActiveHUD11, toggleStatus11, executeOnCallback11),\n config: config11,\n animate: animate11\n });\n }\n // If no mapping has been found and the default image (image prior to effect triggered update) is different from current one\n // reset the token image back to default\n if (effects11.length === 0 && tokenDefaultImg11) {\n delete tokenUpdateObj11.flags?.[\"token-variants\"]?.defaultImg;\n setProperty(tokenUpdateObj11, \"flags.token-variants.-=defaultImg\", null);\n updateCall11 = ()=>(0, $eeGZt.updateTokenImage)(tokenDefaultImg11.imgSrc, {\n token: token11,\n imgName: tokenDefaultImg11.imgName,\n tokenUpdate: tokenUpdateObj11,\n callback: _postTokenUpdateProcessing.bind(null, token11, hadActiveHUD11, toggleStatus11, executeOnCallback11),\n animate: animate11\n });\n // If no default image exists but a custom effect is applied, we still want to perform an update to\n // clear it\n } else if (effects11.length === 0 && token11.getFlag(\"token-variants\", \"usingCustomConfig\")) updateCall11 = ()=>(0, $eeGZt.updateTokenImage)(token11.texture.src, {\n token: token11,\n imgName: tokenImgName11,\n tokenUpdate: tokenUpdateObj11,\n callback: _postTokenUpdateProcessing.bind(null, token11, hadActiveHUD11, toggleStatus11, executeOnCallback11),\n animate: animate11\n });\n if (updateCall11) {\n if (deferredUpdateScripts11.length) {\n for(let i31 = 0; i31 < deferredUpdateScripts11.length; i31++)if (i31 === deferredUpdateScripts11.length - 1) await (0, $eeGZt.tv_executeScript)(deferredUpdateScripts11[i31], {\n token: token11,\n tvaUpdate: ()=>{\n updateCall11();\n }\n });\n else await (0, $eeGZt.tv_executeScript)(deferredUpdateScripts11[i31], {\n token: token11,\n tvaUpdate: ()=>{}\n });\n } else updateCall11();\n } else if (executeOnCallback11.length || deferredUpdateScripts11.length) {\n _postTokenUpdateProcessing(token11, hadActiveHUD11, toggleStatus11, executeOnCallback11);\n _postTokenUpdateProcessing(token11, hadActiveHUD11, toggleStatus11, deferredUpdateScripts11);\n }\n (0, $bFZU7.broadcastOverlayRedraw)(placeable11);\n}\nasync function _postTokenUpdateProcessing(token11, hadActiveHUD11, toggleStatus11, scripts11) {\n if (hadActiveHUD11 && token11.object) {\n canvas.tokens.hud.bind(token11.object);\n if (toggleStatus11) canvas.tokens.hud._toggleStatusEffects(true);\n }\n for (const scr11 of scripts11){\n if (scr11.script) await (0, $eeGZt.tv_executeScript)(scr11.script, {\n token: scr11.token\n });\n else if (scr11.tmfxPreset) await (0, $eeGZt.applyTMFXPreset)(scr11.token, scr11.tmfxPreset, scr11.action);\n else if (scr11.ceEffect) await (0, $eeGZt.applyCEEffect)(scr11.token, scr11.ceEffect, scr11.action);\n else if (scr11.macro) await (0, $eeGZt.executeMacro)(scr11.macro, token11);\n }\n}\nfunction getAllEffectMappings(token11 = null, includeDisabled11 = false) {\n let allMappings11 = (0, $9IngI.getFlagMappings)(token11);\n const unique11 = new Set();\n // TODO: replace with a setting\n allMappings11.forEach((m11)=>unique11.add((0, $9IngI.TVA_CONFIG).mergeGroup ? m11.group : m11.label));\n // Sort out global mappings that do not apply to this actor\n let applicableGlobal11 = (0, $9IngI.TVA_CONFIG).globalMappings;\n if (token11?.actor?.type) {\n const actorType11 = token11.actor.type;\n applicableGlobal11 = applicableGlobal11.filter((m11)=>{\n if (!m11.targetActors || m11.targetActors.includes(actorType11)) return !unique11.has((0, $9IngI.TVA_CONFIG).mergeGroup ? m11.group : m11.label);\n return false;\n });\n }\n allMappings11 = allMappings11.concat(applicableGlobal11);\n if (!includeDisabled11) allMappings11 = allMappings11.filter((m11)=>!m11.disabled);\n return allMappings11;\n}\nasync function setOverlayVisibility({ userName: userName11 = null, userId: userId11 = null, label: label11 = null, group: group11 = null, token: token11 = null, visible: visible11 = true } = {}) {\n if (!label11 && !group11) return;\n if (userName11) userId11 = game.users.find((u11)=>u11.name === userName11)?.id;\n if (!userId11) return;\n let tokenMappings11 = (0, $9IngI.getFlagMappings)(token11);\n let globalMappings11 = (0, $9IngI.TVA_CONFIG).globalMappings;\n let updateToken11 = false;\n let updateGlobal11 = false;\n const updateMappings11 = function(mappings11) {\n mappings11 = mappings11.filter((m11)=>m11.overlay && (m11.label === label11 || m11.group === group11));\n let found11 = false;\n if (mappings11.length) found11 = true;\n mappings11.forEach((m11)=>{\n const overlayConfig11 = m11.overlayConfig;\n if (visible11) {\n if (!overlayConfig11.limitedUsers) overlayConfig11.limitedUsers = [];\n if (!overlayConfig11.limitedUsers.find((u11)=>u11 === userId11)) overlayConfig11.limitedUsers.push(userId11);\n } else if (overlayConfig11.limitedUsers) overlayConfig11.limitedUsers = overlayConfig11.limitedUsers.filter((u11)=>u11 !== userId11);\n });\n return found11;\n };\n updateToken11 = updateMappings11(tokenMappings11);\n updateGlobal11 = updateMappings11(globalMappings11);\n if (updateGlobal11) await (0, $9IngI.updateSettings)({\n globalMappings: globalMappings11\n });\n if (updateToken11) {\n const actor11 = game.actors.get(token11.document.actorId);\n if (actor11) await actor11.setFlag(\"token-variants\", \"effectMappings\", tokenMappings11);\n }\n if (updateToken11 || updateGlobal11) (0, $bFZU7.drawOverlays)(token11);\n}\nfunction _getTemplateMappings(templateName11) {\n return ((0, $9IngI.TVA_CONFIG).templateMappings.find((t11)=>t11.name === templateName11) ?? (0, $hClLE.CORE_TEMPLATES).find((t11)=>t11.name === templateName11))?.mappings;\n}\nasync function applyTemplate(token11, templateName11 = null, mappings11 = null) {\n if (templateName11) mappings11 = _getTemplateMappings(templateName11);\n if (!token11 || !mappings11) return;\n const actor11 = game.actors.get(token11.actor.id);\n if (!actor11) return;\n const templateMappings11 = deepClone(mappings11);\n templateMappings11.forEach((tm11)=>tm11.tokens = [\n token11.id\n ]);\n const actMappings11 = (0, $eeGZt.mergeMappings)(templateMappings11, (0, $9IngI.getFlagMappings)(actor11));\n await actor11.setFlag(\"token-variants\", \"effectMappings\", actMappings11);\n await updateWithEffectMapping(token11);\n (0, $bFZU7.drawOverlays)(token11);\n}\nasync function removeTemplate(token11, templateName11 = null, mappings11 = null) {\n if (templateName11) mappings11 = _getTemplateMappings(templateName11);\n if (!token11 || !mappings11) return;\n const actor11 = game.actors.get(token11.actor.id);\n if (!actor11) return;\n let actMappings11 = (0, $9IngI.getFlagMappings)(actor11);\n mappings11.forEach((m11)=>{\n let i31 = actMappings11.findIndex((m211)=>m211.id === m11.id);\n if (i31 !== -1) {\n actMappings11[i31].tokens = actMappings11[i31].tokens.filter((t11)=>t11 !== token11.id);\n if (actMappings11[i31].tokens.length === 0) actMappings11.splice(i31, 1);\n }\n });\n if (actMappings11.length) await actor11.setFlag(\"token-variants\", \"effectMappings\", actMappings11);\n else await actor11.unsetFlag(\"token-variants\", \"effectMappings\");\n await updateWithEffectMapping(token11);\n (0, $bFZU7.drawOverlays)(token11);\n}\nfunction toggleTemplate(token11, templateName11 = null, mappings11 = null) {\n if (templateName11) mappings11 = _getTemplateMappings(templateName11);\n if (!token11 || !mappings11) return;\n const actor11 = game.actors.get(token11.actor.id);\n if (!actor11) return;\n const actMappings11 = (0, $9IngI.getFlagMappings)(actor11);\n if (actMappings11.some((m11)=>mappings11.some((m211)=>m211.id === m11.id && m11.tokens?.includes(token11.id)))) removeTemplate(token11, null, mappings11);\n else applyTemplate(token11, null, mappings11);\n}\nfunction toggleTemplateOnSelected(templateName11 = null, mappings11 = null) {\n canvas.tokens.controlled.forEach((t11)=>toggleTemplate(t11, templateName11, mappings11));\n}\nfunction getHPChangeEffect(token11, effects11) {\n const internals11 = token11.actor?.getFlag(\"token-variants\", \"internalEffects\") || {};\n const delta11 = getProperty(token11, `${isNewerVersion(\"11\", game.version) ? \"actorData\" : \"delta\"}.flags.token-variants.internalEffects`);\n if (delta11) mergeObject(internals11, delta11);\n if (internals11[\"hp--\"] != null) effects11.push(\"hp--\");\n if (internals11[\"hp++\"] != null) effects11.push(\"hp++\");\n}\nfunction applyHpChangeEffect(actor11, change11, tokens11) {\n let duration11 = Number((0, $9IngI.TVA_CONFIG).internalEffects.hpChange.duration);\n const newHpValue11 = getProperty(change11, `system.${(0, $9IngI.TVA_CONFIG).systemHpPath}.value`);\n if (newHpValue11 != null) {\n const [currentHpVal11, _11] = getTokenHP(tokens11[0]);\n if (currentHpVal11 !== newHpValue11) {\n if (currentHpVal11 < newHpValue11) {\n setProperty(change11, \"flags.token-variants.internalEffects.-=hp--\", null);\n setProperty(change11, \"flags.token-variants.internalEffects.hp++\", newHpValue11 - currentHpVal11);\n if (duration11) setTimeout(()=>{\n actor11.update({\n \"flags.token-variants.internalEffects.-=hp++\": null\n });\n }, duration11 * 1000);\n } else {\n setProperty(change11, \"flags.token-variants.internalEffects.-=hp++\", null);\n setProperty(change11, \"flags.token-variants.internalEffects.hp--\", newHpValue11 - currentHpVal11);\n if (duration11) setTimeout(()=>{\n actor11.update({\n \"flags.token-variants.internalEffects.-=hp--\": null\n });\n }, duration11 * 1000);\n }\n }\n }\n}\nfunction getTokenEffects(token11, includeExpressions11 = false) {\n const data11 = token11.document ?? token11;\n let effects11 = [];\n // TVA Effects\n const tokenInCombat11 = game.combats.some((combat11)=>{\n return combat11.combatants.some((c11)=>c11.tokenId === token11.id);\n });\n if (tokenInCombat11) effects11.push(\"token-variants-combat\");\n if (game.combat?.started) {\n if (game.combat?.combatant?.token?.id === token11.id) effects11.push(\"combat-turn\");\n else if (game.combat?.nextCombatant?.token?.id === token11.id) effects11.push(\"combat-turn-next\");\n }\n if (data11.hidden) effects11.push(\"token-variants-visibility\");\n if ((0, $9IngI.TVA_CONFIG).internalEffects.hpChange.enabled) getHPChangeEffect(data11, effects11);\n // Actor/Token effects\n if (data11.actorLink) getEffectsFromActor(token11.actor, effects11);\n else if (game.system.id === \"pf2e\") (data11.delta?.items || []).forEach((item11)=>{\n if (_activePF2EItem(item11)) effects11.push(item11.name);\n });\n else {\n (data11.effects || []).filter((ef31)=>!ef31.disabled && !ef31.isSuppressed).forEach((ef31)=>effects11.push(ef31.label));\n getEffectsFromActor(token11.actor, effects11);\n }\n // Expression/Mapping effects\n evaluateComparatorEffects(token11, effects11);\n evaluateStateEffects(token11, effects11);\n // Include mappings marked as always applicable\n // as well as the ones defined as logical expressions if needed\n const mappings11 = getAllEffectMappings(token11);\n for (const m11 of mappings11){\n if (m11.tokens?.length && !m11.tokens.includes(data11.id)) continue;\n if (m11.alwaysOn) effects11.unshift(m11.id);\n else if (includeExpressions11) {\n const evaluation11 = evaluateMappingExpression(m11, effects11, token11);\n if (evaluation11) effects11.unshift(m11.id);\n }\n }\n return effects11;\n}\nfunction getEffectsFromActor(actor11, effects11 = []) {\n if (!actor11) return effects11;\n if (game.system.id === \"pf2e\") (actor11.items || []).forEach((item11, id11)=>{\n if (_activePF2EItem(item11)) effects11.push(item11.name);\n });\n else {\n (actor11.effects || []).forEach((activeEffect11, id11)=>{\n if (!activeEffect11.disabled && !activeEffect11.isSuppressed) effects11.push(activeEffect11.name ?? activeEffect11.label);\n });\n (actor11.items || []).forEach((item11)=>{\n if (ITEM_TYPES.includes(item11.type) && item11.system.equipped) effects11.push(item11.name ?? item11.label);\n });\n }\n return effects11;\n}\nfunction _activePF2EItem(item11) {\n if (PF2E_ITEM_TYPES.includes(item11.type)) {\n if (\"active\" in item11) return item11.active;\n else if (\"isEquipped\" in item11) return item11.isEquipped;\n else return true;\n }\n return false;\n}\nconst VALID_EXPRESSION = new RegExp('([a-zA-Z\\\\-\\\\.\\\\+]+)([><=]+)(\".*\"|-?\\\\d+)(%{0,1})');\nfunction evaluateComparator(token11, expression11) {\n const match11 = expression11.match(VALID_EXPRESSION);\n if (match11) {\n const property11 = match11[1];\n let currVal11;\n let maxVal11;\n if (property11 === \"hp\") [currVal11, maxVal11] = getTokenHP(token11);\n else if (property11 === \"hp++\" || property11 === \"hp--\") {\n [currVal11, maxVal11] = getTokenHP(token11);\n currVal11 = getProperty(token11, `actor.flags.token-variants.internalEffects.${property11}`) ?? 0;\n } else currVal11 = getProperty(token11, property11);\n if (currVal11 == null) currVal11 = 0;\n const sign11 = match11[2];\n let val11 = Number(match11[3]);\n if (isNaN(val11)) {\n val11 = match11[3].substring(1, match11[3].length - 1);\n if (val11 === \"true\") val11 = true;\n if (val11 === \"false\") val11 = false;\n // Convert currVal to a truthy/falsy one if this is a bool check\n if (val11 === true || val11 === false) {\n if (isEmpty(currVal11)) currVal11 = false;\n else currVal11 = Boolean(currVal11);\n }\n }\n const isPercentage11 = Boolean(match11[4]);\n if (property11 === \"rotation\") maxVal11 = 360;\n else if (maxVal11 == null) maxVal11 = 999999;\n const toCompare11 = isPercentage11 ? currVal11 / maxVal11 * 100 : currVal11;\n let passed11 = false;\n if (sign11 === \"=\") passed11 = toCompare11 == val11;\n else if (sign11 === \">\") passed11 = toCompare11 > val11;\n else if (sign11 === \"<\") passed11 = toCompare11 < val11;\n else if (sign11 === \">=\") passed11 = toCompare11 >= val11;\n else if (sign11 === \"<=\") passed11 = toCompare11 <= val11;\n else if (sign11 === \"<>\") passed11 = toCompare11 < val11 || toCompare11 > val11;\n return passed11;\n }\n return false;\n}\nfunction evaluateComparatorEffects(token11, effects11 = []) {\n token11 = token11.document ?? token11;\n const mappings11 = getAllEffectMappings(token11);\n const matched11 = new Set();\n for (const m11 of mappings11){\n const expressions11 = m11.expression.split(EXPRESSION_MATCH_RE).filter(Boolean).map((exp11)=>exp11.trim()).filter(Boolean);\n for(let i31 = 0; i31 < expressions11.length; i31++)if (evaluateComparator(token11, expressions11[i31])) matched11.add(expressions11[i31]);\n }\n // Remove duplicate expressions and insert into effects\n matched11.forEach((exp11)=>effects11.unshift(exp11));\n return effects11;\n}\nfunction evaluateStateEffects(token11, effects11) {\n if (game.system.id === \"pf2e\") {\n const deathIcon11 = game.settings.get(\"pf2e\", \"deathIcon\");\n if ((token11.document ?? token11).overlayEffect === deathIcon11) effects11.push(\"Dead\");\n }\n}\n/**\r\n * Replaces {1,a,5,b} type string in the expressions with (1|a|5|b)\r\n * @param {*} exp\r\n * @returns\r\n */ function _findReplaceBracketWildcard(exp11) {\n let nExp11 = \"\";\n let lIndex11 = 0;\n while(lIndex11 >= 0){\n let i111 = exp11.indexOf(\"\\\\\\\\\\\\{\", lIndex11);\n if (i111 !== -1) {\n let i211 = exp11.indexOf(\"\\\\\\\\\\\\}\", i111);\n if (i211 !== -1) {\n nExp11 += exp11.substring(lIndex11, i111);\n nExp11 += \"(\" + exp11.substring(i111 + 4, i211).split(\",\").join(\"|\") + \")\";\n }\n lIndex11 = i211 + 4;\n } else return nExp11 + exp11.substring(lIndex11, exp11.length);\n }\n return nExp11 ?? exp11;\n}\nfunction _testRegExEffect(effect11, effects11) {\n let re11 = effect11.replace(/[/\\-\\\\^$+?.()|[\\]{}]/g, \"\\\\$&\").replaceAll(\"\\\\\\\\*\", \".*\");\n re11 = _findReplaceBracketWildcard(re11);\n re11 = new RegExp(\"^\" + re11 + \"$\");\n return effects11.find((ef31)=>re11.test(ef31));\n}\nfunction evaluateMappingExpression(mapping, effects, token, added = new Set(), removed = new Set()) {\n let arrExpression = mapping.expression.split(EXPRESSION_MATCH_RE).filter(Boolean).map((s11)=>s11.trim()).filter(Boolean);\n let temp = \"\";\n let hasAdded = false;\n let hasRemoved = false;\n for (let exp of arrExpression){\n if ((0, $eeGZt.EXPRESSION_OPERATORS).includes(exp)) {\n temp += exp.replace(\"\\\\\", \"\");\n continue;\n }\n if (/\\\\\\*|\\\\{.*\\\\}/g.test(exp)) {\n let rExp = _testRegExEffect(exp, effects);\n if (rExp) temp += \"true\";\n else temp += \"false\";\n if (_testRegExEffect(exp, added)) hasAdded = true;\n else if (_testRegExEffect(exp, removed)) hasRemoved = true;\n continue;\n } else if (effects.includes(exp)) temp += \"true\";\n else temp += \"false\";\n if (!hasAdded && added.has(exp)) hasAdded = true;\n if (!hasRemoved && removed.has(exp)) hasRemoved = true;\n }\n try {\n let evaluation = eval(temp);\n // Evaluate JS code\n if (mapping.codeExp) try {\n token = token.document ?? token;\n if (!eval(mapping.codeExp)) evaluation = false;\n else if (!mapping.expression) evaluation = true;\n } catch (e) {\n evaluation = false;\n }\n if (evaluation) {\n if (hasAdded || hasRemoved) {\n added.add(mapping.id);\n effects.push(mapping.id);\n } else effects.unshift(mapping.id);\n } else if (hasRemoved || hasAdded) removed.add(mapping.id);\n return evaluation;\n } catch (e) {}\n return false;\n}\nfunction _getTokenHPv11(token11) {\n let attributes11;\n if (token11.actorLink) attributes11 = getProperty(token11.actor?.system, (0, $9IngI.TVA_CONFIG).systemHpPath);\n else attributes11 = mergeObject(getProperty(token11.actor?.system, (0, $9IngI.TVA_CONFIG).systemHpPath) || {}, getProperty(token11.delta?.system) || {}, {\n inplace: false\n });\n return [\n attributes11?.value,\n attributes11?.max\n ];\n}\nfunction getTokenHP(token11) {\n if (!isNewerVersion(\"11\", game.version)) return _getTokenHPv11(token11);\n let attributes11;\n if (token11.actorLink) attributes11 = getProperty(token11.actor.system, (0, $9IngI.TVA_CONFIG).systemHpPath);\n else attributes11 = mergeObject(getProperty(token11.actor.system, (0, $9IngI.TVA_CONFIG).systemHpPath) || {}, getProperty(token11.actorData?.system) || {}, {\n inplace: false\n });\n return [\n attributes11?.value,\n attributes11?.max\n ];\n}\nasync function _updateImageOnEffectChange(effectName11, actor11, added11 = true) {\n const tokens11 = actor11.token ? [\n actor11.token\n ] : (0, $eeGZt.getAllActorTokens)(actor11, true, !(0, $9IngI.TVA_CONFIG).mappingsCurrentSceneOnly);\n for (const token11 of tokens11)await updateWithEffectMapping(token11, {\n added: added11 ? [\n effectName11\n ] : [],\n removed: !added11 ? [\n effectName11\n ] : []\n });\n}\nasync function _updateImageOnMultiEffectChange(actor11, added11 = [], removed11 = []) {\n if (!actor11) return;\n const tokens11 = actor11.token ? [\n actor11.token\n ] : (0, $eeGZt.getAllActorTokens)(actor11, true, !(0, $9IngI.TVA_CONFIG).mappingsCurrentSceneOnly);\n for (const token11 of tokens11)await updateWithEffectMapping(token11, {\n added: added11,\n removed: removed11\n });\n}\nasync function _deleteCombatant(combatant11) {\n const token11 = combatant11._token || canvas.tokens.get(combatant11.tokenId);\n if (!token11 || !token11.actor) return;\n await updateWithEffectMapping(token11, {\n removed: [\n \"token-variants-combat\"\n ]\n });\n}\n\n});\nparcelRequire.register(\"9IngI\", function(module, exports) {\n\n$parcel$export(module.exports, \"TVA_CONFIG\", () => $712a45c6d8b5799c$export$ab258e1978c780a6);\n$parcel$export(module.exports, \"FEATURE_CONTROL\", () => $712a45c6d8b5799c$export$b055032cc483774b);\n$parcel$export(module.exports, \"registerSettings\", () => $712a45c6d8b5799c$export$6628c94500a3bf7b);\n$parcel$export(module.exports, \"migrateMappings\", () => $712a45c6d8b5799c$export$ddc69df64ec0f5ef);\n$parcel$export(module.exports, \"updateSettings\", () => $712a45c6d8b5799c$export$f558026a994b6051);\n$parcel$export(module.exports, \"getFlagMappings\", () => $712a45c6d8b5799c$export$cb45a5664e48b54e);\n$parcel$export(module.exports, \"exportSettingsToJSON\", () => $712a45c6d8b5799c$export$fa17ec2953e9bd4a);\n$parcel$export(module.exports, \"importSettingsFromJSON\", () => $712a45c6d8b5799c$export$1144645bfcc7effc);\n$parcel$export(module.exports, \"getSearchOptions\", () => $712a45c6d8b5799c$export$1474fedcea3afc96);\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $bhyh6 = parcelRequire(\"bhyh6\");\n\nvar $3pmR9 = parcelRequire(\"3pmR9\");\n\nvar $dxtrh = parcelRequire(\"dxtrh\");\n\nvar $aDMsz = parcelRequire(\"aDMsz\");\n\nvar $fVv34 = parcelRequire(\"fVv34\");\n\nvar $8MWlo = parcelRequire(\"8MWlo\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\n\nvar $3pMx9 = parcelRequire(\"3pMx9\");\nconst $712a45c6d8b5799c$export$ab258e1978c780a6 = {\n debug: false,\n disableNotifs: false,\n searchPaths: [\n {\n text: \"modules/caeora-maps-tokens-assets/assets/tokens\",\n cache: true,\n source: typeof ForgeAPI === \"undefined\" ? \"data\" : \"forge-bazaar\",\n types: [\n \"Portrait\",\n \"Token\",\n \"PortraitAndToken\"\n ]\n }\n ],\n forgeSearchPaths: {},\n worldHud: {\n displayOnlySharedImages: false,\n disableIfTHWEnabled: false,\n includeKeywords: false,\n updateActorImage: false,\n useNameSimilarity: false,\n includeWildcard: true,\n showFullPath: false,\n animate: true\n },\n hud: {\n enableSideMenu: true,\n displayAsImage: true,\n imageOpacity: 50\n },\n keywordSearch: true,\n excludedKeywords: \"and,for\",\n runSearchOnPath: false,\n searchFilters: {},\n algorithm: {\n exact: false,\n fuzzy: true,\n fuzzyLimit: 100,\n fuzzyThreshold: 0.3,\n fuzzyArtSelectPercentSlider: true\n },\n tokenConfigs: [],\n randomizer: {\n actorCreate: false,\n tokenCreate: false,\n tokenCopyPaste: false,\n tokenName: true,\n keywords: false,\n shared: false,\n wildcard: false,\n representedActorDisable: false,\n linkedActorDisable: true,\n popupOnDisable: false,\n diffImages: false,\n syncImages: false\n },\n popup: {\n disableAutoPopupOnActorCreate: true,\n disableAutoPopupOnTokenCreate: true,\n disableAutoPopupOnTokenCopyPaste: true,\n twoPopups: false,\n twoPopupsNoDialog: false\n },\n imgurClientId: \"\",\n stackStatusConfig: true,\n mergeGroup: false,\n staticCache: false,\n staticCacheFile: \"modules/token-variants/token-variants-cache.json\",\n tilesEnabled: true,\n compendiumMapper: {\n missingOnly: false,\n diffImages: false,\n showImages: true,\n cache: false,\n autoDisplayArtSelect: true,\n syncImages: false,\n overrideCategory: false,\n category: \"Token\",\n missingImages: [\n {\n document: \"all\",\n image: CONST.DEFAULT_TOKEN\n }\n ],\n searchOptions: {}\n },\n permissions: {\n popups: {\n 1: false,\n 2: false,\n 3: true,\n 4: true\n },\n portrait_right_click: {\n 1: false,\n 2: false,\n 3: true,\n 4: true\n },\n image_path_button: {\n 1: false,\n 2: false,\n 3: true,\n 4: true\n },\n hud: {\n 1: true,\n 2: true,\n 3: true,\n 4: true\n },\n hudFullAccess: {\n 1: false,\n 2: false,\n 3: true,\n 4: true\n },\n statusConfig: {\n 1: false,\n 2: false,\n 3: true,\n 4: true\n }\n },\n globalMappings: [],\n templateMappings: [],\n customImageCategories: [],\n displayEffectIconsOnHover: false,\n disableEffectIcons: false,\n filterEffectIcons: false,\n filterCustomEffectIcons: true,\n filterIconList: [],\n updateTokenProto: false,\n imgNameContainsDimensions: false,\n imgNameContainsFADimensions: false,\n playVideoOnHover: true,\n pauseVideoOnHoverOut: false,\n disableImageChangeOnPolymorphed: false,\n disableImageUpdateOnNonPrototype: false,\n disableTokenUpdateAnimation: false,\n mappingsCurrentSceneOnly: false,\n invisibleImage: \"\",\n systemHpPath: \"\",\n internalEffects: {\n hpChange: {\n enabled: false,\n duration: null\n }\n },\n hideElevationTooltip: false,\n hideTokenBorder: false\n};\nconst $712a45c6d8b5799c$export$b055032cc483774b = {\n EffectMappings: true,\n EffectIcons: true,\n Overlays: true,\n UserMappings: true,\n Wildcards: true,\n PopUpAndRandomize: true,\n HUD: true,\n HideElement: true\n};\nfunction $712a45c6d8b5799c$export$6628c94500a3bf7b() {\n game.settings.register(\"token-variants\", \"featureControl\", {\n scope: \"world\",\n config: false,\n type: Object,\n default: $712a45c6d8b5799c$export$b055032cc483774b,\n onChange: async (val)=>{\n mergeObject($712a45c6d8b5799c$export$b055032cc483774b, val);\n (0, $e9LRe.registerAllHooks)();\n (0, $3pMx9.registerAllWrappers)();\n }\n });\n mergeObject($712a45c6d8b5799c$export$b055032cc483774b, game.settings.get(\"token-variants\", \"featureControl\"));\n game.settings.registerMenu(\"token-variants\", \"settings\", {\n name: \"Configure Settings\",\n hint: \"Configure Token Variant Art settings\",\n label: \"Settings\",\n scope: \"world\",\n icon: \"fas fa-cog\",\n type: (0, $fVv34.default),\n restricted: true\n });\n const systemHpPaths = {\n \"cyberpunk-red-core\": \"derivedStats.hp\",\n lfg: \"health\",\n worldbuilding: \"health\",\n twodsix: \"hits\"\n };\n $712a45c6d8b5799c$export$ab258e1978c780a6.systemHpPath = systemHpPaths[game.system.id] ?? \"attributes.hp\";\n game.settings.register(\"token-variants\", \"effectMappingToggleGroups\", {\n scope: \"world\",\n config: false,\n type: Object,\n default: {\n Default: true\n }\n });\n game.settings.register(\"token-variants\", \"settings\", {\n scope: \"world\",\n config: false,\n type: Object,\n default: $712a45c6d8b5799c$export$ab258e1978c780a6,\n onChange: async (val)=>{\n // Generate a diff, it will be required when doing post-processing of the modified settings\n const diff = $712a45c6d8b5799c$export$be92d635d4f8ae80($712a45c6d8b5799c$export$ab258e1978c780a6, val);\n // Check image re-cache required due to permission changes\n let requiresImageCache = false;\n if (\"permissions\" in diff) {\n if (!(0, $eeGZt.userRequiresImageCache)($712a45c6d8b5799c$export$ab258e1978c780a6.permissions) && (0, $eeGZt.userRequiresImageCache)(val.permissions)) requiresImageCache = true;\n }\n // Update live settings\n mergeObject($712a45c6d8b5799c$export$ab258e1978c780a6, val);\n if ($712a45c6d8b5799c$export$ab258e1978c780a6.filterEffectIcons && (\"filterCustomEffectIcons\" in diff || \"filterIconList\" in diff)) for (const tkn of canvas.tokens.placeables)(0, $eeGZt.waitForTokenTexture)(tkn, (token)=>{\n token.drawEffects();\n });\n // Check image re-cache required due to search path changes\n if (\"searchPaths\" in diff || \"forgeSearchPaths\" in diff) {\n if ((0, $eeGZt.userRequiresImageCache)($712a45c6d8b5799c$export$ab258e1978c780a6.permissions)) requiresImageCache = true;\n }\n // Cache/re-cache images if necessary\n if (requiresImageCache) await (0, $8MWlo.cacheImages)();\n if (diff.staticCache) {\n const cacheFile = diff.staticCacheFile ? diff.staticCacheFile : $712a45c6d8b5799c$export$ab258e1978c780a6.staticCacheFile;\n (0, $8MWlo.saveCache)(cacheFile);\n }\n $712a45c6d8b5799c$export$ab258e1978c780a6.hud = game.settings.get(\"token-variants\", \"hudSettings\");\n (0, $e9LRe.registerAllHooks)();\n (0, $3pMx9.registerAllWrappers)();\n if (\"displayEffectIconsOnHover\" in diff) {\n for (const tkn of canvas.tokens.placeables)if (tkn.effects) tkn.effects.visible = !diff.displayEffectIconsOnHover;\n }\n if (\"hideElevationTooltip\" in diff) {\n for (const tkn of canvas.tokens.placeables)if (tkn.tooltip) tkn.tooltip.text = tkn._getTooltipText();\n }\n if (\"hideTokenBorder\" in diff) {\n for (const tkn of canvas.tokens.placeables)if (tkn.border) tkn.border.visible = !diff.hideTokenBorder;\n }\n if (\"filterEffectIcons\" in diff || \"disableEffectIcons\" in diff) for (const tkn of canvas.tokens.placeables)tkn.drawEffects();\n }\n });\n game.settings.register(\"token-variants\", \"debug\", {\n scope: \"world\",\n config: false,\n type: Boolean,\n default: $712a45c6d8b5799c$export$ab258e1978c780a6.debug,\n onChange: (val)=>$712a45c6d8b5799c$export$ab258e1978c780a6.debug = val\n });\n if (typeof ForgeAPI !== \"undefined\") game.settings.registerMenu(\"token-variants\", \"forgeSearchPaths\", {\n name: game.i18n.localize(\"token-variants.settings.forge-search-paths.Name\"),\n hint: game.i18n.localize(\"token-variants.settings.forge-search-paths.Hint\"),\n icon: \"fas fa-search\",\n type: (0, $bhyh6.ForgeSearchPaths),\n scope: \"client\",\n restricted: false\n });\n game.settings.register(\"token-variants\", \"tokenConfigs\", {\n scope: \"world\",\n config: false,\n type: Array,\n default: $712a45c6d8b5799c$export$ab258e1978c780a6.tokenConfigs,\n onChange: (val)=>$712a45c6d8b5799c$export$ab258e1978c780a6.tokenConfigs = val\n });\n game.settings.registerMenu(\"token-variants\", \"tokenHUDSettings\", {\n name: game.i18n.localize(\"token-variants.settings.token-hud.Name\"),\n hint: game.i18n.localize(\"token-variants.settings.token-hud.Hint\"),\n scope: \"client\",\n icon: \"fas fa-images\",\n type: (0, $3pmR9.default),\n restricted: false\n });\n game.settings.registerMenu(\"token-variants\", \"compendiumMapper\", {\n name: game.i18n.localize(\"token-variants.settings.compendium-mapper.Name\"),\n hint: game.i18n.localize(\"token-variants.settings.compendium-mapper.Hint\"),\n scope: \"world\",\n icon: \"fas fa-cogs\",\n type: (0, $dxtrh.default),\n restricted: true\n });\n game.settings.register(\"token-variants\", \"compendiumMapper\", {\n scope: \"world\",\n config: false,\n type: Object,\n default: $712a45c6d8b5799c$export$ab258e1978c780a6.compendiumMapper,\n onChange: (val)=>$712a45c6d8b5799c$export$ab258e1978c780a6.compendiumMapper = val\n });\n game.settings.register(\"token-variants\", \"hudSettings\", {\n scope: \"client\",\n config: false,\n type: Object,\n default: $712a45c6d8b5799c$export$ab258e1978c780a6.hud,\n onChange: (val)=>$712a45c6d8b5799c$export$ab258e1978c780a6.hud = val\n });\n game.settings.registerMenu(\"token-variants\", \"importExport\", {\n name: `Import/Export`,\n hint: game.i18n.localize(\"token-variants.settings.import-export.Hint\"),\n scope: \"world\",\n icon: \"fas fa-toolbox\",\n type: (0, $aDMsz.default),\n restricted: true\n });\n // Read settings\n const settings = game.settings.get(\"token-variants\", \"settings\");\n mergeObject($712a45c6d8b5799c$export$ab258e1978c780a6, settings);\n if (isEmpty($712a45c6d8b5799c$export$ab258e1978c780a6.searchFilters)) (0, $eeGZt.BASE_IMAGE_CATEGORIES).forEach((cat)=>{\n $712a45c6d8b5799c$export$ab258e1978c780a6.searchFilters[cat] = {\n include: \"\",\n exclude: \"\",\n regex: \"\"\n };\n });\n for(let uid in $712a45c6d8b5799c$export$ab258e1978c780a6.forgeSearchPaths)$712a45c6d8b5799c$export$ab258e1978c780a6.forgeSearchPaths[uid].paths = $712a45c6d8b5799c$export$ab258e1978c780a6.forgeSearchPaths[uid].paths.map((p)=>{\n if (!p.source) p.source = \"forgevtt\";\n if (!p.types) {\n if (p.tiles) p.types = [\n \"Tile\"\n ];\n else p.types = [\n \"Portrait\",\n \"Token\",\n \"PortraitAndToken\"\n ];\n }\n return p;\n });\n // 20/07/2023 Convert globalMappings to a new format\n if (getType(settings.globalMappings) === \"Object\") Hooks.once(\"ready\", ()=>{\n $712a45c6d8b5799c$export$ab258e1978c780a6.globalMappings = $712a45c6d8b5799c$export$ddc69df64ec0f5ef(settings.globalMappings);\n setTimeout(()=>$712a45c6d8b5799c$export$f558026a994b6051({\n globalMappings: $712a45c6d8b5799c$export$ab258e1978c780a6.globalMappings\n }), 10000);\n });\n // Read client settings\n $712a45c6d8b5799c$export$ab258e1978c780a6.hud = game.settings.get(\"token-variants\", \"hudSettings\");\n}\nfunction $712a45c6d8b5799c$export$ddc69df64ec0f5ef(mappings, globalMappings = []) {\n if (!mappings) return [];\n if (getType(mappings) === \"Object\") {\n let nMappings = [];\n for (const [effect, mapping] of Object.entries(mappings)){\n if (!mapping.label) mapping.label = effect.replaceAll(\"\\xb6\", \".\");\n if (!mapping.expression) mapping.expression = effect.replaceAll(\"\\xb6\", \".\");\n if (!mapping.id) mapping.id = randomID(8);\n delete mapping.effect;\n if (mapping.overlayConfig) mapping.overlayConfig.id = mapping.id;\n delete mapping.overlayConfig?.effect;\n nMappings.push(mapping);\n }\n // Convert parents to parentIDs\n let combMappings = nMappings.concat(globalMappings);\n for (const mapping of nMappings)if (mapping.overlayConfig?.parent) {\n if (mapping.overlayConfig.parent === \"Token (Placeable)\") mapping.overlayConfig.parentID = \"TOKEN\";\n else {\n const parent = combMappings.find((m)=>m.label === mapping.overlayConfig.parent);\n if (parent) mapping.overlayConfig.parentID = parent.id;\n else mapping.overlayConfig.parentID = \"\";\n }\n delete mapping.overlayConfig.parent;\n }\n return nMappings;\n }\n return mappings;\n}\nfunction $712a45c6d8b5799c$export$cb45a5664e48b54e(object) {\n if (!object) return [];\n let doc = object.document ?? object;\n const actorId = doc.actor?.id;\n if (actorId) {\n doc = game.actors.get(actorId);\n if (!doc) return [];\n }\n // 23/07/2023\n let mappings = doc.getFlag(\"token-variants\", \"effectMappings\") ?? [];\n if (getType(mappings) === \"Object\") {\n mappings = $712a45c6d8b5799c$export$ddc69df64ec0f5ef(mappings, $712a45c6d8b5799c$export$ab258e1978c780a6.globalMappings);\n doc.setFlag(\"token-variants\", \"effectMappings\", mappings);\n }\n return mappings;\n}\nfunction $712a45c6d8b5799c$export$fa17ec2953e9bd4a() {\n const settings = deepClone($712a45c6d8b5799c$export$ab258e1978c780a6);\n const filename = `token-variants-settings.json`;\n saveDataToFile(JSON.stringify(settings, null, 2), \"text/json\", filename);\n}\nasync function $712a45c6d8b5799c$export$1144645bfcc7effc(json) {\n if (typeof json === \"string\") json = JSON.parse(json);\n if (json.forgeSearchPaths) for(let uid in json.forgeSearchPaths)json.forgeSearchPaths[uid].paths = json.forgeSearchPaths[uid].paths.map((p)=>{\n if (!p.source) p.source = \"forgevtt\";\n if (!p.types) {\n if (p.tiles) p.types = [\n \"Tile\"\n ];\n else p.types = [\n \"Portrait\",\n \"Token\",\n \"PortraitAndToken\"\n ];\n }\n return p;\n });\n // 09/07/2022 Convert filters to new format if old one is still in use\n if (json.searchFilters && json.searchFilters.portraitFilterInclude != null) {\n const filters = json.searchFilters;\n json.searchFilters = {\n Portrait: {\n include: filters.portraitFilterInclude ?? \"\",\n exclude: filters.portraitFilterExclude ?? \"\",\n regex: filters.portraitFilterRegex ?? \"\"\n },\n Token: {\n include: filters.tokenFilterInclude ?? \"\",\n exclude: filters.tokenFilterExclude ?? \"\",\n regex: filters.tokenFilterRegex ?? \"\"\n },\n PortraitAndToken: {\n include: filters.generalFilterInclude ?? \"\",\n exclude: filters.generalFilterExclude ?? \"\",\n regex: filters.generalFilterRegex ?? \"\"\n }\n };\n if (json.compendiumMapper) delete json.compendiumMapper.searchFilters;\n }\n // Global Mappings need special merge\n if (json.globalMappings) {\n const nMappings = $712a45c6d8b5799c$export$ddc69df64ec0f5ef(json.globalMappings);\n for (const m of nMappings){\n const i = $712a45c6d8b5799c$export$ab258e1978c780a6.globalMappings.findIndex((mapping)=>m.label === mapping.label);\n if (i === -1) $712a45c6d8b5799c$export$ab258e1978c780a6.globalMappings.push(m);\n else $712a45c6d8b5799c$export$ab258e1978c780a6.globalMappings[i] = m;\n }\n json.globalMappings = $712a45c6d8b5799c$export$ab258e1978c780a6.globalMappings;\n }\n $712a45c6d8b5799c$export$f558026a994b6051(json);\n}\nfunction $712a45c6d8b5799c$var$_refreshFilters(filters, customCategories, updateTVAConfig = false) {\n const categories = (0, $eeGZt.BASE_IMAGE_CATEGORIES).concat(customCategories ?? $712a45c6d8b5799c$export$ab258e1978c780a6.customImageCategories);\n for(const filter in filters)if (!categories.includes(filter)) {\n delete filters[filter];\n if (updateTVAConfig) delete $712a45c6d8b5799c$export$ab258e1978c780a6.searchFilters[filter];\n }\n for (const category of customCategories)if (filters[category] == null) filters[category] = {\n include: \"\",\n exclude: \"\",\n regex: \"\"\n };\n}\nasync function $712a45c6d8b5799c$export$f558026a994b6051(newSettings) {\n const settings = mergeObject(deepClone($712a45c6d8b5799c$export$ab258e1978c780a6), newSettings, {\n insertKeys: false\n });\n // Custom image categories might have changed, meaning we may have filters that are no longer relevant\n // or need to be added\n if (\"customImageCategories\" in newSettings) {\n $712a45c6d8b5799c$var$_refreshFilters(settings.searchFilters, newSettings.customImageCategories, true);\n if (settings.compendiumMapper?.searchOptions?.searchFilters != null) {\n $712a45c6d8b5799c$var$_refreshFilters(settings.compendiumMapper.searchOptions.searchFilters, newSettings.customImageCategories);\n $712a45c6d8b5799c$export$ab258e1978c780a6.compendiumMapper.searchOptions.searchFilters = settings.compendiumMapper.searchOptions.searchFilters;\n }\n }\n await game.settings.set(\"token-variants\", \"settings\", settings);\n}\nfunction $712a45c6d8b5799c$export$be92d635d4f8ae80(original, other, { inner: inner = false } = {}) {\n function _difference(v0, v1) {\n let t0 = getType(v0);\n let t1 = getType(v1);\n if (t0 !== t1) return [\n true,\n v1\n ];\n if (t0 === \"Array\") return [\n !$712a45c6d8b5799c$var$_arrayEquality(v0, v1),\n v1\n ];\n if (t0 === \"Object\") {\n if (isEmpty(v0) !== isEmpty(v1)) return [\n true,\n v1\n ];\n let d = $712a45c6d8b5799c$export$be92d635d4f8ae80(v0, v1, {\n inner: inner\n });\n return [\n !isEmpty(d),\n d\n ];\n }\n return [\n v0 !== v1,\n v1\n ];\n }\n // Recursively call the _difference function\n return Object.keys(other).reduce((obj, key)=>{\n if (inner && !(key in original)) return obj;\n let [isDifferent, difference] = _difference(original[key], other[key]);\n if (isDifferent) obj[key] = difference;\n return obj;\n }, {});\n}\nfunction $712a45c6d8b5799c$var$_arrayEquality(a1, a2) {\n if (!(a2 instanceof Array) || a2.length !== a1.length) return false;\n return a1.every((v, i)=>{\n if (getType(v) === \"Object\") return Object.keys($712a45c6d8b5799c$export$be92d635d4f8ae80(v, a2[i])).length === 0;\n return a2[i] === v;\n });\n}\nfunction $712a45c6d8b5799c$export$1474fedcea3afc96() {\n return {\n keywordSearch: $712a45c6d8b5799c$export$ab258e1978c780a6.keywordSearch,\n excludedKeywords: $712a45c6d8b5799c$export$ab258e1978c780a6.excludedKeywords,\n runSearchOnPath: $712a45c6d8b5799c$export$ab258e1978c780a6.runSearchOnPath,\n algorithm: $712a45c6d8b5799c$export$ab258e1978c780a6.algorithm,\n searchFilters: $712a45c6d8b5799c$export$ab258e1978c780a6.searchFilters\n };\n}\n\n});\nparcelRequire.register(\"eeGZt\", function(module, exports) {\n\n$parcel$export(module.exports, \"EXPRESSION_OPERATORS\", () => $a5d3b883bf9e749e$export$313cceabf063c648);\n$parcel$export(module.exports, \"SEARCH_TYPE\", () => $a5d3b883bf9e749e$export$71ce8fbad5957261);\n$parcel$export(module.exports, \"BASE_IMAGE_CATEGORIES\", () => $a5d3b883bf9e749e$export$bb3b35fb4fbd121a);\n$parcel$export(module.exports, \"startBatchUpdater\", () => $a5d3b883bf9e749e$export$a9fe6b4c86ebbf2c);\n$parcel$export(module.exports, \"updateTokenImage\", () => $a5d3b883bf9e749e$export$9a81af9500bcd927);\n$parcel$export(module.exports, \"getFileName\", () => $a5d3b883bf9e749e$export$1396dd911f86baee);\n$parcel$export(module.exports, \"updateActorImage\", () => $a5d3b883bf9e749e$export$853901ce27596d97);\n$parcel$export(module.exports, \"keyPressed\", () => $a5d3b883bf9e749e$export$e09b512eecac7579);\n$parcel$export(module.exports, \"registerKeybinds\", () => $a5d3b883bf9e749e$export$2e69de36ed96343);\n$parcel$export(module.exports, \"getTokenConfig\", () => $a5d3b883bf9e749e$export$cf2a4e460992a64b);\n$parcel$export(module.exports, \"setTokenConfig\", () => $a5d3b883bf9e749e$export$99dcb6b6e71c8ec3);\n$parcel$export(module.exports, \"decodeURISafely\", () => $a5d3b883bf9e749e$export$205603ad3b38424c);\n$parcel$export(module.exports, \"getFileNameWithExt\", () => $a5d3b883bf9e749e$export$4569d268217979d8);\n$parcel$export(module.exports, \"getFilePath\", () => $a5d3b883bf9e749e$export$a8ae171f556d108c);\n$parcel$export(module.exports, \"simplifyName\", () => $a5d3b883bf9e749e$export$1cb6eb118298c3f6);\n$parcel$export(module.exports, \"simplifyPath\", () => $a5d3b883bf9e749e$export$7a9d66609c223fd8);\n$parcel$export(module.exports, \"decodeURIComponentSafely\", () => $a5d3b883bf9e749e$export$245a8ae5fac6ab9);\n$parcel$export(module.exports, \"parseKeywords\", () => $a5d3b883bf9e749e$export$b7039c4b5522f566);\n$parcel$export(module.exports, \"isImage\", () => $a5d3b883bf9e749e$export$fb85bc5d6d9ef19b);\n$parcel$export(module.exports, \"isVideo\", () => $a5d3b883bf9e749e$export$ac5608bbe92d6fdc);\n$parcel$export(module.exports, \"callForgeVTT\", () => $a5d3b883bf9e749e$export$a3fc2fee1fd32b75);\n$parcel$export(module.exports, \"getFilters\", () => $a5d3b883bf9e749e$export$1933a9fe712fc1fd);\n$parcel$export(module.exports, \"userRequiresImageCache\", () => $a5d3b883bf9e749e$export$e97747128355dc59);\n$parcel$export(module.exports, \"waitForTokenTexture\", () => $a5d3b883bf9e749e$export$81af53b76c17cdd8);\n$parcel$export(module.exports, \"flattenSearchResults\", () => $a5d3b883bf9e749e$export$1a1482e70c3f8ffc);\n$parcel$export(module.exports, \"tv_executeScript\", () => $a5d3b883bf9e749e$export$da928b76213541d1);\n$parcel$export(module.exports, \"executeMacro\", () => $a5d3b883bf9e749e$export$4efd75b42b486b4d);\n$parcel$export(module.exports, \"applyTMFXPreset\", () => $a5d3b883bf9e749e$export$e43fe9e17895939b);\n$parcel$export(module.exports, \"toggleTMFXPreset\", () => $a5d3b883bf9e749e$export$961a6e71d6289ec6);\n$parcel$export(module.exports, \"applyCEEffect\", () => $a5d3b883bf9e749e$export$8a36ba247bf4b0d0);\n$parcel$export(module.exports, \"toggleCEEffect\", () => $a5d3b883bf9e749e$export$6fc760b2ad2335ff);\n$parcel$export(module.exports, \"determineAddedRemovedEffects\", () => $a5d3b883bf9e749e$export$5afaac5d3dad358c);\n$parcel$export(module.exports, \"nameForgeRandomize\", () => $a5d3b883bf9e749e$export$c60cd2bc191c0655);\n$parcel$export(module.exports, \"uploadTokenImage\", () => $a5d3b883bf9e749e$export$7c70b8725990bcc9);\n$parcel$export(module.exports, \"getAllActorTokens\", () => $a5d3b883bf9e749e$export$1bad3b5e11592c24);\n$parcel$export(module.exports, \"string2Hex\", () => $a5d3b883bf9e749e$export$2b4b146f5cd9519c);\n$parcel$export(module.exports, \"mergeMappings\", () => $a5d3b883bf9e749e$export$488134d4acacca33);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $eYkM9 = parcelRequire(\"eYkM9\");\n\nvar $dxtrh = parcelRequire(\"dxtrh\");\n\nvar $cs88A = parcelRequire(\"cs88A\");\nconst $a5d3b883bf9e749e$var$simplifyRegex = new RegExp(/[^A-Za-z0-9/\\\\]/g);\nconst $a5d3b883bf9e749e$export$6d117a2f25d7dc54 = [\n \"rotation\",\n \"elevation\"\n];\nconst $a5d3b883bf9e749e$export$313cceabf063c648 = [\n \"\\\\(\",\n \"\\\\)\",\n \"&&\",\n \"||\",\n \"\\\\!\"\n];\nconst $a5d3b883bf9e749e$export$71ce8fbad5957261 = {\n PORTRAIT: \"Portrait\",\n TOKEN: \"Token\",\n PORTRAIT_AND_TOKEN: \"PortraitAndToken\",\n TILE: \"Tile\",\n ITEM: \"Item\",\n JOURNAL: \"JournalEntry\",\n MACRO: \"Macro\"\n};\nconst $a5d3b883bf9e749e$export$bb3b35fb4fbd121a = [\n \"Portrait\",\n \"Token\",\n \"PortraitAndToken\",\n \"Tile\",\n \"Item\",\n \"JournalEntry\",\n \"Macro\",\n \"RollTable\"\n];\nconst $a5d3b883bf9e749e$export$b9f1c298ac3e67 = {\n popupOverride: false,\n config: false\n};\nconst $a5d3b883bf9e749e$var$BATCH_UPDATES = {\n TOKEN: [],\n TOKEN_CALLBACKS: [],\n TOKEN_CONTEXT: {\n animate: true\n },\n ACTOR: [],\n ACTOR_CONTEXT: null\n};\nfunction $a5d3b883bf9e749e$export$a9fe6b4c86ebbf2c() {\n canvas.app.ticker.add(()=>{\n if ($a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN.length) {\n canvas.scene.updateEmbeddedDocuments(\"Token\", $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN, $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN_CONTEXT).then(()=>{\n for (const cb of $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN_CALLBACKS)cb();\n $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN_CALLBACKS = [];\n });\n $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN = [];\n }\n if ($a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR.length !== 0) {\n if ($a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR_CONTEXT) Actor.updateDocuments($a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR, $a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR_CONTEXT);\n else Actor.updateDocuments($a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR);\n $a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR = [];\n $a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR_CONTEXT = null;\n }\n });\n}\nfunction $a5d3b883bf9e749e$export$2ab69819310737f7(id, update, callback = null, animate = true) {\n update._id = id;\n $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN.push(update);\n $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN_CONTEXT = {\n animate: animate\n };\n if (callback) $a5d3b883bf9e749e$var$BATCH_UPDATES.TOKEN_CALLBACKS.push(callback);\n}\nfunction $a5d3b883bf9e749e$export$fbec16849efa95ca(id, update, context = null) {\n update._id = id;\n $a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR.push(update);\n $a5d3b883bf9e749e$var$BATCH_UPDATES.ACTOR_CONTEXT = context;\n}\nasync function $a5d3b883bf9e749e$export$9a81af9500bcd927(imgSrc, { token: token = null, actor: actor = null, imgName: imgName = null, tokenUpdate: tokenUpdate = {}, actorUpdate: actorUpdate = {}, pack: pack = \"\", callback: callback = null, config: config, animate: animate = true, update: update = null, applyDefaultConfig: applyDefaultConfig = true } = {}) {\n if (!(token || actor)) {\n console.warn(game.i18n.localize(\"token-variants.notifications.warn.update-image-no-token-actor\"));\n return;\n }\n token = token?.document ?? token;\n // Check if it's a wildcard image\n if (imgSrc && imgSrc.includes(\"*\") || imgSrc.includes(\"{\") && imgSrc.includes(\"}\")) {\n const images = await $a5d3b883bf9e749e$export$b62bf063b9928bd7(imgSrc);\n if (images.length) imgSrc = images[Math.floor(Math.random() * images.length)];\n }\n if (!actor && token.actor) actor = game.actors.get(token.actor.id);\n const getDefaultConfig = (token, actor)=>{\n let configEntries = [];\n if (token) configEntries = token.getFlag(\"token-variants\", \"defaultConfig\") || [];\n else if (actor) {\n const tokenData = actor.prototypeToken;\n if (\"token-variants\" in tokenData.flags && \"defaultConfig\" in tokenData[\"token-variants\"]) configEntries = tokenData[\"token-variants\"][\"defaultConfig\"];\n }\n return expandObject(Object.fromEntries(configEntries));\n };\n const constructDefaultConfig = (origData, customConfig)=>{\n const flatOrigData = flattenObject(origData);\n $a5d3b883bf9e749e$export$7fe60b94e2075390.dataToForm(flatOrigData);\n const flatCustomConfig = flattenObject(customConfig);\n let filtered = filterObject(flatOrigData, flatCustomConfig);\n // Flags need special treatment as once set they are not removed via absence of them in the update\n for (let [k, v] of Object.entries(flatCustomConfig)){\n if (k.startsWith(\"flags.\")) {\n if (!(k in flatOrigData)) {\n let splitK = k.split(\".\");\n splitK[splitK.length - 1] = \"-=\" + splitK[splitK.length - 1];\n filtered[splitK.join(\".\")] = null;\n }\n }\n }\n return Object.entries(filtered);\n };\n let tokenUpdateObj = tokenUpdate;\n if (imgSrc) {\n setProperty(tokenUpdateObj, \"texture.src\", imgSrc);\n if (imgName && $a5d3b883bf9e749e$export$1396dd911f86baee(imgSrc) === imgName) setProperty(tokenUpdateObj, \"flags.token-variants.-=name\", null);\n else setProperty(tokenUpdateObj, \"flags.token-variants.name\", imgName);\n }\n const tokenCustomConfig = mergeObject($a5d3b883bf9e749e$export$f5cd0e7fffe879fe(imgSrc || token?.texture.src, imgName, token), config ?? {});\n const usingCustomConfig = token?.getFlag(\"token-variants\", \"usingCustomConfig\");\n const defaultConfig = getDefaultConfig(token);\n if (!isEmpty(tokenCustomConfig) || usingCustomConfig) tokenUpdateObj = $a5d3b883bf9e749e$export$defc74b45e490df8(tokenUpdateObj, defaultConfig);\n if (!isEmpty(tokenCustomConfig)) {\n if (token) {\n setProperty(tokenUpdateObj, \"flags.token-variants.usingCustomConfig\", true);\n let doc = token.document ?? token;\n const tokenData = doc.toObject ? doc.toObject() : deepClone(doc);\n const defConf = constructDefaultConfig(mergeObject(tokenData, defaultConfig), tokenCustomConfig);\n setProperty(tokenUpdateObj, \"flags.token-variants.defaultConfig\", defConf);\n } else if (actor && !token) {\n setProperty(tokenUpdateObj, \"flags.token-variants.usingCustomConfig\", true);\n const tokenData = actor.prototypeToken instanceof Object ? actor.prototypeToken : actor.prototypeToken.toObject();\n const defConf = constructDefaultConfig(tokenData, tokenCustomConfig);\n setProperty(tokenUpdateObj, \"flags.token-variants.defaultConfig\", defConf);\n }\n // Fix, an empty flag may be passed which would overwrite any current flags in the updateObj\n // Remove it before doing the merge\n if (!tokenCustomConfig.flags) delete tokenCustomConfig.flags;\n tokenUpdateObj = $a5d3b883bf9e749e$export$defc74b45e490df8(tokenUpdateObj, tokenCustomConfig);\n } else if (usingCustomConfig) {\n setProperty(tokenUpdateObj, \"flags.token-variants.-=usingCustomConfig\", null);\n delete tokenUpdateObj?.flags?.[\"token-variants\"]?.defaultConfig;\n setProperty(tokenUpdateObj, \"flags.token-variants.-=defaultConfig\", null);\n }\n if (!applyDefaultConfig) {\n setProperty(tokenUpdateObj, \"flags.token-variants.-=usingCustomConfig\", null);\n delete tokenUpdateObj?.flags?.[\"token-variants\"]?.defaultConfig;\n setProperty(tokenUpdateObj, \"flags.token-variants.-=defaultConfig\", null);\n }\n if (!isEmpty(tokenUpdateObj)) {\n if (actor && !token) {\n $a5d3b883bf9e749e$export$7fe60b94e2075390.formToData(actor.prototypeToken, tokenUpdateObj);\n actorUpdate.token = tokenUpdateObj;\n if (pack) $a5d3b883bf9e749e$export$fbec16849efa95ca(actor.id, actorUpdate, {\n pack: pack\n });\n else await (actor.document ?? actor).update(actorUpdate);\n }\n if (token) {\n $a5d3b883bf9e749e$export$7fe60b94e2075390.formToData(token, tokenUpdateObj);\n if ((0, $9IngI.TVA_CONFIG).updateTokenProto && token.actor) {\n if (update) mergeObject(update, {\n token: tokenUpdateObj\n });\n else // Timeout to prevent race conditions with other modules namely MidiQOL\n // this is a low priority update so it should be Ok to do\n if (token.actorLink) setTimeout(()=>$a5d3b883bf9e749e$export$fbec16849efa95ca(token.actor.id, {\n token: tokenUpdateObj\n }), 500);\n else setTimeout(()=>token.actor.update({\n token: tokenUpdateObj\n }), 500);\n }\n if (update) mergeObject(update, tokenUpdateObj);\n else if (token.object) $a5d3b883bf9e749e$export$2ab69819310737f7(token.id, tokenUpdateObj, callback, animate);\n else {\n await token.update(tokenUpdateObj, {\n animate: animate\n });\n callback();\n }\n }\n }\n}\nasync function $a5d3b883bf9e749e$export$853901ce27596d97(actor, imgSrc, directUpdate = true, pack = \"\") {\n if (!actor) return;\n if (directUpdate) await (actor.document ?? actor).update({\n img: imgSrc\n });\n else $a5d3b883bf9e749e$export$fbec16849efa95ca(actor.id, {\n img: imgSrc\n }, pack ? {\n pack: pack\n } : null);\n}\nasync function $a5d3b883bf9e749e$var$showTileArtSelect() {\n for (const tile of canvas.tiles.controlled){\n const tileName = tile.document.getFlag(\"token-variants\", \"tileName\") || tile.id;\n (0, $coMHP.showArtSelect)(tileName, {\n callback: async function(imgSrc, name) {\n tile.document.update({\n img: imgSrc\n });\n },\n searchType: $a5d3b883bf9e749e$export$71ce8fbad5957261.TILE\n });\n }\n}\nfunction $a5d3b883bf9e749e$export$e09b512eecac7579(key) {\n if (key === \"v\") return game.keyboard.downKeys.has(\"KeyV\");\n return $a5d3b883bf9e749e$export$b9f1c298ac3e67[key];\n}\nfunction $a5d3b883bf9e749e$export$2e69de36ed96343() {\n game.keybindings.register(\"token-variants\", \"popupOverride\", {\n name: \"Popup Override\",\n hint: \"When held will trigger popups even when they are disabled.\",\n editable: [\n {\n key: \"ShiftLeft\"\n }\n ],\n onDown: ()=>{\n $a5d3b883bf9e749e$export$b9f1c298ac3e67.popupOverride = true;\n },\n onUp: ()=>{\n $a5d3b883bf9e749e$export$b9f1c298ac3e67.popupOverride = false;\n },\n restricted: false,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n game.keybindings.register(\"token-variants\", \"config\", {\n name: \"Config\",\n hint: \"When held during a mouse Left-Click of an Image or an Active Affect will display a configuration window.\",\n editable: [\n {\n key: \"ShiftLeft\"\n }\n ],\n onDown: ()=>{\n $a5d3b883bf9e749e$export$b9f1c298ac3e67.config = true;\n },\n onUp: ()=>{\n $a5d3b883bf9e749e$export$b9f1c298ac3e67.config = false;\n },\n restricted: false,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n game.keybindings.register(\"token-variants\", \"showArtSelectPortrait\", {\n name: \"Show Art Select: Portrait\",\n hint: \"Brings up an Art Select pop-up to change the portrait images of the selected tokens.\",\n editable: [\n {\n key: \"Digit1\",\n modifiers: [\n \"Shift\"\n ]\n }\n ],\n onDown: ()=>{\n for (const token of canvas.tokens.controlled){\n const actor = token.actor;\n if (!actor) continue;\n (0, $coMHP.showArtSelect)(actor.name, {\n callback: async function(imgSrc, name) {\n await $a5d3b883bf9e749e$export$853901ce27596d97(actor, imgSrc);\n },\n searchType: $a5d3b883bf9e749e$export$71ce8fbad5957261.PORTRAIT,\n object: actor\n });\n }\n if ((0, $9IngI.TVA_CONFIG).tilesEnabled && canvas.tokens.controlled.length === 0) $a5d3b883bf9e749e$var$showTileArtSelect();\n },\n restricted: true,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n game.keybindings.register(\"token-variants\", \"showArtSelectToken\", {\n name: \"Show Art Select: Token\",\n hint: \"Brings up an Art Select pop-up to change the token images of the selected tokens.\",\n editable: [\n {\n key: \"Digit2\",\n modifiers: [\n \"Shift\"\n ]\n }\n ],\n onDown: ()=>{\n for (const token of canvas.tokens.controlled)(0, $coMHP.showArtSelect)(token.name, {\n callback: async function(imgSrc, imgName) {\n $a5d3b883bf9e749e$export$9a81af9500bcd927(imgSrc, {\n actor: token.actor,\n imgName: imgName,\n token: token\n });\n },\n searchType: $a5d3b883bf9e749e$export$71ce8fbad5957261.TOKEN,\n object: token\n });\n if ((0, $9IngI.TVA_CONFIG).tilesEnabled && canvas.tokens.controlled.length === 0) $a5d3b883bf9e749e$var$showTileArtSelect();\n },\n restricted: true,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n game.keybindings.register(\"token-variants\", \"showArtSelectGeneral\", {\n name: \"Show Art Select: Portrait+Token\",\n hint: \"Brings up an Art Select pop-up to change both Portrait and Token images of the selected tokens.\",\n editable: [\n {\n key: \"Digit3\",\n modifiers: [\n \"Shift\"\n ]\n }\n ],\n onDown: ()=>{\n for (const token of canvas.tokens.controlled){\n const actor = token.actor;\n (0, $coMHP.showArtSelect)(token.name, {\n callback: async function(imgSrc, imgName) {\n if (actor) await $a5d3b883bf9e749e$export$853901ce27596d97(actor, imgSrc);\n $a5d3b883bf9e749e$export$9a81af9500bcd927(imgSrc, {\n actor: token.actor,\n imgName: imgName,\n token: token\n });\n },\n searchType: $a5d3b883bf9e749e$export$71ce8fbad5957261.PORTRAIT_AND_TOKEN,\n object: token\n });\n }\n if ((0, $9IngI.TVA_CONFIG).tilesEnabled && canvas.tokens.controlled.length === 0) $a5d3b883bf9e749e$var$showTileArtSelect();\n },\n restricted: true,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n game.keybindings.register(\"token-variants\", \"openGlobalMappings\", {\n name: \"Open Global Effect Configurations\",\n hint: \"Brings up the settings window for Global Effect Configurations\",\n editable: [\n {\n key: \"KeyG\",\n modifiers: [\n \"Shift\"\n ]\n }\n ],\n onDown: ()=>{\n const setting = game.settings.get(\"core\", DefaultTokenConfig.SETTING);\n const data = new foundry.data.PrototypeToken(setting);\n const token = new TokenDocument(data, {\n actor: null\n });\n new (0, $eYkM9.default)(token, {\n globalMappings: true\n }).render(true);\n },\n restricted: true,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n game.keybindings.register(\"token-variants\", \"compendiumMapper\", {\n name: \"Compendium Mapper\",\n hint: \"Opens Compendium Mapper\",\n editable: [\n {\n key: \"KeyM\",\n modifiers: [\n \"Shift\"\n ]\n }\n ],\n onDown: ()=>{\n new (0, $dxtrh.default)().render(true);\n },\n restricted: true,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n game.keybindings.register(\"token-variants\", \"toggleTemplate\", {\n name: \"Toggle Template Dialog\",\n hint: \"Brings up a dialog from which you can toggle templates on currently selected tokens.\",\n editable: [],\n onDown: (0, $cs88A.toggleTemplateDialog),\n restricted: true,\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL\n });\n}\nfunction $a5d3b883bf9e749e$export$cf2a4e460992a64b(imgSrc, imgName) {\n if (!imgName) imgName = $a5d3b883bf9e749e$export$1396dd911f86baee(imgSrc);\n const tokenConfigs = ((0, $9IngI.TVA_CONFIG).tokenConfigs || []).flat();\n return tokenConfigs.find((config)=>config.tvImgSrc == imgSrc && config.tvImgName == imgName) ?? {};\n}\nfunction $a5d3b883bf9e749e$export$f5cd0e7fffe879fe(imgSrc, imgName, token) {\n if (!imgSrc) return {};\n let tokenConfig = {};\n for (const path of (0, $9IngI.TVA_CONFIG).searchPaths)if (path.config && imgSrc.startsWith(path.text)) mergeObject(tokenConfig, path.config);\n let imgConfig = $a5d3b883bf9e749e$export$cf2a4e460992a64b(imgSrc, imgName ?? $a5d3b883bf9e749e$export$1396dd911f86baee(imgSrc));\n if (!isEmpty(imgConfig)) {\n imgConfig = deepClone(imgConfig);\n delete imgConfig.tvImgSrc;\n delete imgConfig.tvImgName;\n if (token) $a5d3b883bf9e749e$export$7fe60b94e2075390.formToData(token, imgConfig);\n for(var key in imgConfig)if (!key.startsWith(\"tvTab_\")) tokenConfig[key] = imgConfig[key];\n }\n if ((0, $9IngI.TVA_CONFIG).imgNameContainsDimensions || (0, $9IngI.TVA_CONFIG).imgNameContainsFADimensions) $a5d3b883bf9e749e$export$5a727c8601678802(imgSrc, tokenConfig);\n return tokenConfig;\n}\nfunction $a5d3b883bf9e749e$export$99dcb6b6e71c8ec3(imgSrc, imgName, tokenConfig) {\n const tokenConfigs = ((0, $9IngI.TVA_CONFIG).tokenConfigs || []).flat();\n const tcIndex = tokenConfigs.findIndex((config)=>config.tvImgSrc == imgSrc && config.tvImgName == imgName);\n let deleteConfig = !tokenConfig || Object.keys(tokenConfig).length === 0;\n if (!deleteConfig) {\n tokenConfig[\"tvImgSrc\"] = imgSrc;\n tokenConfig[\"tvImgName\"] = imgName;\n }\n if (tcIndex != -1 && !deleteConfig) tokenConfigs[tcIndex] = tokenConfig;\n else if (tcIndex != -1 && deleteConfig) tokenConfigs.splice(tcIndex, 1);\n else if (!deleteConfig) tokenConfigs.push(tokenConfig);\n (0, $9IngI.updateSettings)({\n tokenConfigs: tokenConfigs\n });\n return !deleteConfig;\n}\nfunction $a5d3b883bf9e749e$export$1396dd911f86baee(path) {\n if (!path) return \"\";\n return $a5d3b883bf9e749e$export$205603ad3b38424c(path).split(\"\\\\\").pop().split(\"/\").pop().split(\".\").slice(0, -1).join(\".\");\n}\nfunction $a5d3b883bf9e749e$export$4569d268217979d8(path) {\n if (!path) return \"\";\n return $a5d3b883bf9e749e$export$205603ad3b38424c(path).split(\"\\\\\").pop().split(\"/\").pop();\n}\nfunction $a5d3b883bf9e749e$export$a8ae171f556d108c(path) {\n return $a5d3b883bf9e749e$export$205603ad3b38424c(path).match(/(.*)[\\/\\\\]/)[1] || \"\";\n}\nfunction $a5d3b883bf9e749e$export$1cb6eb118298c3f6(name) {\n return name.replace($a5d3b883bf9e749e$var$simplifyRegex, \"\").toLowerCase();\n}\nfunction $a5d3b883bf9e749e$export$7a9d66609c223fd8(path) {\n return $a5d3b883bf9e749e$export$245a8ae5fac6ab9(path).replace($a5d3b883bf9e749e$var$simplifyRegex, \"\").toLowerCase();\n}\nfunction $a5d3b883bf9e749e$export$b7039c4b5522f566(keywords) {\n return keywords.split(/\\W/).map((word)=>$a5d3b883bf9e749e$export$1cb6eb118298c3f6(word)).filter((word)=>word != \"\");\n}\nfunction $a5d3b883bf9e749e$export$fb85bc5d6d9ef19b(path) {\n var extension = path.split(\".\");\n extension = extension[extension.length - 1].toLowerCase();\n return [\n \"jpg\",\n \"jpeg\",\n \"png\",\n \"svg\",\n \"webp\",\n \"gif\"\n ].includes(extension);\n}\nfunction $a5d3b883bf9e749e$export$ac5608bbe92d6fdc(path) {\n var extension = path.split(\".\");\n extension = extension[extension.length - 1].toLowerCase();\n return [\n \"mp4\",\n \"ogg\",\n \"webm\",\n \"m4v\"\n ].includes(extension);\n}\nasync function $a5d3b883bf9e749e$export$a3fc2fee1fd32b75(path, apiKey) {\n return new Promise(async (resolve, reject)=>{\n if (typeof ForgeVTT === \"undefined\" || !ForgeVTT.usingTheForge) return resolve({});\n const url = `${ForgeVTT.FORGE_URL}/api/assets/browse`;\n const xhr = new XMLHttpRequest();\n xhr.withCredentials = true;\n xhr.open(\"POST\", url);\n xhr.setRequestHeader(\"Access-Key\", apiKey);\n xhr.setRequestHeader(\"X-XSRF-TOKEN\", await ForgeAPI.getXSRFToken());\n xhr.responseType = \"json\";\n xhr.onreadystatechange = ()=>{\n if (xhr.readyState !== 4) return;\n resolve(xhr.response);\n };\n xhr.onerror = (err)=>{\n resolve({\n code: 500,\n error: err.message\n });\n };\n let formData = {\n path: path,\n options: {\n recursive: true\n }\n };\n formData = JSON.stringify(formData);\n xhr.setRequestHeader(\"Content-type\", \"application/json; charset=utf-8\");\n xhr.send(formData);\n });\n}\nfunction $a5d3b883bf9e749e$export$1933a9fe712fc1fd(searchType, filters) {\n // Select filters based on type of search\n filters = filters ? filters : (0, $9IngI.TVA_CONFIG).searchFilters;\n if (filters[searchType]) filters = filters[searchType];\n else filters = {\n include: \"\",\n exclude: \"\",\n regex: \"\"\n };\n if (filters.regex) filters.regex = new RegExp(filters.regex);\n return filters;\n}\nfunction $a5d3b883bf9e749e$export$e97747128355dc59(perm) {\n const permissions = perm ? perm : (0, $9IngI.TVA_CONFIG).permissions;\n const role = game.user.role;\n return permissions.popups[role] || permissions.portrait_right_click[role] || permissions.image_path_button[role] || permissions.hudFullAccess[role];\n}\nasync function $a5d3b883bf9e749e$export$81af53b76c17cdd8(token, callback, checks = 40) {\n // v10/v9 compatibility\n if (!token.mesh || !token.mesh.texture) {\n checks--;\n if (checks > 1) new Promise((resolve)=>setTimeout(resolve, 1)).then(()=>$a5d3b883bf9e749e$export$81af53b76c17cdd8(token, callback, checks));\n return;\n }\n callback(token);\n}\nfunction $a5d3b883bf9e749e$export$1a1482e70c3f8ffc(results) {\n let flattened = [];\n if (!results) return flattened;\n results.forEach((images)=>{\n flattened = flattened.concat(images);\n });\n return flattened;\n}\nfunction $a5d3b883bf9e749e$export$defc74b45e490df8(original, other = {}, { insertKeys: insertKeys = true, insertValues: insertValues = true, overwrite: overwrite = true, recursive: recursive = true, inplace: inplace = true, enforceTypes: enforceTypes = false } = {}, _d = 0) {\n other = other || {};\n if (!(original instanceof Object) || !(other instanceof Object)) throw new Error(\"One of original or other are not Objects!\");\n const options = {\n insertKeys: insertKeys,\n insertValues: insertValues,\n overwrite: overwrite,\n recursive: recursive,\n inplace: inplace,\n enforceTypes: enforceTypes\n };\n // Special handling at depth 0\n if (_d === 0) {\n if (!inplace) original = deepClone(original);\n if (Object.keys(original).some((k)=>/\\./.test(k))) original = expandObject(original);\n if (Object.keys(other).some((k)=>/\\./.test(k))) other = expandObject(other);\n }\n // Iterate over the other object\n for (let k of Object.keys(other)){\n const v = other[k];\n if (original.hasOwnProperty(\"-=\" + k)) {\n original[k] = original[\"-=\" + k];\n delete original[\"-=\" + k];\n }\n if (original.hasOwnProperty(k)) $a5d3b883bf9e749e$var$_modMergeUpdate(original, k, v, options, _d + 1);\n else $a5d3b883bf9e749e$var$_modMergeInsert(original, k, v, options, _d + 1);\n }\n return original;\n}\n/**\r\n * A helper function for merging objects when the target key does not exist in the original\r\n * @private\r\n */ function $a5d3b883bf9e749e$var$_modMergeInsert(original, k, v, { insertKeys: insertKeys, insertValues: insertValues } = {}, _d) {\n // Recursively create simple objects\n if (v?.constructor === Object) {\n original[k] = $a5d3b883bf9e749e$export$defc74b45e490df8({}, v, {\n insertKeys: true,\n inplace: true\n });\n return;\n }\n // Delete a key\n // if (k.startsWith('-=')) {\n // delete original[k.slice(2)];\n // return;\n // }\n // Insert a key\n const canInsert = _d <= 1 && insertKeys || _d > 1 && insertValues;\n if (canInsert) original[k] = v;\n}\n/**\r\n * A helper function for merging objects when the target key exists in the original\r\n * @private\r\n */ function $a5d3b883bf9e749e$var$_modMergeUpdate(original, k, v, { insertKeys: insertKeys, insertValues: insertValues, enforceTypes: enforceTypes, overwrite: overwrite, recursive: recursive } = {}, _d) {\n const x = original[k];\n const tv = getType(v);\n const tx = getType(x);\n // Recursively merge an inner object\n if (tv === \"Object\" && tx === \"Object\" && recursive) return $a5d3b883bf9e749e$export$defc74b45e490df8(x, v, {\n insertKeys: insertKeys,\n insertValues: insertValues,\n overwrite: overwrite,\n inplace: true,\n enforceTypes: enforceTypes\n }, _d);\n // Overwrite an existing value\n if (overwrite) {\n if (tx !== \"undefined\" && tv !== tx && enforceTypes) throw new Error(`Mismatched data types encountered during object merge.`);\n original[k] = v;\n }\n}\nasync function $a5d3b883bf9e749e$export$da928b76213541d1(script, { actor: actor, token: token, tvaUpdate: tvaUpdate } = {}) {\n // Add variables to the evaluation scope\n const speaker = ChatMessage.getSpeaker();\n const character = game.user.character;\n token = token?.object || token || (canvas.ready ? canvas.tokens.get(speaker.token) : null);\n actor = actor || token?.actor || game.actors.get(speaker.actor);\n // Attempt script execution\n const AsyncFunction = (async function() {}).constructor;\n try {\n const fn = AsyncFunction(\"speaker\", \"actor\", \"token\", \"character\", \"tvaUpdate\", `${script}`);\n await fn.call(null, speaker, actor, token, character, tvaUpdate);\n } catch (err) {\n ui.notifications.error(`There was an error in your script syntax. See the console (F12) for details`);\n console.error(err);\n }\n}\nasync function $a5d3b883bf9e749e$export$4efd75b42b486b4d(macroName, token) {\n token = token?.object || token;\n game.macros.find((m)=>m.name === macroName)?.execute({\n token: token\n });\n}\nasync function $a5d3b883bf9e749e$export$e43fe9e17895939b(token, presetName, action = \"apply\") {\n token = token.object ?? token;\n if (game.modules.get(\"tokenmagic\")?.active && token.document) {\n const preset = TokenMagic.getPreset(presetName);\n if (preset) {\n if (action === \"apply\") await TokenMagic.addUpdateFilters(token, preset);\n else if (action === \"remove\") await TokenMagic.deleteFilters(token, presetName);\n }\n }\n}\nasync function $a5d3b883bf9e749e$export$961a6e71d6289ec6(token, presetName) {\n token = token.object ?? token;\n if (game.modules.get(\"tokenmagic\")?.active && token.document) {\n if (TokenMagic.hasFilterId(token, presetName)) $a5d3b883bf9e749e$export$e43fe9e17895939b(token, presetName, \"remove\");\n else $a5d3b883bf9e749e$export$e43fe9e17895939b(token, presetName, \"apply\");\n }\n}\nasync function $a5d3b883bf9e749e$export$8a36ba247bf4b0d0(tokenDoc, ceEffect, action = \"apply\") {\n if (game.modules.get(\"dfreds-convenient-effects\")?.active) {\n if (!ceEffect.apply && !ceEffect.remove) return;\n else if (!ceEffect.apply || !ceEffect.remove) {\n if (action === \"apply\") {\n if (ceEffect.remove) action = \"remove\";\n } else return;\n }\n let uuid = tokenDoc.actor?.uuid;\n if (uuid) {\n if (action === \"apply\") await game.dfreds.effectInterface.addEffect({\n effectName: ceEffect.name,\n uuid: uuid,\n origin: \"token-variants\",\n overlay: false\n });\n else await game.dfreds.effectInterface.removeEffect({\n effectName: ceEffect.name,\n uuid: uuid\n });\n }\n }\n}\nasync function $a5d3b883bf9e749e$export$6fc760b2ad2335ff(token, effectName) {\n if (game.modules.get(\"dfreds-convenient-effects\")?.active) {\n let uuid = (token.document ?? token).actor?.uuid;\n await game.dfreds.effectInterface.toggleEffect(effectName, {\n uuids: [\n uuid\n ],\n overlay: false\n });\n }\n}\nclass $a5d3b883bf9e749e$export$7fe60b94e2075390 {\n static dataToForm(data) {\n if (\"texture.scaleX\" in data) {\n data.scale = Math.abs(data[\"texture.scaleX\"]);\n data.mirrorX = data[\"texture.scaleX\"] < 0;\n }\n if (\"texture.scaleY\" in data) {\n data.scale = Math.abs(data[\"texture.scaleY\"]);\n data.mirrorY = data[\"texture.scaleY\"] < 0;\n }\n }\n static formToData(token, formData) {\n // Scale/mirroring\n if (\"scale\" in formData || \"mirrorX\" in formData || \"mirrorY\" in formData) {\n const doc = token.document ? token.document : token;\n if (!(\"scale\" in formData)) formData.scale = Math.abs(doc.texture.scaleX);\n if (!(\"mirrorX\" in formData)) formData.mirrorX = doc.texture.scaleX < 0;\n if (!(\"mirrorY\" in formData)) formData.mirrorY = doc.texture.scaleY < 0;\n setProperty(formData, \"texture.scaleX\", formData.scale * (formData.mirrorX ? -1 : 1));\n setProperty(formData, \"texture.scaleY\", formData.scale * (formData.mirrorY ? -1 : 1));\n [\n \"scale\",\n \"mirrorX\",\n \"mirrorY\"\n ].forEach((k)=>delete formData[k]);\n }\n }\n}\nfunction $a5d3b883bf9e749e$export$5afaac5d3dad358c(addedEffects, removedEffects, newEffects, oldEffects) {\n for (const ef of newEffects)if (!oldEffects.includes(ef)) addedEffects.push(ef);\n for (const ef of oldEffects)if (!newEffects.includes(ef)) removedEffects.push(ef);\n}\nasync function $a5d3b883bf9e749e$export$b62bf063b9928bd7(imgSrc) {\n let source = \"data\";\n const browseOptions = {\n wildcard: true\n };\n // Support non-user sources\n if (/\\.s3\\./.test(imgSrc)) {\n source = \"s3\";\n const { bucket: bucket, keyPrefix: keyPrefix } = FilePicker.parseS3URL(imgSrc);\n if (bucket) {\n browseOptions.bucket = bucket;\n imgSrc = keyPrefix;\n }\n } else if (imgSrc.startsWith(\"icons/\")) source = \"public\";\n // Retrieve wildcard content\n try {\n const content = await FilePicker.browse(source, imgSrc, browseOptions);\n return content.files;\n } catch (err) {}\n return [];\n}\nasync function $a5d3b883bf9e749e$export$c60cd2bc191c0655(randomizerSettings) {\n const nameForgeSettings = randomizerSettings.nameForge;\n if (nameForgeSettings?.randomize && nameForgeSettings?.models) {\n const nameForge = game.modules.get(\"nameforge\");\n if (nameForge?.active) {\n const randomNames = [];\n for (const modelKey of nameForgeSettings.models){\n const modelProp = getProperty(nameForge.models, modelKey);\n if (modelProp) {\n const model = await nameForge.api.createModel(modelProp);\n if (model) randomNames.push(nameForge.api.generateName(model)[0]);\n }\n }\n return randomNames[Math.floor(Math.random() * randomNames.length)];\n }\n }\n return null;\n}\nasync function $a5d3b883bf9e749e$export$7c70b8725990bcc9(token, options) {\n let renderTexture = $a5d3b883bf9e749e$var$captureToken(token, options);\n if (renderTexture) {\n const b64 = canvas.app.renderer.extract.base64(renderTexture, \"image/webp\", 1);\n let res = await fetch(b64);\n let blob = await res.blob();\n const filename = options.name + `.webp`;\n let file = new File([\n blob\n ], filename, {\n type: \"image/webp\"\n });\n await FilePicker.upload(\"data\", options.path, file, {});\n }\n}\n/**\r\n * Modified version of 'dev7355608' captureCanvas function. Captures combined Token and Overlay image\r\n */ function $a5d3b883bf9e749e$var$captureToken(token, { scale: scale = 3, width: width = null, height: height = null } = {}) {\n if (!canvas.ready || !token) return;\n width = width ?? token.texture.width;\n height = height ?? token.texture.height;\n scale = scale * Math.min(width / token.texture.width, height / token.texture.height);\n const renderer = canvas.app.renderer;\n const viewPosition = {\n ...canvas.scene._viewPosition\n };\n renderer.resize(width ?? renderer.screen.width, height ?? renderer.screen.height);\n width = canvas.screenDimensions[0] = renderer.screen.width;\n height = canvas.screenDimensions[1] = renderer.screen.height;\n canvas.stage.position.set(width / 2, height / 2);\n canvas.pan({\n x: token.center.x,\n y: token.center.y,\n scale: scale\n });\n const renderTexture = PIXI.RenderTexture.create({\n width: width,\n height: height,\n resolution: token.texture.resolution\n });\n const cacheParent = canvas.stage.enableTempParent();\n canvas.stage.updateTransform();\n canvas.stage.disableTempParent(cacheParent);\n let spritesToRender = [\n token.mesh\n ];\n if (token.tvaOverlays) spritesToRender = spritesToRender.concat(token.tvaOverlays);\n spritesToRender.sort((sprite)=>sprite.sort);\n for (const sprite of spritesToRender)renderer.render(sprite, {\n renderTexture: renderTexture,\n skipUpdateTransform: true,\n clear: false\n });\n canvas._onResize();\n canvas.pan(viewPosition);\n return renderTexture;\n}\nfunction $a5d3b883bf9e749e$export$1bad3b5e11592c24(actor, linked = false, document = false) {\n if (actor.isToken) {\n if (document) return [\n actor.token\n ];\n else if (actor.token.object) return [\n actor.token.object\n ];\n else return [];\n }\n const tokens = [];\n game.scenes.forEach((scene)=>scene.tokens.forEach((token)=>{\n if (token.actorId === actor.id) {\n if (linked && token.actorLink) tokens.push(token);\n else if (!linked) tokens.push(token);\n }\n }));\n if (document) return tokens;\n else return tokens.map((token)=>token.object).filter((token)=>token);\n}\nfunction $a5d3b883bf9e749e$export$5a727c8601678802(img, dimensions = {}) {\n const name = $a5d3b883bf9e749e$export$1396dd911f86baee(img);\n let scale;\n if ((0, $9IngI.TVA_CONFIG).imgNameContainsDimensions) {\n const height = name.match(/_height(.*)_/)?.[1];\n if (height) dimensions.height = parseFloat(height);\n const width = name.match(/_width(.*)_/)?.[1];\n if (width) dimensions.width = parseFloat(width);\n scale = name.match(/_scale(.*)_/)?.[1];\n if (scale) scale = Math.max(parseFloat(scale), 0.2);\n }\n if ((0, $9IngI.TVA_CONFIG).imgNameContainsFADimensions) {\n scale = name.match(/_Scale(\\d+)_/)?.[1];\n if (scale) scale = Math.max(parseInt(scale) / 100, 0.2);\n }\n if (scale) {\n dimensions[\"texture.scaleX\"] = scale;\n dimensions[\"texture.scaleY\"] = scale;\n }\n return dimensions;\n}\nfunction $a5d3b883bf9e749e$export$2b4b146f5cd9519c(hexString) {\n return PIXI.utils.string2hex(hexString);\n}\nfunction $a5d3b883bf9e749e$export$205603ad3b38424c(uri) {\n try {\n return decodeURI(uri);\n } catch (e) {\n console.warn(\"URI Component not decodable: \" + uri);\n return uri;\n }\n}\nfunction $a5d3b883bf9e749e$export$245a8ae5fac6ab9(uri) {\n try {\n return decodeURIComponent(uri);\n } catch (e) {\n console.warn(\"URI Component not decodable: \" + uri);\n return uri;\n }\n}\nfunction $a5d3b883bf9e749e$export$488134d4acacca33(from, to) {\n const changedIDs = {};\n for (const m of from){\n const i = to.findIndex((mapping)=>mapping.label === m.label && mapping.group === m.group);\n if (i === -1) to.push(m);\n else {\n changedIDs[to.id] = m.id;\n if (to[i].tokens?.length) {\n if (!m.tokens) m.tokens = [];\n to[i].tokens.forEach((id)=>{\n if (!m.tokens.includes(id)) m.tokens.push(id);\n });\n }\n to[i] = m;\n }\n }\n // If parent's id has been changed we need to update all the children\n to.forEach((m)=>{\n let pID = m.overlayConfig?.parentID;\n if (pID && pID in changedIDs) m.overlayConfig.parentID = changedIDs[pID];\n });\n return to;\n}\n\n});\nparcelRequire.register(\"coMHP\", function(module, exports) {\n\n$parcel$export(module.exports, \"isInitialized\", () => $08fa2328c7dd0741$export$3f95c6f800b78024);\n$parcel$export(module.exports, \"showArtSelect\", () => $08fa2328c7dd0741$export$7515bad222171dd9);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $7OP4c = parcelRequire(\"7OP4c\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $bFZU7 = parcelRequire(\"bFZU7\");\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\n\nvar $8MWlo = parcelRequire(\"8MWlo\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\n\nvar $3pMx9 = parcelRequire(\"3pMx9\");\n\nvar $kPeJW = parcelRequire(\"kPeJW\");\n\nvar $cs88A = parcelRequire(\"cs88A\");\n// Tracks if module has been initialized\nlet $08fa2328c7dd0741$var$MODULE_INITIALIZED = false;\nfunction $08fa2328c7dd0741$export$3f95c6f800b78024() {\n return $08fa2328c7dd0741$var$MODULE_INITIALIZED;\n}\nlet $08fa2328c7dd0741$var$onInit = [];\n/**\r\n * Initialize the Token Variants module on Foundry VTT init\r\n */ async function $08fa2328c7dd0741$var$initialize() {\n // Initialization should only be performed once\n if ($08fa2328c7dd0741$var$MODULE_INITIALIZED) return;\n // Font Awesome need to be loaded manually on FireFox\n (0, $bFZU7.FONT_LOADING).loading = FontConfig.loadFont(\"fontAwesome\", {\n editor: false,\n fonts: [\n {\n urls: [\n \"fonts/fontawesome/webfonts/fa-solid-900.ttf\"\n ]\n }\n ]\n });\n // Want this to be executed once the module has initialized\n $08fa2328c7dd0741$var$onInit.push(()=>{\n // Need to wait for icons do be drawn first however I could not find a way\n // to wait until that has occurred. Instead we'll just wait for some static\n // amount of time.\n new Promise((resolve)=>setTimeout(resolve, 500)).then(()=>{\n for (const tkn of canvas.tokens.placeables){\n (0, $bFZU7.drawOverlays)(tkn); // Draw Overlays\n // Disable effect icons\n if ((0, $9IngI.TVA_CONFIG).disableEffectIcons) (0, $eeGZt.waitForTokenTexture)(tkn, (token)=>{\n token.effects.removeChildren().forEach((c)=>c.destroy());\n token.effects.bg = token.effects.addChild(new PIXI.Graphics());\n token.effects.overlay = null;\n });\n else if ((0, $9IngI.TVA_CONFIG).filterEffectIcons) (0, $eeGZt.waitForTokenTexture)(tkn, (token)=>{\n token.drawEffects();\n });\n }\n });\n });\n if ((0, $eeGZt.userRequiresImageCache)()) (0, $8MWlo.cacheImages)();\n // Register ALL Hooks\n (0, $e9LRe.registerAllHooks)();\n // Startup ticker that will periodically call 'updateEmbeddedDocuments' with all the accrued updates since the last tick\n (0, $eeGZt.startBatchUpdater)();\n (0, $e9LRe.registerHook)(\"Search\", \"renderArtSelect\", ()=>{\n (0, $7OP4c.ArtSelect).executing = false;\n });\n // Handle broadcasts\n game.socket?.on(`module.token-variants`, (message)=>{\n if (message.handlerName === \"forgeSearchPaths\" && message.type === \"UPDATE\") {\n // Workaround for forgeSearchPaths setting to be updated by non-GM clients\n if (!game.user.isGM) return;\n const isResponsibleGM = !game.users.filter((user)=>user.isGM && (user.active || user.isActive)).some((other)=>other.id < game.user.id);\n if (!isResponsibleGM) return;\n (0, $9IngI.updateSettings)({\n forgeSearchPaths: message.args\n });\n } else if (message.handlerName === \"drawOverlays\" && message.type === \"UPDATE\") {\n if (message.args.all) {\n if (canvas.scene.id !== message.args.sceneId) for (const tkn of canvas.tokens.placeables)(0, $bFZU7.drawOverlays)(tkn);\n } else if (message.args.actorId) {\n const actor = game.actors.get(message.args.actorId);\n if (actor) actor.getActiveTokens(true)?.forEach((tkn)=>(0, $bFZU7.drawOverlays)(tkn));\n } else if (message.args.tokenId) {\n const tkn = canvas.tokens.get(message.args.tokenId);\n if (tkn) (0, $bFZU7.drawOverlays)(tkn);\n }\n } else if (message.handlerName === \"effectMappings\") {\n if (!game.user.isGM) return;\n const isResponsibleGM = !game.users.filter((user)=>user.isGM && (user.active || user.isActive)).some((other)=>other.id < game.user.id);\n if (!isResponsibleGM) return;\n const args = message.args;\n const token = game.scenes.get(args.sceneId)?.tokens.get(args.tokenId);\n if (token) (0, $dmUqi.updateWithEffectMapping)(token, {\n added: args.added,\n removed: args.removed\n });\n }\n });\n $08fa2328c7dd0741$var$MODULE_INITIALIZED = true;\n for (const cb of $08fa2328c7dd0741$var$onInit)cb();\n $08fa2328c7dd0741$var$onInit = [];\n}\nasync function $08fa2328c7dd0741$export$7515bad222171dd9(search, { callback: callback = null, searchType: searchType = (0, $eeGZt.SEARCH_TYPE).PORTRAIT_AND_TOKEN, object: object = null, force: force = false, preventClose: preventClose = false, image1: image1 = \"\", image2: image2 = \"\", displayMode: displayMode = (0, $7OP4c.ArtSelect).IMAGE_DISPLAY.NONE, multipleSelection: multipleSelection = false, searchOptions: searchOptions = {}, allImages: allImages = null } = {}) {\n if ((0, $8MWlo.isCaching)()) return;\n const artSelects = Object.values(ui.windows).filter((app)=>app instanceof (0, $7OP4c.ArtSelect));\n if ((0, $7OP4c.ArtSelect).executing || !force && artSelects.length !== 0) {\n (0, $7OP4c.addToArtSelectQueue)(search, {\n callback: callback,\n searchType: searchType,\n object: object,\n preventClose: preventClose,\n searchOptions: searchOptions,\n allImages: allImages\n });\n return;\n }\n (0, $7OP4c.ArtSelect).executing = true;\n if (!allImages) allImages = await (0, $8MWlo.doImageSearch)(search, {\n searchType: searchType,\n searchOptions: searchOptions\n });\n new (0, $7OP4c.ArtSelect)(search, {\n allImages: allImages,\n searchType: searchType,\n callback: callback,\n object: object,\n preventClose: preventClose,\n image1: image1,\n image2: image2,\n displayMode: displayMode,\n multipleSelection: multipleSelection,\n searchOptions: searchOptions\n }).render(true);\n}\n// Initialize module\n(0, $e9LRe.registerHook)(\"main\", \"ready\", $08fa2328c7dd0741$var$initialize, {\n once: true\n});\n// Register API and Keybinds\n(0, $e9LRe.registerHook)(\"main\", \"init\", function() {\n (0, $9IngI.registerSettings)();\n (0, $3pMx9.registerAllWrappers)();\n (0, $eeGZt.registerKeybinds)();\n const api = {\n cacheImages: $8MWlo.cacheImages,\n doImageSearch: $8MWlo.doImageSearch,\n doRandomSearch: $8MWlo.doRandomSearch,\n getTokenEffects: $dmUqi.getTokenEffects,\n showArtSelect: $08fa2328c7dd0741$export$7515bad222171dd9,\n updateTokenImage: $eeGZt.updateTokenImage,\n exportSettingsToJSON: $9IngI.exportSettingsToJSON,\n assignUserSpecificImage: $kPeJW.assignUserSpecificImage,\n assignUserSpecificImageToSelected: $kPeJW.assignUserSpecificImageToSelected,\n unassignUserSpecificImage: $kPeJW.unassignUserSpecificImage,\n unassignUserSpecificImageFromSelected: $kPeJW.unassignUserSpecificImageFromSelected,\n setOverlayVisibility: $dmUqi.setOverlayVisibility,\n toggleTemplateDialog: $cs88A.toggleTemplateDialog,\n toggleTemplate: $dmUqi.toggleTemplate,\n toggleTemplateOnSelected: $dmUqi.toggleTemplateOnSelected,\n TVA_CONFIG: $9IngI.TVA_CONFIG\n };\n Object.defineProperty(api, \"hooks\", {\n get () {\n return deepClone((0, $e9LRe.REGISTERED_HOOKS));\n },\n configurable: true\n });\n Object.defineProperty(api, \"wrappers\", {\n get () {\n return deepClone((0, $3pMx9.REGISTERED_WRAPPERS));\n },\n configurable: true\n });\n game.modules.get(\"token-variants\").api = api;\n});\n\n});\nparcelRequire.register(\"7OP4c\", function(module, exports) {\n\n$parcel$export(module.exports, \"addToArtSelectQueue\", () => $5b14d0b148b3890b$export$9627cb8e26eb867b);\n$parcel$export(module.exports, \"ArtSelect\", () => $5b14d0b148b3890b$export$ccc8aa552c95ef88);\n$parcel$export(module.exports, \"addToQueue\", () => $5b14d0b148b3890b$export$30665681cb9a2b60);\n$parcel$export(module.exports, \"renderFromQueue\", () => $5b14d0b148b3890b$export$abbc2a15ff9ed201);\n$parcel$export(module.exports, \"insertArtSelectButton\", () => $5b14d0b148b3890b$export$746cd8e50fad2f01);\n\nvar $7P4Bo = parcelRequire(\"7P4Bo\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\nfunction $5b14d0b148b3890b$export$9627cb8e26eb867b(search, options) {\n $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.push({\n search: search,\n options: options\n });\n $(\"button#token-variant-art-clear-queue\").html(`Clear Queue (${$5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.length})`).show();\n}\nfunction $5b14d0b148b3890b$export$30665681cb9a2b60(search, options) {\n $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.push({\n search: search,\n options: options\n });\n}\nfunction $5b14d0b148b3890b$export$abbc2a15ff9ed201(force = false) {\n if (!force) {\n const artSelects = Object.values(ui.windows).filter((app)=>app instanceof $5b14d0b148b3890b$export$ccc8aa552c95ef88);\n if (artSelects.length !== 0) {\n if ($5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.length !== 0) $(\"button#token-variant-art-clear-queue\").html(`Clear Queue (${$5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.length})`).show();\n return;\n }\n }\n let callData = $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.shift();\n if (callData?.options.execute) {\n callData.options.execute();\n callData = $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.shift();\n }\n if (callData) (0, $coMHP.showArtSelect)(callData.search, callData.options);\n}\nfunction $5b14d0b148b3890b$var$delay(fn, ms) {\n let timer = 0;\n return function(...args) {\n clearTimeout(timer);\n timer = setTimeout(fn.bind(this, ...args), ms || 0);\n };\n}\nclass $5b14d0b148b3890b$export$ccc8aa552c95ef88 extends FormApplication {\n static queue = [];\n static instance = null;\n // showArtSelect(...) can take a while to fully execute and it is possible for it to be called\n // multiple times in very quick succession especially if copy pasting tokens or importing actors.\n // This variable set early in the function execution is used to queue additional requests rather\n // than continue execution\n static executing = false;\n static IMAGE_DISPLAY = {\n NONE: 0,\n PORTRAIT: 1,\n TOKEN: 2,\n PORTRAIT_TOKEN: 3,\n IMAGE: 4\n };\n constructor(search, { preventClose: preventClose = false, object: object = null, callback: callback = null, searchType: searchType = null, allImages: allImages = null, image1: image1 = \"\", image2: image2 = \"\", displayMode: displayMode = $5b14d0b148b3890b$export$ccc8aa552c95ef88.IMAGE_DISPLAY.NONE, multipleSelection: multipleSelection = false, searchOptions: searchOptions = {} } = {}){\n let title = game.i18n.localize(\"token-variants.windows.art-select.select-variant\");\n if (searchType === (0, $eeGZt.SEARCH_TYPE).TOKEN) title = game.i18n.localize(\"token-variants.windows.art-select.select-token-art\");\n else if (searchType === (0, $eeGZt.SEARCH_TYPE).PORTRAIT) title = game.i18n.localize(\"token-variants.windows.art-select.select-portrait-art\");\n super({}, {\n closeOnSubmit: false,\n width: $5b14d0b148b3890b$export$ccc8aa552c95ef88.WIDTH || 500,\n height: $5b14d0b148b3890b$export$ccc8aa552c95ef88.HEIGHT || 500,\n left: $5b14d0b148b3890b$export$ccc8aa552c95ef88.LEFT,\n top: $5b14d0b148b3890b$export$ccc8aa552c95ef88.TOP,\n title: title\n });\n this.search = search;\n this.allImages = allImages;\n this.callback = callback;\n this.doc = object;\n this.preventClose = preventClose;\n this.image1 = image1;\n this.image2 = image2;\n this.displayMode = displayMode;\n this.multipleSelection = multipleSelection;\n this.searchType = searchType;\n this.searchOptions = mergeObject(searchOptions, (0, $9IngI.getSearchOptions)(), {\n overwrite: false\n });\n $5b14d0b148b3890b$export$ccc8aa552c95ef88.instance = this;\n const constructorName = `ArtSelect`;\n Object.defineProperty($5b14d0b148b3890b$export$ccc8aa552c95ef88.prototype.constructor, \"name\", {\n value: constructorName\n });\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-art-select\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/artSelect.html\",\n resizable: true,\n minimizable: false\n });\n }\n _getHeaderButtons() {\n const buttons = super._getHeaderButtons();\n buttons.unshift({\n label: \"FilePicker\",\n class: \"file-picker\",\n icon: \"fas fa-file-import fa-fw\",\n onclick: ()=>{\n new FilePicker({\n type: \"imagevideo\",\n callback: (path)=>{\n if (!this.preventClose) this.close();\n if (this.callback) this.callback(path, (0, $eeGZt.getFileName)(path));\n }\n }).render();\n }\n });\n buttons.unshift({\n label: \"Image Category\",\n class: \"type\",\n icon: \"fas fa-swatchbook\",\n onclick: ()=>{\n if ($5b14d0b148b3890b$export$ccc8aa552c95ef88.instance) $5b14d0b148b3890b$export$ccc8aa552c95ef88.instance._typeSelect();\n }\n });\n return buttons;\n }\n _typeSelect() {\n const categories = (0, $eeGZt.BASE_IMAGE_CATEGORIES).concat((0, $9IngI.TVA_CONFIG).customImageCategories);\n const buttons = {};\n for (const c of categories){\n let label = c;\n if (c === this.searchType) label = \"<b>>>> \" + label + \" <<<</b>\";\n buttons[c] = {\n label: label,\n callback: ()=>{\n if (this.searchType !== c) {\n this.searchType = c;\n this._performSearch(this.search, true);\n }\n }\n };\n }\n new Dialog({\n title: `Select Image Category and Filter`,\n content: `<style>.dialog .dialog-button {flex: 0 0 auto;}</style>`,\n buttons: buttons\n }).render(true);\n }\n async getData(options) {\n const data = super.getData(options);\n if (this.doc instanceof Item) {\n data.item = true;\n data.description = this.doc.system?.description?.value ?? \"\";\n }\n const searchOptions = this.searchOptions;\n const algorithm = searchOptions.algorithm;\n //\n // Create buttons\n //\n const tokenConfigs = ((0, $9IngI.TVA_CONFIG).tokenConfigs || []).flat();\n const fuzzySearch = algorithm.fuzzy;\n let allButtons = new Map();\n let artFound = false;\n const genLabel = function(str, indices, start = \"<mark>\", end = \"</mark>\", fillChar = null) {\n if (!indices) return str;\n let fillStr = fillChar ? fillChar.repeat(str.length) : str;\n let label = \"\";\n let lastIndex = 0;\n for (const index of indices){\n label += fillStr.slice(lastIndex, index[0]);\n label += start + str.slice(index[0], index[1] + 1) + end;\n lastIndex = index[1] + 1;\n }\n label += fillStr.slice(lastIndex, fillStr.length);\n return label;\n };\n const genTitle = function(obj) {\n if (!fuzzySearch) return obj.path;\n let percent = Math.ceil((1 - obj.score) * 100) + \"%\";\n if (searchOptions.runSearchOnPath) return percent + \"\\n\" + genLabel(obj.path, obj.indices, \"\", \"\", \"-\") + \"\\n\" + obj.path;\n return percent;\n };\n this.allImages.forEach((images, search)=>{\n const buttons = [];\n images.forEach((imageObj)=>{\n artFound = true;\n const vid = (0, $eeGZt.isVideo)(imageObj.path);\n const img = (0, $eeGZt.isImage)(imageObj.path);\n buttons.push({\n path: imageObj.path,\n img: img,\n vid: vid,\n type: vid || img,\n name: imageObj.name,\n label: fuzzySearch && !searchOptions.runSearchOnPath ? genLabel(imageObj.name, imageObj.indices) : imageObj.name,\n title: genTitle(imageObj),\n hasConfig: this.searchType === (0, $eeGZt.SEARCH_TYPE).TOKEN || this.searchType === (0, $eeGZt.SEARCH_TYPE).PORTRAIT_AND_TOKEN ? Boolean(tokenConfigs.find((config)=>config.tvImgSrc == imageObj.path && config.tvImgName == imageObj.name)) : false\n });\n });\n allButtons.set(search, buttons);\n });\n if (artFound) data.allImages = allButtons;\n data.search = this.search;\n data.queue = $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.length;\n data.image1 = this.image1;\n data.image2 = this.image2;\n data.displayMode = this.displayMode;\n data.multipleSelection = this.multipleSelection;\n data.displaySlider = algorithm.fuzzy && algorithm.fuzzyArtSelectPercentSlider;\n data.fuzzyThreshold = algorithm.fuzzyThreshold;\n if (data.displaySlider) {\n data.fuzzyThreshold = 100 - data.fuzzyThreshold * 100;\n data.fuzzyThreshold = data.fuzzyThreshold.toFixed(0);\n }\n data.autoplay = !(0, $9IngI.TVA_CONFIG).playVideoOnHover;\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n const callback = this.callback;\n const close = ()=>this.close();\n const object = this.doc;\n const preventClose = this.preventClose;\n const multipleSelection = this.multipleSelection;\n const boxes = html.find(`.token-variants-grid-box`);\n boxes.hover(function() {\n if ((0, $9IngI.TVA_CONFIG).playVideoOnHover) {\n const vid = $(this).siblings(\"video\");\n if (vid.length) {\n vid[0].play();\n $(this).siblings(\".fa-play\").hide();\n }\n }\n }, function() {\n if ((0, $9IngI.TVA_CONFIG).pauseVideoOnHoverOut) {\n const vid = $(this).siblings(\"video\");\n if (vid.length) {\n vid[0].pause();\n vid[0].currentTime = 0;\n $(this).siblings(\".fa-play\").show();\n }\n }\n });\n boxes.map((box)=>{\n boxes[box].addEventListener(\"click\", async function(event) {\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n if (object) new (0, $7P4Bo.default)(object, {}, event.target.dataset.name, event.target.dataset.filename).render(true);\n } else {\n if (!preventClose) close();\n if (callback) callback(event.target.dataset.name, event.target.dataset.filename);\n }\n });\n if (multipleSelection) boxes[box].addEventListener(\"contextmenu\", async function(event) {\n $(event.target).toggleClass(\"selected\");\n });\n });\n let searchInput = html.find(\"#custom-art-search\");\n searchInput.focus();\n searchInput[0].selectionStart = searchInput[0].selectionEnd = 10000;\n searchInput.on(\"input\", $5b14d0b148b3890b$var$delay((event)=>{\n this._performSearch(event.target.value);\n }, 350));\n html.find(`button#token-variant-art-clear-queue`).on(\"click\", (event)=>{\n $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue = $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.filter((callData)=>callData.options.execute);\n $(event.target).hide();\n });\n $(html).find('[name=\"fuzzyThreshold\"]').change((e)=>{\n $(e.target).siblings(\".token-variants-range-value\").html(`${parseFloat(e.target.value).toFixed(0)}%`);\n this.searchOptions.algorithm.fuzzyThreshold = (100 - e.target.value) / 100;\n }).change($5b14d0b148b3890b$var$delay((event)=>{\n this._performSearch(this.search, true);\n }, 350));\n if (multipleSelection) {\n html.find(`button#token-variant-art-return-selected`).on(\"click\", ()=>{\n if (callback) {\n const images = [];\n html.find(`.token-variants-grid-box.selected`).siblings(\".token-variants-grid-image\").each(function() {\n images.push(this.getAttribute(\"src\"));\n });\n callback(images);\n }\n close();\n });\n html.find(`button#token-variant-art-return-all`).on(\"click\", ()=>{\n if (callback) {\n const images = [];\n html.find(`.token-variants-grid-image`).each(function() {\n images.push(this.getAttribute(\"src\"));\n });\n callback(images);\n }\n close();\n });\n }\n }\n _performSearch(search, force = false) {\n if (!force && this.search.trim() === search.trim()) return;\n (0, $coMHP.showArtSelect)(search, {\n callback: this.callback,\n searchType: this.searchType,\n object: this.doc,\n force: true,\n image1: this.image1,\n image2: this.image2,\n displayMode: this.displayMode,\n multipleSelection: this.multipleSelection,\n searchOptions: this.searchOptions,\n preventClose: this.preventClose\n });\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n if (formData && formData.search != this.search) this._performSearch(formData.search);\n else this.close();\n }\n setPosition(options = {}) {\n if (options.width) $5b14d0b148b3890b$export$ccc8aa552c95ef88.WIDTH = options.width;\n if (options.height) $5b14d0b148b3890b$export$ccc8aa552c95ef88.HEIGHT = options.height;\n if (options.top) $5b14d0b148b3890b$export$ccc8aa552c95ef88.TOP = options.top;\n if (options.left) $5b14d0b148b3890b$export$ccc8aa552c95ef88.LEFT = options.left;\n super.setPosition(options);\n }\n async close(options = {}) {\n let callData = $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.shift();\n if (callData?.options.execute) {\n callData.options.execute();\n callData = $5b14d0b148b3890b$export$ccc8aa552c95ef88.queue.shift();\n }\n if (callData) {\n callData.options.force = true;\n (0, $coMHP.showArtSelect)(callData.search, callData.options);\n } else {\n // For some reason there might be app instances that have not closed themselves by this point\n // If there are, close them now\n const artSelects = Object.values(ui.windows).filter((app)=>app instanceof $5b14d0b148b3890b$export$ccc8aa552c95ef88).filter((app)=>app.appId !== this.appId);\n for (const app of artSelects)app.close();\n return super.close(options);\n }\n }\n}\nfunction $5b14d0b148b3890b$export$746cd8e50fad2f01(html, target, { search: search = \"\", searchType: searchType = (0, $eeGZt.SEARCH_TYPE).TOKEN } = {}) {\n const button = $(`<button \r\n class=\"token-variants-image-select-button\" \r\n type=\"button\"\r\n data-type=\"imagevideo\"\r\n data-target=\"${target}\"\r\n title=\"${game.i18n.localize(\"token-variants.windows.art-select.select-variant\")}\">\r\n <i class=\"fas fa-images\"></i>\r\n </button>`);\n button.on(\"click\", ()=>{\n (0, $coMHP.showArtSelect)(search, {\n callback: (imgSrc, name)=>{\n button.siblings(`[name=\"${target}\"]`).val(imgSrc);\n },\n searchType: searchType\n });\n });\n const input = html.find(`[name=\"${target}\"]`);\n input.after(button);\n return Boolean(input.length);\n}\n\n});\nparcelRequire.register(\"7P4Bo\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $5b20ddaff598079e$export$2e2bcd8739ae039);\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\nclass $5b20ddaff598079e$export$2e2bcd8739ae039 extends TokenConfig {\n constructor(object, options, imgSrc, imgName, callback, config){\n let token;\n if (object instanceof Actor) token = new TokenDocument(object.token, {\n actor: object\n });\n else token = new TokenDocument(object.document, {\n actor: game.actors.get(object.actorId)\n });\n super(token, options);\n this.imgSrc = imgSrc;\n this.imgName = imgName;\n this.callback = callback;\n this.config = config;\n if (this.config) {\n this.flags = this.config.flags;\n this.tv_script = this.config.tv_script;\n }\n }\n _getSubmitData(updateData = {}) {\n if (!this.form) throw new Error(\"The FormApplication subclass has no registered form element\");\n const fd = new FormDataExtended(this.form, {\n editors: this.editors\n });\n let data = fd.object;\n if (updateData) data = foundry.utils.flattenObject(foundry.utils.mergeObject(data, updateData));\n // Clear detection modes array\n if (!(\"detectionModes.0.id\" in data)) data.detectionModes = [];\n // Treat \"None\" as null for bar attributes\n data[\"bar1.attribute\"] ||= null;\n data[\"bar2.attribute\"] ||= null;\n return data;\n }\n async _updateObject(event, formData) {\n const filtered = {};\n const form = $(event.target).closest(\"form\");\n form.find(\".form-group\").each(function(_) {\n const tva_checkbox = $(this).find(\".tva-config-checkbox > input\");\n if (tva_checkbox.length && tva_checkbox.is(\":checked\")) $(this).find(\"[name]\").each(function(_) {\n const name = $(this).attr(\"name\");\n filtered[name] = formData[name];\n });\n });\n if (this.tv_script) filtered.tv_script = this.tv_script;\n if (this.config) {\n let config = expandObject(filtered);\n config.flags = config.flags ? mergeObject(this.flags || {}, config.flags) : this.flags;\n if (this.callback) this.callback(config);\n } else {\n const saved = (0, $eeGZt.setTokenConfig)(this.imgSrc, this.imgName, filtered);\n if (this.callback) this.callback(saved);\n }\n }\n applyCustomConfig() {\n const tokenConfig = flattenObject(this.config || (0, $eeGZt.getTokenConfig)(this.imgSrc, this.imgName));\n const form = $(this.form);\n for (const key of Object.keys(tokenConfig)){\n const el = form.find(`[name=\"${key}\"]`);\n if (el.is(\":checkbox\")) el.prop(\"checked\", tokenConfig[key]);\n else el.val(tokenConfig[key]);\n el.trigger(\"change\");\n }\n }\n // *************\n // consider moving html injection to:\n // _replaceHTML | _injectHTML\n async activateListeners(html) {\n await super.activateListeners(html);\n // Disable image path controls\n $(html).find(\".token-variants-image-select-button\").prop(\"disabled\", true);\n $(html).find(\".file-picker\").prop(\"disabled\", true);\n $(html).find(\".image\").prop(\"disabled\", true);\n // Remove 'Assign Token' button\n $(html).find(\".assign-token\").remove();\n // Add checkboxes to control inclusion of specific tabs in the custom config\n const tokenConfig = this.config || (0, $eeGZt.getTokenConfig)(this.imgSrc, this.imgName);\n this.tv_script = tokenConfig.tv_script;\n $(html).on(\"change\", \".tva-config-checkbox\", this._onCheckboxChange);\n const processFormGroup = function(formGroup) {\n // Checkbox is not added for the Image Path group\n if (!$(formGroup).find('[name=\"img\"]').length) {\n let savedField = false;\n if (tokenConfig) {\n const flatConfig = flattenObject(tokenConfig);\n $(formGroup).find(\"[name]\").each(function(_) {\n const name = $(this).attr(\"name\");\n if (name in flatConfig) savedField = true;\n });\n }\n const checkbox = $(`<div class=\"tva-config-checkbox\"><input type=\"checkbox\" data-dtype=\"Boolean\" ${savedField ? 'checked=\"\"' : \"\"}></div>`);\n if ($(formGroup).find(\"p.hint\").length) $(formGroup).find(\"p.hint\").before(checkbox);\n else $(formGroup).append(checkbox);\n checkbox.find(\"input\").trigger(\"change\");\n }\n };\n // Add checkboxes to each form-group to control highlighting and which fields will are to be saved\n $(html).find(\".form-group\").each(function(index) {\n processFormGroup(this);\n });\n // Add 'update' and 'remove' config buttons\n $(html).find(\".sheet-footer > button\").remove();\n $(html).find(\".sheet-footer\").append('<button type=\"submit\" value=\"1\"><i class=\"far fa-save\"></i> Save Config</button>');\n if (tokenConfig) {\n $(html).find(\".sheet-footer\").append('<button type=\"button\" class=\"remove-config\"><i class=\"fas fa-trash\"></i> Remove Config</button>');\n html.find(\".remove-config\").click(this._onRemoveConfig.bind(this));\n }\n // Pre-select image or appearance tab\n $(html).find('.tabs > .item[data-tab=\"image\"] > i').trigger(\"click\");\n $(html).find('.tabs > .item[data-tab=\"appearance\"] > i').trigger(\"click\");\n document.activeElement.blur(); // Hack fix for key UP/DOWN effects not registering after config has been opened\n // TokenConfig might be changed by some modules after activateListeners is processed\n // Look out for these updates and add checkboxes for any newly added form-groups\n const mutate = (mutations)=>{\n mutations.forEach((mutation)=>{\n mutation.addedNodes.forEach((node)=>{\n if (node.nodeName === \"DIV\" && node.className === \"form-group\") {\n processFormGroup(node);\n this.applyCustomConfig();\n }\n });\n });\n };\n const observer = new MutationObserver(mutate);\n observer.observe(html[0], {\n characterData: false,\n attributes: false,\n childList: true,\n subtree: true\n });\n // On any field being changed we want to automatically select the form-group to be included in the update\n $(html).on(\"change\", \"input, select\", $5b20ddaff598079e$var$onInputChange);\n $(html).on(\"click\", \"button\", $5b20ddaff598079e$var$onInputChange);\n this.applyCustomConfig();\n }\n async _onCheckboxChange(event) {\n const checkbox = $(event.target);\n checkbox.closest(\".form-group\").css({\n \"outline-color\": checkbox.is(\":checked\") ? \"green\" : \"#ffcc6e\",\n \"outline-width\": \"2px\",\n \"outline-style\": \"dotted\",\n \"margin-bottom\": \"5px\"\n });\n checkbox.closest(\".tva-config-checkbox\").css({\n \"outline-color\": checkbox.is(\":checked\") ? \"green\" : \"#ffcc6e\",\n \"outline-width\": \"2px\",\n \"outline-style\": \"solid\"\n });\n }\n async _onRemoveConfig(event) {\n if (this.config) {\n if (this.callback) this.callback({});\n } else {\n const saved = (0, $eeGZt.setTokenConfig)(this.imgSrc, this.imgName, null);\n if (this.callback) this.callback(saved);\n }\n this.close();\n }\n get id() {\n return `token-custom-config-${this.object.id}`;\n }\n _getHeaderButtons() {\n const buttons = super._getHeaderButtons();\n return buttons;\n }\n}\n// Toggle checkbox if input has been detected inside it's form-group\nasync function $5b20ddaff598079e$var$onInputChange(event) {\n if (event.target.parentNode.className === \"tva-config-checkbox\") return;\n $(event.target).closest(\".form-group\").find(\".tva-config-checkbox input\").prop(\"checked\", true);\n}\n\n});\n\n\nparcelRequire.register(\"bFZU7\", function(module, exports) {\n\n$parcel$export(module.exports, \"FONT_LOADING\", () => FONT_LOADING);\n$parcel$export(module.exports, \"drawOverlays\", () => drawOverlays);\n$parcel$export(module.exports, \"evaluateOverlayExpressions\", () => evaluateOverlayExpressions);\n$parcel$export(module.exports, \"genTexture\", () => genTexture);\n$parcel$export(module.exports, \"removeMarkedOverlays\", () => removeMarkedOverlays);\n$parcel$export(module.exports, \"interpolateColor\", () => interpolateColor);\n$parcel$export(module.exports, \"broadcastOverlayRedraw\", () => broadcastOverlayRedraw);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $8QbcE = parcelRequire(\"8QbcE\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\nconst FONT_LOADING = {};\nasync function drawOverlays(token11) {\n if (token11.tva_drawing_overlays) return;\n token11.tva_drawing_overlays = true;\n const mappings11 = (0, $dmUqi.getAllEffectMappings)(token11);\n const effects11 = (0, $dmUqi.getTokenEffects)(token11, true);\n let processedMappings11 = mappings11.filter((m31)=>m31.overlay && effects11.includes(m31.id)).sort((m111, m211)=>(m111.priority - m111.overlayConfig?.parentID ? 0 : 999) - (m211.priority - m211.overlayConfig?.parentID ? 0 : 999));\n // See if the whole stack or just top of the stack should be used according to settings\n if (processedMappings11.length) processedMappings11 = (0, $9IngI.TVA_CONFIG).stackStatusConfig ? processedMappings11 : [\n processedMappings11[processedMappings11.length - 1]\n ];\n // Process strings as expressions\n const overlays11 = processedMappings11.map((m31)=>evaluateOverlayExpressions(deepClone(m31.overlayConfig), token11, m31));\n if (overlays11.length) (0, $eeGZt.waitForTokenTexture)(token11, async (token11)=>{\n if (!token11.tvaOverlays) token11.tvaOverlays = [];\n // Temporarily mark every overlay for removal.\n // We'll only keep overlays that are still applicable to the token\n _markAllOverlaysForRemoval(token11);\n // To keep track of the overlay order\n let overlaySort11 = 0;\n let underlaySort11 = 0;\n for (const ov11 of overlays11){\n let sprite11 = _findTVAOverlay(ov11.id, token11);\n if (sprite11) {\n const diff11 = diffObject(sprite11.overlayConfig, ov11);\n // Check if we need to create a new texture or simply refresh the overlay\n if (!isEmpty(diff11)) {\n if (ov11.img?.includes(\"*\") || ov11.img?.includes(\"{\") && ov11.img?.includes(\"}\")) sprite11.refresh(ov11);\n else if (diff11.img || diff11.text || diff11.shapes || diff11.repeat || diff11.html) sprite11.setTexture(await genTexture(token11, ov11), {\n configuration: ov11\n });\n else if (diff11.parentID) {\n sprite11.parent?.removeChild(sprite11)?.destroy();\n sprite11 = null;\n } else sprite11.refresh(ov11);\n } else if (diff11.text?.text || diff11.shapes) sprite11.setTexture(await genTexture(token11, ov11), {\n configuration: ov11\n });\n if (\"ui\" in diff11) {\n sprite11.parent.removeChild(sprite11);\n const layer11 = ov11.ui ? canvas.tokens : canvas.primary;\n sprite11 = layer11.addChild(sprite11);\n }\n }\n if (!sprite11) {\n if (ov11.parentID) {\n const parent11 = _findTVAOverlay(ov11.parentID, token11);\n if (parent11 && !parent11.tvaRemove) sprite11 = parent11.addChildAuto(new (0, $8QbcE.TVAOverlay)(await genTexture(token11, ov11), token11, ov11));\n } else {\n const layer11 = ov11.ui ? canvas.tokens : canvas.primary;\n sprite11 = layer11.addChild(new (0, $8QbcE.TVAOverlay)(await genTexture(token11, ov11), token11, ov11));\n }\n if (sprite11) token11.tvaOverlays.push(sprite11);\n }\n // If the sprite has a parent confirm that the parent has not been removed\n if (sprite11?.overlayConfig.parentID) {\n const parent11 = _findTVAOverlay(sprite11.overlayConfig.parentID, token11);\n if (!parent11 || parent11.tvaRemove) sprite11 = null;\n }\n if (sprite11) {\n sprite11.tvaRemove = false; // Sprite in use, do not remove\n // Assign order to the overlay\n if (sprite11.overlayConfig.underlay) {\n underlaySort11 -= 0.01;\n sprite11.overlaySort = underlaySort11;\n } else {\n overlaySort11 += 0.01;\n sprite11.overlaySort = overlaySort11;\n }\n }\n }\n removeMarkedOverlays(token11);\n token11.tva_drawing_overlays = false;\n });\n else {\n _removeAllOverlays(token11);\n token11.tva_drawing_overlays = false;\n }\n}\nasync function genTexture(token11, conf11) {\n const img11 = conf11.imgLinked ? token11.document.texture.src : conf11.img?.trim();\n if (img11) return await generateImage(token11, conf11, img11);\n else if (conf11.text?.text != null) return await generateTextTexture(token11, conf11);\n else if (conf11.shapes?.length) return await generateShapeTexture(token11, conf11.shapes);\n else if (conf11.html?.template) return {\n html: true,\n texture: await loadTexture(\"modules\\\\token-variants\\\\img\\\\html_bg.webp\")\n };\n else return {\n texture: await loadTexture(\"modules/token-variants/img/token-images.svg\")\n };\n}\nasync function generateImage(token11, conf11, img11) {\n if (img11.includes(\"*\") || img11.includes(\"{\") && img11.includes(\"}\")) {\n const images11 = await wildcardImageSearch(img11);\n if (images11.length) {\n if (images11.length) img11 = images11[Math.floor(Math.random() * images11.length)];\n }\n }\n let texture11 = await loadTexture(img11, {\n fallback: \"modules/token-variants/img/token-images.svg\"\n });\n // Repeat image if needed\n // Repeating the shape if necessary\n if (conf11.repeating && conf11.repeat) {\n const repeat11 = conf11.repeat;\n let numRepeats11;\n if (repeat11.isPercentage) numRepeats11 = Math.ceil(repeat11.value / repeat11.maxValue / (repeat11.increment / 100));\n else numRepeats11 = Math.ceil(repeat11.value / repeat11.increment);\n let n11 = 0;\n let rows11 = 0;\n const maxRows11 = repeat11.maxRows ?? Infinity;\n let xOffset11 = 0;\n let yOffset11 = 0;\n const paddingX11 = repeat11.paddingX ?? 0;\n const paddingY11 = repeat11.paddingY ?? 0;\n let container11 = new PIXI.Container();\n while(numRepeats11 > 0){\n let img11 = new PIXI.Sprite(texture11);\n img11.x = xOffset11;\n img11.y = yOffset11;\n container11.addChild(img11);\n xOffset11 += texture11.width + paddingX11;\n numRepeats11--;\n n11++;\n if (numRepeats11 != 0 && n11 >= repeat11.perRow) {\n rows11 += 1;\n if (rows11 >= maxRows11) break;\n yOffset11 += texture11.height + paddingY11;\n xOffset11 = 0;\n n11 = 0;\n }\n }\n texture11 = _renderContainer(container11, texture11.resolution);\n }\n return {\n texture: texture11\n };\n}\nfunction _renderContainer(container11, resolution11, { width: width11 = null, height: height11 = null } = {}) {\n const bounds11 = container11.getLocalBounds();\n const matrix11 = new PIXI.Matrix();\n matrix11.tx = -bounds11.x;\n matrix11.ty = -bounds11.y;\n const renderTexture11 = PIXI.RenderTexture.create({\n width: width11 ?? bounds11.width,\n height: height11 ?? bounds11.height,\n resolution: resolution11\n });\n if (isNewerVersion(\"11\", game.version)) canvas.app.renderer.render(container11, renderTexture11, true, matrix11, false);\n else canvas.app.renderer.render(container11, {\n renderTexture: renderTexture11,\n clear: true,\n transform: matrix11,\n skipUpdateTransform: false\n });\n renderTexture11.destroyable = true;\n return renderTexture11;\n}\n// Return width and height of the drawn shape\nfunction _drawShape(graphics11, shape11, xOffset11 = 0, yOffset11 = 0) {\n if (shape11.type === \"rectangle\") {\n graphics11.drawRoundedRect(shape11.x + xOffset11, shape11.y + yOffset11, shape11.width, shape11.height, shape11.radius);\n return [\n shape11.width,\n shape11.height\n ];\n } else if (shape11.type === \"ellipse\") {\n graphics11.drawEllipse(shape11.x + xOffset11 + shape11.width, shape11.y + yOffset11 + shape11.height, shape11.width, shape11.height);\n return [\n shape11.width * 2,\n shape11.height * 2\n ];\n } else if (shape11.type === \"polygon\") graphics11.drawPolygon(shape11.points.split(\",\").map((p11, i11)=>Number(p11) * shape11.scale + (i11 % 2 === 0 ? shape11.x : shape11.y)));\n else if (shape11.type === \"torus\") {\n drawTorus(graphics11, shape11.x + xOffset11 + shape11.outerRadius, shape11.y + yOffset11 + shape11.outerRadius, shape11.innerRadius, shape11.outerRadius, Math.toRadians(shape11.startAngle), shape11.endAngle >= 360 ? Math.PI * 2 : Math.toRadians(shape11.endAngle));\n return [\n shape11.outerRadius * 2,\n shape11.outerRadius * 2\n ];\n }\n}\nasync function generateShapeTexture(token11, shapes11) {\n let graphics11 = new PIXI.Graphics();\n for (const obj11 of shapes11){\n graphics11.beginFill(interpolateColor(obj11.fill.color, obj11.fill.interpolateColor), obj11.fill.alpha);\n graphics11.lineStyle(obj11.line.width, (0, $eeGZt.string2Hex)(obj11.line.color), obj11.line.alpha);\n const shape11 = obj11.shape;\n // Repeating the shape if necessary\n if (obj11.repeating && obj11.repeat) {\n const repeat11 = obj11.repeat;\n let numRepeats11;\n if (repeat11.isPercentage) numRepeats11 = Math.ceil(repeat11.value / repeat11.maxValue / (repeat11.increment / 100));\n else numRepeats11 = Math.ceil(repeat11.value / repeat11.increment);\n let n11 = 0;\n let rows11 = 0;\n const maxRows11 = repeat11.maxRows ?? Infinity;\n let xOffset11 = 0;\n let yOffset11 = 0;\n const paddingX11 = repeat11.paddingX ?? 0;\n const paddingY11 = repeat11.paddingY ?? 0;\n while(numRepeats11 > 0){\n const [width11, height11] = _drawShape(graphics11, shape11, xOffset11, yOffset11);\n xOffset11 += width11 + paddingX11;\n numRepeats11--;\n n11++;\n if (numRepeats11 != 0 && n11 >= repeat11.perRow) {\n rows11 += 1;\n if (rows11 >= maxRows11) break;\n yOffset11 += height11 + paddingY11;\n xOffset11 = 0;\n n11 = 0;\n }\n }\n } else _drawShape(graphics11, shape11);\n }\n // Store original graphics dimensions as these may change when children are added\n graphics11.shapesWidth = Number(graphics11.width);\n graphics11.shapesHeight = Number(graphics11.height);\n return {\n texture: PIXI.Texture.EMPTY,\n shapes: graphics11\n };\n}\nfunction drawTorus(graphics11, x11, y11, innerRadius11, outerRadius11, startArc11 = 0, endArc11 = Math.PI * 2) {\n if (Math.abs(endArc11 - startArc11) >= Math.PI * 2) return graphics11.drawCircle(x11, y11, outerRadius11).beginHole().drawCircle(x11, y11, innerRadius11).endHole();\n graphics11.finishPoly();\n graphics11.arc(x11, y11, innerRadius11, endArc11, startArc11, true).arc(x11, y11, outerRadius11, startArc11, endArc11, false).finishPoly();\n}\nfunction interpolateColor(minColor11, interpolate11, rString11 = false) {\n if (!interpolate11 || !interpolate11.color2 || !interpolate11.prc) return rString11 ? minColor11 : (0, $eeGZt.string2Hex)(minColor11);\n if (!PIXI.Color) return _interpolateV10(minColor11, interpolate11, rString11);\n const percentage11 = interpolate11.prc;\n minColor11 = new PIXI.Color(minColor11);\n const maxColor11 = new PIXI.Color(interpolate11.color2);\n let minHsv11 = rgb2hsv(minColor11.red, minColor11.green, minColor11.blue);\n let maxHsv11 = rgb2hsv(maxColor11.red, maxColor11.green, maxColor11.blue);\n let deltaHue11 = maxHsv11[0] - minHsv11[0];\n let deltaAngle11 = deltaHue11 + (Math.abs(deltaHue11) > 180 ? deltaHue11 < 0 ? 360 : -360 : 0);\n let targetHue11 = minHsv11[0] + deltaAngle11 * percentage11;\n let targetSaturation11 = (1 - percentage11) * minHsv11[1] + percentage11 * maxHsv11[1];\n let targetValue11 = (1 - percentage11) * minHsv11[2] + percentage11 * maxHsv11[2];\n let result11 = new PIXI.Color({\n h: targetHue11,\n s: targetSaturation11 * 100,\n v: targetValue11 * 100\n });\n return rString11 ? result11.toHex() : result11.toNumber();\n}\nfunction _interpolateV10(minColor11, interpolate11, rString11 = false) {\n const percentage11 = interpolate11.prc;\n minColor11 = PIXI.utils.hex2rgb((0, $eeGZt.string2Hex)(minColor11));\n const maxColor11 = PIXI.utils.hex2rgb((0, $eeGZt.string2Hex)(interpolate11.color2));\n let minHsv11 = rgb2hsv(minColor11[0], minColor11[1], minColor11[2]);\n let maxHsv11 = rgb2hsv(maxColor11[0], maxColor11[1], maxColor11[2]);\n let deltaHue11 = maxHsv11[0] - minHsv11[0];\n let deltaAngle11 = deltaHue11 + (Math.abs(deltaHue11) > 180 ? deltaHue11 < 0 ? 360 : -360 : 0);\n let targetHue11 = minHsv11[0] + deltaAngle11 * percentage11;\n let targetSaturation11 = (1 - percentage11) * minHsv11[1] + percentage11 * maxHsv11[1];\n let targetValue11 = (1 - percentage11) * minHsv11[2] + percentage11 * maxHsv11[2];\n let result11 = Color.fromHSV([\n targetHue11 / 360,\n targetSaturation11,\n targetValue11\n ]);\n return rString11 ? result11.toString() : Number(result11);\n}\n/**\r\n * Converts a color from RGB to HSV space.\r\n * Source: https://stackoverflow.com/questions/8022885/rgb-to-hsv-color-in-javascript/54070620#54070620\r\n */ function rgb2hsv(r11, g11, b11) {\n let v11 = Math.max(r11, g11, b11), c11 = v11 - Math.min(r11, g11, b11);\n let h11 = c11 && (v11 == r11 ? (g11 - b11) / c11 : v11 == g11 ? 2 + (b11 - r11) / c11 : 4 + (r11 - g11) / c11);\n return [\n 60 * (h11 < 0 ? h11 + 6 : h11),\n v11 && c11 / v11,\n v11\n ];\n}\nconst CORE_VARIABLES = {\n \"@hp\": (token11)=>(0, $dmUqi.getTokenHP)(token11)?.[0],\n \"@hpMax\": (token11)=>(0, $dmUqi.getTokenHP)(token11)?.[1],\n \"@gridSize\": ()=>canvas.grid?.size,\n \"@label\": (_11, conf11)=>conf11.label\n};\nfunction _evaluateString(str11, token11, conf11) {\n let variables11 = conf11.overlayConfig?.variables;\n const re211 = new RegExp(\"@\\\\w+\", \"gi\");\n str11 = str11.replace(re211, function replace11(match11) {\n let name11 = match11.substr(1, match11.length);\n let v11 = variables11?.find((v11)=>v11.name === name11);\n if (v11) return v11.value;\n else if (match11 in CORE_VARIABLES) return CORE_VARIABLES[match11](token11, conf11);\n return match11;\n });\n const re11 = new RegExp(\"{{.*?}}\", \"gi\");\n str11 = str11.replace(re11, function replace11(match11) {\n const property11 = match11.substring(2, match11.length - 2);\n if (conf11 && property11 === \"effect\") return conf11.expression;\n if (token11 && property11 === \"hp\") return (0, $dmUqi.getTokenHP)(token11)?.[0];\n else if (token11 && property11 === \"hpMax\") return (0, $dmUqi.getTokenHP)(token11)?.[1];\n const val11 = getProperty(token11.document ?? token11, property11);\n return val11 ?? 0;\n }).replace(\"\\\\n\", \"\\n\");\n return str11;\n}\nfunction _executeString(evalString, token) {\n try {\n const actor = token.actor; // So that actor is easily accessible within eval() scope\n const result = eval(evalString);\n if (getType(result) === \"Object\") evalString;\n return result;\n } catch (e) {}\n return evalString;\n}\nfunction evaluateOverlayExpressions(obj11, token11, conf11) {\n for (const [k11, v11] of Object.entries(obj11))if (![\n \"label\",\n \"interactivity\",\n \"variables\",\n \"id\",\n \"parentID\",\n \"limitedUsers\",\n \"filter\",\n \"limitOnProperty\",\n \"html\"\n ].includes(k11)) obj11[k11] = _evaluateObjExpressions(v11, token11, conf11);\n return obj11;\n}\n// Evaluate provided object values substituting in {{path.to.property}} with token properties, and performing eval() on strings\nfunction _evaluateObjExpressions(obj11, token11, conf11) {\n const t11 = getType(obj11);\n if (t11 === \"string\") {\n const str11 = _evaluateString(obj11, token11, conf11);\n return _executeString(str11, token11);\n } else if (t11 === \"Array\") for(let i11 = 0; i11 < obj11.length; i11++)obj11[i11] = _evaluateObjExpressions(obj11[i11], token11, conf11);\n else if (t11 === \"Object\") {\n for (const [k11, v11] of Object.entries(obj11))// Exception for text overlay\n if (k11 === \"text\" && getType(v11) === \"string\" && v11) {\n const evalString11 = _evaluateString(v11, token11, conf11);\n const result11 = _executeString(evalString11, token11);\n if (getType(result11) !== \"string\") obj11[k11] = evalString11;\n else obj11[k11] = result11;\n } else obj11[k11] = _evaluateObjExpressions(v11, token11, conf11);\n }\n return obj11;\n}\nasync function generateTextTexture(token11, conf11) {\n await FONT_LOADING.loading;\n let label11 = conf11.text.text;\n // Repeating the string if necessary\n if (conf11.text.repeating && conf11.text.repeat) {\n let tmp11 = \"\";\n const repeat11 = conf11.text.repeat;\n let numRepeats11;\n if (repeat11.isPercentage) numRepeats11 = Math.ceil(repeat11.value / repeat11.maxValue / (repeat11.increment / 100));\n else numRepeats11 = Math.ceil(repeat11.value / repeat11.increment);\n let n11 = 0;\n let rows11 = 0;\n let maxRows11 = repeat11.maxRows ?? Infinity;\n while(numRepeats11 > 0){\n tmp11 += label11;\n numRepeats11--;\n n11++;\n if (numRepeats11 != 0 && n11 >= repeat11.perRow) {\n rows11 += 1;\n if (rows11 >= maxRows11) break;\n tmp11 += \"\\n\";\n n11 = 0;\n }\n }\n label11 = tmp11;\n }\n let style11 = PreciseText.getTextStyle({\n ...conf11.text,\n fontFamily: [\n conf11.text.fontFamily,\n \"fontAwesome\"\n ].join(\",\"),\n fill: interpolateColor(conf11.text.fill, conf11.text.interpolateColor, true)\n });\n const text11 = new PreciseText(label11, style11);\n text11.updateText(false);\n const texture11 = text11.texture;\n const height11 = conf11.text.maxHeight ? Math.min(texture11.height, conf11.text.maxHeight) : null;\n const curve11 = conf11.text.curve;\n if (!height11 && !curve11?.radius && !curve11?.angle) {\n texture11.textLabel = label11;\n return {\n texture: texture11\n };\n }\n const container11 = new PIXI.Container();\n if (curve11?.radius || curve11?.angle) {\n // Curve the text\n const letterSpacing11 = conf11.text.letterSpacing ?? 0;\n const radius11 = curve11.angle ? (texture11.width + letterSpacing11) / (Math.PI * 2) / (curve11.angle / 360) : curve11.radius;\n const maxRopePoints11 = 100;\n const step11 = Math.PI / maxRopePoints11;\n let ropePoints11 = maxRopePoints11 - Math.round(texture11.width / (radius11 * Math.PI) * maxRopePoints11);\n ropePoints11 /= 2;\n const points11 = [];\n for(let i11 = maxRopePoints11 - ropePoints11; i11 > ropePoints11; i11--){\n const x11 = radius11 * Math.cos(step11 * i11);\n const y11 = radius11 * Math.sin(step11 * i11);\n points11.push(new PIXI.Point(x11, curve11.invert ? y11 : -y11));\n }\n const rope11 = new PIXI.SimpleRope(texture11, points11);\n container11.addChild(rope11);\n } else container11.addChild(new PIXI.Sprite(texture11));\n const renderTexture11 = _renderContainer(container11, 2, {\n height: height11\n });\n text11.destroy();\n renderTexture11.textLabel = label11;\n return {\n texture: renderTexture11\n };\n}\nfunction _markAllOverlaysForRemoval(token11) {\n for (const child11 of token11.tvaOverlays)if (child11 instanceof (0, $8QbcE.TVAOverlay)) child11.tvaRemove = true;\n}\nfunction removeMarkedOverlays(token11) {\n const sprites11 = [];\n for (const child11 of token11.tvaOverlays)if (child11.tvaRemove) child11.parent?.removeChild(child11)?.destroy();\n else sprites11.push(child11);\n token11.tvaOverlays = sprites11;\n}\nfunction _findTVAOverlay(id11, token11) {\n for (const child11 of token11.tvaOverlays){\n if (child11.overlayConfig?.id === id11) return child11;\n }\n return null;\n}\nfunction _removeAllOverlays(token11) {\n if (token11.tvaOverlays) for (const child11 of token11.tvaOverlays)child11.parent?.removeChild(child11)?.destroy();\n token11.tvaOverlays = null;\n}\nfunction broadcastOverlayRedraw(token11) {\n // Need to broadcast to other users to re-draw the overlay\n if (token11) drawOverlays(token11);\n const actorId11 = token11.document?.actorLink ? token11.actor?.id : null;\n const message11 = {\n handlerName: \"drawOverlays\",\n args: {\n tokenId: token11.id,\n actorId: actorId11\n },\n type: \"UPDATE\"\n };\n game.socket?.emit(\"module.token-variants\", message11);\n}\n\n});\nparcelRequire.register(\"8QbcE\", function(module, exports) {\n\n$parcel$export(module.exports, \"TVAOverlay\", () => TVAOverlay);\n\nvar $4rd87 = parcelRequire(\"4rd87\");\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\n\nvar $1u5p6 = parcelRequire(\"1u5p6\");\n\nvar $ce8jp = parcelRequire(\"ce8jp\");\n\nvar $bFZU7 = parcelRequire(\"bFZU7\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $8ZZXW = parcelRequire(\"8ZZXW\");\nclass TVAOverlay extends TokenMesh {\n constructor(pTexture11, token11, config11){\n super(token11);\n if (pTexture11.shapes) pTexture11.shapes = this.addChild(pTexture11.shapes);\n this.pseudoTexture = pTexture11;\n this.texture = pTexture11.texture;\n //this.setTexture(pTexture, { refresh: false });\n this.ready = false;\n this.overlaySort = 0;\n this.overlayConfig = mergeObject((0, $ce8jp.DEFAULT_OVERLAY_CONFIG), config11, {\n inplace: false\n });\n if (pTexture11.html) this.addHTMLOverlay();\n // linkDimensions has been converted to linkDimensionsX and linkDimensionsY\n // Make sure we're using the latest fields\n // 20/07/2023\n if (!(\"linkDimensionsX\" in this.overlayConfig) && this.overlayConfig.linkDimensions) {\n this.overlayConfig.linkDimensionsX = true;\n this.overlayConfig.linkDimensionsY = true;\n }\n this._registerHooks(this.overlayConfig);\n this._tvaPlay().then(()=>this.refresh());\n // Workaround needed for v11 visible property\n Object.defineProperty(this, \"visible\", {\n get: this._customVisible,\n set: function() {},\n configurable: true\n });\n this.eventMode = \"passive\";\n this.enableInteractivity(this.overlayConfig);\n }\n enableInteractivity() {\n if (this.mouseInteractionManager && !this.overlayConfig.interactivity?.length) {\n this.removeAllListeners();\n this.mouseInteractionManager = null;\n this.cursor = null;\n this.eventMode = \"passive\";\n return;\n } else if (this.mouseInteractionManager || !this.overlayConfig.interactivity?.length) return;\n if (!this.overlayConfig.ui) {\n if (canvas.primary.eventMode === \"passive\") canvas.primary.eventMode = \"passive\";\n }\n this.eventMode = \"static\";\n this.cursor = \"pointer\";\n const token11 = this.object;\n const sprite11 = this;\n const runInteraction11 = function(event11, listener11) {\n sprite11.overlayConfig.interactivity.forEach((i11)=>{\n if (i11.listener === listener11) {\n event11.preventDefault();\n event11.stopPropagation();\n if (i11.script) (0, $eeGZt.tv_executeScript)(i11.script, {\n token: token11\n });\n if (i11.macro) (0, $eeGZt.executeMacro)(i11.macro, token11);\n if (i11.ceEffect) (0, $eeGZt.toggleCEEffect)(token11, i11.ceEffect);\n if (i11.tmfxPreset) (0, $eeGZt.toggleTMFXPreset)(token11, i11.tmfxPreset);\n }\n });\n };\n const permissions11 = {\n hoverIn: ()=>true,\n hoverOut: ()=>true,\n clickLeft: ()=>true,\n clickLeft2: ()=>true,\n clickRight: ()=>true,\n clickRight2: ()=>true,\n dragStart: ()=>false\n };\n const callbacks11 = {\n hoverIn: (event11)=>runInteraction11(event11, \"hoverIn\"),\n hoverOut: (event11)=>runInteraction11(event11, \"hoverOut\"),\n clickLeft: (event11)=>runInteraction11(event11, \"clickLeft\"),\n clickLeft2: (event11)=>runInteraction11(event11, \"clickLeft2\"),\n clickRight: (event11)=>runInteraction11(event11, \"clickRight\"),\n clickRight2: (event11)=>runInteraction11(event11, \"clickRight2\"),\n dragLeftStart: null,\n dragLeftMove: null,\n dragLeftDrop: null,\n dragLeftCancel: null,\n dragRightStart: null,\n dragRightMove: null,\n dragRightDrop: null,\n dragRightCancel: null,\n longPress: null\n };\n const options11 = {\n target: null\n };\n // Create the interaction manager\n const mgr11 = new MouseInteractionManager(this, canvas.stage, permissions11, callbacks11, options11);\n this.mouseInteractionManager = mgr11.activate();\n }\n _customVisible() {\n const ov11 = this.overlayConfig;\n if (!this.ready || !(this.object.visible || ov11.alwaysVisible)) return false;\n if (ov11.limitedToOwner && !this.object.owner) return false;\n if (ov11.limitedUsers?.length && !ov11.limitedUsers.includes(game.user.id)) return false;\n if (ov11.limitOnEffect || ov11.limitOnProperty) {\n const speaker11 = ChatMessage.getSpeaker();\n let token11 = canvas.ready ? canvas.tokens.get(speaker11.token) : null;\n if (!token11) return false;\n if (ov11.limitOnEffect) {\n if (!(0, $dmUqi.getTokenEffects)(token11).includes(ov11.limitOnEffect)) return false;\n }\n if (ov11.limitOnProperty) {\n if (!(0, $dmUqi.evaluateComparator)(token11.document, ov11.limitOnProperty)) return false;\n }\n }\n if (ov11.limitOnHover || ov11.limitOnControl || ov11.limitOnHighlight || ov11.limitOnHUD || ov11.limitOnTarget || ov11.limitOnAnyTarget) {\n if (ov11.limitOnHover && canvas.controls.ruler._state === Ruler.STATES.INACTIVE && this.object.hover) return true;\n if (ov11.limitOnControl && this.object.controlled) return true;\n if (ov11.limitOnHighlight && (canvas.tokens.highlightObjects ?? canvas.tokens._highlight)) return true;\n if (ov11.limitOnHUD && this.object.hasActiveHUD) return true;\n if (ov11.limitOnAnyTarget && this.object.targeted.size) return true;\n if (ov11.limitOnTarget && this.object.targeted.some((u11)=>u11.id === game.userId)) return true;\n return false;\n }\n return true;\n }\n // Overlays have the same sort order as the parent\n get sort() {\n return this.object.document.sort || 0;\n }\n get _lastSortedIndex() {\n return (this.object.mesh._lastSortedIndex || 0) + this.overlaySort;\n }\n get elevation() {\n let elevation11 = this.object.mesh?.data.elevation;\n if (this.overlayConfig.top) elevation11 += 9999;\n else if (this.overlayConfig.bottom) elevation11 -= 9999;\n return elevation11;\n }\n set _lastSortedIndex(val11) {}\n async _tvaPlay() {\n // Ensure playback state for video\n const source11 = foundry.utils.getProperty(this.texture, \"baseTexture.resource.source\");\n if (source11 && source11.tagName === \"VIDEO\") {\n // Detach video from others\n const s11 = source11.cloneNode();\n if (this.overlayConfig.playOnce) s11.onended = ()=>{\n this.alpha = 0;\n this.tvaVideoEnded = true;\n };\n await new Promise((resolve11)=>s11.oncanplay = resolve11);\n this.texture = PIXI.Texture.from(s11, {\n resourceOptions: {\n autoPlay: false\n }\n });\n const options11 = {\n loop: this.overlayConfig.loop && !this.overlayConfig.playOnce,\n volume: 0,\n offset: 0,\n playing: true\n };\n game.video.play(s11, options11);\n }\n }\n addChildAuto(...children11) {\n if (this.pseudoTexture?.shapes) return this.pseudoTexture.shapes.addChild(...children11);\n else return this.addChild(...children11);\n }\n setTexture(pTexture11, { preview: preview11 = false, refresh: refresh11 = true, configuration: configuration11 = null } = {}) {\n // Text preview handling\n if (preview11) {\n this._swapChildren(pTexture11);\n if (this.originalTexture) this._destroyTexture();\n else {\n this.originalTexture = this.pseudoTexture;\n if (this.originalTexture.shapes) this.removeChild(this.originalTexture.shapes);\n }\n this.pseudoTexture = pTexture11;\n this.texture = pTexture11.texture;\n if (pTexture11.shapes) pTexture11.shapes = this.addChild(pTexture11.shapes);\n } else if (this.originalTexture) {\n this._swapChildren(this.originalTexture);\n this._destroyTexture();\n this.pseudoTexture = this.originalTexture;\n this.texture = this.originalTexture.texture;\n if (this.originalTexture.shapes) this.pseudoTexture.shapes = this.addChild(this.originalTexture.shapes);\n delete this.originalTexture;\n } else {\n this._swapChildren(pTexture11);\n this._destroyTexture();\n this.pseudoTexture = pTexture11;\n this.texture = pTexture11.texture;\n if (pTexture11.shapes) this.pseudoTexture.shapes = this.addChild(pTexture11.shapes);\n }\n if (this.pseudoTexture.html) this.addHTMLOverlay();\n if (refresh11) this.refresh(configuration11, {\n fullRefresh: !preview11\n });\n }\n refresh(configuration11, { preview: preview11 = false, fullRefresh: fullRefresh11 = true, previewTexture: previewTexture11 = null } = {}) {\n if (!this.overlayConfig || !this.texture) return;\n // Text preview handling\n if (previewTexture11 || this.originalTexture) this.setTexture(previewTexture11, {\n preview: Boolean(previewTexture11),\n refresh: false\n });\n // Register/Unregister hooks that should refresh this overlay\n if (configuration11) this._registerHooks(configuration11);\n const config11 = mergeObject(this.overlayConfig, configuration11 ?? {}, {\n inplace: !preview11\n });\n if (preview11 && this.htmlOverlay) this.htmlOverlay.render(config11, true);\n this.enableInteractivity(config11);\n if (fullRefresh11) {\n const source11 = foundry.utils.getProperty(this.texture, \"baseTexture.resource.source\");\n if (source11 && source11.tagName === \"VIDEO\") {\n if (!source11.loop && config11.loop) game.video.play(source11);\n else if (source11.loop && !config11.loop) game.video.stop(source11);\n source11.loop = config11.loop;\n }\n }\n const shapes11 = this.pseudoTexture.shapes;\n // Scale the image using the same logic as the token\n const dimensions11 = shapes11 ?? this.texture;\n if (config11.linkScale && !config11.parentID) {\n const scale11 = this.scale;\n const aspect11 = dimensions11.width / dimensions11.height;\n if (aspect11 >= 1) {\n scale11.x = this.object.w * this.object.document.texture.scaleX / dimensions11.width;\n scale11.y = Number(scale11.x);\n } else {\n scale11.y = this.object.h * this.object.document.texture.scaleY / dimensions11.height;\n scale11.x = Number(scale11.y);\n }\n } else if (config11.linkStageScale) {\n this.scale.x = 1 / canvas.stage.scale.x;\n this.scale.y = 1 / canvas.stage.scale.y;\n } else if (config11.linkDimensionsX || config11.linkDimensionsY) {\n if (config11.linkDimensionsX) this.scale.x = this.object.document.width;\n if (config11.linkDimensionsY) this.scale.y = this.object.document.height;\n } else {\n this.scale.x = config11.width ? config11.width / dimensions11.width : 1;\n this.scale.y = config11.height ? config11.height / dimensions11.height : 1;\n }\n // Adjust scale according to config\n this.scale.x = this.scale.x * config11.scaleX;\n this.scale.y = this.scale.y * config11.scaleY;\n // Check if mirroring should be inherited from the token and if so apply it\n if (config11.linkMirror && !config11.parentID) {\n this.scale.x = Math.abs(this.scale.x) * (this.object.document.texture.scaleX < 0 ? -1 : 1);\n this.scale.y = Math.abs(this.scale.y) * (this.object.document.texture.scaleY < 0 ? -1 : 1);\n }\n if (this.anchor) {\n if (!config11.anchor) this.anchor.set(0.5, 0.5);\n else this.anchor.set(config11.anchor.x, config11.anchor.y);\n }\n let xOff11 = 0;\n let yOff11 = 0;\n if (shapes11) {\n shapes11.position.x = -this.anchor.x * shapes11.width;\n shapes11.position.y = -this.anchor.y * shapes11.height;\n if (config11.animation.relative) {\n this.pivot.set(0, 0);\n shapes11.pivot.set((0.5 - this.anchor.x) * shapes11.width, (0.5 - this.anchor.y) * shapes11.height);\n xOff11 = shapes11.pivot.x * this.scale.x;\n yOff11 = shapes11.pivot.y * this.scale.y;\n }\n } else if (config11.animation.relative) {\n xOff11 = (0.5 - this.anchor.x) * this.width;\n yOff11 = (0.5 - this.anchor.y) * this.height;\n this.pivot.set((0.5 - this.anchor.x) * this.texture.width, (0.5 - this.anchor.y) * this.texture.height);\n }\n // Position\n const pOffsetX11 = config11.pOffsetX || 0;\n const pOffsetY11 = config11.pOffsetY || 0;\n if (config11.parentID) {\n const anchor11 = this.parent.anchor ?? {\n x: 0,\n y: 0\n };\n const pWidth11 = (this.parent.shapesWidth ?? this.parent.width) / this.parent.scale.x;\n const pHeight11 = (this.parent.shapesHeight ?? this.parent.height) / this.parent.scale.y;\n this.position.set(pOffsetX11 + -config11.offsetX * pWidth11 - anchor11.x * pWidth11 + pWidth11 / 2, pOffsetY11 + -config11.offsetY * pHeight11 - anchor11.y * pHeight11 + pHeight11 / 2);\n } else if (config11.animation.relative) this.position.set(this.object.document.x + this.object.w / 2 + pOffsetX11 + -config11.offsetX * this.object.w + xOff11, this.object.document.y + this.object.h / 2 + pOffsetY11 + -config11.offsetY * this.object.h + yOff11);\n else {\n this.position.set(this.object.document.x + this.object.w / 2, this.object.document.y + this.object.h / 2);\n this.pivot.set(-pOffsetX11 / this.scale.x + config11.offsetX * this.object.w / this.scale.x, -pOffsetY11 / this.scale.y + config11.offsetY * this.object.h / this.scale.y);\n }\n // Set alpha but only if playOnce is disabled and the video hasn't\n // finished playing yet. Otherwise we want to keep alpha as 0 to keep the video hidden\n if (!this.tvaVideoEnded) this.alpha = config11.linkOpacity ? this.object.document.alpha : config11.alpha;\n // Angle in degrees\n if (fullRefresh11) {\n if (config11.linkRotation) this.angle = this.object.document.rotation + config11.angle;\n else this.angle = config11.angle;\n } else if (!config11.animation.rotate) {\n if (config11.linkRotation) this.angle = this.object.document.rotation + config11.angle;\n }\n // Apply color tinting\n const tint11 = config11.inheritTint ? this.object.document.texture.tint : (0, $bFZU7.interpolateColor)(config11.tint, config11.interpolateColor, true);\n this.tint = tint11 ? Color.from(tint11) : 0xffffff;\n if (shapes11) {\n shapes11.tint = this.tint;\n shapes11.alpha = this.alpha;\n }\n if (fullRefresh11) {\n if (config11.animation.rotate) this.animate(config11);\n else this.stopAnimation();\n }\n // Apply filters\n if (fullRefresh11) this._applyFilters(config11);\n //if (fullRefresh) this.filters = this._getFilters(config);\n if (preview11 && this.children) this.children.forEach((ch11)=>{\n if (ch11 instanceof TVAOverlay) ch11.refresh(null, {\n preview: true\n });\n });\n if (this.htmlOverlay) this.htmlOverlay.setPosition({\n left: this.x - this.pivot.x * this.scale.x - this.width * this.anchor.x,\n top: this.y - this.pivot.y * this.scale.y - this.height * this.anchor.y,\n width: this.width,\n height: this.height,\n angle: this.angle\n });\n this.ready = true;\n }\n _activateTicker() {\n this._deactivateTicker();\n canvas.app.ticker.add(this.updatePosition, this, PIXI.UPDATE_PRIORITY.HIGH);\n }\n _deactivateTicker() {\n canvas.app.ticker.remove(this.updatePosition, this);\n }\n updatePosition() {\n let coord11 = canvas.canvasCoordinatesFromClient({\n x: window.innerWidth / 2 + this.overlayConfig.offsetX * window.innerWidth,\n y: window.innerHeight / 2 + this.overlayConfig.offsetY * window.innerHeight\n });\n this.position.set(coord11.x, coord11.y);\n }\n async _applyFilters(config11) {\n const filterName11 = config11.filter;\n const FilterClass11 = PIXI.filters[filterName11];\n const options11 = mergeObject((0, $4rd87.FILTERS)[filterName11]?.defaultValues || {}, config11.filterOptions);\n let filter11;\n if (FilterClass11) {\n if ((0, $4rd87.FILTERS)[filterName11]?.argType === \"args\") {\n let args11 = [];\n const controls11 = (0, $4rd87.FILTERS)[filterName11]?.controls;\n if (controls11) controls11.forEach((c11)=>args11.push(options11[c11.name]));\n filter11 = new FilterClass11(...args11);\n } else if ((0, $4rd87.FILTERS)[filterName11]?.argType === \"options\") filter11 = new FilterClass11(options11);\n else filter11 = new FilterClass11();\n } else if (filterName11 === \"OutlineOverlayFilter\") {\n filter11 = OutlineFilter.create(options11);\n filter11.thickness = options11.trueThickness ?? 1;\n filter11.animate = options11.animate ?? false;\n } else if (filterName11 === \"Token Magic FX\") {\n this.applyTVAFilters(await constructTMFXFilters(options11.params || [], this));\n return;\n }\n if (filter11) {\n this.applyTVAFilters([\n filter11\n ]);\n this.filters = [\n filter11\n ];\n } else this.removeTVAFilters();\n if (this.overlayConfig.ui && this.overlayConfig.bottom) this.applyReverseMask();\n else this.removeReverseMask();\n }\n applyReverseMask() {\n if (!this.filters?.find((f11)=>f11.tvaReverse)) {\n const filters11 = this.filters || [];\n const reverseMask11 = ReverseMaskFilter.create({\n uMaskSampler: canvas.primary.tokensRenderTexture,\n channel: \"a\"\n });\n reverseMask11.tvaReverse = true;\n filters11.push(reverseMask11);\n this.filters = filters11;\n }\n if (!this.filters) filters = [];\n }\n removeReverseMask() {\n if (this.filters?.length) this.filters = this.filters.filter((f11)=>!f11.tvaReverse);\n }\n applyTVAFilters(filters11) {\n if (filters11?.length) {\n this.removeTVAFilters();\n this.filters = (this.filters || []).concat(filters11);\n }\n }\n removeTVAFilters() {\n if (this.filters) this.filters = this.filters.filter((f11)=>!f11.tvaFilter);\n }\n async stopAnimation() {\n if (this.animationName) CanvasAnimation.terminateAnimation(this.animationName);\n }\n async animate(config11) {\n if (!this.animationName) this.animationName = this.object.sourceId + \".\" + randomID(5);\n let newAngle11 = this.angle + (config11.animation.clockwise ? 360 : -360);\n const rotate11 = [\n {\n parent: this,\n attribute: \"angle\",\n to: newAngle11\n }\n ];\n const completed11 = await CanvasAnimation.animate(rotate11, {\n duration: config11.animation.duration,\n name: this.animationName\n });\n if (completed11) this.animate(config11);\n }\n _registerHooks(configuration11) {\n if (configuration11.linkStageScale) (0, $1u5p6.registerOverlayRefreshHook)(this, \"canvasPan\");\n else (0, $1u5p6.unregisterOverlayRefreshHooks)(this, \"canvasPan\");\n }\n _swapChildren(to11) {\n const from11 = this.pseudoTexture;\n if (from11.shapes) {\n this.removeChild(this.pseudoTexture.shapes);\n const children11 = from11.shapes.removeChildren();\n if (to11?.shapes) children11.forEach((c11)=>to11.shapes.addChild(c11)?.refresh());\n else children11.forEach((c11)=>this.addChild(c11)?.refresh());\n } else if (to11?.shapes) {\n const children11 = this.removeChildren();\n children11.forEach((c11)=>to11.shapes.addChild(c11)?.refresh());\n }\n }\n _destroyTexture() {\n if (this.texture.textLabel || this.texture.destroyable) this.texture.destroy(true);\n if (this.pseudoTexture?.shapes) {\n this.removeChild(this.pseudoTexture.shapes);\n this.pseudoTexture.shapes.destroy();\n } else if (this.pseudoTexture?.html) this.removeHTMLOverlay();\n }\n destroy() {\n this.stopAnimation();\n (0, $1u5p6.unregisterOverlayRefreshHooks)(this);\n if (this.children) {\n for (const ch11 of this.children)if (ch11 instanceof TVAOverlay) ch11.tvaRemove = true;\n (0, $bFZU7.removeMarkedOverlays)(this.object);\n if (this.pseudoTexture.shapes) {\n this.pseudoTexture.shapes.children.forEach((c11)=>c11.destroy());\n this.removeChild(this.pseudoTexture.shapes)?.destroy();\n // this.pseudoTexture.shapes.destroy();\n }\n }\n if (this.texture.textLabel || this.texture.destroyable) return super.destroy(true);\n else if (this.texture?.baseTexture.resource?.source?.tagName === \"VIDEO\") this.texture.baseTexture.destroy();\n this.removeHTMLOverlay();\n super.destroy();\n }\n // Foundry BUG Fix\n calculateTrimmedVertices() {\n return PIXI.Sprite.prototype.calculateTrimmedVertices.call(this);\n }\n addHTMLOverlay() {\n if (!this.htmlOverlay) this.htmlOverlay = new (0, $8ZZXW.HTMLOverlay)(this.overlayConfig, this.object);\n }\n removeHTMLOverlay() {\n if (this.htmlOverlay) this.htmlOverlay.remove();\n this.htmlOverlay = null;\n }\n}\nasync function constructTMFXFilters(paramsArray, sprite) {\n if (typeof TokenMagic === \"undefined\") return [];\n try {\n paramsArray = eval(paramsArray);\n } catch (e) {\n return [];\n }\n if (!Array.isArray(paramsArray)) paramsArray = TokenMagic.getPreset(paramsArray);\n if (!(paramsArray instanceof Array && paramsArray.length > 0)) return [];\n let filters = [];\n for (const params of paramsArray){\n if (!params.hasOwnProperty(\"filterType\") || !TMFXFilterTypes.hasOwnProperty(params.filterType)) // one invalid ? all rejected.\n return [];\n if (!params.hasOwnProperty(\"rank\")) params.rank = 5000;\n if (!params.hasOwnProperty(\"filterId\") || params.filterId == null) params.filterId = randomID();\n if (!params.hasOwnProperty(\"enabled\") || !(typeof params.enabled === \"boolean\")) params.enabled = true;\n params.filterInternalId = randomID();\n const gms = game.users.filter((user11)=>user11.isGM);\n params.filterOwner = gms.length ? gms[0].id : game.data.userId;\n // params.placeableType = placeable._TMFXgetPlaceableType();\n params.updateId = randomID();\n const filterClass = await getTMFXFilter(params.filterType);\n if (filterClass) {\n filterClass.prototype.assignPlaceable = function() {\n this.targetPlaceable = sprite.object;\n this.placeableImg = sprite;\n };\n filterClass.prototype._TMFXsetAnimeFlag = async function() {};\n const filter = new filterClass(params);\n if (filter) {\n // Patch fixes\n filter.placeableImg = sprite;\n filter.targetPlaceable = sprite.object;\n // end of fixes\n filter.tvaFilter = true;\n filters.unshift(filter);\n }\n }\n }\n return filters;\n}\nasync function getTMFXFilter(id11) {\n if (id11 in TMFXFilterTypes) {\n if (id11 in LOADED_TMFXFilters) return LOADED_TMFXFilters[id11];\n else try {\n const className11 = TMFXFilterTypes[id11];\n let fxModule11 = await import(`../../../tokenmagic/fx/filters/${className11}.js`);\n if (fxModule11 && fxModule11[className11]) {\n LOADED_TMFXFilters[id11] = fxModule11[className11];\n return fxModule11[className11];\n }\n } catch (e11) {}\n }\n return null;\n}\nconst LOADED_TMFXFilters = {};\nconst TMFXFilterTypes = {\n adjustment: \"FilterAdjustment\",\n distortion: \"FilterDistortion\",\n oldfilm: \"FilterOldFilm\",\n glow: \"FilterGlow\",\n outline: \"FilterOutline\",\n bevel: \"FilterBevel\",\n xbloom: \"FilterXBloom\",\n shadow: \"FilterDropShadow\",\n twist: \"FilterTwist\",\n zoomblur: \"FilterZoomBlur\",\n blur: \"FilterBlur\",\n bulgepinch: \"FilterBulgePinch\",\n zapshadow: \"FilterRemoveShadow\",\n ray: \"FilterRays\",\n fog: \"FilterFog\",\n xfog: \"FilterXFog\",\n electric: \"FilterElectric\",\n wave: \"FilterWaves\",\n shockwave: \"FilterShockwave\",\n fire: \"FilterFire\",\n fumes: \"FilterFumes\",\n smoke: \"FilterSmoke\",\n flood: \"FilterFlood\",\n images: \"FilterMirrorImages\",\n field: \"FilterForceField\",\n xray: \"FilterXRays\",\n liquid: \"FilterLiquid\",\n xglow: \"FilterGleamingGlow\",\n pixel: \"FilterPixelate\",\n web: \"FilterSpiderWeb\",\n ripples: \"FilterSolarRipples\",\n globes: \"FilterGlobes\",\n transform: \"FilterTransform\",\n splash: \"FilterSplash\",\n polymorph: \"FilterPolymorph\",\n xfire: \"FilterXFire\",\n sprite: \"FilterSprite\",\n replaceColor: \"FilterReplaceColor\",\n ddTint: \"FilterDDTint\"\n};\nclass OutlineFilter extends OutlineOverlayFilter {\n /** @inheritdoc */ static createFragmentShader() {\n return `\r\n varying vec2 vTextureCoord;\r\n varying vec2 vFilterCoord;\r\n uniform sampler2D uSampler;\r\n \r\n uniform vec2 thickness;\r\n uniform vec4 outlineColor;\r\n uniform vec4 filterClamp;\r\n uniform float alphaThreshold;\r\n uniform float time;\r\n uniform bool knockout;\r\n uniform bool wave;\r\n \r\n ${this.CONSTANTS}\r\n ${this.WAVE()}\r\n \r\n void main(void) {\r\n float dist = distance(vFilterCoord, vec2(0.5)) * 2.0;\r\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\r\n vec4 wColor = wave ? outlineColor * \r\n wcos(0.0, 1.0, dist * 75.0, \r\n -time * 0.01 + 3.0 * dot(vec4(1.0), ownColor)) \r\n * 0.33 * (1.0 - dist) : vec4(0.0);\r\n float texAlpha = smoothstep(alphaThreshold, 1.0, ownColor.a);\r\n vec4 curColor;\r\n float maxAlpha = 0.;\r\n vec2 displaced;\r\n for ( float angle = 0.0; angle <= TWOPI; angle += ${this.#quality.toFixed(7)} ) {\r\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\r\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\r\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\r\n curColor.a = clamp((curColor.a - 0.6) * 2.5, 0.0, 1.0);\r\n maxAlpha = max(maxAlpha, curColor.a);\r\n }\r\n float resultAlpha = max(maxAlpha, texAlpha);\r\n vec3 result = (ownColor.rgb + outlineColor.rgb * (1.0 - texAlpha)) * resultAlpha;\r\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\r\n }\r\n `;\n }\n static get #quality() {\n switch(canvas.performance.mode){\n case CONST.CANVAS_PERFORMANCE_MODES.LOW:\n return Math.PI * 2 / 10;\n case CONST.CANVAS_PERFORMANCE_MODES.MED:\n return Math.PI * 2 / 20;\n default:\n return Math.PI * 2 / 30;\n }\n }\n}\n\n});\nparcelRequire.register(\"1u5p6\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerOverlayHooks\", () => $114cc8e60adcf175$export$dfc93b4a68593ad7);\n$parcel$export(module.exports, \"registerOverlayRefreshHook\", () => $114cc8e60adcf175$export$eb523686b30ccac9);\n$parcel$export(module.exports, \"unregisterOverlayRefreshHooks\", () => $114cc8e60adcf175$export$83fe15bb1b8a7c6e);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $8ZZXW = parcelRequire(\"8ZZXW\");\n\nvar $8QbcE = parcelRequire(\"8QbcE\");\n\nvar $bFZU7 = parcelRequire(\"bFZU7\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\nconst $114cc8e60adcf175$var$feature_id = \"Overlays\";\nfunction $114cc8e60adcf175$export$dfc93b4a68593ad7() {\n if (!(0, $9IngI.FEATURE_CONTROL)[$114cc8e60adcf175$var$feature_id]) {\n [\n \"refreshToken\",\n \"destroyToken\",\n \"updateActor\",\n \"renderCombatTracker\",\n \"updateToken\",\n \"createToken\",\n \"renderHeadsUpDisplay\"\n ].forEach((id)=>(0, $e9LRe.unregisterHook)($114cc8e60adcf175$var$feature_id, id));\n return;\n }\n (0, $e9LRe.registerHook)($114cc8e60adcf175$var$feature_id, \"createToken\", async function(token) {\n if (token.object) (0, $bFZU7.drawOverlays)(token.object);\n });\n (0, $e9LRe.registerHook)($114cc8e60adcf175$var$feature_id, \"updateToken\", async function(token) {\n if (token.object) (0, $bFZU7.drawOverlays)(token.object);\n });\n (0, $e9LRe.registerHook)($114cc8e60adcf175$var$feature_id, \"refreshToken\", (token)=>{\n if (token.tvaOverlays) {\n for (const child of token.tvaOverlays)if (child instanceof (0, $8QbcE.TVAOverlay)) child.refresh(null, {\n preview: false,\n fullRefresh: false\n });\n }\n });\n (0, $e9LRe.registerHook)($114cc8e60adcf175$var$feature_id, \"destroyToken\", (token)=>{\n if (token.tvaOverlays) for (const child of token.tvaOverlays)child.parent?.removeChild(child)?.destroy();\n });\n (0, $e9LRe.registerHook)($114cc8e60adcf175$var$feature_id, \"updateActor\", async function(actor) {\n if (actor.getActiveTokens) actor.getActiveTokens(true).forEach((token)=>{\n (0, $bFZU7.drawOverlays)(token);\n });\n });\n (0, $e9LRe.registerHook)($114cc8e60adcf175$var$feature_id, \"renderCombatTracker\", function() {\n for (const tkn of canvas.tokens.placeables)(0, $bFZU7.drawOverlays)(tkn);\n });\n (0, $e9LRe.registerHook)($114cc8e60adcf175$var$feature_id, \"renderHeadsUpDisplay\", ()=>{\n (0, $8ZZXW.HTMLOverlay).hudRendered();\n });\n}\nconst $114cc8e60adcf175$var$REFRESH_HOOKS = {};\nfunction $114cc8e60adcf175$export$eb523686b30ccac9(tvaOverlay, hookName) {\n if (!(hookName in $114cc8e60adcf175$var$REFRESH_HOOKS)) {\n (0, $e9LRe.registerHook)(\"TVAOverlayRefresh\", hookName, ()=>{\n $114cc8e60adcf175$var$REFRESH_HOOKS[hookName]?.forEach((s)=>s.refresh());\n });\n $114cc8e60adcf175$var$REFRESH_HOOKS[hookName] = [\n tvaOverlay\n ];\n } else if (!$114cc8e60adcf175$var$REFRESH_HOOKS[hookName].find((s)=>s == tvaOverlay)) $114cc8e60adcf175$var$REFRESH_HOOKS[hookName].push(tvaOverlay);\n}\nfunction $114cc8e60adcf175$export$83fe15bb1b8a7c6e(tvaOverlay, hookName = null) {\n const unregister = function(hook) {\n if ($114cc8e60adcf175$var$REFRESH_HOOKS[hook]) {\n let index = $114cc8e60adcf175$var$REFRESH_HOOKS[hook].findIndex((s)=>s == tvaOverlay);\n if (index > -1) {\n $114cc8e60adcf175$var$REFRESH_HOOKS[hook].splice(index, 1);\n if (!$114cc8e60adcf175$var$REFRESH_HOOKS[hook].length) {\n (0, $e9LRe.unregisterHook)(\"TVAOverlayRefresh\", hook);\n delete $114cc8e60adcf175$var$REFRESH_HOOKS[hook];\n }\n }\n }\n };\n if (hookName) unregister(hookName);\n else Object.keys($114cc8e60adcf175$var$REFRESH_HOOKS).forEach((k)=>unregister(k));\n}\n\n});\nparcelRequire.register(\"8ZZXW\", function(module, exports) {\n\n$parcel$export(module.exports, \"HTMLOverlay\", () => HTMLOverlay);\nclass HTMLOverlay {\n static container = null;\n static renderQueue = [];\n static hudReady = false;\n static hudRendered() {\n HTMLOverlay.hudReady = true;\n HTMLOverlay.renderQueue.forEach((ov11)=>ov11.render());\n HTMLOverlay.renderQueue = [];\n }\n constructor(overlayConfig11, token11){\n this.overlayConfig = overlayConfig11;\n this.token = token11;\n this.render();\n }\n render(overlayConfig11 = null, force11 = false) {\n if (!HTMLOverlay.hudReady) {\n HTMLOverlay.renderQueue.push(this);\n return;\n }\n if (!HTMLOverlay.container) {\n HTMLOverlay.container = $('<div id=\"tva-html-overlays\"></div>');\n $(\"#hud\").append(HTMLOverlay.container);\n }\n if (this.element) this.remove();\n if (overlayConfig11) this.overlayConfig = overlayConfig11;\n this.element = $(renderTemplate(this.overlayConfig, this.getData(), force11));\n HTMLOverlay.container.append(this.element);\n this.activateListeners(this.element);\n this.setPosition();\n }\n remove() {\n if (this.element) this.element.remove();\n this.element = null;\n }\n getData(options11 = {}) {\n const data11 = this.token.document.toObject();\n return foundry.utils.mergeObject(data11, {\n isGM: game.user.isGM\n });\n }\n setPosition({ left: left11, top: top11, width: width11, height: height11, scale: scale11, angle: angle11, origin: origin11 } = {}) {\n if (!HTMLOverlay.hudReady) return;\n const ratio11 = canvas.dimensions.size / 100;\n const position11 = {\n width: width11 || this.token.document.width * 100,\n height: height11 || this.token.document.height * 100,\n left: left11 ?? this.token.document.x,\n top: top11 ?? this.token.document.y\n };\n if (ratio11 !== 1) position11.transform = `scale(${ratio11})`;\n this.element.css(position11);\n if (angle11 != null) this.element.css({\n transform: \"rotate(\" + angle11 + \"deg)\"\n });\n if (origin11 != null) this.element.css({\n \"transform-origin\": origin11.x + \"px \" + origin11.y + \"px\"\n });\n }\n /** @override */ activateListeners(html) {\n try {\n eval(this.overlayConfig.html.listeners);\n } catch (e) {}\n }\n}\nconst _templateCache = {};\nfunction _compile(stringHTML11) {\n return Handlebars.compile('<div class=\"tva-html-overlay\"> <section class=\"window-content\"><form>' + stringHTML11 + \"</form></section></div>\");\n}\nfunction constructTemplate(ovConfig11, force11 = false) {\n if (!_templateCache.hasOwnProperty(ovConfig11.id)) {\n const compiled11 = _compile(ovConfig11.html.template);\n Handlebars.registerPartial(ovConfig11.id, compiled11);\n _templateCache[ovConfig11.id] = compiled11;\n } else if (force11) return _compile(ovConfig11.html.template);\n return _templateCache[ovConfig11.id];\n}\nfunction renderTemplate(ovConfig11, data11, force11 = false) {\n const template11 = constructTemplate(ovConfig11, force11);\n console.log(data11.x);\n return template11(data11 || {}, {\n allowProtoMethodsByDefault: true,\n allowProtoPropertiesByDefault: true\n });\n}\n\n});\n\nparcelRequire.register(\"e9LRe\", function(module, exports) {\n\n$parcel$export(module.exports, \"REGISTERED_HOOKS\", () => $a4e70777a71079ac$export$886510d4c7ede60a);\n$parcel$export(module.exports, \"registerHook\", () => $a4e70777a71079ac$export$d94509b1766d8915);\n$parcel$export(module.exports, \"unregisterHook\", () => $a4e70777a71079ac$export$edf411798a018b13);\n$parcel$export(module.exports, \"registerAllHooks\", () => $a4e70777a71079ac$export$bcab441347d0cde);\n\nvar $aVtQz = parcelRequire(\"aVtQz\");\n\nvar $6Jwr7 = parcelRequire(\"6Jwr7\");\n\nvar $1u5p6 = parcelRequire(\"1u5p6\");\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\n\nvar $1MaGd = parcelRequire(\"1MaGd\");\n\nvar $7Bay0 = parcelRequire(\"7Bay0\");\n\nvar $4VMEk = parcelRequire(\"4VMEk\");\n\nvar $aTVyJ = parcelRequire(\"aTVyJ\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\nconst $a4e70777a71079ac$export$886510d4c7ede60a = {};\nfunction $a4e70777a71079ac$export$d94509b1766d8915(feature_id, name, fn, { once: once = false } = {}) {\n if (!(feature_id in $a4e70777a71079ac$export$886510d4c7ede60a)) $a4e70777a71079ac$export$886510d4c7ede60a[feature_id] = {};\n if (name in $a4e70777a71079ac$export$886510d4c7ede60a[feature_id]) return;\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(`TVA | Registering Hook`, {\n feature_id: feature_id,\n name: name,\n fn: fn,\n once: once\n });\n const num = Hooks.on(name, fn, {\n once: once\n });\n $a4e70777a71079ac$export$886510d4c7ede60a[feature_id][name] = num;\n}\nfunction $a4e70777a71079ac$export$edf411798a018b13(feature_id, name) {\n if (feature_id in $a4e70777a71079ac$export$886510d4c7ede60a && name in $a4e70777a71079ac$export$886510d4c7ede60a[feature_id]) {\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(`TVA | Un-Registering Hook`, {\n feature_id: feature_id,\n name: name,\n id: $a4e70777a71079ac$export$886510d4c7ede60a[feature_id][name]\n });\n Hooks.off(name, $a4e70777a71079ac$export$886510d4c7ede60a[feature_id][name]);\n delete $a4e70777a71079ac$export$886510d4c7ede60a[feature_id][name];\n }\n}\nfunction $a4e70777a71079ac$export$bcab441347d0cde() {\n // Hide effect icons\n (0, $aVtQz.registerEffectIconHooks)();\n // Display overlays\n (0, $1u5p6.registerOverlayHooks)();\n // Insert Art Select buttons and contextmenu listeners\n (0, $6Jwr7.registerArtSelectButtonHooks)();\n // Effect Mapping related listening for state changes and applying configurations\n (0, $dmUqi.registerEffectMappingHooks)();\n // Display HUD buttons for Tokens and Tiles\n (0, $1MaGd.registerHUDHooks)();\n // Default Wildcard image controls\n (0, $4VMEk.registerWildcardHooks)();\n // User to Image mappings for Tile and Tokens\n (0, $7Bay0.registerUserMappingHooks)();\n // Handle pop-ups and randomization on token/actor create\n (0, $aTVyJ.registerPopRandomizeHooks)();\n}\n\n});\nparcelRequire.register(\"aVtQz\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerEffectIconHooks\", () => $7f466139f88e16a7$export$2d8503e635b61305);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\nconst $7f466139f88e16a7$var$feature_id = \"EffectIcons\";\nfunction $7f466139f88e16a7$export$2d8503e635b61305() {\n // OnHover settings specific hooks\n if ((0, $9IngI.FEATURE_CONTROL)[$7f466139f88e16a7$var$feature_id] && (0, $9IngI.TVA_CONFIG).displayEffectIconsOnHover) (0, $e9LRe.registerHook)($7f466139f88e16a7$var$feature_id, \"hoverToken\", (token, hoverIn)=>{\n if (token.effects) token.effects.visible = hoverIn;\n });\n else (0, $e9LRe.unregisterHook)($7f466139f88e16a7$var$feature_id, \"hoverToken\");\n if ((0, $9IngI.FEATURE_CONTROL)[$7f466139f88e16a7$var$feature_id] && (0, $9IngI.TVA_CONFIG).displayEffectIconsOnHover) (0, $e9LRe.registerHook)($7f466139f88e16a7$var$feature_id, \"highlightObjects\", (active)=>{\n if (canvas.tokens.active) {\n for (const tkn of canvas.tokens.placeables)if (tkn.effects) tkn.effects.visible = active || tkn.hover;\n }\n });\n else (0, $e9LRe.unregisterHook)($7f466139f88e16a7$var$feature_id, \"highlightObjects\");\n}\n\n});\n\nparcelRequire.register(\"6Jwr7\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerArtSelectButtonHooks\", () => $4e701b3a6ed20c89$export$802e6d785977eba8);\n\nvar $7OP4c = parcelRequire(\"7OP4c\");\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\nconst $4e701b3a6ed20c89$var$feature_id = \"ArtSelect\";\nfunction $4e701b3a6ed20c89$export$802e6d785977eba8() {\n // Insert right-click listeners to open up ArtSelect forms from various contexts\n if ((0, $9IngI.TVA_CONFIG).permissions.portrait_right_click[game.user.role]) {\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderActorSheet\", $4e701b3a6ed20c89$var$_modActorSheet);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderItemSheet\", $4e701b3a6ed20c89$var$_modItemSheet);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderItemActionSheet\", $4e701b3a6ed20c89$var$_modItemSheet);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderJournalSheet\", $4e701b3a6ed20c89$var$_modJournalSheet);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderRollTableConfig\", $4e701b3a6ed20c89$var$_modRollTableSheet);\n } else [\n \"renderActorSheet\",\n \"renderItemSheet\",\n \"renderItemActionSheet\",\n \"renderJournalSheet\",\n \"renderRollTableConfig\"\n ].forEach((name)=>(0, $e9LRe.unregisterHook)($4e701b3a6ed20c89$var$feature_id, name));\n // Insert buttons\n if ((0, $9IngI.TVA_CONFIG).permissions.image_path_button[game.user.role]) {\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderTileConfig\", $4e701b3a6ed20c89$var$_modTileConfig);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderMeasuredTemplateConfig\", $4e701b3a6ed20c89$var$_modTemplateConfig);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderTokenConfig\", $4e701b3a6ed20c89$var$_modTokenConfig);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderDrawingConfig\", $4e701b3a6ed20c89$var$_modDrawingConfig);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderNoteConfig\", $4e701b3a6ed20c89$var$_modNoteConfig);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderSceneConfig\", $4e701b3a6ed20c89$var$_modSceneConfig);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderMacroConfig\", $4e701b3a6ed20c89$var$_modMacroConfig);\n (0, $e9LRe.registerHook)($4e701b3a6ed20c89$var$feature_id, \"renderActiveEffectConfig\", $4e701b3a6ed20c89$var$_modActiveEffectConfig);\n } else [\n \"renderTileConfig\",\n \"renderMeasuredTemplateConfig\",\n \"renderTokenConfig\",\n \"renderDrawingConfig\",\n \"renderNoteConfig\",\n \"renderSceneConfig\",\n `renderActiveEffectConfig`\n ].forEach((name)=>(0, $e9LRe.unregisterHook)($4e701b3a6ed20c89$var$feature_id, name));\n}\nfunction $4e701b3a6ed20c89$var$_modTokenConfig(config, html) {\n (0, $7OP4c.insertArtSelectButton)(html, \"texture.src\", {\n search: config.object.name,\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN\n });\n}\nfunction $4e701b3a6ed20c89$var$_modTemplateConfig(config, html) {\n (0, $7OP4c.insertArtSelectButton)(html, \"texture\", {\n search: \"Template\",\n searchType: (0, $eeGZt.SEARCH_TYPE).TILE\n });\n}\nfunction $4e701b3a6ed20c89$var$_modDrawingConfig(config, html) {\n (0, $7OP4c.insertArtSelectButton)(html, \"texture\", {\n search: \"Drawing\",\n searchType: (0, $9IngI.TVA_CONFIG).customImageCategories.includes(\"Drawing\") ? \"Drawing\" : (0, $eeGZt.SEARCH_TYPE).TILE\n });\n}\nfunction $4e701b3a6ed20c89$var$_modNoteConfig(config, html) {\n (0, $7OP4c.insertArtSelectButton)(html, \"icon.custom\", {\n search: \"Note\",\n searchType: (0, $9IngI.TVA_CONFIG).customImageCategories.includes(\"Note\") ? \"Note\" : (0, $eeGZt.SEARCH_TYPE).ITEM\n });\n}\nfunction $4e701b3a6ed20c89$var$_modSceneConfig(config, html) {\n (0, $7OP4c.insertArtSelectButton)(html, \"background.src\", {\n search: config.object.name,\n searchType: (0, $9IngI.TVA_CONFIG).customImageCategories.includes(\"Scene\") ? \"Scene\" : (0, $eeGZt.SEARCH_TYPE).TILE\n });\n (0, $7OP4c.insertArtSelectButton)(html, \"foreground\", {\n search: config.object.name,\n searchType: (0, $9IngI.TVA_CONFIG).customImageCategories.includes(\"Scene\") ? \"Scene\" : (0, $eeGZt.SEARCH_TYPE).TILE\n });\n (0, $7OP4c.insertArtSelectButton)(html, \"fogOverlay\", {\n search: config.object.name,\n searchType: (0, $9IngI.TVA_CONFIG).customImageCategories.includes(\"Fog\") ? \"Fog\" : (0, $eeGZt.SEARCH_TYPE).TILE\n });\n}\nfunction $4e701b3a6ed20c89$var$_modTileConfig(tileConfig, html) {\n (0, $7OP4c.insertArtSelectButton)(html, \"texture.src\", {\n search: tileConfig.object.getFlag(\"token-variants\", \"tileName\") || \"Tile\",\n searchType: (0, $eeGZt.SEARCH_TYPE).TILE\n });\n}\nfunction $4e701b3a6ed20c89$var$_modActiveEffectConfig(effectConfig, html) {\n const inserted = (0, $7OP4c.insertArtSelectButton)(html, \"icon\", {\n search: effectConfig.object.name || \"Active Effect\",\n searchType: (0, $9IngI.TVA_CONFIG).customImageCategories.includes(\"Active Effect\") ? \"Active Effect\" : (0, $eeGZt.SEARCH_TYPE).ITEM\n });\n if (!inserted) {\n const img = $(html).find(\".effect-icon\");\n img.on(\"contextmenu\", ()=>{\n (0, $coMHP.showArtSelect)(effectConfig.object?.name ?? \"Active Effect\", {\n searchType: (0, $eeGZt.SEARCH_TYPE).ITEM,\n callback: (imgSrc)=>img.attr(\"src\", imgSrc)\n });\n });\n }\n}\nfunction $4e701b3a6ed20c89$var$_modItemSheet(itemSheet, html, options) {\n $(html).find('img.profile, .profile-img, [data-edit=\"img\"]').on(\"contextmenu\", ()=>{\n const item = itemSheet.object;\n if (!item) return;\n (0, $coMHP.showArtSelect)(item.name, {\n searchType: (0, $eeGZt.SEARCH_TYPE).ITEM,\n callback: (imgSrc)=>item.update({\n img: imgSrc\n })\n });\n });\n}\nfunction $4e701b3a6ed20c89$var$_modMacroConfig(macroConfig, html, options) {\n const img = $(html).find(\".sheet-header > img\");\n img.on(\"contextmenu\", ()=>{\n (0, $coMHP.showArtSelect)(macroConfig.object?.name ?? \"Macro\", {\n searchType: (0, $eeGZt.SEARCH_TYPE).MACRO,\n callback: (imgSrc)=>img.attr(\"src\", imgSrc)\n });\n });\n}\nfunction $4e701b3a6ed20c89$var$_modJournalSheet(journalSheet, html, options) {\n $(html).find(\".header-button.entry-image\").on(\"contextmenu\", ()=>{\n const journal = journalSheet.object;\n if (!journal) return;\n (0, $coMHP.showArtSelect)(journal.name, {\n searchType: (0, $eeGZt.SEARCH_TYPE).JOURNAL,\n callback: (imgSrc)=>journal.update({\n img: imgSrc\n })\n });\n });\n}\nfunction $4e701b3a6ed20c89$var$_modRollTableSheet(sheet, html) {\n $(html).find(\".result-image\").on(\"contextmenu\", (event)=>{\n const table = sheet.object;\n if (!table) return;\n const img = $(event.target).closest(\".result-image\").find(\"img\");\n (0, $coMHP.showArtSelect)(table.name, {\n searchType: (0, $9IngI.TVA_CONFIG).customImageCategories.includes(\"RollTable\") ? \"RollTable\" : (0, $eeGZt.SEARCH_TYPE).ITEM,\n callback: (imgSrc)=>{\n img.attr(\"src\", imgSrc);\n sheet._onSubmit(event);\n }\n });\n });\n}\n/**\r\n * Adds right-click listener to Actor Sheet profile image to open up\r\n * the 'Art Select' screen.\r\n */ function $4e701b3a6ed20c89$var$_modActorSheet(actorSheet, html, options) {\n if (options.editable && (0, $9IngI.TVA_CONFIG).permissions.portrait_right_click[game.user.role]) {\n let profile = null;\n let profileQueries = {\n all: [\n \".profile\",\n \".profile-img\",\n \".profile-image\"\n ],\n pf2e: [\n \".player-image\",\n \".actor-icon\",\n \".sheet-header img\",\n \".actor-image\"\n ]\n };\n for (let query of profileQueries.all){\n profile = html[0].querySelector(query);\n if (profile) break;\n }\n if (!profile && game.system.id in profileQueries) for (let query of profileQueries[game.system.id]){\n profile = html[0].querySelector(query);\n if (profile) break;\n }\n if (!profile) {\n console.warn(\"TVA |\", game.i18n.localize(\"token-variants.notifications.warn.profile-image-not-found\"));\n return;\n }\n profile.addEventListener(\"contextmenu\", function(ev) {\n (0, $coMHP.showArtSelect)(actorSheet.object.name, {\n callback: (imgSrc, name)=>(0, $eeGZt.updateActorImage)(actorSheet.object, imgSrc),\n searchType: (0, $eeGZt.SEARCH_TYPE).PORTRAIT,\n object: actorSheet.object\n });\n }, false);\n }\n}\n\n});\n\nparcelRequire.register(\"1MaGd\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerHUDHooks\", () => $14b28eedf6a68dc7$export$c5e0f603443ce4af);\n\nvar $io0n7 = parcelRequire(\"io0n7\");\n\nvar $6aWyX = parcelRequire(\"6aWyX\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\nconst $14b28eedf6a68dc7$var$feature_id = \"HUD\";\nfunction $14b28eedf6a68dc7$export$c5e0f603443ce4af() {\n if ((0, $9IngI.FEATURE_CONTROL)[$14b28eedf6a68dc7$var$feature_id] && (0, $9IngI.TVA_CONFIG).tilesEnabled) (0, $e9LRe.registerHook)($14b28eedf6a68dc7$var$feature_id, \"renderTileHUD\", (0, $io0n7.renderTileHUD));\n else (0, $e9LRe.unregisterHook)($14b28eedf6a68dc7$var$feature_id, \"renderTileHUD\");\n if ((0, $9IngI.FEATURE_CONTROL)[$14b28eedf6a68dc7$var$feature_id] && ((0, $9IngI.TVA_CONFIG).permissions.hudFullAccess[game.user.role] || (0, $9IngI.TVA_CONFIG).permissions.hud[game.user.role])) (0, $e9LRe.registerHook)($14b28eedf6a68dc7$var$feature_id, \"renderTokenHUD\", (0, $6aWyX.renderTokenHUD));\n else (0, $e9LRe.unregisterHook)($14b28eedf6a68dc7$var$feature_id, \"renderTokenHUD\");\n}\n\n});\nparcelRequire.register(\"io0n7\", function(module, exports) {\n\n$parcel$export(module.exports, \"renderTileHUD\", () => $d62ac1bb767e4dbd$export$1ae1322ef97d28bb);\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $byeN2 = parcelRequire(\"byeN2\");\n\nvar $8MWlo = parcelRequire(\"8MWlo\");\n\nvar $aBy72 = parcelRequire(\"aBy72\");\nasync function $d62ac1bb767e4dbd$export$1ae1322ef97d28bb(hud, html, tileData, searchText = \"\", fp_files = null) {\n const tile = hud.object;\n const hudSettings = (0, $9IngI.TVA_CONFIG).hud;\n if (!hudSettings.enableSideMenu || !(0, $9IngI.TVA_CONFIG).tilesEnabled) return;\n const button = $(`\r\n <div class=\"control-icon\" data-action=\"token-variants-side-selector\">\r\n <img\r\n id=\"token-variants-side-button\"\r\n src=\"modules/token-variants/img/token-images.svg\"\r\n width=\"36\"\r\n height=\"36\"\r\n title=\"${game.i18n.localize(\"token-variants.windows.art-select.select-variant\")}\"\r\n />\r\n </div>\r\n`);\n html.find(\"div.right\").last().append(button);\n html.find(\"div.right\").click($d62ac1bb767e4dbd$var$_deactivateTokenVariantsSideSelector);\n button.click((event)=>$d62ac1bb767e4dbd$var$_onButtonClick(event, tile));\n button.contextmenu((event)=>$d62ac1bb767e4dbd$var$_onButtonRightClick(event, tile));\n}\nasync function $d62ac1bb767e4dbd$var$_onButtonClick(event, tile) {\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n $d62ac1bb767e4dbd$var$setNameDialog(tile);\n return;\n }\n const button = $(event.target).closest(\".control-icon\");\n // De-activate 'Status Effects'\n button.closest(\"div.right\").find(\"div.control-icon.effects\").removeClass(\"active\");\n button.closest(\"div.right\").find(\".status-effects\").removeClass(\"active\");\n // Remove contextmenu\n button.find(\".contextmenu\").remove();\n // Toggle variants side menu\n button.toggleClass(\"active\");\n let variantsWrap = button.find(\".token-variants-wrap\");\n if (button.hasClass(\"active\")) {\n if (!variantsWrap.length) {\n variantsWrap = await $d62ac1bb767e4dbd$var$renderSideSelect(tile);\n if (variantsWrap) button.find(\"img\").after(variantsWrap);\n else return;\n }\n variantsWrap.addClass(\"active\");\n } else variantsWrap.removeClass(\"active\");\n}\nfunction $d62ac1bb767e4dbd$var$_onButtonRightClick(event, tile) {\n // Display side menu if button is not active yet\n const button = $(event.target).closest(\".control-icon\");\n if (!button.hasClass(\"active\")) // button.trigger('click');\n button.addClass(\"active\");\n if (button.find(\".contextmenu\").length) {\n // Contextmenu already displayed. Remove and activate images\n button.find(\".contextmenu\").remove();\n button.removeClass(\"active\").trigger(\"click\");\n //button.find('.token-variants-wrap.images').addClass('active');\n } else {\n // Contextmenu is not displayed. Hide images, create it and add it\n button.find(\".token-variants-wrap.images\").removeClass(\"active\");\n const contextMenu = $(`\r\n <div class=\"token-variants-wrap contextmenu active\">\r\n <div class=\"token-variants-context-menu active\">\r\n <input class=\"token-variants-side-search\" type=\"text\" />\r\n <button class=\"flags\" type=\"button\"><i class=\"fab fa-font-awesome-flag\"></i><label>Flags</label></button>\r\n <button class=\"file-picker\" type=\"button\"><i class=\"fas fa-file-import fa-fw\"></i><label>Browse Folders</label></button>\r\n </div>\r\n </div>\r\n `);\n button.append(contextMenu);\n // Register contextmenu listeners\n contextMenu.find(\".token-variants-side-search\").on(\"keydown\", (event)=>$d62ac1bb767e4dbd$var$_onImageSearchKeyUp(event, tile)).on(\"click\", (event)=>{\n event.preventDefault();\n event.stopPropagation();\n });\n contextMenu.find(\".flags\").click((event)=>{\n event.preventDefault();\n event.stopPropagation();\n new (0, $byeN2.default)(tile).render(true);\n });\n contextMenu.find(\".file-picker\").click(async (event)=>{\n event.preventDefault();\n event.stopPropagation();\n new FilePicker({\n type: \"folder\",\n callback: async (path, fp)=>{\n const content = await FilePicker.browse(fp.activeSource, fp.result.target);\n let files = content.files.filter((f)=>(0, $eeGZt.isImage)(f) || (0, $eeGZt.isVideo)(f));\n if (files.length) {\n button.find(\".token-variants-wrap\").remove();\n const sideSelect = await $d62ac1bb767e4dbd$var$renderSideSelect(tile, null, files);\n if (sideSelect) {\n sideSelect.addClass(\"active\");\n button.append(sideSelect);\n }\n }\n }\n }).render(true);\n });\n }\n}\nfunction $d62ac1bb767e4dbd$var$_deactivateTokenVariantsSideSelector(event) {\n const controlIcon = $(event.target).closest(\".control-icon\");\n const dataAction = controlIcon.attr(\"data-action\");\n switch(dataAction){\n case \"effects\":\n break; // Effects button\n case \"thwildcard-selector\":\n break; // Token HUD Wildcard module button\n default:\n return;\n }\n $(event.target).closest(\"div.right\").find('.control-icon[data-action=\"token-variants-side-selector\"]').removeClass(\"active\");\n $(event.target).closest(\"div.right\").find(\".token-variants-wrap\").removeClass(\"active\");\n}\nasync function $d62ac1bb767e4dbd$var$renderSideSelect(tile, searchText = null, fp_files = null) {\n const hudSettings = (0, $9IngI.TVA_CONFIG).hud;\n const worldHudSettings = (0, $9IngI.TVA_CONFIG).worldHud;\n const FULL_ACCESS = (0, $9IngI.TVA_CONFIG).permissions.hudFullAccess[game.user.role];\n let images = [];\n let variants = [];\n let imageDuplicates = new Set();\n const pushImage = (img)=>{\n if (imageDuplicates.has(img.path)) {\n if (!images.find((obj)=>obj.path === img.path && obj.name === img.name)) images.push(img);\n } else {\n images.push(img);\n imageDuplicates.add(img.path);\n }\n };\n if (!fp_files) {\n if (searchText !== null && !searchText) return;\n if (!searchText) {\n variants = tile.document.getFlag(\"token-variants\", \"variants\") || [];\n variants.forEach((variant)=>{\n for (const name of variant.names)pushImage({\n path: variant.imgSrc,\n name: name\n });\n });\n // Parse directory flag and include the images\n const directoryFlag = tile.document.getFlag(\"token-variants\", \"directory\");\n if (directoryFlag) {\n let dirFlagImages;\n try {\n let path = directoryFlag.path;\n let source = directoryFlag.source;\n let bucket = \"\";\n if (source.startsWith(\"s3:\")) {\n bucket = source.substring(3, source.length);\n source = \"s3\";\n }\n const content = await FilePicker.browse(source, path, {\n type: \"imagevideo\",\n bucket: bucket\n });\n dirFlagImages = content.files;\n } catch (err) {\n dirFlagImages = [];\n }\n dirFlagImages.forEach((f)=>{\n if ((0, $eeGZt.isImage)(f) || (0, $eeGZt.isVideo)(f)) pushImage({\n path: f,\n name: (0, $eeGZt.getFileName)(f)\n });\n });\n }\n }\n // Perform the search if needed\n const search = searchText ?? tile.document.getFlag(\"token-variants\", \"tileName\");\n const noSearch = !search || !searchText && worldHudSettings.displayOnlySharedImages;\n let artSearch = noSearch ? null : await (0, $8MWlo.doImageSearch)(search, {\n searchType: (0, $eeGZt.SEARCH_TYPE).TILE,\n searchOptions: {\n keywordSearch: worldHudSettings.includeKeywords\n }\n });\n if (artSearch) artSearch.forEach((results)=>{\n images.push(...results);\n });\n } else images = fp_files.map((f)=>{\n return {\n path: f,\n name: (0, $eeGZt.getFileName)(f)\n };\n });\n // Retrieving the possibly custom name attached as a flag to the token\n let tileImageName = tile.document.getFlag(\"token-variants\", \"name\");\n if (!tileImageName) tileImageName = (0, $eeGZt.getFileName)(tile.document.texture.src);\n let imagesParsed = [];\n for (const imageObj of images){\n const img = (0, $eeGZt.isImage)(imageObj.path);\n const vid = (0, $eeGZt.isVideo)(imageObj.path);\n let shared = false;\n if (game.user.isGM) variants.forEach((variant)=>{\n if (variant.imgSrc === imageObj.path && variant.names.includes(imageObj.name)) shared = true;\n });\n const userMappings = tile.document.getFlag(\"token-variants\", \"userMappings\") || {};\n const [title, style] = $d62ac1bb767e4dbd$var$genTitleAndStyle(userMappings, imageObj.path, imageObj.name);\n imagesParsed.push({\n route: imageObj.path,\n name: imageObj.name,\n used: imageObj.path === tile.document.texture.src && imageObj.name === tileImageName,\n img: img,\n vid: vid,\n unknownType: !img && !vid,\n shared: shared,\n hasConfig: false,\n title: title,\n style: game.user.isGM && style ? \"box-shadow: \" + style + \";\" : null\n });\n }\n //\n // Render\n //\n const imageDisplay = hudSettings.displayAsImage;\n const imageOpacity = hudSettings.imageOpacity / 100;\n const sideSelect = $(await renderTemplate(\"modules/token-variants/templates/sideSelect.html\", {\n imagesParsed: imagesParsed,\n imageDisplay: imageDisplay,\n imageOpacity: imageOpacity,\n autoplay: !(0, $9IngI.TVA_CONFIG).playVideoOnHover\n }));\n // Activate listeners\n sideSelect.find(\"video\").hover(function() {\n if ((0, $9IngI.TVA_CONFIG).playVideoOnHover) {\n this.play();\n $(this).siblings(\".fa-play\").hide();\n }\n }, function() {\n if ((0, $9IngI.TVA_CONFIG).pauseVideoOnHoverOut) {\n this.pause();\n this.currentTime = 0;\n $(this).siblings(\".fa-play\").show();\n }\n });\n sideSelect.find(\".token-variants-button-select\").click((event)=>$d62ac1bb767e4dbd$var$_onImageClick(event, tile));\n if (FULL_ACCESS) sideSelect.find(\".token-variants-button-select\").on(\"contextmenu\", (event)=>$d62ac1bb767e4dbd$var$_onImageRightClick(event, tile));\n return sideSelect;\n}\nasync function $d62ac1bb767e4dbd$var$_onImageClick(event, tile) {\n event.preventDefault();\n event.stopPropagation();\n if (!tile) return;\n const imgButton = $(event.target).closest(\".token-variants-button-select\");\n const imgSrc = imgButton.attr(\"data-name\");\n const name = imgButton.attr(\"data-filename\");\n if (imgSrc) {\n canvas.tiles.hud.clear();\n await tile.document.update({\n img: imgSrc\n });\n try {\n if ((0, $eeGZt.getFileName)(imgSrc) !== name) await tile.document.setFlag(\"token-variants\", \"name\", name);\n } catch (e) {}\n }\n}\nasync function $d62ac1bb767e4dbd$var$_onImageRightClick(event, tile) {\n event.preventDefault();\n event.stopPropagation();\n if (!tile) return;\n const imgButton = $(event.target).closest(\".token-variants-button-select\");\n const imgSrc = imgButton.attr(\"data-name\");\n const name = imgButton.attr(\"data-filename\");\n if (!imgSrc || !name) return;\n if ((0, $eeGZt.keyPressed)(\"config\") && game.user.isGM) {\n const regenStyle = (tile, img)=>{\n const mappings = tile.document.getFlag(\"token-variants\", \"userMappings\") || {};\n const name = imgButton.attr(\"data-filename\");\n const [title, style] = $d62ac1bb767e4dbd$var$genTitleAndStyle(mappings, img, name);\n imgButton.closest(\".token-variants-wrap\").find(`.token-variants-button-select[data-name='${img}']`).css(\"box-shadow\", style).prop(\"title\", title);\n };\n new (0, $aBy72.default)(tile, imgSrc, regenStyle).render(true);\n return;\n }\n let variants = tile.document.getFlag(\"token-variants\", \"variants\") || [];\n // Remove selected variant if present in the flag, add otherwise\n let del = false;\n let updated = false;\n for (let variant of variants)if (variant.imgSrc === imgSrc) {\n let fNames = variant.names.filter((name)=>name !== name);\n if (fNames.length === 0) del = true;\n else if (fNames.length === variant.names.length) fNames.push(name);\n variant.names = fNames;\n updated = true;\n break;\n }\n if (del) variants = variants.filter((variant)=>variant.imgSrc !== imgSrc);\n else if (!updated) variants.push({\n imgSrc: imgSrc,\n names: [\n name\n ]\n });\n // Set shared variants as a flag\n tile.document.unsetFlag(\"token-variants\", \"variants\");\n if (variants.length > 0) tile.document.setFlag(\"token-variants\", \"variants\", variants);\n imgButton.find(\".fa-share\").toggleClass(\"active\"); // Display green arrow\n}\nasync function $d62ac1bb767e4dbd$var$_onImageSearchKeyUp(event, tile) {\n if (event.key === \"Enter\" || event.keyCode === 13) {\n event.preventDefault();\n if (event.target.value.length >= 3) {\n const button = $(event.target).closest(\".control-icon\");\n button.find(\".token-variants-wrap\").remove();\n const sideSelect = await $d62ac1bb767e4dbd$var$renderSideSelect(tile, event.target.value);\n if (sideSelect) {\n sideSelect.addClass(\"active\");\n button.append(sideSelect);\n }\n }\n return false;\n }\n}\nfunction $d62ac1bb767e4dbd$var$genTitleAndStyle(mappings, imgSrc, name) {\n let title = (0, $9IngI.TVA_CONFIG).worldHud.showFullPath ? imgSrc : name;\n let style = \"\";\n let offset = 2;\n for (const [userId, img] of Object.entries(mappings))if (img === imgSrc) {\n const user = game.users.get(userId);\n if (!user) continue;\n if (style.length === 0) style = `inset 0 0 0 ${offset}px ${user.color}`;\n else style += `, inset 0 0 0 ${offset}px ${user.color}`;\n offset += 2;\n title += `\\nDisplayed to: ${user.name}`;\n }\n return [\n title,\n style\n ];\n}\nfunction $d62ac1bb767e4dbd$var$setNameDialog(tile) {\n const tileName = tile.document.getFlag(\"token-variants\", \"tileName\") || tile.id;\n new Dialog({\n title: `Assign a name to the Tile (3+ chars)`,\n content: `<table style=\"width:100%\"><tr><th style=\"width:50%\"><label>Tile Name</label></th><td style=\"width:50%\"><input type=\"text\" name=\"input\" value=\"${tileName}\"/></td></tr></table>`,\n buttons: {\n Ok: {\n label: `Save`,\n callback: (html)=>{\n const name = html.find(\"input\").val();\n if (name) {\n canvas.tiles.hud.clear();\n tile.document.setFlag(\"token-variants\", \"tileName\", name);\n }\n }\n }\n }\n }).render(true);\n}\n\n});\nparcelRequire.register(\"byeN2\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $868e57a95aec1c35$export$2e2bcd8739ae039);\nclass $868e57a95aec1c35$export$2e2bcd8739ae039 extends FormApplication {\n constructor(obj){\n super({}, {});\n if (obj instanceof Tile) {\n this.objectToFlag = obj.document;\n this.isTile = true;\n } else this.objectToFlag = game.actors.get(obj.document.actorId) || obj.document;\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-token-flags\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/flagsConfig.html\",\n resizable: true,\n minimizable: false,\n title: \"Flags\",\n width: 500\n });\n }\n async getData(options) {\n const data = super.getData(options);\n const popups = this.objectToFlag.getFlag(\"token-variants\", \"popups\");\n const disableNameSearch = this.objectToFlag.getFlag(\"token-variants\", \"disableNameSearch\");\n const directory = this.objectToFlag.getFlag(\"token-variants\", \"directory\") || {};\n return mergeObject(data, {\n popups: popups,\n popupsSetFlag: popups != null,\n disableNameSearch: disableNameSearch,\n disableNameSearchSetFlag: disableNameSearch != null,\n directory: directory.path,\n directorySource: directory.source,\n directorySetFlag: !isEmpty(directory),\n tile: this.isTile\n });\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.find(\".controlFlag\").click((e)=>{\n $(e.target).siblings(\".flag\").prop(\"disabled\", !e.target.checked);\n });\n html.find(\".directory-fp\").click((event)=>{\n new FilePicker({\n type: \"folder\",\n activeSource: \"data\",\n callback: (path, fp)=>{\n html.find('[name=\"directory\"]').val(fp.result.target);\n $(event.target).closest(\"button\").attr(\"title\", \"Directory: \" + fp.result.target);\n const sourceEl = html.find('[name=\"directorySource\"]');\n if (fp.activeSource === \"s3\") sourceEl.val(`s3:${fp.result.bucket}`);\n else sourceEl.val(fp.activeSource);\n }\n }).render(true);\n });\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n if (\"directory\" in formData) formData.directory = {\n path: formData.directory,\n source: formData.directorySource\n };\n [\n \"popups\",\n \"disableNameSearch\",\n \"directory\"\n ].forEach((flag)=>{\n if (flag in formData) this.objectToFlag.setFlag(\"token-variants\", flag, formData[flag]);\n else this.objectToFlag.unsetFlag(\"token-variants\", flag);\n });\n }\n}\n\n});\n\nparcelRequire.register(\"8MWlo\", function(module, exports) {\n\n$parcel$export(module.exports, \"isCaching\", () => $66601058d336fefc$export$ee0468762b49c68b);\n$parcel$export(module.exports, \"doImageSearch\", () => $66601058d336fefc$export$4f3cb237ec0aee8a);\n$parcel$export(module.exports, \"doRandomSearch\", () => $66601058d336fefc$export$54814896b5b3f706);\n$parcel$export(module.exports, \"doSyncSearch\", () => $66601058d336fefc$export$829ee1305b7ab4f9);\n$parcel$export(module.exports, \"findImagesFuzzy\", () => $66601058d336fefc$export$78c2454638ec157e);\n$parcel$export(module.exports, \"saveCache\", () => $66601058d336fefc$export$7a1d85371c4f69);\n$parcel$export(module.exports, \"cacheImages\", () => $66601058d336fefc$export$10bf6393bd6f131d);\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $RzsBm = parcelRequire(\"RzsBm\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n// True if in the middle of caching image paths\nlet $66601058d336fefc$var$caching = false;\nfunction $66601058d336fefc$export$ee0468762b49c68b() {\n return $66601058d336fefc$var$caching;\n}\n// Cached images\nlet $66601058d336fefc$var$CACHED_IMAGES = {};\nasync function $66601058d336fefc$export$4f3cb237ec0aee8a(search, { searchType: searchType = SEARCH_TYPE.PORTRAIT_AND_TOKEN, simpleResults: simpleResults = false, callback: callback = null, searchOptions: searchOptions = {} } = {}) {\n if ($66601058d336fefc$var$caching) return;\n searchOptions = mergeObject(searchOptions, (0, $9IngI.getSearchOptions)(), {\n overwrite: false\n });\n search = search.trim();\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | STARTING: Art Search\", search, searchType, searchOptions);\n let searches = [\n search\n ];\n let allImages = new Map();\n const keywords = (0, $eeGZt.parseKeywords)(searchOptions.excludedKeywords);\n if (searchOptions.keywordSearch) searches = searches.concat(search.split(/[_\\- :,\\|\\(\\)\\[\\]]/).filter((word)=>word.length > 2 && !keywords.includes(word.toLowerCase())).reverse());\n let usedImages = new Set();\n for (const search of searches){\n if (allImages.get(search) !== undefined) continue;\n let results = await $66601058d336fefc$var$findImages(search, searchType, searchOptions);\n results = results.filter((pathObj)=>!usedImages.has(pathObj));\n allImages.set(search, results);\n results.forEach(usedImages.add, usedImages);\n }\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | ENDING: Art Search\");\n if (simpleResults) allImages = Array.from(usedImages).map((obj)=>obj.path);\n if (callback) callback(allImages);\n return allImages;\n}\nasync function $66601058d336fefc$export$54814896b5b3f706(search, { searchType: searchType = SEARCH_TYPE.PORTRAIT_AND_TOKEN, actor: actor = null, callback: callback = null, randomizerOptions: randomizerOptions = {}, searchOptions: searchOptions = {} } = {}) {\n if ($66601058d336fefc$var$caching) return null;\n const results = (0, $eeGZt.flattenSearchResults)(await $66601058d336fefc$var$_randSearchUtil(search, {\n searchType: searchType,\n actor: actor,\n randomizerOptions: randomizerOptions,\n searchOptions: searchOptions\n }));\n if (results.length === 0) return null;\n // Pick random image\n let randImageNum = Math.floor(Math.random() * results.length);\n if (callback) callback([\n results[randImageNum].path,\n results[randImageNum].name\n ]);\n return [\n results[randImageNum].path,\n results[randImageNum].name\n ];\n}\nasync function $66601058d336fefc$export$829ee1305b7ab4f9(search, target, { searchType: searchType = SEARCH_TYPE.TOKEN, actor: actor = null, randomizerOptions: randomizerOptions = {} } = {}) {\n if ($66601058d336fefc$var$caching) return null;\n const results = (0, $eeGZt.flattenSearchResults)(await $66601058d336fefc$var$_randSearchUtil(search, {\n searchType: searchType,\n actor: actor,\n randomizerOptions: randomizerOptions\n }));\n // Find the image with the most similar name\n const fuse = new (0, $RzsBm.Fuse)(results, {\n keys: [\n \"name\"\n ],\n minMatchCharLength: 1,\n ignoreLocation: true,\n threshold: 0.4\n });\n const fResults = fuse.search(target);\n if (fResults && fResults.length !== 0) return [\n fResults[0].item.path,\n fResults[0].item.name\n ];\n else return null;\n}\nasync function $66601058d336fefc$var$_randSearchUtil(search, { searchType: searchType = SEARCH_TYPE.PORTRAIT_AND_TOKEN, actor: actor = null, randomizerOptions: randomizerOptions = {}, searchOptions: searchOptions = {} } = {}) {\n const randSettings = mergeObject(randomizerOptions, (0, $9IngI.TVA_CONFIG).randomizer, {\n overwrite: false\n });\n if (!(randSettings.tokenName || randSettings.actorName || randSettings.keywords || randSettings.shared || randSettings.wildcard)) return null;\n // Randomizer settings take precedence\n searchOptions.keywordSearch = randSettings.keywords;\n // Swap search to the actor name if need be\n if (randSettings.actorName && actor) search = actor.name;\n // Gather all images\n let results = randSettings.actorName || randSettings.tokenName || randSettings.keywords ? await $66601058d336fefc$export$4f3cb237ec0aee8a(search, {\n searchType: searchType,\n searchOptions: searchOptions\n }) : new Map();\n if (!randSettings.tokenName && !randSettings.actorName) results.delete(search);\n if (randSettings.shared && actor) {\n let sharedVariants = actor.getFlag(\"token-variants\", \"variants\") || [];\n if (sharedVariants.length != 0) {\n const sv = [];\n sharedVariants.forEach((variant)=>{\n variant.names.forEach((name)=>{\n sv.push({\n path: variant.imgSrc,\n name: name\n });\n });\n });\n results.set(\"variants95436723\", sv);\n }\n }\n if (randSettings.wildcard && actor) {\n let protoImg = actor.prototypeToken.texture.src;\n if (protoImg.includes(\"*\") || protoImg.includes(\"{\") && protoImg.includes(\"}\")) {\n // Modified version of Actor.getTokenImages()\n const getTokenImages = async (actor)=>{\n if (actor._tokenImages) return actor._tokenImages;\n let source = \"data\";\n const browseOptions = {\n wildcard: true\n };\n // Support non-user sources\n if (/\\.s3\\./.test(protoImg)) {\n source = \"s3\";\n const { bucket: bucket, keyPrefix: keyPrefix } = FilePicker.parseS3URL(protoImg);\n if (bucket) {\n browseOptions.bucket = bucket;\n protoImg = keyPrefix;\n }\n } else if (protoImg.startsWith(\"icons/\")) source = \"public\";\n // Retrieve wildcard content\n try {\n const content = await FilePicker.browse(source, protoImg, browseOptions);\n return content.files;\n } catch (err) {\n return [];\n }\n };\n const wildcardImages = (await getTokenImages(actor)).filter((img)=>!img.includes(\"*\") && ((0, $eeGZt.isImage)(img) || (0, $eeGZt.isVideo)(img))).map((variant)=>{\n return {\n path: variant,\n name: (0, $eeGZt.getFileName)(variant)\n };\n });\n results.set(\"variants95436623\", wildcardImages);\n }\n }\n return results;\n}\n/**\r\n * Recursive image search through a directory\r\n * @param {*} path starting path\r\n * @param {*} options.apiKey ForgeVTT AssetLibrary API key\r\n * @param {*} found_images all the images found\r\n * @returns void\r\n */ async function $66601058d336fefc$var$walkFindImages(path, { apiKey: apiKey = \"\" } = {}, found_images) {\n let files = {};\n if (!path.source) path.source = \"data\";\n const typeKey = path.types.sort().join(\",\");\n try {\n if (path.source.startsWith(\"s3:\")) files = await FilePicker.browse(\"s3\", path.text, {\n bucket: path.source.replace(\"s3:\", \"\")\n });\n else if (path.source.startsWith(\"forgevtt\")) {\n if (apiKey) {\n const response = await (0, $eeGZt.callForgeVTT)(path.text, apiKey);\n files.files = response.files.map((f)=>f.url);\n } else files = await FilePicker.browse(\"forgevtt\", path.text, {\n recursive: true\n });\n } else if (path.source.startsWith(\"forge-bazaar\")) files = await FilePicker.browse(\"forge-bazaar\", path.text, {\n recursive: true\n });\n else if (path.source.startsWith(\"imgur\")) {\n await fetch(\"https://api.imgur.com/3/gallery/album/\" + path.text, {\n headers: {\n Authorization: \"Client-ID \" + ((0, $9IngI.TVA_CONFIG).imgurClientId ? (0, $9IngI.TVA_CONFIG).imgurClientId : \"df9d991443bb222\"),\n Accept: \"application/json\"\n }\n }).then((response)=>response.json()).then(async function(result) {\n if (!result.success) return;\n result.data.images.forEach((img)=>{\n const rtName = img.title ?? img.description ?? (0, $eeGZt.getFileName)(img.link);\n $66601058d336fefc$var$_addToFound({\n path: (0, $eeGZt.decodeURISafely)(img.link),\n name: rtName\n }, typeKey, found_images);\n });\n }).catch((error)=>console.warn(\"TVA |\", error));\n return;\n } else if (path.source.startsWith(\"rolltable\")) {\n const table = game.tables.contents.find((t)=>t.name === path.text);\n if (!table) {\n const rollTableName = path.text;\n ui.notifications.warn(game.i18n.format(\"token-variants.notifications.warn.invalid-table\", {\n rollTableName: rollTableName\n }));\n } else for (let baseTableData of table.results){\n const rtPath = baseTableData.img;\n const rtName = baseTableData.text || (0, $eeGZt.getFileName)(rtPath);\n $66601058d336fefc$var$_addToFound({\n path: (0, $eeGZt.decodeURISafely)(rtPath),\n name: rtName\n }, typeKey, found_images);\n }\n return;\n } else if (path.source.startsWith(\"json\")) {\n await fetch(path.text, {\n headers: {\n Accept: \"application/json\"\n }\n }).then((response)=>response.json()).then(async function(result) {\n if (!result.length > 0) return;\n result.forEach((img)=>{\n const rtName = img.name ?? (0, $eeGZt.getFileName)(img.path);\n $66601058d336fefc$var$_addToFound({\n path: (0, $eeGZt.decodeURISafely)(img.path),\n name: rtName,\n tags: img.tags\n }, typeKey, found_images);\n });\n }).catch((error)=>console.warn(\"TVA |\", error));\n return;\n } else files = await FilePicker.browse(path.source, path.text);\n } catch (err) {\n console.warn(`TVA | ${game.i18n.localize(\"token-variants.notifications.warn.path-not-found\")} ${path.source}:${path.text}`);\n return;\n }\n if (files.target == \".\") return;\n if (files.files) files.files.forEach((tokenSrc)=>{\n $66601058d336fefc$var$_addToFound({\n path: (0, $eeGZt.decodeURISafely)(tokenSrc),\n name: (0, $eeGZt.getFileName)(tokenSrc)\n }, typeKey, found_images);\n });\n // ForgeVTT requires special treatment\n // Bazaar paths fail recursive search if one level above root\n if (path.source.startsWith(\"forgevtt\")) return;\n else if (path.source.startsWith(\"forge-bazaar\") && ![\n \"modules\",\n \"systems\",\n \"worlds\",\n \"assets\"\n ].includes(path.text.replaceAll(/[\\/\\\\]/g, \"\"))) return;\n for (let f_dir of files.dirs)await $66601058d336fefc$var$walkFindImages({\n text: f_dir,\n source: path.source,\n types: path.types\n }, {\n apiKey: apiKey\n }, found_images);\n}\nfunction $66601058d336fefc$var$_addToFound(img, typeKey, found_images) {\n if ((0, $eeGZt.isImage)(img.path) || (0, $eeGZt.isVideo)(img.path)) {\n if (found_images[typeKey] == null) found_images[typeKey] = [\n img\n ];\n else found_images[typeKey].push(img);\n }\n}\n/**\r\n * Recursive walks through all paths exposed to the module and caches them\r\n * @param {*} searchType\r\n * @returns\r\n */ async function $66601058d336fefc$var$walkAllPaths(searchType) {\n const found_images = {};\n const paths = $66601058d336fefc$var$_filterPathsByType((0, $9IngI.TVA_CONFIG).searchPaths, searchType);\n for (const path of paths)if (path.cache && $66601058d336fefc$var$caching || !path.cache && !$66601058d336fefc$var$caching) await $66601058d336fefc$var$walkFindImages(path, {}, found_images);\n // ForgeVTT specific path handling\n const userId = typeof ForgeAPI !== \"undefined\" ? await ForgeAPI.getUserId() : \"\";\n for(const uid in (0, $9IngI.TVA_CONFIG).forgeSearchPaths){\n const apiKey = (0, $9IngI.TVA_CONFIG).forgeSearchPaths[uid].apiKey;\n const paths = $66601058d336fefc$var$_filterPathsByType((0, $9IngI.TVA_CONFIG).forgeSearchPaths[uid].paths, searchType);\n if (uid === userId) {\n for (const path of paths)if (path.cache && $66601058d336fefc$var$caching || !path.cache && !$66601058d336fefc$var$caching) await $66601058d336fefc$var$walkFindImages(path, {}, found_images);\n } else if (apiKey) for (const path of paths){\n if (path.cache && $66601058d336fefc$var$caching || !path.cache && !$66601058d336fefc$var$caching) {\n if (path.share) await $66601058d336fefc$var$walkFindImages(path, {\n apiKey: apiKey\n }, found_images);\n }\n }\n }\n return found_images;\n}\nfunction $66601058d336fefc$var$_filterPathsByType(paths, searchType) {\n if (!searchType) return paths;\n return paths.filter((p)=>p.types.includes(searchType));\n}\nasync function $66601058d336fefc$export$78c2454638ec157e(name, searchType, searchOptions, forceSearchName = false) {\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | STARTING: Fuzzy Image Search\", name, searchType, searchOptions, forceSearchName);\n const filters = (0, $eeGZt.getFilters)(searchType, searchOptions.searchFilters);\n const fuse = new (0, $RzsBm.Fuse)([], {\n keys: [\n !forceSearchName && searchOptions.runSearchOnPath ? \"path\" : \"name\",\n \"tags\"\n ],\n includeScore: true,\n includeMatches: true,\n minMatchCharLength: 1,\n ignoreLocation: true,\n threshold: searchOptions.algorithm.fuzzyThreshold\n });\n const found_images = await $66601058d336fefc$var$walkAllPaths(searchType);\n for (const container of [\n $66601058d336fefc$var$CACHED_IMAGES,\n found_images\n ])for(const typeKey in container){\n const types = typeKey.split(\",\");\n if (types.includes(searchType)) {\n for (const imgObj of container[typeKey])if ($66601058d336fefc$var$_imagePassesFilter(imgObj.name, imgObj.path, filters, searchOptions.runSearchOnPath)) fuse.add(imgObj);\n }\n }\n let results;\n if (name === \"\") results = fuse.getIndex().docs.slice(0, searchOptions.algorithm.fuzzyLimit);\n else {\n results = fuse.search(name).slice(0, searchOptions.algorithm.fuzzyLimit);\n results = results.map((r)=>{\n r.item.indices = r.matches[0].indices;\n r.item.score = r.score;\n return r.item;\n });\n }\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | ENDING: Fuzzy Image Search\", results);\n return results;\n}\nasync function $66601058d336fefc$var$findImagesExact(name, searchType, searchOptions) {\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | STARTING: Exact Image Search\", name, searchType, searchOptions);\n const found_images = await $66601058d336fefc$var$walkAllPaths(searchType);\n const simpleName = (0, $eeGZt.simplifyName)(name);\n const filters = (0, $eeGZt.getFilters)(searchType, searchOptions.searchFilters);\n const matchedImages = [];\n for (const container of [\n $66601058d336fefc$var$CACHED_IMAGES,\n found_images\n ])for(const typeKey in container){\n const types = typeKey.split(\",\");\n if (types.includes(searchType)) {\n for (const imgOBj of container[typeKey])if ($66601058d336fefc$var$_exactSearchMatchesImage(simpleName, imgOBj.path, imgOBj.name, filters, searchOptions.runSearchOnPath)) matchedImages.push(imgOBj);\n }\n }\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | ENDING: Exact Image Search\", matchedImages);\n return matchedImages;\n}\nasync function $66601058d336fefc$var$findImages(name, searchType = \"\", searchOptions = {}) {\n const sOptions = mergeObject(searchOptions, (0, $9IngI.getSearchOptions)(), {\n overwrite: false\n });\n if (sOptions.algorithm.exact) return await $66601058d336fefc$var$findImagesExact(name, searchType, sOptions);\n else return await $66601058d336fefc$export$78c2454638ec157e(name, searchType, sOptions);\n}\n/**\r\n * Checks if image path and name match the provided search text and filters\r\n * @param imagePath image path\r\n * @param imageName image name\r\n * @param filters filters to be applied\r\n * @returns true|false\r\n */ function $66601058d336fefc$var$_exactSearchMatchesImage(simplifiedSearch, imagePath, imageName, filters, runSearchOnPath) {\n // Is the search text contained in the name/path\n const simplified = runSearchOnPath ? (0, $eeGZt.simplifyPath)(imagePath) : (0, $eeGZt.simplifyName)(imageName);\n if (!simplified.includes(simplifiedSearch)) return false;\n if (!filters) return true;\n return $66601058d336fefc$var$_imagePassesFilter(imageName, imagePath, filters, runSearchOnPath);\n}\nfunction $66601058d336fefc$var$_imagePassesFilter(imageName, imagePath, filters, runSearchOnPath) {\n // Filters are applied to path depending on the 'runSearchOnPath' setting, and actual or custom rolltable name\n let text;\n if (runSearchOnPath) text = (0, $eeGZt.decodeURIComponentSafely)(imagePath);\n else if ((0, $eeGZt.getFileName)(imagePath) === imageName) text = (0, $eeGZt.getFileNameWithExt)(imagePath);\n else text = imageName;\n if (filters.regex) return filters.regex.test(text);\n if (filters.include) {\n if (!text.includes(filters.include)) return false;\n }\n if (filters.exclude) {\n if (text.includes(filters.exclude)) return false;\n }\n return true;\n}\nasync function $66601058d336fefc$export$7a1d85371c4f69(cacheFile) {\n const data = {};\n const caches = Object.keys($66601058d336fefc$var$CACHED_IMAGES);\n for (const c of caches){\n if (!(c in data)) data[c] = [];\n for (const img of $66601058d336fefc$var$CACHED_IMAGES[c]){\n if (img.tags) data[c].push([\n img.path,\n img.name,\n img.tags\n ]);\n else if ((0, $eeGZt.getFileName)(img.path) === img.name) data[c].push(img.path);\n else data[c].push([\n img.path,\n img.name\n ]);\n }\n }\n let file = new File([\n JSON.stringify(data)\n ], (0, $eeGZt.getFileNameWithExt)(cacheFile), {\n type: \"text/plain\"\n });\n FilePicker.upload(\"data\", (0, $eeGZt.getFilePath)(cacheFile), file);\n}\nasync function $66601058d336fefc$export$10bf6393bd6f131d({ staticCache: staticCache = (0, $9IngI.TVA_CONFIG).staticCache, staticCacheFile: staticCacheFile = (0, $9IngI.TVA_CONFIG).staticCacheFile } = {}) {\n if ($66601058d336fefc$var$caching) return;\n $66601058d336fefc$var$caching = true;\n if (!(0, $coMHP.isInitialized)() && staticCache) {\n if (await $66601058d336fefc$var$_readCacheFromFile(staticCacheFile)) {\n $66601058d336fefc$var$caching = false;\n return;\n }\n }\n if (!(0, $9IngI.TVA_CONFIG).disableNotifs) ui.notifications.info(game.i18n.format(\"token-variants.notifications.info.caching-started\"));\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | STARTING: Token Caching\");\n const found_images = await $66601058d336fefc$var$walkAllPaths();\n $66601058d336fefc$var$CACHED_IMAGES = found_images;\n if ((0, $9IngI.TVA_CONFIG).debug) console.info(\"TVA | ENDING: Token Caching\");\n $66601058d336fefc$var$caching = false;\n if (!(0, $9IngI.TVA_CONFIG).disableNotifs) ui.notifications.info(game.i18n.format(\"token-variants.notifications.info.caching-finished\", {\n imageCount: Object.keys($66601058d336fefc$var$CACHED_IMAGES).reduce((count, types)=>count + $66601058d336fefc$var$CACHED_IMAGES[types].length, 0)\n }));\n if (staticCache && game.user.isGM) $66601058d336fefc$export$7a1d85371c4f69(staticCacheFile);\n}\nasync function $66601058d336fefc$var$_readCacheFromFile(fileName) {\n $66601058d336fefc$var$CACHED_IMAGES = {};\n try {\n await jQuery.getJSON(fileName, (json)=>{\n for(let category in json){\n $66601058d336fefc$var$CACHED_IMAGES[category] = [];\n for (const img of json[category])if (Array.isArray(img)) {\n if (img.length === 3) $66601058d336fefc$var$CACHED_IMAGES[category].push({\n path: img[0],\n name: img[1],\n tags: img[2]\n });\n else $66601058d336fefc$var$CACHED_IMAGES[category].push({\n path: img[0],\n name: img[1]\n });\n } else $66601058d336fefc$var$CACHED_IMAGES[category].push({\n path: img,\n name: (0, $eeGZt.getFileName)(img)\n });\n }\n if (!(0, $9IngI.TVA_CONFIG).disableNotifs) ui.notifications.info(`Token Variant Art: Using Static Cache (${Object.keys($66601058d336fefc$var$CACHED_IMAGES).reduce((count, c)=>count + $66601058d336fefc$var$CACHED_IMAGES[c].length, 0)} images)`);\n });\n } catch (error) {\n ui.notifications.warn(`Token Variant Art: Static Cache not found`);\n $66601058d336fefc$var$CACHED_IMAGES = {};\n return false;\n }\n return true;\n}\n\n});\nparcelRequire.register(\"RzsBm\", function(module, exports) {\n\n$parcel$export(module.exports, \"Fuse\", () => $0a1075082161df65$export$93605f466b8506d8);\n/**\r\n * Fuse.js v6.5.3 - Lightweight fuzzy-search (http://fusejs.io)\r\n *\r\n * Copyright (c) 2021 Kiro Risk (http://kiro.me)\r\n * All Rights Reserved. Apache Software License 2.0\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n */ function $0a1075082161df65$var$ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function(sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n}\nfunction $0a1075082161df65$var$_objectSpread2(target) {\n for(var i = 1; i < arguments.length; i++){\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? $0a1075082161df65$var$ownKeys(Object(source), !0).forEach(function(key) {\n $0a1075082161df65$var$_defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : $0a1075082161df65$var$ownKeys(Object(source)).forEach(function(key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n}\nfunction $0a1075082161df65$var$_typeof(obj) {\n \"@babel/helpers - typeof\";\n return $0a1075082161df65$var$_typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function(obj) {\n return typeof obj;\n } : function(obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, $0a1075082161df65$var$_typeof(obj);\n}\nfunction $0a1075082161df65$var$_classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) throw new TypeError(\"Cannot call a class as a function\");\n}\nfunction $0a1075082161df65$var$_defineProperties(target, props) {\n for(var i = 0; i < props.length; i++){\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\nfunction $0a1075082161df65$var$_createClass(Constructor, protoProps, staticProps) {\n if (protoProps) $0a1075082161df65$var$_defineProperties(Constructor.prototype, protoProps);\n if (staticProps) $0a1075082161df65$var$_defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\nfunction $0a1075082161df65$var$_defineProperty(obj, key, value) {\n if (key in obj) Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n else obj[key] = value;\n return obj;\n}\nfunction $0a1075082161df65$var$_inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) throw new TypeError(\"Super expression must either be null or a function\");\n Object.defineProperty(subClass, \"prototype\", {\n value: Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n }),\n writable: false\n });\n if (superClass) $0a1075082161df65$var$_setPrototypeOf(subClass, superClass);\n}\nfunction $0a1075082161df65$var$_getPrototypeOf(o) {\n $0a1075082161df65$var$_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return $0a1075082161df65$var$_getPrototypeOf(o);\n}\nfunction $0a1075082161df65$var$_setPrototypeOf(o, p) {\n $0a1075082161df65$var$_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return $0a1075082161df65$var$_setPrototypeOf(o, p);\n}\nfunction $0a1075082161df65$var$_isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));\n return true;\n } catch (e) {\n return false;\n }\n}\nfunction $0a1075082161df65$var$_assertThisInitialized(self) {\n if (self === void 0) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n return self;\n}\nfunction $0a1075082161df65$var$_possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) return call;\n else if (call !== void 0) throw new TypeError(\"Derived constructors may only return object or undefined\");\n return $0a1075082161df65$var$_assertThisInitialized(self);\n}\nfunction $0a1075082161df65$var$_createSuper(Derived) {\n var hasNativeReflectConstruct = $0a1075082161df65$var$_isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = $0a1075082161df65$var$_getPrototypeOf(Derived), result;\n if (hasNativeReflectConstruct) {\n var NewTarget = $0a1075082161df65$var$_getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else result = Super.apply(this, arguments);\n return $0a1075082161df65$var$_possibleConstructorReturn(this, result);\n };\n}\nfunction $0a1075082161df65$var$_toConsumableArray(arr) {\n return $0a1075082161df65$var$_arrayWithoutHoles(arr) || $0a1075082161df65$var$_iterableToArray(arr) || $0a1075082161df65$var$_unsupportedIterableToArray(arr) || $0a1075082161df65$var$_nonIterableSpread();\n}\nfunction $0a1075082161df65$var$_arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return $0a1075082161df65$var$_arrayLikeToArray(arr);\n}\nfunction $0a1075082161df65$var$_iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\nfunction $0a1075082161df65$var$_unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return $0a1075082161df65$var$_arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $0a1075082161df65$var$_arrayLikeToArray(o, minLen);\n}\nfunction $0a1075082161df65$var$_arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];\n return arr2;\n}\nfunction $0a1075082161df65$var$_nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction $0a1075082161df65$var$isArray(value) {\n return !Array.isArray ? $0a1075082161df65$var$getTag(value) === \"[object Array]\" : Array.isArray(value);\n} // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js\nvar $0a1075082161df65$var$INFINITY = 1 / 0;\nfunction $0a1075082161df65$var$baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == \"string\") return value;\n var result = value + \"\";\n return result == \"0\" && 1 / value == -$0a1075082161df65$var$INFINITY ? \"-0\" : result;\n}\nfunction $0a1075082161df65$var$toString(value) {\n return value == null ? \"\" : $0a1075082161df65$var$baseToString(value);\n}\nfunction $0a1075082161df65$var$isString(value) {\n return typeof value === \"string\";\n}\nfunction $0a1075082161df65$var$isNumber(value) {\n return typeof value === \"number\";\n} // Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js\nfunction $0a1075082161df65$var$isBoolean(value) {\n return value === true || value === false || $0a1075082161df65$var$isObjectLike(value) && $0a1075082161df65$var$getTag(value) == \"[object Boolean]\";\n}\nfunction $0a1075082161df65$var$isObject(value) {\n return $0a1075082161df65$var$_typeof(value) === \"object\";\n} // Checks if `value` is object-like.\nfunction $0a1075082161df65$var$isObjectLike(value) {\n return $0a1075082161df65$var$isObject(value) && value !== null;\n}\nfunction $0a1075082161df65$var$isDefined(value) {\n return value !== undefined && value !== null;\n}\nfunction $0a1075082161df65$var$isBlank(value) {\n return !value.trim().length;\n} // Gets the `toStringTag` of `value`.\n// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js\nfunction $0a1075082161df65$var$getTag(value) {\n return value == null ? value === undefined ? \"[object Undefined]\" : \"[object Null]\" : Object.prototype.toString.call(value);\n}\nvar $0a1075082161df65$var$EXTENDED_SEARCH_UNAVAILABLE = \"Extended search is not available\";\nvar $0a1075082161df65$var$INCORRECT_INDEX_TYPE = \"Incorrect 'index' type\";\nvar $0a1075082161df65$var$LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = function LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key) {\n return \"Invalid value for key \".concat(key);\n};\nvar $0a1075082161df65$var$PATTERN_LENGTH_TOO_LARGE = function PATTERN_LENGTH_TOO_LARGE(max) {\n return \"Pattern length exceeds max of \".concat(max, \".\");\n};\nvar $0a1075082161df65$var$MISSING_KEY_PROPERTY = function MISSING_KEY_PROPERTY(name) {\n return \"Missing \".concat(name, \" property in key\");\n};\nvar $0a1075082161df65$var$INVALID_KEY_WEIGHT_VALUE = function INVALID_KEY_WEIGHT_VALUE(key) {\n return \"Property 'weight' in key '\".concat(key, \"' must be a positive integer\");\n};\nvar $0a1075082161df65$var$hasOwn = Object.prototype.hasOwnProperty;\nvar $0a1075082161df65$var$KeyStore = /*#__PURE__*/ function() {\n function KeyStore(keys) {\n var _this = this;\n $0a1075082161df65$var$_classCallCheck(this, KeyStore);\n this._keys = [];\n this._keyMap = {};\n var totalWeight = 0;\n keys.forEach(function(key) {\n var obj = $0a1075082161df65$var$createKey(key);\n totalWeight += obj.weight;\n _this._keys.push(obj);\n _this._keyMap[obj.id] = obj;\n totalWeight += obj.weight;\n }); // Normalize weights so that their sum is equal to 1\n this._keys.forEach(function(key) {\n key.weight /= totalWeight;\n });\n }\n $0a1075082161df65$var$_createClass(KeyStore, [\n {\n key: \"get\",\n value: function get(keyId) {\n return this._keyMap[keyId];\n }\n },\n {\n key: \"keys\",\n value: function keys() {\n return this._keys;\n }\n },\n {\n key: \"toJSON\",\n value: function toJSON() {\n return JSON.stringify(this._keys);\n }\n }\n ]);\n return KeyStore;\n}();\nfunction $0a1075082161df65$var$createKey(key) {\n var path = null;\n var id = null;\n var src = null;\n var weight = 1;\n if ($0a1075082161df65$var$isString(key) || $0a1075082161df65$var$isArray(key)) {\n src = key;\n path = $0a1075082161df65$var$createKeyPath(key);\n id = $0a1075082161df65$var$createKeyId(key);\n } else {\n if (!$0a1075082161df65$var$hasOwn.call(key, \"name\")) throw new Error($0a1075082161df65$var$MISSING_KEY_PROPERTY(\"name\"));\n var name = key.name;\n src = name;\n if ($0a1075082161df65$var$hasOwn.call(key, \"weight\")) {\n weight = key.weight;\n if (weight <= 0) throw new Error($0a1075082161df65$var$INVALID_KEY_WEIGHT_VALUE(name));\n }\n path = $0a1075082161df65$var$createKeyPath(name);\n id = $0a1075082161df65$var$createKeyId(name);\n }\n return {\n path: path,\n id: id,\n weight: weight,\n src: src\n };\n}\nfunction $0a1075082161df65$var$createKeyPath(key) {\n return $0a1075082161df65$var$isArray(key) ? key : key.split(\".\");\n}\nfunction $0a1075082161df65$var$createKeyId(key) {\n return $0a1075082161df65$var$isArray(key) ? key.join(\".\") : key;\n}\nfunction $0a1075082161df65$var$get(obj, path) {\n var list = [];\n var arr = false;\n var deepGet = function deepGet(obj, path, index) {\n if (!$0a1075082161df65$var$isDefined(obj)) return;\n if (!path[index]) // If there's no path left, we've arrived at the object we care about.\n list.push(obj);\n else {\n var key = path[index];\n var value = obj[key];\n if (!$0a1075082161df65$var$isDefined(value)) return;\n // If we're at the last value in the path, and if it's a string/number/bool,\n // add it to the list\n if (index === path.length - 1 && ($0a1075082161df65$var$isString(value) || $0a1075082161df65$var$isNumber(value) || $0a1075082161df65$var$isBoolean(value))) list.push($0a1075082161df65$var$toString(value));\n else if ($0a1075082161df65$var$isArray(value)) {\n arr = true; // Search each item in the array.\n for(var i = 0, len = value.length; i < len; i += 1)deepGet(value[i], path, index + 1);\n } else if (path.length) // An object. Recurse further.\n deepGet(value, path, index + 1);\n }\n }; // Backwards compatibility (since path used to be a string)\n deepGet(obj, $0a1075082161df65$var$isString(path) ? path.split(\".\") : path, 0);\n return arr ? list : list[0];\n}\nvar $0a1075082161df65$var$MatchOptions = {\n // Whether the matches should be included in the result set. When `true`, each record in the result\n // set will include the indices of the matched characters.\n // These can consequently be used for highlighting purposes.\n includeMatches: false,\n // When `true`, the matching function will continue to the end of a search pattern even if\n // a perfect match has already been located in the string.\n findAllMatches: false,\n // Minimum number of characters that must be matched before a result is considered a match\n minMatchCharLength: 1\n};\nvar $0a1075082161df65$var$BasicOptions = {\n // When `true`, the algorithm continues searching to the end of the input even if a perfect\n // match is found before the end of the same input.\n isCaseSensitive: false,\n // When true, the matching function will continue to the end of a search pattern even if\n includeScore: false,\n // List of properties that will be searched. This also supports nested properties.\n keys: [],\n // Whether to sort the result list, by score\n shouldSort: true,\n // Default sort function: sort by ascending score, ascending index\n sortFn: function sortFn(a, b) {\n return a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1;\n }\n};\nvar $0a1075082161df65$var$FuzzyOptions = {\n // Approximately where in the text is the pattern expected to be found?\n location: 0,\n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match\n // (of both letters and location), a threshold of '1.0' would match anything.\n threshold: 0.6,\n // Determines how close the match must be to the fuzzy location (specified above).\n // An exact letter match which is 'distance' characters away from the fuzzy location\n // would score as a complete mismatch. A distance of '0' requires the match be at\n // the exact location specified, a threshold of '1000' would require a perfect match\n // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\n distance: 100\n};\nvar $0a1075082161df65$var$AdvancedOptions = {\n // When `true`, it enables the use of unix-like search commands\n useExtendedSearch: false,\n // The get function to use when fetching an object's properties.\n // The default will search nested paths *ie foo.bar.baz*\n getFn: $0a1075082161df65$var$get,\n // When `true`, search will ignore `location` and `distance`, so it won't matter\n // where in the string the pattern appears.\n // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score\n ignoreLocation: false,\n // When `true`, the calculation for the relevance score (used for sorting) will\n // ignore the field-length norm.\n // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm\n ignoreFieldNorm: false,\n // The weight to determine how much field length norm effects scoring.\n fieldNormWeight: 1\n};\nvar $0a1075082161df65$var$Config = $0a1075082161df65$var$_objectSpread2($0a1075082161df65$var$_objectSpread2($0a1075082161df65$var$_objectSpread2($0a1075082161df65$var$_objectSpread2({}, $0a1075082161df65$var$BasicOptions), $0a1075082161df65$var$MatchOptions), $0a1075082161df65$var$FuzzyOptions), $0a1075082161df65$var$AdvancedOptions);\nvar $0a1075082161df65$var$SPACE = /[^ ]+/g; // Field-length norm: the shorter the field, the higher the weight.\n// Set to 3 decimals to reduce index size.\nfunction $0a1075082161df65$var$norm() {\n var weight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var mantissa = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;\n var cache = new Map();\n var m = Math.pow(10, mantissa);\n return {\n get: function get(value) {\n var numTokens = value.match($0a1075082161df65$var$SPACE).length;\n if (cache.has(numTokens)) return cache.get(numTokens);\n // Default function is 1/sqrt(x), weight makes that variable\n var norm = 1 / Math.pow(numTokens, 0.5 * weight); // In place of `toFixed(mantissa)`, for faster computation\n var n = parseFloat(Math.round(norm * m) / m);\n cache.set(numTokens, n);\n return n;\n },\n clear: function clear() {\n cache.clear();\n }\n };\n}\nvar $0a1075082161df65$var$FuseIndex = /*#__PURE__*/ function() {\n function FuseIndex() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$getFn = _ref.getFn, getFn = _ref$getFn === void 0 ? $0a1075082161df65$var$Config.getFn : _ref$getFn, _ref$fieldNormWeight = _ref.fieldNormWeight, fieldNormWeight = _ref$fieldNormWeight === void 0 ? $0a1075082161df65$var$Config.fieldNormWeight : _ref$fieldNormWeight;\n $0a1075082161df65$var$_classCallCheck(this, FuseIndex);\n this.norm = $0a1075082161df65$var$norm(fieldNormWeight, 3);\n this.getFn = getFn;\n this.isCreated = false;\n this.setIndexRecords();\n }\n $0a1075082161df65$var$_createClass(FuseIndex, [\n {\n key: \"setSources\",\n value: function setSources() {\n var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n this.docs = docs;\n }\n },\n {\n key: \"setIndexRecords\",\n value: function setIndexRecords() {\n var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n this.records = records;\n }\n },\n {\n key: \"setKeys\",\n value: function setKeys() {\n var _this = this;\n var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n this.keys = keys;\n this._keysMap = {};\n keys.forEach(function(key, idx) {\n _this._keysMap[key.id] = idx;\n });\n }\n },\n {\n key: \"create\",\n value: function create() {\n var _this2 = this;\n if (this.isCreated || !this.docs.length) return;\n this.isCreated = true; // List is Array<String>\n if ($0a1075082161df65$var$isString(this.docs[0])) this.docs.forEach(function(doc, docIndex) {\n _this2._addString(doc, docIndex);\n });\n else // List is Array<Object>\n this.docs.forEach(function(doc, docIndex) {\n _this2._addObject(doc, docIndex);\n });\n this.norm.clear();\n }\n },\n {\n key: \"add\",\n value: function add(doc) {\n var idx = this.size();\n if ($0a1075082161df65$var$isString(doc)) this._addString(doc, idx);\n else this._addObject(doc, idx);\n }\n },\n {\n key: \"removeAt\",\n value: function removeAt(idx) {\n this.records.splice(idx, 1); // Change ref index of every subsquent doc\n for(var i = idx, len = this.size(); i < len; i += 1)this.records[i].i -= 1;\n }\n },\n {\n key: \"getValueForItemAtKeyId\",\n value: function getValueForItemAtKeyId(item, keyId) {\n return item[this._keysMap[keyId]];\n }\n },\n {\n key: \"size\",\n value: function size() {\n return this.records.length;\n }\n },\n {\n key: \"_addString\",\n value: function _addString(doc, docIndex) {\n if (!$0a1075082161df65$var$isDefined(doc) || $0a1075082161df65$var$isBlank(doc)) return;\n var record = {\n v: doc,\n i: docIndex,\n n: this.norm.get(doc)\n };\n this.records.push(record);\n }\n },\n {\n key: \"_addObject\",\n value: function _addObject(doc, docIndex) {\n var _this3 = this;\n var record = {\n i: docIndex,\n $: {}\n }; // Iterate over every key (i.e, path), and fetch the value at that key\n this.keys.forEach(function(key, keyIndex) {\n var value = _this3.getFn(doc, key.path);\n if (!$0a1075082161df65$var$isDefined(value)) return;\n if ($0a1075082161df65$var$isArray(value)) (function() {\n var subRecords = [];\n var stack = [\n {\n nestedArrIndex: -1,\n value: value\n }\n ];\n while(stack.length){\n var _stack$pop = stack.pop(), nestedArrIndex = _stack$pop.nestedArrIndex, _value = _stack$pop.value;\n if (!$0a1075082161df65$var$isDefined(_value)) continue;\n if ($0a1075082161df65$var$isString(_value) && !$0a1075082161df65$var$isBlank(_value)) {\n var subRecord = {\n v: _value,\n i: nestedArrIndex,\n n: _this3.norm.get(_value)\n };\n subRecords.push(subRecord);\n } else if ($0a1075082161df65$var$isArray(_value)) _value.forEach(function(item, k) {\n stack.push({\n nestedArrIndex: k,\n value: item\n });\n });\n }\n record.$[keyIndex] = subRecords;\n })();\n else if (!$0a1075082161df65$var$isBlank(value)) {\n var subRecord = {\n v: value,\n n: _this3.norm.get(value)\n };\n record.$[keyIndex] = subRecord;\n }\n });\n this.records.push(record);\n }\n },\n {\n key: \"toJSON\",\n value: function toJSON() {\n return {\n keys: this.keys,\n records: this.records\n };\n }\n }\n ]);\n return FuseIndex;\n}();\nfunction $0a1075082161df65$var$createIndex(keys, docs) {\n var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref2$getFn = _ref2.getFn, getFn = _ref2$getFn === void 0 ? $0a1075082161df65$var$Config.getFn : _ref2$getFn, _ref2$fieldNormWeight = _ref2.fieldNormWeight, fieldNormWeight = _ref2$fieldNormWeight === void 0 ? $0a1075082161df65$var$Config.fieldNormWeight : _ref2$fieldNormWeight;\n var myIndex = new $0a1075082161df65$var$FuseIndex({\n getFn: getFn,\n fieldNormWeight: fieldNormWeight\n });\n myIndex.setKeys(keys.map($0a1075082161df65$var$createKey));\n myIndex.setSources(docs);\n myIndex.create();\n return myIndex;\n}\nfunction $0a1075082161df65$var$parseIndex(data) {\n var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref3$getFn = _ref3.getFn, getFn = _ref3$getFn === void 0 ? $0a1075082161df65$var$Config.getFn : _ref3$getFn, _ref3$fieldNormWeight = _ref3.fieldNormWeight, fieldNormWeight = _ref3$fieldNormWeight === void 0 ? $0a1075082161df65$var$Config.fieldNormWeight : _ref3$fieldNormWeight;\n var keys = data.keys, records = data.records;\n var myIndex = new $0a1075082161df65$var$FuseIndex({\n getFn: getFn,\n fieldNormWeight: fieldNormWeight\n });\n myIndex.setKeys(keys);\n myIndex.setIndexRecords(records);\n return myIndex;\n}\nfunction $0a1075082161df65$var$computeScore$1(pattern) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$errors = _ref.errors, errors = _ref$errors === void 0 ? 0 : _ref$errors, _ref$currentLocation = _ref.currentLocation, currentLocation = _ref$currentLocation === void 0 ? 0 : _ref$currentLocation, _ref$expectedLocation = _ref.expectedLocation, expectedLocation = _ref$expectedLocation === void 0 ? 0 : _ref$expectedLocation, _ref$distance = _ref.distance, distance = _ref$distance === void 0 ? $0a1075082161df65$var$Config.distance : _ref$distance, _ref$ignoreLocation = _ref.ignoreLocation, ignoreLocation = _ref$ignoreLocation === void 0 ? $0a1075082161df65$var$Config.ignoreLocation : _ref$ignoreLocation;\n var accuracy = errors / pattern.length;\n if (ignoreLocation) return accuracy;\n var proximity = Math.abs(expectedLocation - currentLocation);\n if (!distance) // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy;\n return accuracy + proximity / distance;\n}\nfunction $0a1075082161df65$var$convertMaskToIndices() {\n var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var minMatchCharLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : $0a1075082161df65$var$Config.minMatchCharLength;\n var indices = [];\n var start = -1;\n var end = -1;\n var i = 0;\n for(var len = matchmask.length; i < len; i += 1){\n var match = matchmask[i];\n if (match && start === -1) start = i;\n else if (!match && start !== -1) {\n end = i - 1;\n if (end - start + 1 >= minMatchCharLength) indices.push([\n start,\n end\n ]);\n start = -1;\n }\n } // (i-1 - start) + 1 => i - start\n if (matchmask[i - 1] && i - start >= minMatchCharLength) indices.push([\n start,\n i - 1\n ]);\n return indices;\n}\n// Machine word size\nvar $0a1075082161df65$var$MAX_BITS = 32;\nfunction $0a1075082161df65$var$search(text, pattern, patternAlphabet) {\n var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, _ref$location = _ref.location, location = _ref$location === void 0 ? $0a1075082161df65$var$Config.location : _ref$location, _ref$distance = _ref.distance, distance = _ref$distance === void 0 ? $0a1075082161df65$var$Config.distance : _ref$distance, _ref$threshold = _ref.threshold, threshold = _ref$threshold === void 0 ? $0a1075082161df65$var$Config.threshold : _ref$threshold, _ref$findAllMatches = _ref.findAllMatches, findAllMatches = _ref$findAllMatches === void 0 ? $0a1075082161df65$var$Config.findAllMatches : _ref$findAllMatches, _ref$minMatchCharLeng = _ref.minMatchCharLength, minMatchCharLength = _ref$minMatchCharLeng === void 0 ? $0a1075082161df65$var$Config.minMatchCharLength : _ref$minMatchCharLeng, _ref$includeMatches = _ref.includeMatches, includeMatches = _ref$includeMatches === void 0 ? $0a1075082161df65$var$Config.includeMatches : _ref$includeMatches, _ref$ignoreLocation = _ref.ignoreLocation, ignoreLocation = _ref$ignoreLocation === void 0 ? $0a1075082161df65$var$Config.ignoreLocation : _ref$ignoreLocation;\n if (pattern.length > $0a1075082161df65$var$MAX_BITS) throw new Error($0a1075082161df65$var$PATTERN_LENGTH_TOO_LARGE($0a1075082161df65$var$MAX_BITS));\n var patternLen = pattern.length; // Set starting location at beginning text and initialize the alphabet.\n var textLen = text.length; // Handle the case when location > text.length\n var expectedLocation = Math.max(0, Math.min(location, textLen)); // Highest score beyond which we give up.\n var currentThreshold = threshold; // Is there a nearby exact match? (speedup)\n var bestLocation = expectedLocation; // Performance: only computer matches when the minMatchCharLength > 1\n // OR if `includeMatches` is true.\n var computeMatches = minMatchCharLength > 1 || includeMatches; // A mask of the matches, used for building the indices\n var matchMask = computeMatches ? Array(textLen) : [];\n var index; // Get all exact matches, here for speed up\n while((index = text.indexOf(pattern, bestLocation)) > -1){\n var score = $0a1075082161df65$var$computeScore$1(pattern, {\n currentLocation: index,\n expectedLocation: expectedLocation,\n distance: distance,\n ignoreLocation: ignoreLocation\n });\n currentThreshold = Math.min(score, currentThreshold);\n bestLocation = index + patternLen;\n if (computeMatches) {\n var i = 0;\n while(i < patternLen){\n matchMask[index + i] = 1;\n i += 1;\n }\n }\n } // Reset the best location\n bestLocation = -1;\n var lastBitArr = [];\n var finalScore = 1;\n var binMax = patternLen + textLen;\n var mask = 1 << patternLen - 1;\n for(var _i = 0; _i < patternLen; _i += 1){\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from the match location we can stray\n // at this error level.\n var binMin = 0;\n var binMid = binMax;\n while(binMin < binMid){\n var _score2 = $0a1075082161df65$var$computeScore$1(pattern, {\n errors: _i,\n currentLocation: expectedLocation + binMid,\n expectedLocation: expectedLocation,\n distance: distance,\n ignoreLocation: ignoreLocation\n });\n if (_score2 <= currentThreshold) binMin = binMid;\n else binMax = binMid;\n binMid = Math.floor((binMax - binMin) / 2 + binMin);\n } // Use the result from this iteration as the maximum for the next.\n binMax = binMid;\n var start = Math.max(1, expectedLocation - binMid + 1);\n var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; // Initialize the bit array\n var bitArr = Array(finish + 2);\n bitArr[finish + 1] = (1 << _i) - 1;\n for(var j = finish; j >= start; j -= 1){\n var currentLocation = j - 1;\n var charMatch = patternAlphabet[text.charAt(currentLocation)];\n if (computeMatches) // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`)\n matchMask[currentLocation] = +!!charMatch;\n // First pass: exact match\n bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch; // Subsequent passes: fuzzy match\n if (_i) bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];\n if (bitArr[j] & mask) {\n finalScore = $0a1075082161df65$var$computeScore$1(pattern, {\n errors: _i,\n currentLocation: currentLocation,\n expectedLocation: expectedLocation,\n distance: distance,\n ignoreLocation: ignoreLocation\n }); // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (finalScore <= currentThreshold) {\n // Indeed it is\n currentThreshold = finalScore;\n bestLocation = currentLocation; // Already passed `loc`, downhill from here on in.\n if (bestLocation <= expectedLocation) break;\n // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.\n start = Math.max(1, 2 * expectedLocation - bestLocation);\n }\n }\n } // No hope for a (better) match at greater error levels.\n var _score = $0a1075082161df65$var$computeScore$1(pattern, {\n errors: _i + 1,\n currentLocation: expectedLocation,\n expectedLocation: expectedLocation,\n distance: distance,\n ignoreLocation: ignoreLocation\n });\n if (_score > currentThreshold) break;\n lastBitArr = bitArr;\n }\n var result = {\n isMatch: bestLocation >= 0,\n // Count exact matches (those with a score of 0) to be \"almost\" exact\n score: Math.max(0.001, finalScore)\n };\n if (computeMatches) {\n var indices = $0a1075082161df65$var$convertMaskToIndices(matchMask, minMatchCharLength);\n if (!indices.length) result.isMatch = false;\n else if (includeMatches) result.indices = indices;\n }\n return result;\n}\nfunction $0a1075082161df65$var$createPatternAlphabet(pattern) {\n var mask = {};\n for(var i = 0, len = pattern.length; i < len; i += 1){\n var _char = pattern.charAt(i);\n mask[_char] = (mask[_char] || 0) | 1 << len - i - 1;\n }\n return mask;\n}\nvar $0a1075082161df65$var$BitapSearch = /*#__PURE__*/ function() {\n function BitapSearch(pattern) {\n var _this = this;\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$location = _ref.location, location = _ref$location === void 0 ? $0a1075082161df65$var$Config.location : _ref$location, _ref$threshold = _ref.threshold, threshold = _ref$threshold === void 0 ? $0a1075082161df65$var$Config.threshold : _ref$threshold, _ref$distance = _ref.distance, distance = _ref$distance === void 0 ? $0a1075082161df65$var$Config.distance : _ref$distance, _ref$includeMatches = _ref.includeMatches, includeMatches = _ref$includeMatches === void 0 ? $0a1075082161df65$var$Config.includeMatches : _ref$includeMatches, _ref$findAllMatches = _ref.findAllMatches, findAllMatches = _ref$findAllMatches === void 0 ? $0a1075082161df65$var$Config.findAllMatches : _ref$findAllMatches, _ref$minMatchCharLeng = _ref.minMatchCharLength, minMatchCharLength = _ref$minMatchCharLeng === void 0 ? $0a1075082161df65$var$Config.minMatchCharLength : _ref$minMatchCharLeng, _ref$isCaseSensitive = _ref.isCaseSensitive, isCaseSensitive = _ref$isCaseSensitive === void 0 ? $0a1075082161df65$var$Config.isCaseSensitive : _ref$isCaseSensitive, _ref$ignoreLocation = _ref.ignoreLocation, ignoreLocation = _ref$ignoreLocation === void 0 ? $0a1075082161df65$var$Config.ignoreLocation : _ref$ignoreLocation;\n $0a1075082161df65$var$_classCallCheck(this, BitapSearch);\n this.options = {\n location: location,\n threshold: threshold,\n distance: distance,\n includeMatches: includeMatches,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength,\n isCaseSensitive: isCaseSensitive,\n ignoreLocation: ignoreLocation\n };\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n this.chunks = [];\n if (!this.pattern.length) return;\n var addChunk = function addChunk(pattern, startIndex) {\n _this.chunks.push({\n pattern: pattern,\n alphabet: $0a1075082161df65$var$createPatternAlphabet(pattern),\n startIndex: startIndex\n });\n };\n var len = this.pattern.length;\n if (len > $0a1075082161df65$var$MAX_BITS) {\n var i = 0;\n var remainder = len % $0a1075082161df65$var$MAX_BITS;\n var end = len - remainder;\n while(i < end){\n addChunk(this.pattern.substr(i, $0a1075082161df65$var$MAX_BITS), i);\n i += $0a1075082161df65$var$MAX_BITS;\n }\n if (remainder) {\n var startIndex = len - $0a1075082161df65$var$MAX_BITS;\n addChunk(this.pattern.substr(startIndex), startIndex);\n }\n } else addChunk(this.pattern, 0);\n }\n $0a1075082161df65$var$_createClass(BitapSearch, [\n {\n key: \"searchIn\",\n value: function searchIn(text) {\n var _this$options = this.options, isCaseSensitive = _this$options.isCaseSensitive, includeMatches = _this$options.includeMatches;\n if (!isCaseSensitive) text = text.toLowerCase();\n // Exact match\n if (this.pattern === text) {\n var _result = {\n isMatch: true,\n score: 0\n };\n if (includeMatches) _result.indices = [\n [\n 0,\n text.length - 1\n ]\n ];\n return _result;\n } // Otherwise, use Bitap algorithm\n var _this$options2 = this.options, location = _this$options2.location, distance = _this$options2.distance, threshold = _this$options2.threshold, findAllMatches = _this$options2.findAllMatches, minMatchCharLength = _this$options2.minMatchCharLength, ignoreLocation = _this$options2.ignoreLocation;\n var allIndices = [];\n var totalScore = 0;\n var hasMatches = false;\n this.chunks.forEach(function(_ref2) {\n var pattern = _ref2.pattern, alphabet = _ref2.alphabet, startIndex = _ref2.startIndex;\n var _search = $0a1075082161df65$var$search(text, pattern, alphabet, {\n location: location + startIndex,\n distance: distance,\n threshold: threshold,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength,\n includeMatches: includeMatches,\n ignoreLocation: ignoreLocation\n }), isMatch = _search.isMatch, score = _search.score, indices = _search.indices;\n if (isMatch) hasMatches = true;\n totalScore += score;\n if (isMatch && indices) allIndices = [].concat($0a1075082161df65$var$_toConsumableArray(allIndices), $0a1075082161df65$var$_toConsumableArray(indices));\n });\n var result = {\n isMatch: hasMatches,\n score: hasMatches ? totalScore / this.chunks.length : 1\n };\n if (hasMatches && includeMatches) result.indices = allIndices;\n return result;\n }\n }\n ]);\n return BitapSearch;\n}();\nvar $0a1075082161df65$var$BaseMatch = /*#__PURE__*/ function() {\n function BaseMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, BaseMatch);\n this.pattern = pattern;\n }\n $0a1075082161df65$var$_createClass(BaseMatch, [\n {\n key: \"search\",\n value: function /*text*/ search() {}\n }\n ], [\n {\n key: \"isMultiMatch\",\n value: function isMultiMatch(pattern) {\n return $0a1075082161df65$var$getMatch(pattern, this.multiRegex);\n }\n },\n {\n key: \"isSingleMatch\",\n value: function isSingleMatch(pattern) {\n return $0a1075082161df65$var$getMatch(pattern, this.singleRegex);\n }\n }\n ]);\n return BaseMatch;\n}();\nfunction $0a1075082161df65$var$getMatch(pattern, exp) {\n var matches = pattern.match(exp);\n return matches ? matches[1] : null;\n}\nvar $0a1075082161df65$var$ExactMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(ExactMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(ExactMatch);\n function ExactMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, ExactMatch);\n return _super.call(this, pattern);\n }\n $0a1075082161df65$var$_createClass(ExactMatch, [\n {\n key: \"search\",\n value: function search(text) {\n var isMatch = text === this.pattern;\n return {\n isMatch: isMatch,\n score: isMatch ? 0 : 1,\n indices: [\n 0,\n this.pattern.length - 1\n ]\n };\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"exact\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^=\"(.*)\"$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^=(.*)$/;\n }\n }\n ]);\n return ExactMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$InverseExactMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(InverseExactMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(InverseExactMatch);\n function InverseExactMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, InverseExactMatch);\n return _super.call(this, pattern);\n }\n $0a1075082161df65$var$_createClass(InverseExactMatch, [\n {\n key: \"search\",\n value: function search(text) {\n var index = text.indexOf(this.pattern);\n var isMatch = index === -1;\n return {\n isMatch: isMatch,\n score: isMatch ? 0 : 1,\n indices: [\n 0,\n text.length - 1\n ]\n };\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"inverse-exact\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^!\"(.*)\"$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^!(.*)$/;\n }\n }\n ]);\n return InverseExactMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$PrefixExactMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(PrefixExactMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(PrefixExactMatch);\n function PrefixExactMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, PrefixExactMatch);\n return _super.call(this, pattern);\n }\n $0a1075082161df65$var$_createClass(PrefixExactMatch, [\n {\n key: \"search\",\n value: function search(text) {\n var isMatch = text.startsWith(this.pattern);\n return {\n isMatch: isMatch,\n score: isMatch ? 0 : 1,\n indices: [\n 0,\n this.pattern.length - 1\n ]\n };\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"prefix-exact\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^\\^\"(.*)\"$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^\\^(.*)$/;\n }\n }\n ]);\n return PrefixExactMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$InversePrefixExactMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(InversePrefixExactMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(InversePrefixExactMatch);\n function InversePrefixExactMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, InversePrefixExactMatch);\n return _super.call(this, pattern);\n }\n $0a1075082161df65$var$_createClass(InversePrefixExactMatch, [\n {\n key: \"search\",\n value: function search(text) {\n var isMatch = !text.startsWith(this.pattern);\n return {\n isMatch: isMatch,\n score: isMatch ? 0 : 1,\n indices: [\n 0,\n text.length - 1\n ]\n };\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"inverse-prefix-exact\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^!\\^\"(.*)\"$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^!\\^(.*)$/;\n }\n }\n ]);\n return InversePrefixExactMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$SuffixExactMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(SuffixExactMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(SuffixExactMatch);\n function SuffixExactMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, SuffixExactMatch);\n return _super.call(this, pattern);\n }\n $0a1075082161df65$var$_createClass(SuffixExactMatch, [\n {\n key: \"search\",\n value: function search(text) {\n var isMatch = text.endsWith(this.pattern);\n return {\n isMatch: isMatch,\n score: isMatch ? 0 : 1,\n indices: [\n text.length - this.pattern.length,\n text.length - 1\n ]\n };\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"suffix-exact\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^\"(.*)\"\\$$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^(.*)\\$$/;\n }\n }\n ]);\n return SuffixExactMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$InverseSuffixExactMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(InverseSuffixExactMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(InverseSuffixExactMatch);\n function InverseSuffixExactMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, InverseSuffixExactMatch);\n return _super.call(this, pattern);\n }\n $0a1075082161df65$var$_createClass(InverseSuffixExactMatch, [\n {\n key: \"search\",\n value: function search(text) {\n var isMatch = !text.endsWith(this.pattern);\n return {\n isMatch: isMatch,\n score: isMatch ? 0 : 1,\n indices: [\n 0,\n text.length - 1\n ]\n };\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"inverse-suffix-exact\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^!\"(.*)\"\\$$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^!(.*)\\$$/;\n }\n }\n ]);\n return InverseSuffixExactMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$FuzzyMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(FuzzyMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(FuzzyMatch);\n function FuzzyMatch(pattern) {\n var _this;\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$location = _ref.location, location = _ref$location === void 0 ? $0a1075082161df65$var$Config.location : _ref$location, _ref$threshold = _ref.threshold, threshold = _ref$threshold === void 0 ? $0a1075082161df65$var$Config.threshold : _ref$threshold, _ref$distance = _ref.distance, distance = _ref$distance === void 0 ? $0a1075082161df65$var$Config.distance : _ref$distance, _ref$includeMatches = _ref.includeMatches, includeMatches = _ref$includeMatches === void 0 ? $0a1075082161df65$var$Config.includeMatches : _ref$includeMatches, _ref$findAllMatches = _ref.findAllMatches, findAllMatches = _ref$findAllMatches === void 0 ? $0a1075082161df65$var$Config.findAllMatches : _ref$findAllMatches, _ref$minMatchCharLeng = _ref.minMatchCharLength, minMatchCharLength = _ref$minMatchCharLeng === void 0 ? $0a1075082161df65$var$Config.minMatchCharLength : _ref$minMatchCharLeng, _ref$isCaseSensitive = _ref.isCaseSensitive, isCaseSensitive = _ref$isCaseSensitive === void 0 ? $0a1075082161df65$var$Config.isCaseSensitive : _ref$isCaseSensitive, _ref$ignoreLocation = _ref.ignoreLocation, ignoreLocation = _ref$ignoreLocation === void 0 ? $0a1075082161df65$var$Config.ignoreLocation : _ref$ignoreLocation;\n $0a1075082161df65$var$_classCallCheck(this, FuzzyMatch);\n _this = _super.call(this, pattern);\n _this._bitapSearch = new $0a1075082161df65$var$BitapSearch(pattern, {\n location: location,\n threshold: threshold,\n distance: distance,\n includeMatches: includeMatches,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength,\n isCaseSensitive: isCaseSensitive,\n ignoreLocation: ignoreLocation\n });\n return _this;\n }\n $0a1075082161df65$var$_createClass(FuzzyMatch, [\n {\n key: \"search\",\n value: function search(text) {\n return this._bitapSearch.searchIn(text);\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"fuzzy\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^\"(.*)\"$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^(.*)$/;\n }\n }\n ]);\n return FuzzyMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$IncludeMatch = /*#__PURE__*/ function(_BaseMatch) {\n $0a1075082161df65$var$_inherits(IncludeMatch, _BaseMatch);\n var _super = $0a1075082161df65$var$_createSuper(IncludeMatch);\n function IncludeMatch(pattern) {\n $0a1075082161df65$var$_classCallCheck(this, IncludeMatch);\n return _super.call(this, pattern);\n }\n $0a1075082161df65$var$_createClass(IncludeMatch, [\n {\n key: \"search\",\n value: function search(text) {\n var location = 0;\n var index;\n var indices = [];\n var patternLen = this.pattern.length; // Get all exact matches\n while((index = text.indexOf(this.pattern, location)) > -1){\n location = index + patternLen;\n indices.push([\n index,\n location - 1\n ]);\n }\n var isMatch = !!indices.length;\n return {\n isMatch: isMatch,\n score: isMatch ? 0 : 1,\n indices: indices\n };\n }\n }\n ], [\n {\n key: \"type\",\n get: function get() {\n return \"include\";\n }\n },\n {\n key: \"multiRegex\",\n get: function get() {\n return /^'\"(.*)\"$/;\n }\n },\n {\n key: \"singleRegex\",\n get: function get() {\n return /^'(.*)$/;\n }\n }\n ]);\n return IncludeMatch;\n}($0a1075082161df65$var$BaseMatch);\nvar $0a1075082161df65$var$searchers = [\n $0a1075082161df65$var$ExactMatch,\n $0a1075082161df65$var$IncludeMatch,\n $0a1075082161df65$var$PrefixExactMatch,\n $0a1075082161df65$var$InversePrefixExactMatch,\n $0a1075082161df65$var$InverseSuffixExactMatch,\n $0a1075082161df65$var$SuffixExactMatch,\n $0a1075082161df65$var$InverseExactMatch,\n $0a1075082161df65$var$FuzzyMatch\n];\nvar $0a1075082161df65$var$searchersLen = $0a1075082161df65$var$searchers.length; // Regex to split by spaces, but keep anything in quotes together\nvar $0a1075082161df65$var$SPACE_RE = / +(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)/;\nvar $0a1075082161df65$var$OR_TOKEN = \"|\"; // Return a 2D array representation of the query, for simpler parsing.\n// Example:\n// \"^core go$ | rb$ | py$ xy$\" => [[\"^core\", \"go$\"], [\"rb$\"], [\"py$\", \"xy$\"]]\nfunction $0a1075082161df65$var$parseQuery(pattern) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return pattern.split($0a1075082161df65$var$OR_TOKEN).map(function(item) {\n var query = item.trim().split($0a1075082161df65$var$SPACE_RE).filter(function(item) {\n return item && !!item.trim();\n });\n var results = [];\n for(var i = 0, len = query.length; i < len; i += 1){\n var queryItem = query[i]; // 1. Handle multiple query match (i.e, once that are quoted, like `\"hello world\"`)\n var found = false;\n var idx = -1;\n while(!found && ++idx < $0a1075082161df65$var$searchersLen){\n var searcher = $0a1075082161df65$var$searchers[idx];\n var token = searcher.isMultiMatch(queryItem);\n if (token) {\n results.push(new searcher(token, options));\n found = true;\n }\n }\n if (found) continue;\n // 2. Handle single query matches (i.e, once that are *not* quoted)\n idx = -1;\n while(++idx < $0a1075082161df65$var$searchersLen){\n var _searcher = $0a1075082161df65$var$searchers[idx];\n var _token = _searcher.isSingleMatch(queryItem);\n if (_token) {\n results.push(new _searcher(_token, options));\n break;\n }\n }\n }\n return results;\n });\n}\n// to a singl match\nvar $0a1075082161df65$var$MultiMatchSet = new Set([\n $0a1075082161df65$var$FuzzyMatch.type,\n $0a1075082161df65$var$IncludeMatch.type\n]);\n/**\r\n * Command-like searching\r\n * ======================\r\n *\r\n * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`,\r\n * search in a given text.\r\n *\r\n * Search syntax:\r\n *\r\n * | Token | Match type | Description |\r\n * | ----------- | -------------------------- | -------------------------------------- |\r\n * | `jscript` | fuzzy-match | Items that fuzzy match `jscript` |\r\n * | `=scheme` | exact-match | Items that are `scheme` |\r\n * | `'python` | include-match | Items that include `python` |\r\n * | `!ruby` | inverse-exact-match | Items that do not include `ruby` |\r\n * | `^java` | prefix-exact-match | Items that start with `java` |\r\n * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` |\r\n * | `.js$` | suffix-exact-match | Items that end with `.js` |\r\n * | `!.go$` | inverse-suffix-exact-match | Items that do not end with `.go` |\r\n *\r\n * A single pipe character acts as an OR operator. For example, the following\r\n * query matches entries that start with `core` and end with either`go`, `rb`,\r\n * or`py`.\r\n *\r\n * ```\r\n * ^core go$ | rb$ | py$\r\n * ```\r\n */ var $0a1075082161df65$var$ExtendedSearch = /*#__PURE__*/ function() {\n function ExtendedSearch(pattern) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$isCaseSensitive = _ref.isCaseSensitive, isCaseSensitive = _ref$isCaseSensitive === void 0 ? $0a1075082161df65$var$Config.isCaseSensitive : _ref$isCaseSensitive, _ref$includeMatches = _ref.includeMatches, includeMatches = _ref$includeMatches === void 0 ? $0a1075082161df65$var$Config.includeMatches : _ref$includeMatches, _ref$minMatchCharLeng = _ref.minMatchCharLength, minMatchCharLength = _ref$minMatchCharLeng === void 0 ? $0a1075082161df65$var$Config.minMatchCharLength : _ref$minMatchCharLeng, _ref$ignoreLocation = _ref.ignoreLocation, ignoreLocation = _ref$ignoreLocation === void 0 ? $0a1075082161df65$var$Config.ignoreLocation : _ref$ignoreLocation, _ref$findAllMatches = _ref.findAllMatches, findAllMatches = _ref$findAllMatches === void 0 ? $0a1075082161df65$var$Config.findAllMatches : _ref$findAllMatches, _ref$location = _ref.location, location = _ref$location === void 0 ? $0a1075082161df65$var$Config.location : _ref$location, _ref$threshold = _ref.threshold, threshold = _ref$threshold === void 0 ? $0a1075082161df65$var$Config.threshold : _ref$threshold, _ref$distance = _ref.distance, distance = _ref$distance === void 0 ? $0a1075082161df65$var$Config.distance : _ref$distance;\n $0a1075082161df65$var$_classCallCheck(this, ExtendedSearch);\n this.query = null;\n this.options = {\n isCaseSensitive: isCaseSensitive,\n includeMatches: includeMatches,\n minMatchCharLength: minMatchCharLength,\n findAllMatches: findAllMatches,\n ignoreLocation: ignoreLocation,\n location: location,\n threshold: threshold,\n distance: distance\n };\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\n this.query = $0a1075082161df65$var$parseQuery(this.pattern, this.options);\n }\n $0a1075082161df65$var$_createClass(ExtendedSearch, [\n {\n key: \"searchIn\",\n value: function searchIn(text) {\n var query = this.query;\n if (!query) return {\n isMatch: false,\n score: 1\n };\n var _this$options = this.options, includeMatches = _this$options.includeMatches, isCaseSensitive = _this$options.isCaseSensitive;\n text = isCaseSensitive ? text : text.toLowerCase();\n var numMatches = 0;\n var allIndices = [];\n var totalScore = 0; // ORs\n for(var i = 0, qLen = query.length; i < qLen; i += 1){\n var searchers = query[i]; // Reset indices\n allIndices.length = 0;\n numMatches = 0; // ANDs\n for(var j = 0, pLen = searchers.length; j < pLen; j += 1){\n var searcher = searchers[j];\n var _searcher$search = searcher.search(text), isMatch = _searcher$search.isMatch, indices = _searcher$search.indices, score = _searcher$search.score;\n if (isMatch) {\n numMatches += 1;\n totalScore += score;\n if (includeMatches) {\n var type = searcher.constructor.type;\n if ($0a1075082161df65$var$MultiMatchSet.has(type)) allIndices = [].concat($0a1075082161df65$var$_toConsumableArray(allIndices), $0a1075082161df65$var$_toConsumableArray(indices));\n else allIndices.push(indices);\n }\n } else {\n totalScore = 0;\n numMatches = 0;\n allIndices.length = 0;\n break;\n }\n } // OR condition, so if TRUE, return\n if (numMatches) {\n var result = {\n isMatch: true,\n score: totalScore / numMatches\n };\n if (includeMatches) result.indices = allIndices;\n return result;\n }\n } // Nothing was matched\n return {\n isMatch: false,\n score: 1\n };\n }\n }\n ], [\n {\n key: \"condition\",\n value: function condition(_, options) {\n return options.useExtendedSearch;\n }\n }\n ]);\n return ExtendedSearch;\n}();\nvar $0a1075082161df65$var$registeredSearchers = [];\nfunction $0a1075082161df65$var$register() {\n $0a1075082161df65$var$registeredSearchers.push.apply($0a1075082161df65$var$registeredSearchers, arguments);\n}\nfunction $0a1075082161df65$var$createSearcher(pattern, options) {\n for(var i = 0, len = $0a1075082161df65$var$registeredSearchers.length; i < len; i += 1){\n var searcherClass = $0a1075082161df65$var$registeredSearchers[i];\n if (searcherClass.condition(pattern, options)) return new searcherClass(pattern, options);\n }\n return new $0a1075082161df65$var$BitapSearch(pattern, options);\n}\nvar $0a1075082161df65$var$LogicalOperator = {\n AND: \"$and\",\n OR: \"$or\"\n};\nvar $0a1075082161df65$var$KeyType = {\n PATH: \"$path\",\n PATTERN: \"$val\"\n};\nvar $0a1075082161df65$var$isExpression = function isExpression(query) {\n return !!(query[$0a1075082161df65$var$LogicalOperator.AND] || query[$0a1075082161df65$var$LogicalOperator.OR]);\n};\nvar $0a1075082161df65$var$isPath = function isPath(query) {\n return !!query[$0a1075082161df65$var$KeyType.PATH];\n};\nvar $0a1075082161df65$var$isLeaf = function isLeaf(query) {\n return !$0a1075082161df65$var$isArray(query) && $0a1075082161df65$var$isObject(query) && !$0a1075082161df65$var$isExpression(query);\n};\nvar $0a1075082161df65$var$convertToExplicit = function convertToExplicit(query) {\n return $0a1075082161df65$var$_defineProperty({}, $0a1075082161df65$var$LogicalOperator.AND, Object.keys(query).map(function(key) {\n return $0a1075082161df65$var$_defineProperty({}, key, query[key]);\n }));\n}; // When `auto` is `true`, the parse function will infer and initialize and add\n// the appropriate `Searcher` instance\nfunction $0a1075082161df65$var$parse(query, options) {\n var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref3$auto = _ref3.auto, auto = _ref3$auto === void 0 ? true : _ref3$auto;\n var next = function next(query) {\n var keys = Object.keys(query);\n var isQueryPath = $0a1075082161df65$var$isPath(query);\n if (!isQueryPath && keys.length > 1 && !$0a1075082161df65$var$isExpression(query)) return next($0a1075082161df65$var$convertToExplicit(query));\n if ($0a1075082161df65$var$isLeaf(query)) {\n var key = isQueryPath ? query[$0a1075082161df65$var$KeyType.PATH] : keys[0];\n var pattern = isQueryPath ? query[$0a1075082161df65$var$KeyType.PATTERN] : query[key];\n if (!$0a1075082161df65$var$isString(pattern)) throw new Error($0a1075082161df65$var$LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));\n var obj = {\n keyId: $0a1075082161df65$var$createKeyId(key),\n pattern: pattern\n };\n if (auto) obj.searcher = $0a1075082161df65$var$createSearcher(pattern, options);\n return obj;\n }\n var node = {\n children: [],\n operator: keys[0]\n };\n keys.forEach(function(key) {\n var value = query[key];\n if ($0a1075082161df65$var$isArray(value)) value.forEach(function(item) {\n node.children.push(next(item));\n });\n });\n return node;\n };\n if (!$0a1075082161df65$var$isExpression(query)) query = $0a1075082161df65$var$convertToExplicit(query);\n return next(query);\n}\nfunction $0a1075082161df65$var$computeScore(results, _ref) {\n var _ref$ignoreFieldNorm = _ref.ignoreFieldNorm, ignoreFieldNorm = _ref$ignoreFieldNorm === void 0 ? $0a1075082161df65$var$Config.ignoreFieldNorm : _ref$ignoreFieldNorm;\n results.forEach(function(result) {\n var totalScore = 1;\n result.matches.forEach(function(_ref2) {\n var key = _ref2.key, norm = _ref2.norm, score = _ref2.score;\n var weight = key ? key.weight : null;\n totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm));\n });\n result.score = totalScore;\n });\n}\nfunction $0a1075082161df65$var$transformMatches(result, data) {\n var matches = result.matches;\n data.matches = [];\n if (!$0a1075082161df65$var$isDefined(matches)) return;\n matches.forEach(function(match) {\n if (!$0a1075082161df65$var$isDefined(match.indices) || !match.indices.length) return;\n var indices = match.indices, value = match.value;\n var obj = {\n indices: indices,\n value: value\n };\n if (match.key) obj.key = match.key.src;\n if (match.idx > -1) obj.refIndex = match.idx;\n data.matches.push(obj);\n });\n}\nfunction $0a1075082161df65$var$transformScore(result, data) {\n data.score = result.score;\n}\nfunction $0a1075082161df65$var$format(results, docs) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref$includeMatches = _ref.includeMatches, includeMatches = _ref$includeMatches === void 0 ? $0a1075082161df65$var$Config.includeMatches : _ref$includeMatches, _ref$includeScore = _ref.includeScore, includeScore = _ref$includeScore === void 0 ? $0a1075082161df65$var$Config.includeScore : _ref$includeScore;\n var transformers = [];\n if (includeMatches) transformers.push($0a1075082161df65$var$transformMatches);\n if (includeScore) transformers.push($0a1075082161df65$var$transformScore);\n return results.map(function(result) {\n var idx = result.idx;\n var data = {\n item: docs[idx],\n refIndex: idx\n };\n if (transformers.length) transformers.forEach(function(transformer) {\n transformer(result, data);\n });\n return data;\n });\n}\nvar $0a1075082161df65$var$Fuse$1 = /*#__PURE__*/ function() {\n function Fuse(docs) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var index = arguments.length > 2 ? arguments[2] : undefined;\n $0a1075082161df65$var$_classCallCheck(this, Fuse);\n this.options = $0a1075082161df65$var$_objectSpread2($0a1075082161df65$var$_objectSpread2({}, $0a1075082161df65$var$Config), options);\n this.options.useExtendedSearch;\n this._keyStore = new $0a1075082161df65$var$KeyStore(this.options.keys);\n this.setCollection(docs, index);\n }\n $0a1075082161df65$var$_createClass(Fuse, [\n {\n key: \"setCollection\",\n value: function setCollection(docs, index) {\n this._docs = docs;\n if (index && !(index instanceof $0a1075082161df65$var$FuseIndex)) throw new Error($0a1075082161df65$var$INCORRECT_INDEX_TYPE);\n this._myIndex = index || $0a1075082161df65$var$createIndex(this.options.keys, this._docs, {\n getFn: this.options.getFn,\n fieldNormWeight: this.options.fieldNormWeight\n });\n }\n },\n {\n key: \"add\",\n value: function add(doc) {\n if (!$0a1075082161df65$var$isDefined(doc)) return;\n this._docs.push(doc);\n this._myIndex.add(doc);\n }\n },\n {\n key: \"remove\",\n value: function remove() {\n var predicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function() /* doc, idx */ {\n return false;\n };\n var results = [];\n for(var i = 0, len = this._docs.length; i < len; i += 1){\n var doc = this._docs[i];\n if (predicate(doc, i)) {\n this.removeAt(i);\n i -= 1;\n len -= 1;\n results.push(doc);\n }\n }\n return results;\n }\n },\n {\n key: \"removeAt\",\n value: function removeAt(idx) {\n this._docs.splice(idx, 1);\n this._myIndex.removeAt(idx);\n }\n },\n {\n key: \"getIndex\",\n value: function getIndex() {\n return this._myIndex;\n }\n },\n {\n key: \"search\",\n value: function search(query) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$limit = _ref.limit, limit = _ref$limit === void 0 ? -1 : _ref$limit;\n var _this$options = this.options, includeMatches = _this$options.includeMatches, includeScore = _this$options.includeScore, shouldSort = _this$options.shouldSort, sortFn = _this$options.sortFn, ignoreFieldNorm = _this$options.ignoreFieldNorm;\n var results = $0a1075082161df65$var$isString(query) ? $0a1075082161df65$var$isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);\n $0a1075082161df65$var$computeScore(results, {\n ignoreFieldNorm: ignoreFieldNorm\n });\n if (shouldSort) results.sort(sortFn);\n if ($0a1075082161df65$var$isNumber(limit) && limit > -1) results = results.slice(0, limit);\n return $0a1075082161df65$var$format(results, this._docs, {\n includeMatches: includeMatches,\n includeScore: includeScore\n });\n }\n },\n {\n key: \"_searchStringList\",\n value: function _searchStringList(query) {\n var searcher = $0a1075082161df65$var$createSearcher(query, this.options);\n var records = this._myIndex.records;\n var results = []; // Iterate over every string in the index\n records.forEach(function(_ref2) {\n var text = _ref2.v, idx = _ref2.i, norm = _ref2.n;\n if (!$0a1075082161df65$var$isDefined(text)) return;\n var _searcher$searchIn = searcher.searchIn(text), isMatch = _searcher$searchIn.isMatch, score = _searcher$searchIn.score, indices = _searcher$searchIn.indices;\n if (isMatch) results.push({\n item: text,\n idx: idx,\n matches: [\n {\n score: score,\n value: text,\n norm: norm,\n indices: indices\n }\n ]\n });\n });\n return results;\n }\n },\n {\n key: \"_searchLogical\",\n value: function _searchLogical(query) {\n var _this = this;\n var expression = $0a1075082161df65$var$parse(query, this.options);\n var evaluate = function evaluate(node, item, idx) {\n if (!node.children) {\n var keyId = node.keyId, searcher = node.searcher;\n var matches = _this._findMatches({\n key: _this._keyStore.get(keyId),\n value: _this._myIndex.getValueForItemAtKeyId(item, keyId),\n searcher: searcher\n });\n if (matches && matches.length) return [\n {\n idx: idx,\n item: item,\n matches: matches\n }\n ];\n return [];\n }\n var res = [];\n for(var i = 0, len = node.children.length; i < len; i += 1){\n var child = node.children[i];\n var result = evaluate(child, item, idx);\n if (result.length) res.push.apply(res, $0a1075082161df65$var$_toConsumableArray(result));\n else if (node.operator === $0a1075082161df65$var$LogicalOperator.AND) return [];\n }\n return res;\n };\n var records = this._myIndex.records;\n var resultMap = {};\n var results = [];\n records.forEach(function(_ref3) {\n var item = _ref3.$, idx = _ref3.i;\n if ($0a1075082161df65$var$isDefined(item)) {\n var expResults = evaluate(expression, item, idx);\n if (expResults.length) {\n // Dedupe when adding\n if (!resultMap[idx]) {\n resultMap[idx] = {\n idx: idx,\n item: item,\n matches: []\n };\n results.push(resultMap[idx]);\n }\n expResults.forEach(function(_ref4) {\n var _resultMap$idx$matche;\n var matches = _ref4.matches;\n (_resultMap$idx$matche = resultMap[idx].matches).push.apply(_resultMap$idx$matche, $0a1075082161df65$var$_toConsumableArray(matches));\n });\n }\n }\n });\n return results;\n }\n },\n {\n key: \"_searchObjectList\",\n value: function _searchObjectList(query) {\n var _this2 = this;\n var searcher = $0a1075082161df65$var$createSearcher(query, this.options);\n var _this$_myIndex = this._myIndex, keys = _this$_myIndex.keys, records = _this$_myIndex.records;\n var results = []; // List is Array<Object>\n records.forEach(function(_ref5) {\n var item = _ref5.$, idx = _ref5.i;\n if (!$0a1075082161df65$var$isDefined(item)) return;\n var matches = []; // Iterate over every key (i.e, path), and fetch the value at that key\n keys.forEach(function(key, keyIndex) {\n matches.push.apply(matches, $0a1075082161df65$var$_toConsumableArray(_this2._findMatches({\n key: key,\n value: item[keyIndex],\n searcher: searcher\n })));\n });\n if (matches.length) results.push({\n idx: idx,\n item: item,\n matches: matches\n });\n });\n return results;\n }\n },\n {\n key: \"_findMatches\",\n value: function _findMatches(_ref6) {\n var key = _ref6.key, value = _ref6.value, searcher = _ref6.searcher;\n if (!$0a1075082161df65$var$isDefined(value)) return [];\n var matches = [];\n if ($0a1075082161df65$var$isArray(value)) value.forEach(function(_ref7) {\n var text = _ref7.v, idx = _ref7.i, norm = _ref7.n;\n if (!$0a1075082161df65$var$isDefined(text)) return;\n var _searcher$searchIn2 = searcher.searchIn(text), isMatch = _searcher$searchIn2.isMatch, score = _searcher$searchIn2.score, indices = _searcher$searchIn2.indices;\n if (isMatch) matches.push({\n score: score,\n key: key,\n value: text,\n idx: idx,\n norm: norm,\n indices: indices\n });\n });\n else {\n var text = value.v, norm = value.n;\n var _searcher$searchIn3 = searcher.searchIn(text), isMatch = _searcher$searchIn3.isMatch, score = _searcher$searchIn3.score, indices = _searcher$searchIn3.indices;\n if (isMatch) matches.push({\n score: score,\n key: key,\n value: text,\n norm: norm,\n indices: indices\n });\n }\n return matches;\n }\n }\n ]);\n return Fuse;\n}();\n$0a1075082161df65$var$Fuse$1.version = \"6.5.3\";\n$0a1075082161df65$var$Fuse$1.createIndex = $0a1075082161df65$var$createIndex;\n$0a1075082161df65$var$Fuse$1.parseIndex = $0a1075082161df65$var$parseIndex;\n$0a1075082161df65$var$Fuse$1.config = $0a1075082161df65$var$Config;\n$0a1075082161df65$var$Fuse$1.parseQuery = $0a1075082161df65$var$parse;\n$0a1075082161df65$var$register($0a1075082161df65$var$ExtendedSearch);\nvar $0a1075082161df65$export$93605f466b8506d8 = $0a1075082161df65$var$Fuse$1;\n\n});\n\n\nparcelRequire.register(\"aBy72\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $7b87d21eb93bfe57$export$2e2bcd8739ae039);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $7OP4c = parcelRequire(\"7OP4c\");\nclass $7b87d21eb93bfe57$export$2e2bcd8739ae039 extends FormApplication {\n constructor(object, img, regenStyle){\n super({}, {});\n this.object = object;\n this.img = img;\n this.regenStyle = regenStyle;\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-user-list\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/userList.html\",\n resizable: false,\n minimizable: false,\n title: \"User To Image\",\n width: 300\n });\n }\n async getData(options) {\n const data = super.getData(options);\n const mappings = this.object.document.getFlag(\"token-variants\", \"userMappings\") || {};\n let users = [];\n game.users.forEach((user)=>{\n users.push({\n avatar: user.avatar,\n name: user.name,\n apply: user.id in mappings && mappings[user.id] === this.img,\n userId: user.id,\n color: user.color\n });\n });\n data.users = users;\n data.invisibleImage = (0, $9IngI.TVA_CONFIG).invisibleImage;\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n (0, $7OP4c.insertArtSelectButton)(html, \"invisibleImage\", {\n search: \"Invisible Image\",\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN\n });\n }\n async _updateObject(event, formData) {\n const mappings = this.object.document.getFlag(\"token-variants\", \"userMappings\") || {};\n if (formData.invisibleImage !== (0, $9IngI.TVA_CONFIG).invisibleImage) (0, $9IngI.updateSettings)({\n invisibleImage: (0, $eeGZt.decodeURISafely)(formData.invisibleImage)\n });\n delete formData.invisibleImage;\n const affectedImages = [\n this.img\n ];\n for (const [userId, apply] of Object.entries(formData)){\n if (apply) {\n if (mappings[userId] && mappings[userId] !== this.img) affectedImages.push(mappings[userId]);\n mappings[userId] = this.img;\n } else if (mappings[userId] === this.img) {\n delete mappings[userId];\n mappings[\"-=\" + userId] = null;\n }\n }\n if (Object.keys(mappings).filter((userId)=>!userId.startsWith(\"-=\")).length === 0) await this.object.document.unsetFlag(\"token-variants\", \"userMappings\");\n else await this.object.document.setFlag(\"token-variants\", \"userMappings\", mappings);\n for (const img of affectedImages)this.regenStyle(this.object, img);\n }\n}\n\n});\n\n\nparcelRequire.register(\"6aWyX\", function(module, exports) {\n\n$parcel$export(module.exports, \"TOKEN_HUD_VARIANTS\", () => $47f11a959bac7657$export$584c9acde3dd56ba);\n$parcel$export(module.exports, \"renderTokenHUD\", () => $47f11a959bac7657$export$42b0bd17e532cdc8);\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $7P4Bo = parcelRequire(\"7P4Bo\");\n\nvar $eYkM9 = parcelRequire(\"eYkM9\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $aBy72 = parcelRequire(\"aBy72\");\n\nvar $byeN2 = parcelRequire(\"byeN2\");\n\nvar $9Z21J = parcelRequire(\"9Z21J\");\n\nvar $8MWlo = parcelRequire(\"8MWlo\");\nconst $47f11a959bac7657$export$584c9acde3dd56ba = {\n variants: null,\n actor: null\n};\nasync function $47f11a959bac7657$export$42b0bd17e532cdc8(hud, html, token, searchText = \"\", fp_files = null) {\n $47f11a959bac7657$var$activateStatusEffectListeners(token);\n const hudSettings = (0, $9IngI.TVA_CONFIG).hud;\n const FULL_ACCESS = (0, $9IngI.TVA_CONFIG).permissions.hudFullAccess[game.user.role];\n const PARTIAL_ACCESS = (0, $9IngI.TVA_CONFIG).permissions.hud[game.user.role];\n // Check if the HUD button should be displayed\n if (!hudSettings.enableSideMenu || !PARTIAL_ACCESS && !FULL_ACCESS || token.flags[\"token-variants\"]?.disableHUDButton) return;\n const tokenActor = game.actors.get(token.actorId);\n // Disable button if Token HUD Wildcard is enabled and appropriate setting is set\n if ((0, $9IngI.TVA_CONFIG).worldHud.disableIfTHWEnabled && game.modules.get(\"token-hud-wildcard\")?.active) {\n if (tokenActor && tokenActor.prototypeToken.randomImg) return;\n }\n const button = $(`\r\n <div class=\"control-icon\" data-action=\"token-variants-side-selector\">\r\n <img\r\n id=\"token-variants-side-button\"\r\n src=\"modules/token-variants/img/token-images.svg\"\r\n width=\"36\"\r\n height=\"36\"\r\n title=\"Left-click: Image Menu
Right-click: Search & Additional settings\"\r\n />\r\n </div>\r\n`);\n html.find(\"div.right\").last().append(button);\n html.find(\"div.right\").click($47f11a959bac7657$var$_deactivateTokenVariantsSideSelector);\n button.click((event)=>$47f11a959bac7657$var$_onButtonClick(event, token));\n if (FULL_ACCESS) button.contextmenu((event)=>$47f11a959bac7657$var$_onButtonRightClick(event, hud, html, token));\n}\nasync function $47f11a959bac7657$var$_onButtonClick(event, token) {\n const button = $(event.target).closest(\".control-icon\");\n // De-activate 'Status Effects'\n button.closest(\"div.right\").find(\"div.control-icon.effects\").removeClass(\"active\");\n button.closest(\"div.right\").find(\".status-effects\").removeClass(\"active\");\n // Remove contextmenu\n button.find(\".contextmenu\").remove();\n // Toggle variants side menu\n button.toggleClass(\"active\");\n let variantsWrap = button.find(\".token-variants-wrap\");\n if (button.hasClass(\"active\")) {\n if (!variantsWrap.length) {\n variantsWrap = await $47f11a959bac7657$var$renderSideSelect(token);\n if (variantsWrap) button.find(\"img\").after(variantsWrap);\n else return;\n }\n variantsWrap.addClass(\"active\");\n } else variantsWrap.removeClass(\"active\");\n}\nfunction $47f11a959bac7657$var$_onButtonRightClick(event, hud, html, token) {\n // Display side menu if button is not active yet\n const button = $(event.target).closest(\".control-icon\");\n if (!button.hasClass(\"active\")) // button.trigger('click');\n button.addClass(\"active\");\n if (button.find(\".contextmenu\").length) {\n // Contextmenu already displayed. Remove and activate images\n button.find(\".contextmenu\").remove();\n button.removeClass(\"active\").trigger(\"click\");\n //button.find('.token-variants-wrap.images').addClass('active');\n } else {\n // Contextmenu is not displayed. Hide images, create it and add it\n button.find(\".token-variants-wrap.images\").removeClass(\"active\");\n const contextMenu = $(`\r\n <div class=\"token-variants-wrap contextmenu active\">\r\n <div class=\"token-variants-context-menu active\">\r\n <input class=\"token-variants-side-search\" type=\"text\" />\r\n <button class=\"flags\" type=\"button\"><i class=\"fab fa-font-awesome-flag\"></i><label>Flags</label></button>\r\n <button class=\"file-picker\" type=\"button\"><i class=\"fas fa-file-import fa-fw\"></i><label>Browse Folders</label></button>\r\n <button class=\"effectConfig\" type=\"button\"><i class=\"fas fa-sun\"></i><label>Mappings</label></button>\r\n <button class=\"randomizerConfig\" type=\"button\"><i class=\"fas fa-dice\"></i><label>Randomizer</label></button>\r\n </div>\r\n </div>\r\n `);\n button.append(contextMenu);\n // Register contextmenu listeners\n contextMenu.find(\".token-variants-side-search\").on(\"keyup\", (event)=>$47f11a959bac7657$var$_onImageSearchKeyUp(event, token)).on(\"click\", (event)=>{\n event.preventDefault();\n event.stopPropagation();\n });\n contextMenu.find(\".flags\").click((event)=>{\n const tkn = canvas.tokens.get(token._id);\n if (tkn) {\n event.preventDefault();\n event.stopPropagation();\n new (0, $byeN2.default)(tkn).render(true);\n }\n });\n contextMenu.find(\".file-picker\").click(async (event)=>{\n event.preventDefault();\n event.stopPropagation();\n new FilePicker({\n type: \"imagevideo\",\n callback: async (path, fp)=>{\n const content = await FilePicker.browse(fp.activeSource, fp.result.target);\n let files = content.files.filter((f)=>(0, $eeGZt.isImage)(f) || (0, $eeGZt.isVideo)(f));\n if (files.length) {\n button.find(\".token-variants-wrap\").remove();\n const sideSelect = await $47f11a959bac7657$var$renderSideSelect(token, \"\", files);\n if (sideSelect) {\n sideSelect.addClass(\"active\");\n button.append(sideSelect);\n }\n }\n }\n }).render(true);\n });\n contextMenu.find(\".effectConfig\").click((event)=>{\n new (0, $eYkM9.default)(token).render(true);\n });\n contextMenu.find(\".randomizerConfig\").click((event)=>{\n new (0, $9Z21J.default)(token).render(true);\n });\n }\n}\nfunction $47f11a959bac7657$var$_deactivateTokenVariantsSideSelector(event) {\n const controlIcon = $(event.target).closest(\".control-icon\");\n const dataAction = controlIcon.attr(\"data-action\");\n switch(dataAction){\n case \"effects\":\n break; // Effects button\n case \"thwildcard-selector\":\n break; // Token HUD Wildcard module button\n default:\n return;\n }\n $(event.target).closest(\"div.right\").find('.control-icon[data-action=\"token-variants-side-selector\"]').removeClass(\"active\");\n $(event.target).closest(\"div.right\").find(\".token-variants-wrap\").removeClass(\"active\");\n}\nasync function $47f11a959bac7657$var$renderSideSelect(token, searchText = \"\", fp_files = null) {\n const hudSettings = (0, $9IngI.TVA_CONFIG).hud;\n const worldHudSettings = (0, $9IngI.TVA_CONFIG).worldHud;\n const FULL_ACCESS = (0, $9IngI.TVA_CONFIG).permissions.hudFullAccess[game.user.role];\n const PARTIAL_ACCESS = (0, $9IngI.TVA_CONFIG).permissions.hud[game.user.role];\n const tokenActor = game.actors.get(token.actorId);\n let images = [];\n let actorVariants = [];\n let imageDuplicates = new Set();\n const pushImage = (img)=>{\n if (imageDuplicates.has(img.path)) {\n if (!images.find((obj)=>obj.path === img.path && obj.name === img.name)) images.push(img);\n } else {\n images.push(img);\n imageDuplicates.add(img.path);\n }\n };\n actorVariants = $47f11a959bac7657$var$getVariants(tokenActor);\n if (!fp_files) {\n if (!searchText) {\n // Insert current token image\n if (token.texture?.src && token.texture?.src !== CONST.DEFAULT_TOKEN) pushImage({\n path: (0, $eeGZt.decodeURISafely)(token.texture.src),\n name: token.flags?.[\"token-variants\"]?.name ?? (0, $eeGZt.getFileName)(token.texture.src)\n });\n if (tokenActor) {\n // Insert default token image\n const defaultImg = tokenActor.prototypeToken?.flags[\"token-variants\"]?.[\"randomImgDefault\"] || tokenActor.prototypeToken?.flags[\"token-hud-wildcard\"]?.[\"default\"] || \"\";\n if (defaultImg) pushImage({\n path: (0, $eeGZt.decodeURISafely)(defaultImg),\n name: (0, $eeGZt.getFileName)(defaultImg)\n });\n if (FULL_ACCESS || PARTIAL_ACCESS) actorVariants.forEach((variant)=>{\n for (const name of variant.names)pushImage({\n path: (0, $eeGZt.decodeURISafely)(variant.imgSrc),\n name: name\n });\n });\n // Parse directory flag and include the images\n if (FULL_ACCESS || PARTIAL_ACCESS) {\n const directoryFlag = tokenActor.getFlag(\"token-variants\", \"directory\");\n if (directoryFlag) {\n let dirFlagImages;\n try {\n let path = directoryFlag.path;\n let source = directoryFlag.source;\n let bucket = \"\";\n if (source.startsWith(\"s3:\")) {\n bucket = source.substring(3, source.length);\n source = \"s3\";\n }\n const content = await FilePicker.browse(source, path, {\n type: \"imagevideo\",\n bucket: bucket\n });\n dirFlagImages = content.files;\n } catch (err) {\n dirFlagImages = [];\n }\n dirFlagImages = dirFlagImages.forEach((f)=>{\n if ((0, $eeGZt.isImage)(f) || (0, $eeGZt.isVideo)(f)) pushImage({\n path: (0, $eeGZt.decodeURISafely)(f),\n name: (0, $eeGZt.getFileName)(f)\n });\n });\n }\n }\n if ((FULL_ACCESS || PARTIAL_ACCESS) && worldHudSettings.includeWildcard && !worldHudSettings.displayOnlySharedImages) {\n // Merge wildcard images\n const protoImg = tokenActor.prototypeToken.texture.src;\n if (tokenActor.prototypeToken.randomImg) (await tokenActor.getTokenImages()).filter((img)=>!img.includes(\"*\")).forEach((img)=>{\n pushImage({\n path: (0, $eeGZt.decodeURISafely)(img),\n name: (0, $eeGZt.getFileName)(img)\n });\n });\n else if (protoImg.includes(\"*\") || protoImg.includes(\"{\") || protoImg.includes(\"}\")) {\n // Modified version of Actor.getTokenImages()\n const getTokenImages = async ()=>{\n if (tokenActor._tokenImages) return tokenActor._tokenImages;\n let source = \"data\";\n let pattern = tokenActor.prototypeToken.texture.src;\n const browseOptions = {\n wildcard: true\n };\n // Support non-user sources\n if (/\\.s3\\./.test(pattern)) {\n source = \"s3\";\n const { bucket: bucket, keyPrefix: keyPrefix } = FilePicker.parseS3URL(pattern);\n if (bucket) {\n browseOptions.bucket = bucket;\n pattern = keyPrefix;\n }\n } else if (pattern.startsWith(\"icons/\")) source = \"public\";\n // Retrieve wildcard content\n try {\n const content = await FilePicker.browse(source, pattern, browseOptions);\n tokenActor._tokenImages = content.files;\n } catch (err) {\n tokenActor._tokenImages = [];\n }\n return tokenActor._tokenImages;\n };\n (await getTokenImages()).filter((img)=>!img.includes(\"*\") && ((0, $eeGZt.isImage)(img) || (0, $eeGZt.isVideo)(img))).forEach((variant)=>{\n pushImage({\n path: (0, $eeGZt.decodeURISafely)(variant),\n name: (0, $eeGZt.getFileName)(variant)\n });\n });\n }\n }\n }\n }\n // Perform image search if needed\n if (FULL_ACCESS) {\n let search;\n if (searchText) search = searchText.length > 2 ? searchText : null;\n else {\n if (worldHudSettings.displayOnlySharedImages || tokenActor?.getFlag(\"token-variants\", \"disableNameSearch\")) ;\n else if (token.name.length > 2) search = token.name;\n }\n if (search) {\n let artSearch = await (0, $8MWlo.doImageSearch)(search, {\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n searchOptions: {\n keywordSearch: worldHudSettings.includeKeywords\n }\n });\n // Merge full search, and keywords into a single array\n if (artSearch) artSearch.forEach((results)=>{\n results.forEach((img)=>pushImage(img));\n });\n }\n }\n } else images = fp_files.map((f)=>{\n return {\n path: (0, $eeGZt.decodeURISafely)(f),\n name: (0, $eeGZt.getFileName)(f)\n };\n });\n // Retrieving the possibly custom name attached as a flag to the token\n let tokenImageName = \"\";\n if (token.flags[\"token-variants\"] && token.flags[\"token-variants\"][\"name\"]) tokenImageName = token.flags[\"token-variants\"][\"name\"];\n else tokenImageName = (0, $eeGZt.getFileName)(token.texture.src);\n let imagesParsed = [];\n const tokenConfigs = ((0, $9IngI.TVA_CONFIG).tokenConfigs || []).flat();\n const tkn = canvas.tokens.get(token._id);\n const userMappings = tkn.document.getFlag(\"token-variants\", \"userMappings\") || {};\n for (const imageObj of images){\n const img = (0, $eeGZt.isImage)(imageObj.path);\n const vid = (0, $eeGZt.isVideo)(imageObj.path);\n const hasConfig = Boolean(tokenConfigs.find((config)=>config.tvImgSrc === imageObj.path && config.tvImgName === imageObj.name));\n let shared = false;\n if ((0, $9IngI.TVA_CONFIG).permissions.hudFullAccess[game.user.role]) actorVariants.forEach((variant)=>{\n if (variant.imgSrc === imageObj.path && variant.names.includes(imageObj.name)) shared = true;\n });\n const [title, style] = $47f11a959bac7657$var$genTitleAndStyle(userMappings, imageObj.path, imageObj.name);\n imagesParsed.push({\n route: imageObj.path,\n name: imageObj.name,\n used: imageObj.path === token.texture.src && imageObj.name === tokenImageName,\n img: img,\n vid: vid,\n unknownType: !img && !vid,\n shared: shared,\n hasConfig: hasConfig,\n title: title,\n style: game.user.isGM && style ? \"box-shadow: \" + style + \";\" : null\n });\n }\n //\n // Render\n //\n const imageDisplay = hudSettings.displayAsImage;\n const imageOpacity = hudSettings.imageOpacity / 100;\n const sideSelect = $(await renderTemplate(\"modules/token-variants/templates/sideSelect.html\", {\n imagesParsed: imagesParsed,\n imageDisplay: imageDisplay,\n imageOpacity: imageOpacity,\n tokenHud: true\n }));\n // Activate listeners\n sideSelect.find(\"video\").hover(function() {\n if ((0, $9IngI.TVA_CONFIG).playVideoOnHover) {\n this.play();\n $(this).siblings(\".fa-play\").hide();\n }\n }, function() {\n if ((0, $9IngI.TVA_CONFIG).pauseVideoOnHoverOut) {\n this.pause();\n this.currentTime = 0;\n $(this).siblings(\".fa-play\").show();\n }\n });\n sideSelect.find(\".token-variants-button-select\").click((event)=>$47f11a959bac7657$var$_onImageClick(event, token._id));\n if (FULL_ACCESS) sideSelect.find(\".token-variants-button-select\").on(\"contextmenu\", (event)=>$47f11a959bac7657$var$_onImageRightClick(event, token._id));\n return sideSelect;\n}\nasync function $47f11a959bac7657$var$_onImageClick(event, tokenId) {\n event.preventDefault();\n event.stopPropagation();\n const token = canvas.tokens.controlled.find((t)=>t.document.id === tokenId);\n if (!token) return;\n const worldHudSettings = (0, $9IngI.TVA_CONFIG).worldHud;\n const imgButton = $(event.target).closest(\".token-variants-button-select\");\n const imgSrc = imgButton.attr(\"data-name\");\n const name = imgButton.attr(\"data-filename\");\n if (!imgSrc || !name) return;\n if ((0, $eeGZt.keyPressed)(\"config\") && game.user.isGM) {\n const toggleCog = (saved)=>{\n const cog = imgButton.find(\".fa-cog\");\n if (saved) cog.addClass(\"active\");\n else cog.removeClass(\"active\");\n };\n new (0, $7P4Bo.default)(token, {}, imgSrc, name, toggleCog).render(true);\n } else if (token.document.texture.src === imgSrc) {\n let tokenImageName = token.document.getFlag(\"token-variants\", \"name\");\n if (!tokenImageName) tokenImageName = (0, $eeGZt.getFileName)(token.document.texture.src);\n if (tokenImageName !== name) {\n await (0, $eeGZt.updateTokenImage)(imgSrc, {\n token: token,\n imgName: name,\n animate: worldHudSettings.animate\n });\n if (token.actor && worldHudSettings.updateActorImage) {\n if (worldHudSettings.useNameSimilarity) $47f11a959bac7657$var$updateActorWithSimilarName(imgSrc, name, token.actor);\n else (0, $eeGZt.updateActorImage)(token.actor, imgSrc, {\n imgName: name\n });\n }\n }\n } else {\n await (0, $eeGZt.updateTokenImage)(imgSrc, {\n token: token,\n imgName: name,\n animate: worldHudSettings.animate\n });\n if (token.actor && worldHudSettings.updateActorImage) {\n if (worldHudSettings.useNameSimilarity) $47f11a959bac7657$var$updateActorWithSimilarName(imgSrc, name, token.actor);\n else (0, $eeGZt.updateActorImage)(token.actor, imgSrc, {\n imgName: name\n });\n }\n }\n}\nasync function $47f11a959bac7657$var$_onImageRightClick(event, tokenId) {\n event.preventDefault();\n event.stopPropagation();\n let token = canvas.tokens.controlled.find((t)=>t.document.id === tokenId);\n if (!token) return;\n const imgButton = $(event.target).closest(\".token-variants-button-select\");\n const imgSrc = imgButton.attr(\"data-name\");\n const name = imgButton.attr(\"data-filename\");\n if (!imgSrc || !name) return;\n if ((0, $eeGZt.keyPressed)(\"config\") && game.user.isGM) {\n const regenStyle = (token, img)=>{\n const mappings = token.document.getFlag(\"token-variants\", \"userMappings\") || {};\n const name = imgButton.attr(\"data-filename\");\n const [title, style] = $47f11a959bac7657$var$genTitleAndStyle(mappings, img, name);\n imgButton.closest(\".token-variants-wrap\").find(`.token-variants-button-select[data-name='${img}']`).css(\"box-shadow\", style).prop(\"title\", title);\n };\n new (0, $aBy72.default)(token, imgSrc, regenStyle).render(true);\n } else if (token.actor) {\n let tokenActor = game.actors.get(token.actor.id);\n let variants = $47f11a959bac7657$var$getVariants(tokenActor);\n // Remove selected variant if present in the flag, add otherwise\n let del = false;\n let updated = false;\n for (let variant of variants)if (variant.imgSrc === imgSrc) {\n let fNames = variant.names.filter((name)=>name !== name);\n if (fNames.length === 0) del = true;\n else if (fNames.length === variant.names.length) fNames.push(name);\n variant.names = fNames;\n updated = true;\n break;\n }\n if (del) variants = variants.filter((variant)=>variant.imgSrc !== imgSrc);\n else if (!updated) variants.push({\n imgSrc: imgSrc,\n names: [\n name\n ]\n });\n // Set shared variants as an actor flag\n $47f11a959bac7657$var$setVariants(tokenActor, variants);\n imgButton.find(\".fa-share\").toggleClass(\"active\"); // Display green arrow\n }\n}\nasync function $47f11a959bac7657$var$_onImageSearchKeyUp(event, token) {\n event.preventDefault();\n event.stopPropagation();\n if (event.key === \"Enter\" || event.keyCode === 13) {\n if (event.target.value.length >= 3) {\n const button = $(event.target).closest(\".control-icon\");\n button.find(\".token-variants-wrap\").remove();\n const sideSelect = await $47f11a959bac7657$var$renderSideSelect(token, event.target.value);\n if (sideSelect) {\n sideSelect.addClass(\"active\");\n button.append(sideSelect);\n }\n }\n }\n}\nfunction $47f11a959bac7657$var$genTitleAndStyle(mappings, imgSrc, name) {\n let title = (0, $9IngI.TVA_CONFIG).worldHud.showFullPath ? imgSrc : name;\n let style = \"\";\n let offset = 2;\n for (const [userId, img] of Object.entries(mappings))if (img === imgSrc) {\n const user = game.users.get(userId);\n if (!user) continue;\n if (style.length === 0) style = `inset 0 0 0 ${offset}px ${user.color}`;\n else style += `, inset 0 0 0 ${offset}px ${user.color}`;\n offset += 2;\n title += `\\nDisplayed to: ${user.name}`;\n }\n return [\n title,\n style\n ];\n}\nasync function $47f11a959bac7657$var$updateActorWithSimilarName(imgSrc, imgName, actor) {\n const results = await (0, $8MWlo.findImagesFuzzy)(imgName, (0, $eeGZt.SEARCH_TYPE).PORTRAIT, {\n algorithm: {\n fuzzyThreshold: 0.4,\n fuzzyLimit: 50\n }\n }, true);\n if (results && results.length !== 0) (0, $eeGZt.updateActorImage)(actor, results[0].path, {\n imgName: results[0].name\n });\n else (0, $eeGZt.updateActorImage)(actor, imgSrc, {\n imgName: imgName\n });\n}\nfunction $47f11a959bac7657$var$activateStatusEffectListeners(token) {\n if ((0, $9IngI.TVA_CONFIG).permissions.statusConfig[game.user.role] && token.actorId && game.actors.get(token.actorId)) {\n $('.control-icon[data-action=\"effects\"]').find(\"img:first\").click((event)=>{\n event.preventDefault();\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n event.stopPropagation();\n new (0, $eYkM9.default)(token).render(true);\n }\n });\n $('.control-icon[data-action=\"visibility\"]').find(\"img\").click((event)=>{\n event.preventDefault();\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n event.stopPropagation();\n new (0, $eYkM9.default)(token, {\n createMapping: {\n label: \"In Combat\",\n expression: \"token-variants-visibility\"\n }\n }).render(true);\n }\n });\n $('.control-icon[data-action=\"combat\"]').find(\"img\").click((event)=>{\n event.preventDefault();\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n event.stopPropagation();\n new (0, $eYkM9.default)(token, {\n createMapping: {\n label: \"In Combat\",\n expression: \"token-variants-combat\"\n }\n }).render(true);\n }\n });\n $(\".status-effects\").find(\"img\").click((event)=>{\n event.preventDefault();\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n event.stopPropagation();\n let effectName = event.target.getAttribute(\"title\");\n if (game.system.id === \"pf2e\") effectName = $(event.target).closest(\"picture\").attr(\"title\");\n new (0, $eYkM9.default)(token, {\n createMapping: {\n label: effectName,\n expression: effectName\n }\n }).render(true);\n }\n });\n }\n}\nfunction $47f11a959bac7657$var$getVariants(actor) {\n if ($47f11a959bac7657$export$584c9acde3dd56ba.variants) return $47f11a959bac7657$export$584c9acde3dd56ba.variants;\n else return actor?.getFlag(\"token-variants\", \"variants\") || [];\n}\nfunction $47f11a959bac7657$var$setVariants(actor, variants) {\n $47f11a959bac7657$export$584c9acde3dd56ba.variants = variants;\n $47f11a959bac7657$export$584c9acde3dd56ba.actor = actor;\n}\n\n});\nparcelRequire.register(\"eYkM9\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $ae66c8e3e88183ab$export$2e2bcd8739ae039);\n$parcel$export(module.exports, \"sortMappingsToGroups\", () => $ae66c8e3e88183ab$export$94ded7fcdb9fe2e4);\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $7P4Bo = parcelRequire(\"7P4Bo\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $b9QOF = parcelRequire(\"b9QOF\");\n\nvar $4pjFr = parcelRequire(\"4pjFr\");\n\nvar $4rd87 = parcelRequire(\"4rd87\");\n\nvar $cs88A = parcelRequire(\"cs88A\");\n\nvar $ce8jp = parcelRequire(\"ce8jp\");\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\n\nvar $bFZU7 = parcelRequire(\"bFZU7\");\n\nvar $fTFXO = parcelRequire(\"fTFXO\");\n// Persist group toggles across forms\nlet $ae66c8e3e88183ab$var$TOGGLED_GROUPS;\nconst $ae66c8e3e88183ab$var$NO_IMAGE = \"modules\\\\token-variants\\\\img\\\\empty.webp\";\nclass $ae66c8e3e88183ab$export$2e2bcd8739ae039 extends FormApplication {\n constructor(token, { globalMappings: globalMappings = false, callback: callback = null, createMapping: createMapping = null } = {}){\n super({}, {\n title: (globalMappings ? \"GLOBAL \" : \"ACTOR \") + \"Mappings\"\n });\n this.token = token;\n if (globalMappings) this.globalMappings = deepClone((0, $9IngI.TVA_CONFIG).globalMappings).filter(Boolean);\n if (!globalMappings) this.objectToFlag = game.actors.get(token.actorId);\n this.callback = callback;\n $ae66c8e3e88183ab$var$TOGGLED_GROUPS = game.settings.get(\"token-variants\", \"effectMappingToggleGroups\") || {\n Default: true\n };\n this.createMapping = createMapping;\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-active-effect-config\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/effectMappingForm.html\",\n resizable: true,\n minimizable: false,\n closeOnSubmit: false,\n width: 1020,\n height: \"auto\",\n scrollY: [\n \"ol.token-variant-table\"\n ]\n });\n }\n _processConfig(mapping) {\n if (!mapping.config) mapping.config = {};\n let hasTokenConfig = Object.keys(mapping.config).filter((k)=>mapping.config[k]).length;\n if (mapping.config.flags) hasTokenConfig--;\n if (mapping.config.tv_script) hasTokenConfig--;\n return {\n id: mapping.id || randomID(8),\n label: mapping.label,\n expression: mapping.expression,\n codeExp: mapping.codeExp,\n hasCodeExp: Boolean(mapping.codeExp),\n highlightedExpression: $ae66c8e3e88183ab$var$highlightOperators(mapping.expression),\n imgName: mapping.imgName,\n imgSrc: mapping.imgSrc,\n isVideo: mapping.imgSrc ? (0, $eeGZt.isVideo)(mapping.imgSrc) : false,\n priority: mapping.priority,\n hasConfig: mapping.config ? !isEmpty(mapping.config) : false,\n hasScript: mapping.config && mapping.config.tv_script,\n hasTokenConfig: hasTokenConfig > 0,\n config: mapping.config,\n overlay: mapping.overlay,\n alwaysOn: mapping.alwaysOn,\n tokens: mapping.tokens,\n tokensString: mapping.tokens?.join(\",\") ?? \"\",\n tokenIDs: mapping.tokens?.length ? \"Assigned Tokens\\n\" + mapping.tokens.join(\"\\n\") + \"\\n\\n[CLICK TO UNASSIGN]\" : \"\",\n disabled: mapping.disabled,\n overlayConfig: mapping.overlayConfig,\n targetActors: mapping.targetActors,\n group: mapping.group,\n parentID: mapping.overlayConfig?.parentID\n };\n }\n async getData(options) {\n const data = super.getData(options);\n data.NO_IMAGE = $ae66c8e3e88183ab$var$NO_IMAGE;\n let mappings = [];\n if (this.object.mappings) mappings = this.object.mappings.map(this._processConfig);\n else {\n const effectMappings = this.globalMappings ?? (0, $9IngI.getFlagMappings)(this.objectToFlag);\n mappings = effectMappings.map(this._processConfig);\n if (this.createMapping && !effectMappings.find((m)=>m.expression === this.createMapping.expression)) mappings.push(this._processConfig(this._getNewEffectConfig(this.createMapping)));\n this.createMapping = null;\n }\n mappings = mappings.sort((m1, m2)=>{\n if (!m1.label && m2.label) return -1;\n else if (m1.label && !m2.label) return 1;\n if (!m1.overlayConfig?.parentID && m2.overlayConfig?.parentID) return -1;\n else if (m1.overlayConfig?.parentID && !m2.overlayConfig?.parentID) return 1;\n let priorityDiff = m1.priority - m2.priority;\n if (priorityDiff === 0) return m1.label.localeCompare(m2.label);\n return priorityDiff;\n });\n const [sMappings, groupedMappings] = $ae66c8e3e88183ab$export$94ded7fcdb9fe2e4(mappings);\n data.groups = Object.keys(groupedMappings);\n this.object.mappings = sMappings;\n data.groupedMappings = groupedMappings;\n data.global = Boolean(this.globalMappings);\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.find(\".delete-mapping\").click(this._onRemove.bind(this));\n html.find(\".clone-mapping\").click(this._onClone.bind(this));\n html.find(\".create-mapping\").click(this._onCreate.bind(this));\n html.find(\".save-mappings\").click(this._onSaveMappings.bind(this));\n if ((0, $9IngI.TVA_CONFIG).permissions.image_path_button[game.user.role]) {\n html.find(\".mapping-image img\").click(this._onImageClick.bind(this));\n html.find(\".mapping-image img\").mousedown(this._onImageMouseDown.bind(this));\n html.find(\".mapping-image video\").click(this._onImageClick.bind(this));\n html.find(\".mapping-target\").click(this._onConfigureApplicableActors.bind(this));\n }\n html.find(\".mapping-image img\").contextmenu(this._onImageRightClick.bind(this));\n html.find(\".mapping-image video\").contextmenu(this._onImageRightClick.bind(this));\n html.find(\".mapping-config i.config\").click(this._onConfigClick.bind(this));\n html.find(\".mapping-config i.config-edit\").click(this._onConfigEditClick.bind(this));\n html.find(\".mapping-config i.config-script\").click(this._onConfigScriptClick.bind(this));\n html.find(\".mapping-overlay i.overlay-config\").click(this._onOverlayConfigClick.bind(this));\n html.on(\"contextmenu\", \".mapping-overlay i.overlay-config\", this._onOverlayConfigRightClick.bind(this));\n html.find(\".mapping-overlay input\").on(\"change\", this._onOverlayChange).trigger(\"change\");\n html.find(\".div-input\").on(\"input paste focus click\", this._onExpressionChange);\n const app = this;\n html.find(\".group-toggle > a\").on(\"click\", this._onGroupToggle.bind(this)).each(function() {\n const group = $(this).closest(\".group-toggle\");\n const groupName = group.data(\"group\");\n if (!$ae66c8e3e88183ab$var$TOGGLED_GROUPS[groupName]) $(this).trigger(\"click\");\n });\n this.setPosition({\n width: 1020\n });\n html.find(\".mapping-disable > input\").on(\"change\", this._onDisable.bind(this));\n html.find(\".group-disable > a\").on(\"click\", this._onGroupDisable.bind(this));\n html.find(\".group-delete\").on(\"click\", this._onGroupDelete.bind(this));\n html.find(\".mapping-group > input\").on(\"change\", this._onGroupChange.bind(this));\n html.find(\".expression-switch\").on(\"click\", this._onExpressionSwitch.bind(this));\n html.find(\".expression-code textarea\").focus((event)=>$(event.target).animate({\n height: \"10em\"\n }, 500, ()=>this.setPosition())).focusout((event)=>$(event.target).animate({\n height: \"1em\"\n }, 500, ()=>{\n if (this._state === Application.RENDER_STATES.RENDERED) this.setPosition();\n }));\n html.find(\".tokens\").on(\"click\", this._onTokensRemove.bind(this));\n }\n async _onTokensRemove(event) {\n await this._onSubmit(event);\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n mapping.tokens = undefined;\n this.render();\n }\n _onExpressionSwitch(event) {\n const container = $(event.target).closest(\".expression-container\");\n const divInput = container.find(\".div-input\");\n const codeExp = container.find(\".expression-code\");\n if (codeExp.hasClass(\"hidden\")) {\n codeExp.removeClass(\"hidden\");\n divInput.addClass(\"hidden\");\n } else {\n codeExp.addClass(\"hidden\");\n divInput.removeClass(\"hidden\");\n }\n }\n async _onDisable(event) {\n const groupName = $(event.target).closest(\".table-row\").data(\"group\");\n const disableGroupToggle = $(event.target).closest(\".token-variant-table\").find(`.group-disable[data-group=\"${groupName}\"]`);\n const checkboxes = $(event.target).closest(\".token-variant-table\").find(`[data-group=\"${groupName}\"] > .mapping-disable`);\n const numChecked = checkboxes.find(\"input:checked\").length;\n if (checkboxes.length !== numChecked) disableGroupToggle.addClass(\"active\");\n else disableGroupToggle.removeClass(\"active\");\n }\n async _onGroupDisable(event) {\n const group = $(event.target).closest(\".group-disable\");\n const groupName = group.data(\"group\");\n const chks = $(event.target).closest(\"form\").find(`[data-group=\"${groupName}\"]`).find(\".mapping-disable > input\");\n if (group.hasClass(\"active\")) {\n group.removeClass(\"active\");\n chks.prop(\"checked\", true);\n } else {\n group.addClass(\"active\");\n chks.prop(\"checked\", false);\n }\n }\n async _onGroupDelete(event) {\n const group = $(event.target).closest(\".group-delete\");\n const groupName = group.data(\"group\");\n await this._onSubmit(event);\n this.object.mappings = this.object.mappings.filter((m)=>m.group !== groupName);\n this.render();\n }\n async _onGroupChange(event) {\n const input = $(event.target);\n let group = input.val().trim();\n if (!group) group = \"Default\";\n input.val(group);\n await this._onSubmit(event);\n this.render();\n }\n _onGroupToggle(event) {\n const group = $(event.target).closest(\".group-toggle\");\n const groupName = group.data(\"group\");\n const form = $(event.target).closest(\"form\");\n form.find(`li[data-group=\"${groupName}\"]`).toggle();\n if (group.hasClass(\"active\")) {\n group.removeClass(\"active\");\n group.find(\"i\").addClass(\"fa-rotate-180\");\n $ae66c8e3e88183ab$var$TOGGLED_GROUPS[groupName] = false;\n } else {\n group.addClass(\"active\");\n group.find(\"i\").removeClass(\"fa-rotate-180\");\n $ae66c8e3e88183ab$var$TOGGLED_GROUPS[groupName] = true;\n }\n game.settings.set(\"token-variants\", \"effectMappingToggleGroups\", $ae66c8e3e88183ab$var$TOGGLED_GROUPS);\n this.setPosition({\n height: \"auto\"\n });\n }\n async _onExpressionChange(event) {\n var el = event.target;\n // Update the hidden input field so that the text entered in the div will be submitted via the form\n $(el).siblings(\"input\").val(event.target.innerText);\n // The rest of the function is to handle operator highlighting and management of the caret position\n if (!el.childNodes.length) return;\n // Calculate the true/total caret offset within the div\n const sel = window.getSelection();\n const focusNode = sel.focusNode;\n let offset = sel.focusOffset;\n for (const ch of el.childNodes){\n if (ch === focusNode || ch.childNodes[0] === focusNode) break;\n offset += ch.nodeName === \"SPAN\" ? ch.innerText.length : ch.length;\n }\n // Highlight the operators and update the div\n let text = $ae66c8e3e88183ab$var$highlightOperators(event.target.innerText);\n $(event.target).html(text);\n // Set the new caret position with the div\n $ae66c8e3e88183ab$var$setCaretPosition(el, offset);\n }\n async _onOverlayChange(event) {\n if (event.target.checked) $(event.target).siblings(\"a\").show();\n else $(event.target).siblings(\"a\").hide();\n }\n async _onOverlayConfigClick(event) {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n new (0, $4rd87.OverlayConfig)(mapping.overlayConfig, (config)=>{\n mapping.overlayConfig = config;\n const gear = $(li).find(\".mapping-overlay > a\");\n if (config?.parentID && config.parentID !== \"TOKEN\") {\n gear.addClass(\"child\");\n gear.attr(\"title\", \"Child Of: \" + config.parentID);\n } else {\n gear.removeClass(\"child\");\n gear.attr(\"title\", \"\");\n }\n }, mapping.id, this.token).render(true);\n }\n async _onOverlayConfigRightClick(event) {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n (0, $cs88A.showOverlayJsonConfigDialog)(mapping.overlayConfig, (config)=>mapping.overlayConfig = config);\n }\n async _toggleActiveControls(event) {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n const tokenConfig = $(event.target).closest(\".mapping-config\").find(\".config\");\n const configEdit = $(event.target).closest(\".mapping-config\").find(\".config-edit\");\n const scriptEdit = $(event.target).closest(\".mapping-config\").find(\".config-script\");\n let hasTokenConfig = Object.keys(mapping.config).filter((k)=>mapping.config[k]).length;\n if (mapping.config.flags) hasTokenConfig--;\n if (mapping.config.tv_script) hasTokenConfig--;\n if (hasTokenConfig) tokenConfig.addClass(\"active\");\n else tokenConfig.removeClass(\"active\");\n if (Object.keys(mapping.config).filter((k)=>mapping.config[k]).length) configEdit.addClass(\"active\");\n else configEdit.removeClass(\"active\");\n if (mapping.config.tv_script) scriptEdit.addClass(\"active\");\n else scriptEdit.removeClass(\"active\");\n }\n async _onConfigScriptClick(event) {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n new (0, $4pjFr.default)(mapping.config?.tv_script, (script)=>{\n if (!mapping.config) mapping.config = {};\n if (script) mapping.config.tv_script = script;\n else delete mapping.config.tv_script;\n this._toggleActiveControls(event);\n }).render(true);\n }\n async _onConfigEditClick(event) {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n new (0, $b9QOF.default)(mapping.config, (config)=>{\n mapping.config = config;\n this._toggleActiveControls(event);\n }).render(true);\n }\n async _onConfigClick(event) {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n new (0, $7P4Bo.default)(this.token, {}, null, null, (config)=>{\n if (!config || isEmpty(config)) {\n config = {};\n config.tv_script = mapping.config.tv_script;\n config.flags = mapping.config.flags;\n }\n mapping.config = config;\n this._toggleActiveControls(event);\n }, mapping.config ? mapping.config : {}).render(true);\n }\n _removeImage(event) {\n const vid = $(event.target).closest(\".mapping-image\").find(\"video\");\n const img = $(event.target).closest(\".mapping-image\").find(\"img\");\n vid.add(img).attr(\"src\", \"\").attr(\"title\", \"\");\n vid.hide();\n img.show();\n img.attr(\"src\", $ae66c8e3e88183ab$var$NO_IMAGE);\n $(event.target).siblings(\".imgSrc\").val(\"\");\n $(event.target).siblings(\".imgName\").val(\"\");\n }\n async _onImageMouseDown(event) {\n if (event.which === 2) this._removeImage(event);\n }\n async _onImageClick(event) {\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n this._removeImage(event);\n return;\n }\n let search = this.token.name;\n if (search === \"Unknown\") {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n search = mapping.label;\n }\n (0, $coMHP.showArtSelect)(search, {\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n callback: (imgSrc, imgName)=>{\n const vid = $(event.target).closest(\".mapping-image\").find(\"video\");\n const img = $(event.target).closest(\".mapping-image\").find(\"img\");\n vid.add(img).attr(\"src\", imgSrc).attr(\"title\", imgName);\n if ((0, $eeGZt.isVideo)(imgSrc)) {\n vid.show();\n img.hide();\n } else {\n vid.hide();\n img.show();\n }\n $(event.target).siblings(\".imgSrc\").val(imgSrc);\n $(event.target).siblings(\".imgName\").val(imgName);\n }\n });\n }\n async _onImageRightClick(event) {\n if ((0, $eeGZt.keyPressed)(\"config\")) {\n this._removeImage(event);\n return;\n }\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n new FilePicker({\n type: \"imagevideo\",\n current: mapping.imgSrc,\n callback: (path)=>{\n const vid = $(event.target).closest(\".mapping-image\").find(\"video\");\n const img = $(event.target).closest(\".mapping-image\").find(\"img\");\n vid.add(img).attr(\"src\", path).attr(\"title\", (0, $eeGZt.getFileName)(path));\n if ((0, $eeGZt.isVideo)(path)) {\n vid.show();\n img.hide();\n } else {\n vid.hide();\n img.show();\n }\n $(event.target).siblings(\".imgSrc\").val(path);\n $(event.target).siblings(\".imgName\").val((0, $eeGZt.getFileName)(path));\n }\n }).render();\n }\n async _onRemove(event) {\n event.preventDefault();\n await this._onSubmit(event);\n const li = event.currentTarget.closest(\".table-row\");\n this.object.mappings.splice(li.dataset.index, 1);\n this.render();\n }\n async _onClone(event) {\n event.preventDefault();\n await this._onSubmit(event);\n const li = event.currentTarget.closest(\".table-row\");\n const clone = deepClone(this.object.mappings[li.dataset.index]);\n clone.label = clone.label + \" - Copy\";\n clone.id = randomID(8);\n this.object.mappings.push(clone);\n this.render();\n }\n async _onCreate(event) {\n event.preventDefault();\n await this._onSubmit(event);\n this.object.mappings.push(this._getNewEffectConfig());\n this.render();\n }\n _getNewEffectConfig({ label: label = \"\", expression: expression = \"\" } = {}) {\n // if (textOverlay) {\n // TOGGLED_GROUPS['Text Overlays'] = true;\n // return {\n // id: randomID(8),\n // label: label,\n // expression: label,\n // highlightedExpression: highlightOperators(label),\n // imgName: '',\n // imgSrc: '',\n // priority: 50,\n // overlay: false,\n // alwaysOn: false,\n // disabled: false,\n // group: 'Text Overlays',\n // overlay: true,\n // overlayConfig: mergeObject(\n // DEFAULT_OVERLAY_CONFIG,\n // {\n // img: '',\n // linkScale: false,\n // linkRotation: false,\n // linkMirror: false,\n // offsetY: 0.5 + Math.round(Math.random() * 0.3 * 100) / 100,\n // offsetX: 0,\n // scaleX: 0.68,\n // scaleY: 0.68,\n // text: {\n // text: '{{effect}}',\n // fontFamily: CONFIG.defaultFontFamily,\n // fontSize: 36,\n // fill: new Color(Math.round(Math.random() * 16777215)).toString(),\n // stroke: '#000000',\n // strokeThickness: 2,\n // dropShadow: false,\n // curve: {\n // radius: 160,\n // invert: false,\n // },\n // },\n // animation: {\n // rotate: true,\n // duration: 10000 + Math.round(Math.random() * 14000) + 10000,\n // clockwise: true,\n // },\n // },\n // { inplace: false }\n // ),\n // };\n // } else {\n $ae66c8e3e88183ab$var$TOGGLED_GROUPS[\"Default\"] = true;\n return mergeObject(deepClone((0, $ce8jp.DEFAULT_ACTIVE_EFFECT_CONFIG)), {\n label: label,\n expression: expression,\n id: randomID(8)\n });\n // }\n }\n _getHeaderButtons() {\n const buttons = super._getHeaderButtons();\n buttons.unshift({\n label: \"Export\",\n class: \"token-variants-export\",\n icon: \"fas fa-file-export\",\n onclick: (ev)=>this._exportConfigs(ev)\n });\n buttons.unshift({\n label: \"Import\",\n class: \"token-variants-import\",\n icon: \"fas fa-file-import\",\n onclick: (ev)=>this._importConfigs(ev)\n });\n buttons.unshift({\n label: \"Templates\",\n class: \"token-variants-templates\",\n icon: \"fa-solid fa-book\",\n onclick: async (ev)=>{\n new (0, $fTFXO.Templates)({\n mappings: this.globalMappings ?? (0, $9IngI.getFlagMappings)(this.objectToFlag),\n callback: (templateName, mappings)=>{\n this._insertMappings(ev, mappings);\n }\n }).render(true);\n }\n });\n if (this.globalMappings) return buttons;\n buttons.unshift({\n label: \"Copy Global Config\",\n class: \"token-variants-copy-global\",\n icon: \"fas fa-globe\",\n onclick: (ev)=>this._copyGlobalConfig(ev)\n });\n buttons.unshift({\n label: \"Open Global\",\n class: \"token-variants-open-global\",\n icon: \"fas fa-globe\",\n onclick: async (ev)=>{\n await this.close();\n new $ae66c8e3e88183ab$export$2e2bcd8739ae039(this.token, {\n globalMappings: true\n }).render(true);\n }\n });\n buttons.unshift({\n label: \"\",\n class: \"token-variants-print-token\",\n icon: \"fa fa-print\",\n onclick: ()=>(0, $cs88A.showTokenCaptureDialog)(canvas.tokens.get(this.token._id))\n });\n return buttons;\n }\n async _exportConfigs(event) {\n let mappings;\n let filename = \"\";\n if (this.globalMappings) {\n mappings = {\n globalMappings: deepClone((0, $9IngI.TVA_CONFIG).globalMappings)\n };\n filename = \"token-variants-global-mappings.json\";\n } else {\n mappings = {\n globalMappings: deepClone((0, $9IngI.getFlagMappings)(this.objectToFlag))\n };\n let actorName = this.objectToFlag.name ?? \"Actor\";\n actorName = actorName.replace(/[/\\\\?%*:|\"<>]/g, \"-\");\n filename = \"token-variants-\" + actorName + \".json\";\n }\n if (mappings && !isEmpty(mappings)) saveDataToFile(JSON.stringify(mappings, null, 2), \"text/json\", filename);\n }\n async _importConfigs(event) {\n const content = await renderTemplate(\"templates/apps/import-data.html\", {\n entity: \"token-variants\",\n name: \"settings\"\n });\n let dialog = new Promise((resolve, reject)=>{\n new Dialog({\n title: \"Import Effect Configurations\",\n content: content,\n buttons: {\n import: {\n icon: '<i class=\"fas fa-file-import\"></i>',\n label: game.i18n.localize(\"token-variants.common.import\"),\n callback: (html)=>{\n const form = html.find(\"form\")[0];\n if (!form.data.files.length) return ui.notifications?.error(\"You did not upload a data file!\");\n readTextFromFile(form.data.files[0]).then((json)=>{\n json = JSON.parse(json);\n if (!json || !(\"globalMappings\" in json)) return ui.notifications?.error(\"No mappings found within the file!\");\n this._insertMappings(event, (0, $9IngI.migrateMappings)(json.globalMappings));\n resolve(true);\n });\n }\n },\n no: {\n icon: '<i class=\"fas fa-times\"></i>',\n label: \"Cancel\",\n callback: (html)=>resolve(false)\n }\n },\n default: \"import\"\n }, {\n width: 400\n }).render(true);\n });\n return await dialog;\n }\n _copyGlobalConfig(event) {\n (0, $cs88A.showMappingSelectDialog)((0, $9IngI.TVA_CONFIG).globalMappings, {\n title1: \"Global Mappings\",\n title2: \"Select Mappings to Copy:\",\n buttonTitle: \"Copy\",\n callback: (mappings)=>{\n this._insertMappings(event, mappings);\n }\n });\n }\n async _insertMappings(event, mappings) {\n const cMappings = deepClone(mappings).map(this._processConfig);\n await this._onSubmit(event);\n (0, $eeGZt.mergeMappings)(cMappings, this.object.mappings);\n this.render();\n }\n _onConfigureApplicableActors(event) {\n const li = event.currentTarget.closest(\".table-row\");\n const mapping = this.object.mappings[li.dataset.index];\n let actorTypes = (game.system.entityTypes ?? game.system.documentTypes)[\"Actor\"];\n let actors = [];\n for (const t of actorTypes){\n const label = CONFIG[\"Actor\"]?.typeLabels?.[t] ?? t;\n actors.push({\n id: t,\n label: game.i18n.has(label) ? game.i18n.localize(label) : t,\n enabled: !mapping.targetActors || mapping.targetActors.includes(t)\n });\n }\n let content = '<form style=\"overflow-y: scroll; height:250x;\">';\n for (const act of actors)content += `\r\n <div class=\"form-group\">\r\n <label>${act.label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"${act.id}\" data-dtype=\"Boolean\" ${act.enabled ? \"checked\" : \"\"}>\r\n </div>\r\n </div>\r\n `;\n content += `</form><div class=\"form-group\"><button type=\"button\" class=\"select-all\">Select all</div>`;\n new Dialog({\n title: `Configure Applicable Actors`,\n content: content,\n buttons: {\n Ok: {\n label: `Save`,\n callback: async (html)=>{\n let targetActors = [];\n html.find('input[type=\"checkbox\"]').each(function() {\n if (this.checked) targetActors.push(this.name);\n });\n mapping.targetActors = targetActors;\n }\n }\n },\n render: (html)=>{\n html.find(\".select-all\").click(()=>{\n html.find('input[type=\"checkbox\"]').prop(\"checked\", true);\n });\n }\n }).render(true);\n }\n // TODO fix this spaghetti code related to globalMappings...\n async _onSaveMappings(event) {\n await this._onSubmit(event);\n if (this.objectToFlag || this.globalMappings) {\n // First filter out empty mappings\n let mappings = this.object.mappings;\n mappings = mappings.filter((m)=>Boolean(m.label?.trim()) || Boolean(m.expression?.trim()));\n // Make sure a priority is assigned\n for (const mapping of mappings){\n mapping.priority = mapping.priority ? mapping.priority : 50;\n mapping.overlayConfig = mapping.overlayConfig ?? {};\n mapping.overlayConfig.label = mapping.label;\n }\n if (mappings.length !== 0) {\n const effectMappings = mappings.map((m)=>mergeObject((0, $ce8jp.DEFAULT_ACTIVE_EFFECT_CONFIG), m, {\n inplace: false,\n insertKeys: false,\n recursive: false\n }));\n if (this.globalMappings) (0, $9IngI.updateSettings)({\n globalMappings: effectMappings\n });\n else await this.objectToFlag.setFlag(\"token-variants\", \"effectMappings\", effectMappings);\n } else if (this.globalMappings) (0, $9IngI.updateSettings)({\n globalMappings: []\n });\n else await this.objectToFlag.unsetFlag(\"token-variants\", \"effectMappings\");\n const tokens = this.globalMappings ? canvas.tokens.placeables : this.objectToFlag.getActiveTokens();\n for (const tkn of tokens){\n if ((0, $9IngI.TVA_CONFIG).filterEffectIcons) await tkn.drawEffects();\n await (0, $dmUqi.updateWithEffectMapping)(tkn);\n (0, $bFZU7.drawOverlays)(tkn);\n }\n // Instruct users on other scenes to refresh the overlays\n const message = {\n handlerName: \"drawOverlays\",\n args: {\n all: true,\n sceneId: canvas.scene.id\n },\n type: \"UPDATE\"\n };\n game.socket?.emit(\"module.token-variants\", message);\n }\n if (this.callback) this.callback();\n this.close();\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n const mappings = expandObject(formData).mappings ?? {};\n // Merge form data with internal mappings\n for(let i = 0; i < this.object.mappings.length; i++){\n const m1 = mappings[i];\n const m2 = this.object.mappings[i];\n m2.id = m1.id;\n m2.label = m1.label.replaceAll(String.fromCharCode(160), \" \");\n m2.expression = m1.expression.replaceAll(String.fromCharCode(160), \" \");\n m2.codeExp = m1.codeExp?.trim();\n m2.imgSrc = m1.imgSrc;\n m2.imgName = m1.imgName;\n m2.priority = m1.priority;\n m2.overlay = m1.overlay;\n m2.alwaysOn = m1.alwaysOn;\n m2.tokens = m1.tokens?.split(\",\");\n m2.disabled = m1.disabled;\n m2.group = m1.group;\n }\n }\n}\n// Insert <span/> around operators\nfunction $ae66c8e3e88183ab$var$highlightOperators(text) {\n // text = text.replaceAll(' ', ' ');\n const re = new RegExp('([a-zA-Z\\\\.\\\\-\\\\|\\\\+]+)([><=]+)(\".*?\"|-?\\\\d+)(%{0,1})', `gi`);\n text = text.replace(re, function replace(match) {\n return '<span class=\"hp-expression\">' + match + \"</span>\";\n });\n for (const op of [\n \"\\\\(\",\n \"\\\\)\",\n \"&&\",\n \"||\",\n \"\\\\!\",\n \"\\\\*\",\n \"\\\\{\",\n \"\\\\}\"\n ])text = text.replaceAll(op, `<span>${op}</span>`);\n return text;\n}\n// Move caret to a specific point in a DOM element\nfunction $ae66c8e3e88183ab$var$setCaretPosition(el, pos) {\n for (var node of el.childNodes)// Check if it's a text node\n if (node.nodeType == 3) {\n if (node.length >= pos) {\n var range = document.createRange(), sel = window.getSelection();\n range.setStart(node, pos);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n return -1; // We are done\n } else pos -= node.length;\n } else {\n pos = $ae66c8e3e88183ab$var$setCaretPosition(node, pos);\n if (pos == -1) return -1; // No need to finish the for loop\n }\n return pos;\n}\nfunction $ae66c8e3e88183ab$export$94ded7fcdb9fe2e4(mappings) {\n mappings.sort((m1, m2)=>{\n if (!m1.label && m2.label) return -1;\n else if (m1.label && !m2.label) return 1;\n if (!m1.overlayConfig?.parentID && m2.overlayConfig?.parentID) return -1;\n else if (m1.overlayConfig?.parentID && !m2.overlayConfig?.parentID) return 1;\n let priorityDiff = m1.priority - m2.priority;\n if (priorityDiff === 0) return m1.label.localeCompare(m2.label);\n return priorityDiff;\n });\n let groupedMappings = {\n Default: {\n list: [],\n active: false\n }\n };\n mappings.forEach((mapping, index)=>{\n mapping.i = index; // assign so that we can reference the mapping inside of an array\n if (!mapping.group || !mapping.group.trim()) mapping.group = \"Default\";\n if (!(mapping.group in groupedMappings)) groupedMappings[mapping.group] = {\n list: [],\n active: false\n };\n if (!mapping.disabled) groupedMappings[mapping.group].active = true;\n groupedMappings[mapping.group].list.push(mapping);\n });\n return [\n mappings,\n groupedMappings\n ];\n}\n\n});\nparcelRequire.register(\"b9QOF\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $81f98126905c9c34$export$2e2bcd8739ae039);\nclass $81f98126905c9c34$export$2e2bcd8739ae039 extends FormApplication {\n constructor(config, callback){\n super({}, {});\n this.config = config;\n this.callback = callback;\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-config-json-edit\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/configJsonEdit.html\",\n resizable: true,\n minimizable: false,\n title: \"Edit Token Configuration\",\n width: 400,\n height: 380\n });\n }\n async getData(options) {\n const data = super.getData(options);\n data.hasConfig = this.config != null && Object.keys(this.config).length !== 0;\n data.config = JSON.stringify(data.hasConfig ? this.config : {}, null, 2);\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.on(\"input\", \".command textarea\", this._validateJSON.bind(this));\n // Override 'Tab' key to insert spaces\n html.on(\"keydown\", \".command textarea\", function(e) {\n if (e.key === \"Tab\" && !e.shiftKey) {\n e.preventDefault();\n var start = this.selectionStart;\n var end = this.selectionEnd;\n this.value = this.value.substring(0, start) + \" \" + this.value.substring(end);\n this.selectionStart = this.selectionEnd = start + 2;\n return false;\n }\n });\n html.find(\".remove\").click(this._onRemove.bind(this));\n html.find(\".format\").click(this._onFormat.bind(this));\n }\n async _validateJSON(event) {\n const controls = $(event.target).closest(\"form\").find('button[type=\"submit\"], button.format');\n try {\n this.config = JSON.parse(event.target.value);\n this.config = expandObject(this.config);\n this.flag = this.config.flag;\n controls.prop(\"disabled\", false);\n } catch (e) {\n controls.prop(\"disabled\", true);\n }\n }\n async _onRemove(event) {\n this.config = {};\n this.submit();\n }\n async _onFormat(event) {\n $(event.target).closest(\"form\").find('textarea[name=\"config\"]').val(JSON.stringify(this.config, null, 2));\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n if (this.callback) this.callback(this.config);\n }\n}\n\n});\n\nparcelRequire.register(\"4pjFr\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $3358c0bca9192065$export$2e2bcd8739ae039);\nclass $3358c0bca9192065$export$2e2bcd8739ae039 extends FormApplication {\n constructor(script, callback){\n super({}, {});\n this.script = script;\n this.callback = callback;\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-config-script-edit\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/configScriptEdit.html\",\n resizable: true,\n minimizable: false,\n title: \"Scripts\",\n width: 640,\n height: 640\n });\n }\n async getData(options) {\n const data = super.getData(options);\n const script = this.script ? this.script : {};\n data.hasScript = !isEmpty(script);\n data.onApply = script.onApply;\n data.onRemove = script.onRemove;\n data.macroOnApply = script.macroOnApply;\n data.macroOnRemove = script.macroOnRemove;\n data.tmfxPreset = script.tmfxPreset;\n data.tmfxActive = game.modules.get(\"tokenmagic\")?.active;\n if (data.tmfxActive) data.tmfxPresets = TokenMagic.getPresets().map((p)=>p.name);\n data.ceActive = game.modules.get(\"dfreds-convenient-effects\")?.active;\n if (data.ceActive) {\n data.ceEffect = script.ceEffect ?? {\n apply: true,\n remove: true\n };\n data.ceEffects = game.dfreds.effects.all.map((ef)=>ef.name);\n }\n data.macros = game.macros.map((m)=>m.name);\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n // Override 'Tab' key to insert spaces\n html.on(\"keydown\", \".command textarea\", function(e) {\n if (e.key === \"Tab\" && !e.shiftKey) {\n e.preventDefault();\n var start = this.selectionStart;\n var end = this.selectionEnd;\n this.value = this.value.substring(0, start) + \" \" + this.value.substring(end);\n this.selectionStart = this.selectionEnd = start + 2;\n return false;\n }\n });\n html.find(\".remove\").click(this._onRemove.bind(this));\n }\n async _onRemove(event) {\n if (this.callback) this.callback(null);\n this.close();\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n formData = expandObject(formData);\n [\n \"onApply\",\n \"onRemove\",\n \"macroOnApply\",\n \"macroOnRemove\"\n ].forEach((k)=>{\n formData[k] = formData[k].trim();\n });\n if (formData.ceEffect?.name) formData.ceEffect.name = formData.ceEffect.name.trim();\n if (!formData.onApply && !formData.onRemove && !formData.tmfxPreset && !formData.ceEffect.name && !formData.macroOnApply && !formData.macroOnRemove) {\n if (this.callback) this.callback(null);\n } else if (this.callback) this.callback(formData);\n }\n}\n\n});\n\nparcelRequire.register(\"cs88A\", function(module, exports) {\n\n$parcel$export(module.exports, \"showOverlayJsonConfigDialog\", () => $910e697db31bb090$export$d4bc2f83b9e95fdf);\n$parcel$export(module.exports, \"showPathSelectCategoryDialog\", () => $910e697db31bb090$export$184d7e04bfe8244d);\n$parcel$export(module.exports, \"showPathSelectConfigForm\", () => $910e697db31bb090$export$1d34adfb3ae1b);\n$parcel$export(module.exports, \"showTokenCaptureDialog\", () => $910e697db31bb090$export$e032b3f67a64b8e9);\n$parcel$export(module.exports, \"showMappingSelectDialog\", () => $910e697db31bb090$export$398865504eddc155);\n$parcel$export(module.exports, \"showUserTemplateCreateDialog\", () => $910e697db31bb090$export$667fc7c48dd97753);\n$parcel$export(module.exports, \"toggleTemplateDialog\", () => $910e697db31bb090$export$51c95b54ea3e6a53);\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\nparcelRequire(\"hClLE\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $eYkM9 = parcelRequire(\"eYkM9\");\n\nvar $fTFXO = parcelRequire(\"fTFXO\");\n\nvar $7P4Bo = parcelRequire(\"7P4Bo\");\nfunction $910e697db31bb090$export$d4bc2f83b9e95fdf(overlayConfig, callback) {\n const config = deepClone(overlayConfig || {});\n delete config.effect;\n let content = `<div style=\"height: 300px;\" class=\"form-group stacked command\"><textarea style=\"height: 300px;\" class=\"configJson\">${JSON.stringify(config, null, 2)}</textarea></div>`;\n new Dialog({\n title: `Overlay Configuration`,\n content: content,\n buttons: {\n yes: {\n icon: \"<i class='fas fa-save'></i>\",\n label: \"Save\",\n callback: (html)=>{\n let json = $(html).find(\".configJson\").val();\n if (json) try {\n json = JSON.parse(json);\n } catch (e) {\n console.warn(`TVA |`, e);\n json = {};\n }\n else json = {};\n callback(json);\n }\n }\n },\n default: \"yes\"\n }).render(true);\n}\nasync function $910e697db31bb090$export$184d7e04bfe8244d(event) {\n event.preventDefault();\n const typesInput = $(event.target).closest(\".path-category\").find(\"input\");\n const selectedTypes = typesInput.val().split(\",\");\n const categories = (0, $eeGZt.BASE_IMAGE_CATEGORIES).concat((0, $9IngI.TVA_CONFIG).customImageCategories);\n let content = '<div class=\"token-variants-popup-settings\">';\n // Split into rows of 4\n const splits = [];\n let currSplit = [];\n for(let i = 0; i < categories.length; i++){\n if (i > 0 && i + 1 != categories.length && i % 4 == 0) {\n splits.push(currSplit);\n currSplit = [];\n }\n currSplit.push(categories[i]);\n }\n if (currSplit.length) splits.push(currSplit);\n for (const split of splits){\n content += '<header class=\"table-header flexrow\">';\n for (const type of split)content += `<label>${type}</label>`;\n content += '</header><ul class=\"setting-list\"><li class=\"setting form-group\"><div class=\"form-fields\">';\n for (const type of split)content += `<input class=\"category\" type=\"checkbox\" name=\"${type}\" data-dtype=\"Boolean\" ${selectedTypes.includes(type) ? \"checked\" : \"\"}>`;\n content += \"</div></li></ul>\";\n }\n content += \"</div>\";\n new Dialog({\n title: `Image Categories/Filters`,\n content: content,\n buttons: {\n yes: {\n icon: \"<i class='fas fa-save'></i>\",\n label: \"Apply\",\n callback: (html)=>{\n const types = [];\n $(html).find(\".category\").each(function() {\n if ($(this).is(\":checked\")) types.push($(this).attr(\"name\"));\n });\n typesInput.val(types.join(\",\"));\n }\n }\n },\n default: \"yes\"\n }).render(true);\n}\nasync function $910e697db31bb090$export$1d34adfb3ae1b(event) {\n event.preventDefault();\n const configInput = $(event.target).closest(\".path-config\").find(\"input\");\n let config = {};\n try {\n config = JSON.parse(configInput.val());\n } catch (e) {}\n const setting = game.settings.get(\"core\", DefaultTokenConfig.SETTING);\n const data = new foundry.data.PrototypeToken(setting);\n const token = new TokenDocument(data, {\n actor: null\n });\n new (0, $7P4Bo.default)(token, {}, null, null, (conf)=>{\n if (!conf) conf = {};\n if (conf.flags == null || isEmpty(conf.flags)) delete conf.flags;\n configInput.val(JSON.stringify(conf));\n const cog = configInput.siblings(\".select-config\");\n if (isEmpty(conf)) cog.removeClass(\"active\");\n else cog.addClass(\"active\");\n }, config).render(true);\n}\nasync function $910e697db31bb090$export$e032b3f67a64b8e9(token) {\n if (!token) return;\n let content = `<form>\r\n<div class=\"form-group\">\r\n <label>Image Name</label>\r\n <input type=\"text\" name=\"name\" value=\"${token.name}\">\r\n</div>\r\n<div class=\"form-group\">\r\n <label>Image Path</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"path\" value=\"modules/token-variants/\">\r\n <button type=\"button\" class=\"file-picker\" data-type=\"folder\" data-target=\"path\" title=\"Browse Folders\" tabindex=\"-1\">\r\n <i class=\"fas fa-file-import fa-fw\"></i>\r\n </button>\r\n </div>\r\n</div>\r\n<div class=\"form-group slim\">\r\n <label>Width <span class=\"units\">(pixels)</span></label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" step=\"1\" name=\"width\" value=\"${token.mesh.texture.width}\">\r\n </div>\r\n</div>\r\n<div class=\"form-group slim\">\r\n <label>Height <span class=\"units\">(pixels)</span></label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" step=\"1\" name=\"height\" value=\"${token.mesh.texture.height}\">\r\n </div>\r\n</div>\r\n<div class=\"form-group slim\">\r\n <label>Scale</label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" step=\"any\" name=\"scale\" value=\"3\">\r\n </div>\r\n</div>\r\n</form>`;\n new Dialog({\n title: `Save Token/Overlay Image`,\n content: content,\n buttons: {\n yes: {\n icon: \"<i class='fas fa-save'></i>\",\n label: \"Save\",\n callback: (html)=>{\n const options = {};\n $(html).find(\"[name]\").each(function() {\n let val = parseFloat(this.value);\n if (isNaN(val)) val = this.value;\n options[this.name] = val;\n });\n (0, $eeGZt.uploadTokenImage)(token, options);\n }\n }\n },\n render: (html)=>{\n html.find(\".file-picker\").click(()=>{\n new FilePicker({\n type: \"folder\",\n current: html.find('[name=\"path\"]').val(),\n callback: (path)=>{\n html.find('[name=\"path\"]').val(path);\n }\n }).render();\n });\n },\n default: \"yes\"\n }).render(true);\n}\nfunction $910e697db31bb090$export$398865504eddc155(mappings, { title1: title1 = \"Mappings\", title2: title2 = \"Select Mappings\", buttonTitle: buttonTitle = \"Confirm\", callback: callback = null } = {}) {\n if (!mappings || !mappings.length) return;\n let content = `<form style=\"overflow-y: scroll; height:400px;\"><h2>${title2}</h2>`;\n const [_, mappingGroups] = (0, $eYkM9.sortMappingsToGroups)(mappings);\n for (const [group, obj] of Object.entries(mappingGroups))if (obj.list.length) {\n content += `<h4 style=\"text-align:center;\"><b>${group}</b></h4>`;\n for (const mapping of obj.list)content += `\r\n <div class=\"form-group\">\r\n <label>${mapping.label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"${mapping.id}\" data-dtype=\"Boolean\">\r\n </div>\r\n </div>\r\n `;\n }\n content += `</form><div class=\"form-group\"><button type=\"button\" class=\"select-all\">Select all</div>`;\n new Dialog({\n title: title1,\n content: content,\n buttons: {\n Ok: {\n label: buttonTitle,\n callback: async (html)=>{\n if (!callback) return;\n const selectedMappings = [];\n html.find('input[type=\"checkbox\"]').each(function() {\n if (this.checked) {\n const mapping = mappings.find((m)=>m.id === this.name);\n if (mapping) {\n const cMapping = deepClone(mapping);\n selectedMappings.push(cMapping);\n delete cMapping.targetActors;\n }\n }\n });\n callback(selectedMappings);\n }\n }\n },\n render: (html)=>{\n html.find(\".select-all\").click(()=>{\n html.find('input[type=\"checkbox\"]').prop(\"checked\", true);\n });\n }\n }).render(true);\n}\nfunction $910e697db31bb090$export$667fc7c48dd97753(mappings) {\n let content = `\r\n<div class=\"form-group\">\r\n <label>Template Name</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"templateName\" data-dtype=\"String\" value=\"\">\r\n </div>\r\n</div>\r\n<div class=\"form-group\">\r\n <label>Hover Text (optional)</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"templateHint\" data-dtype=\"String\" value=\"\">\r\n </div>\r\n</div>\r\n<div class=\"form-group\">\r\n <label>Hover Image (optional)</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"img\" data-dtype=\"String\" value=\"\">\r\n </div>\r\n</div>`;\n let dialog;\n dialog = new Dialog({\n title: \"Mapping Templates\",\n content: content,\n buttons: {\n create: {\n label: \"Create Template\",\n callback: (html)=>{\n const name = html.find('[name=\"templateName\"]').val().trim();\n const hint = html.find('[name=\"templateHint\"]').val().trim();\n const img = html.find('[name=\"img\"]').val().trim();\n if (name.trim()) {\n (0, $9IngI.TVA_CONFIG).templateMappings.push({\n id: randomID(),\n name: name,\n hint: hint,\n img: img,\n mappings: deepClone(mappings)\n });\n (0, $9IngI.updateSettings)({\n templateMappings: (0, $9IngI.TVA_CONFIG).templateMappings\n });\n }\n }\n },\n cancel: {\n label: \"Cancel\"\n }\n },\n default: \"cancel\"\n });\n dialog.render(true);\n}\nfunction $910e697db31bb090$export$51c95b54ea3e6a53() {\n new (0, $fTFXO.Templates)({\n callback: (templateName, mappings)=>(0, $dmUqi.toggleTemplateOnSelected)(templateName, mappings)\n }).render(true);\n}\n\n});\nparcelRequire.register(\"hClLE\", function(module, exports) {\n\n$parcel$export(module.exports, \"CORE_TEMPLATES\", () => $cd36ded98345a0c2$export$8af7a3ae7ecba113);\nconst $cd36ded98345a0c2$export$8af7a3ae7ecba113 = [\n {\n name: \"Tint Red when HP is bellow 10%\",\n hint: \"Tint token red when HP falls bellow 10%\",\n img: \"https://user-images.githubusercontent.com/7693704/243428871-c52130b3-2f12-4de7-a86e-fabc67e865a9.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"MmLSOlJx\",\n label: \"Tint Red\",\n expression: \"hp<=10%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {\n texture: {\n tint: \"#ff0000\"\n }\n },\n overlay: false,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n label: \"Tint Red\"\n },\n group: \"Low HP\",\n i: 0\n }\n ],\n id: \"Ob9LP35K\"\n },\n {\n name: \"Health State Text Overlay\",\n hint: `Displays text overlay based on percentage health. \\n0% < hp <= 25% : Critical\\n25% < hp <= 50% : Bloodied\\n50% < hp <= 75% : Wounded\\n75% < hp : Healthy`,\n img: \"https://user-images.githubusercontent.com/7693704/243426356-ceab629c-c16c-42b3-9004-af7dafb62eb7.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"jqaFdwkQ\",\n label: \"Bloodied\",\n expression: \"hp>25% && hp<=50%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Bloodied\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ff5900\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Bloodied\",\n id: \"jqaFdwkQ\"\n },\n group: \"Health State Overlay\",\n i: 0\n },\n {\n id: \"m4GQVz5O\",\n label: \"Critical\",\n expression: \"hp>0 && hp<=25%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Critical\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ff0000\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Critical\",\n id: \"m4GQVz5O\"\n },\n group: \"Health State Overlay\",\n i: 1\n },\n {\n id: \"H1wrS5N1\",\n label: \"Healthy\",\n expression: \"hp>75%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Healthy\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#2bff00\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Healthy\",\n id: \"H1wrS5N1\"\n },\n group: \"Health State Overlay\",\n i: 2\n },\n {\n id: \"IojJZS7v\",\n label: \"Wounded\",\n expression: \"hp>50% && hp<=75%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Wounded\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ffbb00\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Wounded\",\n id: \"IojJZS7v\"\n },\n group: \"Health State Overlay\",\n i: 3\n }\n ],\n id: \"JNClkgGU\"\n },\n {\n name: \"Health State Text Overlay - Passed Check\",\n hint: \"Same as Health State Text Overlay except also requiring the Token actor to have Reveal Health active effect applied to it.\",\n img: \"https://user-images.githubusercontent.com/7693704/243429385-f62b111c-3d9c-4cd8-9c27-f5b13e09fea2.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"k0XbFE7a\",\n label: \"Bloodied\",\n expression: \"Reveal Health && hp>25% && hp<=50%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Bloodied\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ff5900\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Bloodied\",\n id: \"k0XbFE7a\"\n },\n group: \"Health State Overlay - Passed Check\",\n i: 0\n },\n {\n id: \"a1VxhnWK\",\n label: \"Critical\",\n expression: \"Reveal Health && hp>0 && hp<=25%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Critical\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ff0000\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Critical\",\n id: \"a1VxhnWK\"\n },\n group: \"Health State Overlay - Passed Check\",\n i: 1\n },\n {\n id: \"DNuBTXe8\",\n label: \"Healthy\",\n expression: \"Reveal Health && hp>75%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Healthy\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#2bff00\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Healthy\",\n id: \"DNuBTXe8\"\n },\n group: \"Health State Overlay - Passed Check\",\n i: 2\n },\n {\n id: \"ROPjrvLu\",\n label: \"Wounded\",\n expression: \"Reveal Health && hp>50% && hp<=75%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.51,\n scaleX: 0.76,\n scaleY: 0.76,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Wounded\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ffbb00\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: null\n }\n },\n label: \"Wounded\",\n id: \"ROPjrvLu\"\n },\n group: \"Health State Overlay - Passed Check\",\n i: 3\n }\n ],\n id: \"0ZJQiOdD\"\n },\n {\n name: \"Fancy Nameplate\",\n hint: \"Displays a curved red nameplate underneath the token.\",\n img: \"https://user-images.githubusercontent.com/7693704/244439674-12510686-2f72-44b3-8a1d-e6cc7fbb00c6.png\",\n mappings: [\n {\n id: \"DTbwvQiG\",\n label: \"Token Nameplate\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n parent: \"\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionX: false,\n linkDimensionY: false,\n linkOpacity: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: -0.51,\n scaleX: 0.68,\n scaleY: 0.68,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"{{name}}\",\n fontFamily: \"Modesto Condensed\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ff0000\",\n dropShadow: \"true\",\n strokeThickness: 3,\n stroke: \"#111111\",\n curve: {\n radius: 450,\n invert: true\n }\n },\n shapes: [\n {\n line: {\n width: 1,\n color: \"#111111\",\n alpha: 1\n },\n fill: {\n color: \"#111111\",\n alpha: 1\n }\n }\n ],\n label: \"Token Nameplate\"\n },\n group: \"Nameplate\",\n i: 0\n }\n ],\n id: \"Ik1uNcWU\"\n },\n {\n name: \"Info Box #1\",\n hint: \"Displays information about the token/actor when hovering over or controlling them. This box will adjust to canvas zoom.\",\n img: \"https://user-images.githubusercontent.com/7693704/244441852-b50f3ca6-e0c3-4ce0-b498-ddd00edcbdca.png\",\n system: \"dnd5e\",\n group: \"Info\",\n mappings: [\n {\n id: \"W8BPK9hv\",\n label: \"Box Background\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"W8BPK9hv\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: true,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.55,\n offsetY: 0,\n scaleX: 0.73,\n scaleY: 0.73,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"DropShadowFilter\",\n filterOptions: {\n rotation: 45,\n distance: 16.9,\n color: \"#000000\",\n alpha: 0.52,\n shadowOnly: false,\n blur: 2,\n quality: 3\n },\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: true,\n limitOnHighlight: false,\n limitOnControl: true,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"rectangle\",\n x: \"0\",\n y: \"0\",\n width: \"450\",\n height: \"200\",\n radius: \"0\"\n },\n label: \"\",\n line: {\n width: 2,\n color: \"#ffffff\",\n alpha: 1\n },\n fill: {\n color: \"#508fe2\",\n color2: \"\",\n prc: \"\",\n alpha: 0.55\n }\n }\n ],\n effect: \"\",\n label: \"Box Background\"\n },\n group: \"Info Box\",\n i: 0\n },\n {\n id: \"bkoP4Qpo\",\n label: \"Legendary Actions\",\n expression: \"actor.system.resources.legact.max>0\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n id: \"bkoP4Qpo\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.47,\n offsetY: -0.02,\n scaleX: 0.5,\n scaleY: 0.5,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Legendary: Action {{actor.system.resources.legact.value}}/{{actor.system.resources.legact.max}} Resistance {{actor.system.resources.legres.value}}/{{actor.system.resources.legres.max}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Legendary Actions\"\n },\n group: \"Info Box\",\n i: 1\n },\n {\n id: \"OvcWUW13\",\n label: \"Mods\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"OvcWUW13\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: -0.38,\n scaleX: 0.57,\n scaleY: 0.57,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"STR {{actor.system.abilities.str.mod}} DEX {{actor.system.abilities.dex.mod}} CON {{actor.system.abilities.con.mod}} INT {{actor.system.abilities.int.mod}} WIS {{actor.system.abilities.wis.mod}} CHA {{actor.system.abilities.cha.mod}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Mods\"\n },\n group: \"Info Box\",\n i: 2\n },\n {\n id: \"jybTYLTB\",\n label: \"Token Name\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 51,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"jybTYLTB\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.47,\n offsetY: 0.35,\n scaleX: 0.77,\n scaleY: 0.77,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Name: {{name}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Token Name\"\n },\n group: \"Info Box\",\n i: 3\n },\n {\n id: \"bGbHPbw6\",\n label: \"HP\",\n expression: \"hp>40%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 52,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n id: \"bGbHPbw6\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.47,\n offsetY: 0.23,\n scaleX: 0.82,\n scaleY: 0.82,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"HP: {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#6b6b6b\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"HP\"\n },\n group: \"Info Box\",\n i: 4\n },\n {\n id: \"S9gXdyGY\",\n label: \"Low HP\",\n expression: \"hp<=40%\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 52,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n id: \"S9gXdyGY\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.47,\n offsetY: 0.23,\n scaleX: 0.82,\n scaleY: 0.82,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"HP: {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#ff0000\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#6b6b6b\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Low HP\"\n },\n group: \"Info Box\",\n i: 5\n },\n {\n id: \"k9Ws74Hc\",\n label: \"Actor AC\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 53,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"k9Ws74Hc\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.25,\n offsetY: 0.46,\n scaleX: 1,\n scaleY: 1,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"AC: {{actor.system.attributes.ac.value}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Actor AC\"\n },\n group: \"Info Box\",\n i: 6\n },\n {\n id: \"eIxjLZmy\",\n label: \"Movement Label\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 54,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"eIxjLZmy\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.25,\n offsetY: 0.2,\n scaleX: 0.61,\n scaleY: 0.61,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Movement\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Movement Label\"\n },\n group: \"Info Box\",\n i: 7\n },\n {\n id: \"k5xYpZAZ\",\n label: \"Movement Walk\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 55,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"k5xYpZAZ\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.36,\n offsetY: -0.03,\n scaleX: 1,\n scaleY: 1,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"{{actor.system.attributes.movement.walk}}ft\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Movement Walk\"\n },\n group: \"Info Box\",\n i: 8\n },\n {\n id: \"dHHZRQXG\",\n label: \"Movement Fly\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 56,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"dHHZRQXG\",\n parentID: \"W8BPK9hv\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.36,\n offsetY: -0.16,\n scaleX: 0.33,\n scaleY: 0.33,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Fly {{actor.system.attributes.movement.fly}}, Swim {{actor.system.attributes.movement.swim}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Movement Fly\"\n },\n group: \"Info Box\",\n i: 9\n }\n ],\n id: \"wuMcLy3T\"\n },\n {\n name: \"Info Box #2\",\n hint: \"Displays information about the token/actor when hovering over or controlling them. This box will adjust to canvas zoom.\",\n img: \"https://user-images.githubusercontent.com/7693704/244750685-81988600-5153-4d29-acb0-2c62111bed14.png\",\n system: \"dnd5e\",\n mappings: [\n {\n id: \"f0pV6Pnl\",\n label: \"Box Background\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"f0pV6Pnl\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: true,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.55,\n offsetY: 0,\n scaleX: 1,\n scaleY: 1,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: true,\n limitOnHighlight: false,\n limitOnControl: true,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"rectangle\",\n x: \"0\",\n y: \"0\",\n width: \"200\",\n height: \"300\",\n radius: \"0\"\n },\n label: \"\",\n line: {\n width: 2,\n color: \"#ffffff\",\n alpha: 1\n },\n fill: {\n color: \"#2e5a94\",\n color2: \"\",\n prc: \"\",\n alpha: 0.9\n }\n }\n ],\n effect: \"\",\n label: \"Box Background\"\n },\n group: \"Info Box #2\",\n i: 0\n },\n {\n id: \"n2Adi1fi\",\n label: \"HP\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 51,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"n2Adi1fi\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.45,\n offsetY: 0.42,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"HP: {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"HP\"\n },\n group: \"Info Box #2\",\n i: 1\n },\n {\n id: \"hCKVzw3Z\",\n label: \" AC\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 52,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"hCKVzw3Z\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.45,\n offsetY: 0.31,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"AC: {{actor.system.attributes.ac.value}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \" AC\"\n },\n group: \"Info Box #2\",\n i: 2\n },\n {\n id: \"2nYmUTwu\",\n label: \" Speed\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 53,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"2nYmUTwu\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.45,\n offsetY: 0.2,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Speed: {{actor.system.attributes.movement.walk}}ft\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \" Speed\"\n },\n group: \"Info Box #2\",\n i: 3\n },\n {\n id: \"s1NtDiUV\",\n label: \"Perception\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 54,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"s1NtDiUV\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0.15,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Perception\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Perception\"\n },\n group: \"Info Box #2\",\n i: 4\n },\n {\n id: \"jYeRIoG2\",\n label: \"Passive Perception\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 55,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"jYeRIoG2\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.47,\n offsetY: 0,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Passive: {{actor.system.skills.prc.passive}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Passive Perception\"\n },\n group: \"Info Box #2\",\n i: 5\n },\n {\n id: \"KYMdkTVI\",\n label: \"Active Perception\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 56,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"KYMdkTVI\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.48,\n offsetY: 0,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 1,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Active: {{actor.system.skills.prc.total}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Active Perception\"\n },\n group: \"Info Box #2\",\n i: 6\n },\n {\n id: \"Ewbg54II\",\n label: \"CHA\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"Ewbg54II\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.31,\n offsetY: -0.3,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"CHA\\\\n{{actor.system.abilities.cha.mod}} {{actor.system.abilities.cha.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"CHA\"\n },\n group: \"Info Box #2\",\n i: 7\n },\n {\n id: \"2le1Nagp\",\n label: \"CON\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"2le1Nagp\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.31,\n offsetY: -0.11,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"CON\\\\n{{actor.system.abilities.con.mod}} {{actor.system.abilities.con.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"CON\"\n },\n group: \"Info Box #2\",\n i: 8\n },\n {\n id: \"ahKmjzLj\",\n label: \"DEX\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"ahKmjzLj\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: -0.11,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"DEX\\\\n{{actor.system.abilities.dex.mod}} {{actor.system.abilities.dex.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"DEX\"\n },\n group: \"Info Box #2\",\n i: 9\n },\n {\n id: \"gQzyq0zm\",\n label: \"INT\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"gQzyq0zm\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.32,\n offsetY: -0.3,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"INT\\\\n{{actor.system.abilities.int.mod}} {{actor.system.abilities.int.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"INT\"\n },\n group: \"Info Box #2\",\n i: 10\n },\n {\n id: \"hYGg1oAt\",\n label: \"STR\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"hYGg1oAt\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.32,\n offsetY: -0.11,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"STR\\\\n{{actor.system.abilities.str.mod}} {{actor.system.abilities.str.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"STR\"\n },\n group: \"Info Box #2\",\n i: 11\n },\n {\n id: \"uQ5zS3K6\",\n label: \"WIS\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"uQ5zS3K6\",\n parentID: \"f0pV6Pnl\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: -0.3,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"WIS\\\\n{{actor.system.abilities.wis.mod}} {{actor.system.abilities.wis.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"WIS\"\n },\n group: \"Info Box #2\",\n i: 12\n }\n ],\n id: \"Wtq9HDsX\"\n },\n {\n name: \"Info Box #3\",\n hint: \"Displays information about the token/actor when hovering over or controlling them. This box will adjust to canvas zoom.\",\n img: \"https://user-images.githubusercontent.com/7693704/244750246-794625b9-9e1d-4322-9265-fc295f02ca2b.png\",\n system: \"dnd5e\",\n mappings: [\n {\n id: \"Gt11vjXV\",\n label: \"Box Background\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"Gt11vjXV\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: true,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.55,\n offsetY: 0,\n scaleX: 1,\n scaleY: 1,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: true,\n limitOnHighlight: false,\n limitOnControl: true,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"rectangle\",\n x: \"0\",\n y: \"0\",\n width: \"240\",\n height: \"300\",\n radius: \"0\"\n },\n label: \"\",\n line: {\n width: 2,\n color: \"#ffffff\",\n alpha: 1\n },\n fill: {\n color: \"#2e5a94\",\n color2: \"\",\n prc: \"\",\n alpha: 0.9\n }\n }\n ],\n effect: \"\",\n label: \"Box Background\"\n },\n group: \"Info Box #3\",\n i: 0\n },\n {\n id: \"o4XWzdDM\",\n label: \"HP\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 51,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"o4XWzdDM\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.44,\n offsetY: 0.42,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \" {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"HP\"\n },\n group: \"Info Box #3\",\n i: 1\n },\n {\n id: \"eAv2dSV6\",\n label: \"AC\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 52,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"eAv2dSV6\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.43,\n offsetY: 0.28,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \" {{actor.system.attributes.ac.value}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"AC\"\n },\n group: \"Info Box #3\",\n i: 2\n },\n {\n id: \"SCfkWTni\",\n label: \"Fly Speed\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 53,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"SCfkWTni\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.04,\n offsetY: 0.13,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \" {{actor.system.attributes.movement.fly}}ft\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Fly Speed\"\n },\n group: \"Info Box #3\",\n i: 3\n },\n {\n id: \"e5LPzVta\",\n label: \"Walk Speed\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 53,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"e5LPzVta\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.45,\n offsetY: 0.13,\n scaleX: 0.84,\n scaleY: 0.84,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \" {{actor.system.attributes.movement.walk}}ft\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Walk Speed\"\n },\n group: \"Info Box #3\",\n i: 4\n },\n {\n id: \"XlopagaT\",\n label: \"Passive Perception\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 55,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"XlopagaT\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.45,\n offsetY: -0.02,\n scaleX: 0.83,\n scaleY: 0.83,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \" {{actor.system.skills.prc.passive}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Passive Perception\"\n },\n group: \"Info Box #3\",\n i: 5\n },\n {\n id: \"CeXgVxA0\",\n label: \"Active Perception\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 56,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"CeXgVxA0\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.03,\n offsetY: -0.02,\n scaleX: 0.83,\n scaleY: 0.83,\n angle: 0,\n anchor: {\n x: 0,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \" {{actor.system.skills.prc.total}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Active Perception\"\n },\n group: \"Info Box #3\",\n i: 6\n },\n {\n id: \"0WWf1iGM\",\n label: \"CHA\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"0WWf1iGM\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.31,\n offsetY: -0.3,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"CHA\\\\n{{actor.system.abilities.cha.mod}} {{actor.system.abilities.cha.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"CHA\"\n },\n group: \"Info Box #3\",\n i: 7\n },\n {\n id: \"AU8tTXat\",\n label: \"CON\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"AU8tTXat\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.31,\n offsetY: -0.11,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"CON\\\\n{{actor.system.abilities.con.mod}} {{actor.system.abilities.con.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"CON\"\n },\n group: \"Info Box #3\",\n i: 8\n },\n {\n id: \"JZKNmgvY\",\n label: \"DEX\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"JZKNmgvY\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: -0.11,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"DEX\\\\n{{actor.system.abilities.dex.mod}} {{actor.system.abilities.dex.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"DEX\"\n },\n group: \"Info Box #3\",\n i: 9\n },\n {\n id: \"AUGurJtx\",\n label: \"INT\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"AUGurJtx\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.32,\n offsetY: -0.3,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"INT\\\\n{{actor.system.abilities.int.mod}} {{actor.system.abilities.int.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"INT\"\n },\n group: \"Info Box #3\",\n i: 10\n },\n {\n id: \"z0PMTFxo\",\n label: \"STR\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"z0PMTFxo\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0.32,\n offsetY: -0.11,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"STR\\\\n{{actor.system.abilities.str.mod}} {{actor.system.abilities.str.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"STR\"\n },\n group: \"Info Box #3\",\n i: 11\n },\n {\n id: \"YXUiGPBv\",\n label: \"WIS\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 57,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"YXUiGPBv\",\n parentID: \"Gt11vjXV\",\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: true,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: -0.3,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"WIS\\\\n{{actor.system.abilities.wis.mod}} {{actor.system.abilities.wis.save}}\",\n fontFamily: \"Signika\",\n fontSize: 36,\n letterSpacing: 0,\n fill: \"#FFFFFF\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"WIS\"\n },\n group: \"Info Box #3\",\n i: 12\n }\n ],\n id: \"vQJ3coCJ\"\n },\n {\n name: \"Facing Direction\",\n hint: \"Displays an arrow in the top-right corner of the token showing the direction it is facing.\",\n img: \"https://user-images.githubusercontent.com/7693704/244647284-2213caf5-6d49-4413-ab5f-83901ffbc8e6.png\",\n mappings: [\n {\n id: \"9UEOkJ1J\",\n label: \"Arrow\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"9UEOkJ1J\",\n parentID: \"\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: true,\n animation: {\n relative: true,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.5,\n offsetY: 0.5,\n scaleX: 0.51,\n scaleY: 0.51,\n angle: 90,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"➢\",\n fontFamily: \"Signika\",\n fontSize: 63,\n letterSpacing: 0,\n fill: \"#ff0000\",\n dropShadow: null,\n strokeThickness: 3,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Arrow\"\n },\n group: \"Facing Direction\",\n i: 0\n }\n ],\n id: \"Z8CTgmOg\"\n },\n {\n name: \"Combat Markers\",\n hint: \"Displays rotating markers for tokens in combat.\",\n img: \"https://user-images.githubusercontent.com/7693704/257478593-81b9192d-1ffe-4f0b-8e5d-806218d7e25f.png\",\n mappings: [\n {\n id: \"9R3glzOK\",\n label: \"Your Turn is Next!\",\n expression: \"combat-turn-next\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n label: \"Your Turn is Next!\",\n parent: \"\",\n underlay: true,\n bottom: true,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: true,\n duration: 30000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: false,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0,\n scaleX: 1.6,\n scaleY: 1.6,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"Next Turn = = = = = = Next turn = = = = = \",\n fontFamily: \"Signika\",\n fontSize: 41,\n letterSpacing: 0,\n fill: \"#e6a800\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 125,\n invert: false\n }\n },\n effect: \"\"\n },\n group: \"Combat\",\n i: 0\n },\n {\n id: \"qoWG5AD0\",\n label: \"Your Turn!\",\n expression: \"combat-turn\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n label: \"Your Turn!\",\n parent: \"\",\n underlay: true,\n bottom: true,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: true,\n duration: 30000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: true,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: false,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: 0,\n offsetY: 0,\n scaleX: 1.6,\n scaleY: 1.6,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"= Your Turn = = = = = = Your turn = = = = = \",\n fontFamily: \"Signika\",\n fontSize: 41,\n letterSpacing: 0,\n fill: \"#00ace6\",\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 125,\n invert: false\n }\n },\n effect: \"\"\n },\n group: \"Combat\",\n i: 1\n }\n ],\n id: \"YpoX5zxO\"\n },\n {\n name: \"Disposition Markers\",\n hint: \"Displays circles underneath tokens coloured based on their disposition.\",\n img: \"https://user-images.githubusercontent.com/7693704/246497702-5de47dc9-21ef-43a1-86db-b3f85eb8ddb1.png\",\n mappings: [\n {\n id: \"TzP6MBC1\",\n label: \"Friendly\",\n expression: \"disposition=1\",\n codeExp: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n id: \"TzP6MBC1\",\n parentID: \"\",\n underlay: true,\n bottom: true,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: \"5000\",\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n imgLinked: false,\n repeating: false,\n alpha: \"1\",\n tint: \"#1acb2f\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n width: \"\",\n height: \"\",\n scaleX: \"0.24\",\n scaleY: \"0.24\",\n angle: \"0\",\n pOffsetX: \"\",\n pOffsetY: \"\",\n offsetX: \"0\",\n offsetY: \"0\",\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedToOwner: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnHUD: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#FFFFFF\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: \"36\",\n align: \"center\",\n letterSpacing: \"0\",\n dropShadow: \"true\",\n strokeThickness: \"1\",\n stroke: \"#111111\",\n wordWrap: false,\n wordWrapWidth: \"200\",\n breakWords: false,\n maxHeight: \"0\",\n curve: {\n angle: \"0\",\n radius: \"0\",\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"ellipse\",\n x: \"0\",\n y: \"0\",\n width: \"{{object.w}} * @scale\",\n height: \"{{object.h}} * @scale\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ffffff\",\n alpha: \"0.75\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"ellipse\",\n x: \"{{object.w}} * @inner\",\n y: \"{{object.w}} * @inner\",\n width: \"{{object.w}} * @scale - {{object.w}} * @inner\",\n height: \"{{object.h}} * @scale - {{object.h}} * @inner\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#b8b8b8\",\n alpha: \"0.7\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n }\n ],\n variables: [\n {\n name: \"scale\",\n value: \"2.3\"\n },\n {\n name: \"inner\",\n value: \"0.3\"\n }\n ],\n effect: \"\",\n interactivity: [],\n label: \"Friendly\"\n },\n group: \"Disposition Markers\",\n i: 2\n },\n {\n id: \"oIsQWISB\",\n label: \"Hostile\",\n expression: \"disposition=-1\",\n codeExp: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n id: \"oIsQWISB\",\n parentID: \"\",\n underlay: true,\n bottom: true,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: \"5000\",\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n imgLinked: false,\n repeating: false,\n alpha: \"1\",\n tint: \"#eb0000\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n width: \"\",\n height: \"\",\n scaleX: \"0.24\",\n scaleY: \"0.24\",\n angle: \"0\",\n pOffsetX: \"\",\n pOffsetY: \"\",\n offsetX: \"0\",\n offsetY: \"0\",\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedToOwner: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnHUD: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#FFFFFF\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: \"36\",\n align: \"center\",\n letterSpacing: \"0\",\n dropShadow: \"true\",\n strokeThickness: \"1\",\n stroke: \"#111111\",\n wordWrap: false,\n wordWrapWidth: \"200\",\n breakWords: false,\n maxHeight: \"0\",\n curve: {\n angle: \"0\",\n radius: \"0\",\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"ellipse\",\n x: \"0\",\n y: \"0\",\n width: \"{{object.w}} * @scale\",\n height: \"{{object.h}} * @scale\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ffffff\",\n alpha: \"0.75\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"ellipse\",\n x: \"{{object.w}} * @inner\",\n y: \"{{object.w}} * @inner\",\n width: \"{{object.w}} * @scale - {{object.w}} * @inner\",\n height: \"{{object.h}} * @scale - {{object.h}} * @inner\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#b8b8b8\",\n alpha: \"0.7\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n }\n ],\n variables: [\n {\n name: \"scale\",\n value: \"2.3\"\n },\n {\n name: \"inner\",\n value: \"0.3\"\n }\n ],\n effect: \"\",\n interactivity: [],\n label: \"Hostile\"\n },\n group: \"Disposition Markers\",\n i: 3\n },\n {\n id: \"fYxJ9Bbc\",\n label: \"Neutral\",\n expression: \"disposition=0\",\n codeExp: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n id: \"fYxJ9Bbc\",\n parentID: \"\",\n underlay: true,\n bottom: true,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: \"5000\",\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n imgLinked: false,\n repeating: false,\n alpha: \"1\",\n tint: \"\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n width: \"\",\n height: \"\",\n scaleX: \"0.24\",\n scaleY: \"0.24\",\n angle: \"0\",\n pOffsetX: \"\",\n pOffsetY: \"\",\n offsetX: \"0\",\n offsetY: \"0\",\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedToOwner: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnHUD: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#FFFFFF\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: \"36\",\n align: \"center\",\n letterSpacing: \"0\",\n dropShadow: \"true\",\n strokeThickness: \"1\",\n stroke: \"#111111\",\n wordWrap: false,\n wordWrapWidth: \"200\",\n breakWords: false,\n maxHeight: \"0\",\n curve: {\n angle: \"0\",\n radius: \"0\",\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"ellipse\",\n x: \"0\",\n y: \"0\",\n width: \"{{object.w}} * @scale\",\n height: \"{{object.h}} * @scale\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ffffff\",\n alpha: \"0.75\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"ellipse\",\n x: \"{{object.w}} * @inner\",\n y: \"{{object.w}} * @inner\",\n width: \"{{object.w}} * @scale - {{object.w}} * @inner\",\n height: \"{{object.h}} * @scale - {{object.h}} * @inner\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#b8b8b8\",\n alpha: \"0.7\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n }\n ],\n variables: [\n {\n name: \"scale\",\n value: \"2.3\"\n },\n {\n name: \"inner\",\n value: \"0.3\"\n }\n ],\n effect: \"\",\n interactivity: [],\n label: \"Neutral\"\n },\n group: \"Disposition Markers\",\n i: 4\n },\n {\n id: \"PyEXXb5J\",\n label: \"Secret\",\n expression: \"disposition=-2\",\n codeExp: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: false,\n disabled: false,\n overlayConfig: {\n id: \"PyEXXb5J\",\n parentID: \"\",\n underlay: true,\n bottom: true,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: \"5000\",\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n imgLinked: false,\n repeating: false,\n alpha: \"1\",\n tint: \"#ba24ff\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n width: \"\",\n height: \"\",\n scaleX: \"0.24\",\n scaleY: \"0.24\",\n angle: \"0\",\n pOffsetX: \"\",\n pOffsetY: \"\",\n offsetX: \"0\",\n offsetY: \"0\",\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedToOwner: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnHUD: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#FFFFFF\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: \"36\",\n align: \"center\",\n letterSpacing: \"0\",\n dropShadow: \"true\",\n strokeThickness: \"1\",\n stroke: \"#111111\",\n wordWrap: false,\n wordWrapWidth: \"200\",\n breakWords: false,\n maxHeight: \"0\",\n curve: {\n angle: \"0\",\n radius: \"0\",\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"ellipse\",\n x: \"0\",\n y: \"0\",\n width: \"{{object.w}} * @scale\",\n height: \"{{object.h}} * @scale\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ffffff\",\n alpha: \"0.75\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"ellipse\",\n x: \"{{object.w}} * @inner\",\n y: \"{{object.w}} * @inner\",\n width: \"{{object.w}} * @scale - {{object.w}} * @inner\",\n height: \"{{object.h}} * @scale - {{object.h}} * @inner\"\n },\n label: \"\",\n line: {\n width: \"0\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#b8b8b8\",\n alpha: \"0.7\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n }\n ],\n variables: [\n {\n name: \"scale\",\n value: \"2.3\"\n },\n {\n name: \"inner\",\n value: \"0.3\"\n }\n ],\n effect: \"\",\n interactivity: [],\n label: \"Secret\"\n },\n group: \"Disposition Markers\",\n i: 5\n }\n ],\n id: \"yjqfAagB\"\n },\n {\n name: \"Health Bar\",\n hint: \"A recreation of the standard health bar using Overlays.\",\n img: \"https://user-images.githubusercontent.com/7693704/257246890-d41894a0-7f40-4e91-a47a-bc10d6f198e6.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"dgIBKbcU\",\n label: \"Health Bar\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"dgIBKbcU\",\n parentID: \"\",\n ui: true,\n underlay: true,\n bottom: true,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n repeating: false,\n alpha: 1,\n tint: \"\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n offsetX: 0,\n offsetY: -0.5,\n scaleX: 1,\n scaleY: 1,\n angle: 0,\n anchor: {\n x: 0.5,\n y: 1\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#FFFFFF\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: 36,\n align: \"left\",\n letterSpacing: 0,\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"rectangle\",\n x: \"0\",\n y: \"0\",\n width: \"{{object.w}}\",\n height: \"{{object.h}} * @height\",\n radius: \"3\"\n },\n label: \"\",\n line: {\n width: 1,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#5c5c5c\",\n alpha: 0.65,\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"rectangle\",\n x: \"0\",\n y: \"0\",\n width: \"{{object.w}} * ( {{hp}} / {{hpMax}} )\",\n height: \"{{object.h}} * @height\",\n radius: \"3\"\n },\n label: \"\",\n line: {\n width: 1,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#ff0000\",\n alpha: 1,\n interpolateColor: {\n color2: \"#74da0e\",\n prc: \"{{hp}} / {{hpMax}}\"\n }\n },\n repeating: false\n }\n ],\n variables: [\n {\n name: \"height\",\n value: \"0.079\"\n }\n ],\n effect: \"\",\n label: \"Health Bar\"\n },\n group: \"Health Bar\",\n i: 0\n }\n ],\n id: \"GDyvkEB4\"\n },\n {\n name: \"Health Ring\",\n hint: \"A ring shaped health bar.\",\n img: \"https://user-images.githubusercontent.com/7693704/257246432-a339394f-489a-4436-9d4b-427c285d4f27.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"erOTHzIc\",\n label: \"Health Ring\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"erOTHzIc\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n repeating: false,\n alpha: 1,\n tint: \"\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n offsetX: 0,\n offsetY: 0,\n scaleX: 1.02,\n scaleY: 1.02,\n angle: -90,\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#ffffff\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: 36,\n align: \"left\",\n letterSpacing: 0,\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"{{object.w}} / @ringScale * @innerRadius\",\n outerRadius: \"{{object.w}} / @ringScale * @outerRadius\",\n startAngle: \"0\",\n endAngle: \"360\"\n },\n label: \"Background\",\n line: {\n width: 0,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#b0b0b0\",\n alpha: 0.6,\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"{{object.w}} / @ringScale * @innerRadius\",\n outerRadius: \"{{object.w}} / @ringScale * @outerRadius\",\n startAngle: \"0\",\n endAngle: \"{{hp}} / {{hpMax}} * 360\"\n },\n label: \"Health Tracker\",\n line: {\n width: 0,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#ff0000\",\n alpha: 1,\n interpolateColor: {\n color2: \"#74da0e\",\n prc: \"{{hp}} / {{hpMax}}\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"{{object.w}} / @ringScale * @innerRadius\",\n outerRadius: \"{{object.w}} / @ringScale * @outerRadius\",\n startAngle: \"0\",\n endAngle: \"360\"\n },\n label: \"Outline\",\n line: {\n width: 1,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#b0b0b0\",\n alpha: 0,\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n }\n },\n repeating: false\n }\n ],\n variables: [\n {\n name: \"ringScale\",\n value: \"1.8\"\n },\n {\n name: \"innerRadius\",\n value: \"0.9\"\n },\n {\n name: \"outerRadius\",\n value: \"1.0\"\n }\n ],\n effect: \"\",\n label: \"Health Ring\"\n },\n group: \"Health Ring\",\n i: 0\n }\n ],\n id: \"yITi94hC\"\n },\n {\n name: \"Health Hearts\",\n hint: \"Displays up to 10 hearts to the right of the token based on their current health. Each heart is representative of 10% of the health.\",\n img: \"https://user-images.githubusercontent.com/7693704/257349483-1864d4ca-a2de-468d-872d-6d8c2847434a.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"4uCpbtHY\",\n label: \"Hearts\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"4uCpbtHY\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: true,\n linkDimensionsY: true,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n alpha: 1,\n tint: \"\",\n offsetX: -0.53,\n offsetY: 0.5,\n scaleX: 0.5,\n scaleY: 0.5,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \" \",\n repeating: true,\n repeat: {\n value: \"{{hp}}\",\n increment: \"10\",\n isPercentage: true,\n maxValue: \"{{hpMax}}\",\n perRow: \"2\",\n maxRows: \"\"\n },\n fontFamily: \"Signika\",\n fill: \"#ff0000\",\n fontSize: 36,\n align: \"left\",\n letterSpacing: 0,\n dropShadow: null,\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n effect: \"\",\n label: \"Hearts\"\n },\n group: \"Health Hearts\",\n i: 0\n }\n ],\n id: \"T2DrD0Em\"\n },\n {\n name: \"Health Circles\",\n hint: \"Displays up to 10 circles to the right of the token based on their current health. Each circle is representative of 10% of the health.\",\n img: \"https://user-images.githubusercontent.com/7693704/257476414-c42bdbc0-c57b-4367-8207-3e2e4273094f.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"0vETg18v\",\n label: \"Health Circles\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"0vETg18v\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: true,\n linkDimensionsY: true,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n repeating: false,\n alpha: 1,\n tint: \"\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n offsetX: -0.52,\n offsetY: 0.6,\n scaleX: 0.46,\n scaleY: 0.46,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#ffffff\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: 36,\n align: \"left\",\n letterSpacing: 0,\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"ellipse\",\n x: \"0\",\n y: \"0\",\n width: \"25\",\n height: \"25\"\n },\n label: \"\",\n line: {\n width: 1,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#ff0000\",\n alpha: 1,\n interpolateColor: {\n color2: \"#74da0e\",\n prc: \"{{hp}} / {{hpMax}}\"\n }\n },\n repeating: true,\n repeat: {\n value: \"{{hp}}\",\n increment: \"10\",\n isPercentage: true,\n maxValue: \"{{hpMax}}\",\n perRow: \"2\",\n maxRows: \"\",\n paddingX: \"3\",\n paddingY: \"3\"\n }\n }\n ],\n effect: \"\",\n label: \"Health Circles\"\n },\n group: \"Health Circles\",\n i: 0\n }\n ],\n id: \"kJ0Fi54w\"\n },\n {\n name: \"Health Squares\",\n hint: \"Displays up to 10 squares to the right of the token based on their current health. Each square is representative of 10% of the health.\",\n img: \"https://user-images.githubusercontent.com/7693704/257477099-689cd23a-0e4a-4d9a-aaa2-bf88b169ede8.png\",\n group: \"Health\",\n mappings: [\n {\n id: \"0vETg18v\",\n label: \"Health Squares\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"0vETg18v\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: false,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: 5000,\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: true,\n linkDimensionsY: true,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n repeating: false,\n alpha: 1,\n tint: \"\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n offsetX: -0.52,\n offsetY: 0.6,\n scaleX: 0.46,\n scaleY: 0.46,\n angle: 0,\n anchor: {\n x: 0,\n y: 0\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedUsers: [],\n limitOnHover: false,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#ffffff\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: 36,\n align: \"left\",\n letterSpacing: 0,\n dropShadow: \"true\",\n strokeThickness: 1,\n stroke: \"#111111\",\n curve: {\n radius: 0,\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"rectangle\",\n x: \"0\",\n y: \"0\",\n width: \"50\",\n height: \"50\",\n radius: \"0\"\n },\n label: \"\",\n line: {\n width: 1,\n color: \"#000000\",\n alpha: 1\n },\n fill: {\n color: \"#ff0000\",\n alpha: 1,\n interpolateColor: {\n color2: \"#74da0e\",\n prc: \"{{hp}} / {{hpMax}}\"\n }\n },\n repeating: true,\n repeat: {\n value: \"{{hp}}\",\n increment: \"10\",\n isPercentage: true,\n maxValue: \"{{hpMax}}\",\n perRow: \"2\",\n maxRows: \"\",\n paddingX: \"3\",\n paddingY: \"3\"\n }\n }\n ],\n effect: \"\",\n label: \"Health Squares\"\n },\n group: \"Health Squares\",\n i: 0\n }\n ],\n id: \"zzeRhmmk\"\n },\n {\n name: \"Spell Slot Ring\",\n hint: \"Remaining spell slots represented as a ring.\",\n img: \"https://user-images.githubusercontent.com/7693704/261663740-444d86b9-ee9f-4a2f-963f-6886a2af29cc.png\",\n system: \"dnd5e\",\n mappings: [\n {\n id: \"1SS3KhwM\",\n label: \"Spell Slot Ring\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 50,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"1SS3KhwM\",\n parentID: \"\",\n ui: true,\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: \"5000\",\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n repeating: false,\n alpha: \"1\",\n tint: \"\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n width: \"{{object.w}} * @Scale\",\n height: \"{{object.w}} * @Scale\",\n scaleX: \"1\",\n scaleY: \"1\",\n angle: \"0\",\n offsetX: \"0\",\n offsetY: \"0\",\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedToOwner: true,\n limitedUsers: [],\n limitOnHover: true,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#ffffff\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: \"36\",\n align: \"left\",\n letterSpacing: \"0\",\n dropShadow: \"true\",\n strokeThickness: \"1\",\n stroke: \"#111111\",\n wordWrap: false,\n wordWrapWidth: \"200\",\n breakWords: false,\n maxHeight: \"0\",\n curve: {\n angle: \"0\",\n radius: \"0\",\n invert: false\n }\n },\n shapes: [\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer \",\n startAngle: \"0\",\n endAngle: \"360\"\n },\n label: \"BaseLayer\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#3b3b3b\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90\",\n endAngle: \"-90 + ( {{actor.system.spells.spell1.value}} * @Tick )\"\n },\n label: \"1st level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff0000\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 4 * @Tick )\",\n endAngle: \"-90 + ( 4 * @Tick ) + ( {{actor.system.spells.spell2.value}} * @Tick )\"\n },\n label: \"2nd Level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff8800\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 7 * @Tick )\",\n endAngle: \"-90 + ( 7 * @Tick ) + ( {{actor.system.spells.spell3.value}} * @Tick )\"\n },\n label: \"3rd Level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ffdd00\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 10 * @Tick )\",\n endAngle: \"-90 + ( 10 * @Tick ) + ( {{actor.system.spells.spell4.value}} * @Tick )\"\n },\n label: \"4th Level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#37ff00\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 13 * @Tick )\",\n endAngle: \"-90 + ( 13 * @Tick ) + ( {{actor.system.spells.spell5.value}} * @Tick )\"\n },\n label: \"5th Level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#00ffcc\",\n alpha: \"0.95\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 16 * @Tick )\",\n endAngle: \"-90 + ( 16 * @Tick ) + ( {{actor.system.spells.spell6.value}} * @Tick )\"\n },\n label: \"6th Level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#00b3ff\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 18 * @Tick )\",\n endAngle: \"-90 + ( 18 * @Tick ) + ( {{actor.system.spells.spell7.value}} * @Tick )\"\n },\n label: \"7th Level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#001eff\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 20 * @Tick )\",\n endAngle: \"-90 + ( 20 * @Tick ) + ( {{actor.system.spells.spell8.value}} * @Tick )\"\n },\n label: \"8th Level\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ae00ff\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 21 * @Tick )\",\n endAngle: \"-90 + ( 21 * @Tick ) + ( {{actor.system.spells.spell9.value}} * @Tick )\"\n },\n label: \"9th Level - Copy\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"1\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90\",\n endAngle: \"-90 + ( 1 * @Tick )\"\n },\n label: \"Outline 1\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 1 * @Tick )\",\n endAngle: \"-90 + ( 2 * @Tick )\"\n },\n label: \"Outline 2\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 2 * @Tick )\",\n endAngle: \"-90 + ( 3 * @Tick )\"\n },\n label: \"Outline 3\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 3 * @Tick )\",\n endAngle: \"-90 + ( 4 * @Tick )\"\n },\n label: \"Outline 4\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 4 * @Tick )\",\n endAngle: \"-90 + ( 5 * @Tick )\"\n },\n label: \"Outline 5\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 5 * @Tick )\",\n endAngle: \"-90 + ( 6 * @Tick )\"\n },\n label: \"Outline 6\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 6 * @Tick )\",\n endAngle: \"-90 + ( 7 * @Tick )\"\n },\n label: \"Outline 7\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 7 * @Tick )\",\n endAngle: \"-90 + ( 8 * @Tick )\"\n },\n label: \"Outline 8\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 8 * @Tick )\",\n endAngle: \"-90 + ( 9 * @Tick )\"\n },\n label: \"Outline 9\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 9 * @Tick )\",\n endAngle: \"-90 + ( 10 * @Tick )\"\n },\n label: \"Outline 10\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 10 * @Tick )\",\n endAngle: \"-90 + ( 11 * @Tick )\"\n },\n label: \"Outline 11\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 11 * @Tick )\",\n endAngle: \"-90 + ( 12 * @Tick )\"\n },\n label: \"Outline 12\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 12 * @Tick )\",\n endAngle: \"-90 + ( 13 * @Tick )\"\n },\n label: \"Outline 13\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 13 * @Tick )\",\n endAngle: \"-90 + ( 14 * @Tick )\"\n },\n label: \"Outline 14\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 14 * @Tick )\",\n endAngle: \"-90 + ( 15 * @Tick )\"\n },\n label: \"Outline 15\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 15 * @Tick )\",\n endAngle: \"-90 + ( 16 * @Tick )\"\n },\n label: \"Outline 16\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 16 * @Tick )\",\n endAngle: \"-90 + ( 17 * @Tick )\"\n },\n label: \"Outline 17\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 17 * @Tick )\",\n endAngle: \"-90 + ( 18 * @Tick )\"\n },\n label: \"Outline 18\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 18 * @Tick )\",\n endAngle: \"-90 + ( 19 * @Tick )\"\n },\n label: \"Outline 19\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 19 * @Tick )\",\n endAngle: \"-90 + ( 20 * @Tick )\"\n },\n label: \"Outline 20\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 20 * @Tick )\",\n endAngle: \"-90 + ( 21 * @Tick )\"\n },\n label: \"Outline 21\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n },\n {\n shape: {\n type: \"torus\",\n x: \"0\",\n y: \"0\",\n innerRadius: \"@Inner\",\n outerRadius: \"@Outer\",\n startAngle: \"-90 + ( 21 * @Tick )\",\n endAngle: \"-90 + ( 22 * @Tick )\"\n },\n label: \"Outline 22\",\n line: {\n width: \"1\",\n color: \"#000000\",\n alpha: \"1\"\n },\n fill: {\n color: \"#ff00ea\",\n alpha: \"0\",\n interpolateColor: {\n color2: \"#ffffff\",\n prc: \"\"\n }\n },\n repeating: false\n }\n ],\n variables: [\n {\n name: \"Tick\",\n value: \"16.3636363636363636\"\n },\n {\n name: \"Inner\",\n value: \"66\"\n },\n {\n name: \"Outer\",\n value: \"80\"\n },\n {\n name: \"Scale\",\n value: \"1.8\"\n }\n ],\n effect: \"\",\n label: \"Spell Slot Ring\"\n },\n group: \"Spell Slot Ring\",\n i: 0\n },\n {\n id: \"3IAo8ZUu\",\n label: \"Spell Slot Numbers\",\n expression: \"\",\n imgName: \"\",\n imgSrc: \"\",\n priority: 60,\n config: {},\n overlay: true,\n alwaysOn: true,\n disabled: false,\n overlayConfig: {\n id: \"3IAo8ZUu\",\n parentID: \"\",\n underlay: false,\n bottom: false,\n top: true,\n inheritTint: false,\n linkRotation: false,\n animation: {\n relative: false,\n rotate: false,\n duration: \"5000\",\n clockwise: true\n },\n linkMirror: false,\n linkScale: false,\n linkDimensionsX: false,\n linkDimensionsY: false,\n linkOpacity: false,\n linkStageScale: false,\n loop: true,\n playOnce: false,\n img: \"\",\n repeating: false,\n alpha: \"1\",\n tint: \"\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n width: \"{{object.w}} * @Scale\",\n height: \"{{object.w}} * @Scale\",\n scaleX: \"1\",\n scaleY: \"1\",\n angle: \"1\",\n offsetX: \"0\",\n offsetY: \"0.009\",\n anchor: {\n x: 0.5,\n y: 0.5\n },\n filter: \"NONE\",\n alwaysVisible: false,\n limitedToOwner: true,\n limitedUsers: [],\n limitOnHover: true,\n limitOnHighlight: false,\n limitOnControl: false,\n limitOnEffect: \"\",\n limitOnProperty: \"\",\n text: {\n text: \"4455566778911112223334\",\n repeating: false,\n fontFamily: \"Signika\",\n fill: \"#ffffff\",\n interpolateColor: {\n color2: \"\",\n prc: \"\"\n },\n fontSize: \"45\",\n align: \"left\",\n letterSpacing: \"41.5\",\n dropShadow: null,\n strokeThickness: \"4\",\n stroke: \"#111111\",\n wordWrap: false,\n wordWrapWidth: \"200\",\n breakWords: false,\n maxHeight: \"0\",\n curve: {\n angle: \"360\",\n radius: \"220\",\n invert: false\n }\n },\n variables: [\n {\n name: \"Scale\",\n value: \"1.85\"\n }\n ],\n effect: \"\",\n label: \"Spell Slot Numbers\"\n },\n group: \"Spell Slot Ring\",\n i: 1\n }\n ],\n id: \"FeFzTjjE\"\n }\n];\n\n});\n\nparcelRequire.register(\"fTFXO\", function(module, exports) {\n\n$parcel$export(module.exports, \"Templates\", () => $b92c8b33d06c705b$export$b78c417a59fec2a7);\n\nvar $hClLE = parcelRequire(\"hClLE\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $cs88A = parcelRequire(\"cs88A\");\nclass $b92c8b33d06c705b$export$b78c417a59fec2a7 extends FormApplication {\n constructor({ mappings: mappings = null, callback: callback = null } = {}){\n super({}, {});\n this.mappings = mappings;\n this.callback = callback;\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-templates\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/templates.html\",\n resizable: false,\n minimizable: false,\n title: \"Mapping Templates\",\n width: 500,\n height: \"auto\"\n });\n }\n async getData(options) {\n const data = super.getData(options);\n if (!this.category) this.category = (0, $9IngI.TVA_CONFIG).templateMappings?.length ? \"user\" : \"core\";\n if (this.category === \"user\") this.templates = (0, $9IngI.TVA_CONFIG).templateMappings;\n else if (this.category === \"core\") this.templates = (0, $hClLE.CORE_TEMPLATES);\n else this.templates = await $b92c8b33d06c705b$var$communityTemplates();\n for (const template of this.templates)template.hint = template.hint?.replace(/(\\r\\n|\\n|\\r)/gm, \"<br>\");\n data.category = this.category;\n data.templates = this.templates;\n data.allowDelete = this.category === \"user\";\n data.allowCreate = this.category === \"user\";\n data.allowCopy = this.category === \"community\" || this.category === \"core\";\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n // Position tooltip\n const appWindow = html.closest(\"#token-variants-templates\");\n html.find(\".template\").on(\"mouseover\", (event)=>{\n const template = $(event.target).closest(\".template\");\n const pos = template.position();\n const tooltip = template.find(\".tooltiptext\");\n const windowPos = appWindow.position();\n tooltip.css(\"top\", windowPos.top + pos.top).css(\"left\", windowPos.left + pos.left);\n // Lazy load image\n const img = template.find(\"img\");\n if (!img.attr(\"src\")) img.attr(\"src\", img.data(\"src\"));\n });\n if (this.callback) html.find(\".template\").on(\"click\", async (event)=>{\n const li = $(event.target).closest(\".template\");\n const id = li.data(\"id\");\n const url = li.data(\"url\");\n let mappings;\n let templateName;\n if (url) {\n const template = await $b92c8b33d06c705b$var$getTemplateFromFileURL(url);\n if (template) mappings = template.mappings;\n } else if (id) {\n const template = this.templates.find((t)=>t.id === id);\n if (template) {\n templateName = template.name;\n mappings = template.mappings;\n }\n }\n if (mappings) this.callback(templateName, mappings);\n });\n html.find(\".search\").on(\"input\", ()=>{\n const filter = html.find(\".search\").val().trim().toLowerCase();\n html.find(\".template-list li\").each(function() {\n const li = $(this);\n const description = li.find(\".description\").text().trim().toLowerCase();\n const name = li.data(\"name\").trim().toLowerCase();\n const createdBy = li.data(\"creator\").trim().toLowerCase();\n if (name.includes(filter) || description.includes(filter) || createdBy.includes(filter)) li.show();\n else li.hide();\n });\n });\n html.find('[name=\"category\"]').on(\"change\", (event)=>{\n this.category = event.target.value;\n this.render(true);\n });\n html.find(\".delete\").on(\"click\", async (event)=>{\n event.preventDefault();\n event.stopPropagation();\n const id = $(event.target).closest(\".template\").data(\"id\");\n if (id) {\n await (0, $9IngI.updateSettings)({\n templateMappings: (0, $9IngI.TVA_CONFIG).templateMappings.filter((m)=>m.id !== id)\n });\n this.render(true);\n }\n });\n html.find(\".copy\").on(\"click\", async (event)=>{\n event.preventDefault();\n event.stopPropagation();\n const id = $(event.target).closest(\".template\").data(\"id\");\n if (id) {\n let template;\n if (this.category === \"core\") template = deepClone((0, $hClLE.CORE_TEMPLATES).find((t)=>t.id === id));\n else {\n const fileURL = $(event.target).closest(\".template\").data(\"url\");\n if (fileURL) template = await $b92c8b33d06c705b$var$getTemplateFromFileURL(fileURL);\n }\n if (template) {\n (0, $9IngI.TVA_CONFIG).templateMappings.push(template);\n await (0, $9IngI.updateSettings)({\n templateMappings: (0, $9IngI.TVA_CONFIG).templateMappings\n });\n ui.notifications.info(`Template {${template.name}} copied to User templates.`);\n this.render(true);\n }\n }\n });\n html.find(\".create\").on(\"click\", ()=>{\n (0, $cs88A.showMappingSelectDialog)(this.mappings, {\n title1: \"Create Template\",\n callback: (selectedMappings)=>{\n if (selectedMappings.length) (0, $cs88A.showUserTemplateCreateDialog)(selectedMappings);\n }\n });\n });\n }\n _getHeaderButtons() {\n const buttons = super._getHeaderButtons();\n buttons.unshift({\n label: \"Upload Template\",\n class: \".token-variants-submit-template\",\n icon: \"fa-solid fa-cloud-arrow-up\",\n onclick: ()=>{\n new $b92c8b33d06c705b$var$TemplateSubmissionForm().render(true);\n }\n });\n return buttons;\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {}\n}\nclass $b92c8b33d06c705b$var$TemplateSubmissionForm extends FormApplication {\n constructor(){\n super({}, {});\n }\n static apiKey = \"AIzaSyCJpwIkpjrG10jaHwcpllvSChxRPawcMXE\";\n static get pk() {\n const k2 = \"AIzaSyCJpw\";\n const k1 = \"IkpjrG10jaHwcpllv\";\n const k3 = \"SChxRPawcMXE\";\n return k2 + k1 + k3;\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-template-submission\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/templateSubmission.html\",\n resizable: true,\n minimizable: false,\n closeOnSubmit: false,\n title: \"Upload Template\",\n width: 500,\n height: \"auto\"\n });\n }\n async getData(options) {\n const data = super.getData(options);\n data.systemID = game.system.id;\n data.systemTitle = game.system.title;\n data.templates = (0, $9IngI.TVA_CONFIG).templateMappings;\n return data;\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n if (!formData.template) return;\n let template = (0, $9IngI.TVA_CONFIG).templateMappings.find((t)=>t.id === formData.template);\n if (!template) return;\n const name = formData.name.trim() || template.name;\n const hint = formData.hint.trim() || template.hint?.trim();\n const createdBy = formData.createdBy.trim();\n const system = formData.system;\n const id = randomID();\n const img = formData.img.trim();\n const result = $b92c8b33d06c705b$var$submitTemplate({\n id: id,\n name: name,\n hint: hint,\n img: img,\n createdBy: createdBy,\n system: system,\n mappings: template.mappings\n });\n if (result) this.close();\n }\n}\nfunction $b92c8b33d06c705b$var$_setStringField(template, fields, field) {\n if (template[field] && template[field] !== \"\") fields[field] = {\n stringValue: template[field]\n };\n}\nasync function $b92c8b33d06c705b$var$submitTemplate(template) {\n const fields = {};\n [\n \"name\",\n \"hint\",\n \"img\",\n \"id\",\n \"createdBy\",\n \"system\"\n ].forEach((field)=>$b92c8b33d06c705b$var$_setStringField(template, fields, field));\n fields.mappings = {\n stringValue: JSON.stringify(template.mappings)\n };\n fields.createTime = {\n integerValue: new Date().getTime()\n };\n fields.approved = {\n booleanValue: false\n };\n const response = await fetch(`https://firestore.googleapis.com/v1/projects/tva---templates/databases/(default)/documents/templates?key=${$b92c8b33d06c705b$var$TemplateSubmissionForm.pk}`, {\n method: \"POST\",\n body: JSON.stringify({\n fields: fields\n }),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n }\n });\n if (response.ok && response.status === 200) {\n ui.notifications.info(\"Template submission completed.\");\n return true;\n } else {\n ui.notifications.warn(\"Template submission failed.\");\n return false;\n }\n}\nconst $b92c8b33d06c705b$var$SEARCH_QUERY = {\n structuredQuery: {\n select: {\n fields: [\n {\n fieldPath: \"id\"\n },\n {\n fieldPath: \"name\"\n },\n {\n fieldPath: \"hint\"\n },\n {\n fieldPath: \"createdBy\"\n },\n {\n fieldPath: \"img\"\n },\n {\n fieldPath: \"system\"\n }\n ]\n },\n where: {\n fieldFilter: {\n field: {\n fieldPath: \"approved\"\n },\n op: \"EQUAL\",\n value: {\n booleanValue: true\n }\n }\n },\n from: [\n {\n collectionId: \"templates\"\n }\n ],\n orderBy: [\n {\n field: {\n fieldPath: \"createTime\"\n }\n }\n ],\n offset: 0,\n limit: 50\n }\n};\nasync function $b92c8b33d06c705b$var$communityTemplates(search = null) {\n const response = await fetch(`https://firestore.googleapis.com/v1/projects/tva---templates/databases/(default)/documents:runQuery?key=${$b92c8b33d06c705b$var$TemplateSubmissionForm.pk}`, {\n method: \"POST\",\n body: JSON.stringify($b92c8b33d06c705b$var$SEARCH_QUERY),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n }\n });\n const templates = [];\n if (response.ok && response.status === 200) {\n const documents = await response.json();\n for (let doc of documents)if (\"document\" in doc) templates.push($b92c8b33d06c705b$var$_docToTemplate(doc.document));\n } else ui.notifications.warn(\"Failed to retrieve Community templates.\");\n return templates;\n}\nfunction $b92c8b33d06c705b$var$_docToTemplate(doc) {\n const template = {};\n [\n \"id\",\n \"name\",\n \"mappings\",\n \"createdBy\",\n \"img\",\n \"hint\",\n \"system\"\n ].forEach((f)=>{\n template[f] = doc.fields[f]?.stringValue || \"\";\n });\n if (template.mappings) template.mappings = JSON.parse(template.mappings);\n else template.fileURL = doc.name;\n if (!template.createdBy) template.createdBy = \"Anonymous\";\n return template;\n}\nasync function $b92c8b33d06c705b$var$getTemplateFromFileURL(fileURL) {\n const response = await fetch(`https://firestore.googleapis.com/v1/${fileURL}?key=${$b92c8b33d06c705b$var$TemplateSubmissionForm.pk}`, {\n method: \"GET\",\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\"\n }\n });\n if (response.ok && response.status === 200) {\n const doc = await response.json();\n return $b92c8b33d06c705b$var$_docToTemplate(doc);\n }\n return null;\n}\n\n});\n\n\n\nparcelRequire.register(\"9Z21J\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $744b620dabd5c2e6$export$2e2bcd8739ae039);\nclass $744b620dabd5c2e6$export$2e2bcd8739ae039 extends FormApplication {\n constructor(obj){\n super({}, {});\n this.actor = game.actors.get(obj.actorId);\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-token-flags\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/randomizerConfig.html\",\n resizable: true,\n minimizable: false,\n title: \"Randomizer\",\n width: 500\n });\n }\n async getData(options) {\n const data = super.getData(options);\n const settings = this.actor.getFlag(\"token-variants\", \"randomizerSettings\") || {};\n data.randomizer = settings;\n data.hasSettings = !isEmpty(settings);\n data.nameForgeActive = game.modules.get(\"nameforge\")?.active;\n if (data.randomizer.nameForge?.models && Array.isArray(data.randomizer.nameForge.models)) data.randomizer.nameForge.models = data.randomizer.nameForge.models.join(\",\");\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.find(\".selectNameForgeModels\").click(this._selectNameForgeModels.bind(this));\n // Can't have both tokenName and actorName checkboxes checked at the same time\n const tokenName = html.find('input[name=\"randomizer.tokenName\"]');\n const actorName = html.find('input[name=\"randomizer.actorName\"]');\n tokenName.change(()=>{\n if (tokenName.is(\":checked\")) actorName.prop(\"checked\", false);\n });\n actorName.change(()=>{\n if (actorName.is(\":checked\")) tokenName.prop(\"checked\", false);\n });\n }\n _selectNameForgeModels(event) {\n const inputSelected = $(event.target).siblings(\"input\");\n const selected = inputSelected.val().split(\",\");\n const genCheckbox = function(name, value) {\n return `\r\n <div class=\"form-group\">\r\n <label>${name}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"model\" value=\"${value}\" data-dtype=\"Boolean\" ${selected?.find((v)=>v === value) ? \"checked\" : \"\"}>\r\n </div>\r\n </div>\r\n `;\n };\n let content = '<form style=\"overflow-y: scroll; height:400px;\">';\n const models = game.modules.get(\"nameforge\").models;\n for (const [k, v] of Object.entries(models.defaultModels))content += genCheckbox(v.name, \"defaultModels.\" + k);\n for (const [k, v] of Object.entries(models.userModels))content += genCheckbox(v.name, \"userModels.\" + k);\n content += `</form>`;\n new Dialog({\n title: `Name Forge Models`,\n content: content,\n buttons: {\n Ok: {\n label: `Select`,\n callback: async (html)=>{\n const selectedModels = [];\n html.find('input[type=\"checkbox\"]').each(function() {\n if (this.checked) selectedModels.push(this.value);\n });\n inputSelected.val(selectedModels.join(\",\"));\n }\n }\n }\n }).render(true);\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n if (event.submitter.value === \"remove\") await this.actor.unsetFlag(\"token-variants\", \"randomizerSettings\");\n else {\n const expanded = expandObject(formData);\n if (expanded.randomizer.nameForge?.models) expanded.randomizer.nameForge.models = expanded.randomizer.nameForge.models.split(\",\");\n this.actor.setFlag(\"token-variants\", \"randomizerSettings\", expanded.randomizer);\n }\n }\n}\n\n});\n\n\n\nparcelRequire.register(\"7Bay0\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerUserMappingHooks\", () => $58842ba3ff7a72d1$export$891f7c0c71a87222);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\nconst $58842ba3ff7a72d1$var$feature_id = \"UserMappings\";\nfunction $58842ba3ff7a72d1$export$891f7c0c71a87222() {\n if (!(0, $9IngI.FEATURE_CONTROL)[$58842ba3ff7a72d1$var$feature_id]) {\n [\n \"updateToken\",\n \"updateTile\",\n \"sightRefresh\"\n ].forEach((id)=>(0, $e9LRe.unregisterHook)($58842ba3ff7a72d1$var$feature_id, id));\n return;\n }\n (0, $e9LRe.registerHook)($58842ba3ff7a72d1$var$feature_id, \"updateToken\", $58842ba3ff7a72d1$var$_updateToken);\n (0, $e9LRe.registerHook)($58842ba3ff7a72d1$var$feature_id, \"updateTile\", $58842ba3ff7a72d1$var$_updateTile);\n (0, $e9LRe.registerHook)($58842ba3ff7a72d1$var$feature_id, \"sightRefresh\", $58842ba3ff7a72d1$var$_sightRefresh);\n}\nasync function $58842ba3ff7a72d1$var$_updateToken(token, change) {\n // Update User Specific Image\n if (change.flags?.[\"token-variants\"]) {\n if (\"userMappings\" in change.flags[\"token-variants\"] || \"-=userMappings\" in change.flags[\"token-variants\"]) {\n const t = canvas.tokens.get(token.id);\n if (t) {\n await t.draw();\n canvas.effects.visibility.restrictVisibility();\n }\n }\n }\n}\nasync function $58842ba3ff7a72d1$var$_updateTile(tile, change) {\n // Update User Specific Image\n if (change.flags?.[\"token-variants\"]) {\n if (\"userMappings\" in change.flags[\"token-variants\"] || \"-=userMappings\" in change.flags[\"token-variants\"]) {\n const t = canvas.tiles.get(tile.id);\n if (t) {\n await t.draw();\n canvas.effects.visibility.restrictVisibility();\n }\n }\n }\n}\nfunction $58842ba3ff7a72d1$var$_sightRefresh() {\n if (!game.user.isGM) {\n for (let t of canvas.tokens.placeables)if ($58842ba3ff7a72d1$var$_isInvisible(t)) t.visible = false;\n for (let t of canvas.tiles.placeables)if ($58842ba3ff7a72d1$var$_isInvisible(t)) t.visible = false;\n }\n}\nfunction $58842ba3ff7a72d1$var$_isInvisible(obj) {\n const img = (obj.document.getFlag(\"token-variants\", \"userMappings\") || {})?.[game.userId];\n return img === (0, $9IngI.TVA_CONFIG).invisibleImage;\n}\n\n});\n\nparcelRequire.register(\"4VMEk\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerWildcardHooks\", () => $3972390c18f47754$export$ca2abc1047677dc9);\n\nvar $7OP4c = parcelRequire(\"7OP4c\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\nconst $3972390c18f47754$var$feature_id = \"Wildcards\";\nfunction $3972390c18f47754$export$ca2abc1047677dc9() {\n if (!(0, $9IngI.FEATURE_CONTROL)[$3972390c18f47754$var$feature_id]) {\n [\n \"renderTokenConfig\",\n \"preCreateToken\"\n ].forEach((name)=>(0, $e9LRe.unregisterHook)($3972390c18f47754$var$feature_id, name));\n return;\n }\n // Insert default random image field\n (0, $e9LRe.registerHook)($3972390c18f47754$var$feature_id, \"renderTokenConfig\", $3972390c18f47754$var$_renderTokenConfig);\n // Set Default Wildcard images if needed\n (0, $e9LRe.registerHook)($3972390c18f47754$var$feature_id, \"preCreateToken\", $3972390c18f47754$var$_preCreateToken);\n}\nasync function $3972390c18f47754$var$_renderTokenConfig(config, html) {\n const checkboxRandomize = html.find('input[name=\"randomImg\"]');\n if (checkboxRandomize.length && !html.find(\".token-variants-proto\").length) {\n const defaultImg = config.actor?.prototypeToken?.flags[\"token-variants\"]?.[\"randomImgDefault\"] || config.actor?.prototypeToken?.flags[\"token-hud-wildcard\"]?.[\"default\"] || \"\";\n const field = await renderTemplate(\"/modules/token-variants/templates/protoTokenElement.html\", {\n defaultImg: defaultImg,\n disableHUDButton: config.object?.getFlag(\"token-variants\", \"disableHUDButton\")\n });\n checkboxRandomize.closest(\".form-group\").after(field);\n const tvaFieldset = html.find(\".token-variants-proto\");\n tvaFieldset.find(\"button\").click((event)=>{\n event.preventDefault();\n const input = tvaFieldset.find(\"input\");\n new FilePicker({\n current: input.val(),\n field: input[0]\n }).browse(defaultImg);\n });\n (0, $7OP4c.insertArtSelectButton)(tvaFieldset, \"flags.token-variants.randomImgDefault\", {\n search: config.object.name,\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN\n });\n // Hide/Show Default Img Form Group\n const rdmImgFormGroup = tvaFieldset.find(\".imagevideo\").closest(\".form-group\");\n const showHideGroup = function(checked) {\n if (checked) rdmImgFormGroup.show();\n else rdmImgFormGroup.hide();\n config.setPosition();\n };\n checkboxRandomize.on(\"click\", (event)=>showHideGroup(event.target.checked));\n showHideGroup(checkboxRandomize.is(\":checked\"));\n }\n}\nfunction $3972390c18f47754$var$_preCreateToken(tokenDocument, data, options, userId) {\n if (game.user.id !== userId) return;\n const update = {};\n if (tokenDocument.actor?.prototypeToken?.randomImg) {\n const defaultImg = tokenDocument.actor?.prototypeToken?.flags[\"token-variants\"]?.[\"randomImgDefault\"] || tokenDocument.actor?.prototypeToken?.flags[\"token-hud-wildcard\"]?.[\"default\"] || \"\";\n if (defaultImg) update[\"texture.src\"] = defaultImg;\n }\n if ((0, $9IngI.TVA_CONFIG).imgNameContainsDimensions || (0, $9IngI.TVA_CONFIG).imgNameContainsFADimensions) (0, $eeGZt.updateTokenImage)(update[\"texture.src\"] ?? tokenDocument.texture.src, {\n token: tokenDocument,\n update: update\n });\n if (!isEmpty(update)) tokenDocument.updateSource(update);\n}\n\n});\n\nparcelRequire.register(\"aTVyJ\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerPopRandomizeHooks\", () => $7efbb077f7553c7f$export$419d00c58c7e40a5);\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $8MWlo = parcelRequire(\"8MWlo\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $e9LRe = parcelRequire(\"e9LRe\");\nconst $7efbb077f7553c7f$var$feature_id = \"PopUpAndRandomize\";\nfunction $7efbb077f7553c7f$export$419d00c58c7e40a5() {\n if ((0, $9IngI.FEATURE_CONTROL)[$7efbb077f7553c7f$var$feature_id]) {\n (0, $e9LRe.registerHook)($7efbb077f7553c7f$var$feature_id, \"createActor\", $7efbb077f7553c7f$var$_createActor);\n (0, $e9LRe.registerHook)($7efbb077f7553c7f$var$feature_id, \"createToken\", $7efbb077f7553c7f$var$_createToken);\n } else [\n \"createActor\",\n \"createToken\"\n ].forEach((name)=>(0, $e9LRe.unregisterHook)($7efbb077f7553c7f$var$feature_id, name));\n}\nasync function $7efbb077f7553c7f$var$_createToken(token, options, userId) {\n if (userId && game.user.id != userId) return;\n // Check if random search is enabled and if so perform it\n const actorRandSettings = game.actors.get(token.actorId)?.getFlag(\"token-variants\", \"randomizerSettings\");\n const randSettings = mergeObject((0, $9IngI.TVA_CONFIG).randomizer, actorRandSettings ?? {}, {\n inplace: false,\n recursive: false\n });\n let vDown = (0, $eeGZt.keyPressed)(\"v\");\n const flagTarget = token.actor ? game.actors.get(token.actor.id) : token.document ?? token;\n const popupFlag = flagTarget.getFlag(\"token-variants\", \"popups\");\n if (vDown && randSettings.tokenCopyPaste || !vDown && randSettings.tokenCreate) {\n let performRandomSearch = true;\n if (!actorRandSettings) {\n if (randSettings.representedActorDisable && token.actor) performRandomSearch = false;\n if (randSettings.linkedActorDisable && token.actorLink) performRandomSearch = false;\n if ($7efbb077f7553c7f$var$_disableRandomSearchForType(randSettings, token.actor)) performRandomSearch = false;\n } else performRandomSearch = Boolean(actorRandSettings);\n if (performRandomSearch) {\n // Randomize Token Name if need be\n const randomName = await (0, $eeGZt.nameForgeRandomize)(randSettings);\n if (randomName) token.update({\n name: randomName\n });\n const img = await (0, $8MWlo.doRandomSearch)(token.name, {\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n actor: token.actor,\n randomizerOptions: randSettings\n });\n if (img) await (0, $eeGZt.updateTokenImage)(img[0], {\n token: token,\n actor: token.actor,\n imgName: img[1]\n });\n if (!img) return;\n if (randSettings.diffImages) {\n let imgPortrait;\n if (randSettings.syncImages) imgPortrait = await (0, $8MWlo.doSyncSearch)(token.name, img[1], {\n actor: token.actor,\n searchType: (0, $eeGZt.SEARCH_TYPE).PORTRAIT,\n randomizerOptions: randSettings\n });\n else imgPortrait = await (0, $8MWlo.doRandomSearch)(token.name, {\n searchType: (0, $eeGZt.SEARCH_TYPE).PORTRAIT,\n actor: token.actor,\n randomizerOptions: randSettings\n });\n if (imgPortrait) await (0, $eeGZt.updateActorImage)(token.actor, imgPortrait[0]);\n } else if (randSettings.tokenToPortrait) await (0, $eeGZt.updateActorImage)(token.actor, img[0]);\n return;\n }\n if (popupFlag == null && !randSettings.popupOnDisable) return;\n } else if (randSettings.tokenCreate || randSettings.tokenCopyPaste) return;\n // Check if pop-up is enabled and if so open it\n if (!(0, $9IngI.TVA_CONFIG).permissions.popups[game.user.role]) return;\n let dirKeyDown = (0, $eeGZt.keyPressed)(\"popupOverride\");\n if (vDown && (0, $9IngI.TVA_CONFIG).popup.disableAutoPopupOnTokenCopyPaste) return;\n if (!dirKeyDown || dirKeyDown && vDown) {\n if ((0, $9IngI.TVA_CONFIG).popup.disableAutoPopupOnTokenCreate && !vDown) return;\n else if (popupFlag == null && $7efbb077f7553c7f$var$_disablePopupForType(token.actor)) return;\n else if (popupFlag != null && !popupFlag) return;\n }\n (0, $coMHP.showArtSelect)(token.name, {\n callback: async function(imgSrc, imgName) {\n if ((0, $9IngI.TVA_CONFIG).popup.twoPopups) {\n await (0, $eeGZt.updateActorImage)(token.actor, imgSrc);\n $7efbb077f7553c7f$var$_twoPopupPrompt(token.actor, imgSrc, imgName, token);\n } else (0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: token.actor,\n imgName: imgName,\n token: token\n });\n },\n searchType: (0, $9IngI.TVA_CONFIG).popup.twoPopups ? (0, $eeGZt.SEARCH_TYPE).PORTRAIT : (0, $eeGZt.SEARCH_TYPE).TOKEN,\n object: token,\n preventClose: (0, $9IngI.TVA_CONFIG).popup.twoPopups && (0, $9IngI.TVA_CONFIG).popup.twoPopupsNoDialog\n });\n}\nasync function $7efbb077f7553c7f$var$_createActor(actor, options, userId) {\n if (userId && game.user.id != userId) return;\n // Check if random search is enabled and if so perform it\n const randSettings = (0, $9IngI.TVA_CONFIG).randomizer;\n if (randSettings.actorCreate) {\n let performRandomSearch = true;\n if (randSettings.linkedActorDisable && actor.prototypeToken.actorLink) performRandomSearch = false;\n if ($7efbb077f7553c7f$var$_disableRandomSearchForType(randSettings, actor)) performRandomSearch = false;\n if (performRandomSearch) {\n const img = await (0, $8MWlo.doRandomSearch)(actor.name, {\n searchType: (0, $eeGZt.SEARCH_TYPE).PORTRAIT,\n actor: actor\n });\n if (img) await (0, $eeGZt.updateActorImage)(actor, img[0]);\n if (!img) return;\n if (randSettings.diffImages) {\n let imgToken;\n if (randSettings.syncImages) imgToken = await (0, $8MWlo.doSyncSearch)(actor.name, img[1], {\n actor: actor\n });\n else imgToken = await (0, $8MWlo.doRandomSearch)(actor.name, {\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n actor: actor\n });\n if (imgToken) await (0, $eeGZt.updateTokenImage)(imgToken[0], {\n actor: actor,\n imgName: imgToken[1]\n });\n }\n return;\n }\n if (!randSettings.popupOnDisable) return;\n }\n // Check if pop-up is enabled and if so open it\n if (!(0, $9IngI.TVA_CONFIG).permissions.popups[game.user.role]) return;\n if ((0, $9IngI.TVA_CONFIG).popup.disableAutoPopupOnActorCreate && !(0, $eeGZt.keyPressed)(\"popupOverride\")) return;\n else if ($7efbb077f7553c7f$var$_disablePopupForType(actor)) return;\n (0, $coMHP.showArtSelect)(actor.name, {\n callback: async function(imgSrc, name) {\n const actTokens = actor.getActiveTokens();\n const token = actTokens.length === 1 ? actTokens[0] : null;\n await (0, $eeGZt.updateActorImage)(actor, imgSrc);\n if ((0, $9IngI.TVA_CONFIG).popup.twoPopups) $7efbb077f7553c7f$var$_twoPopupPrompt(actor, imgSrc, name, token);\n else (0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: actor,\n imgName: name,\n token: token\n });\n },\n searchType: (0, $9IngI.TVA_CONFIG).popup.twoPopups ? (0, $eeGZt.SEARCH_TYPE).PORTRAIT : (0, $eeGZt.SEARCH_TYPE).PORTRAIT_AND_TOKEN,\n object: actor,\n preventClose: (0, $9IngI.TVA_CONFIG).popup.twoPopups && (0, $9IngI.TVA_CONFIG).popup.twoPopupsNoDialog\n });\n}\nfunction $7efbb077f7553c7f$var$_disableRandomSearchForType(randSettings, actor) {\n if (!actor) return false;\n return randSettings[`${actor.type}Disable`] ?? false;\n}\nfunction $7efbb077f7553c7f$var$_disablePopupForType(actor) {\n if (!actor) return false;\n return (0, $9IngI.TVA_CONFIG).popup[`${actor.type}Disable`] ?? false;\n}\nfunction $7efbb077f7553c7f$var$_twoPopupPrompt(actor, imgSrc, imgName, token) {\n if ((0, $9IngI.TVA_CONFIG).popup.twoPopups && (0, $9IngI.TVA_CONFIG).popup.twoPopupsNoDialog) (0, $coMHP.showArtSelect)((token ?? actor.prototypeToken).name, {\n callback: (imgSrc, name)=>(0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: actor,\n imgName: name,\n token: token\n }),\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n object: token ? token : actor,\n force: true\n });\n else if ((0, $9IngI.TVA_CONFIG).popup.twoPopups) {\n let d = new Dialog({\n title: \"Portrait -> Token\",\n content: `<p>${game.i18n.localize(\"token-variants.windows.art-select.apply-same-art\")}</p>`,\n buttons: {\n one: {\n icon: '<i class=\"fas fa-check\"></i>',\n callback: ()=>{\n (0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: actor,\n imgName: imgName,\n token: token\n });\n const artSelects = Object.values(ui.windows).filter((app)=>app instanceof ArtSelect);\n for (const app of artSelects)app.close();\n }\n },\n two: {\n icon: '<i class=\"fas fa-times\"></i>',\n callback: ()=>{\n (0, $coMHP.showArtSelect)((token ?? actor.prototypeToken).name, {\n callback: (imgSrc, name)=>(0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: actor,\n imgName: name,\n token: token\n }),\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n object: token ? token : actor,\n force: true\n });\n }\n }\n },\n default: \"one\"\n });\n d.render(true);\n }\n}\n\n});\n\n\n\n\n\nparcelRequire.register(\"3pMx9\", function(module, exports) {\n\n$parcel$export(module.exports, \"REGISTERED_WRAPPERS\", () => $27c95aabd6b0cb79$export$fc1d449abe42f670);\n$parcel$export(module.exports, \"registerWrapper\", () => $27c95aabd6b0cb79$export$4e224afa9c6f52f3);\n$parcel$export(module.exports, \"unregisterWrapper\", () => $27c95aabd6b0cb79$export$d52c0d8a14cf2845);\n$parcel$export(module.exports, \"registerAllWrappers\", () => $27c95aabd6b0cb79$export$84e6c54a990a03d8);\n\nvar $fFpXf = parcelRequire(\"fFpXf\");\n\nvar $9znht = parcelRequire(\"9znht\");\n\nvar $56MAr = parcelRequire(\"56MAr\");\n\nvar $kPeJW = parcelRequire(\"kPeJW\");\nconst $27c95aabd6b0cb79$export$fc1d449abe42f670 = {};\nfunction $27c95aabd6b0cb79$export$4e224afa9c6f52f3(feature_id, name, fn, method = \"WRAPPER\") {\n if (typeof libWrapper !== \"function\") return;\n if (!(feature_id in $27c95aabd6b0cb79$export$fc1d449abe42f670)) $27c95aabd6b0cb79$export$fc1d449abe42f670[feature_id] = {};\n if (name in $27c95aabd6b0cb79$export$fc1d449abe42f670[feature_id]) return;\n $27c95aabd6b0cb79$export$fc1d449abe42f670[feature_id][name] = libWrapper.register(\"token-variants\", name, fn, method);\n}\nfunction $27c95aabd6b0cb79$export$d52c0d8a14cf2845(feature_id, name) {\n if (typeof libWrapper !== \"function\") return;\n if (feature_id in $27c95aabd6b0cb79$export$fc1d449abe42f670 && name in $27c95aabd6b0cb79$export$fc1d449abe42f670[feature_id]) {\n libWrapper.unregister(\"token-variants\", $27c95aabd6b0cb79$export$fc1d449abe42f670[feature_id][name]);\n delete $27c95aabd6b0cb79$export$fc1d449abe42f670[feature_id][name];\n }\n}\nfunction $27c95aabd6b0cb79$export$84e6c54a990a03d8() {\n // User to Image mappings for Tile and Tokens\n (0, $kPeJW.registerUserMappingWrappers)();\n // Hide effect icons\n (0, $fFpXf.registerEffectIconWrappers)();\n // Token HUD Variants Management\n (0, $56MAr.registerHUDWrappers)();\n // Hide Core Token Elements\n (0, $9znht.registerHideElementWrappers)();\n}\n\n});\nparcelRequire.register(\"fFpXf\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerEffectIconWrappers\", () => $b67ed160259a7178$export$3a8ef264ac3111f8);\n\nvar $dmUqi = parcelRequire(\"dmUqi\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $3pMx9 = parcelRequire(\"3pMx9\");\nconst $b67ed160259a7178$var$feature_id = \"EffectIcons\";\nfunction $b67ed160259a7178$export$3a8ef264ac3111f8() {\n (0, $3pMx9.unregisterWrapper)($b67ed160259a7178$var$feature_id, \"Token.prototype.drawEffects\");\n (0, $3pMx9.unregisterWrapper)($b67ed160259a7178$var$feature_id, \"CombatTracker.prototype.getData\");\n if (!(0, $9IngI.FEATURE_CONTROL)[$b67ed160259a7178$var$feature_id]) return;\n if (!(0, $9IngI.TVA_CONFIG).disableEffectIcons && (0, $9IngI.TVA_CONFIG).filterEffectIcons && ![\n \"pf1e\",\n \"pf2e\"\n ].includes(game.system.id)) (0, $3pMx9.registerWrapper)($b67ed160259a7178$var$feature_id, \"Token.prototype.drawEffects\", $b67ed160259a7178$var$_drawEffects, \"OVERRIDE\");\n else if ((0, $9IngI.TVA_CONFIG).disableEffectIcons) (0, $3pMx9.registerWrapper)($b67ed160259a7178$var$feature_id, \"Token.prototype.drawEffects\", $b67ed160259a7178$var$_drawEffects_fullReplace, \"OVERRIDE\");\n else if ((0, $9IngI.TVA_CONFIG).displayEffectIconsOnHover) (0, $3pMx9.registerWrapper)($b67ed160259a7178$var$feature_id, \"Token.prototype.drawEffects\", $b67ed160259a7178$var$_drawEffects_hoverOnly, \"WRAPPER\");\n if ((0, $9IngI.TVA_CONFIG).disableEffectIcons || (0, $9IngI.TVA_CONFIG).filterCustomEffectIcons) (0, $3pMx9.registerWrapper)($b67ed160259a7178$var$feature_id, \"CombatTracker.prototype.getData\", $b67ed160259a7178$var$_combatTrackerGetData, \"WRAPPER\");\n}\nasync function $b67ed160259a7178$var$_drawEffects_hoverOnly(wrapped, ...args) {\n let result = await wrapped(...args);\n this.effects.visible = this.hover;\n return result;\n}\nasync function $b67ed160259a7178$var$_drawEffects_fullReplace(...args) {\n this.effects.removeChildren().forEach((c)=>c.destroy());\n this.effects.bg = this.effects.addChild(new PIXI.Graphics());\n this.effects.overlay = null;\n}\nasync function $b67ed160259a7178$var$_combatTrackerGetData(wrapped, ...args) {\n let data = await wrapped(...args);\n if (data && data.combat && data.turns) {\n const combat = data.combat;\n for (const turn of data.turns){\n const combatant = combat.combatants.find((c)=>c.id === turn.id);\n if (combatant) {\n if ((0, $9IngI.TVA_CONFIG).disableEffectIcons) turn.effects = new Set();\n else if ((0, $9IngI.TVA_CONFIG).filterEffectIcons) {\n const restrictedEffects = $b67ed160259a7178$var$_getRestrictedEffects(combatant.token);\n // Copied from CombatTracker.getData(...)\n turn.effects = new Set();\n if (combatant.token) {\n combatant.token.effects.forEach((e)=>turn.effects.add(e));\n if (combatant.token.overlayEffect) turn.effects.add(combatant.token.overlayEffect);\n }\n // modified to filter restricted effects\n if (combatant.actor) for (const effect of combatant.actor.temporaryEffects){\n if (effect.statuses.has(CONFIG.specialStatusEffects.DEFEATED)) ;\n else if (effect.icon && !restrictedEffects.includes(effect.name ?? effect.label)) turn.effects.add(effect.icon);\n }\n // end of copy\n }\n }\n }\n }\n return data;\n}\nasync function $b67ed160259a7178$var$_drawEffects(...args) {\n this.effects.renderable = false;\n this.effects.removeChildren().forEach((c)=>c.destroy());\n this.effects.bg = this.effects.addChild(new PIXI.Graphics());\n this.effects.overlay = null;\n // Categorize new effects\n let tokenEffects = this.document.effects;\n let actorEffects = this.actor?.temporaryEffects || [];\n let overlay = {\n src: this.document.overlayEffect,\n tint: null\n };\n // Modified from the original token.drawEffects\n if ((0, $9IngI.TVA_CONFIG).displayEffectIconsOnHover) this.effects.visible = this.hover;\n if (tokenEffects.length || actorEffects.length) {\n const restrictedEffects = $b67ed160259a7178$var$_getRestrictedEffects(this.document);\n actorEffects = actorEffects.filter((ef)=>!restrictedEffects.includes(ef.name ?? ef.label));\n tokenEffects = tokenEffects.filter(// check if it's a string here\n // for tokens without representing actors effects are just stored as paths to icons\n (ef)=>typeof ef === \"string\" || !restrictedEffects.includes(ef.name ?? ef.label));\n }\n // End of modifications\n // Draw status effects\n if (tokenEffects.length || actorEffects.length) {\n const promises = [];\n // Draw actor effects first\n for (let f of actorEffects){\n if (!f.icon) continue;\n const tint = Color.from(f.tint ?? null);\n if (f.getFlag(\"core\", \"overlay\")) {\n overlay = {\n src: f.icon,\n tint: tint\n };\n continue;\n }\n promises.push(this._drawEffect(f.icon, tint));\n }\n // Next draw token effects\n for (let f of tokenEffects)promises.push(this._drawEffect(f, null));\n await Promise.all(promises);\n }\n // Draw overlay effect\n this.effects.overlay = await this._drawOverlay(overlay.src, overlay.tint);\n this._refreshEffects();\n this.effects.renderable = true;\n}\nfunction $b67ed160259a7178$var$_getRestrictedEffects(tokenDoc) {\n let restrictedEffects = (0, $9IngI.TVA_CONFIG).filterIconList;\n if ((0, $9IngI.TVA_CONFIG).filterCustomEffectIcons) {\n const mappings = (0, $dmUqi.getAllEffectMappings)(tokenDoc);\n if (mappings) restrictedEffects = restrictedEffects.concat(mappings.map((m)=>m.expression));\n }\n return restrictedEffects;\n}\n\n});\n\nparcelRequire.register(\"9znht\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerHideElementWrappers\", () => $6f79710a2c22071f$export$ad041355fd382ef2);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $3pMx9 = parcelRequire(\"3pMx9\");\nconst $6f79710a2c22071f$var$feature_id = \"HideElement\";\nfunction $6f79710a2c22071f$export$ad041355fd382ef2() {\n (0, $3pMx9.unregisterWrapper)($6f79710a2c22071f$var$feature_id, \"Token.prototype._getTooltipText\");\n if ((0, $9IngI.FEATURE_CONTROL)[$6f79710a2c22071f$var$feature_id] && (0, $9IngI.TVA_CONFIG).hideElevationTooltip) (0, $3pMx9.registerWrapper)($6f79710a2c22071f$var$feature_id, \"Token.prototype._getTooltipText\", $6f79710a2c22071f$var$_getTooltipText, \"WRAPPER\");\n (0, $3pMx9.unregisterWrapper)($6f79710a2c22071f$var$feature_id, \"Token.prototype._refreshBorder\");\n if ((0, $9IngI.FEATURE_CONTROL)[$6f79710a2c22071f$var$feature_id] && (0, $9IngI.TVA_CONFIG).hideTokenBorder) (0, $3pMx9.registerWrapper)($6f79710a2c22071f$var$feature_id, \"Token.prototype._refreshBorder\", $6f79710a2c22071f$var$_refreshVisibility, \"OVERRIDE\");\n}\nfunction $6f79710a2c22071f$var$_getTooltipText(wrapped, ...args) {\n wrapped(...args);\n return \"\";\n}\nfunction $6f79710a2c22071f$var$_refreshVisibility(...args) {}\n\n});\n\nparcelRequire.register(\"56MAr\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerHUDWrappers\", () => $3b83339781f1ddc1$export$4ed4ca6a96642941);\n\nvar $6aWyX = parcelRequire(\"6aWyX\");\n\nvar $bZ3HW = parcelRequire(\"bZ3HW\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $3pMx9 = parcelRequire(\"3pMx9\");\nconst $3b83339781f1ddc1$var$feature_id = \"HUD\";\nfunction $3b83339781f1ddc1$export$4ed4ca6a96642941() {\n (0, $3pMx9.unregisterWrapper)($3b83339781f1ddc1$var$feature_id, \"TokenHUD.prototype.clear\");\n if ((0, $9IngI.FEATURE_CONTROL)[$3b83339781f1ddc1$var$feature_id]) (0, $3pMx9.registerWrapper)($3b83339781f1ddc1$var$feature_id, \"TokenHUD.prototype.clear\", $3b83339781f1ddc1$var$_clear, \"MIXED\");\n}\nfunction $3b83339781f1ddc1$var$_clear(wrapped, ...args) {\n $3b83339781f1ddc1$var$_applyVariantFlags();\n // HUD should not close if we're in assisted overlay positioning mode\n if ((0, $bZ3HW.Reticle).active && (0, $bZ3HW.Reticle).mode === \"hud\") return;\n return wrapped(...args);\n}\nasync function $3b83339781f1ddc1$var$_applyVariantFlags() {\n const { actor: actor, variants: variants } = (0, $6aWyX.TOKEN_HUD_VARIANTS);\n if (actor) {\n if (!variants?.length) actor.unsetFlag(\"token-variants\", \"variants\");\n else actor.setFlag(\"token-variants\", \"variants\", variants);\n }\n (0, $6aWyX.TOKEN_HUD_VARIANTS).actor = null;\n (0, $6aWyX.TOKEN_HUD_VARIANTS).variants = null;\n}\n\n});\nparcelRequire.register(\"bZ3HW\", function(module, exports) {\n\n$parcel$export(module.exports, \"Reticle\", () => $8b98447900c587c7$export$9d1b0e5bb156c053);\n\nvar $eYkM9 = parcelRequire(\"eYkM9\");\n\nvar $4rd87 = parcelRequire(\"4rd87\");\n\nvar $8QbcE = parcelRequire(\"8QbcE\");\n\nvar $bFZU7 = parcelRequire(\"bFZU7\");\nclass $8b98447900c587c7$export$9d1b0e5bb156c053 {\n static app;\n static fields;\n static reticleOverlay;\n static active = false;\n static hitTest;\n static token = null;\n static dialog = null;\n // Offset calculation controls\n static mode = \"tooltip\";\n static increment = 1;\n static _onReticleMove(event) {\n if (this.reticleOverlay.isMouseDown) {\n let pos = event.data.getLocalPosition(this.reticleOverlay);\n this.config.pOffsetX = 0;\n this.config.pOffsetY = 0;\n this.config.offsetX = 0;\n this.config.offsetY = 0;\n if (this.mode === \"token\") {\n this.config.linkRotation = true;\n this.config.linkMirror = true;\n }\n this.tvaOverlay.refresh(this.config, {\n preview: true\n });\n const tCoord = {\n x: this.tvaOverlay.x,\n y: this.tvaOverlay.y\n };\n if (this.tvaOverlay.overlayConfig.parentID) {\n let parent = this.tvaOverlay;\n do {\n parent = parent.parent;\n tCoord.x += parent.x;\n tCoord.y += parent.y;\n }while (!(parent instanceof (0, $8QbcE.TVAOverlay)));\n }\n let dx = pos.x - tCoord.x;\n let dy = pos.y - tCoord.y;\n let angle = 0;\n if (!this.config.animation.relative) {\n angle = this.config.angle;\n if (this.config.linkRotation) angle += this.tvaOverlay.object.document.rotation;\n }\n [dx, dy] = $8b98447900c587c7$var$rotate(0, 0, dx, dy, angle);\n dx = $8b98447900c587c7$var$round(dx, this.increment);\n dy = $8b98447900c587c7$var$round(dy, this.increment);\n // let lPos = event.data.getLocalPosition(this.tvaOverlay);\n // console.log(lPos);\n // // let dx = lPos.x;\n // // let dy = lPos.y;\n if (this.mode === \"static\") {\n this.config.pOffsetX = dx;\n this.config.pOffsetY = dy;\n } else if (this.mode === \"token\") {\n this.config.offsetX = -dx / this.tvaOverlay.object.w;\n this.config.offsetY = -dy / this.tvaOverlay.object.h;\n } else {\n let token = this.tvaOverlay.object;\n let pWidth;\n let pHeight;\n if (this.tvaOverlay.overlayConfig.parentID) {\n pWidth = (this.tvaOverlay.parent.shapesWidth ?? this.tvaOverlay.parent.width) / this.tvaOverlay.parent.scale.x;\n pHeight = (this.tvaOverlay.parent.shapesHeight ?? this.tvaOverlay.parent.height) / this.tvaOverlay.parent.scale.y;\n } else {\n pWidth = token.w;\n pHeight = token.h;\n }\n if (this.mode === \"tooltip\") {\n if (Math.abs(dx) >= pWidth / 2) {\n this.config.offsetX = 0.5 * (dx < 0 ? 1 : -1);\n dx += pWidth / 2 * (dx < 0 ? 1 : -1);\n } else {\n this.config.offsetX = -dx / this.tvaOverlay.object.w;\n dx = 0;\n }\n if (Math.abs(dy) >= pHeight / 2) {\n this.config.offsetY = 0.5 * (dy < 0 ? 1 : -1);\n dy += pHeight / 2 * (dy < 0 ? 1 : -1);\n } else {\n this.config.offsetY = -dy / this.tvaOverlay.object.h;\n dy = 0;\n }\n } else {\n if (Math.abs(dx) >= pWidth / 2) {\n this.config.offsetX = 0.5 * (dx < 0 ? 1 : -1);\n dx += pWidth / 2 * (dx < 0 ? 1 : -1);\n } else if (Math.abs(dy) >= pHeight / 2) {\n this.config.offsetY = 0.5 * (dy < 0 ? 1 : -1);\n dy += pHeight / 2 * (dy < 0 ? 1 : -1);\n } else {\n this.config.offsetX = -dx / this.tvaOverlay.object.w;\n dx = 0;\n this.config.offsetY = -dy / this.tvaOverlay.object.h;\n dy = 0;\n }\n }\n this.config.pOffsetX = dx;\n this.config.pOffsetY = dy;\n }\n this.tvaOverlay.refresh(this.config, {\n preview: true\n });\n }\n }\n static minimizeApps() {\n Object.values(ui.windows).forEach((app)=>{\n if (app instanceof (0, $4rd87.OverlayConfig) || app instanceof (0, $eYkM9.default)) app.minimize();\n });\n }\n static maximizeApps() {\n Object.values(ui.windows).forEach((app)=>{\n if (app instanceof (0, $4rd87.OverlayConfig) || app instanceof (0, $eYkM9.default)) app.maximize();\n });\n }\n static activate({ tvaOverlay: tvaOverlay = null, config: config = {} } = {}) {\n if (this.deactivate() || !canvas.ready) return false;\n if (!tvaOverlay || !config) return false;\n if (this.reticleOverlay) this.reticleOverlay.destroy(true);\n const interaction = canvas.app.renderer.plugins.interaction;\n if (!interaction.cursorStyles[\"reticle\"]) interaction.cursorStyles[\"reticle\"] = \"url('modules/token-variants/img/reticle.webp'), auto\";\n this.tvaOverlay = tvaOverlay;\n this.minimizeApps();\n this.config = (0, $bFZU7.evaluateOverlayExpressions)(deepClone(config), this.tvaOverlay.object, {\n overlayConfig: config\n });\n // Setup the overlay to be always visible while we're adjusting its position\n this.config.alwaysVisible = true;\n this.active = true;\n // Create the reticle overlay\n this.reticleOverlay = new PIXI.Container();\n this.reticleOverlay.hitArea = canvas.dimensions.rect;\n this.reticleOverlay.cursor = \"reticle\";\n this.reticleOverlay.interactive = true;\n this.reticleOverlay.zIndex = Infinity;\n const stopEvent = function(event) {\n event.preventDefault();\n // event.stopPropagation();\n };\n this.reticleOverlay.on(\"mousedown\", (event)=>{\n event.preventDefault();\n if (event.data.originalEvent.which != 2 && event.data.originalEvent.nativeEvent.which != 2) {\n this.reticleOverlay.isMouseDown = true;\n this._onReticleMove(event);\n }\n });\n this.reticleOverlay.on(\"pointermove\", (event)=>{\n event.preventDefault();\n // event.stopPropagation();\n this._onReticleMove(event);\n });\n this.reticleOverlay.on(\"mouseup\", (event)=>{\n event.preventDefault();\n this.reticleOverlay.isMouseDown = false;\n });\n this.reticleOverlay.on(\"click\", (event)=>{\n event.preventDefault();\n if (event.data.originalEvent.which == 2 || event.data.originalEvent.nativeEvent.which == 2) this.deactivate();\n });\n canvas.stage.addChild(this.reticleOverlay);\n this.dialog = $8b98447900c587c7$var$displayControlDialog();\n return true;\n }\n static deactivate() {\n if (this.active) {\n if (this.reticleOverlay) this.reticleOverlay.parent?.removeChild(this.reticleOverlay);\n this.active = false;\n this.tvaOverlay = null;\n if (this.dialog && this.dialog._state !== Application.RENDER_STATES.CLOSED) this.dialog.close(true);\n this.dialog = null;\n this.maximizeApps();\n const app = Object.values(ui.windows).find((app)=>app instanceof (0, $4rd87.OverlayConfig));\n if (!app) {\n this.config = null;\n return;\n }\n const form = $(app.form);\n [\n \"pOffsetX\",\n \"pOffsetY\",\n \"offsetX\",\n \"offsetY\"\n ].forEach((field)=>{\n if (field in this.config) form.find(`[name=\"${field}\"]`).val(this.config[field]);\n });\n if (this.mode === \"token\") {\n [\n \"linkRotation\",\n \"linkMirror\"\n ].forEach((field)=>{\n form.find(`[name=\"${field}\"]`).prop(\"checked\", true);\n });\n [\n \"linkDimensionsX\",\n \"linkDimensionsY\"\n ].forEach((field)=>{\n form.find(`[name=\"${field}\"]`).prop(\"checked\", false);\n });\n } else [\n \"linkRotation\",\n \"linkMirror\"\n ].forEach((field)=>{\n form.find(`[name=\"${field}\"]`).prop(\"checked\", false);\n });\n if (this.mode === \"hud\") form.find('[name=\"ui\"]').prop(\"checked\", true).trigger(\"change\");\n form.find('[name=\"anchor.x\"]').val(this.config.anchor.x);\n form.find('[name=\"anchor.y\"]').val(this.config.anchor.y).trigger(\"change\");\n this.config = null;\n return true;\n }\n }\n}\nfunction $8b98447900c587c7$var$displayControlDialog() {\n const d = new Dialog({\n title: \"Set Overlay Position\",\n content: `\r\n <style>\r\n .images { display: flex; }\r\n .images a { flex: 20%; width: 50px; margin: 2px; }\r\n .images a.active img { border-color: orange; border-width: 2px; }\r\n .anchorlbl {margin: auto; display: table; }\r\n </style>\r\n <div class=\"images\">\r\n <a data-id=\"token\"><img src=\"modules/token-variants/img/token_mode.png\"></img></a>\r\n <a data-id=\"tooltip\"><img src=\"modules/token-variants/img/tooltip_mode.png\"></img></a>\r\n <a data-id=\"hud\"><img src=\"modules/token-variants/img/hud_mode.png\"></img></a>\r\n <a data-id=\"static\"><img src=\"modules/token-variants/img/static_mode.png\"></img></a>\r\n </div>\r\n <br>\r\n <label class=\"anchorlbl\">Anchor</label>\r\n <div class=\"tva-anchor\">\r\n <input type=\"radio\" class=\"top left\" name=\"anchor\">\r\n <input type=\"radio\" class=\"top center\" name=\"anchor\">\r\n <input type=\"radio\" class=\"top right\" name=\"anchor\">\r\n <input type=\"radio\" class=\"mid left\" name=\"anchor\">\r\n <input type=\"radio\" class=\"mid center\" name=\"anchor\">\r\n <input type=\"radio\" class=\"mid right\" name=\"anchor\">\r\n <input type=\"radio\" class=\"bot left\" name=\"anchor\">\r\n <input type=\"radio\" class=\"bot center\" name=\"anchor\">\r\n <input type=\"radio\" class=\"bot right\" name=\"anchor\">\r\n </div>\r\n <div class=\"form-group\">\r\n <label>Step Size</label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" name=\"step\" min=\"0\" step=\"1\" value=\"${$8b98447900c587c7$export$9d1b0e5bb156c053.increment}\">\r\n </div>\r\n </div>\r\n <p class=\"notes\"><b>Left-Click</b> to move the overlay</p>\r\n <p class=\"notes\"><b>Middle-Click</b> or <b>Close Dialog</b> to exit overlay positioning</p>\r\n `,\n buttons: {},\n render: (html)=>{\n // Mode Images\n const images = html.find(\".images a\");\n html.find(\".images a\").on(\"click\", (event)=>{\n images.removeClass(\"active\");\n const target = $(event.target).closest(\"a\");\n target.addClass(\"active\");\n $8b98447900c587c7$export$9d1b0e5bb156c053.mode = target.data(\"id\");\n });\n html.find(`[data-id=\"${$8b98447900c587c7$export$9d1b0e5bb156c053.mode}\"]`).addClass(\"active\");\n // Anchor\n let anchorX = $8b98447900c587c7$export$9d1b0e5bb156c053.config?.anchor?.x || 0;\n let anchorY = $8b98447900c587c7$export$9d1b0e5bb156c053.config?.anchor?.y || 0;\n let classes = \"\";\n if (anchorX < 0.5) classes += \".left\";\n else if (anchorX > 0.5) classes += \".right\";\n else classes += \".center\";\n if (anchorY < 0.5) classes += \".top\";\n else if (anchorY > 0.5) classes += \".bot\";\n else classes += \".mid\";\n html.find(\".tva-anchor\").find(classes).prop(\"checked\", true);\n // end - Pre-select anchor\n html.find('input[name=\"anchor\"]').on(\"change\", (event)=>{\n const anchor = $(event.target);\n let x;\n let y;\n if (anchor.hasClass(\"left\")) x = 0;\n else if (anchor.hasClass(\"center\")) x = 0.5;\n else x = 1;\n if (anchor.hasClass(\"top\")) y = 0;\n else if (anchor.hasClass(\"mid\")) y = 0.5;\n else y = 1;\n $8b98447900c587c7$export$9d1b0e5bb156c053.config.anchor.x = x;\n $8b98447900c587c7$export$9d1b0e5bb156c053.config.anchor.y = y;\n });\n html.find('[name=\"step\"]').on(\"input\", (event)=>{\n $8b98447900c587c7$export$9d1b0e5bb156c053.increment = $(event.target).val() || 1;\n });\n },\n close: ()=>$8b98447900c587c7$export$9d1b0e5bb156c053.deactivate()\n });\n d.render(true);\n setTimeout(()=>d.setPosition({\n left: 200,\n top: window.innerHeight / 2,\n height: \"auto\"\n }), 100);\n return d;\n}\nfunction $8b98447900c587c7$var$round(number, increment, offset = 0) {\n return Math.ceil((number - offset) / increment) * increment + offset;\n}\nfunction $8b98447900c587c7$var$rotate(cx, cy, x, y, angle) {\n var radians = Math.PI / 180 * angle, cos = Math.cos(radians), sin = Math.sin(radians), nx = cos * (x - cx) + sin * (y - cy) + cx, ny = cos * (y - cy) - sin * (x - cx) + cy;\n return [\n nx,\n ny\n ];\n}\n\n});\n\n\nparcelRequire.register(\"kPeJW\", function(module, exports) {\n\n$parcel$export(module.exports, \"registerUserMappingWrappers\", () => $f294011ce9211d57$export$1a9a3a33e776f780);\n$parcel$export(module.exports, \"assignUserSpecificImage\", () => $f294011ce9211d57$export$649a7855fe41be7);\n$parcel$export(module.exports, \"unassignUserSpecificImage\", () => $f294011ce9211d57$export$b035d326d57db09a);\n$parcel$export(module.exports, \"assignUserSpecificImageToSelected\", () => $f294011ce9211d57$export$c27a4515fabd8fad);\n$parcel$export(module.exports, \"unassignUserSpecificImageFromSelected\", () => $f294011ce9211d57$export$779b84c2df9c577f);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $3pMx9 = parcelRequire(\"3pMx9\");\nconst $f294011ce9211d57$var$feature_id = \"UserMappings\";\nfunction $f294011ce9211d57$export$1a9a3a33e776f780() {\n (0, $3pMx9.registerWrapper)($f294011ce9211d57$var$feature_id, \"Tile.prototype.draw\", $f294011ce9211d57$var$_draw);\n (0, $3pMx9.registerWrapper)($f294011ce9211d57$var$feature_id, \"Token.prototype.draw\", $f294011ce9211d57$var$_draw);\n}\nasync function $f294011ce9211d57$var$_draw(wrapped, ...args) {\n let result;\n // If the Token/Tile has a UserToImage mappings momentarily set document.texture.src to it\n // so that it's texture gets loaded instead of the actual Token image\n const mappings = this.document.getFlag(\"token-variants\", \"userMappings\") || {};\n const img = mappings[game.userId];\n let previous;\n if (img) {\n previous = this.document.texture.src;\n this.document.texture.src = img;\n this.tva_iconOverride = img;\n result = await wrapped(...args);\n this.document.texture.src = previous;\n $f294011ce9211d57$var$overrideVisibility(this, img);\n } else {\n $f294011ce9211d57$var$overrideVisibility(this);\n result = await wrapped(...args);\n }\n return result;\n}\n/**\r\n * If the img is the same as TVA_CONFIG.invisibleImage then we'll override the isVisible\r\n * getter to return false of this client if it's not a GM. Reset it to default if not.\r\n * @param {*} obj object whose isVisible is to be overriden\r\n * @param {*} img UserToImage mapping\r\n */ function $f294011ce9211d57$var$overrideVisibility(obj, img) {\n if (img && (0, $eeGZt.decodeURISafely)(img) === (0, $9IngI.TVA_CONFIG).invisibleImage && !obj.tva_customVisibility) {\n const originalIsVisible = $f294011ce9211d57$var$_getIsVisibleDescriptor(obj).get;\n Object.defineProperty(obj, \"isVisible\", {\n get: function() {\n const isVisible = originalIsVisible.call(this);\n if (isVisible && !game.user.isGM) return false;\n return isVisible;\n },\n configurable: true\n });\n obj.tva_customVisibility = true;\n } else if (!img && obj.tva_customVisibility) {\n Object.defineProperty(obj, \"isVisible\", $f294011ce9211d57$var$_getIsVisibleDescriptor(obj));\n delete obj.tva_customVisibility;\n }\n}\nfunction $f294011ce9211d57$var$_getIsVisibleDescriptor(obj) {\n let iObj = Object.getPrototypeOf(obj);\n let descriptor = null;\n while(iObj){\n descriptor = Object.getOwnPropertyDescriptor(iObj, \"isVisible\");\n if (descriptor) break;\n iObj = Object.getPrototypeOf(iObj);\n }\n return descriptor;\n}\nfunction $f294011ce9211d57$export$649a7855fe41be7(token, img, { userName: userName = null, userId: userId = null } = {}) {\n if (!img) return $f294011ce9211d57$export$b035d326d57db09a(token, {\n userName: userName,\n userId: userId\n });\n if (userName instanceof Array) {\n for (const name of userName)$f294011ce9211d57$export$649a7855fe41be7(token, img, {\n userName: name\n });\n return;\n }\n if (userId instanceof Array) {\n for (const id of userId)$f294011ce9211d57$export$649a7855fe41be7(token, img, {\n userId: id\n });\n return;\n }\n let id = userId;\n if (!id && userName) id = game.users.find((u)=>u.name === userName)?.id;\n if (!id) return;\n const doc = token.document ?? token;\n const mappings = doc.getFlag(\"token-variants\", \"userMappings\") || {};\n mappings[id] = img;\n doc.setFlag(\"token-variants\", \"userMappings\", mappings);\n}\nfunction $f294011ce9211d57$export$c27a4515fabd8fad(img, opts = {}) {\n const selected = [\n ...canvas.tokens.controlled\n ];\n for (const t of selected)$f294011ce9211d57$export$649a7855fe41be7(t, img, opts);\n}\nfunction $f294011ce9211d57$export$b035d326d57db09a(token, { userName: userName = null, userId: userId = null } = {}) {\n if (userName instanceof Array) {\n for (const name of userName)$f294011ce9211d57$export$b035d326d57db09a(token, {\n userName: name\n });\n return;\n }\n if (userId instanceof Array) {\n for (const id of userId)$f294011ce9211d57$export$b035d326d57db09a(token, {\n userId: id\n });\n return;\n }\n let id = userId;\n if (!id && userName) id = game.users.find((u)=>u.name === userName)?.id;\n if (!id) {\n if (!userName && !userId) (token.document ?? token).unsetFlag(\"token-variants\", \"userMappings\");\n } else {\n const update = {};\n update[\"flags.token-variants.userMappings.-=\" + id] = null;\n (token.document ?? token).update(update);\n }\n}\nfunction $f294011ce9211d57$export$779b84c2df9c577f(opts = {}) {\n const selected = [\n ...canvas.tokens.controlled\n ];\n for (const t of selected)$f294011ce9211d57$export$b035d326d57db09a(t, opts);\n}\n\n});\n\n\n\nparcelRequire.register(\"dxtrh\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $9db5316d801b7bc5$export$2e2bcd8739ae039);\n\nvar $coMHP = parcelRequire(\"coMHP\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $7OP4c = parcelRequire(\"7OP4c\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $fVv34 = parcelRequire(\"fVv34\");\n\nvar $2jMtH = parcelRequire(\"2jMtH\");\n\nvar $8MWlo = parcelRequire(\"8MWlo\");\nasync function $9db5316d801b7bc5$var$autoApply(actor, image1, image2, formData, typeOverride) {\n let portraitFound = formData.ignorePortrait;\n let tokenFound = formData.ignoreToken;\n if (formData.diffImages) {\n let results = [];\n if (!formData.ignorePortrait) {\n results = await (0, $8MWlo.doImageSearch)(actor.name, {\n searchType: typeOverride ?? (0, $eeGZt.SEARCH_TYPE).PORTRAIT,\n simpleResults: true,\n searchOptions: formData.searchOptions\n });\n if ((results ?? []).length != 0) {\n portraitFound = true;\n await (0, $eeGZt.updateActorImage)(actor, results[0], false, formData.compendium);\n }\n }\n if (!formData.ignoreToken) {\n results = await (0, $8MWlo.doImageSearch)(actor.prototypeToken.name, {\n searchType: (0, $eeGZt.SEARCH_TYPE).TOKEN,\n simpleResults: true,\n searchOptions: formData.searchOptions\n });\n if ((results ?? []).length != 0) {\n tokenFound = true;\n (0, $eeGZt.updateTokenImage)(results[0], {\n actor: actor,\n pack: formData.compendium,\n applyDefaultConfig: false\n });\n }\n }\n } else {\n let results = await (0, $8MWlo.doImageSearch)(actor.name, {\n searchType: typeOverride ?? (0, $eeGZt.SEARCH_TYPE).PORTRAIT_AND_TOKEN,\n simpleResults: true,\n searchOptions: formData.searchOptions\n });\n if ((results ?? []).length != 0) {\n portraitFound = tokenFound = true;\n (0, $eeGZt.updateTokenImage)(results[0], {\n actor: actor,\n actorUpdate: {\n img: results[0]\n },\n pack: formData.compendium,\n applyDefaultConfig: false\n });\n }\n }\n if (!(tokenFound && portraitFound) && formData.autoDisplayArtSelect) $9db5316d801b7bc5$var$addToArtSelectQueue(actor, image1, image2, formData, typeOverride);\n}\nfunction $9db5316d801b7bc5$var$addToArtSelectQueue(actor, image1, image2, formData, typeOverride) {\n if (formData.diffImages) {\n if (!formData.ignorePortrait && !formData.ignoreToken) (0, $7OP4c.addToQueue)(actor.name, {\n searchType: typeOverride ?? (0, $eeGZt.SEARCH_TYPE).PORTRAIT,\n object: actor,\n preventClose: true,\n image1: image1,\n image2: image2,\n displayMode: (0, $7OP4c.ArtSelect).IMAGE_DISPLAY.PORTRAIT,\n searchOptions: formData.searchOptions,\n callback: async function(imgSrc, _) {\n await (0, $eeGZt.updateActorImage)(actor, imgSrc);\n (0, $coMHP.showArtSelect)(actor.prototypeToken.name, {\n searchType: typeOverride ?? (0, $eeGZt.SEARCH_TYPE).TOKEN,\n object: actor,\n force: true,\n image1: imgSrc,\n image2: image2,\n displayMode: (0, $7OP4c.ArtSelect).IMAGE_DISPLAY.TOKEN,\n searchOptions: formData.searchOptions,\n callback: (imgSrc, name)=>(0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: actor,\n imgName: name,\n applyDefaultConfig: false\n })\n });\n }\n });\n else if (formData.ignorePortrait) (0, $7OP4c.addToQueue)(actor.name, {\n searchType: typeOverride ?? (0, $eeGZt.SEARCH_TYPE).TOKEN,\n object: actor,\n image1: image1,\n image2: image2,\n displayMode: (0, $7OP4c.ArtSelect).IMAGE_DISPLAY.TOKEN,\n searchOptions: formData.searchOptions,\n callback: async function(imgSrc, name) {\n (0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: actor,\n imgName: name,\n applyDefaultConfig: false\n });\n }\n });\n else if (formData.ignoreToken) (0, $7OP4c.addToQueue)(actor.name, {\n searchType: typeOverride ?? (0, $eeGZt.SEARCH_TYPE).PORTRAIT,\n object: actor,\n image1: image1,\n image2: image2,\n displayMode: (0, $7OP4c.ArtSelect).IMAGE_DISPLAY.PORTRAIT,\n searchOptions: formData.searchOptions,\n callback: async function(imgSrc, name) {\n await (0, $eeGZt.updateActorImage)(actor, imgSrc);\n }\n });\n } else (0, $7OP4c.addToQueue)(actor.name, {\n searchType: typeOverride ?? (0, $eeGZt.SEARCH_TYPE).PORTRAIT_AND_TOKEN,\n object: actor,\n image1: image1,\n image2: image2,\n displayMode: (0, $7OP4c.ArtSelect).IMAGE_DISPLAY.PORTRAIT_TOKEN,\n searchOptions: formData.searchOptions,\n callback: async function(imgSrc, name) {\n await (0, $eeGZt.updateActorImage)(actor, imgSrc);\n (0, $eeGZt.updateTokenImage)(imgSrc, {\n actor: actor,\n imgName: name,\n applyDefaultConfig: false\n });\n }\n });\n}\nclass $9db5316d801b7bc5$export$2e2bcd8739ae039 extends FormApplication {\n constructor(){\n super({}, {});\n this.searchOptions = deepClone((0, $9IngI.getSearchOptions)());\n mergeObject(this.searchOptions, deepClone((0, $9IngI.TVA_CONFIG).compendiumMapper.searchOptions));\n this._fixSearchPaths();\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-compendium-map-config\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/compendiumMap.html\",\n resizable: false,\n minimizable: false,\n title: game.i18n.localize(\"token-variants.settings.compendium-mapper.Name\"),\n width: 500\n });\n }\n async getData(options) {\n let data = super.getData(options);\n data = mergeObject(data, (0, $9IngI.TVA_CONFIG).compendiumMapper);\n const supportedPacks = [\n \"Actor\",\n \"Cards\",\n \"Item\",\n \"Macro\",\n \"RollTable\"\n ];\n data.supportedPacks = supportedPacks.join(\", \");\n const packs = [];\n game.packs.forEach((pack)=>{\n if (!pack.locked && supportedPacks.includes(pack.documentName)) packs.push({\n title: pack.title,\n id: pack.collection,\n type: pack.documentName\n });\n });\n data.compendiums = packs;\n data.compendium = (0, $9IngI.TVA_CONFIG).compendiumMapper.compendium;\n data.categories = (0, $eeGZt.BASE_IMAGE_CATEGORIES).concat((0, $9IngI.TVA_CONFIG).customImageCategories);\n data.category = (0, $9IngI.TVA_CONFIG).compendiumMapper.category;\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.find(\".token-variants-override-category\").change(this._onCategoryOverride).trigger(\"change\");\n html.find(\".token-variants-auto-apply\").change(this._onAutoApply);\n html.find(\".token-variants-diff-images\").change(this._onDiffImages);\n html.find(`.token-variants-search-options`).on(\"click\", this._onSearchOptions.bind(this));\n html.find(`.token-variants-missing-images`).on(\"click\", this._onMissingImages.bind(this));\n $(html).find('[name=\"compendium\"]').change(this._onCompendiumSelect.bind(this)).trigger(\"change\");\n }\n async _onAutoApply(event) {\n $(event.target).closest(\"form\").find(\".token-variants-auto-art-select\").prop(\"disabled\", !event.target.checked);\n }\n async _onCategoryOverride(event) {\n $(event.target).closest(\"form\").find(\".token-variants-category\").prop(\"disabled\", !event.target.checked);\n }\n async _onDiffImages(event) {\n $(event.target).closest(\"form\").find(\".token-variants-tp-ignore\").prop(\"disabled\", !event.target.checked);\n }\n async _onCompendiumSelect(event) {\n const compendium = game.packs.get($(event.target).val());\n if (compendium) $(event.target).closest(\"form\").find(\".token-specific\").css(\"visibility\", compendium.documentName === \"Actor\" ? \"visible\" : \"hidden\");\n }\n _fixSearchPaths() {\n if (!this.searchOptions.searchPaths?.length) this.searchOptions.searchPaths = deepClone((0, $9IngI.TVA_CONFIG).searchPaths);\n }\n async _onSearchOptions(event) {\n this._fixSearchPaths();\n new (0, $fVv34.default)(this.searchOptions, {\n searchPaths: true,\n searchFilters: true,\n searchAlgorithm: true,\n randomizer: false,\n features: false,\n popup: false,\n permissions: false,\n worldHud: false,\n misc: false,\n activeEffects: false\n }).render(true);\n }\n async _onMissingImages(event) {\n new (0, $2jMtH.default)().render(true);\n }\n async startMapping(formData) {\n if (formData.diffImages && formData.ignoreToken && formData.ignorePortrait) return;\n const originalSearchPaths = (0, $9IngI.TVA_CONFIG).searchPaths;\n if (formData.searchOptions.searchPaths?.length) (0, $9IngI.TVA_CONFIG).searchPaths = formData.searchOptions.searchPaths;\n if (formData.cache || !(0, $eeGZt.userRequiresImageCache)() || formData.searchOptions.searchPaths?.length) await (0, $8MWlo.cacheImages)();\n const endMapping = function() {\n if (formData.searchOptions.searchPaths?.length) {\n (0, $9IngI.TVA_CONFIG).searchPaths = originalSearchPaths;\n (0, $8MWlo.cacheImages)();\n }\n };\n const compendium = game.packs.get(formData.compendium);\n let missingImageList = (0, $9IngI.TVA_CONFIG).compendiumMapper.missingImages.filter((mi)=>mi.document === \"all\" || mi.document === compendium.documentName).map((mi)=>mi.image);\n const typeOverride = formData.overrideCategory ? formData.category : null;\n let artSelectDisplayed = false;\n let processItem;\n if (compendium.documentName === \"Actor\") processItem = async function(item) {\n const actor = await compendium.getDocument(item._id);\n if (actor.name === \"#[CF_tempEntity]\") return; // Compendium Folders module's control entity\n let hasPortrait = actor.img !== CONST.DEFAULT_TOKEN && !missingImageList.includes(actor.img);\n let hasToken = actor.prototypeToken.texture.src !== CONST.DEFAULT_TOKEN && !missingImageList.includes(actor.prototypeToken.texture.src);\n if (formData.syncImages && hasPortrait !== hasToken) {\n if (hasPortrait) await (0, $eeGZt.updateTokenImage)(actor.img, {\n actor: actor,\n applyDefaultConfig: false\n });\n else await (0, $eeGZt.updateActorImage)(actor, actor.prototypeToken.texture.src);\n hasPortrait = hasToken = true;\n }\n let includeThisActor = !(formData.missingOnly && hasPortrait) && !formData.ignorePortrait;\n let includeThisToken = !(formData.missingOnly && hasToken) && !formData.ignoreToken;\n const image1 = formData.showImages ? actor.img : \"\";\n const image2 = formData.showImages ? actor.prototypeToken.texture.src : \"\";\n if (includeThisActor || includeThisToken) {\n if (formData.autoApply) await $9db5316d801b7bc5$var$autoApply(actor, image1, image2, formData, typeOverride);\n else {\n artSelectDisplayed = true;\n $9db5316d801b7bc5$var$addToArtSelectQueue(actor, image1, image2, formData, typeOverride);\n }\n }\n };\n else processItem = async function(item) {\n const doc = await compendium.getDocument(item._id);\n if (doc.name === \"#[CF_tempEntity]\") return; // Compendium Folders module's control entity\n let defaultImg = \"\";\n if (doc.schema.fields.img || doc.schema.fields.texture) defaultImg = (doc.schema.fields.img ?? doc.schema.fields.texture).initial();\n const hasImage = doc.img != null && doc.img !== defaultImg && !missingImageList.includes(doc.img);\n let imageFound = false;\n if (formData.missingOnly && hasImage) return;\n if (formData.autoApply) {\n let results = await (0, $8MWlo.doImageSearch)(doc.name, {\n searchType: typeOverride ?? compendium.documentName,\n simpleResults: true,\n searchOptions: formData.searchOptions\n });\n if ((results ?? []).length != 0) {\n imageFound = true;\n await (0, $eeGZt.updateActorImage)(doc, results[0], false, formData.compendium);\n }\n }\n if (!formData.autoApply || formData.autoDisplayArtSelect && !imageFound) {\n artSelectDisplayed = true;\n (0, $7OP4c.addToQueue)(doc.name, {\n searchType: typeOverride ?? compendium.documentName,\n object: doc,\n image1: formData.showImages ? doc.img : \"\",\n displayMode: (0, $7OP4c.ArtSelect).IMAGE_DISPLAY.IMAGE,\n searchOptions: formData.searchOptions,\n callback: async function(imgSrc, name) {\n await (0, $eeGZt.updateActorImage)(doc, imgSrc);\n }\n });\n }\n };\n const allItems = [];\n compendium.index.forEach((k)=>{\n allItems.push(k);\n });\n if (formData.autoApply) {\n let processing = true;\n let stopProcessing = false;\n let processed = 0;\n let counter = $(`<p>CACHING 0/${allItems.length}</p>`);\n let d;\n const startProcessing = async function() {\n while(processing && processed < allItems.length){\n await new Promise((resolve, reject)=>{\n setTimeout(async ()=>{\n await processItem(allItems[processed]);\n resolve();\n }, 10);\n });\n processed++;\n counter.html(`${processed}/${allItems.length}`);\n }\n if (stopProcessing || processed === allItems.length) {\n d?.close(true);\n (0, $7OP4c.addToQueue)(\"DUMMY\", {\n execute: endMapping\n });\n (0, $7OP4c.renderFromQueue)();\n }\n };\n d = new Dialog({\n title: `Mapping: ${compendium.title}`,\n content: `\r\n <div style=\"text-align:center;\" class=\"fa-3x\"><i class=\"fas fa-spinner fa-pulse\"></i></div>\r\n <div style=\"text-align:center;\" class=\"counter\"></div>\r\n <button style=\"width:100%;\" class=\"pause\"><i class=\"fas fa-play-circle\"></i> Pause/Start</button>`,\n buttons: {\n cancel: {\n icon: '<i class=\"fas fa-stop-circle\"></i>',\n label: \"Cancel\"\n }\n },\n default: \"cancel\",\n render: (html)=>{\n html.find(\".counter\").append(counter);\n const spinner = html.find(\".fa-spinner\");\n html.find(\".pause\").on(\"click\", ()=>{\n if (processing) {\n processing = false;\n spinner.removeClass(\"fa-pulse\");\n } else {\n processing = true;\n startProcessing();\n spinner.addClass(\"fa-pulse\");\n }\n });\n setTimeout(async ()=>startProcessing(), 1000);\n },\n close: ()=>{\n if (!stopProcessing) {\n stopProcessing = true;\n if (!processing) startProcessing();\n else processing = false;\n }\n }\n });\n d.render(true);\n } else {\n const tasks = allItems.map(processItem);\n Promise.all(tasks).then(()=>{\n (0, $7OP4c.addToQueue)(\"DUMMY\", {\n execute: endMapping\n });\n (0, $7OP4c.renderFromQueue)();\n if (formData.missingOnly && !artSelectDisplayed) ui.notifications.warn(\"Token Variant Art: No documents found containing missing images.\");\n });\n }\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n // If search paths are the same, remove them from searchOptions\n if (!this.searchOptions.searchPaths?.length || isEmpty(diffObject(this.searchOptions.searchPaths, (0, $9IngI.TVA_CONFIG).searchPaths))) this.searchOptions.searchPaths = [];\n formData.searchOptions = this.searchOptions;\n await (0, $9IngI.updateSettings)({\n compendiumMapper: formData\n });\n if (formData.compendium) this.startMapping(formData);\n }\n}\n\n});\nparcelRequire.register(\"fVv34\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $b9844373b5bc97a8$export$2e2bcd8739ae039);\n\nvar $8MWlo = parcelRequire(\"8MWlo\");\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $eYkM9 = parcelRequire(\"eYkM9\");\n\nvar $cs88A = parcelRequire(\"cs88A\");\nclass $b9844373b5bc97a8$export$2e2bcd8739ae039 extends FormApplication {\n constructor(dummySettings, { searchPaths: searchPaths = true, searchFilters: searchFilters = true, searchAlgorithm: searchAlgorithm = true, randomizer: randomizer = true, popup: popup = true, permissions: permissions = true, worldHud: worldHud = true, misc: misc = true, activeEffects: activeEffects = true, features: features = false } = {}){\n super({}, {});\n this.enabledTabs = {\n searchPaths: searchPaths,\n searchFilters: searchFilters,\n searchAlgorithm: searchAlgorithm,\n randomizer: randomizer,\n features: features,\n popup: popup,\n permissions: permissions,\n worldHud: worldHud,\n misc: misc,\n activeEffects: activeEffects\n };\n this.settings = foundry.utils.deepClone((0, $9IngI.TVA_CONFIG));\n if (dummySettings) {\n this.settings = mergeObject(this.settings, dummySettings, {\n insertKeys: false\n });\n this.dummySettings = dummySettings;\n }\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-configure-settings\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/configureSettings.html\",\n resizable: false,\n minimizable: false,\n title: \"Configure Settings\",\n width: 700,\n height: \"auto\",\n tabs: [\n {\n navSelector: \".sheet-tabs\",\n contentSelector: \".content\",\n initial: \"searchPaths\"\n }\n ]\n });\n }\n async getData(options) {\n const data = super.getData(options);\n const settings = this.settings;\n data.enabledTabs = this.enabledTabs;\n // === Search Paths ===\n const paths = settings.searchPaths.map((path)=>{\n const r = {};\n r.text = path.text;\n r.icon = this._pathIcon(path.source || \"\");\n r.cache = path.cache;\n r.source = path.source || \"\";\n r.types = path.types.join(\",\");\n r.config = JSON.stringify(path.config ?? {});\n r.hasConfig = path.config && !isEmpty(path.config);\n return r;\n });\n data.searchPaths = paths;\n // === Search Filters ===\n data.searchFilters = settings.searchFilters;\n for(const filter in data.searchFilters)data.searchFilters[filter].label = filter;\n // === Algorithm ===\n data.algorithm = deepClone(settings.algorithm);\n data.algorithm.fuzzyThreshold = 100 - data.algorithm.fuzzyThreshold * 100;\n // === Randomizer ===\n // Get all actor types defined by the game system\n data.randomizer = deepClone(settings.randomizer);\n const actorTypes = (game.system.entityTypes ?? game.system.documentTypes)[\"Actor\"];\n data.randomizer.actorTypes = actorTypes.reduce((obj, t)=>{\n const label = CONFIG[\"Actor\"]?.typeLabels?.[t] ?? t;\n obj[t] = {\n label: game.i18n.has(label) ? game.i18n.localize(label) : t,\n disable: settings.randomizer[`${t}Disable`] ?? false\n };\n return obj;\n }, {});\n data.randomizer.tokenToPortraitDisabled = !(settings.randomizer.tokenCreate || settings.randomizer.tokenCopyPaste) || data.randomizer.diffImages;\n // === Pop-up ===\n data.popup = deepClone(settings.popup);\n // Get all actor types defined by the game system\n data.popup.actorTypes = actorTypes.reduce((obj, t)=>{\n const label = CONFIG[\"Actor\"]?.typeLabels?.[t] ?? t;\n obj[t] = {\n type: t,\n label: game.i18n.has(label) ? game.i18n.localize(label) : t,\n disable: settings.popup[`${t}Disable`] ?? false\n };\n return obj;\n }, {});\n // Split into arrays of max length 3\n let allTypes = [];\n let tempTypes = [];\n let i = 0;\n for (const [key, value] of Object.entries(data.popup.actorTypes)){\n tempTypes.push(value);\n i++;\n if (i % 3 == 0) {\n allTypes.push(tempTypes);\n tempTypes = [];\n }\n }\n if (tempTypes.length > 0) allTypes.push(tempTypes);\n data.popup.actorTypes = allTypes;\n // === Permissions ===\n data.permissions = settings.permissions;\n // === Token HUD ===\n data.worldHud = deepClone(settings.worldHud);\n data.worldHud.tokenHUDWildcardActive = game.modules.get(\"token-hud-wildcard\")?.active;\n // === Internal Effects ===\n data.internalEffects = deepClone(settings.internalEffects);\n // === Misc ===\n data.keywordSearch = settings.keywordSearch;\n data.excludedKeywords = settings.excludedKeywords;\n data.systemHpPath = settings.systemHpPath;\n data.runSearchOnPath = settings.runSearchOnPath;\n data.imgurClientId = settings.imgurClientId;\n data.enableStatusConfig = settings.enableStatusConfig;\n data.disableNotifs = settings.disableNotifs;\n data.staticCache = settings.staticCache;\n data.staticCacheFile = settings.staticCacheFile;\n data.stackStatusConfig = settings.stackStatusConfig;\n data.mergeGroup = settings.mergeGroup;\n data.customImageCategories = settings.customImageCategories.join(\",\");\n data.disableEffectIcons = settings.disableEffectIcons;\n data.displayEffectIconsOnHover = settings.displayEffectIconsOnHover;\n data.filterEffectIcons = settings.filterEffectIcons;\n data.hideElevationTooltip = settings.hideElevationTooltip;\n data.hideTokenBorder = settings.hideTokenBorder;\n data.filterCustomEffectIcons = settings.filterCustomEffectIcons;\n data.filterIconList = settings.filterIconList.join(\",\");\n data.tilesEnabled = settings.tilesEnabled;\n data.updateTokenProto = settings.updateTokenProto;\n data.imgNameContainsDimensions = settings.imgNameContainsDimensions;\n data.imgNameContainsFADimensions = settings.imgNameContainsFADimensions;\n data.playVideoOnHover = settings.playVideoOnHover;\n data.pauseVideoOnHoverOut = settings.pauseVideoOnHoverOut;\n data.disableImageChangeOnPolymorphed = settings.disableImageChangeOnPolymorphed;\n data.disableImageUpdateOnNonPrototype = settings.disableImageUpdateOnNonPrototype;\n data.disableTokenUpdateAnimation = settings.disableTokenUpdateAnimation;\n data.mappingsCurrentSceneOnly = settings.mappingsCurrentSceneOnly;\n // Controls\n data.pathfinder = [\n \"pf1e\",\n \"pf2e\"\n ].includes(game.system.id);\n data.dnd5e = game.system.id === \"dnd5e\";\n return data;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n // Search Paths\n super.activateListeners(html);\n html.find(\"a.create-path\").click(this._onCreatePath.bind(this));\n html.on(\"input\", \".searchSource\", this._onSearchSourceTextChange.bind(this));\n $(html).on(\"click\", \"a.delete-path\", this._onDeletePath.bind(this));\n $(html).on(\"click\", \"a.convert-imgur\", this._onConvertImgurPath.bind(this));\n $(html).on(\"click\", \"a.convert-json\", this._onConvertJsonPath.bind(this));\n $(html).on(\"click\", \".path-image.source-icon a\", this._onBrowseFolder.bind(this));\n $(html).on(\"click\", \"a.select-category\", (0, $cs88A.showPathSelectCategoryDialog).bind(this));\n $(html).on(\"click\", \"a.select-config\", (0, $cs88A.showPathSelectConfigForm).bind(this));\n // Search Filters\n html.on(\"input\", \"input.filterRegex\", this._validateRegex.bind(this));\n // Active Effects\n const disableEffectIcons = html.find('[name=\"disableEffectIcons\"]');\n const filterEffectIcons = html.find('[name=\"filterEffectIcons\"]');\n disableEffectIcons.on(\"change\", (e)=>{\n if (e.target.checked) filterEffectIcons.prop(\"checked\", false);\n }).trigger(\"change\");\n filterEffectIcons.on(\"change\", (e)=>{\n if (e.target.checked) disableEffectIcons.prop(\"checked\", false);\n });\n // Algorithm\n const algorithmTab = $(html).find('div[data-tab=\"searchAlgorithm\"]');\n algorithmTab.find(`input[name=\"algorithm.exact\"]`).change((e)=>{\n $(e.target).closest(\"form\").find('input[name=\"algorithm.fuzzy\"]').prop(\"checked\", !e.target.checked);\n });\n algorithmTab.find(`input[name=\"algorithm.fuzzy\"]`).change((e)=>{\n $(e.target).closest(\"form\").find('input[name=\"algorithm.exact\"]').prop(\"checked\", !e.target.checked);\n });\n algorithmTab.find('input[name=\"algorithm.fuzzyThreshold\"]').change((e)=>{\n $(e.target).siblings(\".token-variants-range-value\").html(`${e.target.value}%`);\n });\n // Randomizer\n const tokenCreate = html.find('input[name=\"randomizer.tokenCreate\"]');\n const tokenCopyPaste = html.find('input[name=\"randomizer.tokenCopyPaste\"]');\n const tokenToPortrait = html.find('input[name=\"randomizer.tokenToPortrait\"]');\n const _toggle = ()=>{\n tokenToPortrait.prop(\"disabled\", !(tokenCreate.is(\":checked\") || tokenCopyPaste.is(\":checked\")));\n };\n tokenCreate.change(_toggle);\n tokenCopyPaste.change(_toggle);\n const diffImages = html.find('input[name=\"randomizer.diffImages\"]');\n const syncImages = html.find('input[name=\"randomizer.syncImages\"]');\n diffImages.change(()=>{\n syncImages.prop(\"disabled\", !diffImages.is(\":checked\"));\n tokenToPortrait.prop(\"disabled\", diffImages.is(\":checked\"));\n });\n // Token HUD\n html.find('input[name=\"worldHud.updateActorImage\"]').change((event)=>{\n $(event.target).closest(\"form\").find('input[name=\"worldHud.useNameSimilarity\"]').prop(\"disabled\", !event.target.checked);\n });\n // Static Cache\n html.find(\"button.token-variants-cache-images\").click((event)=>{\n const tab = $(event.target).closest(\".tab\");\n const staticOn = tab.find('input[name=\"staticCache\"]');\n const staticFile = tab.find('input[name=\"staticCacheFile\"]');\n (0, $8MWlo.cacheImages)({\n staticCache: staticOn.is(\":checked\"),\n staticCacheFile: staticFile.val()\n });\n });\n // Global Mappings\n html.find(\"button.token-variants-global-mapping\").click(()=>{\n const setting = game.settings.get(\"core\", DefaultTokenConfig.SETTING);\n const data = new foundry.data.PrototypeToken(setting);\n const token = new TokenDocument(data, {\n actor: null\n });\n new (0, $eYkM9.default)(token, {\n globalMappings: true\n }).render(true);\n });\n }\n /**\r\n * Validates regex entered into Search Filter's RegEx input field\r\n */ async _validateRegex(event) {\n if (this._validRegex(event.target.value)) event.target.style.backgroundColor = \"\";\n else event.target.style.backgroundColor = \"#ff7066\";\n }\n _validRegex(val) {\n if (val) try {\n new RegExp(val);\n } catch (e) {\n return false;\n }\n return true;\n }\n /**\r\n * Open a FilePicker so the user can select a local folder to use as an image source\r\n */ async _onBrowseFolder(event) {\n const pathInput = $(event.target).closest(\".table-row\").find(\".path-text input\");\n const sourceInput = $(event.target).closest(\".table-row\").find(\".path-source input\");\n let activeSource = sourceInput.val() || \"data\";\n let current = pathInput.val();\n if (activeSource.startsWith(\"s3:\")) {\n const bucketName = activeSource.replace(\"s3:\", \"\");\n current = `${game.data.files.s3?.endpoint.protocol}//${bucketName}.${game.data.files.s3?.endpoint.host}/${current}`;\n } else if (activeSource.startsWith(\"rolltable\")) {\n let content = `<select style=\"width: 100%;\" name=\"table-name\" id=\"output-tableKey\">`;\n game.tables.forEach((rollTable)=>{\n content += `<option value='${rollTable.name}'>${rollTable.name}</option>`;\n });\n content += `</select>`;\n new Dialog({\n title: `Select a Rolltable`,\n content: content,\n buttons: {\n yes: {\n icon: \"<i class='fas fa-check'></i>\",\n label: \"Select\",\n callback: (html)=>{\n pathInput.val();\n const tableName = html.find(\"select[name='table-name']\").val();\n pathInput.val(tableName);\n }\n }\n },\n default: \"yes\"\n }).render(true);\n return;\n }\n if (activeSource === \"json\") new FilePicker({\n type: \"text\",\n activeSource: \"data\",\n current: current,\n callback: (path, fp)=>{\n pathInput.val(path);\n }\n }).render(true);\n else new FilePicker({\n type: \"folder\",\n activeSource: activeSource,\n current: current,\n callback: (path, fp)=>{\n pathInput.val(fp.result.target);\n if (fp.activeSource === \"s3\") sourceInput.val(`s3:${fp.result.bucket}`);\n else sourceInput.val(fp.activeSource);\n }\n }).render(true);\n }\n /**\r\n * Converts Imgur path to a rolltable\r\n */ async _onConvertImgurPath(event) {\n event.preventDefault();\n const pathInput = $(event.target).closest(\".table-row\").find(\".path-text input\");\n const sourceInput = $(event.target).closest(\".table-row\").find(\".path-source input\");\n const albumHash = pathInput.val();\n const imgurClientId = (0, $9IngI.TVA_CONFIG).imgurClientId === \"\" ? \"df9d991443bb222\" : (0, $9IngI.TVA_CONFIG).imgurClientId;\n fetch(\"https://api.imgur.com/3/gallery/album/\" + albumHash, {\n headers: {\n Authorization: \"Client-ID \" + imgurClientId,\n Accept: \"application/json\"\n }\n }).then((response)=>response.json()).then((async function(result) {\n if (!result.success && location.hostname === \"localhost\") {\n ui.notifications.warn(game.i18n.format(\"token-variants.notifications.warn.imgur-localhost\"));\n return;\n }\n const data = result.data;\n let resultsArray = [];\n data.images.forEach((img, i)=>{\n resultsArray.push({\n type: 0,\n text: img.title ?? img.description ?? \"\",\n weight: 1,\n range: [\n i + 1,\n i + 1\n ],\n collection: \"Text\",\n drawn: false,\n img: img.link\n });\n });\n await RollTable.create({\n name: data.title,\n description: \"Token Variant Art auto generated RollTable: https://imgur.com/gallery/\" + albumHash,\n results: resultsArray,\n replacement: true,\n displayRoll: true,\n img: \"modules/token-variants/img/token-images.svg\"\n });\n pathInput.val(data.title);\n sourceInput.val(\"rolltable\").trigger(\"input\");\n }).bind(this)).catch((error)=>console.warn(\"TVA | \", error));\n }\n /**\r\n * Converts Json path to a rolltable\r\n */ async _onConvertJsonPath(event) {\n event.preventDefault();\n const pathInput = $(event.target).closest(\".table-row\").find(\".path-text input\");\n const sourceInput = $(event.target).closest(\".table-row\").find(\".path-source input\");\n const jsonPath = pathInput.val();\n fetch(jsonPath, {\n headers: {\n Accept: \"application/json\"\n }\n }).then((response)=>response.json()).then((async function(result) {\n if (!result.length > 0) {\n ui.notifications.warn(game.i18n.format(\"token-variants.notifications.warn.json-localhost\"));\n return;\n }\n const data = result;\n data.title = (0, $eeGZt.getFileName)(jsonPath);\n let resultsArray = [];\n data.forEach((img, i)=>{\n resultsArray.push({\n type: 0,\n text: img.name ?? \"\",\n weight: 1,\n range: [\n i + 1,\n i + 1\n ],\n collection: \"Text\",\n drawn: false,\n img: img.path\n });\n });\n await RollTable.create({\n name: data.title,\n description: \"Token Variant Art auto generated RollTable: \" + jsonPath,\n results: resultsArray,\n replacement: true,\n displayRoll: true,\n img: \"modules/token-variants/img/token-images.svg\"\n });\n pathInput.val(data.title);\n sourceInput.val(\"rolltable\").trigger(\"input\");\n }).bind(this)).catch((error)=>console.warn(\"TVA | \", error));\n }\n /**\r\n * Generates a new search path row\r\n */ async _onCreatePath(event) {\n event.preventDefault();\n const table = $(event.currentTarget).closest(\".token-variant-table\");\n let row = `\r\n <li class=\"table-row flexrow\">\r\n <div class=\"path-image source-icon\">\r\n <a><i class=\"${this._pathIcon(\"\")}\"></i></a>\r\n </div>\r\n <div class=\"path-source\">\r\n <input class=\"searchSource\" type=\"text\" name=\"searchPaths.source\" value=\"\" placeholder=\"data\"/>\r\n </div>\r\n <div class=\"path-text\">\r\n <input class=\"searchPath\" type=\"text\" name=\"searchPaths.text\" value=\"\" placeholder=\"Path to folder\"/>\r\n </div>\r\n <div class=\"imgur-control\">\r\n <a class=\"convert-imgur\" title=\"Convert to Rolltable\"><i class=\"fas fa-angle-double-left\"></i></a>\r\n </div>\r\n <div class=\"json-control\">\r\n <a class=\"convert-json\" title=\"Convert to Rolltable\"><i class=\"fas fa-angle-double-left\"></i></a>\r\n </div>\r\n <div class=\"path-category\">\r\n <a class=\"select-category\" title=\"Select image categories/filters\"><i class=\"fas fa-swatchbook\"></i></a>\r\n <input type=\"hidden\" name=\"searchPaths.types\" value=\"Portrait,Token,PortraitAndToken\">\r\n </div>\r\n <div class=\"path-config\">\r\n <a class=\"select-config\" title=\"Apply configuration to images under this path.\"><i class=\"fas fa-cog fa-lg\"></i></a>\r\n <input type=\"hidden\" name=\"searchPaths.config\" value=\"{}\">\r\n </div>\r\n <div class=\"path-cache\">\r\n <input type=\"checkbox\" name=\"searchPaths.cache\" data-dtype=\"Boolean\" checked/>\r\n </div>\r\n <div class=\"path-controls\">\r\n <a class=\"delete-path\" title=\"Delete path\"><i class=\"fas fa-trash\"></i></a>\r\n </div>\r\n </li>\r\n `;\n table.append(row);\n this._reIndexPaths(table);\n this.setPosition(); // Auto-resize window\n }\n async _reIndexPaths(table) {\n table.find(\".path-source\").find(\"input\").each(function(index) {\n $(this).attr(\"name\", `searchPaths.${index}.source`);\n });\n table.find(\".path-text\").find(\"input\").each(function(index) {\n $(this).attr(\"name\", `searchPaths.${index}.text`);\n });\n table.find(\".path-cache\").find(\"input\").each(function(index) {\n $(this).attr(\"name\", `searchPaths.${index}.cache`);\n });\n table.find(\".path-category\").find(\"input\").each(function(index) {\n $(this).attr(\"name\", `searchPaths.${index}.types`);\n });\n table.find(\".path-config\").find(\"input\").each(function(index) {\n $(this).attr(\"name\", `searchPaths.${index}.config`);\n });\n }\n async _onDeletePath(event) {\n event.preventDefault();\n const li = event.currentTarget.closest(\".table-row\");\n li.remove();\n const table = $(event.currentTarget).closest(\".token-variant-table\");\n this._reIndexPaths(table);\n this.setPosition(); // Auto-resize window\n }\n async _onSearchSourceTextChange(event) {\n const image = this._pathIcon(event.target.value);\n const imgur = image === \"fas fa-info\";\n const json = image === \"fas fa-brackets-curly\";\n const imgurControl = $(event.currentTarget).closest(\".table-row\").find(\".imgur-control\");\n if (imgur) imgurControl.addClass(\"active\");\n else imgurControl.removeClass(\"active\");\n const jsonControl = $(event.currentTarget).closest(\".table-row\").find(\".json-control\");\n if (json) jsonControl.addClass(\"active\");\n else jsonControl.removeClass(\"active\");\n $(event.currentTarget).closest(\".table-row\").find(\".path-image i\").attr(\"class\", image);\n }\n // Return icon appropriate for the path provided\n _pathIcon(source) {\n if (source.startsWith(\"s3\")) return \"fas fa-database\";\n else if (source.startsWith(\"rolltable\")) return \"fas fa-dice\";\n else if (source.startsWith(\"forgevtt\") || source.startsWith(\"forge-bazaar\")) return \"fas fa-hammer\";\n else if (source.startsWith(\"imgur\")) return \"fas fa-info\";\n else if (source.startsWith(\"json\")) return \"fas fa-brackets-curly\";\n return \"fas fa-folder\";\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n const settings = this.settings;\n formData = expandObject(formData);\n // Search Paths\n settings.searchPaths = formData.hasOwnProperty(\"searchPaths\") ? Object.values(formData.searchPaths) : [];\n settings.searchPaths.forEach((path)=>{\n if (!path.source) path.source = \"data\";\n if (path.types) path.types = path.types.split(\",\");\n else path.types = [];\n if (path.config) try {\n path.config = JSON.parse(path.config);\n } catch (e) {\n delete path.config;\n }\n else delete path.config;\n });\n // Search Filters\n for(const filter in formData.searchFilters)if (!this._validRegex(formData.searchFilters[filter].regex)) formData.searchFilters[filter].regex = \"\";\n mergeObject(settings.searchFilters, formData.searchFilters);\n // Algorithm\n formData.algorithm.fuzzyLimit = parseInt(formData.algorithm.fuzzyLimit);\n if (isNaN(formData.algorithm.fuzzyLimit) || formData.algorithm.fuzzyLimit < 1) formData.algorithm.fuzzyLimit = 50;\n formData.algorithm.fuzzyThreshold = (100 - formData.algorithm.fuzzyThreshold) / 100;\n mergeObject(settings.algorithm, formData.algorithm);\n // Randomizer\n mergeObject(settings.randomizer, formData.randomizer);\n // Pop-up\n mergeObject(settings.popup, formData.popup);\n // Permissions\n mergeObject(settings.permissions, formData.permissions);\n // Token HUD\n mergeObject(settings.worldHud, formData.worldHud);\n // Internal Effects\n mergeObject(settings.internalEffects, formData.internalEffects);\n // Misc\n mergeObject(settings, {\n keywordSearch: formData.keywordSearch,\n excludedKeywords: formData.excludedKeywords,\n systemHpPath: formData.systemHpPath?.trim(),\n runSearchOnPath: formData.runSearchOnPath,\n imgurClientId: formData.imgurClientId,\n enableStatusConfig: formData.enableStatusConfig,\n disableNotifs: formData.disableNotifs,\n staticCache: formData.staticCache,\n staticCacheFile: formData.staticCacheFile,\n tilesEnabled: formData.tilesEnabled,\n stackStatusConfig: formData.stackStatusConfig,\n mergeGroup: formData.mergeGroup,\n customImageCategories: (formData.customImageCategories || \"\").split(\",\").map((t)=>t.trim()).filter((t)=>t),\n disableEffectIcons: formData.disableEffectIcons,\n displayEffectIconsOnHover: formData.displayEffectIconsOnHover,\n filterEffectIcons: formData.filterEffectIcons,\n hideElevationTooltip: formData.hideElevationTooltip,\n hideTokenBorder: formData.hideTokenBorder,\n filterCustomEffectIcons: formData.filterCustomEffectIcons,\n filterIconList: (formData.filterIconList || \"\").split(\",\").map((t)=>t.trim()).filter((t)=>t),\n updateTokenProto: formData.updateTokenProto,\n imgNameContainsDimensions: formData.imgNameContainsDimensions,\n imgNameContainsFADimensions: formData.imgNameContainsFADimensions,\n playVideoOnHover: formData.playVideoOnHover,\n pauseVideoOnHoverOut: formData.pauseVideoOnHoverOut,\n disableImageChangeOnPolymorphed: formData.disableImageChangeOnPolymorphed,\n disableImageUpdateOnNonPrototype: formData.disableImageUpdateOnNonPrototype,\n disableTokenUpdateAnimation: formData.disableTokenUpdateAnimation,\n mappingsCurrentSceneOnly: formData.mappingsCurrentSceneOnly\n });\n // Global Mappings\n settings.globalMappings = (0, $9IngI.TVA_CONFIG).globalMappings;\n // Save Settings\n if (this.dummySettings) $b9844373b5bc97a8$export$a503acf01ac4867a(this.dummySettings, settings, {\n insertKeys: false\n });\n else (0, $9IngI.updateSettings)(settings);\n }\n}\nfunction $b9844373b5bc97a8$export$a503acf01ac4867a(original, other = {}, { insertKeys: insertKeys = true, insertValues: insertValues = true, overwrite: overwrite = true, recursive: recursive = true, inplace: inplace = true, enforceTypes: enforceTypes = false } = {}, _d = 0) {\n other = other || {};\n if (!(original instanceof Object) || !(other instanceof Object)) throw new Error(\"One of original or other are not Objects!\");\n const options = {\n insertKeys: insertKeys,\n insertValues: insertValues,\n overwrite: overwrite,\n recursive: recursive,\n inplace: inplace,\n enforceTypes: enforceTypes\n };\n // Special handling at depth 0\n if (_d === 0) {\n if (!inplace) original = deepClone(original);\n if (Object.keys(original).some((k)=>/\\./.test(k))) original = expandObject(original);\n if (Object.keys(other).some((k)=>/\\./.test(k))) other = expandObject(other);\n }\n // Iterate over the other object\n for (let k of Object.keys(other)){\n const v = other[k];\n if (original.hasOwnProperty(k)) $b9844373b5bc97a8$var$_mergeUpdate(original, k, v, options, _d + 1);\n else $b9844373b5bc97a8$var$_mergeInsertFix(original, k, v, options, _d + 1);\n }\n return original;\n}\nfunction $b9844373b5bc97a8$var$_mergeInsertFix(original, k, v, { insertKeys: insertKeys, insertValues: insertValues } = {}, _d) {\n // Recursively create simple objects\n if (v?.constructor === Object && insertKeys) {\n original[k] = $b9844373b5bc97a8$export$a503acf01ac4867a({}, v, {\n insertKeys: true,\n inplace: true\n });\n return;\n }\n // Delete a key\n if (k.startsWith(\"-=\")) {\n delete original[k.slice(2)];\n return;\n }\n // Insert a key\n const canInsert = _d <= 1 && insertKeys || _d > 1 && insertValues;\n if (canInsert) original[k] = v;\n}\nfunction $b9844373b5bc97a8$var$_mergeUpdate(original, k, v, { insertKeys: insertKeys, insertValues: insertValues, enforceTypes: enforceTypes, overwrite: overwrite, recursive: recursive } = {}, _d) {\n const x = original[k];\n const tv = getType(v);\n const tx = getType(x);\n // Recursively merge an inner object\n if (tv === \"Object\" && tx === \"Object\" && recursive) return $b9844373b5bc97a8$export$a503acf01ac4867a(x, v, {\n insertKeys: insertKeys,\n insertValues: insertValues,\n overwrite: overwrite,\n inplace: true,\n enforceTypes: enforceTypes\n }, _d);\n // Overwrite an existing value\n if (overwrite) {\n if (tx !== \"undefined\" && tv !== tx && enforceTypes) throw new Error(`Mismatched data types encountered during object merge.`);\n original[k] = v;\n }\n}\n\n});\n\nparcelRequire.register(\"2jMtH\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $1b02f5d547721e51$export$2e2bcd8739ae039);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $eeGZt = parcelRequire(\"eeGZt\");\n\nvar $coMHP = parcelRequire(\"coMHP\");\nclass $1b02f5d547721e51$export$2e2bcd8739ae039 extends FormApplication {\n constructor(){\n super({}, {});\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-missing-images\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/missingImageConfig.html\",\n resizable: true,\n minimizable: false,\n title: \"Define Missing Images\",\n width: 560,\n height: \"auto\"\n });\n }\n async getData(options) {\n const data = super.getData(options);\n if (!this.missingImages) this.missingImages = deepClone((0, $9IngI.TVA_CONFIG).compendiumMapper.missingImages);\n data.missingImages = this.missingImages;\n data.documents = [\n \"all\",\n \"Actor\",\n \"Cards\",\n \"Item\",\n \"Macro\",\n \"RollTable\"\n ];\n return data;\n }\n _processFormData(formData) {\n if (!Array.isArray(formData.document)) {\n formData.document = [\n formData.document\n ];\n formData.image = [\n formData.image\n ];\n }\n const missingImages = [];\n for(let i = 0; i < formData.document.length; i++)missingImages.push({\n document: formData.document[i],\n image: formData.image[i]\n });\n return missingImages;\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.on(\"click\", \".add-row\", ()=>{\n const formData = this._getSubmitData();\n this.missingImages = this._processFormData(formData);\n this.missingImages.push({\n document: \"all\",\n image: CONST.DEFAULT_TOKEN\n });\n this.render();\n });\n html.on(\"click\", \".delete-row\", (event)=>{\n const formData = this._getSubmitData();\n this.missingImages = this._processFormData(formData);\n const index = $(event.target).closest(\"li\")[0].dataset.index;\n this.missingImages.splice(index, 1);\n this.render();\n });\n html.on(\"click\", \".file-picker\", (event)=>{\n new FilePicker({\n type: \"imagevideo\",\n callback: (path)=>{\n $(event.target).closest(\"li\").find('[name=\"image\"]').val(path);\n $(event.target).closest(\"li\").find(\"img\").attr(\"src\", path);\n }\n }).render();\n });\n html.on(\"click\", \".duplicate-picker\", (event)=>{\n let content = `<select style=\"width: 100%;\" name=\"compendium\">`;\n game.packs.forEach((pack)=>{\n content += `<option value='${pack.collection}'>${pack.title}</option>`;\n });\n content += `</select>`;\n new Dialog({\n title: `Compendiums`,\n content: content,\n buttons: {\n yes: {\n icon: \"<i class='far fa-search'></i>\",\n label: \"Search for Duplicates\",\n callback: (html)=>{\n const found = new Set();\n const duplicates = new Set();\n const compendium = game.packs.get(html.find(\"[name='compendium']\").val());\n compendium.index.forEach((k)=>{\n if (found.has(k.img)) duplicates.add(k.img);\n found.add(k.img);\n });\n if (!duplicates.size) ui.notifications.info(\"No duplicates found in: \" + compendium.title);\n const images = Array.from(duplicates).map((img)=>{\n return {\n path: img,\n name: (0, $eeGZt.getFileName)(img)\n };\n });\n const allImages = new Map();\n allImages.set(\"Duplicates\", images);\n (0, $coMHP.showArtSelect)(\"Duplicates\", {\n allImages: allImages,\n callback: (img)=>{\n $(event.target).closest(\"li\").find('[name=\"image\"]').val(img);\n $(event.target).closest(\"li\").find(\"img\").attr(\"src\", img);\n }\n });\n }\n }\n },\n default: \"yes\"\n }).render(true);\n });\n }\n async _updateObject(event, formData) {\n (0, $9IngI.updateSettings)({\n compendiumMapper: {\n missingImages: this._processFormData(formData)\n }\n });\n }\n}\n\n});\n\n\n\nparcelRequire.register(\"bhyh6\", function(module, exports) {\n\n$parcel$export(module.exports, \"ForgeSearchPaths\", () => $836bde882c8ca1a7$export$5713be0477a7b0d8);\n\nvar $9IngI = parcelRequire(\"9IngI\");\n\nvar $cs88A = parcelRequire(\"cs88A\");\nclass $836bde882c8ca1a7$export$5713be0477a7b0d8 extends FormApplication {\n constructor(){\n super({}, {});\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-search-paths\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/forgeSearchPaths.html\",\n resizable: true,\n minimizable: false,\n closeOnSubmit: false,\n title: game.i18n.localize(\"token-variants.settings.search-paths.Name\"),\n width: 592,\n height: \"auto\",\n scrollY: [\n \"ol.token-variant-table\"\n ],\n dragDrop: [\n {\n dragSelector: null,\n dropSelector: null\n }\n ]\n });\n }\n async getData(options) {\n if (!this.object.paths) this.object.paths = await this._getPaths();\n const paths = this.object.paths.map((path)=>{\n const r = {};\n r.text = path.text;\n r.cache = path.cache;\n r.share = path.share;\n r.types = path.types.join(\",\");\n r.config = JSON.stringify(path.config ?? {});\n return r;\n });\n const data = super.getData(options);\n data.paths = paths;\n data.apiKey = this.apiKey;\n return data;\n }\n async _getPaths() {\n const forgePaths = deepClone((0, $9IngI.TVA_CONFIG).forgeSearchPaths) || {};\n this.userId = typeof ForgeAPI !== \"undefined\" ? await ForgeAPI.getUserId() : \"tempUser\"; // TODO\n this.apiKey = forgePaths[this.userId]?.apiKey;\n return forgePaths[this.userId]?.paths || [];\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.find(\"a.create-path\").click(this._onCreatePath.bind(this));\n $(html).on(\"click\", \"a.select-category\", (0, $cs88A.showPathSelectCategoryDialog).bind(this));\n $(html).on(\"click\", \"a.select-config\", (0, $cs88A.showPathSelectConfigForm).bind(this));\n html.find(\"a.delete-path\").click(this._onDeletePath.bind(this));\n html.find(\"button.reset\").click(this._onReset.bind(this));\n html.find(\"button.update\").click(this._onUpdate.bind(this));\n $(html).on(\"click\", \".path-image.source-icon a\", this._onBrowseFolder.bind(this));\n }\n /**\r\n * Open a FilePicker so the user can select a local folder to use as an image source\r\n */ async _onBrowseFolder(event1) {\n const pathInput = $(event1.target).closest(\".table-row\").find(\".path-text input\");\n new FilePicker({\n type: \"folder\",\n activeSource: \"forgevtt\",\n current: pathInput.val(),\n callback: (path, fp)=>{\n if (fp.activeSource !== \"forgevtt\") ui.notifications.warn(\"Token Variant Art: Only 'Assets Library' paths are supported\");\n else pathInput.val(fp.result.target);\n }\n }).render(true);\n }\n async _onCreatePath(event1) {\n event1.preventDefault();\n await this._onSubmit(event1);\n this.object.paths.push({\n text: \"\",\n cache: true,\n share: true,\n types: [\n \"Portrait\",\n \"Token\",\n \"PortraitAndToken\"\n ]\n });\n this.render();\n }\n async _onDeletePath(event1) {\n event1.preventDefault();\n await this._onSubmit(event1);\n const li = event1.currentTarget.closest(\".table-row\");\n this.object.paths.splice(li.dataset.index, 1);\n this.render();\n }\n _onReset(event1) {\n event1.preventDefault();\n this.object.paths = this._getPaths();\n this.render();\n }\n async _onUpdate(event1) {\n event1.preventDefault();\n await this._onSubmit(event1);\n this._updatePaths();\n }\n async _updateObject(event1, formData) {\n const expanded = expandObject(formData);\n expanded.paths = expanded.hasOwnProperty(\"paths\") ? Object.values(expanded.paths) : [];\n expanded.paths.forEach((path, index)=>{\n this.object.paths[index] = {\n text: path.text,\n cache: path.cache,\n share: path.share,\n source: path.source,\n types: path.types.split(\",\")\n };\n if (path.config) try {\n path.config = JSON.parse(path.config);\n if (!isEmpty(path.config)) this.object.paths[index].config = path.config;\n } catch (e) {}\n });\n this.apiKey = expanded.apiKey;\n }\n _cleanPaths() {\n // Cleanup empty and duplicate paths\n let uniquePaths = new Set();\n let paths = this.object.paths.filter((path)=>{\n if (!path.text || uniquePaths.has(path.text)) return false;\n uniquePaths.add(path.text);\n return true;\n });\n return paths;\n }\n _updatePaths() {\n if (this.userId) {\n const forgePaths = deepClone((0, $9IngI.TVA_CONFIG).forgeSearchPaths) || {};\n forgePaths[this.userId] = {\n paths: this._cleanPaths(),\n apiKey: this.apiKey\n };\n if (game.user.isGM) (0, $9IngI.updateSettings)({\n forgeSearchPaths: forgePaths\n });\n else {\n // Workaround for forgeSearchPaths setting to be updated by non-GM clients\n const message = {\n handlerName: \"forgeSearchPaths\",\n args: forgePaths,\n type: \"UPDATE\"\n };\n game.socket?.emit(\"module.token-variants\", message);\n }\n }\n }\n async close(options = {}) {\n await this._onSubmit(event);\n this._updatePaths();\n return super.close(options);\n }\n}\n\n});\n\nparcelRequire.register(\"3pmR9\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $27b56faf6a0f3c08$export$2e2bcd8739ae039);\n\nvar $9IngI = parcelRequire(\"9IngI\");\nclass $27b56faf6a0f3c08$export$2e2bcd8739ae039 extends FormApplication {\n constructor(){\n super({}, {\n title: `Token HUD Settings`\n });\n }\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-hud-settings\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/tokenHUDClientSettings.html\",\n resizable: false,\n minimizable: false,\n title: \"\",\n width: 500\n });\n }\n async getData(options) {\n const data = super.getData(options);\n return mergeObject(data, (0, $9IngI.TVA_CONFIG).hud);\n }\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */ async _updateObject(event, formData) {\n game.settings.set(\"token-variants\", \"hudSettings\", mergeObject((0, $9IngI.TVA_CONFIG).hud, formData));\n }\n}\n\n});\n\nparcelRequire.register(\"aDMsz\", function(module, exports) {\n\n$parcel$export(module.exports, \"default\", () => $7bf322fefda9f6a3$export$2e2bcd8739ae039);\n\nvar $9IngI = parcelRequire(\"9IngI\");\nclass $7bf322fefda9f6a3$export$2e2bcd8739ae039 extends FormApplication {\n static get defaultOptions() {\n return mergeObject(super.defaultOptions, {\n id: \"token-variants-import-export\",\n classes: [\n \"sheet\"\n ],\n template: \"modules/token-variants/templates/importExport.html\",\n resizable: false,\n minimizable: false,\n title: \"Import/Export\",\n width: 250\n });\n }\n /**\r\n * @param {JQuery} html\r\n */ activateListeners(html) {\n super.activateListeners(html);\n html.find(\".import\").click(this._importFromJSONDialog.bind(this));\n html.find(\".export\").click(()=>{\n (0, $9IngI.exportSettingsToJSON)();\n this.close();\n });\n }\n async _importFromJSONDialog() {\n const content = await renderTemplate(\"templates/apps/import-data.html\", {\n entity: \"token-variants\",\n name: \"settings\"\n });\n let dialog = new Promise((resolve, reject)=>{\n new Dialog({\n title: game.i18n.localize(\"token-variants.settings.import-export.window.import-dialog\"),\n content: content,\n buttons: {\n import: {\n icon: '<i class=\"fas fa-file-import\"></i>',\n label: game.i18n.localize(\"token-variants.common.import\"),\n callback: (html)=>{\n const form = html.find(\"form\")[0];\n if (!form.data.files.length) return ui.notifications?.error(\"You did not upload a data file!\");\n readTextFromFile(form.data.files[0]).then((json)=>{\n (0, $9IngI.importSettingsFromJSON)(json);\n resolve(true);\n });\n }\n },\n no: {\n icon: '<i class=\"fas fa-times\"></i>',\n label: \"Cancel\",\n callback: (html)=>resolve(false)\n }\n },\n default: \"import\"\n }, {\n width: 400\n }).render(true);\n });\n this.close();\n return await dialog;\n }\n}\n\n});\n\n\n\n\n\nparcelRequire(\"coMHP\");\n\n//# sourceMappingURL=bundle.js.map\n","import { CORE_SHAPE, DEFAULT_OVERLAY_CONFIG, OVERLAY_SHAPES } from '../scripts/models.js';\r\nimport { VALID_EXPRESSION, getAllEffectMappings } from '../scripts/hooks/effectMappingHooks.js';\r\nimport { evaluateOverlayExpressions, genTexture } from '../scripts/token/overlay.js';\r\nimport { SEARCH_TYPE } from '../scripts/utils.js';\r\nimport { showArtSelect } from '../token-variants.mjs';\r\nimport { sortMappingsToGroups } from './effectMappingForm.js';\r\nimport { getFlagMappings } from '../scripts/settings.js';\r\nimport { Reticle } from '../scripts/reticle.js';\r\n\r\nexport class OverlayConfig extends FormApplication {\r\n constructor(config, callback, id, token) {\r\n super({}, {});\r\n this.config = config ?? {};\r\n this.config.id = id;\r\n this.callback = callback;\r\n this.token = canvas.tokens.get(token._id);\r\n this.previewConfig = deepClone(this.config);\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-overlay-config',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/overlayConfig.html',\r\n resizable: false,\r\n minimizable: false,\r\n title: 'Overlay Settings',\r\n width: 500,\r\n height: 'auto',\r\n //tabs: [{ navSelector: '.sheet-tabs', contentSelector: '.content', initial: 'misc' }, ],\r\n\r\n tabs: [\r\n { navSelector: '.tabs[data-group=\"main\"]', contentSelector: 'form', initial: 'misc' },\r\n { navSelector: '.tabs[data-group=\"html\"]', contentSelector: '.tab[data-tab=\"html\"]', initial: 'template' },\r\n ],\r\n });\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n\r\n html.find('.reticle').on('click', (event) => {\r\n const icons = this.getPreviewIcons();\r\n if (icons.length) {\r\n Reticle.activate({ tvaOverlay: icons[0].icon, app: this, config: this.previewConfig });\r\n }\r\n });\r\n\r\n const imgLinkDisable = function (disabled) {\r\n html.find('.img-link-disable').prop('disabled', disabled);\r\n };\r\n\r\n html.find('.image-link').on('click', (event) => {\r\n const chkBox = $(event.target).closest('.form-group').find('[name=\"imgLinked\"]');\r\n const button = $(event.target).closest('button');\r\n if (chkBox.is(':checked')) {\r\n chkBox.prop('checked', false);\r\n button.removeClass('active');\r\n imgLinkDisable(false);\r\n } else {\r\n chkBox.prop('checked', true);\r\n button.addClass('active');\r\n imgLinkDisable(true);\r\n }\r\n });\r\n imgLinkDisable(Boolean(this.config.imgLinked));\r\n\r\n html.find('.repeat').on('change', (event) => {\r\n const fieldset = $(event.target).closest('fieldset');\r\n const content = fieldset.find('.content');\r\n if (event.target.checked) {\r\n content.show();\r\n fieldset.addClass('active');\r\n } else {\r\n content.hide();\r\n fieldset.removeClass('active');\r\n }\r\n this.setPosition();\r\n });\r\n\r\n // Insert Controls to the Shape Legend\r\n const shapeLegends = html.find('.shape-legend');\r\n let config = this.config;\r\n shapeLegends.each(function (i) {\r\n const legend = $(this);\r\n legend.append(\r\n ` <a class=\"cloneShape\" data-index=\"${i}\" title=\"Clone\"><i class=\"fas fa-clone\"></i></a>\r\n <a class=\"deleteShape\" data-index=\"${i}\" title=\"Remove\"><i class=\"fas fa-trash-alt\"></i></a>`\r\n );\r\n if (i != 0) {\r\n legend.append(\r\n ` <a class=\"moveShapeUp\" data-index=\"${i}\" title=\"Move Up\"><i class=\"fas fa-arrow-up\"></i></a>`\r\n );\r\n }\r\n if (i != shapeLegends.length - 1) {\r\n legend.append(\r\n ` <a class=\"moveShapeDown\" data-index=\"${i}\" title=\"Move Down\"><i class=\"fas fa-arrow-down\"></i></a>`\r\n );\r\n }\r\n legend.append(\r\n `<input class=\"shape-legend-input\" type=\"text\" name=\"shapes.${i}.label\" value=\"${\r\n config.shapes?.[i]?.label ?? ''\r\n }\">`\r\n );\r\n });\r\n\r\n // Shape listeners\r\n html.find('.addShape').on('click', this._onAddShape.bind(this));\r\n html.find('.addEvent').on('click', this._onAddEvent.bind(this));\r\n html.find('.deleteShape').on('click', this._onDeleteShape.bind(this));\r\n html.find('.deleteEvent').on('click', this._onDeleteEvent.bind(this));\r\n html.find('.moveShapeUp').on('click', this._onMoveShapeUp.bind(this));\r\n html.find('.moveShapeDown').on('click', this._onMoveShapeDown.bind(this));\r\n html.find('.cloneShape').on('click', this._onCloneShape.bind(this));\r\n\r\n html.find('input,select').on('change', this._onInputChange.bind(this));\r\n html.find('textarea').on('change', this._onInputChange.bind(this));\r\n const parentId = html.find('[name=\"parentID\"]');\r\n parentId.on('change', (event) => {\r\n if (event.target.value === 'TOKEN') {\r\n html.find('.token-specific-fields').show();\r\n } else {\r\n html.find('.token-specific-fields').hide();\r\n }\r\n this.setPosition();\r\n });\r\n parentId.trigger('change');\r\n html\r\n .find('[name=\"ui\"]')\r\n .on('change', (event) => {\r\n if (parentId.val() === 'TOKEN') {\r\n if (event.target.checked) {\r\n html.find('.ui-hide').hide();\r\n } else {\r\n html.find('.ui-hide').show();\r\n }\r\n this.setPosition();\r\n }\r\n })\r\n .trigger('change');\r\n\r\n html.find('[name=\"filter\"]').on('change', (event) => {\r\n html.find('.filterOptions').empty();\r\n const filterOptions = $(genFilterOptionControls(event.target.value));\r\n html.find('.filterOptions').append(filterOptions);\r\n this.setPosition({ height: 'auto' });\r\n this.activateListeners(filterOptions);\r\n });\r\n\r\n html.find('.token-variants-image-select-button').click((event) => {\r\n showArtSelect(this.token?.name ?? 'overlay', {\r\n searchType: SEARCH_TYPE.TOKEN,\r\n callback: (imgSrc, imgName) => {\r\n if (imgSrc) $(event.target).closest('.form-group').find('input').val(imgSrc).trigger('change');\r\n },\r\n });\r\n });\r\n\r\n html.find('.presetImport').on('click', (event) => {\r\n const presetName = $(event.target).closest('.form-group').find('.tmfxPreset').val();\r\n if (presetName) {\r\n const preset = TokenMagic.getPreset(presetName);\r\n if (preset) {\r\n $(event.target).closest('.form-group').find('textarea').val(JSON.stringify(preset, null, 2)).trigger('input');\r\n }\r\n }\r\n });\r\n\r\n // Controls for locking scale sliders together\r\n let scaleState = { locked: true };\r\n\r\n // Range inputs need to be triggered when slider moves to initiate preview\r\n html\r\n .find('.range-value')\r\n .siblings('[type=\"range\"]')\r\n .on('change', (event) => {\r\n $(event.target).siblings('.range-value').val(event.target.value).trigger('change');\r\n });\r\n\r\n const lockButtons = $(html).find('.scaleLock > a');\r\n const sliderScaleWidth = $(html).find('[name=\"scaleX\"]');\r\n const sliderScaleHeight = $(html).find('[name=\"scaleY\"]');\r\n const sliderWidth = html.find('.scaleX');\r\n const sliderHeight = html.find('.scaleY');\r\n\r\n lockButtons.on('click', function () {\r\n scaleState.locked = !scaleState.locked;\r\n lockButtons.html(scaleState.locked ? '<i class=\"fas fa-link\"></i>' : '<i class=\"fas fa-unlink\"></i>');\r\n });\r\n\r\n sliderScaleWidth.on('change', function () {\r\n if (scaleState.locked && sliderScaleWidth.val() !== sliderScaleHeight.val()) {\r\n sliderScaleHeight.val(sliderScaleWidth.val()).trigger('change');\r\n sliderHeight.val(sliderScaleWidth.val());\r\n }\r\n });\r\n sliderScaleHeight.on('change', function () {\r\n if (scaleState.locked && sliderScaleWidth.val() !== sliderScaleHeight.val()) {\r\n sliderScaleWidth.val(sliderScaleHeight.val()).trigger('change');\r\n sliderWidth.val(sliderScaleHeight.val());\r\n }\r\n });\r\n html.on('change', '.scaleX', () => {\r\n sliderScaleWidth.trigger('change');\r\n });\r\n html.on('change', '.scaleY', () => {\r\n sliderScaleHeight.trigger('change');\r\n });\r\n\r\n html.find('.me-edit-json').on('click', async (event) => {\r\n const textarea = $(event.target).closest('.form-group').find('textarea');\r\n let params;\r\n try {\r\n params = eval(textarea.val());\r\n } catch (e) {\r\n console.warn('TVA |', e);\r\n }\r\n\r\n if (params) {\r\n let param;\r\n if (Array.isArray(params)) {\r\n if (params.length === 1) param = params[0];\r\n else {\r\n let i = await promptParamChoice(params);\r\n if (i < 0) return;\r\n param = params[i];\r\n }\r\n } else {\r\n param = params;\r\n }\r\n\r\n if (param)\r\n game.modules.get('multi-token-edit').api.showGenericForm(param, param.filterType ?? 'TMFX', {\r\n inputChangeCallback: (selected) => {\r\n mergeObject(param, selected, { inplace: true });\r\n textarea.val(JSON.stringify(params, null, 2)).trigger('input');\r\n },\r\n });\r\n }\r\n });\r\n\r\n const underlay = html.find('[name=\"underlay\"]');\r\n const top = html.find('[name=\"top\"]');\r\n const bottom = html.find('[name=\"bottom\"]');\r\n underlay.change(function () {\r\n if (this.checked) top.prop('checked', false);\r\n else bottom.prop('checked', false);\r\n });\r\n top.change(function () {\r\n if (this.checked) {\r\n underlay.prop('checked', false);\r\n bottom.prop('checked', false);\r\n }\r\n });\r\n bottom.change(function () {\r\n if (this.checked) {\r\n underlay.prop('checked', true);\r\n top.prop('checked', false);\r\n }\r\n });\r\n\r\n const linkScale = html.find('[name=\"linkScale\"]');\r\n const linkDimensions = html.find('[name=\"linkDimensionsX\"], [name=\"linkDimensionsY\"]');\r\n const linkStageScale = html.find('[name=\"linkStageScale\"]');\r\n linkScale.change(function () {\r\n if (this.checked) {\r\n linkDimensions.prop('checked', false);\r\n linkStageScale.prop('checked', false);\r\n }\r\n });\r\n linkDimensions.change(function () {\r\n if (this.checked) {\r\n linkScale.prop('checked', false);\r\n linkStageScale.prop('checked', false);\r\n }\r\n });\r\n linkStageScale.change(function () {\r\n if (this.checked) {\r\n linkScale.prop('checked', false);\r\n linkDimensions.prop('checked', false);\r\n }\r\n });\r\n\r\n // Setting border color for property expression\r\n const limitOnProperty = html.find('[name=\"limitOnProperty\"]');\r\n limitOnProperty.on('input', (event) => {\r\n const input = $(event.target);\r\n if (input.val() === '') {\r\n input.removeClass('tvaValid');\r\n input.removeClass('tvaInvalid');\r\n } else if (input.val().match(VALID_EXPRESSION)) {\r\n input.addClass('tvaValid');\r\n input.removeClass('tvaInvalid');\r\n } else {\r\n input.addClass('tvaInvalid');\r\n input.removeClass('tvaValid');\r\n }\r\n });\r\n limitOnProperty.trigger('input');\r\n\r\n html.find('.create-variable').on('click', this._onCreateVariable.bind(this));\r\n html.find('.delete-variable').on('click', this._onDeleteVariable.bind(this));\r\n }\r\n\r\n _onDeleteVariable(event) {\r\n let index = $(event.target).closest('tr').data('index');\r\n if (index != null) {\r\n this.config = this._getSubmitData();\r\n if (!this.config.variables) this.config.variables = [];\r\n this.config.variables.splice(index, 1);\r\n this.render(true);\r\n }\r\n }\r\n\r\n _onCreateVariable(event) {\r\n this.config = this._getSubmitData();\r\n if (!this.config.variables) this.config.variables = [];\r\n this.config.variables.push({ name: '', value: '' });\r\n this.render(true);\r\n }\r\n\r\n _onAddShape(event) {\r\n let shape = $(event.target).siblings('select').val();\r\n shape = deepClone(OVERLAY_SHAPES[shape]);\r\n shape = mergeObject(deepClone(CORE_SHAPE), { shape });\r\n\r\n this.config = this._getSubmitData();\r\n\r\n if (!this.config.shapes) this.config.shapes = [];\r\n this.config.shapes.push(shape);\r\n\r\n this.render(true);\r\n }\r\n\r\n _onAddEvent(event) {\r\n let listener = $(event.target).siblings('select').val();\r\n\r\n this.config = this._getSubmitData();\r\n if (!this.config.interactivity) this.config.interactivity = [];\r\n this.config.interactivity.push({ listener, macro: '', script: '' });\r\n\r\n this.render(true);\r\n }\r\n\r\n _onDeleteShape(event) {\r\n const index = $(event.target).closest('.deleteShape').data('index');\r\n if (index == null) return;\r\n\r\n this.config = this._getSubmitData();\r\n if (!this.config.shapes) this.config.shapes = [];\r\n this.config.shapes.splice(index, 1);\r\n\r\n this.render(true);\r\n }\r\n\r\n _onDeleteEvent(event) {\r\n const index = $(event.target).closest('.deleteEvent').data('index');\r\n if (index == null) return;\r\n\r\n this.config = this._getSubmitData();\r\n if (!this.config.interactivity) this.config.interactivity = [];\r\n this.config.interactivity.splice(index, 1);\r\n\r\n this.render(true);\r\n }\r\n\r\n _onCloneShape(event) {\r\n const index = $(event.target).closest('.cloneShape').data('index');\r\n if (!index && index != 0) return;\r\n\r\n this.config = this._getSubmitData();\r\n if (!this.config.shapes) return;\r\n const nShape = deepClone(this.config.shapes[index]);\r\n if (nShape.label) {\r\n nShape.label = nShape.label + ' - Copy';\r\n }\r\n this.config.shapes.push(nShape);\r\n\r\n this.render(true);\r\n }\r\n\r\n _onMoveShapeUp(event) {\r\n const index = $(event.target).closest('.moveShapeUp').data('index');\r\n if (!index) return;\r\n\r\n this.config = this._getSubmitData();\r\n if (!this.config.shapes) this.config.shapes = [];\r\n if (this.config.shapes.length >= 2) this._swapShapes(index, index - 1);\r\n\r\n this.render(true);\r\n }\r\n\r\n _onMoveShapeDown(event) {\r\n const index = $(event.target).closest('.moveShapeDown').data('index');\r\n if (!index && index != 0) return;\r\n\r\n this.config = this._getSubmitData();\r\n if (!this.config.shapes) this.config.shapes = [];\r\n if (this.config.shapes.length >= 2) this._swapShapes(index, index + 1);\r\n\r\n this.render(true);\r\n }\r\n\r\n _swapShapes(i1, i2) {\r\n let temp = this.config.shapes[i1];\r\n this.config.shapes[i1] = this.config.shapes[i2];\r\n this.config.shapes[i2] = temp;\r\n }\r\n\r\n _convertColor(colString) {\r\n try {\r\n const c = Color.fromString(colString);\r\n const rgba = c.rgb;\r\n rgba.push(1);\r\n return rgba;\r\n } catch (e) {\r\n return [1, 1, 1, 1];\r\n }\r\n }\r\n\r\n async _onInputChange(event) {\r\n this.previewConfig = this._getSubmitData();\r\n if (event.target.type === 'color') {\r\n const color = $(event.target).siblings('.color');\r\n color.val(event.target.value).trigger('change');\r\n return;\r\n }\r\n this._applyPreviews();\r\n }\r\n\r\n getPreviewIcons() {\r\n if (!this.config.id) return [];\r\n const tokens = this.token ? [this.token] : canvas.tokens.placeables;\r\n const previewIcons = [];\r\n for (const tkn of tokens) {\r\n if (tkn.tvaOverlays) {\r\n for (const c of tkn.tvaOverlays) {\r\n if (c.overlayConfig && c.overlayConfig.id === this.config.id) {\r\n // Effect icon found, however if we're in global preview then we need to take into account\r\n // a token/actor specific mapping which may override the global one\r\n if (this.token) {\r\n previewIcons.push({ token: tkn, icon: c });\r\n } else if (!getFlagMappings(tkn).find((m) => m.id === this.config.id)) {\r\n previewIcons.push({ token: tkn, icon: c });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return previewIcons;\r\n }\r\n\r\n async _applyPreviews() {\r\n const targets = this.getPreviewIcons();\r\n for (const target of targets) {\r\n const preview = evaluateOverlayExpressions(deepClone(this.previewConfig), target.token, {\r\n overlayConfig: this.previewConfig,\r\n });\r\n target.icon.refresh(preview, {\r\n preview: true,\r\n previewTexture: await genTexture(target.token, preview),\r\n });\r\n }\r\n }\r\n\r\n async _removePreviews() {\r\n const targets = this.getPreviewIcons();\r\n for (const target of targets) {\r\n target.icon.refresh();\r\n }\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n data.filters = Object.keys(PIXI.filters);\r\n data.filters.push('OutlineOverlayFilter');\r\n data.filters.sort();\r\n data.tmfxActive = game.modules.get('tokenmagic')?.active;\r\n if (data.tmfxActive) {\r\n data.tmfxPresets = TokenMagic.getPresets().map((p) => p.name);\r\n data.filters.unshift('Token Magic FX');\r\n }\r\n data.filters.unshift('NONE');\r\n const settings = mergeObject(DEFAULT_OVERLAY_CONFIG, this.config, {\r\n inplace: false,\r\n });\r\n data.ceActive = game.modules.get('dfreds-convenient-effects')?.active;\r\n if (data.ceActive) {\r\n data.ceEffects = game.dfreds.effects.all.map((ef) => ef.name);\r\n }\r\n data.macros = game.macros.map((m) => m.name);\r\n\r\n if (settings.filter !== 'NONE') {\r\n const filterOptions = genFilterOptionControls(settings.filter, settings.filterOptions);\r\n if (filterOptions) {\r\n settings.filterOptions = filterOptions;\r\n } else {\r\n settings.filterOptions = null;\r\n }\r\n } else {\r\n settings.filterOptions = null;\r\n }\r\n\r\n data.users = game.users.map((u) => {\r\n return { id: u.id, name: u.name, selected: settings.limitedUsers.includes(u.id) };\r\n });\r\n\r\n data.fonts = Object.keys(CONFIG.fontDefinitions);\r\n\r\n const allMappings = getAllEffectMappings(this.token, true).filter((m) => m.id !== this.config.id);\r\n const [_, groupedMappings] = sortMappingsToGroups(allMappings);\r\n\r\n data.parents = groupedMappings;\r\n if (!data.parentID) data.parentID = 'TOKEN';\r\n if (!data.anchor) data.anchor = { x: 0.5, y: 0.5 };\r\n\r\n // Cache Partials\r\n for (const shapeName of Object.keys(OVERLAY_SHAPES)) {\r\n await getTemplate(`modules/token-variants/templates/partials/shape${shapeName}.html`);\r\n }\r\n await getTemplate('modules/token-variants/templates/partials/repeating.html');\r\n await getTemplate('modules/token-variants/templates/partials/interpolateColor.html');\r\n\r\n data.allShapes = Object.keys(OVERLAY_SHAPES);\r\n data.textAlignmentOptions = [\r\n { value: 'left', label: 'Left' },\r\n { value: 'center', label: 'Center' },\r\n { value: 'right', label: 'Right' },\r\n { value: 'justify', label: 'Justify' },\r\n ];\r\n\r\n // linkDimensions has been converted to linkDimensionsX and linkDimensionsY\r\n // Make sure we're using the latest fields\r\n // 20/07/2023\r\n if (!('linkDimensionsX' in settings) && settings.linkDimensions) {\r\n settings.linkDimensionsX = true;\r\n settings.linkDimensionsY = true;\r\n }\r\n\r\n return mergeObject(data, settings);\r\n }\r\n\r\n _getHeaderButtons() {\r\n const buttons = super._getHeaderButtons();\r\n buttons.unshift({\r\n label: 'Core Variables',\r\n class: '.core-variables',\r\n icon: 'fas fa-file-import fa-fw',\r\n onclick: () => {\r\n let content = `\r\n <table>\r\n <tr><th>Variable</th><th>Description</th></tr>\r\n <tr><td>@hp</td><td>Actor Health</td></tr>\r\n <tr><td>@hpMax</td><td>Actor Health (Max)</td></tr>\r\n <tr><td>@gridSize</td><td>Grid Size (Pixels)</td></tr>\r\n <tr><td>@label</td><td>Mapping's Label Field</td></tr>\r\n </table>\r\n `;\r\n\r\n new Dialog({\r\n title: `Core Variables`,\r\n content,\r\n buttons: {},\r\n }).render(true);\r\n },\r\n });\r\n return buttons;\r\n }\r\n\r\n async close(options = {}) {\r\n super.close(options);\r\n this._removePreviews();\r\n }\r\n\r\n _getSubmitData() {\r\n let formData = super._getSubmitData();\r\n formData = expandObject(formData);\r\n\r\n if (!formData.repeating) delete formData.repeat;\r\n if (!formData.text.repeating) delete formData.text.repeat;\r\n\r\n if (formData.shapes) {\r\n formData.shapes = Object.values(formData.shapes);\r\n formData.shapes.forEach((shape) => {\r\n if (!shape.repeating) delete shape.repeat;\r\n });\r\n }\r\n\r\n if (formData.interactivity) {\r\n formData.interactivity = Object.values(formData.interactivity)\r\n .map((e) => {\r\n e.macro = e.macro.trim();\r\n e.script = e.script.trim();\r\n if (e.tmfxPreset) e.tmfxPreset = e.tmfxPreset.trim();\r\n if (e.ceEffect) e.ceEffect = e.ceEffect.trim();\r\n return e;\r\n })\r\n .filter((e) => e.macro || e.script || e.ceEffect || e.tmfxPreset);\r\n } else {\r\n formData.interactivity = [];\r\n }\r\n\r\n if (formData.variables) {\r\n formData.variables = Object.values(formData.variables);\r\n formData.variables = formData.variables.filter((v) => v.name.trim() && v.value.trim());\r\n }\r\n if (formData.limitedUsers) {\r\n if (getType(formData.limitedUsers) === 'string') formData.limitedUsers = [formData.limitedUsers];\r\n formData.limitedUsers = formData.limitedUsers.filter((uid) => uid);\r\n } else {\r\n formData.limitedUsers = [];\r\n }\r\n\r\n formData.limitOnEffect = formData.limitOnEffect.trim();\r\n formData.limitOnProperty = formData.limitOnProperty.trim();\r\n if (formData.parentID === 'TOKEN') formData.parentID = '';\r\n\r\n if (formData.filter === 'OutlineOverlayFilter' && 'filterOptions.outlineColor' in formData) {\r\n formData['filterOptions.outlineColor'] = this._convertColor(formData['filterOptions.outlineColor']);\r\n } else if (formData.filter === 'BevelFilter') {\r\n if ('filterOptions.lightColor' in formData)\r\n formData['filterOptions.lightColor'] = Number(Color.fromString(formData['filterOptions.lightColor']));\r\n if ('filterOptions.shadowColor' in formData)\r\n formData['filterOptions.shadowColor'] = Number(Color.fromString(formData['filterOptions.shadowColor']));\r\n } else if (['DropShadowFilter', 'GlowFilter', 'OutlineFilter', 'FilterFire'].includes(formData.filter)) {\r\n if ('filterOptions.color' in formData)\r\n formData['filterOptions.color'] = Number(Color.fromString(formData['filterOptions.color']));\r\n }\r\n\r\n return formData;\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n if (this.callback) this.callback(formData);\r\n }\r\n}\r\n\r\nexport const FILTERS = {\r\n OutlineOverlayFilter: {\r\n defaultValues: {\r\n outlineColor: [0, 0, 0, 1],\r\n trueThickness: 1,\r\n animate: false,\r\n },\r\n controls: [\r\n {\r\n type: 'color',\r\n name: 'outlineColor',\r\n },\r\n {\r\n type: 'range',\r\n label: 'Thickness',\r\n name: 'trueThickness',\r\n min: 0,\r\n max: 5,\r\n step: 0.01,\r\n },\r\n {\r\n type: 'boolean',\r\n label: 'Oscillate',\r\n name: 'animate',\r\n },\r\n ],\r\n argType: 'args',\r\n },\r\n AlphaFilter: {\r\n defaultValues: {\r\n alpha: 1,\r\n },\r\n controls: [\r\n {\r\n type: 'range',\r\n name: 'alpha',\r\n min: 0,\r\n max: 1,\r\n step: 0.01,\r\n },\r\n ],\r\n argType: 'args',\r\n },\r\n BlurFilter: {\r\n defaultValues: {\r\n strength: 8,\r\n quality: 4,\r\n },\r\n controls: [\r\n { type: 'range', name: 'strength', min: 0, max: 20, step: 1 },\r\n { type: 'range', name: 'quality', min: 0, max: 20, step: 1 },\r\n ],\r\n argType: 'args',\r\n },\r\n BlurFilterPass: {\r\n defaultValues: {\r\n horizontal: false,\r\n strength: 8,\r\n quality: 4,\r\n },\r\n controls: [\r\n {\r\n type: 'boolean',\r\n name: 'horizontal',\r\n },\r\n { type: 'range', name: 'strength', min: 0, max: 20, step: 1 },\r\n { type: 'range', name: 'quality', min: 0, max: 20, step: 1 },\r\n ],\r\n argType: 'args',\r\n },\r\n NoiseFilter: {\r\n defaultValues: {\r\n noise: 0.5,\r\n seed: 4475160954091,\r\n },\r\n controls: [\r\n { type: 'range', name: 'noise', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'seed', min: 0, max: 100000, step: 1 },\r\n ],\r\n argType: 'args',\r\n },\r\n AdjustmentFilter: {\r\n defaultValues: {\r\n gamma: 1,\r\n saturation: 1,\r\n contrast: 1,\r\n brightness: 1,\r\n red: 1,\r\n green: 1,\r\n blue: 1,\r\n alpha: 1,\r\n },\r\n controls: [\r\n { type: 'range', name: 'gamma', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'saturation', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'contrast', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'brightness', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'red', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'green', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'blue', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'alpha', min: 0, max: 1, step: 0.01 },\r\n ],\r\n argType: 'options',\r\n },\r\n AdvancedBloomFilter: {\r\n defaultValues: {\r\n threshold: 0.5,\r\n bloomScale: 1,\r\n brightness: 1,\r\n blur: 8,\r\n quality: 4,\r\n },\r\n controls: [\r\n { type: 'range', name: 'threshold', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'bloomScale', min: 0, max: 5, step: 0.01 },\r\n { type: 'range', name: 'brightness', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'blur', min: 0, max: 20, step: 1 },\r\n { type: 'range', name: 'quality', min: 0, max: 20, step: 1 },\r\n ],\r\n argType: 'options',\r\n },\r\n AsciiFilter: {\r\n defaultValues: {\r\n size: 8,\r\n },\r\n controls: [{ type: 'range', name: 'size', min: 0, max: 20, step: 0.01 }],\r\n argType: 'args',\r\n },\r\n BevelFilter: {\r\n defaultValues: {\r\n rotation: 45,\r\n thickness: 2,\r\n lightColor: 0xffffff,\r\n lightAlpha: 0.7,\r\n shadowColor: 0x000000,\r\n shadowAlpha: 0.7,\r\n },\r\n controls: [\r\n { type: 'range', name: 'rotation', min: 0, max: 360, step: 1 },\r\n { type: 'range', name: 'thickness', min: 0, max: 20, step: 0.01 },\r\n { type: 'color', name: 'lightColor' },\r\n { type: 'range', name: 'lightAlpha', min: 0, max: 1, step: 0.01 },\r\n { type: 'color', name: 'shadowColor' },\r\n { type: 'range', name: 'shadowAlpha', min: 0, max: 1, step: 0.01 },\r\n ],\r\n argType: 'options',\r\n },\r\n BloomFilter: {\r\n defaultValues: {\r\n blur: 2,\r\n quality: 4,\r\n },\r\n controls: [\r\n { type: 'range', name: 'blur', min: 0, max: 20, step: 1 },\r\n { type: 'range', name: 'quality', min: 0, max: 20, step: 1 },\r\n ],\r\n argType: 'args',\r\n },\r\n BulgePinchFilter: {\r\n defaultValues: {\r\n radius: 100,\r\n strength: 1,\r\n },\r\n controls: [\r\n { type: 'range', name: 'radius', min: 0, max: 500, step: 1 },\r\n { type: 'range', name: 'strength', min: -1, max: 1, step: 0.01 },\r\n ],\r\n argType: 'options',\r\n },\r\n CRTFilter: {\r\n defaultValues: {\r\n curvature: 1,\r\n lineWidth: 1,\r\n lineContrast: 0.25,\r\n verticalLine: false,\r\n noise: 0.3,\r\n noiseSize: 1,\r\n seed: 0,\r\n vignetting: 0.3,\r\n vignettingAlpha: 1,\r\n vignettingBlur: 0.3,\r\n time: 0,\r\n },\r\n controls: [\r\n { type: 'range', name: 'curvature', min: 0, max: 20, step: 0.01 },\r\n { type: 'range', name: 'lineWidth', min: 0, max: 20, step: 0.01 },\r\n { type: 'range', name: 'lineContrast', min: 0, max: 5, step: 0.01 },\r\n { type: 'boolean', name: 'verticalLine' },\r\n { type: 'range', name: 'noise', min: 0, max: 2, step: 0.01 },\r\n { type: 'range', name: 'noiseSize', min: 0, max: 20, step: 0.01 },\r\n { type: 'range', name: 'seed', min: 0, max: 100000, step: 1 },\r\n { type: 'range', name: 'vignetting', min: 0, max: 20, step: 0.01 },\r\n { type: 'range', name: 'vignettingAlpha', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'vignettingBlur', min: 0, max: 5, step: 0.01 },\r\n { type: 'range', name: 'time', min: 0, max: 10000, step: 1 },\r\n ],\r\n argType: 'options',\r\n },\r\n DotFilter: {\r\n defaultValues: {\r\n scale: 1,\r\n angle: 5,\r\n },\r\n controls: [\r\n { type: 'range', name: 'scale', min: 0, max: 50, step: 1 },\r\n { type: 'range', name: 'angle', min: 0, max: 360, step: 0.1 },\r\n ],\r\n argType: 'args',\r\n },\r\n DropShadowFilter: {\r\n defaultValues: {\r\n rotation: 45,\r\n distance: 5,\r\n color: 0x000000,\r\n alpha: 0.5,\r\n shadowOnly: false,\r\n blur: 2,\r\n quality: 3,\r\n },\r\n controls: [\r\n { type: 'range', name: 'rotation', min: 0, max: 360, step: 0.1 },\r\n { type: 'range', name: 'distance', min: 0, max: 100, step: 0.1 },\r\n { type: 'color', name: 'color' },\r\n { type: 'range', name: 'alpha', min: 0, max: 1, step: 0.01 },\r\n { type: 'boolean', name: 'shadowOnly' },\r\n { type: 'range', name: 'blur', min: 0, max: 20, step: 0.1 },\r\n { type: 'range', name: 'quality', min: 0, max: 20, step: 1 },\r\n ],\r\n argType: 'options',\r\n },\r\n EmbossFilter: {\r\n defaultValues: {\r\n strength: 5,\r\n },\r\n controls: [{ type: 'range', name: 'strength', min: 0, max: 20, step: 1 }],\r\n argType: 'args',\r\n },\r\n GlitchFilter: {\r\n defaultValues: {\r\n slices: 5,\r\n offset: 100,\r\n direction: 0,\r\n fillMode: 0,\r\n seed: 0,\r\n average: false,\r\n minSize: 8,\r\n sampleSize: 512,\r\n },\r\n controls: [\r\n { type: 'range', name: 'slices', min: 0, max: 50, step: 1 },\r\n { type: 'range', name: 'distance', min: 0, max: 1000, step: 1 },\r\n { type: 'range', name: 'direction', min: 0, max: 360, step: 0.1 },\r\n {\r\n type: 'select',\r\n name: 'fillMode',\r\n options: [\r\n { value: 0, label: 'TRANSPARENT' },\r\n { value: 1, label: 'ORIGINAL' },\r\n { value: 2, label: 'LOOP' },\r\n { value: 3, label: 'CLAMP' },\r\n { value: 4, label: 'MIRROR' },\r\n ],\r\n },\r\n { type: 'range', name: 'seed', min: 0, max: 10000, step: 1 },\r\n { type: 'boolean', name: 'average' },\r\n { type: 'range', name: 'minSize', min: 0, max: 500, step: 1 },\r\n { type: 'range', name: 'sampleSize', min: 0, max: 1024, step: 1 },\r\n ],\r\n argType: 'options',\r\n },\r\n GlowFilter: {\r\n defaultValues: {\r\n distance: 10,\r\n outerStrength: 4,\r\n innerStrength: 0,\r\n color: 0xffffff,\r\n quality: 0.1,\r\n knockout: false,\r\n },\r\n controls: [\r\n { type: 'range', name: 'distance', min: 1, max: 50, step: 1 },\r\n { type: 'range', name: 'outerStrength', min: 0, max: 20, step: 1 },\r\n { type: 'range', name: 'innerStrength', min: 0, max: 20, step: 1 },\r\n { type: 'color', name: 'color' },\r\n { type: 'range', name: 'quality', min: 0, max: 5, step: 0.1 },\r\n { type: 'boolean', name: 'knockout' },\r\n ],\r\n argType: 'options',\r\n },\r\n GodrayFilter: {\r\n defaultValues: {\r\n angle: 30,\r\n gain: 0.5,\r\n lacunarity: 2.5,\r\n parallel: true,\r\n time: 0,\r\n alpha: 1.0,\r\n },\r\n controls: [\r\n { type: 'range', name: 'angle', min: 0, max: 360, step: 0.1 },\r\n { type: 'range', name: 'gain', min: 0, max: 5, step: 0.01 },\r\n { type: 'range', name: 'lacunarity', min: 0, max: 5, step: 0.01 },\r\n { type: 'boolean', name: 'parallel' },\r\n { type: 'range', name: 'time', min: 0, max: 10000, step: 1 },\r\n { type: 'range', name: 'alpha', min: 0, max: 1, step: 0.01 },\r\n ],\r\n argType: 'options',\r\n },\r\n KawaseBlurFilter: {\r\n defaultValues: {\r\n blur: 4,\r\n quality: 3,\r\n clamp: false,\r\n },\r\n controls: [\r\n { type: 'range', name: 'blur', min: 0, max: 20, step: 0.1 },\r\n { type: 'range', name: 'quality', min: 0, max: 20, step: 1 },\r\n { type: 'boolean', name: 'clamp' },\r\n ],\r\n argType: 'args',\r\n },\r\n OldFilmFilter: {\r\n defaultValues: {\r\n sepia: 0.3,\r\n noise: 0.3,\r\n noiseSize: 1.0,\r\n scratch: 0.5,\r\n scratchDensity: 0.3,\r\n scratchWidth: 1.0,\r\n vignetting: 0.3,\r\n vignettingAlpha: 1.0,\r\n vignettingBlur: 0.3,\r\n },\r\n controls: [\r\n { type: 'range', name: 'sepia', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'noise', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'noiseSize', min: 0, max: 5, step: 0.01 },\r\n { type: 'range', name: 'scratch', min: 0, max: 5, step: 0.01 },\r\n { type: 'range', name: 'scratchDensity', min: 0, max: 5, step: 0.01 },\r\n { type: 'range', name: 'scratchWidth', min: 0, max: 20, step: 0.01 },\r\n { type: 'range', name: 'vignetting', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'vignettingAlpha', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'vignettingBlur', min: 0, max: 5, step: 0.01 },\r\n ],\r\n argType: 'options',\r\n },\r\n OutlineFilter: {\r\n defaultValues: {\r\n thickness: 1,\r\n color: 0x000000,\r\n quality: 0.1,\r\n },\r\n controls: [\r\n { type: 'range', name: 'thickness', min: 0, max: 20, step: 0.1 },\r\n { type: 'color', name: 'color' },\r\n { type: 'range', name: 'quality', min: 0, max: 1, step: 0.01 },\r\n ],\r\n argType: 'args',\r\n },\r\n PixelateFilter: {\r\n defaultValues: {\r\n size: 1,\r\n },\r\n controls: [{ type: 'range', name: 'size', min: 1, max: 100, step: 1 }],\r\n argType: 'args',\r\n },\r\n RGBSplitFilter: {\r\n defaultValues: {\r\n red: [-10, 0],\r\n green: [0, 10],\r\n blue: [0, 0],\r\n },\r\n controls: [\r\n { type: 'point', name: 'red', min: 0, max: 50, step: 1 },\r\n { type: 'point', name: 'green', min: 0, max: 50, step: 1 },\r\n { type: 'point', name: 'blue', min: 0, max: 50, step: 1 },\r\n ],\r\n argType: 'args',\r\n },\r\n RadialBlurFilter: {\r\n defaultValues: {\r\n angle: 0,\r\n center: [0, 0],\r\n radius: -1,\r\n },\r\n controls: [\r\n { type: 'range', name: 'angle', min: 0, max: 360, step: 1 },\r\n { type: 'point', name: 'center', min: 0, max: 1000, step: 1 },\r\n { type: 'range', name: 'radius', min: -1, max: 1000, step: 1 },\r\n ],\r\n argType: 'args',\r\n },\r\n ReflectionFilter: {\r\n defaultValues: {\r\n mirror: true,\r\n boundary: 0.5,\r\n amplitude: [0, 20],\r\n waveLength: [30, 100],\r\n alpha: [1, 1],\r\n time: 0,\r\n },\r\n controls: [\r\n { type: 'boolean', name: 'mirror' },\r\n { type: 'range', name: 'boundary', min: 0, max: 1, step: 0.01 },\r\n { type: 'point', name: 'amplitude', min: 0, max: 100, step: 1 },\r\n { type: 'point', name: 'waveLength', min: 0, max: 500, step: 1 },\r\n { type: 'point', name: 'alpha', min: 0, max: 1, step: 0.01 },\r\n { type: 'range', name: 'time', min: 0, max: 10000, step: 1 },\r\n ],\r\n argType: 'options',\r\n },\r\n DisplacementFilter: {\r\n defaultValues: {\r\n sprite: '',\r\n textureScale: 1,\r\n displacementScale: 1,\r\n },\r\n controls: [\r\n { type: 'text', name: 'sprite' },\r\n { type: 'range', name: 'textureScale', min: 0, max: 100, step: 0.1 },\r\n { type: 'range', name: 'displacementScale', min: 0, max: 100, step: 0.1 },\r\n ],\r\n argType: 'options',\r\n },\r\n 'Token Magic FX': {\r\n defaultValues: {\r\n params: [],\r\n },\r\n controls: [\r\n { type: 'tmfxPreset', name: 'tmfxPreset' },\r\n { type: 'json', name: 'params' },\r\n ],\r\n },\r\n};\r\n\r\nfunction genFilterOptionControls(filterName, filterOptions = {}) {\r\n if (!(filterName in FILTERS)) return;\r\n\r\n const options = mergeObject(FILTERS[filterName].defaultValues, filterOptions);\r\n const values = getControlValues(filterName, options);\r\n\r\n const controls = FILTERS[filterName].controls;\r\n let controlsHTML = '<fieldset><legend>Options</legend>';\r\n for (const control of controls) {\r\n controlsHTML += genControl(control, values);\r\n }\r\n controlsHTML += '</fieldset>';\r\n\r\n return controlsHTML;\r\n}\r\n\r\nfunction getControlValues(filterName, options) {\r\n if (filterName === 'OutlineOverlayFilter') {\r\n options.outlineColor = Color.fromRGB(options.outlineColor).toString();\r\n } else if (filterName === 'BevelFilter') {\r\n options.lightColor = Color.from(options.lightColor).toString();\r\n options.shadowColor = Color.from(options.shadowColor).toString();\r\n } else if (['DropShadowFilter', 'GlowFilter', 'OutlineFilter'].includes(filterName)) {\r\n options.color = Color.from(options.color).toString();\r\n }\r\n return options;\r\n}\r\n\r\nfunction genControl(control, values) {\r\n const val = values[control.name];\r\n const name = control.name;\r\n const label = control.label ?? name.charAt(0).toUpperCase() + name.slice(1);\r\n const type = control.type;\r\n if (type === 'color') {\r\n return `\r\n<div class=\"form-group\">\r\n <label>${label}</label>\r\n <div class=\"form-fields\">\r\n <input class=\"color\" type=\"text\" name=\"filterOptions.${name}\" value=\"${val}\">\r\n <input type=\"color\" value=\"${val}\" data-edit=\"filterOptions.${name}\">\r\n </div>\r\n</div>\r\n`;\r\n } else if (type === 'range') {\r\n return `\r\n<div class=\"form-group\">\r\n <label>${label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"range\" name=\"filterOptions.${name}\" value=\"${val}\" min=\"${control.min}\" max=\"${control.max}\" step=\"${control.step}\">\r\n <span class=\"range-value\">${val}</span>\r\n </div>\r\n</div>\r\n`;\r\n } else if (type === 'boolean') {\r\n return `\r\n<div class=\"form-group\">\r\n <label>${label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"filterOptions.${name}\" data-dtype=\"Boolean\" value=\"${val}\" ${val ? 'checked' : ''}>\r\n </div>\r\n</div>\r\n `;\r\n } else if (type === 'select') {\r\n let select = `\r\n <div class=\"form-group\">\r\n <label>${label}</label>\r\n <div class=\"form-fields\">\r\n <select name=\"${name}\">\r\n`;\r\n\r\n for (const opt of control.options) {\r\n select += `<option value=\"${opt.value}\" ${val === opt.value ? 'selected=\"selected\"' : ''}>${opt.label}</option>`;\r\n }\r\n\r\n select += `</select></div></div>`;\r\n\r\n return select;\r\n } else if (type === 'point') {\r\n return `\r\n<div class=\"form-group\">\r\n <label>${label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"range\" name=\"filterOptions.${name}\" value=\"${val[0]}\" min=\"${control.min}\" max=\"${control.max}\" step=\"${control.step}\">\r\n <span class=\"range-value\">${val[0]}</span>\r\n </div>\r\n <div class=\"form-fields\">\r\n <input type=\"range\" name=\"filterOptions.${name}\" value=\"${val[1]}\" min=\"${control.min}\" max=\"${control.max}\" step=\"${control.step}\">\r\n <span class=\"range-value\">${val[1]}</span>\r\n </div>\r\n</div>\r\n`;\r\n } else if (type === 'json') {\r\n let control = `\r\n<div class=\"form-group\">\r\n <label>${label}</label>\r\n <div class=\"form-fields\">\r\n <textarea style=\"width: 450px; height: 200px;\" name=\"filterOptions.${name}\">${val}</textarea>\r\n </div>`;\r\n if (game.modules.get('multi-token-edit')?.api.showGenericForm) {\r\n control += `\r\n <div style=\"text-align: right; color: orangered;\">\r\n <a> <i class=\"me-edit-json fas fa-edit\" title=\"Show Generic Form\"></i></a>\r\n </div>`;\r\n }\r\n control += `</div>`;\r\n return control;\r\n } else if (type === 'text') {\r\n return `\r\n<div class=\"form-group\">\r\n <label>${label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"filterOptions.${name}\" value=\"${val}\">\r\n </div>\r\n</div>\r\n`;\r\n } else if (type === 'tmfxPreset' && game.modules.get('tokenmagic')?.active) {\r\n return `\r\n <div class=\"form-group\">\r\n <label>Preset <span class=\"units\">(TMFX)</span></label>\r\n <div class=\"form-fields\">\r\n <input list=\"tmfxPresets\" class=\"tmfxPreset\">\r\n <button type=\"button\" class=\"presetImport\"><i class=\"fas fa-download\"></i></button>\r\n </div>\r\n `;\r\n }\r\n return '';\r\n}\r\n\r\nasync function promptParamChoice(params) {\r\n return new Promise((resolve, reject) => {\r\n const buttons = {};\r\n for (let i = 0; i < params.length; i++) {\r\n const label = params[i].filterType ?? params[i].filterId;\r\n buttons[label] = {\r\n label,\r\n callback: () => {\r\n resolve(i);\r\n },\r\n };\r\n }\r\n\r\n const dialog = new Dialog({\r\n title: 'Select Filter To Edit',\r\n content: '',\r\n buttons,\r\n close: () => resolve(-1),\r\n });\r\n dialog.render(true);\r\n });\r\n}\r\n","export const DEFAULT_ACTIVE_EFFECT_CONFIG = {\r\n id: '',\r\n label: '',\r\n expression: '',\r\n codeExp: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: null,\r\n overlay: false,\r\n alwaysOn: false,\r\n tokens: undefined,\r\n disabled: false,\r\n overlayConfig: null,\r\n targetActors: null,\r\n group: 'Default',\r\n};\r\n\r\nexport const DEFAULT_OVERLAY_CONFIG = {\r\n img: '',\r\n imgLinked: false,\r\n alpha: 1,\r\n scaleX: 1,\r\n scaleY: 1,\r\n offsetX: 0,\r\n offsetY: 0,\r\n angle: 0,\r\n filter: 'NONE',\r\n filterOptions: {},\r\n inheritTint: false,\r\n top: false,\r\n bottom: false,\r\n underlay: false,\r\n linkRotation: true,\r\n linkMirror: true,\r\n linkOpacity: false,\r\n linkScale: true,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkStageScale: false,\r\n mirror: false,\r\n tint: null,\r\n loop: true,\r\n playOnce: false,\r\n animation: {\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n relative: false,\r\n },\r\n limitedUsers: [],\r\n limitedToOwner: false,\r\n limitOnProperty: '',\r\n alwaysVisible: false,\r\n text: {\r\n text: '',\r\n align: CONFIG.canvasTextStyle.align,\r\n fontSize: CONFIG.canvasTextStyle.fontSize,\r\n fontFamily: CONFIG.canvasTextStyle.fontFamily,\r\n fill: CONFIG.canvasTextStyle.fill,\r\n dropShadow: CONFIG.canvasTextStyle.dropShadow,\r\n strokeThickness: CONFIG.canvasTextStyle.strokeThickness,\r\n stroke: CONFIG.canvasTextStyle.stroke,\r\n curve: { angle: 0, radius: 0, invert: false },\r\n letterSpacing: CONFIG.canvasTextStyle.letterSpacing,\r\n repeating: false,\r\n wordWrap: false,\r\n wordWrapWidth: 200,\r\n breakWords: false,\r\n maxHeight: 0,\r\n },\r\n parentID: '',\r\n id: null,\r\n anchor: { x: 0.5, y: 0.5 },\r\n shapes: [],\r\n variables: [],\r\n interactivity: [],\r\n ui: false,\r\n};\r\n\r\nexport const OVERLAY_SHAPES = {\r\n Rectangle: {\r\n type: 'rectangle',\r\n x: 0,\r\n y: 0,\r\n width: 100,\r\n height: 100,\r\n radius: 0,\r\n repeating: false,\r\n },\r\n Ellipse: {\r\n type: 'ellipse',\r\n x: 0,\r\n y: 0,\r\n width: 50,\r\n height: 50,\r\n repeating: false,\r\n },\r\n Polygon: {\r\n type: 'polygon',\r\n x: 0,\r\n y: 0,\r\n points: '0,1,0.95,0.31,0.59,-0.81,-0.59,-0.81,-0.95,0.31',\r\n scale: 50,\r\n repeating: false,\r\n },\r\n Torus: {\r\n type: 'torus',\r\n x: 0,\r\n y: 0,\r\n innerRadius: 50,\r\n outerRadius: 100,\r\n startAngle: 0,\r\n endAngle: 180,\r\n repeating: false,\r\n },\r\n};\r\n\r\nexport const CORE_SHAPE = {\r\n line: {\r\n width: 1,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: { color: '#ffffff', color2: '', prc: '', alpha: 1 },\r\n};\r\n","import { FEATURE_CONTROL, TVA_CONFIG, getFlagMappings, updateSettings } from '../settings.js';\r\nimport {\r\n applyCEEffect,\r\n applyTMFXPreset,\r\n determineAddedRemovedEffects,\r\n executeMacro,\r\n EXPRESSION_OPERATORS,\r\n getAllActorTokens,\r\n getFileName,\r\n mergeMappings,\r\n tv_executeScript,\r\n updateTokenImage,\r\n} from '../utils.js';\r\nimport { broadcastOverlayRedraw, drawOverlays } from '../token/overlay.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\nimport { CORE_TEMPLATES } from '../mappingTemplates.js';\r\n\r\nconst EXPRESSION_MATCH_RE = /(\\\\\\()|(\\\\\\))|(\\|\\|)|(\\&\\&)|(\\\\\\!)/g;\r\nconst PF2E_ITEM_TYPES = ['condition', 'effect', 'weapon', 'equipment'];\r\nconst ITEM_TYPES = ['equipment', 'weapon'];\r\nconst feature_id = 'EffectMappings';\r\n\r\nexport function registerEffectMappingHooks() {\r\n if (!FEATURE_CONTROL[feature_id]) {\r\n [\r\n 'canvasReady',\r\n 'createActiveEffect',\r\n 'deleteActiveEffect',\r\n 'preUpdateActiveEffect',\r\n 'updateActiveEffect',\r\n 'createCombatant',\r\n 'deleteCombatant',\r\n 'preUpdateCombat',\r\n 'updateCombat',\r\n 'deleteCombat',\r\n 'preUpdateToken',\r\n 'preUpdateActor',\r\n 'updateActor',\r\n 'updateToken',\r\n 'createToken',\r\n 'preUpdateItem',\r\n 'updateItem',\r\n 'createItem',\r\n 'deleteItem',\r\n ].forEach((name) => unregisterHook(feature_id, name));\r\n return;\r\n }\r\n\r\n if (game.user.isGM) {\r\n registerHook(feature_id, 'canvasReady', _refreshTokenMappings);\r\n _refreshTokenMappings();\r\n }\r\n\r\n registerHook(feature_id, 'createActiveEffect', (activeEffect, options, userId) => {\r\n if (!activeEffect.parent || activeEffect.disabled || game.userId !== userId) return;\r\n const effectName = activeEffect.name ?? activeEffect.label;\r\n _updateImageOnEffectChange(effectName, activeEffect.parent, true);\r\n });\r\n registerHook(feature_id, 'deleteActiveEffect', (activeEffect, options, userId) => {\r\n if (!activeEffect.parent || activeEffect.disabled || game.userId !== userId) return;\r\n const effectName = activeEffect.name ?? activeEffect.label;\r\n _updateImageOnEffectChange(effectName, activeEffect.parent, false);\r\n });\r\n registerHook(feature_id, 'preUpdateActiveEffect', _preUpdateActiveEffect);\r\n registerHook(feature_id, 'updateActiveEffect', _updateActiveEffect);\r\n registerHook(feature_id, 'preUpdateToken', _preUpdateToken);\r\n registerHook(feature_id, 'preUpdateActor', _preUpdateActor);\r\n registerHook(feature_id, 'updateActor', _updateActor);\r\n registerHook(feature_id, 'updateToken', _updateToken);\r\n registerHook(feature_id, 'createToken', _createToken);\r\n registerHook(feature_id, 'createCombatant', _createCombatant);\r\n registerHook(feature_id, 'deleteCombatant', (combatant, options, userId) => {\r\n if (game.userId !== userId) return;\r\n _deleteCombatant(combatant);\r\n });\r\n registerHook(feature_id, 'preUpdateCombat', _preUpdateCombat);\r\n registerHook(feature_id, 'updateCombat', _updateCombat);\r\n registerHook(feature_id, 'deleteCombat', (combat, options, userId) => {\r\n if (game.userId !== userId) return;\r\n combat.combatants.forEach((combatant) => {\r\n _deleteCombatant(combatant);\r\n });\r\n });\r\n\r\n const applicable_item_types = game.system.id === 'pf2e' ? PF2E_ITEM_TYPES : ITEM_TYPES;\r\n // Want to track condition/effect previous name so that the config can be reverted for it\r\n registerHook(feature_id, 'preUpdateItem', (item, change, options, userId) => {\r\n if (game.user.id === userId && applicable_item_types.includes(item.type)) {\r\n options['token-variants-old-name'] = item.name;\r\n }\r\n _preUpdateAssign(item.parent, change, options);\r\n });\r\n\r\n registerHook(feature_id, 'createItem', (item, options, userId) => {\r\n if (game.userId !== userId || !applicable_item_types.includes(item.type) || !item.parent) return;\r\n _updateImageOnEffectChange(item.name, item.parent, true);\r\n });\r\n\r\n registerHook(feature_id, 'deleteItem', (item, options, userId) => {\r\n if (game.userId !== userId || !applicable_item_types.includes(item.type) || !item.parent || item.disabled) return;\r\n _updateImageOnEffectChange(item.name, item.parent, false);\r\n });\r\n\r\n // Status Effects can be applied \"stealthily\" on item equip/un-equip\r\n registerHook(feature_id, 'updateItem', _updateItem);\r\n}\r\n\r\nasync function _refreshTokenMappings() {\r\n for (const tkn of canvas.tokens.placeables) {\r\n await updateWithEffectMapping(tkn);\r\n }\r\n}\r\n\r\nfunction _createCombatant(combatant, options, userId) {\r\n if (game.userId !== userId) return;\r\n const token = combatant._token || canvas.tokens.get(combatant.tokenId);\r\n if (!token || !token.actor) return;\r\n\r\n updateWithEffectMapping(token, {\r\n added: ['token-variants-combat'],\r\n });\r\n}\r\n\r\nfunction _preUpdateActiveEffect(activeEffect, change, options, userId) {\r\n if (!activeEffect.parent || game.userId !== userId) return;\r\n\r\n if ('label' in change) {\r\n options['token-variants-old-name'] = activeEffect.label;\r\n }\r\n}\r\n\r\nfunction _updateActiveEffect(activeEffect, change, options, userId) {\r\n if (!activeEffect.parent || game.userId !== userId) return;\r\n\r\n const added = [];\r\n const removed = [];\r\n\r\n if ('disabled' in change) {\r\n if (change.disabled) removed.push(activeEffect.label);\r\n else added.push(activeEffect.label);\r\n }\r\n if ('label' in change) {\r\n removed.push(options['token-variants-old-name']);\r\n added.push(change.label);\r\n }\r\n\r\n if (added.length || removed.length) {\r\n _updateImageOnMultiEffectChange(activeEffect.parent, added, removed);\r\n }\r\n}\r\n\r\nfunction _preUpdateToken(token, change, options, userId) {\r\n if (game.user.id !== userId || change.actorId) return;\r\n\r\n const preUpdateEffects = getTokenEffects(token, true);\r\n if (preUpdateEffects.length) {\r\n setProperty(options, 'token-variants.preUpdateEffects', preUpdateEffects);\r\n }\r\n\r\n if (game.system.id === 'dnd5e' && token.actor?.isPolymorphed) {\r\n setProperty(options, 'token-variants.wasPolymorphed', true);\r\n }\r\n}\r\n\r\nasync function _updateToken(token, change, options, userId) {\r\n if (game.user.id !== userId || change.actorId) return;\r\n\r\n // TODO\r\n token.object?.tvaOverlays?.forEach((ov) => ov.htmlOverlay?.render());\r\n\r\n const addedEffects = [];\r\n const removedEffects = [];\r\n const preUpdateEffects = getProperty(options, 'token-variants.preUpdateEffects') || [];\r\n const postUpdateEffects = getTokenEffects(token, true);\r\n determineAddedRemovedEffects(addedEffects, removedEffects, postUpdateEffects, preUpdateEffects);\r\n\r\n if (addedEffects.length || removedEffects.length || 'actorLink' in change) {\r\n updateWithEffectMapping(token, { added: addedEffects, removed: removedEffects });\r\n } else if (getProperty(options, 'token-variants.wasPolymorphed') && !token.actor?.isPolymorphed) {\r\n updateWithEffectMapping(token);\r\n }\r\n\r\n if (game.userId === userId && 'hidden' in change) {\r\n updateWithEffectMapping(token, {\r\n added: change.hidden ? ['token-variants-visibility'] : [],\r\n removed: !change.hidden ? ['token-variants-visibility'] : [],\r\n });\r\n }\r\n}\r\n\r\nfunction _preUpdateActor(actor, change, options, userId) {\r\n if (game.user.id !== userId) return;\r\n _preUpdateAssign(actor, change, options);\r\n}\r\n\r\nasync function _updateActor(actor, change, options, userId) {\r\n if (game.user.id !== userId) return;\r\n\r\n if ('flags' in change && 'token-variants' in change.flags) {\r\n const tokenVariantFlags = change.flags['token-variants'];\r\n if ('effectMappings' in tokenVariantFlags || '-=effectMappings' in tokenVariantFlags) {\r\n const tokens = actor.token ? [actor.token] : getAllActorTokens(actor, true, !TVA_CONFIG.mappingsCurrentSceneOnly);\r\n tokens.forEach((tkn) => updateWithEffectMapping(tkn));\r\n for (const tkn of tokens) {\r\n if (tkn.object && TVA_CONFIG.filterEffectIcons) {\r\n await tkn.object.drawEffects();\r\n }\r\n }\r\n }\r\n }\r\n\r\n _preUpdateCheck(actor, options);\r\n}\r\n\r\nfunction _preUpdateAssign(actor, change, options) {\r\n if (!actor) return;\r\n\r\n // Determine which comparators are applicable so that we can compare after the\r\n // actor update\r\n const tokens = actor.token ? [actor.token] : getAllActorTokens(actor, true, !TVA_CONFIG.mappingsCurrentSceneOnly);\r\n if (TVA_CONFIG.internalEffects.hpChange.enabled && tokens.length) {\r\n applyHpChangeEffect(actor, change, tokens);\r\n }\r\n for (const tkn of tokens) {\r\n const preUpdateEffects = getTokenEffects(tkn, true);\r\n\r\n if (preUpdateEffects.length) {\r\n setProperty(options, 'token-variants.' + tkn.id + '.preUpdateEffects', preUpdateEffects);\r\n }\r\n }\r\n}\r\n\r\nfunction _preUpdateCheck(actor, options, pAdded = [], pRemoved = []) {\r\n if (!actor) return;\r\n const tokens = actor.token ? [actor.token] : getAllActorTokens(actor, true, !TVA_CONFIG.mappingsCurrentSceneOnly);\r\n for (const tkn of tokens) {\r\n // Check if effects changed by comparing them against the ones calculated in preUpdate*\r\n const added = [...pAdded];\r\n const removed = [...pRemoved];\r\n const postUpdateEffects = getTokenEffects(tkn, true);\r\n const preUpdateEffects = getProperty(options, 'token-variants.' + tkn.id + '.preUpdateEffects') ?? [];\r\n\r\n determineAddedRemovedEffects(added, removed, postUpdateEffects, preUpdateEffects);\r\n if (added.length || removed.length) updateWithEffectMapping(tkn, { added, removed });\r\n }\r\n}\r\n\r\nfunction _createToken(token, options, userId) {\r\n if (userId && userId === game.user.id) updateWithEffectMapping(token);\r\n}\r\n\r\nfunction _preUpdateCombat(combat, round, options, userId) {\r\n if (game.userId !== userId) return;\r\n options['token-variants'] = {\r\n combatantId: combat?.combatant?.token?.id,\r\n nextCombatantId: combat?.nextCombatant?.token?.id,\r\n };\r\n}\r\n\r\nfunction _updateCombat(combat, round, options, userId) {\r\n if (game.userId !== userId) return;\r\n\r\n const previousCombatantId = options['token-variants']?.combatantId;\r\n const previousNextCombatantId = options['token-variants']?.nextCombatantId;\r\n\r\n const currentCombatantId = combat?.combatant?.token?.id;\r\n const currentNextCombatantId = combat?.nextCombatant?.token?.id;\r\n\r\n const updateCombatant = function (id, added = [], removed = []) {\r\n if (game.user.isGM) {\r\n const token = canvas.tokens.get(id);\r\n if (token) updateWithEffectMapping(token, { added, removed });\r\n } else {\r\n const message = {\r\n handlerName: 'effectMappings',\r\n args: { tokenId: id, sceneId: canvas.scene.id, added, removed },\r\n type: 'UPDATE',\r\n };\r\n game.socket?.emit('module.token-variants', message);\r\n }\r\n };\r\n\r\n if (previousCombatantId !== currentCombatantId) {\r\n if (previousCombatantId) updateCombatant(previousCombatantId, [], ['combat-turn']);\r\n if (currentCombatantId) updateCombatant(currentCombatantId, ['combat-turn'], []);\r\n }\r\n if (previousNextCombatantId !== currentNextCombatantId) {\r\n if (previousNextCombatantId) updateCombatant(previousNextCombatantId, [], ['combat-turn-next']);\r\n if (currentNextCombatantId) updateCombatant(currentNextCombatantId, ['combat-turn-next'], []);\r\n }\r\n}\r\n\r\nfunction _updateItem(item, change, options, userId) {\r\n const added = [];\r\n const removed = [];\r\n\r\n if (game.user.id === userId) {\r\n // Handle condition/effect name change\r\n if (options['token-variants-old-name'] !== item.name) {\r\n added.push(item.name);\r\n removed.push(options['token-variants-old-name']);\r\n }\r\n\r\n _preUpdateCheck(item.parent, options, added, removed);\r\n }\r\n}\r\n\r\nlet EFFECT_M_QUEUES = {};\r\nlet EFFECT_M_TIMER;\r\n\r\nexport async function updateWithEffectMapping(token, { added = [], removed = [] } = {}) {\r\n const callUpdateWithEffectMapping = function () {\r\n for (const id of Object.keys(EFFECT_M_QUEUES)) {\r\n const m = EFFECT_M_QUEUES[id];\r\n _updateWithEffectMapping(m.token, m.opts.added, m.opts.removed);\r\n }\r\n EFFECT_M_QUEUES = {};\r\n };\r\n\r\n clearTimeout(EFFECT_M_TIMER);\r\n\r\n if (token.id in EFFECT_M_QUEUES) {\r\n const opts = EFFECT_M_QUEUES[token.id].opts;\r\n added.forEach((a) => opts.added.add(a));\r\n removed.forEach((a) => opts.removed.add(a));\r\n } else {\r\n EFFECT_M_QUEUES[token.id] = {\r\n token,\r\n opts: { added: new Set(added), removed: new Set(removed) },\r\n };\r\n }\r\n EFFECT_M_TIMER = setTimeout(callUpdateWithEffectMapping, 100);\r\n}\r\n\r\nasync function _updateWithEffectMapping(token, added, removed) {\r\n const placeable = token.object ?? token._object ?? token;\r\n token = token.document ?? token;\r\n\r\n const tokenImgName = token.getFlag('token-variants', 'name') || getFileName(token.texture.src);\r\n let tokenDefaultImg = token.getFlag('token-variants', 'defaultImg');\r\n const animate = !TVA_CONFIG.disableTokenUpdateAnimation;\r\n const tokenUpdateObj = {};\r\n const hadActiveHUD = token.object?.hasActiveHUD;\r\n const toggleStatus = canvas.tokens.hud.object?.id === token.id ? canvas.tokens.hud._statusEffects : false;\r\n\r\n let effects = getTokenEffects(token);\r\n\r\n // If effect is included in `added` or `removed` we need to:\r\n // 1. Insert it into `effects` if it's not there in case of 'added' and place it on top of the list\r\n // 2. Remove it in case of 'removed'\r\n for (const ef of added) {\r\n const i = effects.findIndex((s) => s === ef);\r\n if (i === -1) {\r\n effects.push(ef);\r\n } else if (i < effects.length - 1) {\r\n effects.splice(i, 1);\r\n effects.push(ef);\r\n }\r\n }\r\n for (const ef of removed) {\r\n const i = effects.findIndex((s) => s === ef);\r\n if (i !== -1) {\r\n effects.splice(i, 1);\r\n }\r\n }\r\n\r\n const mappings = getAllEffectMappings(token);\r\n\r\n // 3. Configurations may contain effect names in a form of a logical expressions\r\n // We need to evaluate them and insert them into effects/added/removed if needed\r\n for (const mapping of mappings) {\r\n evaluateMappingExpression(mapping, effects, token, added, removed);\r\n }\r\n\r\n // Accumulate all scripts that will need to be run after the update\r\n const executeOnCallback = [];\r\n const deferredUpdateScripts = [];\r\n for (const ef of removed) {\r\n const script = mappings.find((m) => m.id === ef)?.config?.tv_script;\r\n if (script) {\r\n if (script.onRemove) {\r\n if (script.onRemove.includes('tvaUpdate')) deferredUpdateScripts.push(script.onRemove);\r\n else executeOnCallback.push({ script: script.onRemove, token });\r\n }\r\n if (script.tmfxPreset) executeOnCallback.push({ tmfxPreset: script.tmfxPreset, token, action: 'remove' });\r\n if (script.ceEffect?.name) executeOnCallback.push({ ceEffect: script.ceEffect, token, action: 'remove' });\r\n if (script.macroOnApply) executeOnCallback.push({ macro: script.macroOnApply, token });\r\n }\r\n }\r\n for (const ef of added) {\r\n const script = mappings.find((m) => m.id === ef)?.config?.tv_script;\r\n if (script) {\r\n if (script.onApply) {\r\n if (script.onApply.includes('tvaUpdate')) deferredUpdateScripts.push(script.onApply);\r\n else executeOnCallback.push({ script: script.onApply, token });\r\n }\r\n if (script.tmfxPreset) executeOnCallback.push({ tmfxPreset: script.tmfxPreset, token, action: 'apply' });\r\n if (script.ceEffect?.name) executeOnCallback.push({ ceEffect: script.ceEffect, token, action: 'apply' });\r\n if (script.macroOnRemove) executeOnCallback.push({ macro: script.macroOnRemove, token });\r\n }\r\n }\r\n\r\n // Next we're going to determine what configs need to be applied and in what order\r\n // Filter effects that do not have a mapping and sort based on priority\r\n effects = mappings.filter((m) => effects.includes(m.id)).sort((ef1, ef2) => ef1.priority - ef2.priority);\r\n\r\n // Check if image update should be prevented based on module settings\r\n let disableImageUpdate = false;\r\n if (TVA_CONFIG.disableImageChangeOnPolymorphed && token.actor?.isPolymorphed) {\r\n disableImageUpdate = true;\r\n } else if (\r\n TVA_CONFIG.disableImageUpdateOnNonPrototype &&\r\n token.actor?.prototypeToken?.texture?.src !== token.texture.src\r\n ) {\r\n disableImageUpdate = true;\r\n const tknImg = token.texture.src;\r\n for (const m of mappings) {\r\n if (m.imgSrc === tknImg) {\r\n disableImageUpdate = false;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (disableImageUpdate) {\r\n tokenDefaultImg = '';\r\n }\r\n\r\n let updateCall;\r\n\r\n if (effects.length > 0) {\r\n // Some effect mappings may not have images, find a mapping with one if it exists\r\n const newImg = { imgSrc: '', imgName: '' };\r\n\r\n if (!disableImageUpdate) {\r\n for (let i = effects.length - 1; i >= 0; i--) {\r\n if (effects[i].imgSrc) {\r\n let iSrc = effects[i].imgSrc;\r\n if (iSrc.includes('*') || (iSrc.includes('{') && iSrc.includes('}'))) {\r\n // wildcard image, if this effect hasn't been newly applied we do not want to randomize the image again\r\n if (!added.has(effects[i].overlayConfig?.effect)) {\r\n newImg.imgSrc = token.texture.src;\r\n newImg.imgName = getFileName(newImg.imgSrc);\r\n break;\r\n }\r\n }\r\n newImg.imgSrc = effects[i].imgSrc;\r\n newImg.imgName = effects[i].imgName;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Collect custom configs to be applied to the token\r\n let config;\r\n if (TVA_CONFIG.stackStatusConfig) {\r\n config = {};\r\n for (const ef of effects) {\r\n config = mergeObject(config, ef.config);\r\n }\r\n } else {\r\n for (let i = effects.length - 1; i >= 0; i--) {\r\n if (effects[i].config && Object.keys(effects[i].config).length !== 0) {\r\n config = effects[i].config;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Use or update the default (original) token image\r\n if (!newImg.imgSrc && tokenDefaultImg) {\r\n delete tokenUpdateObj.flags?.['token-variants']?.defaultImg;\r\n setProperty(tokenUpdateObj, 'flags.token-variants.-=defaultImg', null);\r\n newImg.imgSrc = tokenDefaultImg.imgSrc;\r\n newImg.imgName = tokenDefaultImg.imgName;\r\n } else if (!tokenDefaultImg && newImg.imgSrc) {\r\n setProperty(tokenUpdateObj, 'flags.token-variants.defaultImg', {\r\n imgSrc: token.texture.src,\r\n imgName: tokenImgName,\r\n });\r\n }\r\n\r\n updateCall = () =>\r\n updateTokenImage(newImg.imgSrc ?? null, {\r\n token,\r\n imgName: newImg.imgName ? newImg.imgName : tokenImgName,\r\n tokenUpdate: tokenUpdateObj,\r\n callback: _postTokenUpdateProcessing.bind(null, token, hadActiveHUD, toggleStatus, executeOnCallback),\r\n config: config,\r\n animate,\r\n });\r\n }\r\n\r\n // If no mapping has been found and the default image (image prior to effect triggered update) is different from current one\r\n // reset the token image back to default\r\n if (effects.length === 0 && tokenDefaultImg) {\r\n delete tokenUpdateObj.flags?.['token-variants']?.defaultImg;\r\n setProperty(tokenUpdateObj, 'flags.token-variants.-=defaultImg', null);\r\n\r\n updateCall = () =>\r\n updateTokenImage(tokenDefaultImg.imgSrc, {\r\n token,\r\n imgName: tokenDefaultImg.imgName,\r\n tokenUpdate: tokenUpdateObj,\r\n callback: _postTokenUpdateProcessing.bind(null, token, hadActiveHUD, toggleStatus, executeOnCallback),\r\n animate,\r\n });\r\n // If no default image exists but a custom effect is applied, we still want to perform an update to\r\n // clear it\r\n } else if (effects.length === 0 && token.getFlag('token-variants', 'usingCustomConfig')) {\r\n updateCall = () =>\r\n updateTokenImage(token.texture.src, {\r\n token,\r\n imgName: tokenImgName,\r\n tokenUpdate: tokenUpdateObj,\r\n callback: _postTokenUpdateProcessing.bind(null, token, hadActiveHUD, toggleStatus, executeOnCallback),\r\n animate,\r\n });\r\n }\r\n\r\n if (updateCall) {\r\n if (deferredUpdateScripts.length) {\r\n for (let i = 0; i < deferredUpdateScripts.length; i++) {\r\n if (i === deferredUpdateScripts.length - 1) {\r\n await tv_executeScript(deferredUpdateScripts[i], {\r\n token,\r\n tvaUpdate: () => {\r\n updateCall();\r\n },\r\n });\r\n } else {\r\n await tv_executeScript(deferredUpdateScripts[i], {\r\n token,\r\n tvaUpdate: () => {},\r\n });\r\n }\r\n }\r\n } else {\r\n updateCall();\r\n }\r\n } else {\r\n if (executeOnCallback.length || deferredUpdateScripts.length) {\r\n _postTokenUpdateProcessing(token, hadActiveHUD, toggleStatus, executeOnCallback);\r\n _postTokenUpdateProcessing(token, hadActiveHUD, toggleStatus, deferredUpdateScripts);\r\n }\r\n }\r\n broadcastOverlayRedraw(placeable);\r\n}\r\n\r\nasync function _postTokenUpdateProcessing(token, hadActiveHUD, toggleStatus, scripts) {\r\n if (hadActiveHUD && token.object) {\r\n canvas.tokens.hud.bind(token.object);\r\n if (toggleStatus) canvas.tokens.hud._toggleStatusEffects(true);\r\n }\r\n for (const scr of scripts) {\r\n if (scr.script) {\r\n await tv_executeScript(scr.script, { token: scr.token });\r\n } else if (scr.tmfxPreset) {\r\n await applyTMFXPreset(scr.token, scr.tmfxPreset, scr.action);\r\n } else if (scr.ceEffect) {\r\n await applyCEEffect(scr.token, scr.ceEffect, scr.action);\r\n } else if (scr.macro) {\r\n await executeMacro(scr.macro, token);\r\n }\r\n }\r\n}\r\n\r\nexport function getAllEffectMappings(token = null, includeDisabled = false) {\r\n let allMappings = getFlagMappings(token);\r\n const unique = new Set();\r\n\r\n // TODO: replace with a setting\r\n allMappings.forEach((m) => unique.add(TVA_CONFIG.mergeGroup ? m.group : m.label));\r\n\r\n // Sort out global mappings that do not apply to this actor\r\n let applicableGlobal = TVA_CONFIG.globalMappings;\r\n if (token?.actor?.type) {\r\n const actorType = token.actor.type;\r\n applicableGlobal = applicableGlobal.filter((m) => {\r\n if (!m.targetActors || m.targetActors.includes(actorType)) {\r\n return !unique.has(TVA_CONFIG.mergeGroup ? m.group : m.label);\r\n }\r\n return false;\r\n });\r\n }\r\n allMappings = allMappings.concat(applicableGlobal);\r\n\r\n if (!includeDisabled) allMappings = allMappings.filter((m) => !m.disabled);\r\n\r\n return allMappings;\r\n}\r\n\r\nexport async function setOverlayVisibility({\r\n userName = null,\r\n userId = null,\r\n label = null,\r\n group = null,\r\n token = null,\r\n visible = true,\r\n} = {}) {\r\n if (!label && !group) return;\r\n if (userName) userId = game.users.find((u) => u.name === userName)?.id;\r\n if (!userId) return;\r\n\r\n let tokenMappings = getFlagMappings(token);\r\n let globalMappings = TVA_CONFIG.globalMappings;\r\n\r\n let updateToken = false;\r\n let updateGlobal = false;\r\n\r\n const updateMappings = function (mappings) {\r\n mappings = mappings.filter((m) => m.overlay && (m.label === label || m.group === group));\r\n let found = false;\r\n if (mappings.length) found = true;\r\n\r\n mappings.forEach((m) => {\r\n const overlayConfig = m.overlayConfig;\r\n if (visible) {\r\n if (!overlayConfig.limitedUsers) overlayConfig.limitedUsers = [];\r\n if (!overlayConfig.limitedUsers.find((u) => u === userId)) overlayConfig.limitedUsers.push(userId);\r\n } else if (overlayConfig.limitedUsers) {\r\n overlayConfig.limitedUsers = overlayConfig.limitedUsers.filter((u) => u !== userId);\r\n }\r\n });\r\n return found;\r\n };\r\n\r\n updateToken = updateMappings(tokenMappings);\r\n updateGlobal = updateMappings(globalMappings);\r\n\r\n if (updateGlobal) await updateSettings({ globalMappings: globalMappings });\r\n if (updateToken) {\r\n const actor = game.actors.get(token.document.actorId);\r\n if (actor) await actor.setFlag('token-variants', 'effectMappings', tokenMappings);\r\n }\r\n if (updateToken || updateGlobal) drawOverlays(token);\r\n}\r\n\r\nfunction _getTemplateMappings(templateName) {\r\n return (\r\n TVA_CONFIG.templateMappings.find((t) => t.name === templateName) ??\r\n CORE_TEMPLATES.find((t) => t.name === templateName)\r\n )?.mappings;\r\n}\r\n\r\nexport async function applyTemplate(token, templateName = null, mappings = null) {\r\n if (templateName) mappings = _getTemplateMappings(templateName);\r\n if (!token || !mappings) return;\r\n\r\n const actor = game.actors.get(token.actor.id);\r\n if (!actor) return;\r\n const templateMappings = deepClone(mappings);\r\n templateMappings.forEach((tm) => (tm.tokens = [token.id]));\r\n\r\n const actMappings = mergeMappings(templateMappings, getFlagMappings(actor));\r\n await actor.setFlag('token-variants', 'effectMappings', actMappings);\r\n await updateWithEffectMapping(token);\r\n drawOverlays(token);\r\n}\r\n\r\nexport async function removeTemplate(token, templateName = null, mappings = null) {\r\n if (templateName) mappings = _getTemplateMappings(templateName);\r\n if (!token || !mappings) return;\r\n\r\n const actor = game.actors.get(token.actor.id);\r\n if (!actor) return;\r\n\r\n let actMappings = getFlagMappings(actor);\r\n mappings.forEach((m) => {\r\n let i = actMappings.findIndex((m2) => m2.id === m.id);\r\n if (i !== -1) {\r\n actMappings[i].tokens = actMappings[i].tokens.filter((t) => t !== token.id);\r\n if (actMappings[i].tokens.length === 0) actMappings.splice(i, 1);\r\n }\r\n });\r\n\r\n if (actMappings.length) await actor.setFlag('token-variants', 'effectMappings', actMappings);\r\n else await actor.unsetFlag('token-variants', 'effectMappings');\r\n await updateWithEffectMapping(token);\r\n drawOverlays(token);\r\n}\r\n\r\nexport function toggleTemplate(token, templateName = null, mappings = null) {\r\n if (templateName) mappings = _getTemplateMappings(templateName);\r\n if (!token || !mappings) return;\r\n\r\n const actor = game.actors.get(token.actor.id);\r\n if (!actor) return;\r\n\r\n const actMappings = getFlagMappings(actor);\r\n if (actMappings.some((m) => mappings.some((m2) => m2.id === m.id && m.tokens?.includes(token.id)))) {\r\n removeTemplate(token, null, mappings);\r\n } else {\r\n applyTemplate(token, null, mappings);\r\n }\r\n}\r\n\r\nexport function toggleTemplateOnSelected(templateName = null, mappings = null) {\r\n canvas.tokens.controlled.forEach((t) => toggleTemplate(t, templateName, mappings));\r\n}\r\n\r\nfunction getHPChangeEffect(token, effects) {\r\n const internals = token.actor?.getFlag('token-variants', 'internalEffects') || {};\r\n const delta = getProperty(\r\n token,\r\n `${isNewerVersion('11', game.version) ? 'actorData' : 'delta'}.flags.token-variants.internalEffects`\r\n );\r\n if (delta) mergeObject(internals, delta);\r\n if (internals['hp--'] != null) effects.push('hp--');\r\n if (internals['hp++'] != null) effects.push('hp++');\r\n}\r\n\r\nfunction applyHpChangeEffect(actor, change, tokens) {\r\n let duration = Number(TVA_CONFIG.internalEffects.hpChange.duration);\r\n\r\n const newHpValue = getProperty(change, `system.${TVA_CONFIG.systemHpPath}.value`);\r\n if (newHpValue != null) {\r\n const [currentHpVal, _] = getTokenHP(tokens[0]);\r\n if (currentHpVal !== newHpValue) {\r\n if (currentHpVal < newHpValue) {\r\n setProperty(change, 'flags.token-variants.internalEffects.-=hp--', null);\r\n setProperty(change, 'flags.token-variants.internalEffects.hp++', newHpValue - currentHpVal);\r\n if (duration) {\r\n setTimeout(() => {\r\n actor.update({\r\n 'flags.token-variants.internalEffects.-=hp++': null,\r\n });\r\n }, duration * 1000);\r\n }\r\n } else {\r\n setProperty(change, 'flags.token-variants.internalEffects.-=hp++', null);\r\n setProperty(change, 'flags.token-variants.internalEffects.hp--', newHpValue - currentHpVal);\r\n if (duration) {\r\n setTimeout(() => {\r\n actor.update({\r\n 'flags.token-variants.internalEffects.-=hp--': null,\r\n });\r\n }, duration * 1000);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function getTokenEffects(token, includeExpressions = false) {\r\n const data = token.document ?? token;\r\n let effects = [];\r\n\r\n // TVA Effects\r\n const tokenInCombat = game.combats.some((combat) => {\r\n return combat.combatants.some((c) => c.tokenId === token.id);\r\n });\r\n if (tokenInCombat) {\r\n effects.push('token-variants-combat');\r\n }\r\n\r\n if (game.combat?.started) {\r\n if (game.combat?.combatant?.token?.id === token.id) {\r\n effects.push('combat-turn');\r\n } else if (game.combat?.nextCombatant?.token?.id === token.id) {\r\n effects.push('combat-turn-next');\r\n }\r\n }\r\n if (data.hidden) {\r\n effects.push('token-variants-visibility');\r\n }\r\n\r\n if (TVA_CONFIG.internalEffects.hpChange.enabled) {\r\n getHPChangeEffect(data, effects);\r\n }\r\n\r\n // Actor/Token effects\r\n if (data.actorLink) {\r\n getEffectsFromActor(token.actor, effects);\r\n } else {\r\n if (game.system.id === 'pf2e') {\r\n (data.delta?.items || []).forEach((item) => {\r\n if (_activePF2EItem(item)) {\r\n effects.push(item.name);\r\n }\r\n });\r\n } else {\r\n (data.effects || []).filter((ef) => !ef.disabled && !ef.isSuppressed).forEach((ef) => effects.push(ef.label));\r\n getEffectsFromActor(token.actor, effects);\r\n }\r\n }\r\n\r\n // Expression/Mapping effects\r\n evaluateComparatorEffects(token, effects);\r\n evaluateStateEffects(token, effects);\r\n\r\n // Include mappings marked as always applicable\r\n // as well as the ones defined as logical expressions if needed\r\n const mappings = getAllEffectMappings(token);\r\n\r\n for (const m of mappings) {\r\n if (m.tokens?.length && !m.tokens.includes(data.id)) continue;\r\n if (m.alwaysOn) effects.unshift(m.id);\r\n else if (includeExpressions) {\r\n const evaluation = evaluateMappingExpression(m, effects, token);\r\n if (evaluation) effects.unshift(m.id);\r\n }\r\n }\r\n\r\n return effects;\r\n}\r\n\r\nexport function getEffectsFromActor(actor, effects = []) {\r\n if (!actor) return effects;\r\n\r\n if (game.system.id === 'pf2e') {\r\n (actor.items || []).forEach((item, id) => {\r\n if (_activePF2EItem(item)) effects.push(item.name);\r\n });\r\n } else {\r\n (actor.effects || []).forEach((activeEffect, id) => {\r\n if (!activeEffect.disabled && !activeEffect.isSuppressed) effects.push(activeEffect.name ?? activeEffect.label);\r\n });\r\n (actor.items || []).forEach((item) => {\r\n if (ITEM_TYPES.includes(item.type) && item.system.equipped) effects.push(item.name ?? item.label);\r\n });\r\n }\r\n\r\n return effects;\r\n}\r\n\r\nfunction _activePF2EItem(item) {\r\n if (PF2E_ITEM_TYPES.includes(item.type)) {\r\n if ('active' in item) {\r\n return item.active;\r\n } else if ('isEquipped' in item) {\r\n return item.isEquipped;\r\n } else {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nexport const VALID_EXPRESSION = new RegExp('([a-zA-Z\\\\-\\\\.\\\\+]+)([><=]+)(\".*\"|-?\\\\d+)(%{0,1})');\r\n\r\nexport function evaluateComparator(token, expression) {\r\n const match = expression.match(VALID_EXPRESSION);\r\n if (match) {\r\n const property = match[1];\r\n\r\n let currVal;\r\n let maxVal;\r\n if (property === 'hp') {\r\n [currVal, maxVal] = getTokenHP(token);\r\n } else if (property === 'hp++' || property === 'hp--') {\r\n [currVal, maxVal] = getTokenHP(token);\r\n currVal = getProperty(token, `actor.flags.token-variants.internalEffects.${property}`) ?? 0;\r\n } else currVal = getProperty(token, property);\r\n if (currVal == null) currVal = 0;\r\n\r\n const sign = match[2];\r\n let val = Number(match[3]);\r\n if (isNaN(val)) {\r\n val = match[3].substring(1, match[3].length - 1);\r\n if (val === 'true') val = true;\r\n if (val === 'false') val = false;\r\n // Convert currVal to a truthy/falsy one if this is a bool check\r\n if (val === true || val === false) {\r\n if (isEmpty(currVal)) currVal = false;\r\n else currVal = Boolean(currVal);\r\n }\r\n }\r\n const isPercentage = Boolean(match[4]);\r\n\r\n if (property === 'rotation') {\r\n maxVal = 360;\r\n } else if (maxVal == null) {\r\n maxVal = 999999;\r\n }\r\n const toCompare = isPercentage ? (currVal / maxVal) * 100 : currVal;\r\n\r\n let passed = false;\r\n if (sign === '=') {\r\n passed = toCompare == val;\r\n } else if (sign === '>') {\r\n passed = toCompare > val;\r\n } else if (sign === '<') {\r\n passed = toCompare < val;\r\n } else if (sign === '>=') {\r\n passed = toCompare >= val;\r\n } else if (sign === '<=') {\r\n passed = toCompare <= val;\r\n } else if (sign === '<>') {\r\n passed = toCompare < val || toCompare > val;\r\n }\r\n return passed;\r\n }\r\n return false;\r\n}\r\n\r\nexport function evaluateComparatorEffects(token, effects = []) {\r\n token = token.document ?? token;\r\n\r\n const mappings = getAllEffectMappings(token);\r\n\r\n const matched = new Set();\r\n\r\n for (const m of mappings) {\r\n const expressions = m.expression\r\n .split(EXPRESSION_MATCH_RE)\r\n .filter(Boolean)\r\n .map((exp) => exp.trim())\r\n .filter(Boolean);\r\n for (let i = 0; i < expressions.length; i++) {\r\n if (evaluateComparator(token, expressions[i])) {\r\n matched.add(expressions[i]);\r\n }\r\n }\r\n }\r\n\r\n // Remove duplicate expressions and insert into effects\r\n matched.forEach((exp) => effects.unshift(exp));\r\n\r\n return effects;\r\n}\r\n\r\nexport function evaluateStateEffects(token, effects) {\r\n if (game.system.id === 'pf2e') {\r\n const deathIcon = game.settings.get('pf2e', 'deathIcon');\r\n if ((token.document ?? token).overlayEffect === deathIcon) effects.push('Dead');\r\n }\r\n}\r\n\r\n/**\r\n * Replaces {1,a,5,b} type string in the expressions with (1|a|5|b)\r\n * @param {*} exp\r\n * @returns\r\n */\r\nfunction _findReplaceBracketWildcard(exp) {\r\n let nExp = '';\r\n let lIndex = 0;\r\n while (lIndex >= 0) {\r\n let i1 = exp.indexOf('\\\\\\\\\\\\{', lIndex);\r\n if (i1 !== -1) {\r\n let i2 = exp.indexOf('\\\\\\\\\\\\}', i1);\r\n if (i2 !== -1) {\r\n nExp += exp.substring(lIndex, i1);\r\n nExp +=\r\n '(' +\r\n exp\r\n .substring(i1 + 4, i2)\r\n .split(',')\r\n .join('|') +\r\n ')';\r\n }\r\n lIndex = i2 + 4;\r\n } else {\r\n return nExp + exp.substring(lIndex, exp.length);\r\n }\r\n }\r\n return nExp ?? exp;\r\n}\r\n\r\nfunction _testRegExEffect(effect, effects) {\r\n let re = effect.replace(/[/\\-\\\\^$+?.()|[\\]{}]/g, '\\\\$&').replaceAll('\\\\\\\\*', '.*');\r\n re = _findReplaceBracketWildcard(re);\r\n re = new RegExp('^' + re + '$');\r\n return effects.find((ef) => re.test(ef));\r\n}\r\n\r\nexport function evaluateMappingExpression(mapping, effects, token, added = new Set(), removed = new Set()) {\r\n let arrExpression = mapping.expression\r\n .split(EXPRESSION_MATCH_RE)\r\n .filter(Boolean)\r\n .map((s) => s.trim())\r\n .filter(Boolean);\r\n\r\n let temp = '';\r\n let hasAdded = false;\r\n let hasRemoved = false;\r\n for (let exp of arrExpression) {\r\n if (EXPRESSION_OPERATORS.includes(exp)) {\r\n temp += exp.replace('\\\\', '');\r\n continue;\r\n }\r\n\r\n if (/\\\\\\*|\\\\{.*\\\\}/g.test(exp)) {\r\n let rExp = _testRegExEffect(exp, effects);\r\n if (rExp) {\r\n temp += 'true';\r\n } else {\r\n temp += 'false';\r\n }\r\n\r\n if (_testRegExEffect(exp, added)) hasAdded = true;\r\n else if (_testRegExEffect(exp, removed)) hasRemoved = true;\r\n continue;\r\n } else if (effects.includes(exp)) {\r\n temp += 'true';\r\n } else {\r\n temp += 'false';\r\n }\r\n\r\n if (!hasAdded && added.has(exp)) hasAdded = true;\r\n if (!hasRemoved && removed.has(exp)) hasRemoved = true;\r\n }\r\n\r\n try {\r\n let evaluation = eval(temp);\r\n\r\n // Evaluate JS code\r\n if (mapping.codeExp) {\r\n try {\r\n token = token.document ?? token;\r\n if (!eval(mapping.codeExp)) evaluation = false;\r\n else if (!mapping.expression) evaluation = true;\r\n } catch (e) {\r\n evaluation = false;\r\n }\r\n }\r\n\r\n if (evaluation) {\r\n if (hasAdded || hasRemoved) {\r\n added.add(mapping.id);\r\n effects.push(mapping.id);\r\n } else effects.unshift(mapping.id);\r\n } else if (hasRemoved || hasAdded) {\r\n removed.add(mapping.id);\r\n }\r\n return evaluation;\r\n } catch (e) {}\r\n return false;\r\n}\r\n\r\nfunction _getTokenHPv11(token) {\r\n let attributes;\r\n\r\n if (token.actorLink) {\r\n attributes = getProperty(token.actor?.system, TVA_CONFIG.systemHpPath);\r\n } else {\r\n attributes = mergeObject(\r\n getProperty(token.actor?.system, TVA_CONFIG.systemHpPath) || {},\r\n getProperty(token.delta?.system) || {},\r\n {\r\n inplace: false,\r\n }\r\n );\r\n }\r\n\r\n return [attributes?.value, attributes?.max];\r\n}\r\n\r\nexport function getTokenHP(token) {\r\n if (!isNewerVersion('11', game.version)) return _getTokenHPv11(token);\r\n\r\n let attributes;\r\n\r\n if (token.actorLink) {\r\n attributes = getProperty(token.actor.system, TVA_CONFIG.systemHpPath);\r\n } else {\r\n attributes = mergeObject(\r\n getProperty(token.actor.system, TVA_CONFIG.systemHpPath) || {},\r\n getProperty(token.actorData?.system) || {},\r\n {\r\n inplace: false,\r\n }\r\n );\r\n }\r\n return [attributes?.value, attributes?.max];\r\n}\r\n\r\nasync function _updateImageOnEffectChange(effectName, actor, added = true) {\r\n const tokens = actor.token ? [actor.token] : getAllActorTokens(actor, true, !TVA_CONFIG.mappingsCurrentSceneOnly);\r\n for (const token of tokens) {\r\n await updateWithEffectMapping(token, {\r\n added: added ? [effectName] : [],\r\n removed: !added ? [effectName] : [],\r\n });\r\n }\r\n}\r\n\r\nasync function _updateImageOnMultiEffectChange(actor, added = [], removed = []) {\r\n if (!actor) return;\r\n const tokens = actor.token ? [actor.token] : getAllActorTokens(actor, true, !TVA_CONFIG.mappingsCurrentSceneOnly);\r\n for (const token of tokens) {\r\n await updateWithEffectMapping(token, {\r\n added: added,\r\n removed: removed,\r\n });\r\n }\r\n}\r\n\r\nasync function _deleteCombatant(combatant) {\r\n const token = combatant._token || canvas.tokens.get(combatant.tokenId);\r\n if (!token || !token.actor) return;\r\n await updateWithEffectMapping(token, {\r\n removed: ['token-variants-combat'],\r\n });\r\n}\r\n","import { BASE_IMAGE_CATEGORIES, userRequiresImageCache, waitForTokenTexture } from './utils.js';\r\nimport { ForgeSearchPaths } from '../applications/forgeSearchPaths.js';\r\nimport TokenHUDClientSettings from '../applications/tokenHUDClientSettings.js';\r\nimport CompendiumMapConfig from '../applications/compendiumMap.js';\r\nimport ImportExport from '../applications/importExport.js';\r\nimport ConfigureSettings from '../applications/configureSettings.js';\r\nimport { cacheImages, saveCache } from './search.js';\r\nimport { registerAllHooks } from './hooks/hooks.js';\r\nimport { registerAllWrappers } from './wrappers/wrappers.js';\r\n\r\nexport const TVA_CONFIG = {\r\n debug: false,\r\n disableNotifs: false,\r\n searchPaths: [\r\n {\r\n text: 'modules/caeora-maps-tokens-assets/assets/tokens',\r\n cache: true,\r\n source: typeof ForgeAPI === 'undefined' ? 'data' : 'forge-bazaar',\r\n types: ['Portrait', 'Token', 'PortraitAndToken'],\r\n },\r\n ],\r\n forgeSearchPaths: {},\r\n worldHud: {\r\n displayOnlySharedImages: false,\r\n disableIfTHWEnabled: false,\r\n includeKeywords: false,\r\n updateActorImage: false,\r\n useNameSimilarity: false,\r\n includeWildcard: true,\r\n showFullPath: false,\r\n animate: true,\r\n },\r\n hud: {\r\n enableSideMenu: true,\r\n displayAsImage: true,\r\n imageOpacity: 50,\r\n },\r\n keywordSearch: true,\r\n excludedKeywords: 'and,for',\r\n runSearchOnPath: false,\r\n searchFilters: {},\r\n algorithm: {\r\n exact: false,\r\n fuzzy: true,\r\n fuzzyLimit: 100,\r\n fuzzyThreshold: 0.3,\r\n fuzzyArtSelectPercentSlider: true,\r\n },\r\n tokenConfigs: [],\r\n randomizer: {\r\n actorCreate: false,\r\n tokenCreate: false,\r\n tokenCopyPaste: false,\r\n tokenName: true,\r\n keywords: false,\r\n shared: false,\r\n wildcard: false,\r\n representedActorDisable: false,\r\n linkedActorDisable: true,\r\n popupOnDisable: false,\r\n diffImages: false,\r\n syncImages: false,\r\n },\r\n popup: {\r\n disableAutoPopupOnActorCreate: true,\r\n disableAutoPopupOnTokenCreate: true,\r\n disableAutoPopupOnTokenCopyPaste: true,\r\n twoPopups: false,\r\n twoPopupsNoDialog: false,\r\n },\r\n imgurClientId: '',\r\n stackStatusConfig: true,\r\n mergeGroup: false,\r\n staticCache: false,\r\n staticCacheFile: 'modules/token-variants/token-variants-cache.json',\r\n tilesEnabled: true,\r\n compendiumMapper: {\r\n missingOnly: false,\r\n diffImages: false,\r\n showImages: true,\r\n cache: false,\r\n autoDisplayArtSelect: true,\r\n syncImages: false,\r\n overrideCategory: false,\r\n category: 'Token',\r\n missingImages: [{ document: 'all', image: CONST.DEFAULT_TOKEN }],\r\n searchOptions: {},\r\n },\r\n permissions: {\r\n popups: {\r\n 1: false,\r\n 2: false,\r\n 3: true,\r\n 4: true,\r\n },\r\n portrait_right_click: {\r\n 1: false,\r\n 2: false,\r\n 3: true,\r\n 4: true,\r\n },\r\n image_path_button: {\r\n 1: false,\r\n 2: false,\r\n 3: true,\r\n 4: true,\r\n },\r\n hud: {\r\n 1: true,\r\n 2: true,\r\n 3: true,\r\n 4: true,\r\n },\r\n hudFullAccess: {\r\n 1: false,\r\n 2: false,\r\n 3: true,\r\n 4: true,\r\n },\r\n statusConfig: {\r\n 1: false,\r\n 2: false,\r\n 3: true,\r\n 4: true,\r\n },\r\n },\r\n globalMappings: [],\r\n templateMappings: [],\r\n customImageCategories: [],\r\n displayEffectIconsOnHover: false,\r\n disableEffectIcons: false,\r\n filterEffectIcons: false,\r\n filterCustomEffectIcons: true,\r\n filterIconList: [],\r\n updateTokenProto: false,\r\n imgNameContainsDimensions: false,\r\n imgNameContainsFADimensions: false,\r\n playVideoOnHover: true,\r\n pauseVideoOnHoverOut: false,\r\n disableImageChangeOnPolymorphed: false,\r\n disableImageUpdateOnNonPrototype: false,\r\n disableTokenUpdateAnimation: false,\r\n mappingsCurrentSceneOnly: false,\r\n invisibleImage: '',\r\n systemHpPath: '',\r\n internalEffects: {\r\n hpChange: { enabled: false, duration: null },\r\n },\r\n hideElevationTooltip: false,\r\n hideTokenBorder: false,\r\n};\r\n\r\nexport const FEATURE_CONTROL = {\r\n EffectMappings: true,\r\n EffectIcons: true,\r\n Overlays: true,\r\n UserMappings: true,\r\n Wildcards: true,\r\n PopUpAndRandomize: true,\r\n HUD: true,\r\n HideElement: true,\r\n};\r\n\r\nexport function registerSettings() {\r\n game.settings.register('token-variants', 'featureControl', {\r\n scope: 'world',\r\n config: false,\r\n type: Object,\r\n default: FEATURE_CONTROL,\r\n onChange: async (val) => {\r\n mergeObject(FEATURE_CONTROL, val);\r\n registerAllHooks();\r\n registerAllWrappers();\r\n },\r\n });\r\n mergeObject(FEATURE_CONTROL, game.settings.get('token-variants', 'featureControl'));\r\n\r\n game.settings.registerMenu('token-variants', 'settings', {\r\n name: 'Configure Settings',\r\n hint: 'Configure Token Variant Art settings',\r\n label: 'Settings',\r\n scope: 'world',\r\n icon: 'fas fa-cog',\r\n type: ConfigureSettings,\r\n restricted: true,\r\n });\r\n\r\n const systemHpPaths = {\r\n 'cyberpunk-red-core': 'derivedStats.hp',\r\n lfg: 'health',\r\n worldbuilding: 'health',\r\n twodsix: 'hits',\r\n };\r\n TVA_CONFIG.systemHpPath = systemHpPaths[game.system.id] ?? 'attributes.hp';\r\n\r\n game.settings.register('token-variants', 'effectMappingToggleGroups', {\r\n scope: 'world',\r\n config: false,\r\n type: Object,\r\n default: { Default: true },\r\n });\r\n\r\n game.settings.register('token-variants', 'settings', {\r\n scope: 'world',\r\n config: false,\r\n type: Object,\r\n default: TVA_CONFIG,\r\n onChange: async (val) => {\r\n // Generate a diff, it will be required when doing post-processing of the modified settings\r\n const diff = _arrayAwareDiffObject(TVA_CONFIG, val);\r\n\r\n // Check image re-cache required due to permission changes\r\n let requiresImageCache = false;\r\n if ('permissions' in diff) {\r\n if (\r\n !userRequiresImageCache(TVA_CONFIG.permissions) &&\r\n userRequiresImageCache(val.permissions)\r\n )\r\n requiresImageCache = true;\r\n }\r\n\r\n // Update live settings\r\n mergeObject(TVA_CONFIG, val);\r\n\r\n if (\r\n TVA_CONFIG.filterEffectIcons &&\r\n ('filterCustomEffectIcons' in diff || 'filterIconList' in diff)\r\n ) {\r\n for (const tkn of canvas.tokens.placeables) {\r\n waitForTokenTexture(tkn, (token) => {\r\n token.drawEffects();\r\n });\r\n }\r\n }\r\n\r\n // Check image re-cache required due to search path changes\r\n if ('searchPaths' in diff || 'forgeSearchPaths' in diff) {\r\n if (userRequiresImageCache(TVA_CONFIG.permissions)) requiresImageCache = true;\r\n }\r\n\r\n // Cache/re-cache images if necessary\r\n if (requiresImageCache) {\r\n await cacheImages();\r\n }\r\n\r\n if (diff.staticCache) {\r\n const cacheFile = diff.staticCacheFile ? diff.staticCacheFile : TVA_CONFIG.staticCacheFile;\r\n saveCache(cacheFile);\r\n }\r\n\r\n TVA_CONFIG.hud = game.settings.get('token-variants', 'hudSettings');\r\n\r\n registerAllHooks();\r\n registerAllWrappers();\r\n\r\n if ('displayEffectIconsOnHover' in diff) {\r\n for (const tkn of canvas.tokens.placeables) {\r\n if (tkn.effects) tkn.effects.visible = !diff.displayEffectIconsOnHover;\r\n }\r\n }\r\n\r\n if ('hideElevationTooltip' in diff) {\r\n for (const tkn of canvas.tokens.placeables) {\r\n if (tkn.tooltip) tkn.tooltip.text = tkn._getTooltipText();\r\n }\r\n }\r\n\r\n if ('hideTokenBorder' in diff) {\r\n for (const tkn of canvas.tokens.placeables) {\r\n if (tkn.border) tkn.border.visible = !diff.hideTokenBorder;\r\n }\r\n }\r\n\r\n if ('filterEffectIcons' in diff || 'disableEffectIcons' in diff) {\r\n for (const tkn of canvas.tokens.placeables) {\r\n tkn.drawEffects();\r\n }\r\n }\r\n },\r\n });\r\n\r\n game.settings.register('token-variants', 'debug', {\r\n scope: 'world',\r\n config: false,\r\n type: Boolean,\r\n default: TVA_CONFIG.debug,\r\n onChange: (val) => (TVA_CONFIG.debug = val),\r\n });\r\n\r\n if (typeof ForgeAPI !== 'undefined') {\r\n game.settings.registerMenu('token-variants', 'forgeSearchPaths', {\r\n name: game.i18n.localize('token-variants.settings.forge-search-paths.Name'),\r\n hint: game.i18n.localize('token-variants.settings.forge-search-paths.Hint'),\r\n icon: 'fas fa-search',\r\n type: ForgeSearchPaths,\r\n scope: 'client',\r\n restricted: false,\r\n });\r\n }\r\n\r\n game.settings.register('token-variants', 'tokenConfigs', {\r\n scope: 'world',\r\n config: false,\r\n type: Array,\r\n default: TVA_CONFIG.tokenConfigs,\r\n onChange: (val) => (TVA_CONFIG.tokenConfigs = val),\r\n });\r\n\r\n game.settings.registerMenu('token-variants', 'tokenHUDSettings', {\r\n name: game.i18n.localize('token-variants.settings.token-hud.Name'),\r\n hint: game.i18n.localize('token-variants.settings.token-hud.Hint'),\r\n scope: 'client',\r\n icon: 'fas fa-images',\r\n type: TokenHUDClientSettings,\r\n restricted: false,\r\n });\r\n\r\n game.settings.registerMenu('token-variants', 'compendiumMapper', {\r\n name: game.i18n.localize('token-variants.settings.compendium-mapper.Name'),\r\n hint: game.i18n.localize('token-variants.settings.compendium-mapper.Hint'),\r\n scope: 'world',\r\n icon: 'fas fa-cogs',\r\n type: CompendiumMapConfig,\r\n restricted: true,\r\n });\r\n\r\n game.settings.register('token-variants', 'compendiumMapper', {\r\n scope: 'world',\r\n config: false,\r\n type: Object,\r\n default: TVA_CONFIG.compendiumMapper,\r\n onChange: (val) => (TVA_CONFIG.compendiumMapper = val),\r\n });\r\n\r\n game.settings.register('token-variants', 'hudSettings', {\r\n scope: 'client',\r\n config: false,\r\n type: Object,\r\n default: TVA_CONFIG.hud,\r\n onChange: (val) => (TVA_CONFIG.hud = val),\r\n });\r\n\r\n game.settings.registerMenu('token-variants', 'importExport', {\r\n name: `Import/Export`,\r\n hint: game.i18n.localize('token-variants.settings.import-export.Hint'),\r\n scope: 'world',\r\n icon: 'fas fa-toolbox',\r\n type: ImportExport,\r\n restricted: true,\r\n });\r\n\r\n // Read settings\r\n const settings = game.settings.get('token-variants', 'settings');\r\n mergeObject(TVA_CONFIG, settings);\r\n\r\n if (isEmpty(TVA_CONFIG.searchFilters)) {\r\n BASE_IMAGE_CATEGORIES.forEach((cat) => {\r\n TVA_CONFIG.searchFilters[cat] = {\r\n include: '',\r\n exclude: '',\r\n regex: '',\r\n };\r\n });\r\n }\r\n\r\n for (let uid in TVA_CONFIG.forgeSearchPaths) {\r\n TVA_CONFIG.forgeSearchPaths[uid].paths = TVA_CONFIG.forgeSearchPaths[uid].paths.map((p) => {\r\n if (!p.source) {\r\n p.source = 'forgevtt';\r\n }\r\n if (!p.types) {\r\n if (p.tiles) p.types = ['Tile'];\r\n else p.types = ['Portrait', 'Token', 'PortraitAndToken'];\r\n }\r\n return p;\r\n });\r\n }\r\n\r\n // 20/07/2023 Convert globalMappings to a new format\r\n if (getType(settings.globalMappings) === 'Object') {\r\n Hooks.once('ready', () => {\r\n TVA_CONFIG.globalMappings = migrateMappings(settings.globalMappings);\r\n setTimeout(() => updateSettings({ globalMappings: TVA_CONFIG.globalMappings }), 10000);\r\n });\r\n }\r\n\r\n // Read client settings\r\n TVA_CONFIG.hud = game.settings.get('token-variants', 'hudSettings');\r\n}\r\n\r\nexport function migrateMappings(mappings, globalMappings = []) {\r\n if (!mappings) return [];\r\n if (getType(mappings) === 'Object') {\r\n let nMappings = [];\r\n for (const [effect, mapping] of Object.entries(mappings)) {\r\n if (!mapping.label) mapping.label = effect.replaceAll('¶', '.');\r\n if (!mapping.expression) mapping.expression = effect.replaceAll('¶', '.');\r\n if (!mapping.id) mapping.id = randomID(8);\r\n delete mapping.effect;\r\n if (mapping.overlayConfig) mapping.overlayConfig.id = mapping.id;\r\n delete mapping.overlayConfig?.effect;\r\n nMappings.push(mapping);\r\n }\r\n // Convert parents to parentIDs\r\n let combMappings = nMappings.concat(globalMappings);\r\n for (const mapping of nMappings) {\r\n if (mapping.overlayConfig?.parent) {\r\n if (mapping.overlayConfig.parent === 'Token (Placeable)') {\r\n mapping.overlayConfig.parentID = 'TOKEN';\r\n } else {\r\n const parent = combMappings.find((m) => m.label === mapping.overlayConfig.parent);\r\n if (parent) mapping.overlayConfig.parentID = parent.id;\r\n else mapping.overlayConfig.parentID = '';\r\n }\r\n delete mapping.overlayConfig.parent;\r\n }\r\n }\r\n return nMappings;\r\n }\r\n return mappings;\r\n}\r\n\r\nexport function getFlagMappings(object) {\r\n if (!object) return [];\r\n let doc = object.document ?? object;\r\n const actorId = doc.actor?.id;\r\n if (actorId) {\r\n doc = game.actors.get(actorId);\r\n if (!doc) return [];\r\n }\r\n\r\n // 23/07/2023\r\n let mappings = doc.getFlag('token-variants', 'effectMappings') ?? [];\r\n if (getType(mappings) === 'Object') {\r\n mappings = migrateMappings(mappings, TVA_CONFIG.globalMappings);\r\n doc.setFlag('token-variants', 'effectMappings', mappings);\r\n }\r\n return mappings;\r\n}\r\n\r\nexport function exportSettingsToJSON() {\r\n const settings = deepClone(TVA_CONFIG);\r\n const filename = `token-variants-settings.json`;\r\n saveDataToFile(JSON.stringify(settings, null, 2), 'text/json', filename);\r\n}\r\n\r\nexport async function importSettingsFromJSON(json) {\r\n if (typeof json === 'string') json = JSON.parse(json);\r\n\r\n if (json.forgeSearchPaths)\r\n for (let uid in json.forgeSearchPaths) {\r\n json.forgeSearchPaths[uid].paths = json.forgeSearchPaths[uid].paths.map((p) => {\r\n if (!p.source) {\r\n p.source = 'forgevtt';\r\n }\r\n if (!p.types) {\r\n if (p.tiles) p.types = ['Tile'];\r\n else p.types = ['Portrait', 'Token', 'PortraitAndToken'];\r\n }\r\n return p;\r\n });\r\n }\r\n\r\n // 09/07/2022 Convert filters to new format if old one is still in use\r\n if (json.searchFilters && json.searchFilters.portraitFilterInclude != null) {\r\n const filters = json.searchFilters;\r\n json.searchFilters = {\r\n Portrait: {\r\n include: filters.portraitFilterInclude ?? '',\r\n exclude: filters.portraitFilterExclude ?? '',\r\n regex: filters.portraitFilterRegex ?? '',\r\n },\r\n Token: {\r\n include: filters.tokenFilterInclude ?? '',\r\n exclude: filters.tokenFilterExclude ?? '',\r\n regex: filters.tokenFilterRegex ?? '',\r\n },\r\n PortraitAndToken: {\r\n include: filters.generalFilterInclude ?? '',\r\n exclude: filters.generalFilterExclude ?? '',\r\n regex: filters.generalFilterRegex ?? '',\r\n },\r\n };\r\n if (json.compendiumMapper) delete json.compendiumMapper.searchFilters;\r\n }\r\n\r\n // Global Mappings need special merge\r\n if (json.globalMappings) {\r\n const nMappings = migrateMappings(json.globalMappings);\r\n for (const m of nMappings) {\r\n const i = TVA_CONFIG.globalMappings.findIndex((mapping) => m.label === mapping.label);\r\n if (i === -1) TVA_CONFIG.globalMappings.push(m);\r\n else TVA_CONFIG.globalMappings[i] = m;\r\n }\r\n json.globalMappings = TVA_CONFIG.globalMappings;\r\n }\r\n\r\n updateSettings(json);\r\n}\r\n\r\nfunction _refreshFilters(filters, customCategories, updateTVAConfig = false) {\r\n const categories = BASE_IMAGE_CATEGORIES.concat(\r\n customCategories ?? TVA_CONFIG.customImageCategories\r\n );\r\n for (const filter in filters) {\r\n if (!categories.includes(filter)) {\r\n delete filters[filter];\r\n if (updateTVAConfig) delete TVA_CONFIG.searchFilters[filter];\r\n }\r\n }\r\n for (const category of customCategories) {\r\n if (filters[category] == null) {\r\n filters[category] = {\r\n include: '',\r\n exclude: '',\r\n regex: '',\r\n };\r\n }\r\n }\r\n}\r\n\r\nexport async function updateSettings(newSettings) {\r\n const settings = mergeObject(deepClone(TVA_CONFIG), newSettings, { insertKeys: false });\r\n // Custom image categories might have changed, meaning we may have filters that are no longer relevant\r\n // or need to be added\r\n if ('customImageCategories' in newSettings) {\r\n _refreshFilters(settings.searchFilters, newSettings.customImageCategories, true);\r\n if (settings.compendiumMapper?.searchOptions?.searchFilters != null) {\r\n _refreshFilters(\r\n settings.compendiumMapper.searchOptions.searchFilters,\r\n newSettings.customImageCategories\r\n );\r\n TVA_CONFIG.compendiumMapper.searchOptions.searchFilters =\r\n settings.compendiumMapper.searchOptions.searchFilters;\r\n }\r\n }\r\n await game.settings.set('token-variants', 'settings', settings);\r\n}\r\n\r\nexport function _arrayAwareDiffObject(original, other, { inner = false } = {}) {\r\n function _difference(v0, v1) {\r\n let t0 = getType(v0);\r\n let t1 = getType(v1);\r\n if (t0 !== t1) return [true, v1];\r\n if (t0 === 'Array') return [!_arrayEquality(v0, v1), v1];\r\n if (t0 === 'Object') {\r\n if (isEmpty(v0) !== isEmpty(v1)) return [true, v1];\r\n let d = _arrayAwareDiffObject(v0, v1, { inner });\r\n return [!isEmpty(d), d];\r\n }\r\n return [v0 !== v1, v1];\r\n }\r\n\r\n // Recursively call the _difference function\r\n return Object.keys(other).reduce((obj, key) => {\r\n if (inner && !(key in original)) return obj;\r\n let [isDifferent, difference] = _difference(original[key], other[key]);\r\n if (isDifferent) obj[key] = difference;\r\n return obj;\r\n }, {});\r\n}\r\n\r\nfunction _arrayEquality(a1, a2) {\r\n if (!(a2 instanceof Array) || a2.length !== a1.length) return false;\r\n return a1.every((v, i) => {\r\n if (getType(v) === 'Object') return Object.keys(_arrayAwareDiffObject(v, a2[i])).length === 0;\r\n return a2[i] === v;\r\n });\r\n}\r\n\r\nexport function getSearchOptions() {\r\n return {\r\n keywordSearch: TVA_CONFIG.keywordSearch,\r\n excludedKeywords: TVA_CONFIG.excludedKeywords,\r\n runSearchOnPath: TVA_CONFIG.runSearchOnPath,\r\n algorithm: TVA_CONFIG.algorithm,\r\n searchFilters: TVA_CONFIG.searchFilters,\r\n };\r\n}\r\n","import { TVA_CONFIG, updateSettings, _arrayAwareDiffObject } from './settings.js';\r\nimport { showArtSelect } from '../token-variants.mjs';\r\nimport EffectMappingForm from '../applications/effectMappingForm.js';\r\nimport CompendiumMapConfig from '../applications/compendiumMap.js';\r\nimport { toggleTemplateDialog } from '../applications/dialogs.js';\r\n\r\nconst simplifyRegex = new RegExp(/[^A-Za-z0-9/\\\\]/g);\r\n\r\nexport const SUPPORTED_COMP_ATTRIBUTES = ['rotation', 'elevation'];\r\nexport const EXPRESSION_OPERATORS = ['\\\\(', '\\\\)', '&&', '||', '\\\\!'];\r\n\r\n// Types of searches\r\nexport const SEARCH_TYPE = {\r\n PORTRAIT: 'Portrait',\r\n TOKEN: 'Token',\r\n PORTRAIT_AND_TOKEN: 'PortraitAndToken',\r\n TILE: 'Tile',\r\n ITEM: 'Item',\r\n JOURNAL: 'JournalEntry',\r\n MACRO: 'Macro',\r\n};\r\n\r\nexport const BASE_IMAGE_CATEGORIES = [\r\n 'Portrait',\r\n 'Token',\r\n 'PortraitAndToken',\r\n 'Tile',\r\n 'Item',\r\n 'JournalEntry',\r\n 'Macro',\r\n 'RollTable',\r\n];\r\n\r\nexport const PRESSED_KEYS = {\r\n popupOverride: false,\r\n config: false,\r\n};\r\n\r\nconst BATCH_UPDATES = {\r\n TOKEN: [],\r\n TOKEN_CALLBACKS: [],\r\n TOKEN_CONTEXT: { animate: true },\r\n ACTOR: [],\r\n ACTOR_CONTEXT: null,\r\n};\r\n\r\nexport function startBatchUpdater() {\r\n canvas.app.ticker.add(() => {\r\n if (BATCH_UPDATES.TOKEN.length) {\r\n canvas.scene.updateEmbeddedDocuments('Token', BATCH_UPDATES.TOKEN, BATCH_UPDATES.TOKEN_CONTEXT).then(() => {\r\n for (const cb of BATCH_UPDATES.TOKEN_CALLBACKS) {\r\n cb();\r\n }\r\n BATCH_UPDATES.TOKEN_CALLBACKS = [];\r\n });\r\n BATCH_UPDATES.TOKEN = [];\r\n }\r\n if (BATCH_UPDATES.ACTOR.length !== 0) {\r\n if (BATCH_UPDATES.ACTOR_CONTEXT) Actor.updateDocuments(BATCH_UPDATES.ACTOR, BATCH_UPDATES.ACTOR_CONTEXT);\r\n else Actor.updateDocuments(BATCH_UPDATES.ACTOR);\r\n BATCH_UPDATES.ACTOR = [];\r\n BATCH_UPDATES.ACTOR_CONTEXT = null;\r\n }\r\n });\r\n}\r\n\r\nexport function queueTokenUpdate(id, update, callback = null, animate = true) {\r\n update._id = id;\r\n BATCH_UPDATES.TOKEN.push(update);\r\n BATCH_UPDATES.TOKEN_CONTEXT = { animate };\r\n if (callback) BATCH_UPDATES.TOKEN_CALLBACKS.push(callback);\r\n}\r\n\r\nexport function queueActorUpdate(id, update, context = null) {\r\n update._id = id;\r\n BATCH_UPDATES.ACTOR.push(update);\r\n BATCH_UPDATES.ACTOR_CONTEXT = context;\r\n}\r\n\r\n/**\r\n * Updates Token and/or Proto Token with the new image and custom configuration if one exists.\r\n * @param {string} imgSrc Image source path/url\r\n * @param {object} [options={}] Update options\r\n * @param {Token[]} [options.token] Token to be updated with the new image\r\n * @param {Actor} [options.actor] Actor with Proto Token to be updated with the new image\r\n * @param {string} [options.imgName] Image name if it differs from the file name. Relevant for rolltable sourced images.\r\n * @param {object} [options.tokenUpdate] Token update to be merged and performed at the same time as image update\r\n * @param {object} [options.actorUpdate] Actor update to be merged and performed at the same time as image update\r\n * @param {string} [options.pack] Compendium pack of the Actor being updated\r\n * @param {func} [options.callback] Callback to be executed when a batch update has been performed\r\n * @param {object} [options.config] Token Configuration settings to be applied to the token\r\n */\r\nexport async function updateTokenImage(\r\n imgSrc,\r\n {\r\n token = null,\r\n actor = null,\r\n imgName = null,\r\n tokenUpdate = {},\r\n actorUpdate = {},\r\n pack = '',\r\n callback = null,\r\n config = undefined,\r\n animate = true,\r\n update = null,\r\n applyDefaultConfig = true,\r\n } = {}\r\n) {\r\n if (!(token || actor)) {\r\n console.warn(game.i18n.localize('token-variants.notifications.warn.update-image-no-token-actor'));\r\n return;\r\n }\r\n\r\n token = token?.document ?? token;\r\n\r\n // Check if it's a wildcard image\r\n if ((imgSrc && imgSrc.includes('*')) || (imgSrc.includes('{') && imgSrc.includes('}'))) {\r\n const images = await wildcardImageSearch(imgSrc);\r\n if (images.length) {\r\n imgSrc = images[Math.floor(Math.random() * images.length)];\r\n }\r\n }\r\n\r\n if (!actor && token.actor) {\r\n actor = game.actors.get(token.actor.id);\r\n }\r\n\r\n const getDefaultConfig = (token, actor) => {\r\n let configEntries = [];\r\n if (token) configEntries = token.getFlag('token-variants', 'defaultConfig') || [];\r\n else if (actor) {\r\n const tokenData = actor.prototypeToken;\r\n if ('token-variants' in tokenData.flags && 'defaultConfig' in tokenData['token-variants'])\r\n configEntries = tokenData['token-variants']['defaultConfig'];\r\n }\r\n return expandObject(Object.fromEntries(configEntries));\r\n };\r\n\r\n const constructDefaultConfig = (origData, customConfig) => {\r\n const flatOrigData = flattenObject(origData);\r\n TokenDataAdapter.dataToForm(flatOrigData);\r\n const flatCustomConfig = flattenObject(customConfig);\r\n let filtered = filterObject(flatOrigData, flatCustomConfig);\r\n\r\n // Flags need special treatment as once set they are not removed via absence of them in the update\r\n for (let [k, v] of Object.entries(flatCustomConfig)) {\r\n if (k.startsWith('flags.')) {\r\n if (!(k in flatOrigData)) {\r\n let splitK = k.split('.');\r\n splitK[splitK.length - 1] = '-=' + splitK[splitK.length - 1];\r\n filtered[splitK.join('.')] = null;\r\n }\r\n }\r\n }\r\n\r\n return Object.entries(filtered);\r\n };\r\n\r\n let tokenUpdateObj = tokenUpdate;\r\n if (imgSrc) {\r\n setProperty(tokenUpdateObj, 'texture.src', imgSrc);\r\n if (imgName && getFileName(imgSrc) === imgName) setProperty(tokenUpdateObj, 'flags.token-variants.-=name', null);\r\n else setProperty(tokenUpdateObj, 'flags.token-variants.name', imgName);\r\n }\r\n\r\n const tokenCustomConfig = mergeObject(\r\n getTokenConfigForUpdate(imgSrc || token?.texture.src, imgName, token),\r\n config ?? {}\r\n );\r\n const usingCustomConfig = token?.getFlag('token-variants', 'usingCustomConfig');\r\n const defaultConfig = getDefaultConfig(token);\r\n if (!isEmpty(tokenCustomConfig) || usingCustomConfig) {\r\n tokenUpdateObj = modMergeObject(tokenUpdateObj, defaultConfig);\r\n }\r\n\r\n if (!isEmpty(tokenCustomConfig)) {\r\n if (token) {\r\n setProperty(tokenUpdateObj, 'flags.token-variants.usingCustomConfig', true);\r\n let doc = token.document ?? token;\r\n const tokenData = doc.toObject ? doc.toObject() : deepClone(doc);\r\n\r\n const defConf = constructDefaultConfig(mergeObject(tokenData, defaultConfig), tokenCustomConfig);\r\n setProperty(tokenUpdateObj, 'flags.token-variants.defaultConfig', defConf);\r\n } else if (actor && !token) {\r\n setProperty(tokenUpdateObj, 'flags.token-variants.usingCustomConfig', true);\r\n const tokenData = actor.prototypeToken instanceof Object ? actor.prototypeToken : actor.prototypeToken.toObject();\r\n const defConf = constructDefaultConfig(tokenData, tokenCustomConfig);\r\n setProperty(tokenUpdateObj, 'flags.token-variants.defaultConfig', defConf);\r\n }\r\n\r\n // Fix, an empty flag may be passed which would overwrite any current flags in the updateObj\r\n // Remove it before doing the merge\r\n if (!tokenCustomConfig.flags) {\r\n delete tokenCustomConfig.flags;\r\n }\r\n\r\n tokenUpdateObj = modMergeObject(tokenUpdateObj, tokenCustomConfig);\r\n } else if (usingCustomConfig) {\r\n setProperty(tokenUpdateObj, 'flags.token-variants.-=usingCustomConfig', null);\r\n delete tokenUpdateObj?.flags?.['token-variants']?.defaultConfig;\r\n setProperty(tokenUpdateObj, 'flags.token-variants.-=defaultConfig', null);\r\n }\r\n\r\n if (!applyDefaultConfig) {\r\n setProperty(tokenUpdateObj, 'flags.token-variants.-=usingCustomConfig', null);\r\n delete tokenUpdateObj?.flags?.['token-variants']?.defaultConfig;\r\n setProperty(tokenUpdateObj, 'flags.token-variants.-=defaultConfig', null);\r\n }\r\n\r\n if (!isEmpty(tokenUpdateObj)) {\r\n if (actor && !token) {\r\n TokenDataAdapter.formToData(actor.prototypeToken, tokenUpdateObj);\r\n actorUpdate.token = tokenUpdateObj;\r\n if (pack) {\r\n queueActorUpdate(actor.id, actorUpdate, { pack: pack });\r\n } else {\r\n await (actor.document ?? actor).update(actorUpdate);\r\n }\r\n }\r\n\r\n if (token) {\r\n TokenDataAdapter.formToData(token, tokenUpdateObj);\r\n if (TVA_CONFIG.updateTokenProto && token.actor) {\r\n if (update) {\r\n mergeObject(update, { token: tokenUpdateObj });\r\n } else {\r\n // Timeout to prevent race conditions with other modules namely MidiQOL\r\n // this is a low priority update so it should be Ok to do\r\n if (token.actorLink) {\r\n setTimeout(() => queueActorUpdate(token.actor.id, { token: tokenUpdateObj }), 500);\r\n } else {\r\n setTimeout(() => token.actor.update({ token: tokenUpdateObj }), 500);\r\n }\r\n }\r\n }\r\n\r\n if (update) {\r\n mergeObject(update, tokenUpdateObj);\r\n } else {\r\n if (token.object) queueTokenUpdate(token.id, tokenUpdateObj, callback, animate);\r\n else {\r\n await token.update(tokenUpdateObj, { animate });\r\n callback();\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Assign new artwork to the actor\r\n */\r\nexport async function updateActorImage(actor, imgSrc, directUpdate = true, pack = '') {\r\n if (!actor) return;\r\n if (directUpdate) {\r\n await (actor.document ?? actor).update({\r\n img: imgSrc,\r\n });\r\n } else {\r\n queueActorUpdate(\r\n actor.id,\r\n {\r\n img: imgSrc,\r\n },\r\n pack ? { pack: pack } : null\r\n );\r\n }\r\n}\r\n\r\nasync function showTileArtSelect() {\r\n for (const tile of canvas.tiles.controlled) {\r\n const tileName = tile.document.getFlag('token-variants', 'tileName') || tile.id;\r\n showArtSelect(tileName, {\r\n callback: async function (imgSrc, name) {\r\n tile.document.update({ img: imgSrc });\r\n },\r\n searchType: SEARCH_TYPE.TILE,\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Checks if a key is pressed taking into account current game version.\r\n * @param {string} key v/Ctrl/Shift/Alt\r\n * @returns\r\n */\r\nexport function keyPressed(key) {\r\n if (key === 'v') return game.keyboard.downKeys.has('KeyV');\r\n return PRESSED_KEYS[key];\r\n}\r\n\r\nexport function registerKeybinds() {\r\n game.keybindings.register('token-variants', 'popupOverride', {\r\n name: 'Popup Override',\r\n hint: 'When held will trigger popups even when they are disabled.',\r\n editable: [\r\n {\r\n key: 'ShiftLeft',\r\n },\r\n ],\r\n onDown: () => {\r\n PRESSED_KEYS.popupOverride = true;\r\n },\r\n onUp: () => {\r\n PRESSED_KEYS.popupOverride = false;\r\n },\r\n restricted: false,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n game.keybindings.register('token-variants', 'config', {\r\n name: 'Config',\r\n hint: 'When held during a mouse Left-Click of an Image or an Active Affect will display a configuration window.',\r\n editable: [\r\n {\r\n key: 'ShiftLeft',\r\n },\r\n ],\r\n onDown: () => {\r\n PRESSED_KEYS.config = true;\r\n },\r\n onUp: () => {\r\n PRESSED_KEYS.config = false;\r\n },\r\n restricted: false,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n game.keybindings.register('token-variants', 'showArtSelectPortrait', {\r\n name: 'Show Art Select: Portrait',\r\n hint: 'Brings up an Art Select pop-up to change the portrait images of the selected tokens.',\r\n editable: [\r\n {\r\n key: 'Digit1',\r\n modifiers: ['Shift'],\r\n },\r\n ],\r\n onDown: () => {\r\n for (const token of canvas.tokens.controlled) {\r\n const actor = token.actor;\r\n if (!actor) continue;\r\n showArtSelect(actor.name, {\r\n callback: async function (imgSrc, name) {\r\n await updateActorImage(actor, imgSrc);\r\n },\r\n searchType: SEARCH_TYPE.PORTRAIT,\r\n object: actor,\r\n });\r\n }\r\n if (TVA_CONFIG.tilesEnabled && canvas.tokens.controlled.length === 0) showTileArtSelect();\r\n },\r\n restricted: true,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n game.keybindings.register('token-variants', 'showArtSelectToken', {\r\n name: 'Show Art Select: Token',\r\n hint: 'Brings up an Art Select pop-up to change the token images of the selected tokens.',\r\n editable: [\r\n {\r\n key: 'Digit2',\r\n modifiers: ['Shift'],\r\n },\r\n ],\r\n onDown: () => {\r\n for (const token of canvas.tokens.controlled) {\r\n showArtSelect(token.name, {\r\n callback: async function (imgSrc, imgName) {\r\n updateTokenImage(imgSrc, {\r\n actor: token.actor,\r\n imgName: imgName,\r\n token: token,\r\n });\r\n },\r\n searchType: SEARCH_TYPE.TOKEN,\r\n object: token,\r\n });\r\n }\r\n if (TVA_CONFIG.tilesEnabled && canvas.tokens.controlled.length === 0) showTileArtSelect();\r\n },\r\n restricted: true,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n game.keybindings.register('token-variants', 'showArtSelectGeneral', {\r\n name: 'Show Art Select: Portrait+Token',\r\n hint: 'Brings up an Art Select pop-up to change both Portrait and Token images of the selected tokens.',\r\n editable: [\r\n {\r\n key: 'Digit3',\r\n modifiers: ['Shift'],\r\n },\r\n ],\r\n onDown: () => {\r\n for (const token of canvas.tokens.controlled) {\r\n const actor = token.actor;\r\n showArtSelect(token.name, {\r\n callback: async function (imgSrc, imgName) {\r\n if (actor) await updateActorImage(actor, imgSrc);\r\n updateTokenImage(imgSrc, {\r\n actor: token.actor,\r\n imgName: imgName,\r\n token: token,\r\n });\r\n },\r\n searchType: SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n object: token,\r\n });\r\n }\r\n if (TVA_CONFIG.tilesEnabled && canvas.tokens.controlled.length === 0) showTileArtSelect();\r\n },\r\n restricted: true,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n game.keybindings.register('token-variants', 'openGlobalMappings', {\r\n name: 'Open Global Effect Configurations',\r\n hint: 'Brings up the settings window for Global Effect Configurations',\r\n editable: [\r\n {\r\n key: 'KeyG',\r\n modifiers: ['Shift'],\r\n },\r\n ],\r\n onDown: () => {\r\n const setting = game.settings.get('core', DefaultTokenConfig.SETTING);\r\n const data = new foundry.data.PrototypeToken(setting);\r\n const token = new TokenDocument(data, { actor: null });\r\n new EffectMappingForm(token, { globalMappings: true }).render(true);\r\n },\r\n restricted: true,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n\r\n game.keybindings.register('token-variants', 'compendiumMapper', {\r\n name: 'Compendium Mapper',\r\n hint: 'Opens Compendium Mapper',\r\n editable: [\r\n {\r\n key: 'KeyM',\r\n modifiers: ['Shift'],\r\n },\r\n ],\r\n onDown: () => {\r\n new CompendiumMapConfig().render(true);\r\n },\r\n restricted: true,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n\r\n game.keybindings.register('token-variants', 'toggleTemplate', {\r\n name: 'Toggle Template Dialog',\r\n hint: 'Brings up a dialog from which you can toggle templates on currently selected tokens.',\r\n editable: [],\r\n onDown: toggleTemplateDialog,\r\n restricted: true,\r\n precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL,\r\n });\r\n}\r\n\r\n/**\r\n * Retrieves a custom token configuration if one exists for the given image\r\n */\r\nexport function getTokenConfig(imgSrc, imgName) {\r\n if (!imgName) imgName = getFileName(imgSrc);\r\n const tokenConfigs = (TVA_CONFIG.tokenConfigs || []).flat();\r\n return tokenConfigs.find((config) => config.tvImgSrc == imgSrc && config.tvImgName == imgName) ?? {};\r\n}\r\n\r\n/**\r\n * Retrieves a custom token configuration if one exists for the given image and removes control keys\r\n * returning a clean config that can be used in token update.\r\n */\r\nexport function getTokenConfigForUpdate(imgSrc, imgName, token) {\r\n if (!imgSrc) return {};\r\n\r\n let tokenConfig = {};\r\n for (const path of TVA_CONFIG.searchPaths) {\r\n if (path.config && imgSrc.startsWith(path.text)) {\r\n mergeObject(tokenConfig, path.config);\r\n }\r\n }\r\n\r\n let imgConfig = getTokenConfig(imgSrc, imgName ?? getFileName(imgSrc));\r\n if (!isEmpty(imgConfig)) {\r\n imgConfig = deepClone(imgConfig);\r\n delete imgConfig.tvImgSrc;\r\n delete imgConfig.tvImgName;\r\n if (token) TokenDataAdapter.formToData(token, imgConfig);\r\n\r\n for (var key in imgConfig) {\r\n if (!key.startsWith('tvTab_')) {\r\n tokenConfig[key] = imgConfig[key];\r\n }\r\n }\r\n }\r\n\r\n if (TVA_CONFIG.imgNameContainsDimensions || TVA_CONFIG.imgNameContainsFADimensions) {\r\n extractDimensionsFromImgName(imgSrc, tokenConfig);\r\n }\r\n\r\n return tokenConfig;\r\n}\r\n\r\n/**\r\n * Adds or removes a custom token configuration\r\n */\r\nexport function setTokenConfig(imgSrc, imgName, tokenConfig) {\r\n const tokenConfigs = (TVA_CONFIG.tokenConfigs || []).flat();\r\n const tcIndex = tokenConfigs.findIndex((config) => config.tvImgSrc == imgSrc && config.tvImgName == imgName);\r\n\r\n let deleteConfig = !tokenConfig || Object.keys(tokenConfig).length === 0;\r\n if (!deleteConfig) {\r\n tokenConfig['tvImgSrc'] = imgSrc;\r\n tokenConfig['tvImgName'] = imgName;\r\n }\r\n\r\n if (tcIndex != -1 && !deleteConfig) {\r\n tokenConfigs[tcIndex] = tokenConfig;\r\n } else if (tcIndex != -1 && deleteConfig) {\r\n tokenConfigs.splice(tcIndex, 1);\r\n } else if (!deleteConfig) {\r\n tokenConfigs.push(tokenConfig);\r\n }\r\n updateSettings({ tokenConfigs: tokenConfigs });\r\n return !deleteConfig;\r\n}\r\n\r\n/**\r\n * Extracts the file name from the given path.\r\n */\r\nexport function getFileName(path) {\r\n if (!path) return '';\r\n return decodeURISafely(path).split('\\\\').pop().split('/').pop().split('.').slice(0, -1).join('.');\r\n}\r\n\r\n/**\r\n * Extracts the file name including the extension from the given path.\r\n */\r\nexport function getFileNameWithExt(path) {\r\n if (!path) return '';\r\n return decodeURISafely(path).split('\\\\').pop().split('/').pop();\r\n}\r\n\r\n/**\r\n * Extract the directory path excluding the file name.\r\n */\r\nexport function getFilePath(path) {\r\n return decodeURISafely(path).match(/(.*)[\\/\\\\]/)[1] || '';\r\n}\r\n\r\n/**\r\n * Simplify name.\r\n */\r\nexport function simplifyName(name) {\r\n return name.replace(simplifyRegex, '').toLowerCase();\r\n}\r\n\r\nexport function simplifyPath(path) {\r\n return decodeURIComponentSafely(path).replace(simplifyRegex, '').toLowerCase();\r\n}\r\n\r\n/**\r\n * Parses the 'excludedKeyword' setting (a comma separated string) into a Set\r\n */\r\nexport function parseKeywords(keywords) {\r\n return keywords\r\n .split(/\\W/)\r\n .map((word) => simplifyName(word))\r\n .filter((word) => word != '');\r\n}\r\n\r\n/**\r\n * Returns true of provided path points to an image\r\n */\r\nexport function isImage(path) {\r\n var extension = path.split('.');\r\n extension = extension[extension.length - 1].toLowerCase();\r\n return ['jpg', 'jpeg', 'png', 'svg', 'webp', 'gif'].includes(extension);\r\n}\r\n\r\n/**\r\n * Returns true of provided path points to a video\r\n */\r\nexport function isVideo(path) {\r\n var extension = path.split('.');\r\n extension = extension[extension.length - 1].toLowerCase();\r\n return ['mp4', 'ogg', 'webm', 'm4v'].includes(extension);\r\n}\r\n\r\n/**\r\n * Send a recursive HTTP asset browse request to ForgeVTT\r\n * @param {string} path Asset Library path\r\n * @param {string} apiKey Key with read access to the Asset Library\r\n * @returns\r\n */\r\nexport async function callForgeVTT(path, apiKey) {\r\n return new Promise(async (resolve, reject) => {\r\n if (typeof ForgeVTT === 'undefined' || !ForgeVTT.usingTheForge) return resolve({});\r\n\r\n const url = `${ForgeVTT.FORGE_URL}/api/assets/browse`;\r\n const xhr = new XMLHttpRequest();\r\n xhr.withCredentials = true;\r\n xhr.open('POST', url);\r\n xhr.setRequestHeader('Access-Key', apiKey);\r\n xhr.setRequestHeader('X-XSRF-TOKEN', await ForgeAPI.getXSRFToken());\r\n xhr.responseType = 'json';\r\n\r\n xhr.onreadystatechange = () => {\r\n if (xhr.readyState !== 4) return;\r\n resolve(xhr.response);\r\n };\r\n xhr.onerror = (err) => {\r\n resolve({ code: 500, error: err.message });\r\n };\r\n let formData = {\r\n path: path,\r\n options: {\r\n recursive: true,\r\n },\r\n };\r\n formData = JSON.stringify(formData);\r\n xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');\r\n xhr.send(formData);\r\n });\r\n}\r\n\r\n/**\r\n * Retrieves filters based on the type of search.\r\n * @param {SEARCH_TYPE} searchType\r\n */\r\nexport function getFilters(searchType, filters) {\r\n // Select filters based on type of search\r\n filters = filters ? filters : TVA_CONFIG.searchFilters;\r\n\r\n if (filters[searchType]) {\r\n filters = filters[searchType];\r\n } else {\r\n filters = {\r\n include: '',\r\n exclude: '',\r\n regex: '',\r\n };\r\n }\r\n\r\n if (filters.regex) filters.regex = new RegExp(filters.regex);\r\n return filters;\r\n}\r\n\r\nexport function userRequiresImageCache(perm) {\r\n const permissions = perm ? perm : TVA_CONFIG.permissions;\r\n const role = game.user.role;\r\n return (\r\n permissions.popups[role] ||\r\n permissions.portrait_right_click[role] ||\r\n permissions.image_path_button[role] ||\r\n permissions.hudFullAccess[role]\r\n );\r\n}\r\n\r\nexport async function waitForTokenTexture(token, callback, checks = 40) {\r\n // v10/v9 compatibility\r\n\r\n if (!token.mesh || !token.mesh.texture) {\r\n checks--;\r\n if (checks > 1)\r\n new Promise((resolve) => setTimeout(resolve, 1)).then(() => waitForTokenTexture(token, callback, checks));\r\n return;\r\n }\r\n\r\n callback(token);\r\n}\r\n\r\nexport function flattenSearchResults(results) {\r\n let flattened = [];\r\n if (!results) return flattened;\r\n results.forEach((images) => {\r\n flattened = flattened.concat(images);\r\n });\r\n return flattened;\r\n}\r\n\r\n// Slightly modified version of mergeObject; added an option to ignore -= keys\r\nexport function modMergeObject(\r\n original,\r\n other = {},\r\n {\r\n insertKeys = true,\r\n insertValues = true,\r\n overwrite = true,\r\n recursive = true,\r\n inplace = true,\r\n enforceTypes = false,\r\n } = {},\r\n _d = 0\r\n) {\r\n other = other || {};\r\n if (!(original instanceof Object) || !(other instanceof Object)) {\r\n throw new Error('One of original or other are not Objects!');\r\n }\r\n const options = {\r\n insertKeys,\r\n insertValues,\r\n overwrite,\r\n recursive,\r\n inplace,\r\n enforceTypes,\r\n };\r\n\r\n // Special handling at depth 0\r\n if (_d === 0) {\r\n if (!inplace) original = deepClone(original);\r\n if (Object.keys(original).some((k) => /\\./.test(k))) original = expandObject(original);\r\n if (Object.keys(other).some((k) => /\\./.test(k))) other = expandObject(other);\r\n }\r\n\r\n // Iterate over the other object\r\n for (let k of Object.keys(other)) {\r\n const v = other[k];\r\n if (original.hasOwnProperty('-=' + k)) {\r\n original[k] = original['-=' + k];\r\n delete original['-=' + k];\r\n }\r\n if (original.hasOwnProperty(k)) _modMergeUpdate(original, k, v, options, _d + 1);\r\n else _modMergeInsert(original, k, v, options, _d + 1);\r\n }\r\n return original;\r\n}\r\n\r\n/**\r\n * A helper function for merging objects when the target key does not exist in the original\r\n * @private\r\n */\r\nfunction _modMergeInsert(original, k, v, { insertKeys, insertValues } = {}, _d) {\r\n // Recursively create simple objects\r\n if (v?.constructor === Object) {\r\n original[k] = modMergeObject({}, v, {\r\n insertKeys: true,\r\n inplace: true,\r\n });\r\n return;\r\n }\r\n\r\n // Delete a key\r\n // if (k.startsWith('-=')) {\r\n // delete original[k.slice(2)];\r\n // return;\r\n // }\r\n\r\n // Insert a key\r\n const canInsert = (_d <= 1 && insertKeys) || (_d > 1 && insertValues);\r\n if (canInsert) original[k] = v;\r\n}\r\n\r\n/**\r\n * A helper function for merging objects when the target key exists in the original\r\n * @private\r\n */\r\nfunction _modMergeUpdate(original, k, v, { insertKeys, insertValues, enforceTypes, overwrite, recursive } = {}, _d) {\r\n const x = original[k];\r\n const tv = getType(v);\r\n const tx = getType(x);\r\n\r\n // Recursively merge an inner object\r\n if (tv === 'Object' && tx === 'Object' && recursive) {\r\n return modMergeObject(\r\n x,\r\n v,\r\n {\r\n insertKeys: insertKeys,\r\n insertValues: insertValues,\r\n overwrite: overwrite,\r\n inplace: true,\r\n enforceTypes: enforceTypes,\r\n },\r\n _d\r\n );\r\n }\r\n\r\n // Overwrite an existing value\r\n if (overwrite) {\r\n if (tx !== 'undefined' && tv !== tx && enforceTypes) {\r\n throw new Error(`Mismatched data types encountered during object merge.`);\r\n }\r\n original[k] = v;\r\n }\r\n}\r\n\r\nexport async function tv_executeScript(script, { actor, token, tvaUpdate } = {}) {\r\n // Add variables to the evaluation scope\r\n const speaker = ChatMessage.getSpeaker();\r\n const character = game.user.character;\r\n\r\n token = token?.object || token || (canvas.ready ? canvas.tokens.get(speaker.token) : null);\r\n actor = actor || token?.actor || game.actors.get(speaker.actor);\r\n\r\n // Attempt script execution\r\n const AsyncFunction = async function () {}.constructor;\r\n try {\r\n const fn = AsyncFunction('speaker', 'actor', 'token', 'character', 'tvaUpdate', `${script}`);\r\n await fn.call(null, speaker, actor, token, character, tvaUpdate);\r\n } catch (err) {\r\n ui.notifications.error(`There was an error in your script syntax. See the console (F12) for details`);\r\n console.error(err);\r\n }\r\n}\r\n\r\nexport async function executeMacro(macroName, token) {\r\n token = token?.object || token;\r\n game.macros.find((m) => m.name === macroName)?.execute({ token });\r\n}\r\n\r\nexport async function applyTMFXPreset(token, presetName, action = 'apply') {\r\n token = token.object ?? token;\r\n if (game.modules.get('tokenmagic')?.active && token.document) {\r\n const preset = TokenMagic.getPreset(presetName);\r\n if (preset) {\r\n if (action === 'apply') {\r\n await TokenMagic.addUpdateFilters(token, preset);\r\n } else if (action === 'remove') {\r\n await TokenMagic.deleteFilters(token, presetName);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport async function toggleTMFXPreset(token, presetName) {\r\n token = token.object ?? token;\r\n if (game.modules.get('tokenmagic')?.active && token.document) {\r\n if (TokenMagic.hasFilterId(token, presetName)) {\r\n applyTMFXPreset(token, presetName, 'remove');\r\n } else {\r\n applyTMFXPreset(token, presetName, 'apply');\r\n }\r\n }\r\n}\r\n\r\nexport async function applyCEEffect(tokenDoc, ceEffect, action = 'apply') {\r\n if (game.modules.get('dfreds-convenient-effects')?.active) {\r\n if (!ceEffect.apply && !ceEffect.remove) return;\r\n else if (!ceEffect.apply || !ceEffect.remove) {\r\n if (action === 'apply') {\r\n if (ceEffect.remove) action = 'remove';\r\n } else return;\r\n }\r\n\r\n let uuid = tokenDoc.actor?.uuid;\r\n if (uuid) {\r\n if (action === 'apply') {\r\n await game.dfreds.effectInterface.addEffect({\r\n effectName: ceEffect.name,\r\n uuid,\r\n origin: 'token-variants',\r\n overlay: false,\r\n });\r\n } else {\r\n await game.dfreds.effectInterface.removeEffect({ effectName: ceEffect.name, uuid });\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport async function toggleCEEffect(token, effectName) {\r\n if (game.modules.get('dfreds-convenient-effects')?.active) {\r\n let uuid = (token.document ?? token).actor?.uuid;\r\n await game.dfreds.effectInterface.toggleEffect(effectName, {\r\n uuids: [uuid],\r\n overlay: false,\r\n });\r\n }\r\n}\r\n\r\nexport class TokenDataAdapter {\r\n static dataToForm(data) {\r\n if ('texture.scaleX' in data) {\r\n data.scale = Math.abs(data['texture.scaleX']);\r\n data.mirrorX = data['texture.scaleX'] < 0;\r\n }\r\n if ('texture.scaleY' in data) {\r\n data.scale = Math.abs(data['texture.scaleY']);\r\n data.mirrorY = data['texture.scaleY'] < 0;\r\n }\r\n }\r\n\r\n static formToData(token, formData) {\r\n // Scale/mirroring\r\n if ('scale' in formData || 'mirrorX' in formData || 'mirrorY' in formData) {\r\n const doc = token.document ? token.document : token;\r\n if (!('scale' in formData)) formData.scale = Math.abs(doc.texture.scaleX);\r\n if (!('mirrorX' in formData)) formData.mirrorX = doc.texture.scaleX < 0;\r\n if (!('mirrorY' in formData)) formData.mirrorY = doc.texture.scaleY < 0;\r\n setProperty(formData, 'texture.scaleX', formData.scale * (formData.mirrorX ? -1 : 1));\r\n setProperty(formData, 'texture.scaleY', formData.scale * (formData.mirrorY ? -1 : 1));\r\n ['scale', 'mirrorX', 'mirrorY'].forEach((k) => delete formData[k]);\r\n }\r\n }\r\n}\r\n\r\nexport function determineAddedRemovedEffects(addedEffects, removedEffects, newEffects, oldEffects) {\r\n for (const ef of newEffects) {\r\n if (!oldEffects.includes(ef)) {\r\n addedEffects.push(ef);\r\n }\r\n }\r\n for (const ef of oldEffects) {\r\n if (!newEffects.includes(ef)) {\r\n removedEffects.push(ef);\r\n }\r\n }\r\n}\r\n\r\nexport async function wildcardImageSearch(imgSrc) {\r\n let source = 'data';\r\n const browseOptions = { wildcard: true };\r\n\r\n // Support non-user sources\r\n if (/\\.s3\\./.test(imgSrc)) {\r\n source = 's3';\r\n const { bucket, keyPrefix } = FilePicker.parseS3URL(imgSrc);\r\n if (bucket) {\r\n browseOptions.bucket = bucket;\r\n imgSrc = keyPrefix;\r\n }\r\n } else if (imgSrc.startsWith('icons/')) source = 'public';\r\n\r\n // Retrieve wildcard content\r\n try {\r\n const content = await FilePicker.browse(source, imgSrc, browseOptions);\r\n return content.files;\r\n } catch (err) {}\r\n return [];\r\n}\r\n\r\n/**\r\n * Returns a random name generated using Name Forge module\r\n * @param {*} randomizerSettings\r\n * @returns\r\n */\r\nexport async function nameForgeRandomize(randomizerSettings) {\r\n const nameForgeSettings = randomizerSettings.nameForge;\r\n if (nameForgeSettings?.randomize && nameForgeSettings?.models) {\r\n const nameForge = game.modules.get('nameforge');\r\n if (nameForge?.active) {\r\n const randomNames = [];\r\n for (const modelKey of nameForgeSettings.models) {\r\n const modelProp = getProperty(nameForge.models, modelKey);\r\n if (modelProp) {\r\n const model = await nameForge.api.createModel(modelProp);\r\n if (model) {\r\n randomNames.push(nameForge.api.generateName(model)[0]);\r\n }\r\n }\r\n }\r\n return randomNames[Math.floor(Math.random() * randomNames.length)];\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Upload Token and associated overlays as a single image\r\n */\r\nexport async function uploadTokenImage(token, options) {\r\n let renderTexture = captureToken(token, options);\r\n if (renderTexture) {\r\n const b64 = canvas.app.renderer.extract.base64(renderTexture, 'image/webp', 1);\r\n let res = await fetch(b64);\r\n let blob = await res.blob();\r\n const filename = options.name + `.webp`;\r\n let file = new File([blob], filename, { type: 'image/webp' });\r\n await FilePicker.upload('data', options.path, file, {});\r\n }\r\n}\r\n\r\n/**\r\n * Modified version of 'dev7355608' captureCanvas function. Captures combined Token and Overlay image\r\n */\r\nfunction captureToken(token, { scale = 3, width = null, height = null } = {}) {\r\n if (!canvas.ready || !token) {\r\n return;\r\n }\r\n\r\n width = width ?? token.texture.width;\r\n height = height ?? token.texture.height;\r\n\r\n scale = scale * Math.min(width / token.texture.width, height / token.texture.height);\r\n\r\n const renderer = canvas.app.renderer;\r\n const viewPosition = { ...canvas.scene._viewPosition };\r\n\r\n renderer.resize(width ?? renderer.screen.width, height ?? renderer.screen.height);\r\n\r\n width = canvas.screenDimensions[0] = renderer.screen.width;\r\n height = canvas.screenDimensions[1] = renderer.screen.height;\r\n\r\n canvas.stage.position.set(width / 2, height / 2);\r\n\r\n canvas.pan({\r\n x: token.center.x,\r\n y: token.center.y,\r\n scale,\r\n });\r\n\r\n const renderTexture = PIXI.RenderTexture.create({\r\n width,\r\n height,\r\n resolution: token.texture.resolution,\r\n });\r\n\r\n const cacheParent = canvas.stage.enableTempParent();\r\n\r\n canvas.stage.updateTransform();\r\n canvas.stage.disableTempParent(cacheParent);\r\n\r\n let spritesToRender = [token.mesh];\r\n if (token.tvaOverlays) spritesToRender = spritesToRender.concat(token.tvaOverlays);\r\n spritesToRender.sort((sprite) => sprite.sort);\r\n\r\n for (const sprite of spritesToRender) {\r\n renderer.render(sprite, { renderTexture, skipUpdateTransform: true, clear: false });\r\n }\r\n\r\n canvas._onResize();\r\n canvas.pan(viewPosition);\r\n\r\n return renderTexture;\r\n}\r\n\r\nexport function getAllActorTokens(actor, linked = false, document = false) {\r\n if (actor.isToken) {\r\n if (document) return [actor.token];\r\n else if (actor.token.object) return [actor.token.object];\r\n else return [];\r\n }\r\n\r\n const tokens = [];\r\n game.scenes.forEach((scene) =>\r\n scene.tokens.forEach((token) => {\r\n if (token.actorId === actor.id) {\r\n if (linked && token.actorLink) tokens.push(token);\r\n else if (!linked) tokens.push(token);\r\n }\r\n })\r\n );\r\n if (document) return tokens;\r\n else return tokens.map((token) => token.object).filter((token) => token);\r\n}\r\n\r\nexport function extractDimensionsFromImgName(img, dimensions = {}) {\r\n const name = getFileName(img);\r\n\r\n let scale;\r\n if (TVA_CONFIG.imgNameContainsDimensions) {\r\n const height = name.match(/_height(.*)_/)?.[1];\r\n if (height) dimensions.height = parseFloat(height);\r\n const width = name.match(/_width(.*)_/)?.[1];\r\n if (width) dimensions.width = parseFloat(width);\r\n scale = name.match(/_scale(.*)_/)?.[1];\r\n if (scale) scale = Math.max(parseFloat(scale), 0.2);\r\n }\r\n if (TVA_CONFIG.imgNameContainsFADimensions) {\r\n scale = name.match(/_Scale(\\d+)_/)?.[1];\r\n if (scale) {\r\n scale = Math.max(parseInt(scale) / 100, 0.2);\r\n }\r\n }\r\n if (scale) {\r\n dimensions['texture.scaleX'] = scale;\r\n dimensions['texture.scaleY'] = scale;\r\n }\r\n return dimensions;\r\n}\r\n\r\nexport function string2Hex(hexString) {\r\n return PIXI.utils.string2hex(hexString);\r\n}\r\n\r\nexport function decodeURISafely(uri) {\r\n try {\r\n return decodeURI(uri);\r\n } catch (e) {\r\n console.warn('URI Component not decodable: ' + uri);\r\n return uri;\r\n }\r\n}\r\n\r\nexport function decodeURIComponentSafely(uri) {\r\n try {\r\n return decodeURIComponent(uri);\r\n } catch (e) {\r\n console.warn('URI Component not decodable: ' + uri);\r\n return uri;\r\n }\r\n}\r\n\r\nexport function mergeMappings(from, to) {\r\n const changedIDs = {};\r\n\r\n for (const m of from) {\r\n const i = to.findIndex((mapping) => mapping.label === m.label && mapping.group === m.group);\r\n if (i === -1) to.push(m);\r\n else {\r\n changedIDs[to.id] = m.id;\r\n if (to[i].tokens?.length) {\r\n if (!m.tokens) m.tokens = [];\r\n to[i].tokens.forEach((id) => {\r\n if (!m.tokens.includes(id)) m.tokens.push(id);\r\n });\r\n }\r\n to[i] = m;\r\n }\r\n }\r\n\r\n // If parent's id has been changed we need to update all the children\r\n to.forEach((m) => {\r\n let pID = m.overlayConfig?.parentID;\r\n if (pID && pID in changedIDs) {\r\n m.overlayConfig.parentID = changedIDs[pID];\r\n }\r\n });\r\n\r\n return to;\r\n}\r\n","import { registerSettings, TVA_CONFIG, exportSettingsToJSON, updateSettings } from './scripts/settings.js';\r\nimport { ArtSelect, addToArtSelectQueue } from './applications/artSelect.js';\r\nimport {\r\n SEARCH_TYPE,\r\n registerKeybinds,\r\n updateTokenImage,\r\n startBatchUpdater,\r\n userRequiresImageCache,\r\n waitForTokenTexture,\r\n} from './scripts/utils.js';\r\nimport { FONT_LOADING, drawOverlays } from './scripts/token/overlay.js';\r\nimport {\r\n getTokenEffects,\r\n setOverlayVisibility,\r\n toggleTemplate,\r\n toggleTemplateOnSelected,\r\n updateWithEffectMapping,\r\n} from './scripts/hooks/effectMappingHooks.js';\r\nimport { cacheImages, doImageSearch, doRandomSearch, isCaching } from './scripts/search.js';\r\nimport { REGISTERED_HOOKS, registerAllHooks, registerHook } from './scripts/hooks/hooks.js';\r\nimport { REGISTERED_WRAPPERS, registerAllWrappers } from './scripts/wrappers/wrappers.js';\r\nimport {\r\n assignUserSpecificImage,\r\n assignUserSpecificImageToSelected,\r\n unassignUserSpecificImage,\r\n unassignUserSpecificImageFromSelected,\r\n} from './scripts/wrappers/userMappingWrappers.js';\r\nimport { toggleTemplateDialog } from './applications/dialogs.js';\r\n\r\n// Tracks if module has been initialized\r\nlet MODULE_INITIALIZED = false;\r\nexport function isInitialized() {\r\n return MODULE_INITIALIZED;\r\n}\r\nlet onInit = [];\r\n\r\n/**\r\n * Initialize the Token Variants module on Foundry VTT init\r\n */\r\nasync function initialize() {\r\n // Initialization should only be performed once\r\n if (MODULE_INITIALIZED) {\r\n return;\r\n }\r\n\r\n // Font Awesome need to be loaded manually on FireFox\r\n FONT_LOADING.loading = FontConfig.loadFont('fontAwesome', {\r\n editor: false,\r\n fonts: [{ urls: ['fonts/fontawesome/webfonts/fa-solid-900.ttf'] }],\r\n });\r\n\r\n // Want this to be executed once the module has initialized\r\n onInit.push(() => {\r\n // Need to wait for icons do be drawn first however I could not find a way\r\n // to wait until that has occurred. Instead we'll just wait for some static\r\n // amount of time.\r\n new Promise((resolve) => setTimeout(resolve, 500)).then(() => {\r\n for (const tkn of canvas.tokens.placeables) {\r\n drawOverlays(tkn); // Draw Overlays\r\n\r\n // Disable effect icons\r\n if (TVA_CONFIG.disableEffectIcons) {\r\n waitForTokenTexture(tkn, (token) => {\r\n token.effects.removeChildren().forEach((c) => c.destroy());\r\n token.effects.bg = token.effects.addChild(new PIXI.Graphics());\r\n token.effects.overlay = null;\r\n });\r\n } else if (TVA_CONFIG.filterEffectIcons) {\r\n waitForTokenTexture(tkn, (token) => {\r\n token.drawEffects();\r\n });\r\n }\r\n }\r\n });\r\n });\r\n\r\n if (userRequiresImageCache()) cacheImages();\r\n\r\n // Register ALL Hooks\r\n registerAllHooks();\r\n\r\n // Startup ticker that will periodically call 'updateEmbeddedDocuments' with all the accrued updates since the last tick\r\n startBatchUpdater();\r\n\r\n registerHook('Search', 'renderArtSelect', () => {\r\n ArtSelect.executing = false;\r\n });\r\n\r\n // Handle broadcasts\r\n game.socket?.on(`module.token-variants`, (message) => {\r\n if (message.handlerName === 'forgeSearchPaths' && message.type === 'UPDATE') {\r\n // Workaround for forgeSearchPaths setting to be updated by non-GM clients\r\n if (!game.user.isGM) return;\r\n const isResponsibleGM = !game.users\r\n .filter((user) => user.isGM && (user.active || user.isActive))\r\n .some((other) => other.id < game.user.id);\r\n if (!isResponsibleGM) return;\r\n updateSettings({ forgeSearchPaths: message.args });\r\n } else if (message.handlerName === 'drawOverlays' && message.type === 'UPDATE') {\r\n if (message.args.all) {\r\n if (canvas.scene.id !== message.args.sceneId) {\r\n for (const tkn of canvas.tokens.placeables) {\r\n drawOverlays(tkn);\r\n }\r\n }\r\n } else if (message.args.actorId) {\r\n const actor = game.actors.get(message.args.actorId);\r\n if (actor) actor.getActiveTokens(true)?.forEach((tkn) => drawOverlays(tkn));\r\n } else if (message.args.tokenId) {\r\n const tkn = canvas.tokens.get(message.args.tokenId);\r\n if (tkn) drawOverlays(tkn);\r\n }\r\n } else if (message.handlerName === 'effectMappings') {\r\n if (!game.user.isGM) return;\r\n const isResponsibleGM = !game.users\r\n .filter((user) => user.isGM && (user.active || user.isActive))\r\n .some((other) => other.id < game.user.id);\r\n if (!isResponsibleGM) return;\r\n const args = message.args;\r\n const token = game.scenes.get(args.sceneId)?.tokens.get(args.tokenId);\r\n if (token) updateWithEffectMapping(token, { added: args.added, removed: args.removed });\r\n }\r\n });\r\n\r\n MODULE_INITIALIZED = true;\r\n for (const cb of onInit) {\r\n cb();\r\n }\r\n onInit = [];\r\n}\r\n\r\n/**\r\n * Performs searches and displays the Art Select pop-up with the results\r\n * @param {string} search The text to be used as the search criteria\r\n * @param {object} [options={}] Options which customize the search\r\n * @param {Function[]} [options.callback] Function to be called with the user selected image path\r\n * @param {SEARCH_TYPE|string} [options.searchType] Controls filters applied to the search results\r\n * @param {Token|Actor} [options.object] Token/Actor used when displaying Custom Token Config prompt\r\n * @param {boolean} [options.force] If true will always override the current Art Select window if one exists instead of adding it to the queue\r\n * @param {object} [options.searchOptions] Override search and filter settings\r\n */\r\nexport async function showArtSelect(\r\n search,\r\n {\r\n callback = null,\r\n searchType = SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n object = null,\r\n force = false,\r\n preventClose = false,\r\n image1 = '',\r\n image2 = '',\r\n displayMode = ArtSelect.IMAGE_DISPLAY.NONE,\r\n multipleSelection = false,\r\n searchOptions = {},\r\n allImages = null,\r\n } = {}\r\n) {\r\n if (isCaching()) return;\r\n\r\n const artSelects = Object.values(ui.windows).filter((app) => app instanceof ArtSelect);\r\n if (ArtSelect.executing || (!force && artSelects.length !== 0)) {\r\n addToArtSelectQueue(search, {\r\n callback,\r\n searchType,\r\n object,\r\n preventClose,\r\n searchOptions,\r\n allImages,\r\n });\r\n return;\r\n }\r\n\r\n ArtSelect.executing = true;\r\n if (!allImages)\r\n allImages = await doImageSearch(search, {\r\n searchType: searchType,\r\n searchOptions: searchOptions,\r\n });\r\n\r\n new ArtSelect(search, {\r\n allImages: allImages,\r\n searchType: searchType,\r\n callback: callback,\r\n object: object,\r\n preventClose: preventClose,\r\n image1: image1,\r\n image2: image2,\r\n displayMode: displayMode,\r\n multipleSelection: multipleSelection,\r\n searchOptions: searchOptions,\r\n }).render(true);\r\n}\r\n\r\n// Initialize module\r\nregisterHook('main', 'ready', initialize, { once: true });\r\n\r\n// Register API and Keybinds\r\nregisterHook('main', 'init', function () {\r\n registerSettings();\r\n registerAllWrappers();\r\n\r\n registerKeybinds();\r\n\r\n const api = {\r\n cacheImages,\r\n doImageSearch,\r\n doRandomSearch,\r\n getTokenEffects,\r\n showArtSelect,\r\n updateTokenImage,\r\n exportSettingsToJSON,\r\n assignUserSpecificImage,\r\n assignUserSpecificImageToSelected,\r\n unassignUserSpecificImage,\r\n unassignUserSpecificImageFromSelected,\r\n setOverlayVisibility,\r\n toggleTemplateDialog,\r\n toggleTemplate,\r\n toggleTemplateOnSelected,\r\n TVA_CONFIG,\r\n };\r\n\r\n Object.defineProperty(api, 'hooks', {\r\n get() {\r\n return deepClone(REGISTERED_HOOKS);\r\n },\r\n configurable: true,\r\n });\r\n\r\n Object.defineProperty(api, 'wrappers', {\r\n get() {\r\n return deepClone(REGISTERED_WRAPPERS);\r\n },\r\n configurable: true,\r\n });\r\n\r\n game.modules.get('token-variants').api = api;\r\n});\r\n","import TokenCustomConfig from './tokenCustomConfig.js';\r\nimport { isVideo, isImage, keyPressed, SEARCH_TYPE, BASE_IMAGE_CATEGORIES, getFileName } from '../scripts/utils.js';\r\nimport { showArtSelect } from '../token-variants.mjs';\r\nimport { TVA_CONFIG, getSearchOptions } from '../scripts/settings.js';\r\n\r\nexport function addToArtSelectQueue(search, options) {\r\n ArtSelect.queue.push({\r\n search: search,\r\n options: options,\r\n });\r\n $('button#token-variant-art-clear-queue').html(`Clear Queue (${ArtSelect.queue.length})`).show();\r\n}\r\n\r\nexport function addToQueue(search, options) {\r\n ArtSelect.queue.push({\r\n search: search,\r\n options: options,\r\n });\r\n}\r\n\r\nexport function renderFromQueue(force = false) {\r\n if (!force) {\r\n const artSelects = Object.values(ui.windows).filter((app) => app instanceof ArtSelect);\r\n if (artSelects.length !== 0) {\r\n if (ArtSelect.queue.length !== 0)\r\n $('button#token-variant-art-clear-queue').html(`Clear Queue (${ArtSelect.queue.length})`).show();\r\n return;\r\n }\r\n }\r\n\r\n let callData = ArtSelect.queue.shift();\r\n if (callData?.options.execute) {\r\n callData.options.execute();\r\n callData = ArtSelect.queue.shift();\r\n }\r\n if (callData) {\r\n showArtSelect(callData.search, callData.options);\r\n }\r\n}\r\n\r\nfunction delay(fn, ms) {\r\n let timer = 0;\r\n return function (...args) {\r\n clearTimeout(timer);\r\n timer = setTimeout(fn.bind(this, ...args), ms || 0);\r\n };\r\n}\r\n\r\nexport class ArtSelect extends FormApplication {\r\n static queue = [];\r\n\r\n static instance = null;\r\n\r\n // showArtSelect(...) can take a while to fully execute and it is possible for it to be called\r\n // multiple times in very quick succession especially if copy pasting tokens or importing actors.\r\n // This variable set early in the function execution is used to queue additional requests rather\r\n // than continue execution\r\n static executing = false;\r\n\r\n static IMAGE_DISPLAY = {\r\n NONE: 0,\r\n PORTRAIT: 1,\r\n TOKEN: 2,\r\n PORTRAIT_TOKEN: 3,\r\n IMAGE: 4,\r\n };\r\n\r\n constructor(\r\n search,\r\n {\r\n preventClose = false,\r\n object = null,\r\n callback = null,\r\n searchType = null,\r\n allImages = null,\r\n image1 = '',\r\n image2 = '',\r\n displayMode = ArtSelect.IMAGE_DISPLAY.NONE,\r\n multipleSelection = false,\r\n searchOptions = {},\r\n } = {}\r\n ) {\r\n let title = game.i18n.localize('token-variants.windows.art-select.select-variant');\r\n if (searchType === SEARCH_TYPE.TOKEN)\r\n title = game.i18n.localize('token-variants.windows.art-select.select-token-art');\r\n else if (searchType === SEARCH_TYPE.PORTRAIT)\r\n title = game.i18n.localize('token-variants.windows.art-select.select-portrait-art');\r\n\r\n super(\r\n {},\r\n {\r\n closeOnSubmit: false,\r\n width: ArtSelect.WIDTH || 500,\r\n height: ArtSelect.HEIGHT || 500,\r\n left: ArtSelect.LEFT,\r\n top: ArtSelect.TOP,\r\n title: title,\r\n }\r\n );\r\n this.search = search;\r\n this.allImages = allImages;\r\n this.callback = callback;\r\n this.doc = object;\r\n this.preventClose = preventClose;\r\n this.image1 = image1;\r\n this.image2 = image2;\r\n this.displayMode = displayMode;\r\n this.multipleSelection = multipleSelection;\r\n this.searchType = searchType;\r\n this.searchOptions = mergeObject(searchOptions, getSearchOptions(), {\r\n overwrite: false,\r\n });\r\n ArtSelect.instance = this;\r\n\r\n const constructorName = `ArtSelect`;\r\n Object.defineProperty(ArtSelect.prototype.constructor, 'name', { value: constructorName });\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-art-select',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/artSelect.html',\r\n resizable: true,\r\n minimizable: false,\r\n });\r\n }\r\n\r\n _getHeaderButtons() {\r\n const buttons = super._getHeaderButtons();\r\n buttons.unshift({\r\n label: 'FilePicker',\r\n class: 'file-picker',\r\n icon: 'fas fa-file-import fa-fw',\r\n onclick: () => {\r\n new FilePicker({\r\n type: 'imagevideo',\r\n callback: (path) => {\r\n if (!this.preventClose) {\r\n this.close();\r\n }\r\n if (this.callback) {\r\n this.callback(path, getFileName(path));\r\n }\r\n },\r\n }).render();\r\n },\r\n });\r\n buttons.unshift({\r\n label: 'Image Category',\r\n class: 'type',\r\n icon: 'fas fa-swatchbook',\r\n onclick: () => {\r\n if (ArtSelect.instance) ArtSelect.instance._typeSelect();\r\n },\r\n });\r\n return buttons;\r\n }\r\n\r\n _typeSelect() {\r\n const categories = BASE_IMAGE_CATEGORIES.concat(TVA_CONFIG.customImageCategories);\r\n\r\n const buttons = {};\r\n for (const c of categories) {\r\n let label = c;\r\n if (c === this.searchType) {\r\n label = '<b>>>> ' + label + ' <<<</b>';\r\n }\r\n buttons[c] = {\r\n label: label,\r\n callback: () => {\r\n if (this.searchType !== c) {\r\n this.searchType = c;\r\n this._performSearch(this.search, true);\r\n }\r\n },\r\n };\r\n }\r\n\r\n new Dialog({\r\n title: `Select Image Category and Filter`,\r\n content: `<style>.dialog .dialog-button {flex: 0 0 auto;}</style>`,\r\n buttons: buttons,\r\n }).render(true);\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n if (this.doc instanceof Item) {\r\n data.item = true;\r\n data.description = this.doc.system?.description?.value ?? '';\r\n }\r\n const searchOptions = this.searchOptions;\r\n const algorithm = searchOptions.algorithm;\r\n\r\n //\r\n // Create buttons\r\n //\r\n const tokenConfigs = (TVA_CONFIG.tokenConfigs || []).flat();\r\n const fuzzySearch = algorithm.fuzzy;\r\n\r\n let allButtons = new Map();\r\n let artFound = false;\r\n\r\n const genLabel = function (str, indices, start = '<mark>', end = '</mark>', fillChar = null) {\r\n if (!indices) return str;\r\n let fillStr = fillChar ? fillChar.repeat(str.length) : str;\r\n let label = '';\r\n let lastIndex = 0;\r\n for (const index of indices) {\r\n label += fillStr.slice(lastIndex, index[0]);\r\n label += start + str.slice(index[0], index[1] + 1) + end;\r\n lastIndex = index[1] + 1;\r\n }\r\n label += fillStr.slice(lastIndex, fillStr.length);\r\n\r\n return label;\r\n };\r\n\r\n const genTitle = function (obj) {\r\n if (!fuzzySearch) return obj.path;\r\n\r\n let percent = Math.ceil((1 - obj.score) * 100) + '%';\r\n if (searchOptions.runSearchOnPath) {\r\n return percent + '\\n' + genLabel(obj.path, obj.indices, '', '', '-') + '\\n' + obj.path;\r\n }\r\n return percent;\r\n };\r\n\r\n this.allImages.forEach((images, search) => {\r\n const buttons = [];\r\n images.forEach((imageObj) => {\r\n artFound = true;\r\n const vid = isVideo(imageObj.path);\r\n const img = isImage(imageObj.path);\r\n buttons.push({\r\n path: imageObj.path,\r\n img: img,\r\n vid: vid,\r\n type: vid || img,\r\n name: imageObj.name,\r\n label:\r\n fuzzySearch && !searchOptions.runSearchOnPath ? genLabel(imageObj.name, imageObj.indices) : imageObj.name,\r\n title: genTitle(imageObj),\r\n hasConfig:\r\n this.searchType === SEARCH_TYPE.TOKEN || this.searchType === SEARCH_TYPE.PORTRAIT_AND_TOKEN\r\n ? Boolean(\r\n tokenConfigs.find((config) => config.tvImgSrc == imageObj.path && config.tvImgName == imageObj.name)\r\n )\r\n : false,\r\n });\r\n });\r\n allButtons.set(search, buttons);\r\n });\r\n\r\n if (artFound) data.allImages = allButtons;\r\n\r\n data.search = this.search;\r\n data.queue = ArtSelect.queue.length;\r\n data.image1 = this.image1;\r\n data.image2 = this.image2;\r\n data.displayMode = this.displayMode;\r\n data.multipleSelection = this.multipleSelection;\r\n data.displaySlider = algorithm.fuzzy && algorithm.fuzzyArtSelectPercentSlider;\r\n data.fuzzyThreshold = algorithm.fuzzyThreshold;\r\n if (data.displaySlider) {\r\n data.fuzzyThreshold = 100 - data.fuzzyThreshold * 100;\r\n data.fuzzyThreshold = data.fuzzyThreshold.toFixed(0);\r\n }\r\n data.autoplay = !TVA_CONFIG.playVideoOnHover;\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n const callback = this.callback;\r\n const close = () => this.close();\r\n const object = this.doc;\r\n const preventClose = this.preventClose;\r\n const multipleSelection = this.multipleSelection;\r\n\r\n const boxes = html.find(`.token-variants-grid-box`);\r\n boxes.hover(\r\n function () {\r\n if (TVA_CONFIG.playVideoOnHover) {\r\n const vid = $(this).siblings('video');\r\n if (vid.length) {\r\n vid[0].play();\r\n $(this).siblings('.fa-play').hide();\r\n }\r\n }\r\n },\r\n function () {\r\n if (TVA_CONFIG.pauseVideoOnHoverOut) {\r\n const vid = $(this).siblings('video');\r\n if (vid.length) {\r\n vid[0].pause();\r\n vid[0].currentTime = 0;\r\n $(this).siblings('.fa-play').show();\r\n }\r\n }\r\n }\r\n );\r\n boxes.map((box) => {\r\n boxes[box].addEventListener('click', async function (event) {\r\n if (keyPressed('config')) {\r\n if (object)\r\n new TokenCustomConfig(object, {}, event.target.dataset.name, event.target.dataset.filename).render(true);\r\n } else {\r\n if (!preventClose) {\r\n close();\r\n }\r\n if (callback) {\r\n callback(event.target.dataset.name, event.target.dataset.filename);\r\n }\r\n }\r\n });\r\n if (multipleSelection) {\r\n boxes[box].addEventListener('contextmenu', async function (event) {\r\n $(event.target).toggleClass('selected');\r\n });\r\n }\r\n });\r\n\r\n let searchInput = html.find('#custom-art-search');\r\n searchInput.focus();\r\n searchInput[0].selectionStart = searchInput[0].selectionEnd = 10000;\r\n\r\n searchInput.on(\r\n 'input',\r\n delay((event) => {\r\n this._performSearch(event.target.value);\r\n }, 350)\r\n );\r\n\r\n html.find(`button#token-variant-art-clear-queue`).on('click', (event) => {\r\n ArtSelect.queue = ArtSelect.queue.filter((callData) => callData.options.execute);\r\n $(event.target).hide();\r\n });\r\n\r\n $(html)\r\n .find('[name=\"fuzzyThreshold\"]')\r\n .change((e) => {\r\n $(e.target)\r\n .siblings('.token-variants-range-value')\r\n .html(`${parseFloat(e.target.value).toFixed(0)}%`);\r\n this.searchOptions.algorithm.fuzzyThreshold = (100 - e.target.value) / 100;\r\n })\r\n .change(\r\n delay((event) => {\r\n this._performSearch(this.search, true);\r\n }, 350)\r\n );\r\n\r\n if (multipleSelection) {\r\n html.find(`button#token-variant-art-return-selected`).on('click', () => {\r\n if (callback) {\r\n const images = [];\r\n html\r\n .find(`.token-variants-grid-box.selected`)\r\n .siblings('.token-variants-grid-image')\r\n .each(function () {\r\n images.push(this.getAttribute('src'));\r\n });\r\n callback(images);\r\n }\r\n close();\r\n });\r\n html.find(`button#token-variant-art-return-all`).on('click', () => {\r\n if (callback) {\r\n const images = [];\r\n html.find(`.token-variants-grid-image`).each(function () {\r\n images.push(this.getAttribute('src'));\r\n });\r\n callback(images);\r\n }\r\n close();\r\n });\r\n }\r\n }\r\n\r\n _performSearch(search, force = false) {\r\n if (!force && this.search.trim() === search.trim()) return;\r\n showArtSelect(search, {\r\n callback: this.callback,\r\n searchType: this.searchType,\r\n object: this.doc,\r\n force: true,\r\n image1: this.image1,\r\n image2: this.image2,\r\n displayMode: this.displayMode,\r\n multipleSelection: this.multipleSelection,\r\n searchOptions: this.searchOptions,\r\n preventClose: this.preventClose,\r\n });\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n if (formData && formData.search != this.search) {\r\n this._performSearch(formData.search);\r\n } else {\r\n this.close();\r\n }\r\n }\r\n\r\n setPosition(options = {}) {\r\n if (options.width) ArtSelect.WIDTH = options.width;\r\n if (options.height) ArtSelect.HEIGHT = options.height;\r\n if (options.top) ArtSelect.TOP = options.top;\r\n if (options.left) ArtSelect.LEFT = options.left;\r\n super.setPosition(options);\r\n }\r\n\r\n async close(options = {}) {\r\n let callData = ArtSelect.queue.shift();\r\n if (callData?.options.execute) {\r\n callData.options.execute();\r\n callData = ArtSelect.queue.shift();\r\n }\r\n if (callData) {\r\n callData.options.force = true;\r\n showArtSelect(callData.search, callData.options);\r\n } else {\r\n // For some reason there might be app instances that have not closed themselves by this point\r\n // If there are, close them now\r\n const artSelects = Object.values(ui.windows)\r\n .filter((app) => app instanceof ArtSelect)\r\n .filter((app) => app.appId !== this.appId);\r\n for (const app of artSelects) {\r\n app.close();\r\n }\r\n\r\n return super.close(options);\r\n }\r\n }\r\n}\r\n\r\nexport function insertArtSelectButton(html, target, { search = '', searchType = SEARCH_TYPE.TOKEN } = {}) {\r\n const button = $(`<button \r\n class=\"token-variants-image-select-button\" \r\n type=\"button\"\r\n data-type=\"imagevideo\"\r\n data-target=\"${target}\"\r\n title=\"${game.i18n.localize('token-variants.windows.art-select.select-variant')}\">\r\n <i class=\"fas fa-images\"></i>\r\n </button>`);\r\n button.on('click', () => {\r\n showArtSelect(search, {\r\n callback: (imgSrc, name) => {\r\n button.siblings(`[name=\"${target}\"]`).val(imgSrc);\r\n },\r\n searchType,\r\n });\r\n });\r\n const input = html.find(`[name=\"${target}\"]`);\r\n input.after(button);\r\n return Boolean(input.length);\r\n}\r\n","import { getTokenConfig, setTokenConfig } from '../scripts/utils.js';\r\n\r\nexport default class TokenCustomConfig extends TokenConfig {\r\n constructor(object, options, imgSrc, imgName, callback, config) {\r\n let token;\r\n if (object instanceof Actor) {\r\n token = new TokenDocument(object.token, {\r\n actor: object,\r\n });\r\n } else {\r\n token = new TokenDocument(object.document, {\r\n actor: game.actors.get(object.actorId),\r\n });\r\n }\r\n super(token, options);\r\n this.imgSrc = imgSrc;\r\n this.imgName = imgName;\r\n this.callback = callback;\r\n this.config = config;\r\n if (this.config) {\r\n this.flags = this.config.flags;\r\n this.tv_script = this.config.tv_script;\r\n }\r\n }\r\n\r\n _getSubmitData(updateData = {}) {\r\n if (!this.form) throw new Error('The FormApplication subclass has no registered form element');\r\n const fd = new FormDataExtended(this.form, { editors: this.editors });\r\n let data = fd.object;\r\n if (updateData) data = foundry.utils.flattenObject(foundry.utils.mergeObject(data, updateData));\r\n\r\n // Clear detection modes array\r\n if (!('detectionModes.0.id' in data)) data.detectionModes = [];\r\n\r\n // Treat \"None\" as null for bar attributes\r\n data['bar1.attribute'] ||= null;\r\n data['bar2.attribute'] ||= null;\r\n return data;\r\n }\r\n\r\n async _updateObject(event, formData) {\r\n const filtered = {};\r\n\r\n const form = $(event.target).closest('form');\r\n\r\n form.find('.form-group').each(function (_) {\r\n const tva_checkbox = $(this).find('.tva-config-checkbox > input');\r\n if (tva_checkbox.length && tva_checkbox.is(':checked')) {\r\n $(this)\r\n .find('[name]')\r\n .each(function (_) {\r\n const name = $(this).attr('name');\r\n filtered[name] = formData[name];\r\n });\r\n }\r\n });\r\n\r\n if (this.tv_script) {\r\n filtered.tv_script = this.tv_script;\r\n }\r\n\r\n if (this.config) {\r\n let config = expandObject(filtered);\r\n config.flags = config.flags ? mergeObject(this.flags || {}, config.flags) : this.flags;\r\n if (this.callback) this.callback(config);\r\n } else {\r\n const saved = setTokenConfig(this.imgSrc, this.imgName, filtered);\r\n if (this.callback) this.callback(saved);\r\n }\r\n }\r\n\r\n applyCustomConfig() {\r\n const tokenConfig = flattenObject(this.config || getTokenConfig(this.imgSrc, this.imgName));\r\n const form = $(this.form);\r\n for (const key of Object.keys(tokenConfig)) {\r\n const el = form.find(`[name=\"${key}\"]`);\r\n if (el.is(':checkbox')) {\r\n el.prop('checked', tokenConfig[key]);\r\n } else {\r\n el.val(tokenConfig[key]);\r\n }\r\n el.trigger('change');\r\n }\r\n }\r\n\r\n // *************\r\n // consider moving html injection to:\r\n // _replaceHTML | _injectHTML\r\n\r\n async activateListeners(html) {\r\n await super.activateListeners(html);\r\n\r\n // Disable image path controls\r\n $(html).find('.token-variants-image-select-button').prop('disabled', true);\r\n $(html).find('.file-picker').prop('disabled', true);\r\n $(html).find('.image').prop('disabled', true);\r\n\r\n // Remove 'Assign Token' button\r\n $(html).find('.assign-token').remove();\r\n\r\n // Add checkboxes to control inclusion of specific tabs in the custom config\r\n const tokenConfig = this.config || getTokenConfig(this.imgSrc, this.imgName);\r\n this.tv_script = tokenConfig.tv_script;\r\n\r\n $(html).on('change', '.tva-config-checkbox', this._onCheckboxChange);\r\n\r\n const processFormGroup = function (formGroup) {\r\n // Checkbox is not added for the Image Path group\r\n if (!$(formGroup).find('[name=\"img\"]').length) {\r\n let savedField = false;\r\n if (tokenConfig) {\r\n const flatConfig = flattenObject(tokenConfig);\r\n $(formGroup)\r\n .find('[name]')\r\n .each(function (_) {\r\n const name = $(this).attr('name');\r\n if (name in flatConfig) {\r\n savedField = true;\r\n }\r\n });\r\n }\r\n\r\n const checkbox = $(\r\n `<div class=\"tva-config-checkbox\"><input type=\"checkbox\" data-dtype=\"Boolean\" ${\r\n savedField ? 'checked=\"\"' : ''\r\n }></div>`\r\n );\r\n if ($(formGroup).find('p.hint').length) {\r\n $(formGroup).find('p.hint').before(checkbox);\r\n } else {\r\n $(formGroup).append(checkbox);\r\n }\r\n checkbox.find('input').trigger('change');\r\n }\r\n };\r\n // Add checkboxes to each form-group to control highlighting and which fields will are to be saved\r\n $(html)\r\n .find('.form-group')\r\n .each(function (index) {\r\n processFormGroup(this);\r\n });\r\n\r\n // Add 'update' and 'remove' config buttons\r\n $(html).find('.sheet-footer > button').remove();\r\n $(html)\r\n .find('.sheet-footer')\r\n .append('<button type=\"submit\" value=\"1\"><i class=\"far fa-save\"></i> Save Config</button>');\r\n if (tokenConfig) {\r\n $(html)\r\n .find('.sheet-footer')\r\n .append('<button type=\"button\" class=\"remove-config\"><i class=\"fas fa-trash\"></i> Remove Config</button>');\r\n html.find('.remove-config').click(this._onRemoveConfig.bind(this));\r\n }\r\n\r\n // Pre-select image or appearance tab\r\n $(html).find('.tabs > .item[data-tab=\"image\"] > i').trigger('click');\r\n $(html).find('.tabs > .item[data-tab=\"appearance\"] > i').trigger('click');\r\n\r\n document.activeElement.blur(); // Hack fix for key UP/DOWN effects not registering after config has been opened\r\n\r\n // TokenConfig might be changed by some modules after activateListeners is processed\r\n // Look out for these updates and add checkboxes for any newly added form-groups\r\n const mutate = (mutations) => {\r\n mutations.forEach((mutation) => {\r\n mutation.addedNodes.forEach((node) => {\r\n if (node.nodeName === 'DIV' && node.className === 'form-group') {\r\n processFormGroup(node);\r\n this.applyCustomConfig();\r\n }\r\n });\r\n });\r\n };\r\n\r\n const observer = new MutationObserver(mutate);\r\n observer.observe(html[0], {\r\n characterData: false,\r\n attributes: false,\r\n childList: true,\r\n subtree: true,\r\n });\r\n\r\n // On any field being changed we want to automatically select the form-group to be included in the update\r\n $(html).on('change', 'input, select', onInputChange);\r\n $(html).on('click', 'button', onInputChange);\r\n\r\n this.applyCustomConfig();\r\n }\r\n\r\n async _onCheckboxChange(event) {\r\n const checkbox = $(event.target);\r\n checkbox.closest('.form-group').css({\r\n 'outline-color': checkbox.is(':checked') ? 'green' : '#ffcc6e',\r\n 'outline-width': '2px',\r\n 'outline-style': 'dotted',\r\n 'margin-bottom': '5px',\r\n });\r\n checkbox.closest('.tva-config-checkbox').css({\r\n 'outline-color': checkbox.is(':checked') ? 'green' : '#ffcc6e',\r\n 'outline-width': '2px',\r\n 'outline-style': 'solid',\r\n });\r\n }\r\n\r\n async _onRemoveConfig(event) {\r\n if (this.config) {\r\n if (this.callback) this.callback({});\r\n } else {\r\n const saved = setTokenConfig(this.imgSrc, this.imgName, null);\r\n if (this.callback) this.callback(saved);\r\n }\r\n this.close();\r\n }\r\n\r\n get id() {\r\n return `token-custom-config-${this.object.id}`;\r\n }\r\n\r\n _getHeaderButtons() {\r\n const buttons = super._getHeaderButtons();\r\n return buttons;\r\n }\r\n}\r\n\r\n// Toggle checkbox if input has been detected inside it's form-group\r\nasync function onInputChange(event) {\r\n if (event.target.parentNode.className === 'tva-config-checkbox') return;\r\n $(event.target).closest('.form-group').find('.tva-config-checkbox input').prop('checked', true);\r\n}\r\n","import { TVA_CONFIG } from '../settings.js';\r\nimport { TVAOverlay } from '../sprite/TVAOverlay.js';\r\nimport { string2Hex, waitForTokenTexture } from '../utils.js';\r\nimport { getAllEffectMappings, getTokenEffects, getTokenHP } from '../hooks/effectMappingHooks.js';\r\n\r\nexport const FONT_LOADING = {};\r\n\r\nexport async function drawOverlays(token) {\r\n if (token.tva_drawing_overlays) return;\r\n token.tva_drawing_overlays = true;\r\n\r\n const mappings = getAllEffectMappings(token);\r\n const effects = getTokenEffects(token, true);\r\n let processedMappings = mappings\r\n .filter((m) => m.overlay && effects.includes(m.id))\r\n .sort(\r\n (m1, m2) =>\r\n (m1.priority - m1.overlayConfig?.parentID ? 0 : 999) - (m2.priority - m2.overlayConfig?.parentID ? 0 : 999)\r\n );\r\n\r\n // See if the whole stack or just top of the stack should be used according to settings\r\n if (processedMappings.length) {\r\n processedMappings = TVA_CONFIG.stackStatusConfig\r\n ? processedMappings\r\n : [processedMappings[processedMappings.length - 1]];\r\n }\r\n\r\n // Process strings as expressions\r\n const overlays = processedMappings.map((m) => evaluateOverlayExpressions(deepClone(m.overlayConfig), token, m));\r\n\r\n if (overlays.length) {\r\n waitForTokenTexture(token, async (token) => {\r\n if (!token.tvaOverlays) token.tvaOverlays = [];\r\n // Temporarily mark every overlay for removal.\r\n // We'll only keep overlays that are still applicable to the token\r\n _markAllOverlaysForRemoval(token);\r\n\r\n // To keep track of the overlay order\r\n let overlaySort = 0;\r\n let underlaySort = 0;\r\n for (const ov of overlays) {\r\n let sprite = _findTVAOverlay(ov.id, token);\r\n if (sprite) {\r\n const diff = diffObject(sprite.overlayConfig, ov);\r\n\r\n // Check if we need to create a new texture or simply refresh the overlay\r\n if (!isEmpty(diff)) {\r\n if (ov.img?.includes('*') || (ov.img?.includes('{') && ov.img?.includes('}'))) {\r\n sprite.refresh(ov);\r\n } else if (diff.img || diff.text || diff.shapes || diff.repeat || diff.html) {\r\n sprite.setTexture(await genTexture(token, ov), { configuration: ov });\r\n } else if (diff.parentID) {\r\n sprite.parent?.removeChild(sprite)?.destroy();\r\n sprite = null;\r\n } else {\r\n sprite.refresh(ov);\r\n }\r\n } else if (diff.text?.text || diff.shapes) {\r\n sprite.setTexture(await genTexture(token, ov), { configuration: ov });\r\n }\r\n\r\n if ('ui' in diff) {\r\n sprite.parent.removeChild(sprite);\r\n const layer = ov.ui ? canvas.tokens : canvas.primary;\r\n sprite = layer.addChild(sprite);\r\n }\r\n }\r\n if (!sprite) {\r\n if (ov.parentID) {\r\n const parent = _findTVAOverlay(ov.parentID, token);\r\n if (parent && !parent.tvaRemove)\r\n sprite = parent.addChildAuto(new TVAOverlay(await genTexture(token, ov), token, ov));\r\n } else {\r\n const layer = ov.ui ? canvas.tokens : canvas.primary;\r\n sprite = layer.addChild(new TVAOverlay(await genTexture(token, ov), token, ov));\r\n }\r\n if (sprite) token.tvaOverlays.push(sprite);\r\n }\r\n\r\n // If the sprite has a parent confirm that the parent has not been removed\r\n if (sprite?.overlayConfig.parentID) {\r\n const parent = _findTVAOverlay(sprite.overlayConfig.parentID, token);\r\n if (!parent || parent.tvaRemove) sprite = null;\r\n }\r\n\r\n if (sprite) {\r\n sprite.tvaRemove = false; // Sprite in use, do not remove\r\n\r\n // Assign order to the overlay\r\n if (sprite.overlayConfig.underlay) {\r\n underlaySort -= 0.01;\r\n sprite.overlaySort = underlaySort;\r\n } else {\r\n overlaySort += 0.01;\r\n sprite.overlaySort = overlaySort;\r\n }\r\n }\r\n }\r\n\r\n removeMarkedOverlays(token);\r\n token.tva_drawing_overlays = false;\r\n });\r\n } else {\r\n _removeAllOverlays(token);\r\n token.tva_drawing_overlays = false;\r\n }\r\n}\r\n\r\n// function _getLayer(ov) {\r\n// const layer = ov.ui ? canvas.tokens : canvas.primary;\r\n// if (!layer.tvaOverlay) layer.tvaOverlays = layer.addChild(new PIXI.Container());\r\n// return layer.tvaOverlays;\r\n// }\r\n\r\nexport async function genTexture(token, conf) {\r\n const img = conf.imgLinked ? token.document.texture.src : conf.img?.trim();\r\n if (img) {\r\n return await generateImage(token, conf, img);\r\n } else if (conf.text?.text != null) {\r\n return await generateTextTexture(token, conf);\r\n } else if (conf.shapes?.length) {\r\n return await generateShapeTexture(token, conf.shapes);\r\n } else if (conf.html?.template) {\r\n return { html: true, texture: await loadTexture('modules\\\\token-variants\\\\img\\\\html_bg.webp') };\r\n } else {\r\n return {\r\n texture: await loadTexture('modules/token-variants/img/token-images.svg'),\r\n };\r\n }\r\n}\r\n\r\nasync function generateImage(token, conf, img) {\r\n if (img.includes('*') || (img.includes('{') && img.includes('}'))) {\r\n const images = await wildcardImageSearch(img);\r\n if (images.length) {\r\n if (images.length) {\r\n img = images[Math.floor(Math.random() * images.length)];\r\n }\r\n }\r\n }\r\n\r\n let texture = await loadTexture(img, {\r\n fallback: 'modules/token-variants/img/token-images.svg',\r\n });\r\n\r\n // Repeat image if needed\r\n // Repeating the shape if necessary\r\n if (conf.repeating && conf.repeat) {\r\n const repeat = conf.repeat;\r\n let numRepeats;\r\n if (repeat.isPercentage) {\r\n numRepeats = Math.ceil(repeat.value / repeat.maxValue / (repeat.increment / 100));\r\n } else {\r\n numRepeats = Math.ceil(repeat.value / repeat.increment);\r\n }\r\n let n = 0;\r\n let rows = 0;\r\n const maxRows = repeat.maxRows ?? Infinity;\r\n let xOffset = 0;\r\n let yOffset = 0;\r\n const paddingX = repeat.paddingX ?? 0;\r\n const paddingY = repeat.paddingY ?? 0;\r\n let container = new PIXI.Container();\r\n while (numRepeats > 0) {\r\n let img = new PIXI.Sprite(texture);\r\n img.x = xOffset;\r\n img.y = yOffset;\r\n container.addChild(img);\r\n xOffset += texture.width + paddingX;\r\n numRepeats--;\r\n n++;\r\n if (numRepeats != 0 && n >= repeat.perRow) {\r\n rows += 1;\r\n if (rows >= maxRows) break;\r\n yOffset += texture.height + paddingY;\r\n xOffset = 0;\r\n n = 0;\r\n }\r\n }\r\n\r\n texture = _renderContainer(container, texture.resolution);\r\n }\r\n\r\n return { texture };\r\n}\r\n\r\nfunction _renderContainer(container, resolution, { width = null, height = null } = {}) {\r\n const bounds = container.getLocalBounds();\r\n const matrix = new PIXI.Matrix();\r\n matrix.tx = -bounds.x;\r\n matrix.ty = -bounds.y;\r\n\r\n const renderTexture = PIXI.RenderTexture.create({\r\n width: width ?? bounds.width,\r\n height: height ?? bounds.height,\r\n resolution: resolution,\r\n });\r\n\r\n if (isNewerVersion('11', game.version)) {\r\n canvas.app.renderer.render(container, renderTexture, true, matrix, false);\r\n } else {\r\n canvas.app.renderer.render(container, {\r\n renderTexture,\r\n clear: true,\r\n transform: matrix,\r\n skipUpdateTransform: false,\r\n });\r\n }\r\n renderTexture.destroyable = true;\r\n return renderTexture;\r\n}\r\n\r\n// Return width and height of the drawn shape\r\nfunction _drawShape(graphics, shape, xOffset = 0, yOffset = 0) {\r\n if (shape.type === 'rectangle') {\r\n graphics.drawRoundedRect(shape.x + xOffset, shape.y + yOffset, shape.width, shape.height, shape.radius);\r\n return [shape.width, shape.height];\r\n } else if (shape.type === 'ellipse') {\r\n graphics.drawEllipse(shape.x + xOffset + shape.width, shape.y + yOffset + shape.height, shape.width, shape.height);\r\n return [shape.width * 2, shape.height * 2];\r\n } else if (shape.type === 'polygon') {\r\n graphics.drawPolygon(\r\n shape.points.split(',').map((p, i) => Number(p) * shape.scale + (i % 2 === 0 ? shape.x : shape.y))\r\n );\r\n } else if (shape.type === 'torus') {\r\n drawTorus(\r\n graphics,\r\n shape.x + xOffset + shape.outerRadius,\r\n shape.y + yOffset + shape.outerRadius,\r\n shape.innerRadius,\r\n shape.outerRadius,\r\n Math.toRadians(shape.startAngle),\r\n shape.endAngle >= 360 ? Math.PI * 2 : Math.toRadians(shape.endAngle)\r\n );\r\n return [shape.outerRadius * 2, shape.outerRadius * 2];\r\n }\r\n}\r\n\r\nexport async function generateShapeTexture(token, shapes) {\r\n let graphics = new PIXI.Graphics();\r\n\r\n for (const obj of shapes) {\r\n graphics.beginFill(interpolateColor(obj.fill.color, obj.fill.interpolateColor), obj.fill.alpha);\r\n graphics.lineStyle(obj.line.width, string2Hex(obj.line.color), obj.line.alpha);\r\n\r\n const shape = obj.shape;\r\n\r\n // Repeating the shape if necessary\r\n if (obj.repeating && obj.repeat) {\r\n const repeat = obj.repeat;\r\n let numRepeats;\r\n if (repeat.isPercentage) {\r\n numRepeats = Math.ceil(repeat.value / repeat.maxValue / (repeat.increment / 100));\r\n } else {\r\n numRepeats = Math.ceil(repeat.value / repeat.increment);\r\n }\r\n let n = 0;\r\n let rows = 0;\r\n const maxRows = repeat.maxRows ?? Infinity;\r\n let xOffset = 0;\r\n let yOffset = 0;\r\n const paddingX = repeat.paddingX ?? 0;\r\n const paddingY = repeat.paddingY ?? 0;\r\n while (numRepeats > 0) {\r\n const [width, height] = _drawShape(graphics, shape, xOffset, yOffset);\r\n xOffset += width + paddingX;\r\n numRepeats--;\r\n n++;\r\n if (numRepeats != 0 && n >= repeat.perRow) {\r\n rows += 1;\r\n if (rows >= maxRows) break;\r\n yOffset += height + paddingY;\r\n xOffset = 0;\r\n n = 0;\r\n }\r\n }\r\n } else {\r\n _drawShape(graphics, shape);\r\n }\r\n }\r\n\r\n // Store original graphics dimensions as these may change when children are added\r\n graphics.shapesWidth = Number(graphics.width);\r\n graphics.shapesHeight = Number(graphics.height);\r\n\r\n return { texture: PIXI.Texture.EMPTY, shapes: graphics };\r\n}\r\n\r\nfunction drawTorus(graphics, x, y, innerRadius, outerRadius, startArc = 0, endArc = Math.PI * 2) {\r\n if (Math.abs(endArc - startArc) >= Math.PI * 2) {\r\n return graphics.drawCircle(x, y, outerRadius).beginHole().drawCircle(x, y, innerRadius).endHole();\r\n }\r\n\r\n graphics.finishPoly();\r\n graphics.arc(x, y, innerRadius, endArc, startArc, true).arc(x, y, outerRadius, startArc, endArc, false).finishPoly();\r\n}\r\n\r\nexport function interpolateColor(minColor, interpolate, rString = false) {\r\n if (!interpolate || !interpolate.color2 || !interpolate.prc) return rString ? minColor : string2Hex(minColor);\r\n\r\n if (!PIXI.Color) return _interpolateV10(minColor, interpolate, rString);\r\n\r\n const percentage = interpolate.prc;\r\n minColor = new PIXI.Color(minColor);\r\n const maxColor = new PIXI.Color(interpolate.color2);\r\n\r\n let minHsv = rgb2hsv(minColor.red, minColor.green, minColor.blue);\r\n let maxHsv = rgb2hsv(maxColor.red, maxColor.green, maxColor.blue);\r\n\r\n let deltaHue = maxHsv[0] - minHsv[0];\r\n let deltaAngle = deltaHue + (Math.abs(deltaHue) > 180 ? (deltaHue < 0 ? 360 : -360) : 0);\r\n\r\n let targetHue = minHsv[0] + deltaAngle * percentage;\r\n let targetSaturation = (1 - percentage) * minHsv[1] + percentage * maxHsv[1];\r\n let targetValue = (1 - percentage) * minHsv[2] + percentage * maxHsv[2];\r\n\r\n let result = new PIXI.Color({ h: targetHue, s: targetSaturation * 100, v: targetValue * 100 });\r\n return rString ? result.toHex() : result.toNumber();\r\n}\r\n\r\nfunction _interpolateV10(minColor, interpolate, rString = false) {\r\n const percentage = interpolate.prc;\r\n minColor = PIXI.utils.hex2rgb(string2Hex(minColor));\r\n const maxColor = PIXI.utils.hex2rgb(string2Hex(interpolate.color2));\r\n\r\n let minHsv = rgb2hsv(minColor[0], minColor[1], minColor[2]);\r\n let maxHsv = rgb2hsv(maxColor[0], maxColor[1], maxColor[2]);\r\n\r\n let deltaHue = maxHsv[0] - minHsv[0];\r\n let deltaAngle = deltaHue + (Math.abs(deltaHue) > 180 ? (deltaHue < 0 ? 360 : -360) : 0);\r\n\r\n let targetHue = minHsv[0] + deltaAngle * percentage;\r\n let targetSaturation = (1 - percentage) * minHsv[1] + percentage * maxHsv[1];\r\n let targetValue = (1 - percentage) * minHsv[2] + percentage * maxHsv[2];\r\n\r\n let result = Color.fromHSV([targetHue / 360, targetSaturation, targetValue]);\r\n return rString ? result.toString() : Number(result);\r\n}\r\n\r\n/**\r\n * Converts a color from RGB to HSV space.\r\n * Source: https://stackoverflow.com/questions/8022885/rgb-to-hsv-color-in-javascript/54070620#54070620\r\n */\r\nfunction rgb2hsv(r, g, b) {\r\n let v = Math.max(r, g, b),\r\n c = v - Math.min(r, g, b);\r\n let h = c && (v == r ? (g - b) / c : v == g ? 2 + (b - r) / c : 4 + (r - g) / c);\r\n return [60 * (h < 0 ? h + 6 : h), v && c / v, v];\r\n}\r\n\r\nconst CORE_VARIABLES = {\r\n '@hp': (token) => getTokenHP(token)?.[0],\r\n '@hpMax': (token) => getTokenHP(token)?.[1],\r\n '@gridSize': () => canvas.grid?.size,\r\n '@label': (_, conf) => conf.label,\r\n};\r\n\r\nfunction _evaluateString(str, token, conf) {\r\n let variables = conf.overlayConfig?.variables;\r\n const re2 = new RegExp('@\\\\w+', 'gi');\r\n str = str.replace(re2, function replace(match) {\r\n let name = match.substr(1, match.length);\r\n let v = variables?.find((v) => v.name === name);\r\n if (v) return v.value;\r\n else if (match in CORE_VARIABLES) return CORE_VARIABLES[match](token, conf);\r\n return match;\r\n });\r\n\r\n const re = new RegExp('{{.*?}}', 'gi');\r\n str = str\r\n .replace(re, function replace(match) {\r\n const property = match.substring(2, match.length - 2);\r\n if (conf && property === 'effect') {\r\n return conf.expression;\r\n }\r\n if (token && property === 'hp') return getTokenHP(token)?.[0];\r\n else if (token && property === 'hpMax') return getTokenHP(token)?.[1];\r\n const val = getProperty(token.document ?? token, property);\r\n return val ?? 0;\r\n })\r\n .replace('\\\\n', '\\n');\r\n\r\n return str;\r\n}\r\n\r\nfunction _executeString(evalString, token) {\r\n try {\r\n const actor = token.actor; // So that actor is easily accessible within eval() scope\r\n const result = eval(evalString);\r\n if (getType(result) === 'Object') evalString;\r\n return result;\r\n } catch (e) {}\r\n return evalString;\r\n}\r\n\r\nexport function evaluateOverlayExpressions(obj, token, conf) {\r\n for (const [k, v] of Object.entries(obj)) {\r\n if (\r\n ![\r\n 'label',\r\n 'interactivity',\r\n 'variables',\r\n 'id',\r\n 'parentID',\r\n 'limitedUsers',\r\n 'filter',\r\n 'limitOnProperty',\r\n 'html',\r\n ].includes(k)\r\n ) {\r\n obj[k] = _evaluateObjExpressions(v, token, conf);\r\n }\r\n }\r\n return obj;\r\n}\r\n\r\n// Evaluate provided object values substituting in {{path.to.property}} with token properties, and performing eval() on strings\r\nfunction _evaluateObjExpressions(obj, token, conf) {\r\n const t = getType(obj);\r\n if (t === 'string') {\r\n const str = _evaluateString(obj, token, conf);\r\n return _executeString(str, token);\r\n } else if (t === 'Array') {\r\n for (let i = 0; i < obj.length; i++) {\r\n obj[i] = _evaluateObjExpressions(obj[i], token, conf);\r\n }\r\n } else if (t === 'Object') {\r\n for (const [k, v] of Object.entries(obj)) {\r\n // Exception for text overlay\r\n if (k === 'text' && getType(v) === 'string' && v) {\r\n const evalString = _evaluateString(v, token, conf);\r\n const result = _executeString(evalString, token);\r\n if (getType(result) !== 'string') obj[k] = evalString;\r\n else obj[k] = result;\r\n } else obj[k] = _evaluateObjExpressions(v, token, conf);\r\n }\r\n }\r\n return obj;\r\n}\r\n\r\nexport async function generateTextTexture(token, conf) {\r\n await FONT_LOADING.loading;\r\n let label = conf.text.text;\r\n\r\n // Repeating the string if necessary\r\n if (conf.text.repeating && conf.text.repeat) {\r\n let tmp = '';\r\n const repeat = conf.text.repeat;\r\n let numRepeats;\r\n if (repeat.isPercentage) {\r\n numRepeats = Math.ceil(repeat.value / repeat.maxValue / (repeat.increment / 100));\r\n } else {\r\n numRepeats = Math.ceil(repeat.value / repeat.increment);\r\n }\r\n let n = 0;\r\n let rows = 0;\r\n let maxRows = repeat.maxRows ?? Infinity;\r\n while (numRepeats > 0) {\r\n tmp += label;\r\n numRepeats--;\r\n n++;\r\n if (numRepeats != 0 && n >= repeat.perRow) {\r\n rows += 1;\r\n if (rows >= maxRows) break;\r\n tmp += '\\n';\r\n n = 0;\r\n }\r\n }\r\n label = tmp;\r\n }\r\n\r\n let style = PreciseText.getTextStyle({\r\n ...conf.text,\r\n fontFamily: [conf.text.fontFamily, 'fontAwesome'].join(','),\r\n fill: interpolateColor(conf.text.fill, conf.text.interpolateColor, true),\r\n });\r\n const text = new PreciseText(label, style);\r\n text.updateText(false);\r\n\r\n const texture = text.texture;\r\n const height = conf.text.maxHeight ? Math.min(texture.height, conf.text.maxHeight) : null;\r\n const curve = conf.text.curve;\r\n\r\n if (!height && !curve?.radius && !curve?.angle) {\r\n texture.textLabel = label;\r\n return { texture };\r\n }\r\n\r\n const container = new PIXI.Container();\r\n\r\n if (curve?.radius || curve?.angle) {\r\n // Curve the text\r\n const letterSpacing = conf.text.letterSpacing ?? 0;\r\n const radius = curve.angle ? (texture.width + letterSpacing) / (Math.PI * 2) / (curve.angle / 360) : curve.radius;\r\n const maxRopePoints = 100;\r\n const step = Math.PI / maxRopePoints;\r\n\r\n let ropePoints = maxRopePoints - Math.round((texture.width / (radius * Math.PI)) * maxRopePoints);\r\n ropePoints /= 2;\r\n\r\n const points = [];\r\n for (let i = maxRopePoints - ropePoints; i > ropePoints; i--) {\r\n const x = radius * Math.cos(step * i);\r\n const y = radius * Math.sin(step * i);\r\n points.push(new PIXI.Point(x, curve.invert ? y : -y));\r\n }\r\n const rope = new PIXI.SimpleRope(texture, points);\r\n container.addChild(rope);\r\n } else {\r\n container.addChild(new PIXI.Sprite(texture));\r\n }\r\n\r\n const renderTexture = _renderContainer(container, 2, { height });\r\n text.destroy();\r\n\r\n renderTexture.textLabel = label;\r\n return { texture: renderTexture };\r\n}\r\n\r\nfunction _markAllOverlaysForRemoval(token) {\r\n for (const child of token.tvaOverlays) {\r\n if (child instanceof TVAOverlay) {\r\n child.tvaRemove = true;\r\n }\r\n }\r\n}\r\n\r\nexport function removeMarkedOverlays(token) {\r\n const sprites = [];\r\n for (const child of token.tvaOverlays) {\r\n if (child.tvaRemove) {\r\n child.parent?.removeChild(child)?.destroy();\r\n } else {\r\n sprites.push(child);\r\n }\r\n }\r\n token.tvaOverlays = sprites;\r\n}\r\n\r\nfunction _findTVAOverlay(id, token) {\r\n for (const child of token.tvaOverlays) {\r\n if (child.overlayConfig?.id === id) {\r\n return child;\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nfunction _removeAllOverlays(token) {\r\n if (token.tvaOverlays)\r\n for (const child of token.tvaOverlays) {\r\n child.parent?.removeChild(child)?.destroy();\r\n }\r\n token.tvaOverlays = null;\r\n}\r\n\r\nexport function broadcastOverlayRedraw(token) {\r\n // Need to broadcast to other users to re-draw the overlay\r\n if (token) drawOverlays(token);\r\n const actorId = token.document?.actorLink ? token.actor?.id : null;\r\n const message = {\r\n handlerName: 'drawOverlays',\r\n args: { tokenId: token.id, actorId },\r\n type: 'UPDATE',\r\n };\r\n game.socket?.emit('module.token-variants', message);\r\n}\r\n","import { FILTERS } from '../../applications/overlayConfig.js';\r\nimport { evaluateComparator, getTokenEffects } from '../hooks/effectMappingHooks.js';\r\nimport { registerOverlayRefreshHook, unregisterOverlayRefreshHooks } from '../hooks/overlayHooks.js';\r\nimport { DEFAULT_OVERLAY_CONFIG } from '../models.js';\r\nimport { interpolateColor, removeMarkedOverlays } from '../token/overlay.js';\r\nimport { executeMacro, toggleCEEffect, toggleTMFXPreset, tv_executeScript } from '../utils.js';\r\nimport { HTMLOverlay } from './HTMLOverlay.js';\r\n\r\nexport class TVAOverlay extends TokenMesh {\r\n constructor(pTexture, token, config) {\r\n super(token);\r\n if (pTexture.shapes) pTexture.shapes = this.addChild(pTexture.shapes);\r\n\r\n this.pseudoTexture = pTexture;\r\n this.texture = pTexture.texture;\r\n //this.setTexture(pTexture, { refresh: false });\r\n\r\n this.ready = false;\r\n this.overlaySort = 0;\r\n\r\n this.overlayConfig = mergeObject(DEFAULT_OVERLAY_CONFIG, config, { inplace: false });\r\n if (pTexture.html) this.addHTMLOverlay();\r\n\r\n // linkDimensions has been converted to linkDimensionsX and linkDimensionsY\r\n // Make sure we're using the latest fields\r\n // 20/07/2023\r\n if (!('linkDimensionsX' in this.overlayConfig) && this.overlayConfig.linkDimensions) {\r\n this.overlayConfig.linkDimensionsX = true;\r\n this.overlayConfig.linkDimensionsY = true;\r\n }\r\n\r\n this._registerHooks(this.overlayConfig);\r\n this._tvaPlay().then(() => this.refresh());\r\n\r\n // Workaround needed for v11 visible property\r\n Object.defineProperty(this, 'visible', {\r\n get: this._customVisible,\r\n set: function () {},\r\n configurable: true,\r\n });\r\n\r\n this.eventMode = 'passive';\r\n this.enableInteractivity(this.overlayConfig);\r\n }\r\n\r\n enableInteractivity() {\r\n if (this.mouseInteractionManager && !this.overlayConfig.interactivity?.length) {\r\n this.removeAllListeners();\r\n this.mouseInteractionManager = null;\r\n this.cursor = null;\r\n this.eventMode = 'passive';\r\n return;\r\n } else if (this.mouseInteractionManager || !this.overlayConfig.interactivity?.length) return;\r\n\r\n if (!this.overlayConfig.ui) {\r\n if (canvas.primary.eventMode === 'passive') {\r\n canvas.primary.eventMode = 'passive';\r\n }\r\n }\r\n\r\n this.eventMode = 'static';\r\n this.cursor = 'pointer';\r\n const token = this.object;\r\n const sprite = this;\r\n\r\n const runInteraction = function (event, listener) {\r\n sprite.overlayConfig.interactivity.forEach((i) => {\r\n if (i.listener === listener) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n if (i.script) tv_executeScript(i.script, { token });\r\n if (i.macro) executeMacro(i.macro, token);\r\n if (i.ceEffect) toggleCEEffect(token, i.ceEffect);\r\n if (i.tmfxPreset) toggleTMFXPreset(token, i.tmfxPreset);\r\n }\r\n });\r\n };\r\n\r\n const permissions = {\r\n hoverIn: () => true,\r\n hoverOut: () => true,\r\n clickLeft: () => true,\r\n clickLeft2: () => true,\r\n clickRight: () => true,\r\n clickRight2: () => true,\r\n dragStart: () => false,\r\n };\r\n\r\n const callbacks = {\r\n hoverIn: (event) => runInteraction(event, 'hoverIn'),\r\n hoverOut: (event) => runInteraction(event, 'hoverOut'),\r\n clickLeft: (event) => runInteraction(event, 'clickLeft'),\r\n clickLeft2: (event) => runInteraction(event, 'clickLeft2'),\r\n clickRight: (event) => runInteraction(event, 'clickRight'),\r\n clickRight2: (event) => runInteraction(event, 'clickRight2'),\r\n dragLeftStart: null,\r\n dragLeftMove: null,\r\n dragLeftDrop: null,\r\n dragLeftCancel: null,\r\n dragRightStart: null,\r\n dragRightMove: null,\r\n dragRightDrop: null,\r\n dragRightCancel: null,\r\n longPress: null,\r\n };\r\n\r\n const options = { target: null };\r\n\r\n // Create the interaction manager\r\n const mgr = new MouseInteractionManager(this, canvas.stage, permissions, callbacks, options);\r\n this.mouseInteractionManager = mgr.activate();\r\n }\r\n\r\n _customVisible() {\r\n const ov = this.overlayConfig;\r\n if (!this.ready || !(this.object.visible || ov.alwaysVisible)) return false;\r\n\r\n if (ov.limitedToOwner && !this.object.owner) return false;\r\n if (ov.limitedUsers?.length && !ov.limitedUsers.includes(game.user.id)) return false;\r\n\r\n if (ov.limitOnEffect || ov.limitOnProperty) {\r\n const speaker = ChatMessage.getSpeaker();\r\n let token = canvas.ready ? canvas.tokens.get(speaker.token) : null;\r\n if (!token) return false;\r\n if (ov.limitOnEffect) {\r\n if (!getTokenEffects(token).includes(ov.limitOnEffect)) return false;\r\n }\r\n if (ov.limitOnProperty) {\r\n if (!evaluateComparator(token.document, ov.limitOnProperty)) return false;\r\n }\r\n }\r\n\r\n if (\r\n ov.limitOnHover ||\r\n ov.limitOnControl ||\r\n ov.limitOnHighlight ||\r\n ov.limitOnHUD ||\r\n ov.limitOnTarget ||\r\n ov.limitOnAnyTarget\r\n ) {\r\n if (ov.limitOnHover && canvas.controls.ruler._state === Ruler.STATES.INACTIVE && this.object.hover) return true;\r\n if (ov.limitOnControl && this.object.controlled) return true;\r\n if (ov.limitOnHighlight && (canvas.tokens.highlightObjects ?? canvas.tokens._highlight)) return true;\r\n if (ov.limitOnHUD && this.object.hasActiveHUD) return true;\r\n if (ov.limitOnAnyTarget && this.object.targeted.size) return true;\r\n if (ov.limitOnTarget && this.object.targeted.some((u) => u.id === game.userId)) return true;\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n // Overlays have the same sort order as the parent\r\n get sort() {\r\n return this.object.document.sort || 0;\r\n }\r\n\r\n get _lastSortedIndex() {\r\n return (this.object.mesh._lastSortedIndex || 0) + this.overlaySort;\r\n }\r\n\r\n get elevation() {\r\n let elevation = this.object.mesh?.data.elevation;\r\n if (this.overlayConfig.top) elevation += 9999;\r\n else if (this.overlayConfig.bottom) elevation -= 9999;\r\n return elevation;\r\n }\r\n\r\n set _lastSortedIndex(val) {}\r\n\r\n async _tvaPlay() {\r\n // Ensure playback state for video\r\n const source = foundry.utils.getProperty(this.texture, 'baseTexture.resource.source');\r\n if (source && source.tagName === 'VIDEO') {\r\n // Detach video from others\r\n const s = source.cloneNode();\r\n\r\n if (this.overlayConfig.playOnce) {\r\n s.onended = () => {\r\n this.alpha = 0;\r\n this.tvaVideoEnded = true;\r\n };\r\n }\r\n\r\n await new Promise((resolve) => (s.oncanplay = resolve));\r\n this.texture = PIXI.Texture.from(s, { resourceOptions: { autoPlay: false } });\r\n\r\n const options = {\r\n loop: this.overlayConfig.loop && !this.overlayConfig.playOnce,\r\n volume: 0,\r\n offset: 0,\r\n playing: true,\r\n };\r\n game.video.play(s, options);\r\n }\r\n }\r\n\r\n addChildAuto(...children) {\r\n if (this.pseudoTexture?.shapes) {\r\n return this.pseudoTexture.shapes.addChild(...children);\r\n } else {\r\n return this.addChild(...children);\r\n }\r\n }\r\n\r\n setTexture(pTexture, { preview = false, refresh = true, configuration = null } = {}) {\r\n // Text preview handling\r\n if (preview) {\r\n this._swapChildren(pTexture);\r\n if (this.originalTexture) this._destroyTexture();\r\n else {\r\n this.originalTexture = this.pseudoTexture;\r\n if (this.originalTexture.shapes) this.removeChild(this.originalTexture.shapes);\r\n }\r\n this.pseudoTexture = pTexture;\r\n this.texture = pTexture.texture;\r\n if (pTexture.shapes) pTexture.shapes = this.addChild(pTexture.shapes);\r\n } else if (this.originalTexture) {\r\n this._swapChildren(this.originalTexture);\r\n this._destroyTexture();\r\n this.pseudoTexture = this.originalTexture;\r\n this.texture = this.originalTexture.texture;\r\n if (this.originalTexture.shapes) this.pseudoTexture.shapes = this.addChild(this.originalTexture.shapes);\r\n delete this.originalTexture;\r\n } else {\r\n this._swapChildren(pTexture);\r\n this._destroyTexture();\r\n this.pseudoTexture = pTexture;\r\n this.texture = pTexture.texture;\r\n if (pTexture.shapes) this.pseudoTexture.shapes = this.addChild(pTexture.shapes);\r\n }\r\n\r\n if (this.pseudoTexture.html) this.addHTMLOverlay();\r\n if (refresh) this.refresh(configuration, { fullRefresh: !preview });\r\n }\r\n\r\n refresh(configuration, { preview = false, fullRefresh = true, previewTexture = null } = {}) {\r\n if (!this.overlayConfig || !this.texture) return;\r\n\r\n // Text preview handling\r\n if (previewTexture || this.originalTexture) {\r\n this.setTexture(previewTexture, { preview: Boolean(previewTexture), refresh: false });\r\n }\r\n\r\n // Register/Unregister hooks that should refresh this overlay\r\n if (configuration) {\r\n this._registerHooks(configuration);\r\n }\r\n\r\n const config = mergeObject(this.overlayConfig, configuration ?? {}, { inplace: !preview });\r\n\r\n if (preview && this.htmlOverlay) this.htmlOverlay.render(config, true);\r\n\r\n this.enableInteractivity(config);\r\n\r\n if (fullRefresh) {\r\n const source = foundry.utils.getProperty(this.texture, 'baseTexture.resource.source');\r\n if (source && source.tagName === 'VIDEO') {\r\n if (!source.loop && config.loop) {\r\n game.video.play(source);\r\n } else if (source.loop && !config.loop) {\r\n game.video.stop(source);\r\n }\r\n source.loop = config.loop;\r\n }\r\n }\r\n\r\n const shapes = this.pseudoTexture.shapes;\r\n\r\n // Scale the image using the same logic as the token\r\n const dimensions = shapes ?? this.texture;\r\n if (config.linkScale && !config.parentID) {\r\n const scale = this.scale;\r\n const aspect = dimensions.width / dimensions.height;\r\n if (aspect >= 1) {\r\n scale.x = (this.object.w * this.object.document.texture.scaleX) / dimensions.width;\r\n scale.y = Number(scale.x);\r\n } else {\r\n scale.y = (this.object.h * this.object.document.texture.scaleY) / dimensions.height;\r\n scale.x = Number(scale.y);\r\n }\r\n } else if (config.linkStageScale) {\r\n this.scale.x = 1 / canvas.stage.scale.x;\r\n this.scale.y = 1 / canvas.stage.scale.y;\r\n } else if (config.linkDimensionsX || config.linkDimensionsY) {\r\n if (config.linkDimensionsX) {\r\n this.scale.x = this.object.document.width;\r\n }\r\n if (config.linkDimensionsY) {\r\n this.scale.y = this.object.document.height;\r\n }\r\n } else {\r\n this.scale.x = config.width ? config.width / dimensions.width : 1;\r\n this.scale.y = config.height ? config.height / dimensions.height : 1;\r\n }\r\n\r\n // Adjust scale according to config\r\n this.scale.x = this.scale.x * config.scaleX;\r\n this.scale.y = this.scale.y * config.scaleY;\r\n\r\n // Check if mirroring should be inherited from the token and if so apply it\r\n if (config.linkMirror && !config.parentID) {\r\n this.scale.x = Math.abs(this.scale.x) * (this.object.document.texture.scaleX < 0 ? -1 : 1);\r\n this.scale.y = Math.abs(this.scale.y) * (this.object.document.texture.scaleY < 0 ? -1 : 1);\r\n }\r\n\r\n if (this.anchor) {\r\n if (!config.anchor) this.anchor.set(0.5, 0.5);\r\n else this.anchor.set(config.anchor.x, config.anchor.y);\r\n }\r\n\r\n let xOff = 0;\r\n let yOff = 0;\r\n if (shapes) {\r\n shapes.position.x = -this.anchor.x * shapes.width;\r\n shapes.position.y = -this.anchor.y * shapes.height;\r\n if (config.animation.relative) {\r\n this.pivot.set(0, 0);\r\n shapes.pivot.set((0.5 - this.anchor.x) * shapes.width, (0.5 - this.anchor.y) * shapes.height);\r\n xOff = shapes.pivot.x * this.scale.x;\r\n yOff = shapes.pivot.y * this.scale.y;\r\n }\r\n } else if (config.animation.relative) {\r\n xOff = (0.5 - this.anchor.x) * this.width;\r\n yOff = (0.5 - this.anchor.y) * this.height;\r\n this.pivot.set((0.5 - this.anchor.x) * this.texture.width, (0.5 - this.anchor.y) * this.texture.height);\r\n }\r\n\r\n // Position\r\n const pOffsetX = config.pOffsetX || 0;\r\n const pOffsetY = config.pOffsetY || 0;\r\n if (config.parentID) {\r\n const anchor = this.parent.anchor ?? { x: 0, y: 0 };\r\n const pWidth = (this.parent.shapesWidth ?? this.parent.width) / this.parent.scale.x;\r\n const pHeight = (this.parent.shapesHeight ?? this.parent.height) / this.parent.scale.y;\r\n this.position.set(\r\n pOffsetX + -config.offsetX * pWidth - anchor.x * pWidth + pWidth / 2,\r\n pOffsetY + -config.offsetY * pHeight - anchor.y * pHeight + pHeight / 2\r\n );\r\n } else {\r\n if (config.animation.relative) {\r\n this.position.set(\r\n this.object.document.x + this.object.w / 2 + pOffsetX + -config.offsetX * this.object.w + xOff,\r\n this.object.document.y + this.object.h / 2 + pOffsetY + -config.offsetY * this.object.h + yOff\r\n );\r\n } else {\r\n this.position.set(this.object.document.x + this.object.w / 2, this.object.document.y + this.object.h / 2);\r\n this.pivot.set(\r\n -pOffsetX / this.scale.x + (config.offsetX * this.object.w) / this.scale.x,\r\n -pOffsetY / this.scale.y + (config.offsetY * this.object.h) / this.scale.y\r\n );\r\n }\r\n }\r\n\r\n // Set alpha but only if playOnce is disabled and the video hasn't\r\n // finished playing yet. Otherwise we want to keep alpha as 0 to keep the video hidden\r\n if (!this.tvaVideoEnded) {\r\n this.alpha = config.linkOpacity ? this.object.document.alpha : config.alpha;\r\n }\r\n\r\n // Angle in degrees\r\n if (fullRefresh) {\r\n if (config.linkRotation) this.angle = this.object.document.rotation + config.angle;\r\n else this.angle = config.angle;\r\n } else if (!config.animation.rotate) {\r\n if (config.linkRotation) this.angle = this.object.document.rotation + config.angle;\r\n }\r\n\r\n // Apply color tinting\r\n const tint = config.inheritTint\r\n ? this.object.document.texture.tint\r\n : interpolateColor(config.tint, config.interpolateColor, true);\r\n this.tint = tint ? Color.from(tint) : 0xffffff;\r\n if (shapes) {\r\n shapes.tint = this.tint;\r\n shapes.alpha = this.alpha;\r\n }\r\n\r\n if (fullRefresh) {\r\n if (config.animation.rotate) {\r\n this.animate(config);\r\n } else {\r\n this.stopAnimation();\r\n }\r\n }\r\n\r\n // Apply filters\r\n if (fullRefresh) this._applyFilters(config);\r\n //if (fullRefresh) this.filters = this._getFilters(config);\r\n\r\n if (preview && this.children) {\r\n this.children.forEach((ch) => {\r\n if (ch instanceof TVAOverlay) ch.refresh(null, { preview: true });\r\n });\r\n }\r\n\r\n if (this.htmlOverlay) {\r\n this.htmlOverlay.setPosition({\r\n left: this.x - this.pivot.x * this.scale.x - this.width * this.anchor.x,\r\n top: this.y - this.pivot.y * this.scale.y - this.height * this.anchor.y,\r\n width: this.width,\r\n height: this.height,\r\n angle: this.angle,\r\n });\r\n }\r\n\r\n this.ready = true;\r\n }\r\n\r\n _activateTicker() {\r\n this._deactivateTicker();\r\n canvas.app.ticker.add(this.updatePosition, this, PIXI.UPDATE_PRIORITY.HIGH);\r\n }\r\n\r\n _deactivateTicker() {\r\n canvas.app.ticker.remove(this.updatePosition, this);\r\n }\r\n\r\n updatePosition() {\r\n let coord = canvas.canvasCoordinatesFromClient({\r\n x: window.innerWidth / 2 + this.overlayConfig.offsetX * window.innerWidth,\r\n y: window.innerHeight / 2 + this.overlayConfig.offsetY * window.innerHeight,\r\n });\r\n this.position.set(coord.x, coord.y);\r\n }\r\n\r\n async _applyFilters(config) {\r\n const filterName = config.filter;\r\n const FilterClass = PIXI.filters[filterName];\r\n const options = mergeObject(FILTERS[filterName]?.defaultValues || {}, config.filterOptions);\r\n let filter;\r\n if (FilterClass) {\r\n if (FILTERS[filterName]?.argType === 'args') {\r\n let args = [];\r\n const controls = FILTERS[filterName]?.controls;\r\n if (controls) {\r\n controls.forEach((c) => args.push(options[c.name]));\r\n }\r\n filter = new FilterClass(...args);\r\n } else if (FILTERS[filterName]?.argType === 'options') {\r\n filter = new FilterClass(options);\r\n } else {\r\n filter = new FilterClass();\r\n }\r\n } else if (filterName === 'OutlineOverlayFilter') {\r\n filter = OutlineFilter.create(options);\r\n filter.thickness = options.trueThickness ?? 1;\r\n filter.animate = options.animate ?? false;\r\n } else if (filterName === 'Token Magic FX') {\r\n this.applyTVAFilters(await constructTMFXFilters(options.params || [], this));\r\n return;\r\n }\r\n\r\n if (filter) {\r\n this.applyTVAFilters([filter]);\r\n this.filters = [filter];\r\n } else {\r\n this.removeTVAFilters();\r\n }\r\n\r\n if (this.overlayConfig.ui && this.overlayConfig.bottom) this.applyReverseMask();\r\n else this.removeReverseMask();\r\n }\r\n\r\n applyReverseMask() {\r\n if (!this.filters?.find((f) => f.tvaReverse)) {\r\n const filters = this.filters || [];\r\n const reverseMask = ReverseMaskFilter.create({\r\n uMaskSampler: canvas.primary.tokensRenderTexture,\r\n channel: 'a',\r\n });\r\n reverseMask.tvaReverse = true;\r\n filters.push(reverseMask);\r\n this.filters = filters;\r\n }\r\n if (!this.filters) filters = [];\r\n }\r\n\r\n removeReverseMask() {\r\n if (this.filters?.length) {\r\n this.filters = this.filters.filter((f) => !f.tvaReverse);\r\n }\r\n }\r\n\r\n applyTVAFilters(filters) {\r\n if (filters?.length) {\r\n this.removeTVAFilters();\r\n this.filters = (this.filters || []).concat(filters);\r\n }\r\n }\r\n\r\n removeTVAFilters() {\r\n if (this.filters) this.filters = this.filters.filter((f) => !f.tvaFilter);\r\n }\r\n\r\n async stopAnimation() {\r\n if (this.animationName) {\r\n CanvasAnimation.terminateAnimation(this.animationName);\r\n }\r\n }\r\n\r\n async animate(config) {\r\n if (!this.animationName) this.animationName = this.object.sourceId + '.' + randomID(5);\r\n\r\n let newAngle = this.angle + (config.animation.clockwise ? 360 : -360);\r\n const rotate = [{ parent: this, attribute: 'angle', to: newAngle }];\r\n\r\n const completed = await CanvasAnimation.animate(rotate, {\r\n duration: config.animation.duration,\r\n name: this.animationName,\r\n });\r\n if (completed) {\r\n this.animate(config);\r\n }\r\n }\r\n\r\n _registerHooks(configuration) {\r\n if (configuration.linkStageScale) registerOverlayRefreshHook(this, 'canvasPan');\r\n else unregisterOverlayRefreshHooks(this, 'canvasPan');\r\n }\r\n\r\n _swapChildren(to) {\r\n const from = this.pseudoTexture;\r\n if (from.shapes) {\r\n this.removeChild(this.pseudoTexture.shapes);\r\n const children = from.shapes.removeChildren();\r\n if (to?.shapes) children.forEach((c) => to.shapes.addChild(c)?.refresh());\r\n else children.forEach((c) => this.addChild(c)?.refresh());\r\n } else if (to?.shapes) {\r\n const children = this.removeChildren();\r\n children.forEach((c) => to.shapes.addChild(c)?.refresh());\r\n }\r\n }\r\n\r\n _destroyTexture() {\r\n if (this.texture.textLabel || this.texture.destroyable) {\r\n this.texture.destroy(true);\r\n }\r\n\r\n if (this.pseudoTexture?.shapes) {\r\n this.removeChild(this.pseudoTexture.shapes);\r\n this.pseudoTexture.shapes.destroy();\r\n } else if (this.pseudoTexture?.html) {\r\n this.removeHTMLOverlay();\r\n }\r\n }\r\n\r\n destroy() {\r\n this.stopAnimation();\r\n unregisterOverlayRefreshHooks(this);\r\n\r\n if (this.children) {\r\n for (const ch of this.children) {\r\n if (ch instanceof TVAOverlay) ch.tvaRemove = true;\r\n }\r\n removeMarkedOverlays(this.object);\r\n if (this.pseudoTexture.shapes) {\r\n this.pseudoTexture.shapes.children.forEach((c) => c.destroy());\r\n this.removeChild(this.pseudoTexture.shapes)?.destroy();\r\n // this.pseudoTexture.shapes.destroy();\r\n }\r\n }\r\n\r\n if (this.texture.textLabel || this.texture.destroyable) {\r\n return super.destroy(true);\r\n } else if (this.texture?.baseTexture.resource?.source?.tagName === 'VIDEO') {\r\n this.texture.baseTexture.destroy();\r\n }\r\n\r\n this.removeHTMLOverlay();\r\n\r\n super.destroy();\r\n }\r\n\r\n // Foundry BUG Fix\r\n calculateTrimmedVertices() {\r\n return PIXI.Sprite.prototype.calculateTrimmedVertices.call(this);\r\n }\r\n\r\n addHTMLOverlay() {\r\n if (!this.htmlOverlay) this.htmlOverlay = new HTMLOverlay(this.overlayConfig, this.object);\r\n }\r\n\r\n removeHTMLOverlay() {\r\n if (this.htmlOverlay) this.htmlOverlay.remove();\r\n this.htmlOverlay = null;\r\n }\r\n}\r\n\r\nasync function constructTMFXFilters(paramsArray, sprite) {\r\n if (typeof TokenMagic === 'undefined') return [];\r\n\r\n try {\r\n paramsArray = eval(paramsArray);\r\n } catch (e) {\r\n return [];\r\n }\r\n\r\n if (!Array.isArray(paramsArray)) {\r\n paramsArray = TokenMagic.getPreset(paramsArray);\r\n }\r\n if (!(paramsArray instanceof Array && paramsArray.length > 0)) return [];\r\n\r\n let filters = [];\r\n for (const params of paramsArray) {\r\n if (!params.hasOwnProperty('filterType') || !TMFXFilterTypes.hasOwnProperty(params.filterType)) {\r\n // one invalid ? all rejected.\r\n return [];\r\n }\r\n\r\n if (!params.hasOwnProperty('rank')) {\r\n params.rank = 5000;\r\n }\r\n\r\n if (!params.hasOwnProperty('filterId') || params.filterId == null) {\r\n params.filterId = randomID();\r\n }\r\n\r\n if (!params.hasOwnProperty('enabled') || !(typeof params.enabled === 'boolean')) {\r\n params.enabled = true;\r\n }\r\n\r\n params.filterInternalId = randomID();\r\n\r\n const gms = game.users.filter((user) => user.isGM);\r\n params.filterOwner = gms.length ? gms[0].id : game.data.userId;\r\n // params.placeableType = placeable._TMFXgetPlaceableType();\r\n params.updateId = randomID();\r\n\r\n const filterClass = await getTMFXFilter(params.filterType);\r\n if (filterClass) {\r\n filterClass.prototype.assignPlaceable = function () {\r\n this.targetPlaceable = sprite.object;\r\n this.placeableImg = sprite;\r\n };\r\n\r\n filterClass.prototype._TMFXsetAnimeFlag = async function () {};\r\n\r\n const filter = new filterClass(params);\r\n if (filter) {\r\n // Patch fixes\r\n filter.placeableImg = sprite;\r\n filter.targetPlaceable = sprite.object;\r\n // end of fixes\r\n filter.tvaFilter = true;\r\n filters.unshift(filter);\r\n }\r\n }\r\n }\r\n return filters;\r\n}\r\n\r\nasync function getTMFXFilter(id) {\r\n if (id in TMFXFilterTypes) {\r\n if (id in LOADED_TMFXFilters) return LOADED_TMFXFilters[id];\r\n else {\r\n try {\r\n const className = TMFXFilterTypes[id];\r\n let fxModule = await import(`../../../tokenmagic/fx/filters/${className}.js`);\r\n if (fxModule && fxModule[className]) {\r\n LOADED_TMFXFilters[id] = fxModule[className];\r\n return fxModule[className];\r\n }\r\n } catch (e) {}\r\n }\r\n }\r\n return null;\r\n}\r\n\r\nconst LOADED_TMFXFilters = {};\r\n\r\nconst TMFXFilterTypes = {\r\n adjustment: 'FilterAdjustment',\r\n distortion: 'FilterDistortion',\r\n oldfilm: 'FilterOldFilm',\r\n glow: 'FilterGlow',\r\n outline: 'FilterOutline',\r\n bevel: 'FilterBevel',\r\n xbloom: 'FilterXBloom',\r\n shadow: 'FilterDropShadow',\r\n twist: 'FilterTwist',\r\n zoomblur: 'FilterZoomBlur',\r\n blur: 'FilterBlur',\r\n bulgepinch: 'FilterBulgePinch',\r\n zapshadow: 'FilterRemoveShadow',\r\n ray: 'FilterRays',\r\n fog: 'FilterFog',\r\n xfog: 'FilterXFog',\r\n electric: 'FilterElectric',\r\n wave: 'FilterWaves',\r\n shockwave: 'FilterShockwave',\r\n fire: 'FilterFire',\r\n fumes: 'FilterFumes',\r\n smoke: 'FilterSmoke',\r\n flood: 'FilterFlood',\r\n images: 'FilterMirrorImages',\r\n field: 'FilterForceField',\r\n xray: 'FilterXRays',\r\n liquid: 'FilterLiquid',\r\n xglow: 'FilterGleamingGlow',\r\n pixel: 'FilterPixelate',\r\n web: 'FilterSpiderWeb',\r\n ripples: 'FilterSolarRipples',\r\n globes: 'FilterGlobes',\r\n transform: 'FilterTransform',\r\n splash: 'FilterSplash',\r\n polymorph: 'FilterPolymorph',\r\n xfire: 'FilterXFire',\r\n sprite: 'FilterSprite',\r\n replaceColor: 'FilterReplaceColor',\r\n ddTint: 'FilterDDTint',\r\n};\r\n\r\nclass OutlineFilter extends OutlineOverlayFilter {\r\n /** @inheritdoc */\r\n static createFragmentShader() {\r\n return `\r\n varying vec2 vTextureCoord;\r\n varying vec2 vFilterCoord;\r\n uniform sampler2D uSampler;\r\n \r\n uniform vec2 thickness;\r\n uniform vec4 outlineColor;\r\n uniform vec4 filterClamp;\r\n uniform float alphaThreshold;\r\n uniform float time;\r\n uniform bool knockout;\r\n uniform bool wave;\r\n \r\n ${this.CONSTANTS}\r\n ${this.WAVE()}\r\n \r\n void main(void) {\r\n float dist = distance(vFilterCoord, vec2(0.5)) * 2.0;\r\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\r\n vec4 wColor = wave ? outlineColor * \r\n wcos(0.0, 1.0, dist * 75.0, \r\n -time * 0.01 + 3.0 * dot(vec4(1.0), ownColor)) \r\n * 0.33 * (1.0 - dist) : vec4(0.0);\r\n float texAlpha = smoothstep(alphaThreshold, 1.0, ownColor.a);\r\n vec4 curColor;\r\n float maxAlpha = 0.;\r\n vec2 displaced;\r\n for ( float angle = 0.0; angle <= TWOPI; angle += ${this.#quality.toFixed(7)} ) {\r\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\r\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\r\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\r\n curColor.a = clamp((curColor.a - 0.6) * 2.5, 0.0, 1.0);\r\n maxAlpha = max(maxAlpha, curColor.a);\r\n }\r\n float resultAlpha = max(maxAlpha, texAlpha);\r\n vec3 result = (ownColor.rgb + outlineColor.rgb * (1.0 - texAlpha)) * resultAlpha;\r\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\r\n }\r\n `;\r\n }\r\n\r\n static get #quality() {\r\n switch (canvas.performance.mode) {\r\n case CONST.CANVAS_PERFORMANCE_MODES.LOW:\r\n return (Math.PI * 2) / 10;\r\n case CONST.CANVAS_PERFORMANCE_MODES.MED:\r\n return (Math.PI * 2) / 20;\r\n default:\r\n return (Math.PI * 2) / 30;\r\n }\r\n }\r\n}\r\n","import { FEATURE_CONTROL } from '../settings.js';\r\nimport { HTMLOverlay } from '../sprite/HTMLOverlay.js';\r\nimport { TVAOverlay } from '../sprite/TVAOverlay.js';\r\nimport { drawOverlays } from '../token/overlay.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\n\r\nconst feature_id = 'Overlays';\r\n\r\nexport function registerOverlayHooks() {\r\n if (!FEATURE_CONTROL[feature_id]) {\r\n [\r\n 'refreshToken',\r\n 'destroyToken',\r\n 'updateActor',\r\n 'renderCombatTracker',\r\n 'updateToken',\r\n 'createToken',\r\n 'renderHeadsUpDisplay',\r\n ].forEach((id) => unregisterHook(feature_id, id));\r\n return;\r\n }\r\n\r\n registerHook(feature_id, 'createToken', async function (token) {\r\n if (token.object) drawOverlays(token.object);\r\n });\r\n\r\n registerHook(feature_id, 'updateToken', async function (token) {\r\n if (token.object) drawOverlays(token.object);\r\n });\r\n\r\n registerHook(feature_id, 'refreshToken', (token) => {\r\n if (token.tvaOverlays)\r\n for (const child of token.tvaOverlays) {\r\n if (child instanceof TVAOverlay) {\r\n child.refresh(null, { preview: false, fullRefresh: false });\r\n }\r\n }\r\n });\r\n\r\n registerHook(feature_id, 'destroyToken', (token) => {\r\n if (token.tvaOverlays)\r\n for (const child of token.tvaOverlays) {\r\n child.parent?.removeChild(child)?.destroy();\r\n }\r\n });\r\n\r\n registerHook(feature_id, 'updateActor', async function (actor) {\r\n if (actor.getActiveTokens)\r\n actor.getActiveTokens(true).forEach((token) => {\r\n drawOverlays(token);\r\n });\r\n });\r\n\r\n registerHook(feature_id, 'renderCombatTracker', function () {\r\n for (const tkn of canvas.tokens.placeables) {\r\n drawOverlays(tkn);\r\n }\r\n });\r\n\r\n registerHook(feature_id, 'renderHeadsUpDisplay', () => {\r\n HTMLOverlay.hudRendered();\r\n });\r\n}\r\n\r\nconst REFRESH_HOOKS = {};\r\n\r\nexport function registerOverlayRefreshHook(tvaOverlay, hookName) {\r\n if (!(hookName in REFRESH_HOOKS)) {\r\n registerHook('TVAOverlayRefresh', hookName, () => {\r\n REFRESH_HOOKS[hookName]?.forEach((s) => s.refresh());\r\n });\r\n REFRESH_HOOKS[hookName] = [tvaOverlay];\r\n } else if (!REFRESH_HOOKS[hookName].find((s) => s == tvaOverlay)) {\r\n REFRESH_HOOKS[hookName].push(tvaOverlay);\r\n }\r\n}\r\n\r\nexport function unregisterOverlayRefreshHooks(tvaOverlay, hookName = null) {\r\n const unregister = function (hook) {\r\n if (REFRESH_HOOKS[hook]) {\r\n let index = REFRESH_HOOKS[hook].findIndex((s) => s == tvaOverlay);\r\n if (index > -1) {\r\n REFRESH_HOOKS[hook].splice(index, 1);\r\n if (!REFRESH_HOOKS[hook].length) {\r\n unregisterHook('TVAOverlayRefresh', hook);\r\n delete REFRESH_HOOKS[hook];\r\n }\r\n }\r\n }\r\n };\r\n\r\n if (hookName) unregister(hookName);\r\n else {\r\n Object.keys(REFRESH_HOOKS).forEach((k) => unregister(k));\r\n }\r\n}\r\n","export class HTMLOverlay {\r\n static container = null;\r\n static renderQueue = [];\r\n static hudReady = false;\r\n\r\n static hudRendered() {\r\n HTMLOverlay.hudReady = true;\r\n HTMLOverlay.renderQueue.forEach((ov) => ov.render());\r\n HTMLOverlay.renderQueue = [];\r\n }\r\n\r\n constructor(overlayConfig, token) {\r\n this.overlayConfig = overlayConfig;\r\n this.token = token;\r\n this.render();\r\n }\r\n\r\n render(overlayConfig = null, force = false) {\r\n if (!HTMLOverlay.hudReady) {\r\n HTMLOverlay.renderQueue.push(this);\r\n return;\r\n }\r\n\r\n if (!HTMLOverlay.container) {\r\n HTMLOverlay.container = $('<div id=\"tva-html-overlays\"></div>');\r\n $('#hud').append(HTMLOverlay.container);\r\n }\r\n\r\n if (this.element) this.remove();\r\n if (overlayConfig) this.overlayConfig = overlayConfig;\r\n\r\n this.element = $(renderTemplate(this.overlayConfig, this.getData(), force));\r\n HTMLOverlay.container.append(this.element);\r\n this.activateListeners(this.element);\r\n this.setPosition();\r\n }\r\n\r\n remove() {\r\n if (this.element) this.element.remove();\r\n this.element = null;\r\n }\r\n\r\n getData(options = {}) {\r\n const data = this.token.document.toObject();\r\n return foundry.utils.mergeObject(data, {\r\n isGM: game.user.isGM,\r\n });\r\n }\r\n\r\n setPosition({ left, top, width, height, scale, angle, origin } = {}) {\r\n if (!HTMLOverlay.hudReady) return;\r\n const ratio = canvas.dimensions.size / 100;\r\n const position = {\r\n width: width || this.token.document.width * 100,\r\n height: height || this.token.document.height * 100,\r\n left: left ?? this.token.document.x,\r\n top: top ?? this.token.document.y,\r\n };\r\n if (ratio !== 1) position.transform = `scale(${ratio})`;\r\n this.element.css(position);\r\n if (angle != null) {\r\n this.element.css({ transform: 'rotate(' + angle + 'deg)' });\r\n }\r\n if (origin != null) {\r\n this.element.css({ 'transform-origin': origin.x + 'px ' + origin.y + 'px' });\r\n }\r\n }\r\n\r\n /** @override */\r\n activateListeners(html) {\r\n try {\r\n eval(this.overlayConfig.html.listeners);\r\n } catch (e) {}\r\n }\r\n}\r\n\r\nconst _templateCache = {};\r\n\r\nfunction _compile(stringHTML) {\r\n return Handlebars.compile(\r\n '<div class=\"tva-html-overlay\"> <section class=\"window-content\"><form>' + stringHTML + '</form></section></div>'\r\n );\r\n}\r\n\r\nfunction constructTemplate(ovConfig, force = false) {\r\n if (!_templateCache.hasOwnProperty(ovConfig.id)) {\r\n const compiled = _compile(ovConfig.html.template);\r\n Handlebars.registerPartial(ovConfig.id, compiled);\r\n _templateCache[ovConfig.id] = compiled;\r\n } else if (force) {\r\n return _compile(ovConfig.html.template);\r\n }\r\n return _templateCache[ovConfig.id];\r\n}\r\n\r\nfunction renderTemplate(ovConfig, data, force = false) {\r\n const template = constructTemplate(ovConfig, force);\r\n console.log(data.x);\r\n return template(data || {}, {\r\n allowProtoMethodsByDefault: true,\r\n allowProtoPropertiesByDefault: true,\r\n });\r\n}\r\n","import { registerEffectIconHooks } from './effectIconHooks.js';\r\nimport { registerArtSelectButtonHooks } from './artSelectButtonHooks.js';\r\nimport { registerOverlayHooks } from './overlayHooks.js';\r\nimport { registerEffectMappingHooks } from './effectMappingHooks.js';\r\nimport { registerHUDHooks } from './hudHooks.js';\r\nimport { registerUserMappingHooks } from './userMappingHooks.js';\r\nimport { registerWildcardHooks } from './wildcardHooks.js';\r\nimport { registerPopRandomizeHooks } from './popUpRandomizeHooks.js';\r\nimport { TVA_CONFIG } from '../settings.js';\r\n\r\nexport const REGISTERED_HOOKS = {};\r\n\r\nexport function registerHook(feature_id, name, fn, { once = false } = {}) {\r\n if (!(feature_id in REGISTERED_HOOKS)) REGISTERED_HOOKS[feature_id] = {};\r\n if (name in REGISTERED_HOOKS[feature_id]) return;\r\n if (TVA_CONFIG.debug) console.info(`TVA | Registering Hook`, { feature_id, name, fn, once });\r\n const num = Hooks.on(name, fn, { once });\r\n REGISTERED_HOOKS[feature_id][name] = num;\r\n}\r\n\r\nexport function unregisterHook(feature_id, name) {\r\n if (feature_id in REGISTERED_HOOKS && name in REGISTERED_HOOKS[feature_id]) {\r\n if (TVA_CONFIG.debug)\r\n console.info(`TVA | Un-Registering Hook`, {\r\n feature_id,\r\n name,\r\n id: REGISTERED_HOOKS[feature_id][name],\r\n });\r\n Hooks.off(name, REGISTERED_HOOKS[feature_id][name]);\r\n delete REGISTERED_HOOKS[feature_id][name];\r\n }\r\n}\r\n\r\nexport function registerAllHooks() {\r\n // Hide effect icons\r\n registerEffectIconHooks();\r\n // Display overlays\r\n registerOverlayHooks();\r\n // Insert Art Select buttons and contextmenu listeners\r\n registerArtSelectButtonHooks();\r\n // Effect Mapping related listening for state changes and applying configurations\r\n registerEffectMappingHooks();\r\n // Display HUD buttons for Tokens and Tiles\r\n registerHUDHooks();\r\n // Default Wildcard image controls\r\n registerWildcardHooks();\r\n // User to Image mappings for Tile and Tokens\r\n registerUserMappingHooks();\r\n // Handle pop-ups and randomization on token/actor create\r\n registerPopRandomizeHooks();\r\n}\r\n","import { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\n\r\nconst feature_id = 'EffectIcons';\r\n\r\nexport function registerEffectIconHooks() {\r\n // OnHover settings specific hooks\r\n if (FEATURE_CONTROL[feature_id] && TVA_CONFIG.displayEffectIconsOnHover) {\r\n registerHook(feature_id, 'hoverToken', (token, hoverIn) => {\r\n if (token.effects) {\r\n token.effects.visible = hoverIn;\r\n }\r\n });\r\n } else {\r\n unregisterHook(feature_id, 'hoverToken');\r\n }\r\n\r\n if (FEATURE_CONTROL[feature_id] && TVA_CONFIG.displayEffectIconsOnHover) {\r\n registerHook(feature_id, 'highlightObjects', (active) => {\r\n if (canvas.tokens.active) {\r\n for (const tkn of canvas.tokens.placeables) {\r\n if (tkn.effects) {\r\n tkn.effects.visible = active || tkn.hover;\r\n }\r\n }\r\n }\r\n });\r\n } else {\r\n unregisterHook(feature_id, 'highlightObjects');\r\n }\r\n}\r\n","import { insertArtSelectButton } from '../../applications/artSelect.js';\r\nimport { showArtSelect } from '../../token-variants.mjs';\r\nimport { TVA_CONFIG } from '../settings.js';\r\nimport { SEARCH_TYPE, updateActorImage } from '../utils.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\n\r\nconst feature_id = 'ArtSelect';\r\n\r\nexport function registerArtSelectButtonHooks() {\r\n // Insert right-click listeners to open up ArtSelect forms from various contexts\r\n if (TVA_CONFIG.permissions.portrait_right_click[game.user.role]) {\r\n registerHook(feature_id, 'renderActorSheet', _modActorSheet);\r\n registerHook(feature_id, 'renderItemSheet', _modItemSheet);\r\n registerHook(feature_id, 'renderItemActionSheet', _modItemSheet);\r\n registerHook(feature_id, 'renderJournalSheet', _modJournalSheet);\r\n registerHook(feature_id, 'renderRollTableConfig', _modRollTableSheet);\r\n } else {\r\n [\r\n 'renderActorSheet',\r\n 'renderItemSheet',\r\n 'renderItemActionSheet',\r\n 'renderJournalSheet',\r\n 'renderRollTableConfig',\r\n ].forEach((name) => unregisterHook(feature_id, name));\r\n }\r\n\r\n // Insert buttons\r\n if (TVA_CONFIG.permissions.image_path_button[game.user.role]) {\r\n registerHook(feature_id, 'renderTileConfig', _modTileConfig);\r\n registerHook(feature_id, 'renderMeasuredTemplateConfig', _modTemplateConfig);\r\n registerHook(feature_id, 'renderTokenConfig', _modTokenConfig);\r\n registerHook(feature_id, 'renderDrawingConfig', _modDrawingConfig);\r\n registerHook(feature_id, 'renderNoteConfig', _modNoteConfig);\r\n registerHook(feature_id, 'renderSceneConfig', _modSceneConfig);\r\n registerHook(feature_id, 'renderMacroConfig', _modMacroConfig);\r\n registerHook(feature_id, 'renderActiveEffectConfig', _modActiveEffectConfig);\r\n } else {\r\n [\r\n 'renderTileConfig',\r\n 'renderMeasuredTemplateConfig',\r\n 'renderTokenConfig',\r\n 'renderDrawingConfig',\r\n 'renderNoteConfig',\r\n 'renderSceneConfig',\r\n `renderActiveEffectConfig`,\r\n ].forEach((name) => unregisterHook(feature_id, name));\r\n }\r\n}\r\n\r\nfunction _modTokenConfig(config, html) {\r\n insertArtSelectButton(html, 'texture.src', {\r\n search: config.object.name,\r\n searchType: SEARCH_TYPE.TOKEN,\r\n });\r\n}\r\n\r\nfunction _modTemplateConfig(config, html) {\r\n insertArtSelectButton(html, 'texture', { search: 'Template', searchType: SEARCH_TYPE.TILE });\r\n}\r\n\r\nfunction _modDrawingConfig(config, html) {\r\n insertArtSelectButton(html, 'texture', {\r\n search: 'Drawing',\r\n searchType: TVA_CONFIG.customImageCategories.includes('Drawing') ? 'Drawing' : SEARCH_TYPE.TILE,\r\n });\r\n}\r\n\r\nfunction _modNoteConfig(config, html) {\r\n insertArtSelectButton(html, 'icon.custom', {\r\n search: 'Note',\r\n searchType: TVA_CONFIG.customImageCategories.includes('Note') ? 'Note' : SEARCH_TYPE.ITEM,\r\n });\r\n}\r\n\r\nfunction _modSceneConfig(config, html) {\r\n insertArtSelectButton(html, 'background.src', {\r\n search: config.object.name,\r\n searchType: TVA_CONFIG.customImageCategories.includes('Scene') ? 'Scene' : SEARCH_TYPE.TILE,\r\n });\r\n insertArtSelectButton(html, 'foreground', {\r\n search: config.object.name,\r\n searchType: TVA_CONFIG.customImageCategories.includes('Scene') ? 'Scene' : SEARCH_TYPE.TILE,\r\n });\r\n insertArtSelectButton(html, 'fogOverlay', {\r\n search: config.object.name,\r\n searchType: TVA_CONFIG.customImageCategories.includes('Fog') ? 'Fog' : SEARCH_TYPE.TILE,\r\n });\r\n}\r\n\r\nfunction _modTileConfig(tileConfig, html) {\r\n insertArtSelectButton(html, 'texture.src', {\r\n search: tileConfig.object.getFlag('token-variants', 'tileName') || 'Tile',\r\n searchType: SEARCH_TYPE.TILE,\r\n });\r\n}\r\n\r\nfunction _modActiveEffectConfig(effectConfig, html) {\r\n const inserted = insertArtSelectButton(html, 'icon', {\r\n search: effectConfig.object.name || 'Active Effect',\r\n searchType: TVA_CONFIG.customImageCategories.includes('Active Effect') ? 'Active Effect' : SEARCH_TYPE.ITEM,\r\n });\r\n if (!inserted) {\r\n const img = $(html).find('.effect-icon');\r\n img.on('contextmenu', () => {\r\n showArtSelect(effectConfig.object?.name ?? 'Active Effect', {\r\n searchType: SEARCH_TYPE.ITEM,\r\n callback: (imgSrc) => img.attr('src', imgSrc),\r\n });\r\n });\r\n }\r\n}\r\n\r\nfunction _modItemSheet(itemSheet, html, options) {\r\n $(html)\r\n .find('img.profile, .profile-img, [data-edit=\"img\"]')\r\n .on('contextmenu', () => {\r\n const item = itemSheet.object;\r\n if (!item) return;\r\n showArtSelect(item.name, {\r\n searchType: SEARCH_TYPE.ITEM,\r\n callback: (imgSrc) => item.update({ img: imgSrc }),\r\n });\r\n });\r\n}\r\n\r\nfunction _modMacroConfig(macroConfig, html, options) {\r\n const img = $(html).find('.sheet-header > img');\r\n img.on('contextmenu', () => {\r\n showArtSelect(macroConfig.object?.name ?? 'Macro', {\r\n searchType: SEARCH_TYPE.MACRO,\r\n callback: (imgSrc) => img.attr('src', imgSrc),\r\n });\r\n });\r\n}\r\n\r\nfunction _modJournalSheet(journalSheet, html, options) {\r\n $(html)\r\n .find('.header-button.entry-image')\r\n .on('contextmenu', () => {\r\n const journal = journalSheet.object;\r\n if (!journal) return;\r\n showArtSelect(journal.name, {\r\n searchType: SEARCH_TYPE.JOURNAL,\r\n callback: (imgSrc) => journal.update({ img: imgSrc }),\r\n });\r\n });\r\n}\r\n\r\nfunction _modRollTableSheet(sheet, html) {\r\n $(html)\r\n .find('.result-image')\r\n .on('contextmenu', (event) => {\r\n const table = sheet.object;\r\n if (!table) return;\r\n const img = $(event.target).closest('.result-image').find('img');\r\n showArtSelect(table.name, {\r\n searchType: TVA_CONFIG.customImageCategories.includes('RollTable') ? 'RollTable' : SEARCH_TYPE.ITEM,\r\n callback: (imgSrc) => {\r\n img.attr('src', imgSrc);\r\n sheet._onSubmit(event);\r\n },\r\n });\r\n });\r\n}\r\n\r\n/**\r\n * Adds right-click listener to Actor Sheet profile image to open up\r\n * the 'Art Select' screen.\r\n */\r\nfunction _modActorSheet(actorSheet, html, options) {\r\n if (options.editable && TVA_CONFIG.permissions.portrait_right_click[game.user.role]) {\r\n let profile = null;\r\n let profileQueries = {\r\n all: ['.profile', '.profile-img', '.profile-image'],\r\n pf2e: ['.player-image', '.actor-icon', '.sheet-header img', '.actor-image'],\r\n };\r\n\r\n for (let query of profileQueries.all) {\r\n profile = html[0].querySelector(query);\r\n if (profile) break;\r\n }\r\n\r\n if (!profile && game.system.id in profileQueries) {\r\n for (let query of profileQueries[game.system.id]) {\r\n profile = html[0].querySelector(query);\r\n if (profile) break;\r\n }\r\n }\r\n\r\n if (!profile) {\r\n console.warn('TVA |', game.i18n.localize('token-variants.notifications.warn.profile-image-not-found'));\r\n return;\r\n }\r\n\r\n profile.addEventListener(\r\n 'contextmenu',\r\n function (ev) {\r\n showArtSelect(actorSheet.object.name, {\r\n callback: (imgSrc, name) => updateActorImage(actorSheet.object, imgSrc),\r\n searchType: SEARCH_TYPE.PORTRAIT,\r\n object: actorSheet.object,\r\n });\r\n },\r\n false\r\n );\r\n }\r\n}\r\n","import { renderTileHUD } from '../../applications/tileHUD.js';\r\nimport { renderTokenHUD } from '../../applications/tokenHUD.js';\r\nimport { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\n\r\nconst feature_id = 'HUD';\r\n\r\nexport function registerHUDHooks() {\r\n if (FEATURE_CONTROL[feature_id] && TVA_CONFIG.tilesEnabled) {\r\n registerHook(feature_id, 'renderTileHUD', renderTileHUD);\r\n } else {\r\n unregisterHook(feature_id, 'renderTileHUD');\r\n }\r\n\r\n if (\r\n FEATURE_CONTROL[feature_id] &&\r\n (TVA_CONFIG.permissions.hudFullAccess[game.user.role] || TVA_CONFIG.permissions.hud[game.user.role])\r\n ) {\r\n registerHook(feature_id, 'renderTokenHUD', renderTokenHUD);\r\n } else {\r\n unregisterHook(feature_id, 'renderTokenHUD');\r\n }\r\n}\r\n","import { getFileName, isImage, isVideo, SEARCH_TYPE, keyPressed } from '../scripts/utils.js';\r\nimport { TVA_CONFIG } from '../scripts/settings.js';\r\nimport FlagsConfig from './flagsConfig.js';\r\nimport { doImageSearch } from '../scripts/search.js';\r\nimport UserList from './userList.js';\r\n\r\nexport async function renderTileHUD(hud, html, tileData, searchText = '', fp_files = null) {\r\n const tile = hud.object;\r\n const hudSettings = TVA_CONFIG.hud;\r\n\r\n if (!hudSettings.enableSideMenu || !TVA_CONFIG.tilesEnabled) return;\r\n\r\n const button = $(`\r\n <div class=\"control-icon\" data-action=\"token-variants-side-selector\">\r\n <img\r\n id=\"token-variants-side-button\"\r\n src=\"modules/token-variants/img/token-images.svg\"\r\n width=\"36\"\r\n height=\"36\"\r\n title=\"${game.i18n.localize('token-variants.windows.art-select.select-variant')}\"\r\n />\r\n </div>\r\n`);\r\n\r\n html.find('div.right').last().append(button);\r\n html.find('div.right').click(_deactivateTokenVariantsSideSelector);\r\n\r\n button.click((event) => _onButtonClick(event, tile));\r\n button.contextmenu((event) => _onButtonRightClick(event, tile));\r\n}\r\n\r\nasync function _onButtonClick(event, tile) {\r\n if (keyPressed('config')) {\r\n setNameDialog(tile);\r\n return;\r\n }\r\n\r\n const button = $(event.target).closest('.control-icon');\r\n\r\n // De-activate 'Status Effects'\r\n button.closest('div.right').find('div.control-icon.effects').removeClass('active');\r\n button.closest('div.right').find('.status-effects').removeClass('active');\r\n\r\n // Remove contextmenu\r\n button.find('.contextmenu').remove();\r\n\r\n // Toggle variants side menu\r\n button.toggleClass('active');\r\n let variantsWrap = button.find('.token-variants-wrap');\r\n if (button.hasClass('active')) {\r\n if (!variantsWrap.length) {\r\n variantsWrap = await renderSideSelect(tile);\r\n if (variantsWrap) button.find('img').after(variantsWrap);\r\n else return;\r\n }\r\n variantsWrap.addClass('active');\r\n } else {\r\n variantsWrap.removeClass('active');\r\n }\r\n}\r\n\r\nfunction _onButtonRightClick(event, tile) {\r\n // Display side menu if button is not active yet\r\n const button = $(event.target).closest('.control-icon');\r\n if (!button.hasClass('active')) {\r\n // button.trigger('click');\r\n button.addClass('active');\r\n }\r\n\r\n if (button.find('.contextmenu').length) {\r\n // Contextmenu already displayed. Remove and activate images\r\n button.find('.contextmenu').remove();\r\n button.removeClass('active').trigger('click');\r\n //button.find('.token-variants-wrap.images').addClass('active');\r\n } else {\r\n // Contextmenu is not displayed. Hide images, create it and add it\r\n button.find('.token-variants-wrap.images').removeClass('active');\r\n const contextMenu = $(`\r\n <div class=\"token-variants-wrap contextmenu active\">\r\n <div class=\"token-variants-context-menu active\">\r\n <input class=\"token-variants-side-search\" type=\"text\" />\r\n <button class=\"flags\" type=\"button\"><i class=\"fab fa-font-awesome-flag\"></i><label>Flags</label></button>\r\n <button class=\"file-picker\" type=\"button\"><i class=\"fas fa-file-import fa-fw\"></i><label>Browse Folders</label></button>\r\n </div>\r\n </div>\r\n `);\r\n button.append(contextMenu);\r\n\r\n // Register contextmenu listeners\r\n contextMenu\r\n .find('.token-variants-side-search')\r\n .on('keydown', (event) => _onImageSearchKeyUp(event, tile))\r\n .on('click', (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n });\r\n contextMenu.find('.flags').click((event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n new FlagsConfig(tile).render(true);\r\n });\r\n contextMenu.find('.file-picker').click(async (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n new FilePicker({\r\n type: 'folder',\r\n callback: async (path, fp) => {\r\n const content = await FilePicker.browse(fp.activeSource, fp.result.target);\r\n let files = content.files.filter((f) => isImage(f) || isVideo(f));\r\n if (files.length) {\r\n button.find('.token-variants-wrap').remove();\r\n const sideSelect = await renderSideSelect(tile, null, files);\r\n if (sideSelect) {\r\n sideSelect.addClass('active');\r\n button.append(sideSelect);\r\n }\r\n }\r\n },\r\n }).render(true);\r\n });\r\n }\r\n}\r\n\r\nfunction _deactivateTokenVariantsSideSelector(event) {\r\n const controlIcon = $(event.target).closest('.control-icon');\r\n const dataAction = controlIcon.attr('data-action');\r\n\r\n switch (dataAction) {\r\n case 'effects':\r\n break; // Effects button\r\n case 'thwildcard-selector':\r\n break; // Token HUD Wildcard module button\r\n default:\r\n return;\r\n }\r\n\r\n $(event.target)\r\n .closest('div.right')\r\n .find('.control-icon[data-action=\"token-variants-side-selector\"]')\r\n .removeClass('active');\r\n $(event.target).closest('div.right').find('.token-variants-wrap').removeClass('active');\r\n}\r\n\r\nasync function renderSideSelect(tile, searchText = null, fp_files = null) {\r\n const hudSettings = TVA_CONFIG.hud;\r\n const worldHudSettings = TVA_CONFIG.worldHud;\r\n const FULL_ACCESS = TVA_CONFIG.permissions.hudFullAccess[game.user.role];\r\n let images = [];\r\n let variants = [];\r\n let imageDuplicates = new Set();\r\n const pushImage = (img) => {\r\n if (imageDuplicates.has(img.path)) {\r\n if (!images.find((obj) => obj.path === img.path && obj.name === img.name)) {\r\n images.push(img);\r\n }\r\n } else {\r\n images.push(img);\r\n imageDuplicates.add(img.path);\r\n }\r\n };\r\n\r\n if (!fp_files) {\r\n if (searchText !== null && !searchText) return;\r\n\r\n if (!searchText) {\r\n variants = tile.document.getFlag('token-variants', 'variants') || [];\r\n variants.forEach((variant) => {\r\n for (const name of variant.names) {\r\n pushImage({ path: variant.imgSrc, name: name });\r\n }\r\n });\r\n\r\n // Parse directory flag and include the images\r\n const directoryFlag = tile.document.getFlag('token-variants', 'directory');\r\n if (directoryFlag) {\r\n let dirFlagImages;\r\n try {\r\n let path = directoryFlag.path;\r\n let source = directoryFlag.source;\r\n let bucket = '';\r\n if (source.startsWith('s3:')) {\r\n bucket = source.substring(3, source.length);\r\n source = 's3';\r\n }\r\n const content = await FilePicker.browse(source, path, {\r\n type: 'imagevideo',\r\n bucket,\r\n });\r\n dirFlagImages = content.files;\r\n } catch (err) {\r\n dirFlagImages = [];\r\n }\r\n dirFlagImages.forEach((f) => {\r\n if (isImage(f) || isVideo(f)) pushImage({ path: f, name: getFileName(f) });\r\n });\r\n }\r\n }\r\n\r\n // Perform the search if needed\r\n const search = searchText ?? tile.document.getFlag('token-variants', 'tileName');\r\n const noSearch = !search || (!searchText && worldHudSettings.displayOnlySharedImages);\r\n let artSearch = noSearch\r\n ? null\r\n : await doImageSearch(search, {\r\n searchType: SEARCH_TYPE.TILE,\r\n searchOptions: { keywordSearch: worldHudSettings.includeKeywords },\r\n });\r\n\r\n if (artSearch) {\r\n artSearch.forEach((results) => {\r\n images.push(...results);\r\n });\r\n }\r\n } else {\r\n images = fp_files.map((f) => {\r\n return { path: f, name: getFileName(f) };\r\n });\r\n }\r\n\r\n // Retrieving the possibly custom name attached as a flag to the token\r\n let tileImageName = tile.document.getFlag('token-variants', 'name');\r\n if (!tileImageName) {\r\n tileImageName = getFileName(tile.document.texture.src);\r\n }\r\n\r\n let imagesParsed = [];\r\n\r\n for (const imageObj of images) {\r\n const img = isImage(imageObj.path);\r\n const vid = isVideo(imageObj.path);\r\n\r\n let shared = false;\r\n if (game.user.isGM) {\r\n variants.forEach((variant) => {\r\n if (variant.imgSrc === imageObj.path && variant.names.includes(imageObj.name)) {\r\n shared = true;\r\n }\r\n });\r\n }\r\n\r\n const userMappings = tile.document.getFlag('token-variants', 'userMappings') || {};\r\n const [title, style] = genTitleAndStyle(userMappings, imageObj.path, imageObj.name);\r\n\r\n imagesParsed.push({\r\n route: imageObj.path,\r\n name: imageObj.name,\r\n used: imageObj.path === tile.document.texture.src && imageObj.name === tileImageName,\r\n img,\r\n vid,\r\n unknownType: !img && !vid,\r\n shared: shared,\r\n hasConfig: false, //hasConfig,\r\n title: title,\r\n style: game.user.isGM && style ? 'box-shadow: ' + style + ';' : null,\r\n });\r\n }\r\n\r\n //\r\n // Render\r\n //\r\n const imageDisplay = hudSettings.displayAsImage;\r\n const imageOpacity = hudSettings.imageOpacity / 100;\r\n\r\n const sideSelect = $(\r\n await renderTemplate('modules/token-variants/templates/sideSelect.html', {\r\n imagesParsed,\r\n imageDisplay,\r\n imageOpacity,\r\n autoplay: !TVA_CONFIG.playVideoOnHover,\r\n })\r\n );\r\n\r\n // Activate listeners\r\n sideSelect.find('video').hover(\r\n function () {\r\n if (TVA_CONFIG.playVideoOnHover) {\r\n this.play();\r\n $(this).siblings('.fa-play').hide();\r\n }\r\n },\r\n function () {\r\n if (TVA_CONFIG.pauseVideoOnHoverOut) {\r\n this.pause();\r\n this.currentTime = 0;\r\n $(this).siblings('.fa-play').show();\r\n }\r\n }\r\n );\r\n sideSelect.find('.token-variants-button-select').click((event) => _onImageClick(event, tile));\r\n\r\n if (FULL_ACCESS) {\r\n sideSelect\r\n .find('.token-variants-button-select')\r\n .on('contextmenu', (event) => _onImageRightClick(event, tile));\r\n }\r\n\r\n return sideSelect;\r\n}\r\n\r\nasync function _onImageClick(event, tile) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!tile) return;\r\n\r\n const imgButton = $(event.target).closest('.token-variants-button-select');\r\n const imgSrc = imgButton.attr('data-name');\r\n const name = imgButton.attr('data-filename');\r\n if (imgSrc) {\r\n canvas.tiles.hud.clear();\r\n await tile.document.update({ img: imgSrc });\r\n try {\r\n if (getFileName(imgSrc) !== name) await tile.document.setFlag('token-variants', 'name', name);\r\n } catch (e) {}\r\n }\r\n}\r\n\r\nasync function _onImageRightClick(event, tile) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!tile) return;\r\n\r\n const imgButton = $(event.target).closest('.token-variants-button-select');\r\n const imgSrc = imgButton.attr('data-name');\r\n const name = imgButton.attr('data-filename');\r\n\r\n if (!imgSrc || !name) return;\r\n\r\n if (keyPressed('config') && game.user.isGM) {\r\n const regenStyle = (tile, img) => {\r\n const mappings = tile.document.getFlag('token-variants', 'userMappings') || {};\r\n const name = imgButton.attr('data-filename');\r\n const [title, style] = genTitleAndStyle(mappings, img, name);\r\n imgButton\r\n .closest('.token-variants-wrap')\r\n .find(`.token-variants-button-select[data-name='${img}']`)\r\n .css('box-shadow', style)\r\n .prop('title', title);\r\n };\r\n new UserList(tile, imgSrc, regenStyle).render(true);\r\n return;\r\n }\r\n\r\n let variants = tile.document.getFlag('token-variants', 'variants') || [];\r\n\r\n // Remove selected variant if present in the flag, add otherwise\r\n let del = false;\r\n let updated = false;\r\n for (let variant of variants) {\r\n if (variant.imgSrc === imgSrc) {\r\n let fNames = variant.names.filter((name) => name !== name);\r\n if (fNames.length === 0) {\r\n del = true;\r\n } else if (fNames.length === variant.names.length) {\r\n fNames.push(name);\r\n }\r\n variant.names = fNames;\r\n updated = true;\r\n break;\r\n }\r\n }\r\n if (del) variants = variants.filter((variant) => variant.imgSrc !== imgSrc);\r\n else if (!updated) variants.push({ imgSrc: imgSrc, names: [name] });\r\n\r\n // Set shared variants as a flag\r\n tile.document.unsetFlag('token-variants', 'variants');\r\n if (variants.length > 0) {\r\n tile.document.setFlag('token-variants', 'variants', variants);\r\n }\r\n imgButton.find('.fa-share').toggleClass('active'); // Display green arrow\r\n}\r\n\r\nasync function _onImageSearchKeyUp(event, tile) {\r\n if (event.key === 'Enter' || event.keyCode === 13) {\r\n event.preventDefault();\r\n if (event.target.value.length >= 3) {\r\n const button = $(event.target).closest('.control-icon');\r\n button.find('.token-variants-wrap').remove();\r\n const sideSelect = await renderSideSelect(tile, event.target.value);\r\n if (sideSelect) {\r\n sideSelect.addClass('active');\r\n button.append(sideSelect);\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\n\r\nfunction genTitleAndStyle(mappings, imgSrc, name) {\r\n let title = TVA_CONFIG.worldHud.showFullPath ? imgSrc : name;\r\n let style = '';\r\n let offset = 2;\r\n for (const [userId, img] of Object.entries(mappings)) {\r\n if (img === imgSrc) {\r\n const user = game.users.get(userId);\r\n if (!user) continue;\r\n if (style.length === 0) {\r\n style = `inset 0 0 0 ${offset}px ${user.color}`;\r\n } else {\r\n style += `, inset 0 0 0 ${offset}px ${user.color}`;\r\n }\r\n offset += 2;\r\n title += `\\nDisplayed to: ${user.name}`;\r\n }\r\n }\r\n return [title, style];\r\n}\r\n\r\nfunction setNameDialog(tile) {\r\n const tileName = tile.document.getFlag('token-variants', 'tileName') || tile.id;\r\n new Dialog({\r\n title: `Assign a name to the Tile (3+ chars)`,\r\n content: `<table style=\"width:100%\"><tr><th style=\"width:50%\"><label>Tile Name</label></th><td style=\"width:50%\"><input type=\"text\" name=\"input\" value=\"${tileName}\"/></td></tr></table>`,\r\n buttons: {\r\n Ok: {\r\n label: `Save`,\r\n callback: (html) => {\r\n const name = html.find('input').val();\r\n if (name) {\r\n canvas.tiles.hud.clear();\r\n tile.document.setFlag('token-variants', 'tileName', name);\r\n }\r\n },\r\n },\r\n },\r\n }).render(true);\r\n}\r\n","export default class FlagsConfig extends FormApplication {\r\n constructor(obj) {\r\n super({}, {});\r\n if (obj instanceof Tile) {\r\n this.objectToFlag = obj.document;\r\n this.isTile = true;\r\n } else {\r\n this.objectToFlag = game.actors.get(obj.document.actorId) || obj.document;\r\n }\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-token-flags',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/flagsConfig.html',\r\n resizable: true,\r\n minimizable: false,\r\n title: 'Flags',\r\n width: 500,\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n const popups = this.objectToFlag.getFlag('token-variants', 'popups');\r\n const disableNameSearch = this.objectToFlag.getFlag('token-variants', 'disableNameSearch');\r\n const directory = this.objectToFlag.getFlag('token-variants', 'directory') || {};\r\n\r\n return mergeObject(data, {\r\n popups: popups,\r\n popupsSetFlag: popups != null,\r\n disableNameSearch: disableNameSearch,\r\n disableNameSearchSetFlag: disableNameSearch != null,\r\n directory: directory.path,\r\n directorySource: directory.source,\r\n directorySetFlag: !isEmpty(directory),\r\n tile: this.isTile,\r\n });\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n html.find('.controlFlag').click((e) => {\r\n $(e.target).siblings('.flag').prop('disabled', !e.target.checked);\r\n });\r\n html.find('.directory-fp').click((event) => {\r\n new FilePicker({\r\n type: 'folder',\r\n activeSource: 'data',\r\n callback: (path, fp) => {\r\n html.find('[name=\"directory\"]').val(fp.result.target);\r\n $(event.target)\r\n .closest('button')\r\n .attr('title', 'Directory: ' + fp.result.target);\r\n const sourceEl = html.find('[name=\"directorySource\"]');\r\n if (fp.activeSource === 's3') {\r\n sourceEl.val(`s3:${fp.result.bucket}`);\r\n } else {\r\n sourceEl.val(fp.activeSource);\r\n }\r\n },\r\n }).render(true);\r\n });\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n if ('directory' in formData) {\r\n formData.directory = { path: formData.directory, source: formData.directorySource };\r\n }\r\n\r\n ['popups', 'disableNameSearch', 'directory'].forEach((flag) => {\r\n if (flag in formData) {\r\n this.objectToFlag.setFlag('token-variants', flag, formData[flag]);\r\n } else {\r\n this.objectToFlag.unsetFlag('token-variants', flag);\r\n }\r\n });\r\n }\r\n}\r\n","import { isInitialized } from '../token-variants.mjs';\r\nimport { Fuse } from './fuse/fuse.js';\r\nimport { getSearchOptions, TVA_CONFIG } from './settings.js';\r\nimport {\r\n callForgeVTT,\r\n decodeURIComponentSafely,\r\n decodeURISafely,\r\n flattenSearchResults,\r\n getFileName,\r\n getFileNameWithExt,\r\n getFilePath,\r\n getFilters,\r\n isImage,\r\n isVideo,\r\n parseKeywords,\r\n simplifyName,\r\n simplifyPath,\r\n} from './utils.js';\r\n\r\n// True if in the middle of caching image paths\r\nlet caching = false;\r\nexport function isCaching() {\r\n return caching;\r\n}\r\n\r\n// Cached images\r\nlet CACHED_IMAGES = {};\r\n\r\n/**\r\n * @param {string} search Text to be used as the search criteria\r\n * @param {object} [options={}] Options which customize the search\r\n * @param {SEARCH_TYPE|string} [options.searchType] Controls filters applied to the search results\r\n * @param {Boolean} [options.simpleResults] Results will be returned as an array of all image paths found\r\n * @param {Function[]} [options.callback] Function to be called with the found images\r\n * @param {object} [options.searchOptions] Override search settings\r\n * @returns {Promise<Map<string, Array<object>|Array<string>>} All images found split by original criteria and keywords\r\n */\r\nexport async function doImageSearch(\r\n search,\r\n {\r\n searchType = SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n simpleResults = false,\r\n callback = null,\r\n searchOptions = {},\r\n } = {}\r\n) {\r\n if (caching) return;\r\n\r\n searchOptions = mergeObject(searchOptions, getSearchOptions(), { overwrite: false });\r\n\r\n search = search.trim();\r\n\r\n if (TVA_CONFIG.debug)\r\n console.info('TVA | STARTING: Art Search', search, searchType, searchOptions);\r\n\r\n let searches = [search];\r\n let allImages = new Map();\r\n const keywords = parseKeywords(searchOptions.excludedKeywords);\r\n\r\n if (searchOptions.keywordSearch) {\r\n searches = searches.concat(\r\n search\r\n .split(/[_\\- :,\\|\\(\\)\\[\\]]/)\r\n .filter((word) => word.length > 2 && !keywords.includes(word.toLowerCase()))\r\n .reverse()\r\n );\r\n }\r\n\r\n let usedImages = new Set();\r\n for (const search of searches) {\r\n if (allImages.get(search) !== undefined) continue;\r\n\r\n let results = await findImages(search, searchType, searchOptions);\r\n results = results.filter((pathObj) => !usedImages.has(pathObj));\r\n\r\n allImages.set(search, results);\r\n results.forEach(usedImages.add, usedImages);\r\n }\r\n\r\n if (TVA_CONFIG.debug) console.info('TVA | ENDING: Art Search');\r\n\r\n if (simpleResults) {\r\n allImages = Array.from(usedImages).map((obj) => obj.path);\r\n }\r\n\r\n if (callback) callback(allImages);\r\n return allImages;\r\n}\r\n\r\n/**\r\n * @param {*} search Text to be used as the search criteria\r\n * @param {object} [options={}] Options which customize the search\r\n * @param {SEARCH_TYPE|string} [options.searchType] Controls filters applied to the search results\r\n * @param {Actor} [options.actor] Used to retrieve 'shared' images from if enabled in the Randomizer Settings\r\n * @param {Function[]} [options.callback] Function to be called with the random image\r\n * @param {object} [options.searchOptions] Override search settings\r\n * @param {object} [options.randomizerOptions] Override randomizer settings. These take precedence over searchOptions\r\n * @returns Array<string>|null} Image path and name\r\n */\r\nexport async function doRandomSearch(\r\n search,\r\n {\r\n searchType = SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n actor = null,\r\n callback = null,\r\n randomizerOptions = {},\r\n searchOptions = {},\r\n } = {}\r\n) {\r\n if (caching) return null;\r\n\r\n const results = flattenSearchResults(\r\n await _randSearchUtil(search, {\r\n searchType: searchType,\r\n actor: actor,\r\n randomizerOptions: randomizerOptions,\r\n searchOptions: searchOptions,\r\n })\r\n );\r\n if (results.length === 0) return null;\r\n\r\n // Pick random image\r\n let randImageNum = Math.floor(Math.random() * results.length);\r\n if (callback) callback([results[randImageNum].path, results[randImageNum].name]);\r\n return [results[randImageNum].path, results[randImageNum].name];\r\n}\r\n\r\nexport async function doSyncSearch(\r\n search,\r\n target,\r\n { searchType = SEARCH_TYPE.TOKEN, actor = null, randomizerOptions = {} } = {}\r\n) {\r\n if (caching) return null;\r\n\r\n const results = flattenSearchResults(\r\n await _randSearchUtil(search, { searchType, actor, randomizerOptions })\r\n );\r\n\r\n // Find the image with the most similar name\r\n const fuse = new Fuse(results, {\r\n keys: ['name'],\r\n minMatchCharLength: 1,\r\n ignoreLocation: true,\r\n threshold: 0.4,\r\n });\r\n\r\n const fResults = fuse.search(target);\r\n\r\n if (fResults && fResults.length !== 0) {\r\n return [fResults[0].item.path, fResults[0].item.name];\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\nasync function _randSearchUtil(\r\n search,\r\n {\r\n searchType = SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n actor = null,\r\n randomizerOptions = {},\r\n searchOptions = {},\r\n } = {}\r\n) {\r\n const randSettings = mergeObject(randomizerOptions, TVA_CONFIG.randomizer, { overwrite: false });\r\n if (\r\n !(\r\n randSettings.tokenName ||\r\n randSettings.actorName ||\r\n randSettings.keywords ||\r\n randSettings.shared ||\r\n randSettings.wildcard\r\n )\r\n )\r\n return null;\r\n\r\n // Randomizer settings take precedence\r\n searchOptions.keywordSearch = randSettings.keywords;\r\n\r\n // Swap search to the actor name if need be\r\n if (randSettings.actorName && actor) {\r\n search = actor.name;\r\n }\r\n\r\n // Gather all images\r\n let results =\r\n randSettings.actorName || randSettings.tokenName || randSettings.keywords\r\n ? await doImageSearch(search, {\r\n searchType: searchType,\r\n searchOptions: searchOptions,\r\n })\r\n : new Map();\r\n\r\n if (!randSettings.tokenName && !randSettings.actorName) {\r\n results.delete(search);\r\n }\r\n if (randSettings.shared && actor) {\r\n let sharedVariants = actor.getFlag('token-variants', 'variants') || [];\r\n if (sharedVariants.length != 0) {\r\n const sv = [];\r\n sharedVariants.forEach((variant) => {\r\n variant.names.forEach((name) => {\r\n sv.push({ path: variant.imgSrc, name: name });\r\n });\r\n });\r\n results.set('variants95436723', sv);\r\n }\r\n }\r\n if (randSettings.wildcard && actor) {\r\n let protoImg = actor.prototypeToken.texture.src;\r\n if (protoImg.includes('*') || (protoImg.includes('{') && protoImg.includes('}'))) {\r\n // Modified version of Actor.getTokenImages()\r\n const getTokenImages = async (actor) => {\r\n if (actor._tokenImages) return actor._tokenImages;\r\n let source = 'data';\r\n const browseOptions = { wildcard: true };\r\n\r\n // Support non-user sources\r\n if (/\\.s3\\./.test(protoImg)) {\r\n source = 's3';\r\n const { bucket, keyPrefix } = FilePicker.parseS3URL(protoImg);\r\n if (bucket) {\r\n browseOptions.bucket = bucket;\r\n protoImg = keyPrefix;\r\n }\r\n } else if (protoImg.startsWith('icons/')) source = 'public';\r\n\r\n // Retrieve wildcard content\r\n try {\r\n const content = await FilePicker.browse(source, protoImg, browseOptions);\r\n return content.files;\r\n } catch (err) {\r\n return [];\r\n }\r\n };\r\n\r\n const wildcardImages = (await getTokenImages(actor))\r\n .filter((img) => !img.includes('*') && (isImage(img) || isVideo(img)))\r\n .map((variant) => {\r\n return { path: variant, name: getFileName(variant) };\r\n });\r\n results.set('variants95436623', wildcardImages);\r\n }\r\n }\r\n\r\n return results;\r\n}\r\n\r\n/**\r\n * Recursive image search through a directory\r\n * @param {*} path starting path\r\n * @param {*} options.apiKey ForgeVTT AssetLibrary API key\r\n * @param {*} found_images all the images found\r\n * @returns void\r\n */\r\nasync function walkFindImages(path, { apiKey = '' } = {}, found_images) {\r\n let files = {};\r\n if (!path.source) {\r\n path.source = 'data';\r\n }\r\n const typeKey = path.types.sort().join(',');\r\n try {\r\n if (path.source.startsWith('s3:')) {\r\n files = await FilePicker.browse('s3', path.text, {\r\n bucket: path.source.replace('s3:', ''),\r\n });\r\n } else if (path.source.startsWith('forgevtt')) {\r\n if (apiKey) {\r\n const response = await callForgeVTT(path.text, apiKey);\r\n files.files = response.files.map((f) => f.url);\r\n } else {\r\n files = await FilePicker.browse('forgevtt', path.text, { recursive: true });\r\n }\r\n } else if (path.source.startsWith('forge-bazaar')) {\r\n files = await FilePicker.browse('forge-bazaar', path.text, { recursive: true });\r\n } else if (path.source.startsWith('imgur')) {\r\n await fetch('https://api.imgur.com/3/gallery/album/' + path.text, {\r\n headers: {\r\n Authorization:\r\n 'Client-ID ' +\r\n (TVA_CONFIG.imgurClientId ? TVA_CONFIG.imgurClientId : 'df9d991443bb222'),\r\n Accept: 'application/json',\r\n },\r\n })\r\n .then((response) => response.json())\r\n .then(async function (result) {\r\n if (!result.success) {\r\n return;\r\n }\r\n result.data.images.forEach((img) => {\r\n const rtName = img.title ?? img.description ?? getFileName(img.link);\r\n _addToFound({ path: decodeURISafely(img.link), name: rtName }, typeKey, found_images);\r\n });\r\n })\r\n .catch((error) => console.warn('TVA |', error));\r\n return;\r\n } else if (path.source.startsWith('rolltable')) {\r\n const table = game.tables.contents.find((t) => t.name === path.text);\r\n if (!table) {\r\n const rollTableName = path.text;\r\n ui.notifications.warn(\r\n game.i18n.format('token-variants.notifications.warn.invalid-table', {\r\n rollTableName,\r\n })\r\n );\r\n } else {\r\n for (let baseTableData of table.results) {\r\n const rtPath = baseTableData.img;\r\n const rtName = baseTableData.text || getFileName(rtPath);\r\n _addToFound({ path: decodeURISafely(rtPath), name: rtName }, typeKey, found_images);\r\n }\r\n }\r\n return;\r\n } else if (path.source.startsWith('json')) {\r\n await fetch(path.text, {\r\n headers: {\r\n Accept: 'application/json',\r\n },\r\n })\r\n .then((response) => response.json())\r\n .then(async function (result) {\r\n if (!result.length > 0) {\r\n return;\r\n }\r\n result.forEach((img) => {\r\n const rtName = img.name ?? getFileName(img.path);\r\n _addToFound(\r\n { path: decodeURISafely(img.path), name: rtName, tags: img.tags },\r\n typeKey,\r\n found_images\r\n );\r\n });\r\n })\r\n .catch((error) => console.warn('TVA |', error));\r\n return;\r\n } else {\r\n files = await FilePicker.browse(path.source, path.text);\r\n }\r\n } catch (err) {\r\n console.warn(\r\n `TVA | ${game.i18n.localize('token-variants.notifications.warn.path-not-found')} ${\r\n path.source\r\n }:${path.text}`\r\n );\r\n return;\r\n }\r\n\r\n if (files.target == '.') return;\r\n\r\n if (files.files) {\r\n files.files.forEach((tokenSrc) => {\r\n _addToFound(\r\n { path: decodeURISafely(tokenSrc), name: getFileName(tokenSrc) },\r\n typeKey,\r\n found_images\r\n );\r\n });\r\n }\r\n\r\n // ForgeVTT requires special treatment\r\n // Bazaar paths fail recursive search if one level above root\r\n if (path.source.startsWith('forgevtt')) return;\r\n else if (\r\n path.source.startsWith('forge-bazaar') &&\r\n !['modules', 'systems', 'worlds', 'assets'].includes(path.text.replaceAll(/[\\/\\\\]/g, ''))\r\n ) {\r\n return;\r\n }\r\n\r\n for (let f_dir of files.dirs) {\r\n await walkFindImages(\r\n { text: f_dir, source: path.source, types: path.types },\r\n { apiKey: apiKey },\r\n found_images\r\n );\r\n }\r\n}\r\n\r\nfunction _addToFound(img, typeKey, found_images) {\r\n if (isImage(img.path) || isVideo(img.path)) {\r\n if (found_images[typeKey] == null) {\r\n found_images[typeKey] = [img];\r\n } else {\r\n found_images[typeKey].push(img);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Recursive walks through all paths exposed to the module and caches them\r\n * @param {*} searchType\r\n * @returns\r\n */\r\nasync function walkAllPaths(searchType) {\r\n const found_images = {};\r\n const paths = _filterPathsByType(TVA_CONFIG.searchPaths, searchType);\r\n\r\n for (const path of paths) {\r\n if ((path.cache && caching) || (!path.cache && !caching))\r\n await walkFindImages(path, {}, found_images);\r\n }\r\n\r\n // ForgeVTT specific path handling\r\n const userId = typeof ForgeAPI !== 'undefined' ? await ForgeAPI.getUserId() : '';\r\n for (const uid in TVA_CONFIG.forgeSearchPaths) {\r\n const apiKey = TVA_CONFIG.forgeSearchPaths[uid].apiKey;\r\n const paths = _filterPathsByType(TVA_CONFIG.forgeSearchPaths[uid].paths, searchType);\r\n if (uid === userId) {\r\n for (const path of paths) {\r\n if ((path.cache && caching) || (!path.cache && !caching))\r\n await walkFindImages(path, {}, found_images);\r\n }\r\n } else if (apiKey) {\r\n for (const path of paths) {\r\n if ((path.cache && caching) || (!path.cache && !caching)) {\r\n if (path.share) await walkFindImages(path, { apiKey: apiKey }, found_images);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return found_images;\r\n}\r\n\r\nfunction _filterPathsByType(paths, searchType) {\r\n if (!searchType) return paths;\r\n return paths.filter((p) => p.types.includes(searchType));\r\n}\r\n\r\nexport async function findImagesFuzzy(name, searchType, searchOptions, forceSearchName = false) {\r\n if (TVA_CONFIG.debug)\r\n console.info(\r\n 'TVA | STARTING: Fuzzy Image Search',\r\n name,\r\n searchType,\r\n searchOptions,\r\n forceSearchName\r\n );\r\n\r\n const filters = getFilters(searchType, searchOptions.searchFilters);\r\n\r\n const fuse = new Fuse([], {\r\n keys: [!forceSearchName && searchOptions.runSearchOnPath ? 'path' : 'name', 'tags'],\r\n includeScore: true,\r\n includeMatches: true,\r\n minMatchCharLength: 1,\r\n ignoreLocation: true,\r\n threshold: searchOptions.algorithm.fuzzyThreshold,\r\n });\r\n\r\n const found_images = await walkAllPaths(searchType);\r\n\r\n for (const container of [CACHED_IMAGES, found_images]) {\r\n for (const typeKey in container) {\r\n const types = typeKey.split(',');\r\n if (types.includes(searchType)) {\r\n for (const imgObj of container[typeKey]) {\r\n if (\r\n _imagePassesFilter(imgObj.name, imgObj.path, filters, searchOptions.runSearchOnPath)\r\n ) {\r\n fuse.add(imgObj);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n let results;\r\n if (name === '') {\r\n results = fuse.getIndex().docs.slice(0, searchOptions.algorithm.fuzzyLimit);\r\n } else {\r\n results = fuse.search(name).slice(0, searchOptions.algorithm.fuzzyLimit);\r\n results = results.map((r) => {\r\n r.item.indices = r.matches[0].indices;\r\n r.item.score = r.score;\r\n return r.item;\r\n });\r\n }\r\n\r\n if (TVA_CONFIG.debug) console.info('TVA | ENDING: Fuzzy Image Search', results);\r\n\r\n return results;\r\n}\r\n\r\nasync function findImagesExact(name, searchType, searchOptions) {\r\n if (TVA_CONFIG.debug)\r\n console.info('TVA | STARTING: Exact Image Search', name, searchType, searchOptions);\r\n\r\n const found_images = await walkAllPaths(searchType);\r\n\r\n const simpleName = simplifyName(name);\r\n const filters = getFilters(searchType, searchOptions.searchFilters);\r\n\r\n const matchedImages = [];\r\n\r\n for (const container of [CACHED_IMAGES, found_images]) {\r\n for (const typeKey in container) {\r\n const types = typeKey.split(',');\r\n if (types.includes(searchType)) {\r\n for (const imgOBj of container[typeKey]) {\r\n if (\r\n _exactSearchMatchesImage(\r\n simpleName,\r\n imgOBj.path,\r\n imgOBj.name,\r\n filters,\r\n searchOptions.runSearchOnPath\r\n )\r\n ) {\r\n matchedImages.push(imgOBj);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (TVA_CONFIG.debug) console.info('TVA | ENDING: Exact Image Search', matchedImages);\r\n return matchedImages;\r\n}\r\n\r\nasync function findImages(name, searchType = '', searchOptions = {}) {\r\n const sOptions = mergeObject(searchOptions, getSearchOptions(), { overwrite: false });\r\n if (sOptions.algorithm.exact) {\r\n return await findImagesExact(name, searchType, sOptions);\r\n } else {\r\n return await findImagesFuzzy(name, searchType, sOptions);\r\n }\r\n}\r\n\r\n/**\r\n * Checks if image path and name match the provided search text and filters\r\n * @param imagePath image path\r\n * @param imageName image name\r\n * @param filters filters to be applied\r\n * @returns true|false\r\n */\r\nfunction _exactSearchMatchesImage(\r\n simplifiedSearch,\r\n imagePath,\r\n imageName,\r\n filters,\r\n runSearchOnPath\r\n) {\r\n // Is the search text contained in the name/path\r\n const simplified = runSearchOnPath ? simplifyPath(imagePath) : simplifyName(imageName);\r\n if (!simplified.includes(simplifiedSearch)) {\r\n return false;\r\n }\r\n\r\n if (!filters) return true;\r\n return _imagePassesFilter(imageName, imagePath, filters, runSearchOnPath);\r\n}\r\n\r\nfunction _imagePassesFilter(imageName, imagePath, filters, runSearchOnPath) {\r\n // Filters are applied to path depending on the 'runSearchOnPath' setting, and actual or custom rolltable name\r\n let text;\r\n if (runSearchOnPath) {\r\n text = decodeURIComponentSafely(imagePath);\r\n } else if (getFileName(imagePath) === imageName) {\r\n text = getFileNameWithExt(imagePath);\r\n } else {\r\n text = imageName;\r\n }\r\n\r\n if (filters.regex) {\r\n return filters.regex.test(text);\r\n }\r\n if (filters.include) {\r\n if (!text.includes(filters.include)) return false;\r\n }\r\n if (filters.exclude) {\r\n if (text.includes(filters.exclude)) return false;\r\n }\r\n return true;\r\n}\r\n\r\n// ===================================\r\n// ==== CACHING RELATED FUNCTIONS ====\r\n// ===================================\r\n\r\nexport async function saveCache(cacheFile) {\r\n const data = {};\r\n\r\n const caches = Object.keys(CACHED_IMAGES);\r\n for (const c of caches) {\r\n if (!(c in data)) data[c] = [];\r\n for (const img of CACHED_IMAGES[c]) {\r\n if (img.tags) {\r\n data[c].push([img.path, img.name, img.tags]);\r\n } else if (getFileName(img.path) === img.name) {\r\n data[c].push(img.path);\r\n } else {\r\n data[c].push([img.path, img.name]);\r\n }\r\n }\r\n }\r\n\r\n let file = new File([JSON.stringify(data)], getFileNameWithExt(cacheFile), {\r\n type: 'text/plain',\r\n });\r\n FilePicker.upload('data', getFilePath(cacheFile), file);\r\n}\r\n\r\n/**\r\n * Search for and cache all the found token art\r\n */\r\nexport async function cacheImages({\r\n staticCache = TVA_CONFIG.staticCache,\r\n staticCacheFile = TVA_CONFIG.staticCacheFile,\r\n} = {}) {\r\n if (caching) return;\r\n caching = true;\r\n\r\n if (!isInitialized() && staticCache) {\r\n if (await _readCacheFromFile(staticCacheFile)) {\r\n caching = false;\r\n return;\r\n }\r\n }\r\n\r\n if (!TVA_CONFIG.disableNotifs)\r\n ui.notifications.info(game.i18n.format('token-variants.notifications.info.caching-started'));\r\n\r\n if (TVA_CONFIG.debug) console.info('TVA | STARTING: Token Caching');\r\n const found_images = await walkAllPaths();\r\n CACHED_IMAGES = found_images;\r\n\r\n if (TVA_CONFIG.debug) console.info('TVA | ENDING: Token Caching');\r\n\r\n caching = false;\r\n if (!TVA_CONFIG.disableNotifs)\r\n ui.notifications.info(\r\n game.i18n.format('token-variants.notifications.info.caching-finished', {\r\n imageCount: Object.keys(CACHED_IMAGES).reduce(\r\n (count, types) => count + CACHED_IMAGES[types].length,\r\n 0\r\n ),\r\n })\r\n );\r\n\r\n if (staticCache && game.user.isGM) {\r\n saveCache(staticCacheFile);\r\n }\r\n}\r\n\r\nasync function _readCacheFromFile(fileName) {\r\n CACHED_IMAGES = {};\r\n try {\r\n await jQuery.getJSON(fileName, (json) => {\r\n for (let category in json) {\r\n CACHED_IMAGES[category] = [];\r\n\r\n for (const img of json[category]) {\r\n if (Array.isArray(img)) {\r\n if (img.length === 3) {\r\n CACHED_IMAGES[category].push({ path: img[0], name: img[1], tags: img[2] });\r\n } else {\r\n CACHED_IMAGES[category].push({ path: img[0], name: img[1] });\r\n }\r\n } else {\r\n CACHED_IMAGES[category].push({ path: img, name: getFileName(img) });\r\n }\r\n }\r\n }\r\n if (!TVA_CONFIG.disableNotifs)\r\n ui.notifications.info(\r\n `Token Variant Art: Using Static Cache (${Object.keys(CACHED_IMAGES).reduce(\r\n (count, c) => count + CACHED_IMAGES[c].length,\r\n 0\r\n )} images)`\r\n );\r\n });\r\n } catch (error) {\r\n ui.notifications.warn(`Token Variant Art: Static Cache not found`);\r\n CACHED_IMAGES = {};\r\n return false;\r\n }\r\n return true;\r\n}\r\n","/**\r\n * Fuse.js v6.5.3 - Lightweight fuzzy-search (http://fusejs.io)\r\n *\r\n * Copyright (c) 2021 Kiro Risk (http://kiro.me)\r\n * All Rights Reserved. Apache Software License 2.0\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n */\r\n\r\nfunction ownKeys(object, enumerableOnly) {\r\n var keys = Object.keys(object);\r\n\r\n if (Object.getOwnPropertySymbols) {\r\n var symbols = Object.getOwnPropertySymbols(object);\r\n enumerableOnly &&\r\n (symbols = symbols.filter(function (sym) {\r\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\r\n })),\r\n keys.push.apply(keys, symbols);\r\n }\r\n\r\n return keys;\r\n}\r\n\r\nfunction _objectSpread2(target) {\r\n for (var i = 1; i < arguments.length; i++) {\r\n var source = null != arguments[i] ? arguments[i] : {};\r\n i % 2\r\n ? ownKeys(Object(source), !0).forEach(function (key) {\r\n _defineProperty(target, key, source[key]);\r\n })\r\n : Object.getOwnPropertyDescriptors\r\n ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source))\r\n : ownKeys(Object(source)).forEach(function (key) {\r\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\r\n });\r\n }\r\n\r\n return target;\r\n}\r\n\r\nfunction _typeof(obj) {\r\n '@babel/helpers - typeof';\r\n\r\n return (\r\n (_typeof =\r\n 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator\r\n ? function (obj) {\r\n return typeof obj;\r\n }\r\n : function (obj) {\r\n return obj &&\r\n 'function' == typeof Symbol &&\r\n obj.constructor === Symbol &&\r\n obj !== Symbol.prototype\r\n ? 'symbol'\r\n : typeof obj;\r\n }),\r\n _typeof(obj)\r\n );\r\n}\r\n\r\nfunction _classCallCheck(instance, Constructor) {\r\n if (!(instance instanceof Constructor)) {\r\n throw new TypeError('Cannot call a class as a function');\r\n }\r\n}\r\n\r\nfunction _defineProperties(target, props) {\r\n for (var i = 0; i < props.length; i++) {\r\n var descriptor = props[i];\r\n descriptor.enumerable = descriptor.enumerable || false;\r\n descriptor.configurable = true;\r\n if ('value' in descriptor) descriptor.writable = true;\r\n Object.defineProperty(target, descriptor.key, descriptor);\r\n }\r\n}\r\n\r\nfunction _createClass(Constructor, protoProps, staticProps) {\r\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\r\n if (staticProps) _defineProperties(Constructor, staticProps);\r\n Object.defineProperty(Constructor, 'prototype', {\r\n writable: false,\r\n });\r\n return Constructor;\r\n}\r\n\r\nfunction _defineProperty(obj, key, value) {\r\n if (key in obj) {\r\n Object.defineProperty(obj, key, {\r\n value: value,\r\n enumerable: true,\r\n configurable: true,\r\n writable: true,\r\n });\r\n } else {\r\n obj[key] = value;\r\n }\r\n\r\n return obj;\r\n}\r\n\r\nfunction _inherits(subClass, superClass) {\r\n if (typeof superClass !== 'function' && superClass !== null) {\r\n throw new TypeError('Super expression must either be null or a function');\r\n }\r\n\r\n Object.defineProperty(subClass, 'prototype', {\r\n value: Object.create(superClass && superClass.prototype, {\r\n constructor: {\r\n value: subClass,\r\n writable: true,\r\n configurable: true,\r\n },\r\n }),\r\n writable: false,\r\n });\r\n if (superClass) _setPrototypeOf(subClass, superClass);\r\n}\r\n\r\nfunction _getPrototypeOf(o) {\r\n _getPrototypeOf = Object.setPrototypeOf\r\n ? Object.getPrototypeOf\r\n : function _getPrototypeOf(o) {\r\n return o.__proto__ || Object.getPrototypeOf(o);\r\n };\r\n return _getPrototypeOf(o);\r\n}\r\n\r\nfunction _setPrototypeOf(o, p) {\r\n _setPrototypeOf =\r\n Object.setPrototypeOf ||\r\n function _setPrototypeOf(o, p) {\r\n o.__proto__ = p;\r\n return o;\r\n };\r\n\r\n return _setPrototypeOf(o, p);\r\n}\r\n\r\nfunction _isNativeReflectConstruct() {\r\n if (typeof Reflect === 'undefined' || !Reflect.construct) return false;\r\n if (Reflect.construct.sham) return false;\r\n if (typeof Proxy === 'function') return true;\r\n\r\n try {\r\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\r\n return true;\r\n } catch (e) {\r\n return false;\r\n }\r\n}\r\n\r\nfunction _assertThisInitialized(self) {\r\n if (self === void 0) {\r\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\r\n }\r\n\r\n return self;\r\n}\r\n\r\nfunction _possibleConstructorReturn(self, call) {\r\n if (call && (typeof call === 'object' || typeof call === 'function')) {\r\n return call;\r\n } else if (call !== void 0) {\r\n throw new TypeError('Derived constructors may only return object or undefined');\r\n }\r\n\r\n return _assertThisInitialized(self);\r\n}\r\n\r\nfunction _createSuper(Derived) {\r\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\r\n\r\n return function _createSuperInternal() {\r\n var Super = _getPrototypeOf(Derived),\r\n result;\r\n\r\n if (hasNativeReflectConstruct) {\r\n var NewTarget = _getPrototypeOf(this).constructor;\r\n\r\n result = Reflect.construct(Super, arguments, NewTarget);\r\n } else {\r\n result = Super.apply(this, arguments);\r\n }\r\n\r\n return _possibleConstructorReturn(this, result);\r\n };\r\n}\r\n\r\nfunction _toConsumableArray(arr) {\r\n return (\r\n _arrayWithoutHoles(arr) ||\r\n _iterableToArray(arr) ||\r\n _unsupportedIterableToArray(arr) ||\r\n _nonIterableSpread()\r\n );\r\n}\r\n\r\nfunction _arrayWithoutHoles(arr) {\r\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\r\n}\r\n\r\nfunction _iterableToArray(iter) {\r\n if (\r\n (typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null) ||\r\n iter['@@iterator'] != null\r\n )\r\n return Array.from(iter);\r\n}\r\n\r\nfunction _unsupportedIterableToArray(o, minLen) {\r\n if (!o) return;\r\n if (typeof o === 'string') return _arrayLikeToArray(o, minLen);\r\n var n = Object.prototype.toString.call(o).slice(8, -1);\r\n if (n === 'Object' && o.constructor) n = o.constructor.name;\r\n if (n === 'Map' || n === 'Set') return Array.from(o);\r\n if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))\r\n return _arrayLikeToArray(o, minLen);\r\n}\r\n\r\nfunction _arrayLikeToArray(arr, len) {\r\n if (len == null || len > arr.length) len = arr.length;\r\n\r\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\r\n\r\n return arr2;\r\n}\r\n\r\nfunction _nonIterableSpread() {\r\n throw new TypeError(\r\n 'Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'\r\n );\r\n}\r\n\r\nfunction isArray(value) {\r\n return !Array.isArray ? getTag(value) === '[object Array]' : Array.isArray(value);\r\n} // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js\r\n\r\nvar INFINITY = 1 / 0;\r\nfunction baseToString(value) {\r\n // Exit early for strings to avoid a performance hit in some environments.\r\n if (typeof value == 'string') {\r\n return value;\r\n }\r\n\r\n var result = value + '';\r\n return result == '0' && 1 / value == -INFINITY ? '-0' : result;\r\n}\r\nfunction toString(value) {\r\n return value == null ? '' : baseToString(value);\r\n}\r\nfunction isString(value) {\r\n return typeof value === 'string';\r\n}\r\nfunction isNumber(value) {\r\n return typeof value === 'number';\r\n} // Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js\r\n\r\nfunction isBoolean(value) {\r\n return (\r\n value === true ||\r\n value === false ||\r\n (isObjectLike(value) && getTag(value) == '[object Boolean]')\r\n );\r\n}\r\nfunction isObject(value) {\r\n return _typeof(value) === 'object';\r\n} // Checks if `value` is object-like.\r\n\r\nfunction isObjectLike(value) {\r\n return isObject(value) && value !== null;\r\n}\r\nfunction isDefined(value) {\r\n return value !== undefined && value !== null;\r\n}\r\nfunction isBlank(value) {\r\n return !value.trim().length;\r\n} // Gets the `toStringTag` of `value`.\r\n// Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js\r\n\r\nfunction getTag(value) {\r\n return value == null\r\n ? value === undefined\r\n ? '[object Undefined]'\r\n : '[object Null]'\r\n : Object.prototype.toString.call(value);\r\n}\r\n\r\nvar EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available';\r\nvar INCORRECT_INDEX_TYPE = \"Incorrect 'index' type\";\r\nvar LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = function LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key) {\r\n return 'Invalid value for key '.concat(key);\r\n};\r\nvar PATTERN_LENGTH_TOO_LARGE = function PATTERN_LENGTH_TOO_LARGE(max) {\r\n return 'Pattern length exceeds max of '.concat(max, '.');\r\n};\r\nvar MISSING_KEY_PROPERTY = function MISSING_KEY_PROPERTY(name) {\r\n return 'Missing '.concat(name, ' property in key');\r\n};\r\nvar INVALID_KEY_WEIGHT_VALUE = function INVALID_KEY_WEIGHT_VALUE(key) {\r\n return \"Property 'weight' in key '\".concat(key, \"' must be a positive integer\");\r\n};\r\n\r\nvar hasOwn = Object.prototype.hasOwnProperty;\r\n\r\nvar KeyStore = /*#__PURE__*/ (function () {\r\n function KeyStore(keys) {\r\n var _this = this;\r\n\r\n _classCallCheck(this, KeyStore);\r\n\r\n this._keys = [];\r\n this._keyMap = {};\r\n var totalWeight = 0;\r\n keys.forEach(function (key) {\r\n var obj = createKey(key);\r\n totalWeight += obj.weight;\r\n\r\n _this._keys.push(obj);\r\n\r\n _this._keyMap[obj.id] = obj;\r\n totalWeight += obj.weight;\r\n }); // Normalize weights so that their sum is equal to 1\r\n\r\n this._keys.forEach(function (key) {\r\n key.weight /= totalWeight;\r\n });\r\n }\r\n\r\n _createClass(KeyStore, [\r\n {\r\n key: 'get',\r\n value: function get(keyId) {\r\n return this._keyMap[keyId];\r\n },\r\n },\r\n {\r\n key: 'keys',\r\n value: function keys() {\r\n return this._keys;\r\n },\r\n },\r\n {\r\n key: 'toJSON',\r\n value: function toJSON() {\r\n return JSON.stringify(this._keys);\r\n },\r\n },\r\n ]);\r\n\r\n return KeyStore;\r\n})();\r\nfunction createKey(key) {\r\n var path = null;\r\n var id = null;\r\n var src = null;\r\n var weight = 1;\r\n\r\n if (isString(key) || isArray(key)) {\r\n src = key;\r\n path = createKeyPath(key);\r\n id = createKeyId(key);\r\n } else {\r\n if (!hasOwn.call(key, 'name')) {\r\n throw new Error(MISSING_KEY_PROPERTY('name'));\r\n }\r\n\r\n var name = key.name;\r\n src = name;\r\n\r\n if (hasOwn.call(key, 'weight')) {\r\n weight = key.weight;\r\n\r\n if (weight <= 0) {\r\n throw new Error(INVALID_KEY_WEIGHT_VALUE(name));\r\n }\r\n }\r\n\r\n path = createKeyPath(name);\r\n id = createKeyId(name);\r\n }\r\n\r\n return {\r\n path: path,\r\n id: id,\r\n weight: weight,\r\n src: src,\r\n };\r\n}\r\nfunction createKeyPath(key) {\r\n return isArray(key) ? key : key.split('.');\r\n}\r\nfunction createKeyId(key) {\r\n return isArray(key) ? key.join('.') : key;\r\n}\r\n\r\nfunction get(obj, path) {\r\n var list = [];\r\n var arr = false;\r\n\r\n var deepGet = function deepGet(obj, path, index) {\r\n if (!isDefined(obj)) {\r\n return;\r\n }\r\n\r\n if (!path[index]) {\r\n // If there's no path left, we've arrived at the object we care about.\r\n list.push(obj);\r\n } else {\r\n var key = path[index];\r\n var value = obj[key];\r\n\r\n if (!isDefined(value)) {\r\n return;\r\n } // If we're at the last value in the path, and if it's a string/number/bool,\r\n // add it to the list\r\n\r\n if (index === path.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {\r\n list.push(toString(value));\r\n } else if (isArray(value)) {\r\n arr = true; // Search each item in the array.\r\n\r\n for (var i = 0, len = value.length; i < len; i += 1) {\r\n deepGet(value[i], path, index + 1);\r\n }\r\n } else if (path.length) {\r\n // An object. Recurse further.\r\n deepGet(value, path, index + 1);\r\n }\r\n }\r\n }; // Backwards compatibility (since path used to be a string)\r\n\r\n deepGet(obj, isString(path) ? path.split('.') : path, 0);\r\n return arr ? list : list[0];\r\n}\r\n\r\nvar MatchOptions = {\r\n // Whether the matches should be included in the result set. When `true`, each record in the result\r\n // set will include the indices of the matched characters.\r\n // These can consequently be used for highlighting purposes.\r\n includeMatches: false,\r\n // When `true`, the matching function will continue to the end of a search pattern even if\r\n // a perfect match has already been located in the string.\r\n findAllMatches: false,\r\n // Minimum number of characters that must be matched before a result is considered a match\r\n minMatchCharLength: 1,\r\n};\r\nvar BasicOptions = {\r\n // When `true`, the algorithm continues searching to the end of the input even if a perfect\r\n // match is found before the end of the same input.\r\n isCaseSensitive: false,\r\n // When true, the matching function will continue to the end of a search pattern even if\r\n includeScore: false,\r\n // List of properties that will be searched. This also supports nested properties.\r\n keys: [],\r\n // Whether to sort the result list, by score\r\n shouldSort: true,\r\n // Default sort function: sort by ascending score, ascending index\r\n sortFn: function sortFn(a, b) {\r\n return a.score === b.score ? (a.idx < b.idx ? -1 : 1) : a.score < b.score ? -1 : 1;\r\n },\r\n};\r\nvar FuzzyOptions = {\r\n // Approximately where in the text is the pattern expected to be found?\r\n location: 0,\r\n // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match\r\n // (of both letters and location), a threshold of '1.0' would match anything.\r\n threshold: 0.6,\r\n // Determines how close the match must be to the fuzzy location (specified above).\r\n // An exact letter match which is 'distance' characters away from the fuzzy location\r\n // would score as a complete mismatch. A distance of '0' requires the match be at\r\n // the exact location specified, a threshold of '1000' would require a perfect match\r\n // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.\r\n distance: 100,\r\n};\r\nvar AdvancedOptions = {\r\n // When `true`, it enables the use of unix-like search commands\r\n useExtendedSearch: false,\r\n // The get function to use when fetching an object's properties.\r\n // The default will search nested paths *ie foo.bar.baz*\r\n getFn: get,\r\n // When `true`, search will ignore `location` and `distance`, so it won't matter\r\n // where in the string the pattern appears.\r\n // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score\r\n ignoreLocation: false,\r\n // When `true`, the calculation for the relevance score (used for sorting) will\r\n // ignore the field-length norm.\r\n // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm\r\n ignoreFieldNorm: false,\r\n // The weight to determine how much field length norm effects scoring.\r\n fieldNormWeight: 1,\r\n};\r\nvar Config = _objectSpread2(\r\n _objectSpread2(_objectSpread2(_objectSpread2({}, BasicOptions), MatchOptions), FuzzyOptions),\r\n AdvancedOptions\r\n);\r\n\r\nvar SPACE = /[^ ]+/g; // Field-length norm: the shorter the field, the higher the weight.\r\n// Set to 3 decimals to reduce index size.\r\n\r\nfunction norm() {\r\n var weight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\r\n var mantissa = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;\r\n var cache = new Map();\r\n var m = Math.pow(10, mantissa);\r\n return {\r\n get: function get(value) {\r\n var numTokens = value.match(SPACE).length;\r\n\r\n if (cache.has(numTokens)) {\r\n return cache.get(numTokens);\r\n } // Default function is 1/sqrt(x), weight makes that variable\r\n\r\n var norm = 1 / Math.pow(numTokens, 0.5 * weight); // In place of `toFixed(mantissa)`, for faster computation\r\n\r\n var n = parseFloat(Math.round(norm * m) / m);\r\n cache.set(numTokens, n);\r\n return n;\r\n },\r\n clear: function clear() {\r\n cache.clear();\r\n },\r\n };\r\n}\r\n\r\nvar FuseIndex = /*#__PURE__*/ (function () {\r\n function FuseIndex() {\r\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\r\n _ref$getFn = _ref.getFn,\r\n getFn = _ref$getFn === void 0 ? Config.getFn : _ref$getFn,\r\n _ref$fieldNormWeight = _ref.fieldNormWeight,\r\n fieldNormWeight =\r\n _ref$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref$fieldNormWeight;\r\n\r\n _classCallCheck(this, FuseIndex);\r\n\r\n this.norm = norm(fieldNormWeight, 3);\r\n this.getFn = getFn;\r\n this.isCreated = false;\r\n this.setIndexRecords();\r\n }\r\n\r\n _createClass(FuseIndex, [\r\n {\r\n key: 'setSources',\r\n value: function setSources() {\r\n var docs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\r\n this.docs = docs;\r\n },\r\n },\r\n {\r\n key: 'setIndexRecords',\r\n value: function setIndexRecords() {\r\n var records = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\r\n this.records = records;\r\n },\r\n },\r\n {\r\n key: 'setKeys',\r\n value: function setKeys() {\r\n var _this = this;\r\n\r\n var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\r\n this.keys = keys;\r\n this._keysMap = {};\r\n keys.forEach(function (key, idx) {\r\n _this._keysMap[key.id] = idx;\r\n });\r\n },\r\n },\r\n {\r\n key: 'create',\r\n value: function create() {\r\n var _this2 = this;\r\n\r\n if (this.isCreated || !this.docs.length) {\r\n return;\r\n }\r\n\r\n this.isCreated = true; // List is Array<String>\r\n\r\n if (isString(this.docs[0])) {\r\n this.docs.forEach(function (doc, docIndex) {\r\n _this2._addString(doc, docIndex);\r\n });\r\n } else {\r\n // List is Array<Object>\r\n this.docs.forEach(function (doc, docIndex) {\r\n _this2._addObject(doc, docIndex);\r\n });\r\n }\r\n\r\n this.norm.clear();\r\n }, // Adds a doc to the end of the index\r\n },\r\n {\r\n key: 'add',\r\n value: function add(doc) {\r\n var idx = this.size();\r\n\r\n if (isString(doc)) {\r\n this._addString(doc, idx);\r\n } else {\r\n this._addObject(doc, idx);\r\n }\r\n }, // Removes the doc at the specified index of the index\r\n },\r\n {\r\n key: 'removeAt',\r\n value: function removeAt(idx) {\r\n this.records.splice(idx, 1); // Change ref index of every subsquent doc\r\n\r\n for (var i = idx, len = this.size(); i < len; i += 1) {\r\n this.records[i].i -= 1;\r\n }\r\n },\r\n },\r\n {\r\n key: 'getValueForItemAtKeyId',\r\n value: function getValueForItemAtKeyId(item, keyId) {\r\n return item[this._keysMap[keyId]];\r\n },\r\n },\r\n {\r\n key: 'size',\r\n value: function size() {\r\n return this.records.length;\r\n },\r\n },\r\n {\r\n key: '_addString',\r\n value: function _addString(doc, docIndex) {\r\n if (!isDefined(doc) || isBlank(doc)) {\r\n return;\r\n }\r\n\r\n var record = {\r\n v: doc,\r\n i: docIndex,\r\n n: this.norm.get(doc),\r\n };\r\n this.records.push(record);\r\n },\r\n },\r\n {\r\n key: '_addObject',\r\n value: function _addObject(doc, docIndex) {\r\n var _this3 = this;\r\n\r\n var record = {\r\n i: docIndex,\r\n $: {},\r\n }; // Iterate over every key (i.e, path), and fetch the value at that key\r\n\r\n this.keys.forEach(function (key, keyIndex) {\r\n var value = _this3.getFn(doc, key.path);\r\n\r\n if (!isDefined(value)) {\r\n return;\r\n }\r\n\r\n if (isArray(value)) {\r\n (function () {\r\n var subRecords = [];\r\n var stack = [\r\n {\r\n nestedArrIndex: -1,\r\n value: value,\r\n },\r\n ];\r\n\r\n while (stack.length) {\r\n var _stack$pop = stack.pop(),\r\n nestedArrIndex = _stack$pop.nestedArrIndex,\r\n _value = _stack$pop.value;\r\n\r\n if (!isDefined(_value)) {\r\n continue;\r\n }\r\n\r\n if (isString(_value) && !isBlank(_value)) {\r\n var subRecord = {\r\n v: _value,\r\n i: nestedArrIndex,\r\n n: _this3.norm.get(_value),\r\n };\r\n subRecords.push(subRecord);\r\n } else if (isArray(_value)) {\r\n _value.forEach(function (item, k) {\r\n stack.push({\r\n nestedArrIndex: k,\r\n value: item,\r\n });\r\n });\r\n } else;\r\n }\r\n\r\n record.$[keyIndex] = subRecords;\r\n })();\r\n } else if (!isBlank(value)) {\r\n var subRecord = {\r\n v: value,\r\n n: _this3.norm.get(value),\r\n };\r\n record.$[keyIndex] = subRecord;\r\n }\r\n });\r\n this.records.push(record);\r\n },\r\n },\r\n {\r\n key: 'toJSON',\r\n value: function toJSON() {\r\n return {\r\n keys: this.keys,\r\n records: this.records,\r\n };\r\n },\r\n },\r\n ]);\r\n\r\n return FuseIndex;\r\n})();\r\nfunction createIndex(keys, docs) {\r\n var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\r\n _ref2$getFn = _ref2.getFn,\r\n getFn = _ref2$getFn === void 0 ? Config.getFn : _ref2$getFn,\r\n _ref2$fieldNormWeight = _ref2.fieldNormWeight,\r\n fieldNormWeight =\r\n _ref2$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref2$fieldNormWeight;\r\n\r\n var myIndex = new FuseIndex({\r\n getFn: getFn,\r\n fieldNormWeight: fieldNormWeight,\r\n });\r\n myIndex.setKeys(keys.map(createKey));\r\n myIndex.setSources(docs);\r\n myIndex.create();\r\n return myIndex;\r\n}\r\nfunction parseIndex(data) {\r\n var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\r\n _ref3$getFn = _ref3.getFn,\r\n getFn = _ref3$getFn === void 0 ? Config.getFn : _ref3$getFn,\r\n _ref3$fieldNormWeight = _ref3.fieldNormWeight,\r\n fieldNormWeight =\r\n _ref3$fieldNormWeight === void 0 ? Config.fieldNormWeight : _ref3$fieldNormWeight;\r\n\r\n var keys = data.keys,\r\n records = data.records;\r\n var myIndex = new FuseIndex({\r\n getFn: getFn,\r\n fieldNormWeight: fieldNormWeight,\r\n });\r\n myIndex.setKeys(keys);\r\n myIndex.setIndexRecords(records);\r\n return myIndex;\r\n}\r\n\r\nfunction computeScore$1(pattern) {\r\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\r\n _ref$errors = _ref.errors,\r\n errors = _ref$errors === void 0 ? 0 : _ref$errors,\r\n _ref$currentLocation = _ref.currentLocation,\r\n currentLocation = _ref$currentLocation === void 0 ? 0 : _ref$currentLocation,\r\n _ref$expectedLocation = _ref.expectedLocation,\r\n expectedLocation = _ref$expectedLocation === void 0 ? 0 : _ref$expectedLocation,\r\n _ref$distance = _ref.distance,\r\n distance = _ref$distance === void 0 ? Config.distance : _ref$distance,\r\n _ref$ignoreLocation = _ref.ignoreLocation,\r\n ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation;\r\n\r\n var accuracy = errors / pattern.length;\r\n\r\n if (ignoreLocation) {\r\n return accuracy;\r\n }\r\n\r\n var proximity = Math.abs(expectedLocation - currentLocation);\r\n\r\n if (!distance) {\r\n // Dodge divide by zero error.\r\n return proximity ? 1.0 : accuracy;\r\n }\r\n\r\n return accuracy + proximity / distance;\r\n}\r\n\r\nfunction convertMaskToIndices() {\r\n var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\r\n var minMatchCharLength =\r\n arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Config.minMatchCharLength;\r\n var indices = [];\r\n var start = -1;\r\n var end = -1;\r\n var i = 0;\r\n\r\n for (var len = matchmask.length; i < len; i += 1) {\r\n var match = matchmask[i];\r\n\r\n if (match && start === -1) {\r\n start = i;\r\n } else if (!match && start !== -1) {\r\n end = i - 1;\r\n\r\n if (end - start + 1 >= minMatchCharLength) {\r\n indices.push([start, end]);\r\n }\r\n\r\n start = -1;\r\n }\r\n } // (i-1 - start) + 1 => i - start\r\n\r\n if (matchmask[i - 1] && i - start >= minMatchCharLength) {\r\n indices.push([start, i - 1]);\r\n }\r\n\r\n return indices;\r\n}\r\n\r\n// Machine word size\r\nvar MAX_BITS = 32;\r\n\r\nfunction search(text, pattern, patternAlphabet) {\r\n var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},\r\n _ref$location = _ref.location,\r\n location = _ref$location === void 0 ? Config.location : _ref$location,\r\n _ref$distance = _ref.distance,\r\n distance = _ref$distance === void 0 ? Config.distance : _ref$distance,\r\n _ref$threshold = _ref.threshold,\r\n threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold,\r\n _ref$findAllMatches = _ref.findAllMatches,\r\n findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches,\r\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\r\n minMatchCharLength =\r\n _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng,\r\n _ref$includeMatches = _ref.includeMatches,\r\n includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches,\r\n _ref$ignoreLocation = _ref.ignoreLocation,\r\n ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation;\r\n\r\n if (pattern.length > MAX_BITS) {\r\n throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));\r\n }\r\n\r\n var patternLen = pattern.length; // Set starting location at beginning text and initialize the alphabet.\r\n\r\n var textLen = text.length; // Handle the case when location > text.length\r\n\r\n var expectedLocation = Math.max(0, Math.min(location, textLen)); // Highest score beyond which we give up.\r\n\r\n var currentThreshold = threshold; // Is there a nearby exact match? (speedup)\r\n\r\n var bestLocation = expectedLocation; // Performance: only computer matches when the minMatchCharLength > 1\r\n // OR if `includeMatches` is true.\r\n\r\n var computeMatches = minMatchCharLength > 1 || includeMatches; // A mask of the matches, used for building the indices\r\n\r\n var matchMask = computeMatches ? Array(textLen) : [];\r\n var index; // Get all exact matches, here for speed up\r\n\r\n while ((index = text.indexOf(pattern, bestLocation)) > -1) {\r\n var score = computeScore$1(pattern, {\r\n currentLocation: index,\r\n expectedLocation: expectedLocation,\r\n distance: distance,\r\n ignoreLocation: ignoreLocation,\r\n });\r\n currentThreshold = Math.min(score, currentThreshold);\r\n bestLocation = index + patternLen;\r\n\r\n if (computeMatches) {\r\n var i = 0;\r\n\r\n while (i < patternLen) {\r\n matchMask[index + i] = 1;\r\n i += 1;\r\n }\r\n }\r\n } // Reset the best location\r\n\r\n bestLocation = -1;\r\n var lastBitArr = [];\r\n var finalScore = 1;\r\n var binMax = patternLen + textLen;\r\n var mask = 1 << (patternLen - 1);\r\n\r\n for (var _i = 0; _i < patternLen; _i += 1) {\r\n // Scan for the best match; each iteration allows for one more error.\r\n // Run a binary search to determine how far from the match location we can stray\r\n // at this error level.\r\n var binMin = 0;\r\n var binMid = binMax;\r\n\r\n while (binMin < binMid) {\r\n var _score2 = computeScore$1(pattern, {\r\n errors: _i,\r\n currentLocation: expectedLocation + binMid,\r\n expectedLocation: expectedLocation,\r\n distance: distance,\r\n ignoreLocation: ignoreLocation,\r\n });\r\n\r\n if (_score2 <= currentThreshold) {\r\n binMin = binMid;\r\n } else {\r\n binMax = binMid;\r\n }\r\n\r\n binMid = Math.floor((binMax - binMin) / 2 + binMin);\r\n } // Use the result from this iteration as the maximum for the next.\r\n\r\n binMax = binMid;\r\n var start = Math.max(1, expectedLocation - binMid + 1);\r\n var finish = findAllMatches\r\n ? textLen\r\n : Math.min(expectedLocation + binMid, textLen) + patternLen; // Initialize the bit array\r\n\r\n var bitArr = Array(finish + 2);\r\n bitArr[finish + 1] = (1 << _i) - 1;\r\n\r\n for (var j = finish; j >= start; j -= 1) {\r\n var currentLocation = j - 1;\r\n var charMatch = patternAlphabet[text.charAt(currentLocation)];\r\n\r\n if (computeMatches) {\r\n // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`)\r\n matchMask[currentLocation] = +!!charMatch;\r\n } // First pass: exact match\r\n\r\n bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch; // Subsequent passes: fuzzy match\r\n\r\n if (_i) {\r\n bitArr[j] |= ((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1 | lastBitArr[j + 1];\r\n }\r\n\r\n if (bitArr[j] & mask) {\r\n finalScore = computeScore$1(pattern, {\r\n errors: _i,\r\n currentLocation: currentLocation,\r\n expectedLocation: expectedLocation,\r\n distance: distance,\r\n ignoreLocation: ignoreLocation,\r\n }); // This match will almost certainly be better than any existing match.\r\n // But check anyway.\r\n\r\n if (finalScore <= currentThreshold) {\r\n // Indeed it is\r\n currentThreshold = finalScore;\r\n bestLocation = currentLocation; // Already passed `loc`, downhill from here on in.\r\n\r\n if (bestLocation <= expectedLocation) {\r\n break;\r\n } // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.\r\n\r\n start = Math.max(1, 2 * expectedLocation - bestLocation);\r\n }\r\n }\r\n } // No hope for a (better) match at greater error levels.\r\n\r\n var _score = computeScore$1(pattern, {\r\n errors: _i + 1,\r\n currentLocation: expectedLocation,\r\n expectedLocation: expectedLocation,\r\n distance: distance,\r\n ignoreLocation: ignoreLocation,\r\n });\r\n\r\n if (_score > currentThreshold) {\r\n break;\r\n }\r\n\r\n lastBitArr = bitArr;\r\n }\r\n\r\n var result = {\r\n isMatch: bestLocation >= 0,\r\n // Count exact matches (those with a score of 0) to be \"almost\" exact\r\n score: Math.max(0.001, finalScore),\r\n };\r\n\r\n if (computeMatches) {\r\n var indices = convertMaskToIndices(matchMask, minMatchCharLength);\r\n\r\n if (!indices.length) {\r\n result.isMatch = false;\r\n } else if (includeMatches) {\r\n result.indices = indices;\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction createPatternAlphabet(pattern) {\r\n var mask = {};\r\n\r\n for (var i = 0, len = pattern.length; i < len; i += 1) {\r\n var _char = pattern.charAt(i);\r\n\r\n mask[_char] = (mask[_char] || 0) | (1 << (len - i - 1));\r\n }\r\n\r\n return mask;\r\n}\r\n\r\nvar BitapSearch = /*#__PURE__*/ (function () {\r\n function BitapSearch(pattern) {\r\n var _this = this;\r\n\r\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\r\n _ref$location = _ref.location,\r\n location = _ref$location === void 0 ? Config.location : _ref$location,\r\n _ref$threshold = _ref.threshold,\r\n threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold,\r\n _ref$distance = _ref.distance,\r\n distance = _ref$distance === void 0 ? Config.distance : _ref$distance,\r\n _ref$includeMatches = _ref.includeMatches,\r\n includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches,\r\n _ref$findAllMatches = _ref.findAllMatches,\r\n findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches,\r\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\r\n minMatchCharLength =\r\n _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng,\r\n _ref$isCaseSensitive = _ref.isCaseSensitive,\r\n isCaseSensitive =\r\n _ref$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref$isCaseSensitive,\r\n _ref$ignoreLocation = _ref.ignoreLocation,\r\n ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation;\r\n\r\n _classCallCheck(this, BitapSearch);\r\n\r\n this.options = {\r\n location: location,\r\n threshold: threshold,\r\n distance: distance,\r\n includeMatches: includeMatches,\r\n findAllMatches: findAllMatches,\r\n minMatchCharLength: minMatchCharLength,\r\n isCaseSensitive: isCaseSensitive,\r\n ignoreLocation: ignoreLocation,\r\n };\r\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\r\n this.chunks = [];\r\n\r\n if (!this.pattern.length) {\r\n return;\r\n }\r\n\r\n var addChunk = function addChunk(pattern, startIndex) {\r\n _this.chunks.push({\r\n pattern: pattern,\r\n alphabet: createPatternAlphabet(pattern),\r\n startIndex: startIndex,\r\n });\r\n };\r\n\r\n var len = this.pattern.length;\r\n\r\n if (len > MAX_BITS) {\r\n var i = 0;\r\n var remainder = len % MAX_BITS;\r\n var end = len - remainder;\r\n\r\n while (i < end) {\r\n addChunk(this.pattern.substr(i, MAX_BITS), i);\r\n i += MAX_BITS;\r\n }\r\n\r\n if (remainder) {\r\n var startIndex = len - MAX_BITS;\r\n addChunk(this.pattern.substr(startIndex), startIndex);\r\n }\r\n } else {\r\n addChunk(this.pattern, 0);\r\n }\r\n }\r\n\r\n _createClass(BitapSearch, [\r\n {\r\n key: 'searchIn',\r\n value: function searchIn(text) {\r\n var _this$options = this.options,\r\n isCaseSensitive = _this$options.isCaseSensitive,\r\n includeMatches = _this$options.includeMatches;\r\n\r\n if (!isCaseSensitive) {\r\n text = text.toLowerCase();\r\n } // Exact match\r\n\r\n if (this.pattern === text) {\r\n var _result = {\r\n isMatch: true,\r\n score: 0,\r\n };\r\n\r\n if (includeMatches) {\r\n _result.indices = [[0, text.length - 1]];\r\n }\r\n\r\n return _result;\r\n } // Otherwise, use Bitap algorithm\r\n\r\n var _this$options2 = this.options,\r\n location = _this$options2.location,\r\n distance = _this$options2.distance,\r\n threshold = _this$options2.threshold,\r\n findAllMatches = _this$options2.findAllMatches,\r\n minMatchCharLength = _this$options2.minMatchCharLength,\r\n ignoreLocation = _this$options2.ignoreLocation;\r\n var allIndices = [];\r\n var totalScore = 0;\r\n var hasMatches = false;\r\n this.chunks.forEach(function (_ref2) {\r\n var pattern = _ref2.pattern,\r\n alphabet = _ref2.alphabet,\r\n startIndex = _ref2.startIndex;\r\n\r\n var _search = search(text, pattern, alphabet, {\r\n location: location + startIndex,\r\n distance: distance,\r\n threshold: threshold,\r\n findAllMatches: findAllMatches,\r\n minMatchCharLength: minMatchCharLength,\r\n includeMatches: includeMatches,\r\n ignoreLocation: ignoreLocation,\r\n }),\r\n isMatch = _search.isMatch,\r\n score = _search.score,\r\n indices = _search.indices;\r\n\r\n if (isMatch) {\r\n hasMatches = true;\r\n }\r\n\r\n totalScore += score;\r\n\r\n if (isMatch && indices) {\r\n allIndices = [].concat(_toConsumableArray(allIndices), _toConsumableArray(indices));\r\n }\r\n });\r\n var result = {\r\n isMatch: hasMatches,\r\n score: hasMatches ? totalScore / this.chunks.length : 1,\r\n };\r\n\r\n if (hasMatches && includeMatches) {\r\n result.indices = allIndices;\r\n }\r\n\r\n return result;\r\n },\r\n },\r\n ]);\r\n\r\n return BitapSearch;\r\n})();\r\n\r\nvar BaseMatch = /*#__PURE__*/ (function () {\r\n function BaseMatch(pattern) {\r\n _classCallCheck(this, BaseMatch);\r\n\r\n this.pattern = pattern;\r\n }\r\n\r\n _createClass(\r\n BaseMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function /*text*/ search() {},\r\n },\r\n ],\r\n [\r\n {\r\n key: 'isMultiMatch',\r\n value: function isMultiMatch(pattern) {\r\n return getMatch(pattern, this.multiRegex);\r\n },\r\n },\r\n {\r\n key: 'isSingleMatch',\r\n value: function isSingleMatch(pattern) {\r\n return getMatch(pattern, this.singleRegex);\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return BaseMatch;\r\n})();\r\n\r\nfunction getMatch(pattern, exp) {\r\n var matches = pattern.match(exp);\r\n return matches ? matches[1] : null;\r\n}\r\n\r\nvar ExactMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(ExactMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(ExactMatch);\r\n\r\n function ExactMatch(pattern) {\r\n _classCallCheck(this, ExactMatch);\r\n\r\n return _super.call(this, pattern);\r\n }\r\n\r\n _createClass(\r\n ExactMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n var isMatch = text === this.pattern;\r\n return {\r\n isMatch: isMatch,\r\n score: isMatch ? 0 : 1,\r\n indices: [0, this.pattern.length - 1],\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'exact';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^=\"(.*)\"$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^=(.*)$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return ExactMatch;\r\n})(BaseMatch);\r\n\r\nvar InverseExactMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(InverseExactMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(InverseExactMatch);\r\n\r\n function InverseExactMatch(pattern) {\r\n _classCallCheck(this, InverseExactMatch);\r\n\r\n return _super.call(this, pattern);\r\n }\r\n\r\n _createClass(\r\n InverseExactMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n var index = text.indexOf(this.pattern);\r\n var isMatch = index === -1;\r\n return {\r\n isMatch: isMatch,\r\n score: isMatch ? 0 : 1,\r\n indices: [0, text.length - 1],\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'inverse-exact';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^!\"(.*)\"$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^!(.*)$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return InverseExactMatch;\r\n})(BaseMatch);\r\n\r\nvar PrefixExactMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(PrefixExactMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(PrefixExactMatch);\r\n\r\n function PrefixExactMatch(pattern) {\r\n _classCallCheck(this, PrefixExactMatch);\r\n\r\n return _super.call(this, pattern);\r\n }\r\n\r\n _createClass(\r\n PrefixExactMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n var isMatch = text.startsWith(this.pattern);\r\n return {\r\n isMatch: isMatch,\r\n score: isMatch ? 0 : 1,\r\n indices: [0, this.pattern.length - 1],\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'prefix-exact';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^\\^\"(.*)\"$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^\\^(.*)$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return PrefixExactMatch;\r\n})(BaseMatch);\r\n\r\nvar InversePrefixExactMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(InversePrefixExactMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(InversePrefixExactMatch);\r\n\r\n function InversePrefixExactMatch(pattern) {\r\n _classCallCheck(this, InversePrefixExactMatch);\r\n\r\n return _super.call(this, pattern);\r\n }\r\n\r\n _createClass(\r\n InversePrefixExactMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n var isMatch = !text.startsWith(this.pattern);\r\n return {\r\n isMatch: isMatch,\r\n score: isMatch ? 0 : 1,\r\n indices: [0, text.length - 1],\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'inverse-prefix-exact';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^!\\^\"(.*)\"$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^!\\^(.*)$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return InversePrefixExactMatch;\r\n})(BaseMatch);\r\n\r\nvar SuffixExactMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(SuffixExactMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(SuffixExactMatch);\r\n\r\n function SuffixExactMatch(pattern) {\r\n _classCallCheck(this, SuffixExactMatch);\r\n\r\n return _super.call(this, pattern);\r\n }\r\n\r\n _createClass(\r\n SuffixExactMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n var isMatch = text.endsWith(this.pattern);\r\n return {\r\n isMatch: isMatch,\r\n score: isMatch ? 0 : 1,\r\n indices: [text.length - this.pattern.length, text.length - 1],\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'suffix-exact';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^\"(.*)\"\\$$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^(.*)\\$$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return SuffixExactMatch;\r\n})(BaseMatch);\r\n\r\nvar InverseSuffixExactMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(InverseSuffixExactMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(InverseSuffixExactMatch);\r\n\r\n function InverseSuffixExactMatch(pattern) {\r\n _classCallCheck(this, InverseSuffixExactMatch);\r\n\r\n return _super.call(this, pattern);\r\n }\r\n\r\n _createClass(\r\n InverseSuffixExactMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n var isMatch = !text.endsWith(this.pattern);\r\n return {\r\n isMatch: isMatch,\r\n score: isMatch ? 0 : 1,\r\n indices: [0, text.length - 1],\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'inverse-suffix-exact';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^!\"(.*)\"\\$$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^!(.*)\\$$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return InverseSuffixExactMatch;\r\n})(BaseMatch);\r\n\r\nvar FuzzyMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(FuzzyMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(FuzzyMatch);\r\n\r\n function FuzzyMatch(pattern) {\r\n var _this;\r\n\r\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\r\n _ref$location = _ref.location,\r\n location = _ref$location === void 0 ? Config.location : _ref$location,\r\n _ref$threshold = _ref.threshold,\r\n threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold,\r\n _ref$distance = _ref.distance,\r\n distance = _ref$distance === void 0 ? Config.distance : _ref$distance,\r\n _ref$includeMatches = _ref.includeMatches,\r\n includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches,\r\n _ref$findAllMatches = _ref.findAllMatches,\r\n findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches,\r\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\r\n minMatchCharLength =\r\n _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng,\r\n _ref$isCaseSensitive = _ref.isCaseSensitive,\r\n isCaseSensitive =\r\n _ref$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref$isCaseSensitive,\r\n _ref$ignoreLocation = _ref.ignoreLocation,\r\n ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation;\r\n\r\n _classCallCheck(this, FuzzyMatch);\r\n\r\n _this = _super.call(this, pattern);\r\n _this._bitapSearch = new BitapSearch(pattern, {\r\n location: location,\r\n threshold: threshold,\r\n distance: distance,\r\n includeMatches: includeMatches,\r\n findAllMatches: findAllMatches,\r\n minMatchCharLength: minMatchCharLength,\r\n isCaseSensitive: isCaseSensitive,\r\n ignoreLocation: ignoreLocation,\r\n });\r\n return _this;\r\n }\r\n\r\n _createClass(\r\n FuzzyMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n return this._bitapSearch.searchIn(text);\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'fuzzy';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^\"(.*)\"$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^(.*)$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return FuzzyMatch;\r\n})(BaseMatch);\r\n\r\nvar IncludeMatch = /*#__PURE__*/ (function (_BaseMatch) {\r\n _inherits(IncludeMatch, _BaseMatch);\r\n\r\n var _super = _createSuper(IncludeMatch);\r\n\r\n function IncludeMatch(pattern) {\r\n _classCallCheck(this, IncludeMatch);\r\n\r\n return _super.call(this, pattern);\r\n }\r\n\r\n _createClass(\r\n IncludeMatch,\r\n [\r\n {\r\n key: 'search',\r\n value: function search(text) {\r\n var location = 0;\r\n var index;\r\n var indices = [];\r\n var patternLen = this.pattern.length; // Get all exact matches\r\n\r\n while ((index = text.indexOf(this.pattern, location)) > -1) {\r\n location = index + patternLen;\r\n indices.push([index, location - 1]);\r\n }\r\n\r\n var isMatch = !!indices.length;\r\n return {\r\n isMatch: isMatch,\r\n score: isMatch ? 0 : 1,\r\n indices: indices,\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'type',\r\n get: function get() {\r\n return 'include';\r\n },\r\n },\r\n {\r\n key: 'multiRegex',\r\n get: function get() {\r\n return /^'\"(.*)\"$/;\r\n },\r\n },\r\n {\r\n key: 'singleRegex',\r\n get: function get() {\r\n return /^'(.*)$/;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return IncludeMatch;\r\n})(BaseMatch);\r\n\r\nvar searchers = [\r\n ExactMatch,\r\n IncludeMatch,\r\n PrefixExactMatch,\r\n InversePrefixExactMatch,\r\n InverseSuffixExactMatch,\r\n SuffixExactMatch,\r\n InverseExactMatch,\r\n FuzzyMatch,\r\n];\r\nvar searchersLen = searchers.length; // Regex to split by spaces, but keep anything in quotes together\r\n\r\nvar SPACE_RE = / +(?=([^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)/;\r\nvar OR_TOKEN = '|'; // Return a 2D array representation of the query, for simpler parsing.\r\n// Example:\r\n// \"^core go$ | rb$ | py$ xy$\" => [[\"^core\", \"go$\"], [\"rb$\"], [\"py$\", \"xy$\"]]\r\n\r\nfunction parseQuery(pattern) {\r\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\r\n return pattern.split(OR_TOKEN).map(function (item) {\r\n var query = item\r\n .trim()\r\n .split(SPACE_RE)\r\n .filter(function (item) {\r\n return item && !!item.trim();\r\n });\r\n var results = [];\r\n\r\n for (var i = 0, len = query.length; i < len; i += 1) {\r\n var queryItem = query[i]; // 1. Handle multiple query match (i.e, once that are quoted, like `\"hello world\"`)\r\n\r\n var found = false;\r\n var idx = -1;\r\n\r\n while (!found && ++idx < searchersLen) {\r\n var searcher = searchers[idx];\r\n var token = searcher.isMultiMatch(queryItem);\r\n\r\n if (token) {\r\n results.push(new searcher(token, options));\r\n found = true;\r\n }\r\n }\r\n\r\n if (found) {\r\n continue;\r\n } // 2. Handle single query matches (i.e, once that are *not* quoted)\r\n\r\n idx = -1;\r\n\r\n while (++idx < searchersLen) {\r\n var _searcher = searchers[idx];\r\n\r\n var _token = _searcher.isSingleMatch(queryItem);\r\n\r\n if (_token) {\r\n results.push(new _searcher(_token, options));\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return results;\r\n });\r\n}\r\n\r\n// to a singl match\r\n\r\nvar MultiMatchSet = new Set([FuzzyMatch.type, IncludeMatch.type]);\r\n/**\r\n * Command-like searching\r\n * ======================\r\n *\r\n * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`,\r\n * search in a given text.\r\n *\r\n * Search syntax:\r\n *\r\n * | Token | Match type | Description |\r\n * | ----------- | -------------------------- | -------------------------------------- |\r\n * | `jscript` | fuzzy-match | Items that fuzzy match `jscript` |\r\n * | `=scheme` | exact-match | Items that are `scheme` |\r\n * | `'python` | include-match | Items that include `python` |\r\n * | `!ruby` | inverse-exact-match | Items that do not include `ruby` |\r\n * | `^java` | prefix-exact-match | Items that start with `java` |\r\n * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` |\r\n * | `.js$` | suffix-exact-match | Items that end with `.js` |\r\n * | `!.go$` | inverse-suffix-exact-match | Items that do not end with `.go` |\r\n *\r\n * A single pipe character acts as an OR operator. For example, the following\r\n * query matches entries that start with `core` and end with either`go`, `rb`,\r\n * or`py`.\r\n *\r\n * ```\r\n * ^core go$ | rb$ | py$\r\n * ```\r\n */\r\n\r\nvar ExtendedSearch = /*#__PURE__*/ (function () {\r\n function ExtendedSearch(pattern) {\r\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\r\n _ref$isCaseSensitive = _ref.isCaseSensitive,\r\n isCaseSensitive =\r\n _ref$isCaseSensitive === void 0 ? Config.isCaseSensitive : _ref$isCaseSensitive,\r\n _ref$includeMatches = _ref.includeMatches,\r\n includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches,\r\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\r\n minMatchCharLength =\r\n _ref$minMatchCharLeng === void 0 ? Config.minMatchCharLength : _ref$minMatchCharLeng,\r\n _ref$ignoreLocation = _ref.ignoreLocation,\r\n ignoreLocation = _ref$ignoreLocation === void 0 ? Config.ignoreLocation : _ref$ignoreLocation,\r\n _ref$findAllMatches = _ref.findAllMatches,\r\n findAllMatches = _ref$findAllMatches === void 0 ? Config.findAllMatches : _ref$findAllMatches,\r\n _ref$location = _ref.location,\r\n location = _ref$location === void 0 ? Config.location : _ref$location,\r\n _ref$threshold = _ref.threshold,\r\n threshold = _ref$threshold === void 0 ? Config.threshold : _ref$threshold,\r\n _ref$distance = _ref.distance,\r\n distance = _ref$distance === void 0 ? Config.distance : _ref$distance;\r\n\r\n _classCallCheck(this, ExtendedSearch);\r\n\r\n this.query = null;\r\n this.options = {\r\n isCaseSensitive: isCaseSensitive,\r\n includeMatches: includeMatches,\r\n minMatchCharLength: minMatchCharLength,\r\n findAllMatches: findAllMatches,\r\n ignoreLocation: ignoreLocation,\r\n location: location,\r\n threshold: threshold,\r\n distance: distance,\r\n };\r\n this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase();\r\n this.query = parseQuery(this.pattern, this.options);\r\n }\r\n\r\n _createClass(\r\n ExtendedSearch,\r\n [\r\n {\r\n key: 'searchIn',\r\n value: function searchIn(text) {\r\n var query = this.query;\r\n\r\n if (!query) {\r\n return {\r\n isMatch: false,\r\n score: 1,\r\n };\r\n }\r\n\r\n var _this$options = this.options,\r\n includeMatches = _this$options.includeMatches,\r\n isCaseSensitive = _this$options.isCaseSensitive;\r\n text = isCaseSensitive ? text : text.toLowerCase();\r\n var numMatches = 0;\r\n var allIndices = [];\r\n var totalScore = 0; // ORs\r\n\r\n for (var i = 0, qLen = query.length; i < qLen; i += 1) {\r\n var searchers = query[i]; // Reset indices\r\n\r\n allIndices.length = 0;\r\n numMatches = 0; // ANDs\r\n\r\n for (var j = 0, pLen = searchers.length; j < pLen; j += 1) {\r\n var searcher = searchers[j];\r\n\r\n var _searcher$search = searcher.search(text),\r\n isMatch = _searcher$search.isMatch,\r\n indices = _searcher$search.indices,\r\n score = _searcher$search.score;\r\n\r\n if (isMatch) {\r\n numMatches += 1;\r\n totalScore += score;\r\n\r\n if (includeMatches) {\r\n var type = searcher.constructor.type;\r\n\r\n if (MultiMatchSet.has(type)) {\r\n allIndices = [].concat(\r\n _toConsumableArray(allIndices),\r\n _toConsumableArray(indices)\r\n );\r\n } else {\r\n allIndices.push(indices);\r\n }\r\n }\r\n } else {\r\n totalScore = 0;\r\n numMatches = 0;\r\n allIndices.length = 0;\r\n break;\r\n }\r\n } // OR condition, so if TRUE, return\r\n\r\n if (numMatches) {\r\n var result = {\r\n isMatch: true,\r\n score: totalScore / numMatches,\r\n };\r\n\r\n if (includeMatches) {\r\n result.indices = allIndices;\r\n }\r\n\r\n return result;\r\n }\r\n } // Nothing was matched\r\n\r\n return {\r\n isMatch: false,\r\n score: 1,\r\n };\r\n },\r\n },\r\n ],\r\n [\r\n {\r\n key: 'condition',\r\n value: function condition(_, options) {\r\n return options.useExtendedSearch;\r\n },\r\n },\r\n ]\r\n );\r\n\r\n return ExtendedSearch;\r\n})();\r\n\r\nvar registeredSearchers = [];\r\nfunction register() {\r\n registeredSearchers.push.apply(registeredSearchers, arguments);\r\n}\r\nfunction createSearcher(pattern, options) {\r\n for (var i = 0, len = registeredSearchers.length; i < len; i += 1) {\r\n var searcherClass = registeredSearchers[i];\r\n\r\n if (searcherClass.condition(pattern, options)) {\r\n return new searcherClass(pattern, options);\r\n }\r\n }\r\n\r\n return new BitapSearch(pattern, options);\r\n}\r\n\r\nvar LogicalOperator = {\r\n AND: '$and',\r\n OR: '$or',\r\n};\r\nvar KeyType = {\r\n PATH: '$path',\r\n PATTERN: '$val',\r\n};\r\n\r\nvar isExpression = function isExpression(query) {\r\n return !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);\r\n};\r\n\r\nvar isPath = function isPath(query) {\r\n return !!query[KeyType.PATH];\r\n};\r\n\r\nvar isLeaf = function isLeaf(query) {\r\n return !isArray(query) && isObject(query) && !isExpression(query);\r\n};\r\n\r\nvar convertToExplicit = function convertToExplicit(query) {\r\n return _defineProperty(\r\n {},\r\n LogicalOperator.AND,\r\n Object.keys(query).map(function (key) {\r\n return _defineProperty({}, key, query[key]);\r\n })\r\n );\r\n}; // When `auto` is `true`, the parse function will infer and initialize and add\r\n// the appropriate `Searcher` instance\r\n\r\nfunction parse(query, options) {\r\n var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\r\n _ref3$auto = _ref3.auto,\r\n auto = _ref3$auto === void 0 ? true : _ref3$auto;\r\n\r\n var next = function next(query) {\r\n var keys = Object.keys(query);\r\n var isQueryPath = isPath(query);\r\n\r\n if (!isQueryPath && keys.length > 1 && !isExpression(query)) {\r\n return next(convertToExplicit(query));\r\n }\r\n\r\n if (isLeaf(query)) {\r\n var key = isQueryPath ? query[KeyType.PATH] : keys[0];\r\n var pattern = isQueryPath ? query[KeyType.PATTERN] : query[key];\r\n\r\n if (!isString(pattern)) {\r\n throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));\r\n }\r\n\r\n var obj = {\r\n keyId: createKeyId(key),\r\n pattern: pattern,\r\n };\r\n\r\n if (auto) {\r\n obj.searcher = createSearcher(pattern, options);\r\n }\r\n\r\n return obj;\r\n }\r\n\r\n var node = {\r\n children: [],\r\n operator: keys[0],\r\n };\r\n keys.forEach(function (key) {\r\n var value = query[key];\r\n\r\n if (isArray(value)) {\r\n value.forEach(function (item) {\r\n node.children.push(next(item));\r\n });\r\n }\r\n });\r\n return node;\r\n };\r\n\r\n if (!isExpression(query)) {\r\n query = convertToExplicit(query);\r\n }\r\n\r\n return next(query);\r\n}\r\n\r\nfunction computeScore(results, _ref) {\r\n var _ref$ignoreFieldNorm = _ref.ignoreFieldNorm,\r\n ignoreFieldNorm =\r\n _ref$ignoreFieldNorm === void 0 ? Config.ignoreFieldNorm : _ref$ignoreFieldNorm;\r\n results.forEach(function (result) {\r\n var totalScore = 1;\r\n result.matches.forEach(function (_ref2) {\r\n var key = _ref2.key,\r\n norm = _ref2.norm,\r\n score = _ref2.score;\r\n var weight = key ? key.weight : null;\r\n totalScore *= Math.pow(\r\n score === 0 && weight ? Number.EPSILON : score,\r\n (weight || 1) * (ignoreFieldNorm ? 1 : norm)\r\n );\r\n });\r\n result.score = totalScore;\r\n });\r\n}\r\n\r\nfunction transformMatches(result, data) {\r\n var matches = result.matches;\r\n data.matches = [];\r\n\r\n if (!isDefined(matches)) {\r\n return;\r\n }\r\n\r\n matches.forEach(function (match) {\r\n if (!isDefined(match.indices) || !match.indices.length) {\r\n return;\r\n }\r\n\r\n var indices = match.indices,\r\n value = match.value;\r\n var obj = {\r\n indices: indices,\r\n value: value,\r\n };\r\n\r\n if (match.key) {\r\n obj.key = match.key.src;\r\n }\r\n\r\n if (match.idx > -1) {\r\n obj.refIndex = match.idx;\r\n }\r\n\r\n data.matches.push(obj);\r\n });\r\n}\r\n\r\nfunction transformScore(result, data) {\r\n data.score = result.score;\r\n}\r\n\r\nfunction format(results, docs) {\r\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\r\n _ref$includeMatches = _ref.includeMatches,\r\n includeMatches = _ref$includeMatches === void 0 ? Config.includeMatches : _ref$includeMatches,\r\n _ref$includeScore = _ref.includeScore,\r\n includeScore = _ref$includeScore === void 0 ? Config.includeScore : _ref$includeScore;\r\n\r\n var transformers = [];\r\n if (includeMatches) transformers.push(transformMatches);\r\n if (includeScore) transformers.push(transformScore);\r\n return results.map(function (result) {\r\n var idx = result.idx;\r\n var data = {\r\n item: docs[idx],\r\n refIndex: idx,\r\n };\r\n\r\n if (transformers.length) {\r\n transformers.forEach(function (transformer) {\r\n transformer(result, data);\r\n });\r\n }\r\n\r\n return data;\r\n });\r\n}\r\n\r\nvar Fuse$1 = /*#__PURE__*/ (function () {\r\n function Fuse(docs) {\r\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\r\n var index = arguments.length > 2 ? arguments[2] : undefined;\r\n\r\n _classCallCheck(this, Fuse);\r\n\r\n this.options = _objectSpread2(_objectSpread2({}, Config), options);\r\n\r\n if (this.options.useExtendedSearch && !true) {\r\n throw new Error(EXTENDED_SEARCH_UNAVAILABLE);\r\n }\r\n\r\n this._keyStore = new KeyStore(this.options.keys);\r\n this.setCollection(docs, index);\r\n }\r\n\r\n _createClass(Fuse, [\r\n {\r\n key: 'setCollection',\r\n value: function setCollection(docs, index) {\r\n this._docs = docs;\r\n\r\n if (index && !(index instanceof FuseIndex)) {\r\n throw new Error(INCORRECT_INDEX_TYPE);\r\n }\r\n\r\n this._myIndex =\r\n index ||\r\n createIndex(this.options.keys, this._docs, {\r\n getFn: this.options.getFn,\r\n fieldNormWeight: this.options.fieldNormWeight,\r\n });\r\n },\r\n },\r\n {\r\n key: 'add',\r\n value: function add(doc) {\r\n if (!isDefined(doc)) {\r\n return;\r\n }\r\n\r\n this._docs.push(doc);\r\n\r\n this._myIndex.add(doc);\r\n },\r\n },\r\n {\r\n key: 'remove',\r\n value: function remove() {\r\n var predicate =\r\n arguments.length > 0 && arguments[0] !== undefined\r\n ? arguments[0]\r\n : function () /* doc, idx */\r\n {\r\n return false;\r\n };\r\n var results = [];\r\n\r\n for (var i = 0, len = this._docs.length; i < len; i += 1) {\r\n var doc = this._docs[i];\r\n\r\n if (predicate(doc, i)) {\r\n this.removeAt(i);\r\n i -= 1;\r\n len -= 1;\r\n results.push(doc);\r\n }\r\n }\r\n\r\n return results;\r\n },\r\n },\r\n {\r\n key: 'removeAt',\r\n value: function removeAt(idx) {\r\n this._docs.splice(idx, 1);\r\n\r\n this._myIndex.removeAt(idx);\r\n },\r\n },\r\n {\r\n key: 'getIndex',\r\n value: function getIndex() {\r\n return this._myIndex;\r\n },\r\n },\r\n {\r\n key: 'search',\r\n value: function search(query) {\r\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\r\n _ref$limit = _ref.limit,\r\n limit = _ref$limit === void 0 ? -1 : _ref$limit;\r\n\r\n var _this$options = this.options,\r\n includeMatches = _this$options.includeMatches,\r\n includeScore = _this$options.includeScore,\r\n shouldSort = _this$options.shouldSort,\r\n sortFn = _this$options.sortFn,\r\n ignoreFieldNorm = _this$options.ignoreFieldNorm;\r\n var results = isString(query)\r\n ? isString(this._docs[0])\r\n ? this._searchStringList(query)\r\n : this._searchObjectList(query)\r\n : this._searchLogical(query);\r\n computeScore(results, {\r\n ignoreFieldNorm: ignoreFieldNorm,\r\n });\r\n\r\n if (shouldSort) {\r\n results.sort(sortFn);\r\n }\r\n\r\n if (isNumber(limit) && limit > -1) {\r\n results = results.slice(0, limit);\r\n }\r\n\r\n return format(results, this._docs, {\r\n includeMatches: includeMatches,\r\n includeScore: includeScore,\r\n });\r\n },\r\n },\r\n {\r\n key: '_searchStringList',\r\n value: function _searchStringList(query) {\r\n var searcher = createSearcher(query, this.options);\r\n var records = this._myIndex.records;\r\n var results = []; // Iterate over every string in the index\r\n\r\n records.forEach(function (_ref2) {\r\n var text = _ref2.v,\r\n idx = _ref2.i,\r\n norm = _ref2.n;\r\n\r\n if (!isDefined(text)) {\r\n return;\r\n }\r\n\r\n var _searcher$searchIn = searcher.searchIn(text),\r\n isMatch = _searcher$searchIn.isMatch,\r\n score = _searcher$searchIn.score,\r\n indices = _searcher$searchIn.indices;\r\n\r\n if (isMatch) {\r\n results.push({\r\n item: text,\r\n idx: idx,\r\n matches: [\r\n {\r\n score: score,\r\n value: text,\r\n norm: norm,\r\n indices: indices,\r\n },\r\n ],\r\n });\r\n }\r\n });\r\n return results;\r\n },\r\n },\r\n {\r\n key: '_searchLogical',\r\n value: function _searchLogical(query) {\r\n var _this = this;\r\n\r\n var expression = parse(query, this.options);\r\n\r\n var evaluate = function evaluate(node, item, idx) {\r\n if (!node.children) {\r\n var keyId = node.keyId,\r\n searcher = node.searcher;\r\n\r\n var matches = _this._findMatches({\r\n key: _this._keyStore.get(keyId),\r\n value: _this._myIndex.getValueForItemAtKeyId(item, keyId),\r\n searcher: searcher,\r\n });\r\n\r\n if (matches && matches.length) {\r\n return [\r\n {\r\n idx: idx,\r\n item: item,\r\n matches: matches,\r\n },\r\n ];\r\n }\r\n\r\n return [];\r\n }\r\n\r\n var res = [];\r\n\r\n for (var i = 0, len = node.children.length; i < len; i += 1) {\r\n var child = node.children[i];\r\n var result = evaluate(child, item, idx);\r\n\r\n if (result.length) {\r\n res.push.apply(res, _toConsumableArray(result));\r\n } else if (node.operator === LogicalOperator.AND) {\r\n return [];\r\n }\r\n }\r\n\r\n return res;\r\n };\r\n\r\n var records = this._myIndex.records;\r\n var resultMap = {};\r\n var results = [];\r\n records.forEach(function (_ref3) {\r\n var item = _ref3.$,\r\n idx = _ref3.i;\r\n\r\n if (isDefined(item)) {\r\n var expResults = evaluate(expression, item, idx);\r\n\r\n if (expResults.length) {\r\n // Dedupe when adding\r\n if (!resultMap[idx]) {\r\n resultMap[idx] = {\r\n idx: idx,\r\n item: item,\r\n matches: [],\r\n };\r\n results.push(resultMap[idx]);\r\n }\r\n\r\n expResults.forEach(function (_ref4) {\r\n var _resultMap$idx$matche;\r\n\r\n var matches = _ref4.matches;\r\n\r\n (_resultMap$idx$matche = resultMap[idx].matches).push.apply(\r\n _resultMap$idx$matche,\r\n _toConsumableArray(matches)\r\n );\r\n });\r\n }\r\n }\r\n });\r\n return results;\r\n },\r\n },\r\n {\r\n key: '_searchObjectList',\r\n value: function _searchObjectList(query) {\r\n var _this2 = this;\r\n\r\n var searcher = createSearcher(query, this.options);\r\n var _this$_myIndex = this._myIndex,\r\n keys = _this$_myIndex.keys,\r\n records = _this$_myIndex.records;\r\n var results = []; // List is Array<Object>\r\n\r\n records.forEach(function (_ref5) {\r\n var item = _ref5.$,\r\n idx = _ref5.i;\r\n\r\n if (!isDefined(item)) {\r\n return;\r\n }\r\n\r\n var matches = []; // Iterate over every key (i.e, path), and fetch the value at that key\r\n\r\n keys.forEach(function (key, keyIndex) {\r\n matches.push.apply(\r\n matches,\r\n _toConsumableArray(\r\n _this2._findMatches({\r\n key: key,\r\n value: item[keyIndex],\r\n searcher: searcher,\r\n })\r\n )\r\n );\r\n });\r\n\r\n if (matches.length) {\r\n results.push({\r\n idx: idx,\r\n item: item,\r\n matches: matches,\r\n });\r\n }\r\n });\r\n return results;\r\n },\r\n },\r\n {\r\n key: '_findMatches',\r\n value: function _findMatches(_ref6) {\r\n var key = _ref6.key,\r\n value = _ref6.value,\r\n searcher = _ref6.searcher;\r\n\r\n if (!isDefined(value)) {\r\n return [];\r\n }\r\n\r\n var matches = [];\r\n\r\n if (isArray(value)) {\r\n value.forEach(function (_ref7) {\r\n var text = _ref7.v,\r\n idx = _ref7.i,\r\n norm = _ref7.n;\r\n\r\n if (!isDefined(text)) {\r\n return;\r\n }\r\n\r\n var _searcher$searchIn2 = searcher.searchIn(text),\r\n isMatch = _searcher$searchIn2.isMatch,\r\n score = _searcher$searchIn2.score,\r\n indices = _searcher$searchIn2.indices;\r\n\r\n if (isMatch) {\r\n matches.push({\r\n score: score,\r\n key: key,\r\n value: text,\r\n idx: idx,\r\n norm: norm,\r\n indices: indices,\r\n });\r\n }\r\n });\r\n } else {\r\n var text = value.v,\r\n norm = value.n;\r\n\r\n var _searcher$searchIn3 = searcher.searchIn(text),\r\n isMatch = _searcher$searchIn3.isMatch,\r\n score = _searcher$searchIn3.score,\r\n indices = _searcher$searchIn3.indices;\r\n\r\n if (isMatch) {\r\n matches.push({\r\n score: score,\r\n key: key,\r\n value: text,\r\n norm: norm,\r\n indices: indices,\r\n });\r\n }\r\n }\r\n\r\n return matches;\r\n },\r\n },\r\n ]);\r\n\r\n return Fuse;\r\n})();\r\n\r\nFuse$1.version = '6.5.3';\r\nFuse$1.createIndex = createIndex;\r\nFuse$1.parseIndex = parseIndex;\r\nFuse$1.config = Config;\r\n\r\n{\r\n Fuse$1.parseQuery = parse;\r\n}\r\n\r\n{\r\n register(ExtendedSearch);\r\n}\r\n\r\nexport var Fuse = Fuse$1;\r\n","import { TVA_CONFIG, updateSettings } from '../scripts/settings.js';\r\nimport { SEARCH_TYPE, decodeURISafely } from '../scripts/utils.js';\r\nimport { insertArtSelectButton } from './artSelect.js';\r\n\r\nexport default class UserList extends FormApplication {\r\n constructor(object, img, regenStyle) {\r\n super({}, {});\r\n this.object = object;\r\n this.img = img;\r\n this.regenStyle = regenStyle;\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-user-list',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/userList.html',\r\n resizable: false,\r\n minimizable: false,\r\n title: 'User To Image',\r\n width: 300,\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n const mappings = this.object.document.getFlag('token-variants', 'userMappings') || {};\r\n let users = [];\r\n game.users.forEach((user) => {\r\n users.push({\r\n avatar: user.avatar,\r\n name: user.name,\r\n apply: user.id in mappings && mappings[user.id] === this.img,\r\n userId: user.id,\r\n color: user.color,\r\n });\r\n });\r\n data.users = users;\r\n data.invisibleImage = TVA_CONFIG.invisibleImage;\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n insertArtSelectButton(html, 'invisibleImage', {\r\n search: 'Invisible Image',\r\n searchType: SEARCH_TYPE.TOKEN,\r\n });\r\n }\r\n\r\n async _updateObject(event, formData) {\r\n const mappings = this.object.document.getFlag('token-variants', 'userMappings') || {};\r\n\r\n if (formData.invisibleImage !== TVA_CONFIG.invisibleImage) {\r\n updateSettings({ invisibleImage: decodeURISafely(formData.invisibleImage) });\r\n }\r\n delete formData.invisibleImage;\r\n\r\n const affectedImages = [this.img];\r\n\r\n for (const [userId, apply] of Object.entries(formData)) {\r\n if (apply) {\r\n if (mappings[userId] && mappings[userId] !== this.img)\r\n affectedImages.push(mappings[userId]);\r\n mappings[userId] = this.img;\r\n } else if (mappings[userId] === this.img) {\r\n delete mappings[userId];\r\n mappings['-=' + userId] = null;\r\n }\r\n }\r\n\r\n if (Object.keys(mappings).filter((userId) => !userId.startsWith('-=')).length === 0) {\r\n await this.object.document.unsetFlag('token-variants', 'userMappings');\r\n } else {\r\n await this.object.document.setFlag('token-variants', 'userMappings', mappings);\r\n }\r\n\r\n for (const img of affectedImages) {\r\n this.regenStyle(this.object, img);\r\n }\r\n }\r\n}\r\n","import {\r\n getFileName,\r\n isImage,\r\n isVideo,\r\n SEARCH_TYPE,\r\n keyPressed,\r\n updateActorImage,\r\n updateTokenImage,\r\n decodeURISafely,\r\n} from '../scripts/utils.js';\r\nimport TokenCustomConfig from './tokenCustomConfig.js';\r\nimport EffectMappingForm from './effectMappingForm.js';\r\nimport { TVA_CONFIG } from '../scripts/settings.js';\r\nimport UserList from './userList.js';\r\nimport FlagsConfig from './flagsConfig.js';\r\nimport RandomizerConfig from './randomizerConfig.js';\r\nimport { doImageSearch, findImagesFuzzy } from '../scripts/search.js';\r\n\r\nexport const TOKEN_HUD_VARIANTS = { variants: null, actor: null };\r\n\r\nexport async function renderTokenHUD(hud, html, token, searchText = '', fp_files = null) {\r\n activateStatusEffectListeners(token);\r\n\r\n const hudSettings = TVA_CONFIG.hud;\r\n const FULL_ACCESS = TVA_CONFIG.permissions.hudFullAccess[game.user.role];\r\n const PARTIAL_ACCESS = TVA_CONFIG.permissions.hud[game.user.role];\r\n\r\n // Check if the HUD button should be displayed\r\n if (\r\n !hudSettings.enableSideMenu ||\r\n (!PARTIAL_ACCESS && !FULL_ACCESS) ||\r\n token.flags['token-variants']?.disableHUDButton\r\n )\r\n return;\r\n\r\n const tokenActor = game.actors.get(token.actorId);\r\n\r\n // Disable button if Token HUD Wildcard is enabled and appropriate setting is set\r\n if (TVA_CONFIG.worldHud.disableIfTHWEnabled && game.modules.get('token-hud-wildcard')?.active) {\r\n if (tokenActor && tokenActor.prototypeToken.randomImg) return;\r\n }\r\n\r\n const button = $(`\r\n <div class=\"control-icon\" data-action=\"token-variants-side-selector\">\r\n <img\r\n id=\"token-variants-side-button\"\r\n src=\"modules/token-variants/img/token-images.svg\"\r\n width=\"36\"\r\n height=\"36\"\r\n title=\"Left-click: Image Menu
Right-click: Search & Additional settings\"\r\n />\r\n </div>\r\n`);\r\n\r\n html.find('div.right').last().append(button);\r\n html.find('div.right').click(_deactivateTokenVariantsSideSelector);\r\n\r\n button.click((event) => _onButtonClick(event, token));\r\n if (FULL_ACCESS) {\r\n button.contextmenu((event) => _onButtonRightClick(event, hud, html, token));\r\n }\r\n}\r\n\r\nasync function _onButtonClick(event, token) {\r\n const button = $(event.target).closest('.control-icon');\r\n\r\n // De-activate 'Status Effects'\r\n button.closest('div.right').find('div.control-icon.effects').removeClass('active');\r\n button.closest('div.right').find('.status-effects').removeClass('active');\r\n\r\n // Remove contextmenu\r\n button.find('.contextmenu').remove();\r\n\r\n // Toggle variants side menu\r\n button.toggleClass('active');\r\n let variantsWrap = button.find('.token-variants-wrap');\r\n if (button.hasClass('active')) {\r\n if (!variantsWrap.length) {\r\n variantsWrap = await renderSideSelect(token);\r\n if (variantsWrap) button.find('img').after(variantsWrap);\r\n else return;\r\n }\r\n variantsWrap.addClass('active');\r\n } else {\r\n variantsWrap.removeClass('active');\r\n }\r\n}\r\n\r\nfunction _onButtonRightClick(event, hud, html, token) {\r\n // Display side menu if button is not active yet\r\n const button = $(event.target).closest('.control-icon');\r\n if (!button.hasClass('active')) {\r\n // button.trigger('click');\r\n button.addClass('active');\r\n }\r\n\r\n if (button.find('.contextmenu').length) {\r\n // Contextmenu already displayed. Remove and activate images\r\n button.find('.contextmenu').remove();\r\n button.removeClass('active').trigger('click');\r\n //button.find('.token-variants-wrap.images').addClass('active');\r\n } else {\r\n // Contextmenu is not displayed. Hide images, create it and add it\r\n button.find('.token-variants-wrap.images').removeClass('active');\r\n const contextMenu = $(`\r\n <div class=\"token-variants-wrap contextmenu active\">\r\n <div class=\"token-variants-context-menu active\">\r\n <input class=\"token-variants-side-search\" type=\"text\" />\r\n <button class=\"flags\" type=\"button\"><i class=\"fab fa-font-awesome-flag\"></i><label>Flags</label></button>\r\n <button class=\"file-picker\" type=\"button\"><i class=\"fas fa-file-import fa-fw\"></i><label>Browse Folders</label></button>\r\n <button class=\"effectConfig\" type=\"button\"><i class=\"fas fa-sun\"></i><label>Mappings</label></button>\r\n <button class=\"randomizerConfig\" type=\"button\"><i class=\"fas fa-dice\"></i><label>Randomizer</label></button>\r\n </div>\r\n </div>\r\n `);\r\n button.append(contextMenu);\r\n\r\n // Register contextmenu listeners\r\n contextMenu\r\n .find('.token-variants-side-search')\r\n .on('keyup', (event) => _onImageSearchKeyUp(event, token))\r\n .on('click', (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n });\r\n contextMenu.find('.flags').click((event) => {\r\n const tkn = canvas.tokens.get(token._id);\r\n if (tkn) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n new FlagsConfig(tkn).render(true);\r\n }\r\n });\r\n contextMenu.find('.file-picker').click(async (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n new FilePicker({\r\n type: 'imagevideo',\r\n callback: async (path, fp) => {\r\n const content = await FilePicker.browse(fp.activeSource, fp.result.target);\r\n let files = content.files.filter((f) => isImage(f) || isVideo(f));\r\n if (files.length) {\r\n button.find('.token-variants-wrap').remove();\r\n const sideSelect = await renderSideSelect(token, '', files);\r\n if (sideSelect) {\r\n sideSelect.addClass('active');\r\n button.append(sideSelect);\r\n }\r\n }\r\n },\r\n }).render(true);\r\n });\r\n contextMenu.find('.effectConfig').click((event) => {\r\n new EffectMappingForm(token).render(true);\r\n });\r\n contextMenu.find('.randomizerConfig').click((event) => {\r\n new RandomizerConfig(token).render(true);\r\n });\r\n }\r\n}\r\n\r\nfunction _deactivateTokenVariantsSideSelector(event) {\r\n const controlIcon = $(event.target).closest('.control-icon');\r\n const dataAction = controlIcon.attr('data-action');\r\n\r\n switch (dataAction) {\r\n case 'effects':\r\n break; // Effects button\r\n case 'thwildcard-selector':\r\n break; // Token HUD Wildcard module button\r\n default:\r\n return;\r\n }\r\n\r\n $(event.target)\r\n .closest('div.right')\r\n .find('.control-icon[data-action=\"token-variants-side-selector\"]')\r\n .removeClass('active');\r\n $(event.target).closest('div.right').find('.token-variants-wrap').removeClass('active');\r\n}\r\n\r\nasync function renderSideSelect(token, searchText = '', fp_files = null) {\r\n const hudSettings = TVA_CONFIG.hud;\r\n const worldHudSettings = TVA_CONFIG.worldHud;\r\n const FULL_ACCESS = TVA_CONFIG.permissions.hudFullAccess[game.user.role];\r\n const PARTIAL_ACCESS = TVA_CONFIG.permissions.hud[game.user.role];\r\n\r\n const tokenActor = game.actors.get(token.actorId);\r\n\r\n let images = [];\r\n let actorVariants = [];\r\n let imageDuplicates = new Set();\r\n const pushImage = (img) => {\r\n if (imageDuplicates.has(img.path)) {\r\n if (!images.find((obj) => obj.path === img.path && obj.name === img.name)) {\r\n images.push(img);\r\n }\r\n } else {\r\n images.push(img);\r\n imageDuplicates.add(img.path);\r\n }\r\n };\r\n\r\n actorVariants = getVariants(tokenActor);\r\n\r\n if (!fp_files) {\r\n if (!searchText) {\r\n // Insert current token image\r\n if (token.texture?.src && token.texture?.src !== CONST.DEFAULT_TOKEN) {\r\n pushImage({\r\n path: decodeURISafely(token.texture.src),\r\n name: token.flags?.['token-variants']?.name ?? getFileName(token.texture.src),\r\n });\r\n }\r\n\r\n if (tokenActor) {\r\n // Insert default token image\r\n const defaultImg =\r\n tokenActor.prototypeToken?.flags['token-variants']?.['randomImgDefault'] ||\r\n tokenActor.prototypeToken?.flags['token-hud-wildcard']?.['default'] ||\r\n '';\r\n if (defaultImg) {\r\n pushImage({ path: decodeURISafely(defaultImg), name: getFileName(defaultImg) });\r\n }\r\n\r\n if (FULL_ACCESS || PARTIAL_ACCESS) {\r\n actorVariants.forEach((variant) => {\r\n for (const name of variant.names) {\r\n pushImage({ path: decodeURISafely(variant.imgSrc), name: name });\r\n }\r\n });\r\n }\r\n\r\n // Parse directory flag and include the images\r\n if (FULL_ACCESS || PARTIAL_ACCESS) {\r\n const directoryFlag = tokenActor.getFlag('token-variants', 'directory');\r\n if (directoryFlag) {\r\n let dirFlagImages;\r\n try {\r\n let path = directoryFlag.path;\r\n let source = directoryFlag.source;\r\n let bucket = '';\r\n if (source.startsWith('s3:')) {\r\n bucket = source.substring(3, source.length);\r\n source = 's3';\r\n }\r\n const content = await FilePicker.browse(source, path, {\r\n type: 'imagevideo',\r\n bucket,\r\n });\r\n dirFlagImages = content.files;\r\n } catch (err) {\r\n dirFlagImages = [];\r\n }\r\n dirFlagImages = dirFlagImages.forEach((f) => {\r\n if (isImage(f) || isVideo(f)) pushImage({ path: decodeURISafely(f), name: getFileName(f) });\r\n });\r\n }\r\n }\r\n\r\n if (\r\n (FULL_ACCESS || PARTIAL_ACCESS) &&\r\n worldHudSettings.includeWildcard &&\r\n !worldHudSettings.displayOnlySharedImages\r\n ) {\r\n // Merge wildcard images\r\n const protoImg = tokenActor.prototypeToken.texture.src;\r\n if (tokenActor.prototypeToken.randomImg) {\r\n (await tokenActor.getTokenImages())\r\n .filter((img) => !img.includes('*'))\r\n .forEach((img) => {\r\n pushImage({ path: decodeURISafely(img), name: getFileName(img) });\r\n });\r\n } else if (protoImg.includes('*') || protoImg.includes('{') || protoImg.includes('}')) {\r\n // Modified version of Actor.getTokenImages()\r\n const getTokenImages = async () => {\r\n if (tokenActor._tokenImages) return tokenActor._tokenImages;\r\n\r\n let source = 'data';\r\n let pattern = tokenActor.prototypeToken.texture.src;\r\n const browseOptions = { wildcard: true };\r\n\r\n // Support non-user sources\r\n if (/\\.s3\\./.test(pattern)) {\r\n source = 's3';\r\n const { bucket, keyPrefix } = FilePicker.parseS3URL(pattern);\r\n if (bucket) {\r\n browseOptions.bucket = bucket;\r\n pattern = keyPrefix;\r\n }\r\n } else if (pattern.startsWith('icons/')) source = 'public';\r\n\r\n // Retrieve wildcard content\r\n try {\r\n const content = await FilePicker.browse(source, pattern, browseOptions);\r\n tokenActor._tokenImages = content.files;\r\n } catch (err) {\r\n tokenActor._tokenImages = [];\r\n }\r\n return tokenActor._tokenImages;\r\n };\r\n\r\n (await getTokenImages())\r\n .filter((img) => !img.includes('*') && (isImage(img) || isVideo(img)))\r\n .forEach((variant) => {\r\n pushImage({ path: decodeURISafely(variant), name: getFileName(variant) });\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Perform image search if needed\r\n if (FULL_ACCESS) {\r\n let search;\r\n if (searchText) {\r\n search = searchText.length > 2 ? searchText : null;\r\n } else {\r\n if (worldHudSettings.displayOnlySharedImages || tokenActor?.getFlag('token-variants', 'disableNameSearch')) {\r\n // No search\r\n } else if (token.name.length > 2) {\r\n search = token.name;\r\n }\r\n }\r\n\r\n if (search) {\r\n let artSearch = await doImageSearch(search, {\r\n searchType: SEARCH_TYPE.TOKEN,\r\n searchOptions: { keywordSearch: worldHudSettings.includeKeywords },\r\n });\r\n\r\n // Merge full search, and keywords into a single array\r\n if (artSearch) {\r\n artSearch.forEach((results) => {\r\n results.forEach((img) => pushImage(img));\r\n });\r\n }\r\n }\r\n }\r\n } else {\r\n images = fp_files.map((f) => {\r\n return { path: decodeURISafely(f), name: getFileName(f) };\r\n });\r\n }\r\n\r\n // Retrieving the possibly custom name attached as a flag to the token\r\n let tokenImageName = '';\r\n if (token.flags['token-variants'] && token.flags['token-variants']['name']) {\r\n tokenImageName = token.flags['token-variants']['name'];\r\n } else {\r\n tokenImageName = getFileName(token.texture.src);\r\n }\r\n\r\n let imagesParsed = [];\r\n const tokenConfigs = (TVA_CONFIG.tokenConfigs || []).flat();\r\n const tkn = canvas.tokens.get(token._id);\r\n const userMappings = tkn.document.getFlag('token-variants', 'userMappings') || {};\r\n\r\n for (const imageObj of images) {\r\n const img = isImage(imageObj.path);\r\n const vid = isVideo(imageObj.path);\r\n\r\n const hasConfig = Boolean(\r\n tokenConfigs.find((config) => config.tvImgSrc === imageObj.path && config.tvImgName === imageObj.name)\r\n );\r\n let shared = false;\r\n if (TVA_CONFIG.permissions.hudFullAccess[game.user.role]) {\r\n actorVariants.forEach((variant) => {\r\n if (variant.imgSrc === imageObj.path && variant.names.includes(imageObj.name)) {\r\n shared = true;\r\n }\r\n });\r\n }\r\n\r\n const [title, style] = genTitleAndStyle(userMappings, imageObj.path, imageObj.name);\r\n\r\n imagesParsed.push({\r\n route: imageObj.path,\r\n name: imageObj.name,\r\n used: imageObj.path === token.texture.src && imageObj.name === tokenImageName,\r\n img,\r\n vid,\r\n unknownType: !img && !vid,\r\n shared: shared,\r\n hasConfig: hasConfig,\r\n title: title,\r\n style: game.user.isGM && style ? 'box-shadow: ' + style + ';' : null,\r\n });\r\n }\r\n\r\n //\r\n // Render\r\n //\r\n const imageDisplay = hudSettings.displayAsImage;\r\n const imageOpacity = hudSettings.imageOpacity / 100;\r\n\r\n const sideSelect = $(\r\n await renderTemplate('modules/token-variants/templates/sideSelect.html', {\r\n imagesParsed,\r\n imageDisplay,\r\n imageOpacity,\r\n tokenHud: true,\r\n })\r\n );\r\n\r\n // Activate listeners\r\n sideSelect.find('video').hover(\r\n function () {\r\n if (TVA_CONFIG.playVideoOnHover) {\r\n this.play();\r\n $(this).siblings('.fa-play').hide();\r\n }\r\n },\r\n function () {\r\n if (TVA_CONFIG.pauseVideoOnHoverOut) {\r\n this.pause();\r\n this.currentTime = 0;\r\n $(this).siblings('.fa-play').show();\r\n }\r\n }\r\n );\r\n sideSelect.find('.token-variants-button-select').click((event) => _onImageClick(event, token._id));\r\n\r\n if (FULL_ACCESS) {\r\n sideSelect.find('.token-variants-button-select').on('contextmenu', (event) => _onImageRightClick(event, token._id));\r\n }\r\n\r\n return sideSelect;\r\n}\r\n\r\nasync function _onImageClick(event, tokenId) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const token = canvas.tokens.controlled.find((t) => t.document.id === tokenId);\r\n if (!token) return;\r\n\r\n const worldHudSettings = TVA_CONFIG.worldHud;\r\n\r\n const imgButton = $(event.target).closest('.token-variants-button-select');\r\n const imgSrc = imgButton.attr('data-name');\r\n const name = imgButton.attr('data-filename');\r\n\r\n if (!imgSrc || !name) return;\r\n\r\n if (keyPressed('config') && game.user.isGM) {\r\n const toggleCog = (saved) => {\r\n const cog = imgButton.find('.fa-cog');\r\n if (saved) {\r\n cog.addClass('active');\r\n } else {\r\n cog.removeClass('active');\r\n }\r\n };\r\n new TokenCustomConfig(token, {}, imgSrc, name, toggleCog).render(true);\r\n } else if (token.document.texture.src === imgSrc) {\r\n let tokenImageName = token.document.getFlag('token-variants', 'name');\r\n if (!tokenImageName) tokenImageName = getFileName(token.document.texture.src);\r\n if (tokenImageName !== name) {\r\n await updateTokenImage(imgSrc, {\r\n token: token,\r\n imgName: name,\r\n animate: worldHudSettings.animate,\r\n });\r\n if (token.actor && worldHudSettings.updateActorImage) {\r\n if (worldHudSettings.useNameSimilarity) {\r\n updateActorWithSimilarName(imgSrc, name, token.actor);\r\n } else {\r\n updateActorImage(token.actor, imgSrc, { imgName: name });\r\n }\r\n }\r\n }\r\n } else {\r\n await updateTokenImage(imgSrc, {\r\n token: token,\r\n imgName: name,\r\n animate: worldHudSettings.animate,\r\n });\r\n if (token.actor && worldHudSettings.updateActorImage) {\r\n if (worldHudSettings.useNameSimilarity) {\r\n updateActorWithSimilarName(imgSrc, name, token.actor);\r\n } else {\r\n updateActorImage(token.actor, imgSrc, { imgName: name });\r\n }\r\n }\r\n }\r\n}\r\n\r\nasync function _onImageRightClick(event, tokenId) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n let token = canvas.tokens.controlled.find((t) => t.document.id === tokenId);\r\n if (!token) return;\r\n\r\n const imgButton = $(event.target).closest('.token-variants-button-select');\r\n const imgSrc = imgButton.attr('data-name');\r\n const name = imgButton.attr('data-filename');\r\n\r\n if (!imgSrc || !name) return;\r\n\r\n if (keyPressed('config') && game.user.isGM) {\r\n const regenStyle = (token, img) => {\r\n const mappings = token.document.getFlag('token-variants', 'userMappings') || {};\r\n const name = imgButton.attr('data-filename');\r\n const [title, style] = genTitleAndStyle(mappings, img, name);\r\n imgButton\r\n .closest('.token-variants-wrap')\r\n .find(`.token-variants-button-select[data-name='${img}']`)\r\n .css('box-shadow', style)\r\n .prop('title', title);\r\n };\r\n new UserList(token, imgSrc, regenStyle).render(true);\r\n } else if (token.actor) {\r\n let tokenActor = game.actors.get(token.actor.id);\r\n let variants = getVariants(tokenActor);\r\n\r\n // Remove selected variant if present in the flag, add otherwise\r\n let del = false;\r\n let updated = false;\r\n for (let variant of variants) {\r\n if (variant.imgSrc === imgSrc) {\r\n let fNames = variant.names.filter((name) => name !== name);\r\n if (fNames.length === 0) {\r\n del = true;\r\n } else if (fNames.length === variant.names.length) {\r\n fNames.push(name);\r\n }\r\n variant.names = fNames;\r\n updated = true;\r\n break;\r\n }\r\n }\r\n if (del) variants = variants.filter((variant) => variant.imgSrc !== imgSrc);\r\n else if (!updated) variants.push({ imgSrc: imgSrc, names: [name] });\r\n\r\n // Set shared variants as an actor flag\r\n setVariants(tokenActor, variants);\r\n imgButton.find('.fa-share').toggleClass('active'); // Display green arrow\r\n }\r\n}\r\n\r\nasync function _onImageSearchKeyUp(event, token) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n if (event.key === 'Enter' || event.keyCode === 13) {\r\n if (event.target.value.length >= 3) {\r\n const button = $(event.target).closest('.control-icon');\r\n button.find('.token-variants-wrap').remove();\r\n const sideSelect = await renderSideSelect(token, event.target.value);\r\n if (sideSelect) {\r\n sideSelect.addClass('active');\r\n button.append(sideSelect);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction genTitleAndStyle(mappings, imgSrc, name) {\r\n let title = TVA_CONFIG.worldHud.showFullPath ? imgSrc : name;\r\n let style = '';\r\n let offset = 2;\r\n for (const [userId, img] of Object.entries(mappings)) {\r\n if (img === imgSrc) {\r\n const user = game.users.get(userId);\r\n if (!user) continue;\r\n if (style.length === 0) {\r\n style = `inset 0 0 0 ${offset}px ${user.color}`;\r\n } else {\r\n style += `, inset 0 0 0 ${offset}px ${user.color}`;\r\n }\r\n offset += 2;\r\n title += `\\nDisplayed to: ${user.name}`;\r\n }\r\n }\r\n return [title, style];\r\n}\r\n\r\nasync function updateActorWithSimilarName(imgSrc, imgName, actor) {\r\n const results = await findImagesFuzzy(\r\n imgName,\r\n SEARCH_TYPE.PORTRAIT,\r\n {\r\n algorithm: {\r\n fuzzyThreshold: 0.4,\r\n fuzzyLimit: 50,\r\n },\r\n },\r\n true\r\n );\r\n\r\n if (results && results.length !== 0) {\r\n updateActorImage(actor, results[0].path, { imgName: results[0].name });\r\n } else {\r\n updateActorImage(actor, imgSrc, { imgName: imgName });\r\n }\r\n}\r\n\r\nfunction activateStatusEffectListeners(token) {\r\n if (TVA_CONFIG.permissions.statusConfig[game.user.role] && token.actorId && game.actors.get(token.actorId)) {\r\n $('.control-icon[data-action=\"effects\"]')\r\n .find('img:first')\r\n .click((event) => {\r\n event.preventDefault();\r\n if (keyPressed('config')) {\r\n event.stopPropagation();\r\n new EffectMappingForm(token).render(true);\r\n }\r\n });\r\n\r\n $('.control-icon[data-action=\"visibility\"]')\r\n .find('img')\r\n .click((event) => {\r\n event.preventDefault();\r\n if (keyPressed('config')) {\r\n event.stopPropagation();\r\n new EffectMappingForm(token, {\r\n createMapping: { label: 'In Combat', expression: 'token-variants-visibility' },\r\n }).render(true);\r\n }\r\n });\r\n\r\n $('.control-icon[data-action=\"combat\"]')\r\n .find('img')\r\n .click((event) => {\r\n event.preventDefault();\r\n if (keyPressed('config')) {\r\n event.stopPropagation();\r\n new EffectMappingForm(token, {\r\n createMapping: { label: 'In Combat', expression: 'token-variants-combat' },\r\n }).render(true);\r\n }\r\n });\r\n\r\n $('.status-effects')\r\n .find('img')\r\n .click((event) => {\r\n event.preventDefault();\r\n if (keyPressed('config')) {\r\n event.stopPropagation();\r\n\r\n let effectName = event.target.getAttribute('title');\r\n if (game.system.id === 'pf2e') {\r\n effectName = $(event.target).closest('picture').attr('title');\r\n }\r\n new EffectMappingForm(token, {\r\n createMapping: { label: effectName, expression: effectName },\r\n }).render(true);\r\n }\r\n });\r\n }\r\n}\r\n\r\nfunction getVariants(actor) {\r\n if (TOKEN_HUD_VARIANTS.variants) return TOKEN_HUD_VARIANTS.variants;\r\n else return actor?.getFlag('token-variants', 'variants') || [];\r\n}\r\n\r\nfunction setVariants(actor, variants) {\r\n TOKEN_HUD_VARIANTS.variants = variants;\r\n TOKEN_HUD_VARIANTS.actor = actor;\r\n}\r\n","import { showArtSelect } from '../token-variants.mjs';\r\nimport { SEARCH_TYPE, getFileName, isVideo, keyPressed, mergeMappings } from '../scripts/utils.js';\r\nimport TokenCustomConfig from './tokenCustomConfig.js';\r\nimport { TVA_CONFIG, getFlagMappings, migrateMappings, updateSettings } from '../scripts/settings.js';\r\nimport EditJsonConfig from './configJsonEdit.js';\r\nimport EditScriptConfig from './configScriptEdit.js';\r\nimport { OverlayConfig } from './overlayConfig.js';\r\nimport { showMappingSelectDialog, showOverlayJsonConfigDialog, showTokenCaptureDialog } from './dialogs.js';\r\nimport { DEFAULT_ACTIVE_EFFECT_CONFIG } from '../scripts/models.js';\r\nimport { updateWithEffectMapping } from '../scripts/hooks/effectMappingHooks.js';\r\nimport { drawOverlays } from '../scripts/token/overlay.js';\r\nimport { Templates } from './templates.js';\r\n\r\n// Persist group toggles across forms\r\nlet TOGGLED_GROUPS;\r\nconst NO_IMAGE = 'modules\\\\token-variants\\\\img\\\\empty.webp';\r\n\r\nexport default class EffectMappingForm extends FormApplication {\r\n constructor(token, { globalMappings = false, callback = null, createMapping = null } = {}) {\r\n super({}, { title: (globalMappings ? 'GLOBAL ' : 'ACTOR ') + 'Mappings' });\r\n\r\n this.token = token;\r\n if (globalMappings) {\r\n this.globalMappings = deepClone(TVA_CONFIG.globalMappings).filter(Boolean);\r\n }\r\n if (!globalMappings) this.objectToFlag = game.actors.get(token.actorId);\r\n this.callback = callback;\r\n TOGGLED_GROUPS = game.settings.get('token-variants', 'effectMappingToggleGroups') || {\r\n Default: true,\r\n };\r\n this.createMapping = createMapping;\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-active-effect-config',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/effectMappingForm.html',\r\n resizable: true,\r\n minimizable: false,\r\n closeOnSubmit: false,\r\n width: 1020,\r\n height: 'auto',\r\n scrollY: ['ol.token-variant-table'],\r\n });\r\n }\r\n\r\n _processConfig(mapping) {\r\n if (!mapping.config) mapping.config = {};\r\n let hasTokenConfig = Object.keys(mapping.config).filter((k) => mapping.config[k]).length;\r\n if (mapping.config.flags) hasTokenConfig--;\r\n if (mapping.config.tv_script) hasTokenConfig--;\r\n\r\n return {\r\n id: mapping.id || randomID(8),\r\n label: mapping.label,\r\n expression: mapping.expression,\r\n codeExp: mapping.codeExp,\r\n hasCodeExp: Boolean(mapping.codeExp),\r\n highlightedExpression: highlightOperators(mapping.expression),\r\n imgName: mapping.imgName,\r\n imgSrc: mapping.imgSrc,\r\n isVideo: mapping.imgSrc ? isVideo(mapping.imgSrc) : false,\r\n priority: mapping.priority,\r\n hasConfig: mapping.config ? !isEmpty(mapping.config) : false,\r\n hasScript: mapping.config && mapping.config.tv_script,\r\n hasTokenConfig: hasTokenConfig > 0,\r\n config: mapping.config,\r\n overlay: mapping.overlay,\r\n alwaysOn: mapping.alwaysOn,\r\n tokens: mapping.tokens,\r\n tokensString: mapping.tokens?.join(',') ?? '',\r\n tokenIDs: mapping.tokens?.length\r\n ? 'Assigned Tokens\\n' + mapping.tokens.join('\\n') + '\\n\\n[CLICK TO UNASSIGN]'\r\n : '',\r\n disabled: mapping.disabled,\r\n overlayConfig: mapping.overlayConfig,\r\n targetActors: mapping.targetActors,\r\n group: mapping.group,\r\n parentID: mapping.overlayConfig?.parentID,\r\n };\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n\r\n data.NO_IMAGE = NO_IMAGE;\r\n\r\n let mappings = [];\r\n if (this.object.mappings) {\r\n mappings = this.object.mappings.map(this._processConfig);\r\n } else {\r\n const effectMappings = this.globalMappings ?? getFlagMappings(this.objectToFlag);\r\n mappings = effectMappings.map(this._processConfig);\r\n\r\n if (this.createMapping && !effectMappings.find((m) => m.expression === this.createMapping.expression)) {\r\n mappings.push(this._processConfig(this._getNewEffectConfig(this.createMapping)));\r\n }\r\n this.createMapping = null;\r\n }\r\n\r\n mappings = mappings.sort((m1, m2) => {\r\n if (!m1.label && m2.label) return -1;\r\n else if (m1.label && !m2.label) return 1;\r\n\r\n if (!m1.overlayConfig?.parentID && m2.overlayConfig?.parentID) return -1;\r\n else if (m1.overlayConfig?.parentID && !m2.overlayConfig?.parentID) return 1;\r\n\r\n let priorityDiff = m1.priority - m2.priority;\r\n if (priorityDiff === 0) return m1.label.localeCompare(m2.label);\r\n return priorityDiff;\r\n });\r\n\r\n const [sMappings, groupedMappings] = sortMappingsToGroups(mappings);\r\n data.groups = Object.keys(groupedMappings);\r\n\r\n this.object.mappings = sMappings;\r\n data.groupedMappings = groupedMappings;\r\n data.global = Boolean(this.globalMappings);\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n html.find('.delete-mapping').click(this._onRemove.bind(this));\r\n html.find('.clone-mapping').click(this._onClone.bind(this));\r\n html.find('.create-mapping').click(this._onCreate.bind(this));\r\n html.find('.save-mappings').click(this._onSaveMappings.bind(this));\r\n if (TVA_CONFIG.permissions.image_path_button[game.user.role]) {\r\n html.find('.mapping-image img').click(this._onImageClick.bind(this));\r\n html.find('.mapping-image img').mousedown(this._onImageMouseDown.bind(this));\r\n html.find('.mapping-image video').click(this._onImageClick.bind(this));\r\n html.find('.mapping-target').click(this._onConfigureApplicableActors.bind(this));\r\n }\r\n html.find('.mapping-image img').contextmenu(this._onImageRightClick.bind(this));\r\n html.find('.mapping-image video').contextmenu(this._onImageRightClick.bind(this));\r\n html.find('.mapping-config i.config').click(this._onConfigClick.bind(this));\r\n html.find('.mapping-config i.config-edit').click(this._onConfigEditClick.bind(this));\r\n html.find('.mapping-config i.config-script').click(this._onConfigScriptClick.bind(this));\r\n html.find('.mapping-overlay i.overlay-config').click(this._onOverlayConfigClick.bind(this));\r\n html.on('contextmenu', '.mapping-overlay i.overlay-config', this._onOverlayConfigRightClick.bind(this));\r\n html.find('.mapping-overlay input').on('change', this._onOverlayChange).trigger('change');\r\n html.find('.div-input').on('input paste focus click', this._onExpressionChange);\r\n const app = this;\r\n html\r\n .find('.group-toggle > a')\r\n .on('click', this._onGroupToggle.bind(this))\r\n .each(function () {\r\n const group = $(this).closest('.group-toggle');\r\n const groupName = group.data('group');\r\n if (!TOGGLED_GROUPS[groupName]) {\r\n $(this).trigger('click');\r\n }\r\n });\r\n this.setPosition({ width: 1020 });\r\n html.find('.mapping-disable > input').on('change', this._onDisable.bind(this));\r\n html.find('.group-disable > a').on('click', this._onGroupDisable.bind(this));\r\n html.find('.group-delete').on('click', this._onGroupDelete.bind(this));\r\n html.find('.mapping-group > input').on('change', this._onGroupChange.bind(this));\r\n html.find('.expression-switch').on('click', this._onExpressionSwitch.bind(this));\r\n html\r\n .find('.expression-code textarea')\r\n .focus((event) => $(event.target).animate({ height: '10em' }, 500, () => this.setPosition()))\r\n .focusout((event) =>\r\n $(event.target).animate({ height: '1em' }, 500, () => {\r\n if (this._state === Application.RENDER_STATES.RENDERED) this.setPosition();\r\n })\r\n );\r\n html.find('.tokens').on('click', this._onTokensRemove.bind(this));\r\n }\r\n\r\n async _onTokensRemove(event) {\r\n await this._onSubmit(event);\r\n\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n mapping.tokens = undefined;\r\n\r\n this.render();\r\n }\r\n\r\n _onExpressionSwitch(event) {\r\n const container = $(event.target).closest('.expression-container');\r\n const divInput = container.find('.div-input');\r\n const codeExp = container.find('.expression-code');\r\n\r\n if (codeExp.hasClass('hidden')) {\r\n codeExp.removeClass('hidden');\r\n divInput.addClass('hidden');\r\n } else {\r\n codeExp.addClass('hidden');\r\n divInput.removeClass('hidden');\r\n }\r\n }\r\n\r\n async _onDisable(event) {\r\n const groupName = $(event.target).closest('.table-row').data('group');\r\n const disableGroupToggle = $(event.target)\r\n .closest('.token-variant-table')\r\n .find(`.group-disable[data-group=\"${groupName}\"]`);\r\n\r\n const checkboxes = $(event.target)\r\n .closest('.token-variant-table')\r\n .find(`[data-group=\"${groupName}\"] > .mapping-disable`);\r\n const numChecked = checkboxes.find('input:checked').length;\r\n\r\n if (checkboxes.length !== numChecked) {\r\n disableGroupToggle.addClass('active');\r\n } else disableGroupToggle.removeClass('active');\r\n }\r\n\r\n async _onGroupDisable(event) {\r\n const group = $(event.target).closest('.group-disable');\r\n const groupName = group.data('group');\r\n const chks = $(event.target).closest('form').find(`[data-group=\"${groupName}\"]`).find('.mapping-disable > input');\r\n\r\n if (group.hasClass('active')) {\r\n group.removeClass('active');\r\n chks.prop('checked', true);\r\n } else {\r\n group.addClass('active');\r\n chks.prop('checked', false);\r\n }\r\n }\r\n\r\n async _onGroupDelete(event) {\r\n const group = $(event.target).closest('.group-delete');\r\n const groupName = group.data('group');\r\n await this._onSubmit(event);\r\n this.object.mappings = this.object.mappings.filter((m) => m.group !== groupName);\r\n this.render();\r\n }\r\n\r\n async _onGroupChange(event) {\r\n const input = $(event.target);\r\n let group = input.val().trim();\r\n if (!group) group = 'Default';\r\n input.val(group);\r\n\r\n await this._onSubmit(event);\r\n this.render();\r\n }\r\n\r\n _onGroupToggle(event) {\r\n const group = $(event.target).closest('.group-toggle');\r\n const groupName = group.data('group');\r\n const form = $(event.target).closest('form');\r\n form.find(`li[data-group=\"${groupName}\"]`).toggle();\r\n if (group.hasClass('active')) {\r\n group.removeClass('active');\r\n group.find('i').addClass('fa-rotate-180');\r\n TOGGLED_GROUPS[groupName] = false;\r\n } else {\r\n group.addClass('active');\r\n group.find('i').removeClass('fa-rotate-180');\r\n TOGGLED_GROUPS[groupName] = true;\r\n }\r\n game.settings.set('token-variants', 'effectMappingToggleGroups', TOGGLED_GROUPS);\r\n this.setPosition({ height: 'auto' });\r\n }\r\n\r\n async _onExpressionChange(event) {\r\n var el = event.target;\r\n\r\n // Update the hidden input field so that the text entered in the div will be submitted via the form\r\n $(el).siblings('input').val(event.target.innerText);\r\n\r\n // The rest of the function is to handle operator highlighting and management of the caret position\r\n\r\n if (!el.childNodes.length) return;\r\n\r\n // Calculate the true/total caret offset within the div\r\n const sel = window.getSelection();\r\n const focusNode = sel.focusNode;\r\n let offset = sel.focusOffset;\r\n\r\n for (const ch of el.childNodes) {\r\n if (ch === focusNode || ch.childNodes[0] === focusNode) break;\r\n offset += ch.nodeName === 'SPAN' ? ch.innerText.length : ch.length;\r\n }\r\n\r\n // Highlight the operators and update the div\r\n let text = highlightOperators(event.target.innerText);\r\n $(event.target).html(text);\r\n\r\n // Set the new caret position with the div\r\n setCaretPosition(el, offset);\r\n }\r\n\r\n async _onOverlayChange(event) {\r\n if (event.target.checked) {\r\n $(event.target).siblings('a').show();\r\n } else {\r\n $(event.target).siblings('a').hide();\r\n }\r\n }\r\n\r\n async _onOverlayConfigClick(event) {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n\r\n new OverlayConfig(\r\n mapping.overlayConfig,\r\n (config) => {\r\n mapping.overlayConfig = config;\r\n const gear = $(li).find('.mapping-overlay > a');\r\n if (config?.parentID && config.parentID !== 'TOKEN') {\r\n gear.addClass('child');\r\n gear.attr('title', 'Child Of: ' + config.parentID);\r\n } else {\r\n gear.removeClass('child');\r\n gear.attr('title', '');\r\n }\r\n },\r\n mapping.id,\r\n this.token\r\n ).render(true);\r\n }\r\n\r\n async _onOverlayConfigRightClick(event) {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n showOverlayJsonConfigDialog(mapping.overlayConfig, (config) => (mapping.overlayConfig = config));\r\n }\r\n\r\n async _toggleActiveControls(event) {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n const tokenConfig = $(event.target).closest('.mapping-config').find('.config');\r\n const configEdit = $(event.target).closest('.mapping-config').find('.config-edit');\r\n const scriptEdit = $(event.target).closest('.mapping-config').find('.config-script');\r\n\r\n let hasTokenConfig = Object.keys(mapping.config).filter((k) => mapping.config[k]).length;\r\n if (mapping.config.flags) hasTokenConfig--;\r\n if (mapping.config.tv_script) hasTokenConfig--;\r\n\r\n if (hasTokenConfig) tokenConfig.addClass('active');\r\n else tokenConfig.removeClass('active');\r\n\r\n if (Object.keys(mapping.config).filter((k) => mapping.config[k]).length) configEdit.addClass('active');\r\n else configEdit.removeClass('active');\r\n\r\n if (mapping.config.tv_script) scriptEdit.addClass('active');\r\n else scriptEdit.removeClass('active');\r\n }\r\n\r\n async _onConfigScriptClick(event) {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n\r\n new EditScriptConfig(mapping.config?.tv_script, (script) => {\r\n if (!mapping.config) mapping.config = {};\r\n if (script) mapping.config.tv_script = script;\r\n else delete mapping.config.tv_script;\r\n this._toggleActiveControls(event);\r\n }).render(true);\r\n }\r\n\r\n async _onConfigEditClick(event) {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n\r\n new EditJsonConfig(mapping.config, (config) => {\r\n mapping.config = config;\r\n this._toggleActiveControls(event);\r\n }).render(true);\r\n }\r\n\r\n async _onConfigClick(event) {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n new TokenCustomConfig(\r\n this.token,\r\n {},\r\n null,\r\n null,\r\n (config) => {\r\n if (!config || isEmpty(config)) {\r\n config = {};\r\n config.tv_script = mapping.config.tv_script;\r\n config.flags = mapping.config.flags;\r\n }\r\n mapping.config = config;\r\n this._toggleActiveControls(event);\r\n },\r\n mapping.config ? mapping.config : {}\r\n ).render(true);\r\n }\r\n\r\n _removeImage(event) {\r\n const vid = $(event.target).closest('.mapping-image').find('video');\r\n const img = $(event.target).closest('.mapping-image').find('img');\r\n vid.add(img).attr('src', '').attr('title', '');\r\n vid.hide();\r\n img.show();\r\n img.attr('src', NO_IMAGE);\r\n $(event.target).siblings('.imgSrc').val('');\r\n $(event.target).siblings('.imgName').val('');\r\n }\r\n\r\n async _onImageMouseDown(event) {\r\n if (event.which === 2) {\r\n this._removeImage(event);\r\n }\r\n }\r\n\r\n async _onImageClick(event) {\r\n if (keyPressed('config')) {\r\n this._removeImage(event);\r\n return;\r\n }\r\n\r\n let search = this.token.name;\r\n if (search === 'Unknown') {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n search = mapping.label;\r\n }\r\n\r\n showArtSelect(search, {\r\n searchType: SEARCH_TYPE.TOKEN,\r\n callback: (imgSrc, imgName) => {\r\n const vid = $(event.target).closest('.mapping-image').find('video');\r\n const img = $(event.target).closest('.mapping-image').find('img');\r\n vid.add(img).attr('src', imgSrc).attr('title', imgName);\r\n if (isVideo(imgSrc)) {\r\n vid.show();\r\n img.hide();\r\n } else {\r\n vid.hide();\r\n img.show();\r\n }\r\n $(event.target).siblings('.imgSrc').val(imgSrc);\r\n $(event.target).siblings('.imgName').val(imgName);\r\n },\r\n });\r\n }\r\n\r\n async _onImageRightClick(event) {\r\n if (keyPressed('config')) {\r\n this._removeImage(event);\r\n return;\r\n }\r\n\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n\r\n new FilePicker({\r\n type: 'imagevideo',\r\n current: mapping.imgSrc,\r\n callback: (path) => {\r\n const vid = $(event.target).closest('.mapping-image').find('video');\r\n const img = $(event.target).closest('.mapping-image').find('img');\r\n vid.add(img).attr('src', path).attr('title', getFileName(path));\r\n if (isVideo(path)) {\r\n vid.show();\r\n img.hide();\r\n } else {\r\n vid.hide();\r\n img.show();\r\n }\r\n $(event.target).siblings('.imgSrc').val(path);\r\n $(event.target).siblings('.imgName').val(getFileName(path));\r\n },\r\n }).render();\r\n }\r\n\r\n async _onRemove(event) {\r\n event.preventDefault();\r\n await this._onSubmit(event);\r\n const li = event.currentTarget.closest('.table-row');\r\n this.object.mappings.splice(li.dataset.index, 1);\r\n this.render();\r\n }\r\n\r\n async _onClone(event) {\r\n event.preventDefault();\r\n await this._onSubmit(event);\r\n const li = event.currentTarget.closest('.table-row');\r\n const clone = deepClone(this.object.mappings[li.dataset.index]);\r\n clone.label = clone.label + ' - Copy';\r\n clone.id = randomID(8);\r\n this.object.mappings.push(clone);\r\n this.render();\r\n }\r\n\r\n async _onCreate(event) {\r\n event.preventDefault();\r\n await this._onSubmit(event);\r\n this.object.mappings.push(this._getNewEffectConfig());\r\n this.render();\r\n }\r\n\r\n _getNewEffectConfig({ label = '', expression = '' } = {}) {\r\n // if (textOverlay) {\r\n // TOGGLED_GROUPS['Text Overlays'] = true;\r\n // return {\r\n // id: randomID(8),\r\n // label: label,\r\n // expression: label,\r\n // highlightedExpression: highlightOperators(label),\r\n // imgName: '',\r\n // imgSrc: '',\r\n // priority: 50,\r\n // overlay: false,\r\n // alwaysOn: false,\r\n // disabled: false,\r\n // group: 'Text Overlays',\r\n // overlay: true,\r\n // overlayConfig: mergeObject(\r\n // DEFAULT_OVERLAY_CONFIG,\r\n // {\r\n // img: '',\r\n // linkScale: false,\r\n // linkRotation: false,\r\n // linkMirror: false,\r\n // offsetY: 0.5 + Math.round(Math.random() * 0.3 * 100) / 100,\r\n // offsetX: 0,\r\n // scaleX: 0.68,\r\n // scaleY: 0.68,\r\n // text: {\r\n // text: '{{effect}}',\r\n // fontFamily: CONFIG.defaultFontFamily,\r\n // fontSize: 36,\r\n // fill: new Color(Math.round(Math.random() * 16777215)).toString(),\r\n // stroke: '#000000',\r\n // strokeThickness: 2,\r\n // dropShadow: false,\r\n // curve: {\r\n // radius: 160,\r\n // invert: false,\r\n // },\r\n // },\r\n // animation: {\r\n // rotate: true,\r\n // duration: 10000 + Math.round(Math.random() * 14000) + 10000,\r\n // clockwise: true,\r\n // },\r\n // },\r\n // { inplace: false }\r\n // ),\r\n // };\r\n // } else {\r\n TOGGLED_GROUPS['Default'] = true;\r\n return mergeObject(deepClone(DEFAULT_ACTIVE_EFFECT_CONFIG), {\r\n label,\r\n expression,\r\n id: randomID(8),\r\n });\r\n // }\r\n }\r\n\r\n _getHeaderButtons() {\r\n const buttons = super._getHeaderButtons();\r\n\r\n buttons.unshift({\r\n label: 'Export',\r\n class: 'token-variants-export',\r\n icon: 'fas fa-file-export',\r\n onclick: (ev) => this._exportConfigs(ev),\r\n });\r\n buttons.unshift({\r\n label: 'Import',\r\n class: 'token-variants-import',\r\n icon: 'fas fa-file-import',\r\n onclick: (ev) => this._importConfigs(ev),\r\n });\r\n\r\n buttons.unshift({\r\n label: 'Templates',\r\n class: 'token-variants-templates',\r\n icon: 'fa-solid fa-book',\r\n onclick: async (ev) => {\r\n new Templates({\r\n mappings: this.globalMappings ?? getFlagMappings(this.objectToFlag),\r\n callback: (templateName, mappings) => {\r\n this._insertMappings(ev, mappings);\r\n },\r\n }).render(true);\r\n },\r\n });\r\n\r\n if (this.globalMappings) return buttons;\r\n\r\n buttons.unshift({\r\n label: 'Copy Global Config',\r\n class: 'token-variants-copy-global',\r\n icon: 'fas fa-globe',\r\n onclick: (ev) => this._copyGlobalConfig(ev),\r\n });\r\n buttons.unshift({\r\n label: 'Open Global',\r\n class: 'token-variants-open-global',\r\n icon: 'fas fa-globe',\r\n onclick: async (ev) => {\r\n await this.close();\r\n new EffectMappingForm(this.token, { globalMappings: true }).render(true);\r\n },\r\n });\r\n\r\n buttons.unshift({\r\n label: '',\r\n class: 'token-variants-print-token',\r\n icon: 'fa fa-print',\r\n onclick: () => showTokenCaptureDialog(canvas.tokens.get(this.token._id)),\r\n });\r\n return buttons;\r\n }\r\n\r\n async _exportConfigs(event) {\r\n let mappings;\r\n let filename = '';\r\n if (this.globalMappings) {\r\n mappings = { globalMappings: deepClone(TVA_CONFIG.globalMappings) };\r\n filename = 'token-variants-global-mappings.json';\r\n } else {\r\n mappings = {\r\n globalMappings: deepClone(getFlagMappings(this.objectToFlag)),\r\n };\r\n\r\n let actorName = this.objectToFlag.name ?? 'Actor';\r\n actorName = actorName.replace(/[/\\\\?%*:|\"<>]/g, '-');\r\n filename = 'token-variants-' + actorName + '.json';\r\n }\r\n\r\n if (mappings && !isEmpty(mappings)) {\r\n saveDataToFile(JSON.stringify(mappings, null, 2), 'text/json', filename);\r\n }\r\n }\r\n\r\n async _importConfigs(event) {\r\n const content = await renderTemplate('templates/apps/import-data.html', {\r\n entity: 'token-variants',\r\n name: 'settings',\r\n });\r\n let dialog = new Promise((resolve, reject) => {\r\n new Dialog(\r\n {\r\n title: 'Import Effect Configurations',\r\n content: content,\r\n buttons: {\r\n import: {\r\n icon: '<i class=\"fas fa-file-import\"></i>',\r\n label: game.i18n.localize('token-variants.common.import'),\r\n callback: (html) => {\r\n const form = html.find('form')[0];\r\n if (!form.data.files.length) return ui.notifications?.error('You did not upload a data file!');\r\n readTextFromFile(form.data.files[0]).then((json) => {\r\n json = JSON.parse(json);\r\n if (!json || !('globalMappings' in json)) {\r\n return ui.notifications?.error('No mappings found within the file!');\r\n }\r\n\r\n this._insertMappings(event, migrateMappings(json.globalMappings));\r\n resolve(true);\r\n });\r\n },\r\n },\r\n no: {\r\n icon: '<i class=\"fas fa-times\"></i>',\r\n label: 'Cancel',\r\n callback: (html) => resolve(false),\r\n },\r\n },\r\n default: 'import',\r\n },\r\n {\r\n width: 400,\r\n }\r\n ).render(true);\r\n });\r\n return await dialog;\r\n }\r\n\r\n _copyGlobalConfig(event) {\r\n showMappingSelectDialog(TVA_CONFIG.globalMappings, {\r\n title1: 'Global Mappings',\r\n title2: 'Select Mappings to Copy:',\r\n buttonTitle: 'Copy',\r\n callback: (mappings) => {\r\n this._insertMappings(event, mappings);\r\n },\r\n });\r\n }\r\n\r\n async _insertMappings(event, mappings) {\r\n const cMappings = deepClone(mappings).map(this._processConfig);\r\n await this._onSubmit(event);\r\n mergeMappings(cMappings, this.object.mappings);\r\n this.render();\r\n }\r\n\r\n _onConfigureApplicableActors(event) {\r\n const li = event.currentTarget.closest('.table-row');\r\n const mapping = this.object.mappings[li.dataset.index];\r\n\r\n let actorTypes = (game.system.entityTypes ?? game.system.documentTypes)['Actor'];\r\n let actors = [];\r\n for (const t of actorTypes) {\r\n const label = CONFIG['Actor']?.typeLabels?.[t] ?? t;\r\n actors.push({\r\n id: t,\r\n label: game.i18n.has(label) ? game.i18n.localize(label) : t,\r\n enabled: !mapping.targetActors || mapping.targetActors.includes(t),\r\n });\r\n }\r\n\r\n let content = '<form style=\"overflow-y: scroll; height:250x;\">';\r\n for (const act of actors) {\r\n content += `\r\n <div class=\"form-group\">\r\n <label>${act.label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"${act.id}\" data-dtype=\"Boolean\" ${act.enabled ? 'checked' : ''}>\r\n </div>\r\n </div>\r\n `;\r\n }\r\n content += `</form><div class=\"form-group\"><button type=\"button\" class=\"select-all\">Select all</div>`;\r\n\r\n new Dialog({\r\n title: `Configure Applicable Actors`,\r\n content: content,\r\n buttons: {\r\n Ok: {\r\n label: `Save`,\r\n callback: async (html) => {\r\n let targetActors = [];\r\n html.find('input[type=\"checkbox\"]').each(function () {\r\n if (this.checked) {\r\n targetActors.push(this.name);\r\n }\r\n });\r\n mapping.targetActors = targetActors;\r\n },\r\n },\r\n },\r\n render: (html) => {\r\n html.find('.select-all').click(() => {\r\n html.find('input[type=\"checkbox\"]').prop('checked', true);\r\n });\r\n },\r\n }).render(true);\r\n }\r\n\r\n // TODO fix this spaghetti code related to globalMappings...\r\n async _onSaveMappings(event) {\r\n await this._onSubmit(event);\r\n if (this.objectToFlag || this.globalMappings) {\r\n // First filter out empty mappings\r\n let mappings = this.object.mappings;\r\n mappings = mappings.filter((m) => Boolean(m.label?.trim()) || Boolean(m.expression?.trim()));\r\n\r\n // Make sure a priority is assigned\r\n for (const mapping of mappings) {\r\n mapping.priority = mapping.priority ? mapping.priority : 50;\r\n mapping.overlayConfig = mapping.overlayConfig ?? {};\r\n mapping.overlayConfig.label = mapping.label;\r\n }\r\n\r\n if (mappings.length !== 0) {\r\n const effectMappings = mappings.map((m) =>\r\n mergeObject(DEFAULT_ACTIVE_EFFECT_CONFIG, m, {\r\n inplace: false,\r\n insertKeys: false,\r\n recursive: false,\r\n })\r\n );\r\n if (this.globalMappings) {\r\n updateSettings({ globalMappings: effectMappings });\r\n } else {\r\n await this.objectToFlag.setFlag('token-variants', 'effectMappings', effectMappings);\r\n }\r\n } else if (this.globalMappings) {\r\n updateSettings({ globalMappings: [] });\r\n } else {\r\n await this.objectToFlag.unsetFlag('token-variants', 'effectMappings');\r\n }\r\n\r\n const tokens = this.globalMappings ? canvas.tokens.placeables : this.objectToFlag.getActiveTokens();\r\n for (const tkn of tokens) {\r\n if (TVA_CONFIG.filterEffectIcons) {\r\n await tkn.drawEffects();\r\n }\r\n await updateWithEffectMapping(tkn);\r\n drawOverlays(tkn);\r\n }\r\n\r\n // Instruct users on other scenes to refresh the overlays\r\n const message = {\r\n handlerName: 'drawOverlays',\r\n args: { all: true, sceneId: canvas.scene.id },\r\n type: 'UPDATE',\r\n };\r\n game.socket?.emit('module.token-variants', message);\r\n }\r\n if (this.callback) this.callback();\r\n this.close();\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n const mappings = expandObject(formData).mappings ?? {};\r\n\r\n // Merge form data with internal mappings\r\n for (let i = 0; i < this.object.mappings.length; i++) {\r\n const m1 = mappings[i];\r\n const m2 = this.object.mappings[i];\r\n m2.id = m1.id;\r\n m2.label = m1.label.replaceAll(String.fromCharCode(160), ' ');\r\n m2.expression = m1.expression.replaceAll(String.fromCharCode(160), ' ');\r\n m2.codeExp = m1.codeExp?.trim();\r\n m2.imgSrc = m1.imgSrc;\r\n m2.imgName = m1.imgName;\r\n m2.priority = m1.priority;\r\n m2.overlay = m1.overlay;\r\n m2.alwaysOn = m1.alwaysOn;\r\n m2.tokens = m1.tokens?.split(',');\r\n m2.disabled = m1.disabled;\r\n m2.group = m1.group;\r\n }\r\n }\r\n}\r\n\r\n// Insert <span/> around operators\r\nfunction highlightOperators(text) {\r\n // text = text.replaceAll(' ', ' ');\r\n\r\n const re = new RegExp('([a-zA-Z\\\\.\\\\-\\\\|\\\\+]+)([><=]+)(\".*?\"|-?\\\\d+)(%{0,1})', `gi`);\r\n text = text.replace(re, function replace(match) {\r\n return '<span class=\"hp-expression\">' + match + '</span>';\r\n });\r\n\r\n for (const op of ['\\\\(', '\\\\)', '&&', '||', '\\\\!', '\\\\*', '\\\\{', '\\\\}']) {\r\n text = text.replaceAll(op, `<span>${op}</span>`);\r\n }\r\n return text;\r\n}\r\n\r\n// Move caret to a specific point in a DOM element\r\nfunction setCaretPosition(el, pos) {\r\n for (var node of el.childNodes) {\r\n // Check if it's a text node\r\n if (node.nodeType == 3) {\r\n if (node.length >= pos) {\r\n var range = document.createRange(),\r\n sel = window.getSelection();\r\n range.setStart(node, pos);\r\n range.collapse(true);\r\n sel.removeAllRanges();\r\n sel.addRange(range);\r\n return -1; // We are done\r\n } else {\r\n pos -= node.length;\r\n }\r\n } else {\r\n pos = setCaretPosition(node, pos);\r\n if (pos == -1) {\r\n return -1; // No need to finish the for loop\r\n }\r\n }\r\n }\r\n return pos;\r\n}\r\n\r\nexport function sortMappingsToGroups(mappings) {\r\n mappings.sort((m1, m2) => {\r\n if (!m1.label && m2.label) return -1;\r\n else if (m1.label && !m2.label) return 1;\r\n\r\n if (!m1.overlayConfig?.parentID && m2.overlayConfig?.parentID) return -1;\r\n else if (m1.overlayConfig?.parentID && !m2.overlayConfig?.parentID) return 1;\r\n\r\n let priorityDiff = m1.priority - m2.priority;\r\n if (priorityDiff === 0) return m1.label.localeCompare(m2.label);\r\n return priorityDiff;\r\n });\r\n\r\n let groupedMappings = { Default: { list: [], active: false } };\r\n mappings.forEach((mapping, index) => {\r\n mapping.i = index; // assign so that we can reference the mapping inside of an array\r\n if (!mapping.group || !mapping.group.trim()) mapping.group = 'Default';\r\n if (!(mapping.group in groupedMappings)) groupedMappings[mapping.group] = { list: [], active: false };\r\n if (!mapping.disabled) groupedMappings[mapping.group].active = true;\r\n groupedMappings[mapping.group].list.push(mapping);\r\n });\r\n return [mappings, groupedMappings];\r\n}\r\n","export default class EditJsonConfig extends FormApplication {\r\n constructor(config, callback) {\r\n super({}, {});\r\n this.config = config;\r\n this.callback = callback;\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-config-json-edit',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/configJsonEdit.html',\r\n resizable: true,\r\n minimizable: false,\r\n title: 'Edit Token Configuration',\r\n width: 400,\r\n height: 380,\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n\r\n data.hasConfig = this.config != null && Object.keys(this.config).length !== 0;\r\n data.config = JSON.stringify(data.hasConfig ? this.config : {}, null, 2);\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n html.on('input', '.command textarea', this._validateJSON.bind(this));\r\n // Override 'Tab' key to insert spaces\r\n html.on('keydown', '.command textarea', function (e) {\r\n if (e.key === 'Tab' && !e.shiftKey) {\r\n e.preventDefault();\r\n var start = this.selectionStart;\r\n var end = this.selectionEnd;\r\n this.value = this.value.substring(0, start) + ' ' + this.value.substring(end);\r\n this.selectionStart = this.selectionEnd = start + 2;\r\n return false;\r\n }\r\n });\r\n\r\n html.find('.remove').click(this._onRemove.bind(this));\r\n html.find('.format').click(this._onFormat.bind(this));\r\n }\r\n\r\n async _validateJSON(event) {\r\n const controls = $(event.target).closest('form').find('button[type=\"submit\"], button.format');\r\n try {\r\n this.config = JSON.parse(event.target.value);\r\n this.config = expandObject(this.config);\r\n this.flag = this.config.flag;\r\n controls.prop('disabled', false);\r\n } catch (e) {\r\n controls.prop('disabled', true);\r\n }\r\n }\r\n\r\n async _onRemove(event) {\r\n this.config = {};\r\n this.submit();\r\n }\r\n\r\n async _onFormat(event) {\r\n $(event.target)\r\n .closest('form')\r\n .find('textarea[name=\"config\"]')\r\n .val(JSON.stringify(this.config, null, 2));\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n if (this.callback) this.callback(this.config);\r\n }\r\n}\r\n","export default class EditScriptConfig extends FormApplication {\r\n constructor(script, callback) {\r\n super({}, {});\r\n this.script = script;\r\n this.callback = callback;\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-config-script-edit',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/configScriptEdit.html',\r\n resizable: true,\r\n minimizable: false,\r\n title: 'Scripts',\r\n width: 640,\r\n height: 640,\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n\r\n const script = this.script ? this.script : {};\r\n data.hasScript = !isEmpty(script);\r\n data.onApply = script.onApply;\r\n data.onRemove = script.onRemove;\r\n data.macroOnApply = script.macroOnApply;\r\n data.macroOnRemove = script.macroOnRemove;\r\n\r\n data.tmfxPreset = script.tmfxPreset;\r\n data.tmfxActive = game.modules.get('tokenmagic')?.active;\r\n if (data.tmfxActive) {\r\n data.tmfxPresets = TokenMagic.getPresets().map((p) => p.name);\r\n }\r\n\r\n data.ceActive = game.modules.get('dfreds-convenient-effects')?.active;\r\n if (data.ceActive) {\r\n data.ceEffect = script.ceEffect ?? { apply: true, remove: true };\r\n data.ceEffects = game.dfreds.effects.all.map((ef) => ef.name);\r\n }\r\n\r\n data.macros = game.macros.map((m) => m.name);\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n // Override 'Tab' key to insert spaces\r\n html.on('keydown', '.command textarea', function (e) {\r\n if (e.key === 'Tab' && !e.shiftKey) {\r\n e.preventDefault();\r\n var start = this.selectionStart;\r\n var end = this.selectionEnd;\r\n this.value = this.value.substring(0, start) + ' ' + this.value.substring(end);\r\n this.selectionStart = this.selectionEnd = start + 2;\r\n return false;\r\n }\r\n });\r\n\r\n html.find('.remove').click(this._onRemove.bind(this));\r\n }\r\n\r\n async _onRemove(event) {\r\n if (this.callback) this.callback(null);\r\n this.close();\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n formData = expandObject(formData);\r\n ['onApply', 'onRemove', 'macroOnApply', 'macroOnRemove'].forEach((k) => {\r\n formData[k] = formData[k].trim();\r\n });\r\n if (formData.ceEffect?.name) formData.ceEffect.name = formData.ceEffect.name.trim();\r\n\r\n if (\r\n !formData.onApply &&\r\n !formData.onRemove &&\r\n !formData.tmfxPreset &&\r\n !formData.ceEffect.name &&\r\n !formData.macroOnApply &&\r\n !formData.macroOnRemove\r\n ) {\r\n if (this.callback) this.callback(null);\r\n } else {\r\n if (this.callback) this.callback(formData);\r\n }\r\n }\r\n}\r\n","import { toggleTemplateOnSelected } from '../scripts/hooks/effectMappingHooks.js';\r\nimport { CORE_TEMPLATES } from '../scripts/mappingTemplates.js';\r\nimport { TVA_CONFIG, updateSettings } from '../scripts/settings.js';\r\nimport { BASE_IMAGE_CATEGORIES, uploadTokenImage } from '../scripts/utils.js';\r\nimport { sortMappingsToGroups } from './effectMappingForm.js';\r\nimport { Templates } from './templates.js';\r\nimport TokenCustomConfig from './tokenCustomConfig.js';\r\n\r\n// Edit overlay configuration as a json string\r\nexport function showOverlayJsonConfigDialog(overlayConfig, callback) {\r\n const config = deepClone(overlayConfig || {});\r\n delete config.effect;\r\n let content = `<div style=\"height: 300px;\" class=\"form-group stacked command\"><textarea style=\"height: 300px;\" class=\"configJson\">${JSON.stringify(\r\n config,\r\n null,\r\n 2\r\n )}</textarea></div>`;\r\n\r\n new Dialog({\r\n title: `Overlay Configuration`,\r\n content: content,\r\n buttons: {\r\n yes: {\r\n icon: \"<i class='fas fa-save'></i>\",\r\n label: 'Save',\r\n callback: (html) => {\r\n let json = $(html).find('.configJson').val();\r\n if (json) {\r\n try {\r\n json = JSON.parse(json);\r\n } catch (e) {\r\n console.warn(`TVA |`, e);\r\n json = {};\r\n }\r\n } else {\r\n json = {};\r\n }\r\n callback(json);\r\n },\r\n },\r\n },\r\n default: 'yes',\r\n }).render(true);\r\n}\r\n\r\n// Change categories assigned to a path\r\nexport async function showPathSelectCategoryDialog(event) {\r\n event.preventDefault();\r\n const typesInput = $(event.target).closest('.path-category').find('input');\r\n const selectedTypes = typesInput.val().split(',');\r\n\r\n const categories = BASE_IMAGE_CATEGORIES.concat(TVA_CONFIG.customImageCategories);\r\n\r\n let content = '<div class=\"token-variants-popup-settings\">';\r\n\r\n // Split into rows of 4\r\n const splits = [];\r\n let currSplit = [];\r\n for (let i = 0; i < categories.length; i++) {\r\n if (i > 0 && i + 1 != categories.length && i % 4 == 0) {\r\n splits.push(currSplit);\r\n currSplit = [];\r\n }\r\n currSplit.push(categories[i]);\r\n }\r\n if (currSplit.length) splits.push(currSplit);\r\n\r\n for (const split of splits) {\r\n content += '<header class=\"table-header flexrow\">';\r\n for (const type of split) {\r\n content += `<label>${type}</label>`;\r\n }\r\n content += '</header><ul class=\"setting-list\"><li class=\"setting form-group\"><div class=\"form-fields\">';\r\n for (const type of split) {\r\n content += `<input class=\"category\" type=\"checkbox\" name=\"${type}\" data-dtype=\"Boolean\" ${\r\n selectedTypes.includes(type) ? 'checked' : ''\r\n }>`;\r\n }\r\n content += '</div></li></ul>';\r\n }\r\n content += '</div>';\r\n\r\n new Dialog({\r\n title: `Image Categories/Filters`,\r\n content: content,\r\n buttons: {\r\n yes: {\r\n icon: \"<i class='fas fa-save'></i>\",\r\n label: 'Apply',\r\n callback: (html) => {\r\n const types = [];\r\n $(html)\r\n .find('.category')\r\n .each(function () {\r\n if ($(this).is(':checked')) {\r\n types.push($(this).attr('name'));\r\n }\r\n });\r\n typesInput.val(types.join(','));\r\n },\r\n },\r\n },\r\n default: 'yes',\r\n }).render(true);\r\n}\r\n\r\n// Change configs assigned to a path\r\nexport async function showPathSelectConfigForm(event) {\r\n event.preventDefault();\r\n const configInput = $(event.target).closest('.path-config').find('input');\r\n let config = {};\r\n try {\r\n config = JSON.parse(configInput.val());\r\n } catch (e) {}\r\n\r\n const setting = game.settings.get('core', DefaultTokenConfig.SETTING);\r\n const data = new foundry.data.PrototypeToken(setting);\r\n const token = new TokenDocument(data, { actor: null });\r\n new TokenCustomConfig(\r\n token,\r\n {},\r\n null,\r\n null,\r\n (conf) => {\r\n if (!conf) conf = {};\r\n if (conf.flags == null || isEmpty(conf.flags)) delete conf.flags;\r\n configInput.val(JSON.stringify(conf));\r\n const cog = configInput.siblings('.select-config');\r\n if (isEmpty(conf)) cog.removeClass('active');\r\n else cog.addClass('active');\r\n },\r\n config\r\n ).render(true);\r\n}\r\n\r\nexport async function showTokenCaptureDialog(token) {\r\n if (!token) return;\r\n let content = `<form>\r\n<div class=\"form-group\">\r\n <label>Image Name</label>\r\n <input type=\"text\" name=\"name\" value=\"${token.name}\">\r\n</div>\r\n<div class=\"form-group\">\r\n <label>Image Path</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"path\" value=\"modules/token-variants/\">\r\n <button type=\"button\" class=\"file-picker\" data-type=\"folder\" data-target=\"path\" title=\"Browse Folders\" tabindex=\"-1\">\r\n <i class=\"fas fa-file-import fa-fw\"></i>\r\n </button>\r\n </div>\r\n</div>\r\n<div class=\"form-group slim\">\r\n <label>Width <span class=\"units\">(pixels)</span></label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" step=\"1\" name=\"width\" value=\"${token.mesh.texture.width}\">\r\n </div>\r\n</div>\r\n<div class=\"form-group slim\">\r\n <label>Height <span class=\"units\">(pixels)</span></label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" step=\"1\" name=\"height\" value=\"${token.mesh.texture.height}\">\r\n </div>\r\n</div>\r\n<div class=\"form-group slim\">\r\n <label>Scale</label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" step=\"any\" name=\"scale\" value=\"3\">\r\n </div>\r\n</div>\r\n</form>`;\r\n\r\n new Dialog({\r\n title: `Save Token/Overlay Image`,\r\n content: content,\r\n buttons: {\r\n yes: {\r\n icon: \"<i class='fas fa-save'></i>\",\r\n label: 'Save',\r\n callback: (html) => {\r\n const options = {};\r\n $(html)\r\n .find('[name]')\r\n .each(function () {\r\n let val = parseFloat(this.value);\r\n if (isNaN(val)) val = this.value;\r\n options[this.name] = val;\r\n });\r\n uploadTokenImage(token, options);\r\n },\r\n },\r\n },\r\n render: (html) => {\r\n html.find('.file-picker').click(() => {\r\n new FilePicker({\r\n type: 'folder',\r\n current: html.find('[name=\"path\"]').val(),\r\n callback: (path) => {\r\n html.find('[name=\"path\"]').val(path);\r\n },\r\n }).render();\r\n });\r\n },\r\n default: 'yes',\r\n }).render(true);\r\n}\r\n\r\nexport function showMappingSelectDialog(\r\n mappings,\r\n { title1 = 'Mappings', title2 = 'Select Mappings', buttonTitle = 'Confirm', callback = null } = {}\r\n) {\r\n if (!mappings || !mappings.length) return;\r\n\r\n let content = `<form style=\"overflow-y: scroll; height:400px;\"><h2>${title2}</h2>`;\r\n\r\n const [_, mappingGroups] = sortMappingsToGroups(mappings);\r\n for (const [group, obj] of Object.entries(mappingGroups)) {\r\n if (obj.list.length) {\r\n content += `<h4 style=\"text-align:center;\"><b>${group}</b></h4>`;\r\n for (const mapping of obj.list) {\r\n content += `\r\n <div class=\"form-group\">\r\n <label>${mapping.label}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"${mapping.id}\" data-dtype=\"Boolean\">\r\n </div>\r\n </div>\r\n `;\r\n }\r\n }\r\n }\r\n\r\n content += `</form><div class=\"form-group\"><button type=\"button\" class=\"select-all\">Select all</div>`;\r\n\r\n new Dialog({\r\n title: title1,\r\n content: content,\r\n buttons: {\r\n Ok: {\r\n label: buttonTitle,\r\n callback: async (html) => {\r\n if (!callback) return;\r\n const selectedMappings = [];\r\n html.find('input[type=\"checkbox\"]').each(function () {\r\n if (this.checked) {\r\n const mapping = mappings.find((m) => m.id === this.name);\r\n if (mapping) {\r\n const cMapping = deepClone(mapping);\r\n selectedMappings.push(cMapping);\r\n delete cMapping.targetActors;\r\n }\r\n }\r\n });\r\n callback(selectedMappings);\r\n },\r\n },\r\n },\r\n render: (html) => {\r\n html.find('.select-all').click(() => {\r\n html.find('input[type=\"checkbox\"]').prop('checked', true);\r\n });\r\n },\r\n }).render(true);\r\n}\r\n\r\nexport function showUserTemplateCreateDialog(mappings) {\r\n let content = `\r\n<div class=\"form-group\">\r\n <label>Template Name</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"templateName\" data-dtype=\"String\" value=\"\">\r\n </div>\r\n</div>\r\n<div class=\"form-group\">\r\n <label>Hover Text (optional)</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"templateHint\" data-dtype=\"String\" value=\"\">\r\n </div>\r\n</div>\r\n<div class=\"form-group\">\r\n <label>Hover Image (optional)</label>\r\n <div class=\"form-fields\">\r\n <input type=\"text\" name=\"img\" data-dtype=\"String\" value=\"\">\r\n </div>\r\n</div>`;\r\n\r\n let dialog;\r\n dialog = new Dialog({\r\n title: 'Mapping Templates',\r\n content,\r\n buttons: {\r\n create: {\r\n label: 'Create Template',\r\n callback: (html) => {\r\n const name = html.find('[name=\"templateName\"]').val().trim();\r\n const hint = html.find('[name=\"templateHint\"]').val().trim();\r\n const img = html.find('[name=\"img\"]').val().trim();\r\n if (name.trim()) {\r\n TVA_CONFIG.templateMappings.push({ id: randomID(), name, hint, img, mappings: deepClone(mappings) });\r\n updateSettings({ templateMappings: TVA_CONFIG.templateMappings });\r\n }\r\n },\r\n },\r\n cancel: {\r\n label: 'Cancel',\r\n },\r\n },\r\n default: 'cancel',\r\n });\r\n dialog.render(true);\r\n}\r\n\r\nexport function toggleTemplateDialog() {\r\n new Templates({ callback: (templateName, mappings) => toggleTemplateOnSelected(templateName, mappings) }).render(\r\n true\r\n );\r\n}\r\n","export const CORE_TEMPLATES = [\r\n {\r\n name: 'Tint Red when HP is bellow 10%',\r\n hint: 'Tint token red when HP falls bellow 10%',\r\n img: 'https://user-images.githubusercontent.com/7693704/243428871-c52130b3-2f12-4de7-a86e-fabc67e865a9.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: 'MmLSOlJx',\r\n label: 'Tint Red',\r\n expression: 'hp<=10%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {\r\n texture: {\r\n tint: '#ff0000',\r\n },\r\n },\r\n overlay: false,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n label: 'Tint Red',\r\n },\r\n group: 'Low HP',\r\n i: 0,\r\n },\r\n ],\r\n id: 'Ob9LP35K',\r\n },\r\n {\r\n name: 'Health State Text Overlay',\r\n hint: `Displays text overlay based on percentage health. \\n0% < hp <= 25% : Critical\\n25% < hp <= 50% : Bloodied\\n50% < hp <= 75% : Wounded\\n75% < hp : Healthy`,\r\n img: 'https://user-images.githubusercontent.com/7693704/243426356-ceab629c-c16c-42b3-9004-af7dafb62eb7.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: 'jqaFdwkQ',\r\n label: 'Bloodied',\r\n expression: 'hp>25% && hp<=50%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Bloodied',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ff5900',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Bloodied',\r\n id: 'jqaFdwkQ',\r\n },\r\n group: 'Health State Overlay',\r\n i: 0,\r\n },\r\n {\r\n id: 'm4GQVz5O',\r\n label: 'Critical',\r\n expression: 'hp>0 && hp<=25%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Critical',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ff0000',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Critical',\r\n id: 'm4GQVz5O',\r\n },\r\n group: 'Health State Overlay',\r\n i: 1,\r\n },\r\n {\r\n id: 'H1wrS5N1',\r\n label: 'Healthy',\r\n expression: 'hp>75%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Healthy',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#2bff00',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Healthy',\r\n id: 'H1wrS5N1',\r\n },\r\n group: 'Health State Overlay',\r\n i: 2,\r\n },\r\n {\r\n id: 'IojJZS7v',\r\n label: 'Wounded',\r\n expression: 'hp>50% && hp<=75%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Wounded',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ffbb00',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Wounded',\r\n id: 'IojJZS7v',\r\n },\r\n group: 'Health State Overlay',\r\n i: 3,\r\n },\r\n ],\r\n id: 'JNClkgGU',\r\n },\r\n {\r\n name: 'Health State Text Overlay - Passed Check',\r\n hint: 'Same as Health State Text Overlay except also requiring the Token actor to have Reveal Health active effect applied to it.',\r\n img: 'https://user-images.githubusercontent.com/7693704/243429385-f62b111c-3d9c-4cd8-9c27-f5b13e09fea2.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: 'k0XbFE7a',\r\n label: 'Bloodied',\r\n expression: 'Reveal Health && hp>25% && hp<=50%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Bloodied',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ff5900',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Bloodied',\r\n id: 'k0XbFE7a',\r\n },\r\n group: 'Health State Overlay - Passed Check',\r\n i: 0,\r\n },\r\n {\r\n id: 'a1VxhnWK',\r\n label: 'Critical',\r\n expression: 'Reveal Health && hp>0 && hp<=25%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Critical',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ff0000',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Critical',\r\n id: 'a1VxhnWK',\r\n },\r\n group: 'Health State Overlay - Passed Check',\r\n i: 1,\r\n },\r\n {\r\n id: 'DNuBTXe8',\r\n label: 'Healthy',\r\n expression: 'Reveal Health && hp>75%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Healthy',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#2bff00',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Healthy',\r\n id: 'DNuBTXe8',\r\n },\r\n group: 'Health State Overlay - Passed Check',\r\n i: 2,\r\n },\r\n {\r\n id: 'ROPjrvLu',\r\n label: 'Wounded',\r\n expression: 'Reveal Health && hp>50% && hp<=75%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.51,\r\n scaleX: 0.76,\r\n scaleY: 0.76,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Wounded',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ffbb00',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: null,\r\n },\r\n },\r\n label: 'Wounded',\r\n id: 'ROPjrvLu',\r\n },\r\n group: 'Health State Overlay - Passed Check',\r\n i: 3,\r\n },\r\n ],\r\n id: '0ZJQiOdD',\r\n },\r\n {\r\n name: 'Fancy Nameplate',\r\n hint: 'Displays a curved red nameplate underneath the token.',\r\n img: 'https://user-images.githubusercontent.com/7693704/244439674-12510686-2f72-44b3-8a1d-e6cc7fbb00c6.png',\r\n mappings: [\r\n {\r\n id: 'DTbwvQiG',\r\n label: 'Token Nameplate',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n parent: '',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionX: false,\r\n linkDimensionY: false,\r\n linkOpacity: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: -0.51,\r\n scaleX: 0.68,\r\n scaleY: 0.68,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '{{name}}',\r\n fontFamily: 'Modesto Condensed',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ff0000',\r\n dropShadow: 'true',\r\n strokeThickness: 3,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 450,\r\n invert: true,\r\n },\r\n },\r\n shapes: [\r\n {\r\n line: {\r\n width: 1,\r\n color: '#111111',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#111111',\r\n alpha: 1,\r\n },\r\n },\r\n ],\r\n label: 'Token Nameplate',\r\n },\r\n group: 'Nameplate',\r\n i: 0,\r\n },\r\n ],\r\n id: 'Ik1uNcWU',\r\n },\r\n {\r\n name: 'Info Box #1',\r\n hint: 'Displays information about the token/actor when hovering over or controlling them. This box will adjust to canvas zoom.',\r\n img: 'https://user-images.githubusercontent.com/7693704/244441852-b50f3ca6-e0c3-4ce0-b498-ddd00edcbdca.png',\r\n system: 'dnd5e',\r\n group: 'Info',\r\n mappings: [\r\n {\r\n id: 'W8BPK9hv',\r\n label: 'Box Background',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'W8BPK9hv',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: true,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.55,\r\n offsetY: 0,\r\n scaleX: 0.73,\r\n scaleY: 0.73,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'DropShadowFilter',\r\n filterOptions: {\r\n rotation: 45,\r\n distance: 16.9,\r\n color: '#000000',\r\n alpha: 0.52,\r\n shadowOnly: false,\r\n blur: 2,\r\n quality: 3,\r\n },\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: true,\r\n limitOnHighlight: false,\r\n limitOnControl: true,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'rectangle',\r\n x: '0',\r\n y: '0',\r\n width: '450',\r\n height: '200',\r\n radius: '0',\r\n },\r\n label: '',\r\n line: {\r\n width: 2,\r\n color: '#ffffff',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#508fe2',\r\n color2: '',\r\n prc: '',\r\n alpha: 0.55,\r\n },\r\n },\r\n ],\r\n effect: '',\r\n label: 'Box Background',\r\n },\r\n group: 'Info Box',\r\n i: 0,\r\n },\r\n {\r\n id: 'bkoP4Qpo',\r\n label: 'Legendary Actions',\r\n expression: 'actor.system.resources.legact.max>0',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'bkoP4Qpo',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.47,\r\n offsetY: -0.02,\r\n scaleX: 0.5,\r\n scaleY: 0.5,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Legendary: Action {{actor.system.resources.legact.value}}/{{actor.system.resources.legact.max}} Resistance {{actor.system.resources.legres.value}}/{{actor.system.resources.legres.max}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Legendary Actions',\r\n },\r\n group: 'Info Box',\r\n i: 1,\r\n },\r\n {\r\n id: 'OvcWUW13',\r\n label: 'Mods',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'OvcWUW13',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: -0.38,\r\n scaleX: 0.57,\r\n scaleY: 0.57,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'STR {{actor.system.abilities.str.mod}} DEX {{actor.system.abilities.dex.mod}} CON {{actor.system.abilities.con.mod}} INT {{actor.system.abilities.int.mod}} WIS {{actor.system.abilities.wis.mod}} CHA {{actor.system.abilities.cha.mod}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Mods',\r\n },\r\n group: 'Info Box',\r\n i: 2,\r\n },\r\n {\r\n id: 'jybTYLTB',\r\n label: 'Token Name',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 51,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'jybTYLTB',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.47,\r\n offsetY: 0.35,\r\n scaleX: 0.77,\r\n scaleY: 0.77,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Name: {{name}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Token Name',\r\n },\r\n group: 'Info Box',\r\n i: 3,\r\n },\r\n {\r\n id: 'bGbHPbw6',\r\n label: 'HP',\r\n expression: 'hp>40%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 52,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'bGbHPbw6',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.47,\r\n offsetY: 0.23,\r\n scaleX: 0.82,\r\n scaleY: 0.82,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'HP: {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#6b6b6b',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'HP',\r\n },\r\n group: 'Info Box',\r\n i: 4,\r\n },\r\n {\r\n id: 'S9gXdyGY',\r\n label: 'Low HP',\r\n expression: 'hp<=40%',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 52,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'S9gXdyGY',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.47,\r\n offsetY: 0.23,\r\n scaleX: 0.82,\r\n scaleY: 0.82,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'HP: {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#ff0000',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#6b6b6b',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Low HP',\r\n },\r\n group: 'Info Box',\r\n i: 5,\r\n },\r\n {\r\n id: 'k9Ws74Hc',\r\n label: 'Actor AC',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 53,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'k9Ws74Hc',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.25,\r\n offsetY: 0.46,\r\n scaleX: 1,\r\n scaleY: 1,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'AC: {{actor.system.attributes.ac.value}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Actor AC',\r\n },\r\n group: 'Info Box',\r\n i: 6,\r\n },\r\n {\r\n id: 'eIxjLZmy',\r\n label: 'Movement Label',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 54,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'eIxjLZmy',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.25,\r\n offsetY: 0.2,\r\n scaleX: 0.61,\r\n scaleY: 0.61,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Movement',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Movement Label',\r\n },\r\n group: 'Info Box',\r\n i: 7,\r\n },\r\n {\r\n id: 'k5xYpZAZ',\r\n label: 'Movement Walk',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 55,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'k5xYpZAZ',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.36,\r\n offsetY: -0.03,\r\n scaleX: 1,\r\n scaleY: 1,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '{{actor.system.attributes.movement.walk}}ft',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Movement Walk',\r\n },\r\n group: 'Info Box',\r\n i: 8,\r\n },\r\n {\r\n id: 'dHHZRQXG',\r\n label: 'Movement Fly',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 56,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'dHHZRQXG',\r\n parentID: 'W8BPK9hv',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.36,\r\n offsetY: -0.16,\r\n scaleX: 0.33,\r\n scaleY: 0.33,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Fly {{actor.system.attributes.movement.fly}}, Swim {{actor.system.attributes.movement.swim}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Movement Fly',\r\n },\r\n group: 'Info Box',\r\n i: 9,\r\n },\r\n ],\r\n id: 'wuMcLy3T',\r\n },\r\n {\r\n name: 'Info Box #2',\r\n hint: 'Displays information about the token/actor when hovering over or controlling them. This box will adjust to canvas zoom.',\r\n img: 'https://user-images.githubusercontent.com/7693704/244750685-81988600-5153-4d29-acb0-2c62111bed14.png',\r\n system: 'dnd5e',\r\n mappings: [\r\n {\r\n id: 'f0pV6Pnl',\r\n label: 'Box Background',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'f0pV6Pnl',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: true,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.55,\r\n offsetY: 0,\r\n scaleX: 1,\r\n scaleY: 1,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: true,\r\n limitOnHighlight: false,\r\n limitOnControl: true,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'rectangle',\r\n x: '0',\r\n y: '0',\r\n width: '200',\r\n height: '300',\r\n radius: '0',\r\n },\r\n label: '',\r\n line: {\r\n width: 2,\r\n color: '#ffffff',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#2e5a94',\r\n color2: '',\r\n prc: '',\r\n alpha: 0.9,\r\n },\r\n },\r\n ],\r\n effect: '',\r\n label: 'Box Background',\r\n },\r\n group: 'Info Box #2',\r\n i: 0,\r\n },\r\n {\r\n id: 'n2Adi1fi',\r\n label: 'HP',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 51,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'n2Adi1fi',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.45,\r\n offsetY: 0.42,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'HP: {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'HP',\r\n },\r\n group: 'Info Box #2',\r\n i: 1,\r\n },\r\n {\r\n id: 'hCKVzw3Z',\r\n label: ' AC',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 52,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'hCKVzw3Z',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.45,\r\n offsetY: 0.31,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'AC: {{actor.system.attributes.ac.value}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: ' AC',\r\n },\r\n group: 'Info Box #2',\r\n i: 2,\r\n },\r\n {\r\n id: '2nYmUTwu',\r\n label: ' Speed',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 53,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '2nYmUTwu',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.45,\r\n offsetY: 0.2,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Speed: {{actor.system.attributes.movement.walk}}ft',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: ' Speed',\r\n },\r\n group: 'Info Box #2',\r\n i: 3,\r\n },\r\n {\r\n id: 's1NtDiUV',\r\n label: 'Perception',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 54,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 's1NtDiUV',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0.15,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Perception',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Perception',\r\n },\r\n group: 'Info Box #2',\r\n i: 4,\r\n },\r\n {\r\n id: 'jYeRIoG2',\r\n label: 'Passive Perception',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 55,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'jYeRIoG2',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.47,\r\n offsetY: 0,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Passive: {{actor.system.skills.prc.passive}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Passive Perception',\r\n },\r\n group: 'Info Box #2',\r\n i: 5,\r\n },\r\n {\r\n id: 'KYMdkTVI',\r\n label: 'Active Perception',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 56,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'KYMdkTVI',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.48,\r\n offsetY: 0,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 1,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Active: {{actor.system.skills.prc.total}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Active Perception',\r\n },\r\n group: 'Info Box #2',\r\n i: 6,\r\n },\r\n {\r\n id: 'Ewbg54II',\r\n label: 'CHA',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'Ewbg54II',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.31,\r\n offsetY: -0.3,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'CHA\\\\n{{actor.system.abilities.cha.mod}} {{actor.system.abilities.cha.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'CHA',\r\n },\r\n group: 'Info Box #2',\r\n i: 7,\r\n },\r\n {\r\n id: '2le1Nagp',\r\n label: 'CON',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '2le1Nagp',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.31,\r\n offsetY: -0.11,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'CON\\\\n{{actor.system.abilities.con.mod}} {{actor.system.abilities.con.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'CON',\r\n },\r\n group: 'Info Box #2',\r\n i: 8,\r\n },\r\n {\r\n id: 'ahKmjzLj',\r\n label: 'DEX',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'ahKmjzLj',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: -0.11,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'DEX\\\\n{{actor.system.abilities.dex.mod}} {{actor.system.abilities.dex.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'DEX',\r\n },\r\n group: 'Info Box #2',\r\n i: 9,\r\n },\r\n {\r\n id: 'gQzyq0zm',\r\n label: 'INT',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'gQzyq0zm',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.32,\r\n offsetY: -0.3,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'INT\\\\n{{actor.system.abilities.int.mod}} {{actor.system.abilities.int.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'INT',\r\n },\r\n group: 'Info Box #2',\r\n i: 10,\r\n },\r\n {\r\n id: 'hYGg1oAt',\r\n label: 'STR',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'hYGg1oAt',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.32,\r\n offsetY: -0.11,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'STR\\\\n{{actor.system.abilities.str.mod}} {{actor.system.abilities.str.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'STR',\r\n },\r\n group: 'Info Box #2',\r\n i: 11,\r\n },\r\n {\r\n id: 'uQ5zS3K6',\r\n label: 'WIS',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'uQ5zS3K6',\r\n parentID: 'f0pV6Pnl',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: -0.3,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'WIS\\\\n{{actor.system.abilities.wis.mod}} {{actor.system.abilities.wis.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'WIS',\r\n },\r\n group: 'Info Box #2',\r\n i: 12,\r\n },\r\n ],\r\n id: 'Wtq9HDsX',\r\n },\r\n {\r\n name: 'Info Box #3',\r\n hint: 'Displays information about the token/actor when hovering over or controlling them. This box will adjust to canvas zoom.',\r\n img: 'https://user-images.githubusercontent.com/7693704/244750246-794625b9-9e1d-4322-9265-fc295f02ca2b.png',\r\n system: 'dnd5e',\r\n mappings: [\r\n {\r\n id: 'Gt11vjXV',\r\n label: 'Box Background',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'Gt11vjXV',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: true,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.55,\r\n offsetY: 0,\r\n scaleX: 1,\r\n scaleY: 1,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: true,\r\n limitOnHighlight: false,\r\n limitOnControl: true,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'rectangle',\r\n x: '0',\r\n y: '0',\r\n width: '240',\r\n height: '300',\r\n radius: '0',\r\n },\r\n label: '',\r\n line: {\r\n width: 2,\r\n color: '#ffffff',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#2e5a94',\r\n color2: '',\r\n prc: '',\r\n alpha: 0.9,\r\n },\r\n },\r\n ],\r\n effect: '',\r\n label: 'Box Background',\r\n },\r\n group: 'Info Box #3',\r\n i: 0,\r\n },\r\n {\r\n id: 'o4XWzdDM',\r\n label: 'HP',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 51,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'o4XWzdDM',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.44,\r\n offsetY: 0.42,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: ' {{actor.system.attributes.hp.value}}/{{actor.system.attributes.hp.max}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'HP',\r\n },\r\n group: 'Info Box #3',\r\n i: 1,\r\n },\r\n {\r\n id: 'eAv2dSV6',\r\n label: 'AC',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 52,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'eAv2dSV6',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.43,\r\n offsetY: 0.28,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: ' {{actor.system.attributes.ac.value}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'AC',\r\n },\r\n group: 'Info Box #3',\r\n i: 2,\r\n },\r\n {\r\n id: 'SCfkWTni',\r\n label: 'Fly Speed',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 53,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'SCfkWTni',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.04,\r\n offsetY: 0.13,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: ' {{actor.system.attributes.movement.fly}}ft',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Fly Speed',\r\n },\r\n group: 'Info Box #3',\r\n i: 3,\r\n },\r\n {\r\n id: 'e5LPzVta',\r\n label: 'Walk Speed',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 53,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'e5LPzVta',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.45,\r\n offsetY: 0.13,\r\n scaleX: 0.84,\r\n scaleY: 0.84,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: ' {{actor.system.attributes.movement.walk}}ft',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Walk Speed',\r\n },\r\n group: 'Info Box #3',\r\n i: 4,\r\n },\r\n {\r\n id: 'XlopagaT',\r\n label: 'Passive Perception',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 55,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'XlopagaT',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.45,\r\n offsetY: -0.02,\r\n scaleX: 0.83,\r\n scaleY: 0.83,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: ' {{actor.system.skills.prc.passive}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Passive Perception',\r\n },\r\n group: 'Info Box #3',\r\n i: 5,\r\n },\r\n {\r\n id: 'CeXgVxA0',\r\n label: 'Active Perception',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 56,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'CeXgVxA0',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.03,\r\n offsetY: -0.02,\r\n scaleX: 0.83,\r\n scaleY: 0.83,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: ' {{actor.system.skills.prc.total}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Active Perception',\r\n },\r\n group: 'Info Box #3',\r\n i: 6,\r\n },\r\n {\r\n id: '0WWf1iGM',\r\n label: 'CHA',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '0WWf1iGM',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.31,\r\n offsetY: -0.3,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'CHA\\\\n{{actor.system.abilities.cha.mod}} {{actor.system.abilities.cha.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'CHA',\r\n },\r\n group: 'Info Box #3',\r\n i: 7,\r\n },\r\n {\r\n id: 'AU8tTXat',\r\n label: 'CON',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'AU8tTXat',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.31,\r\n offsetY: -0.11,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'CON\\\\n{{actor.system.abilities.con.mod}} {{actor.system.abilities.con.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'CON',\r\n },\r\n group: 'Info Box #3',\r\n i: 8,\r\n },\r\n {\r\n id: 'JZKNmgvY',\r\n label: 'DEX',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'JZKNmgvY',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: -0.11,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'DEX\\\\n{{actor.system.abilities.dex.mod}} {{actor.system.abilities.dex.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'DEX',\r\n },\r\n group: 'Info Box #3',\r\n i: 9,\r\n },\r\n {\r\n id: 'AUGurJtx',\r\n label: 'INT',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'AUGurJtx',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.32,\r\n offsetY: -0.3,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'INT\\\\n{{actor.system.abilities.int.mod}} {{actor.system.abilities.int.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'INT',\r\n },\r\n group: 'Info Box #3',\r\n i: 10,\r\n },\r\n {\r\n id: 'z0PMTFxo',\r\n label: 'STR',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'z0PMTFxo',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0.32,\r\n offsetY: -0.11,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'STR\\\\n{{actor.system.abilities.str.mod}} {{actor.system.abilities.str.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'STR',\r\n },\r\n group: 'Info Box #3',\r\n i: 11,\r\n },\r\n {\r\n id: 'YXUiGPBv',\r\n label: 'WIS',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 57,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'YXUiGPBv',\r\n parentID: 'Gt11vjXV',\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: true,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: -0.3,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'WIS\\\\n{{actor.system.abilities.wis.mod}} {{actor.system.abilities.wis.save}}',\r\n fontFamily: 'Signika',\r\n fontSize: 36,\r\n letterSpacing: 0,\r\n fill: '#FFFFFF',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'WIS',\r\n },\r\n group: 'Info Box #3',\r\n i: 12,\r\n },\r\n ],\r\n id: 'vQJ3coCJ',\r\n },\r\n {\r\n name: 'Facing Direction',\r\n hint: 'Displays an arrow in the top-right corner of the token showing the direction it is facing.',\r\n img: 'https://user-images.githubusercontent.com/7693704/244647284-2213caf5-6d49-4413-ab5f-83901ffbc8e6.png',\r\n mappings: [\r\n {\r\n id: '9UEOkJ1J',\r\n label: 'Arrow',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '9UEOkJ1J',\r\n parentID: '',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: true,\r\n animation: {\r\n relative: true,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.5,\r\n offsetY: 0.5,\r\n scaleX: 0.51,\r\n scaleY: 0.51,\r\n angle: 90,\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '➢',\r\n fontFamily: 'Signika',\r\n fontSize: 63,\r\n letterSpacing: 0,\r\n fill: '#ff0000',\r\n dropShadow: null,\r\n strokeThickness: 3,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Arrow',\r\n },\r\n group: 'Facing Direction',\r\n i: 0,\r\n },\r\n ],\r\n id: 'Z8CTgmOg',\r\n },\r\n {\r\n name: 'Combat Markers',\r\n hint: 'Displays rotating markers for tokens in combat.',\r\n img: 'https://user-images.githubusercontent.com/7693704/257478593-81b9192d-1ffe-4f0b-8e5d-806218d7e25f.png',\r\n mappings: [\r\n {\r\n id: '9R3glzOK',\r\n label: 'Your Turn is Next!',\r\n expression: 'combat-turn-next',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n label: 'Your Turn is Next!',\r\n parent: '',\r\n underlay: true,\r\n bottom: true,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: true,\r\n duration: 30000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: false,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0,\r\n scaleX: 1.6,\r\n scaleY: 1.6,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: 'Next Turn = = = = = = Next turn = = = = = ',\r\n fontFamily: 'Signika',\r\n fontSize: 41,\r\n letterSpacing: 0,\r\n fill: '#e6a800',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 125,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n },\r\n group: 'Combat',\r\n i: 0,\r\n },\r\n {\r\n id: 'qoWG5AD0',\r\n label: 'Your Turn!',\r\n expression: 'combat-turn',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n label: 'Your Turn!',\r\n parent: '',\r\n underlay: true,\r\n bottom: true,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: true,\r\n duration: 30000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: true,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: false,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: 0,\r\n offsetY: 0,\r\n scaleX: 1.6,\r\n scaleY: 1.6,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '= Your Turn = = = = = = Your turn = = = = = ',\r\n fontFamily: 'Signika',\r\n fontSize: 41,\r\n letterSpacing: 0,\r\n fill: '#00ace6',\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 125,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n },\r\n group: 'Combat',\r\n i: 1,\r\n },\r\n ],\r\n id: 'YpoX5zxO',\r\n },\r\n {\r\n name: 'Disposition Markers',\r\n hint: 'Displays circles underneath tokens coloured based on their disposition.',\r\n img: 'https://user-images.githubusercontent.com/7693704/246497702-5de47dc9-21ef-43a1-86db-b3f85eb8ddb1.png',\r\n mappings: [\r\n {\r\n id: 'TzP6MBC1',\r\n label: 'Friendly',\r\n expression: 'disposition=1',\r\n codeExp: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'TzP6MBC1',\r\n parentID: '',\r\n underlay: true,\r\n bottom: true,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: '5000',\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n imgLinked: false,\r\n repeating: false,\r\n alpha: '1',\r\n tint: '#1acb2f',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n width: '',\r\n height: '',\r\n scaleX: '0.24',\r\n scaleY: '0.24',\r\n angle: '0',\r\n pOffsetX: '',\r\n pOffsetY: '',\r\n offsetX: '0',\r\n offsetY: '0',\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedToOwner: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnHUD: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#FFFFFF',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: '36',\r\n align: 'center',\r\n letterSpacing: '0',\r\n dropShadow: 'true',\r\n strokeThickness: '1',\r\n stroke: '#111111',\r\n wordWrap: false,\r\n wordWrapWidth: '200',\r\n breakWords: false,\r\n maxHeight: '0',\r\n curve: {\r\n angle: '0',\r\n radius: '0',\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '0',\r\n y: '0',\r\n width: '{{object.w}} * @scale',\r\n height: '{{object.h}} * @scale',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ffffff',\r\n alpha: '0.75',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '{{object.w}} * @inner',\r\n y: '{{object.w}} * @inner',\r\n width: '{{object.w}} * @scale - {{object.w}} * @inner',\r\n height: '{{object.h}} * @scale - {{object.h}} * @inner',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#b8b8b8',\r\n alpha: '0.7',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n ],\r\n variables: [\r\n {\r\n name: 'scale',\r\n value: '2.3',\r\n },\r\n {\r\n name: 'inner',\r\n value: '0.3',\r\n },\r\n ],\r\n effect: '',\r\n interactivity: [],\r\n label: 'Friendly',\r\n },\r\n group: 'Disposition Markers',\r\n i: 2,\r\n },\r\n {\r\n id: 'oIsQWISB',\r\n label: 'Hostile',\r\n expression: 'disposition=-1',\r\n codeExp: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'oIsQWISB',\r\n parentID: '',\r\n underlay: true,\r\n bottom: true,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: '5000',\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n imgLinked: false,\r\n repeating: false,\r\n alpha: '1',\r\n tint: '#eb0000',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n width: '',\r\n height: '',\r\n scaleX: '0.24',\r\n scaleY: '0.24',\r\n angle: '0',\r\n pOffsetX: '',\r\n pOffsetY: '',\r\n offsetX: '0',\r\n offsetY: '0',\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedToOwner: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnHUD: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#FFFFFF',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: '36',\r\n align: 'center',\r\n letterSpacing: '0',\r\n dropShadow: 'true',\r\n strokeThickness: '1',\r\n stroke: '#111111',\r\n wordWrap: false,\r\n wordWrapWidth: '200',\r\n breakWords: false,\r\n maxHeight: '0',\r\n curve: {\r\n angle: '0',\r\n radius: '0',\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '0',\r\n y: '0',\r\n width: '{{object.w}} * @scale',\r\n height: '{{object.h}} * @scale',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ffffff',\r\n alpha: '0.75',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '{{object.w}} * @inner',\r\n y: '{{object.w}} * @inner',\r\n width: '{{object.w}} * @scale - {{object.w}} * @inner',\r\n height: '{{object.h}} * @scale - {{object.h}} * @inner',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#b8b8b8',\r\n alpha: '0.7',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n ],\r\n variables: [\r\n {\r\n name: 'scale',\r\n value: '2.3',\r\n },\r\n {\r\n name: 'inner',\r\n value: '0.3',\r\n },\r\n ],\r\n effect: '',\r\n interactivity: [],\r\n label: 'Hostile',\r\n },\r\n group: 'Disposition Markers',\r\n i: 3,\r\n },\r\n {\r\n id: 'fYxJ9Bbc',\r\n label: 'Neutral',\r\n expression: 'disposition=0',\r\n codeExp: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'fYxJ9Bbc',\r\n parentID: '',\r\n underlay: true,\r\n bottom: true,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: '5000',\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n imgLinked: false,\r\n repeating: false,\r\n alpha: '1',\r\n tint: '',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n width: '',\r\n height: '',\r\n scaleX: '0.24',\r\n scaleY: '0.24',\r\n angle: '0',\r\n pOffsetX: '',\r\n pOffsetY: '',\r\n offsetX: '0',\r\n offsetY: '0',\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedToOwner: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnHUD: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#FFFFFF',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: '36',\r\n align: 'center',\r\n letterSpacing: '0',\r\n dropShadow: 'true',\r\n strokeThickness: '1',\r\n stroke: '#111111',\r\n wordWrap: false,\r\n wordWrapWidth: '200',\r\n breakWords: false,\r\n maxHeight: '0',\r\n curve: {\r\n angle: '0',\r\n radius: '0',\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '0',\r\n y: '0',\r\n width: '{{object.w}} * @scale',\r\n height: '{{object.h}} * @scale',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ffffff',\r\n alpha: '0.75',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '{{object.w}} * @inner',\r\n y: '{{object.w}} * @inner',\r\n width: '{{object.w}} * @scale - {{object.w}} * @inner',\r\n height: '{{object.h}} * @scale - {{object.h}} * @inner',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#b8b8b8',\r\n alpha: '0.7',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n ],\r\n variables: [\r\n {\r\n name: 'scale',\r\n value: '2.3',\r\n },\r\n {\r\n name: 'inner',\r\n value: '0.3',\r\n },\r\n ],\r\n effect: '',\r\n interactivity: [],\r\n label: 'Neutral',\r\n },\r\n group: 'Disposition Markers',\r\n i: 4,\r\n },\r\n {\r\n id: 'PyEXXb5J',\r\n label: 'Secret',\r\n expression: 'disposition=-2',\r\n codeExp: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: false,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'PyEXXb5J',\r\n parentID: '',\r\n underlay: true,\r\n bottom: true,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: '5000',\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n imgLinked: false,\r\n repeating: false,\r\n alpha: '1',\r\n tint: '#ba24ff',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n width: '',\r\n height: '',\r\n scaleX: '0.24',\r\n scaleY: '0.24',\r\n angle: '0',\r\n pOffsetX: '',\r\n pOffsetY: '',\r\n offsetX: '0',\r\n offsetY: '0',\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedToOwner: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnHUD: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#FFFFFF',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: '36',\r\n align: 'center',\r\n letterSpacing: '0',\r\n dropShadow: 'true',\r\n strokeThickness: '1',\r\n stroke: '#111111',\r\n wordWrap: false,\r\n wordWrapWidth: '200',\r\n breakWords: false,\r\n maxHeight: '0',\r\n curve: {\r\n angle: '0',\r\n radius: '0',\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '0',\r\n y: '0',\r\n width: '{{object.w}} * @scale',\r\n height: '{{object.h}} * @scale',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ffffff',\r\n alpha: '0.75',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '{{object.w}} * @inner',\r\n y: '{{object.w}} * @inner',\r\n width: '{{object.w}} * @scale - {{object.w}} * @inner',\r\n height: '{{object.h}} * @scale - {{object.h}} * @inner',\r\n },\r\n label: '',\r\n line: {\r\n width: '0',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#b8b8b8',\r\n alpha: '0.7',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n ],\r\n variables: [\r\n {\r\n name: 'scale',\r\n value: '2.3',\r\n },\r\n {\r\n name: 'inner',\r\n value: '0.3',\r\n },\r\n ],\r\n effect: '',\r\n interactivity: [],\r\n label: 'Secret',\r\n },\r\n group: 'Disposition Markers',\r\n i: 5,\r\n },\r\n ],\r\n id: 'yjqfAagB',\r\n },\r\n {\r\n name: 'Health Bar',\r\n hint: 'A recreation of the standard health bar using Overlays.',\r\n img: 'https://user-images.githubusercontent.com/7693704/257246890-d41894a0-7f40-4e91-a47a-bc10d6f198e6.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: 'dgIBKbcU',\r\n label: 'Health Bar',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'dgIBKbcU',\r\n parentID: '',\r\n ui: true,\r\n underlay: true,\r\n bottom: true,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n repeating: false,\r\n alpha: 1,\r\n tint: '',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n offsetX: 0,\r\n offsetY: -0.5,\r\n scaleX: 1,\r\n scaleY: 1,\r\n angle: 0,\r\n anchor: {\r\n x: 0.5,\r\n y: 1,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#FFFFFF',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: 36,\r\n align: 'left',\r\n letterSpacing: 0,\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'rectangle',\r\n x: '0',\r\n y: '0',\r\n width: '{{object.w}}',\r\n height: '{{object.h}} * @height',\r\n radius: '3',\r\n },\r\n label: '',\r\n line: {\r\n width: 1,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#5c5c5c',\r\n alpha: 0.65,\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'rectangle',\r\n x: '0',\r\n y: '0',\r\n width: '{{object.w}} * ( {{hp}} / {{hpMax}} )',\r\n height: '{{object.h}} * @height',\r\n radius: '3',\r\n },\r\n label: '',\r\n line: {\r\n width: 1,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#ff0000',\r\n alpha: 1,\r\n interpolateColor: {\r\n color2: '#74da0e',\r\n prc: '{{hp}} / {{hpMax}}',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n ],\r\n variables: [\r\n {\r\n name: 'height',\r\n value: '0.079',\r\n },\r\n ],\r\n effect: '',\r\n label: 'Health Bar',\r\n },\r\n group: 'Health Bar',\r\n i: 0,\r\n },\r\n ],\r\n id: 'GDyvkEB4',\r\n },\r\n {\r\n name: 'Health Ring',\r\n hint: 'A ring shaped health bar.',\r\n img: 'https://user-images.githubusercontent.com/7693704/257246432-a339394f-489a-4436-9d4b-427c285d4f27.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: 'erOTHzIc',\r\n label: 'Health Ring',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: 'erOTHzIc',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n repeating: false,\r\n alpha: 1,\r\n tint: '',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n offsetX: 0,\r\n offsetY: 0,\r\n scaleX: 1.02,\r\n scaleY: 1.02,\r\n angle: -90,\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#ffffff',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: 36,\r\n align: 'left',\r\n letterSpacing: 0,\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '{{object.w}} / @ringScale * @innerRadius',\r\n outerRadius: '{{object.w}} / @ringScale * @outerRadius',\r\n startAngle: '0',\r\n endAngle: '360',\r\n },\r\n label: 'Background',\r\n line: {\r\n width: 0,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#b0b0b0',\r\n alpha: 0.6,\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '{{object.w}} / @ringScale * @innerRadius',\r\n outerRadius: '{{object.w}} / @ringScale * @outerRadius',\r\n startAngle: '0',\r\n endAngle: '{{hp}} / {{hpMax}} * 360',\r\n },\r\n label: 'Health Tracker',\r\n line: {\r\n width: 0,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#ff0000',\r\n alpha: 1,\r\n interpolateColor: {\r\n color2: '#74da0e',\r\n prc: '{{hp}} / {{hpMax}}',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '{{object.w}} / @ringScale * @innerRadius',\r\n outerRadius: '{{object.w}} / @ringScale * @outerRadius',\r\n startAngle: '0',\r\n endAngle: '360',\r\n },\r\n label: 'Outline',\r\n line: {\r\n width: 1,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#b0b0b0',\r\n alpha: 0,\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n ],\r\n variables: [\r\n {\r\n name: 'ringScale',\r\n value: '1.8',\r\n },\r\n {\r\n name: 'innerRadius',\r\n value: '0.9',\r\n },\r\n {\r\n name: 'outerRadius',\r\n value: '1.0',\r\n },\r\n ],\r\n effect: '',\r\n label: 'Health Ring',\r\n },\r\n group: 'Health Ring',\r\n i: 0,\r\n },\r\n ],\r\n id: 'yITi94hC',\r\n },\r\n {\r\n name: 'Health Hearts',\r\n hint: 'Displays up to 10 hearts to the right of the token based on their current health. Each heart is representative of 10% of the health.',\r\n img: 'https://user-images.githubusercontent.com/7693704/257349483-1864d4ca-a2de-468d-872d-6d8c2847434a.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: '4uCpbtHY',\r\n label: 'Hearts',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '4uCpbtHY',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: true,\r\n linkDimensionsY: true,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n alpha: 1,\r\n tint: '',\r\n offsetX: -0.53,\r\n offsetY: 0.5,\r\n scaleX: 0.5,\r\n scaleY: 0.5,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: ' ',\r\n repeating: true,\r\n repeat: {\r\n value: '{{hp}}',\r\n increment: '10',\r\n isPercentage: true,\r\n maxValue: '{{hpMax}}',\r\n perRow: '2',\r\n maxRows: '',\r\n },\r\n fontFamily: 'Signika',\r\n fill: '#ff0000',\r\n fontSize: 36,\r\n align: 'left',\r\n letterSpacing: 0,\r\n dropShadow: null,\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n effect: '',\r\n label: 'Hearts',\r\n },\r\n group: 'Health Hearts',\r\n i: 0,\r\n },\r\n ],\r\n id: 'T2DrD0Em',\r\n },\r\n {\r\n name: 'Health Circles',\r\n hint: 'Displays up to 10 circles to the right of the token based on their current health. Each circle is representative of 10% of the health.',\r\n img: 'https://user-images.githubusercontent.com/7693704/257476414-c42bdbc0-c57b-4367-8207-3e2e4273094f.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: '0vETg18v',\r\n label: 'Health Circles',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '0vETg18v',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: true,\r\n linkDimensionsY: true,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n repeating: false,\r\n alpha: 1,\r\n tint: '',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n offsetX: -0.52,\r\n offsetY: 0.6,\r\n scaleX: 0.46,\r\n scaleY: 0.46,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#ffffff',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: 36,\r\n align: 'left',\r\n letterSpacing: 0,\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'ellipse',\r\n x: '0',\r\n y: '0',\r\n width: '25',\r\n height: '25',\r\n },\r\n label: '',\r\n line: {\r\n width: 1,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#ff0000',\r\n alpha: 1,\r\n interpolateColor: {\r\n color2: '#74da0e',\r\n prc: '{{hp}} / {{hpMax}}',\r\n },\r\n },\r\n repeating: true,\r\n repeat: {\r\n value: '{{hp}}',\r\n increment: '10',\r\n isPercentage: true,\r\n maxValue: '{{hpMax}}',\r\n perRow: '2',\r\n maxRows: '',\r\n paddingX: '3',\r\n paddingY: '3',\r\n },\r\n },\r\n ],\r\n effect: '',\r\n label: 'Health Circles',\r\n },\r\n group: 'Health Circles',\r\n i: 0,\r\n },\r\n ],\r\n id: 'kJ0Fi54w',\r\n },\r\n {\r\n name: 'Health Squares',\r\n hint: 'Displays up to 10 squares to the right of the token based on their current health. Each square is representative of 10% of the health.',\r\n img: 'https://user-images.githubusercontent.com/7693704/257477099-689cd23a-0e4a-4d9a-aaa2-bf88b169ede8.png',\r\n group: 'Health',\r\n mappings: [\r\n {\r\n id: '0vETg18v',\r\n label: 'Health Squares',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '0vETg18v',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: false,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: 5000,\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: true,\r\n linkDimensionsY: true,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n repeating: false,\r\n alpha: 1,\r\n tint: '',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n offsetX: -0.52,\r\n offsetY: 0.6,\r\n scaleX: 0.46,\r\n scaleY: 0.46,\r\n angle: 0,\r\n anchor: {\r\n x: 0,\r\n y: 0,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedUsers: [],\r\n limitOnHover: false,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#ffffff',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: 36,\r\n align: 'left',\r\n letterSpacing: 0,\r\n dropShadow: 'true',\r\n strokeThickness: 1,\r\n stroke: '#111111',\r\n curve: {\r\n radius: 0,\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'rectangle',\r\n x: '0',\r\n y: '0',\r\n width: '50',\r\n height: '50',\r\n radius: '0',\r\n },\r\n label: '',\r\n line: {\r\n width: 1,\r\n color: '#000000',\r\n alpha: 1,\r\n },\r\n fill: {\r\n color: '#ff0000',\r\n alpha: 1,\r\n interpolateColor: {\r\n color2: '#74da0e',\r\n prc: '{{hp}} / {{hpMax}}',\r\n },\r\n },\r\n repeating: true,\r\n repeat: {\r\n value: '{{hp}}',\r\n increment: '10',\r\n isPercentage: true,\r\n maxValue: '{{hpMax}}',\r\n perRow: '2',\r\n maxRows: '',\r\n paddingX: '3',\r\n paddingY: '3',\r\n },\r\n },\r\n ],\r\n effect: '',\r\n label: 'Health Squares',\r\n },\r\n group: 'Health Squares',\r\n i: 0,\r\n },\r\n ],\r\n id: 'zzeRhmmk',\r\n },\r\n {\r\n name: 'Spell Slot Ring',\r\n hint: 'Remaining spell slots represented as a ring.',\r\n img: 'https://user-images.githubusercontent.com/7693704/261663740-444d86b9-ee9f-4a2f-963f-6886a2af29cc.png',\r\n system: 'dnd5e',\r\n mappings: [\r\n {\r\n id: '1SS3KhwM',\r\n label: 'Spell Slot Ring',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 50,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '1SS3KhwM',\r\n parentID: '',\r\n ui: true,\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: '5000',\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n repeating: false,\r\n alpha: '1',\r\n tint: '',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n width: '{{object.w}} * @Scale',\r\n height: '{{object.w}} * @Scale',\r\n scaleX: '1',\r\n scaleY: '1',\r\n angle: '0',\r\n offsetX: '0',\r\n offsetY: '0',\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedToOwner: true,\r\n limitedUsers: [],\r\n limitOnHover: true,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#ffffff',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: '36',\r\n align: 'left',\r\n letterSpacing: '0',\r\n dropShadow: 'true',\r\n strokeThickness: '1',\r\n stroke: '#111111',\r\n wordWrap: false,\r\n wordWrapWidth: '200',\r\n breakWords: false,\r\n maxHeight: '0',\r\n curve: {\r\n angle: '0',\r\n radius: '0',\r\n invert: false,\r\n },\r\n },\r\n shapes: [\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer ',\r\n startAngle: '0',\r\n endAngle: '360',\r\n },\r\n label: 'BaseLayer',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#3b3b3b',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90',\r\n endAngle: '-90 + ( {{actor.system.spells.spell1.value}} * @Tick )',\r\n },\r\n label: '1st level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff0000',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 4 * @Tick )',\r\n endAngle: '-90 + ( 4 * @Tick ) + ( {{actor.system.spells.spell2.value}} * @Tick )',\r\n },\r\n label: '2nd Level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff8800',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 7 * @Tick )',\r\n endAngle: '-90 + ( 7 * @Tick ) + ( {{actor.system.spells.spell3.value}} * @Tick )',\r\n },\r\n label: '3rd Level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ffdd00',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 10 * @Tick )',\r\n endAngle: '-90 + ( 10 * @Tick ) + ( {{actor.system.spells.spell4.value}} * @Tick )',\r\n },\r\n label: '4th Level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#37ff00',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 13 * @Tick )',\r\n endAngle: '-90 + ( 13 * @Tick ) + ( {{actor.system.spells.spell5.value}} * @Tick )',\r\n },\r\n label: '5th Level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#00ffcc',\r\n alpha: '0.95',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 16 * @Tick )',\r\n endAngle: '-90 + ( 16 * @Tick ) + ( {{actor.system.spells.spell6.value}} * @Tick )',\r\n },\r\n label: '6th Level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#00b3ff',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 18 * @Tick )',\r\n endAngle: '-90 + ( 18 * @Tick ) + ( {{actor.system.spells.spell7.value}} * @Tick )',\r\n },\r\n label: '7th Level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#001eff',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 20 * @Tick )',\r\n endAngle: '-90 + ( 20 * @Tick ) + ( {{actor.system.spells.spell8.value}} * @Tick )',\r\n },\r\n label: '8th Level',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ae00ff',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 21 * @Tick )',\r\n endAngle: '-90 + ( 21 * @Tick ) + ( {{actor.system.spells.spell9.value}} * @Tick )',\r\n },\r\n label: '9th Level - Copy',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '1',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90',\r\n endAngle: '-90 + ( 1 * @Tick )',\r\n },\r\n label: 'Outline 1',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 1 * @Tick )',\r\n endAngle: '-90 + ( 2 * @Tick )',\r\n },\r\n label: 'Outline 2',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 2 * @Tick )',\r\n endAngle: '-90 + ( 3 * @Tick )',\r\n },\r\n label: 'Outline 3',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 3 * @Tick )',\r\n endAngle: '-90 + ( 4 * @Tick )',\r\n },\r\n label: 'Outline 4',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 4 * @Tick )',\r\n endAngle: '-90 + ( 5 * @Tick )',\r\n },\r\n label: 'Outline 5',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 5 * @Tick )',\r\n endAngle: '-90 + ( 6 * @Tick )',\r\n },\r\n label: 'Outline 6',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 6 * @Tick )',\r\n endAngle: '-90 + ( 7 * @Tick )',\r\n },\r\n label: 'Outline 7',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 7 * @Tick )',\r\n endAngle: '-90 + ( 8 * @Tick )',\r\n },\r\n label: 'Outline 8',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 8 * @Tick )',\r\n endAngle: '-90 + ( 9 * @Tick )',\r\n },\r\n label: 'Outline 9',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 9 * @Tick )',\r\n endAngle: '-90 + ( 10 * @Tick )',\r\n },\r\n label: 'Outline 10',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 10 * @Tick )',\r\n endAngle: '-90 + ( 11 * @Tick )',\r\n },\r\n label: 'Outline 11',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 11 * @Tick )',\r\n endAngle: '-90 + ( 12 * @Tick )',\r\n },\r\n label: 'Outline 12',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 12 * @Tick )',\r\n endAngle: '-90 + ( 13 * @Tick )',\r\n },\r\n label: 'Outline 13',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 13 * @Tick )',\r\n endAngle: '-90 + ( 14 * @Tick )',\r\n },\r\n label: 'Outline 14',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 14 * @Tick )',\r\n endAngle: '-90 + ( 15 * @Tick )',\r\n },\r\n label: 'Outline 15',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 15 * @Tick )',\r\n endAngle: '-90 + ( 16 * @Tick )',\r\n },\r\n label: 'Outline 16',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 16 * @Tick )',\r\n endAngle: '-90 + ( 17 * @Tick )',\r\n },\r\n label: 'Outline 17',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 17 * @Tick )',\r\n endAngle: '-90 + ( 18 * @Tick )',\r\n },\r\n label: 'Outline 18',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 18 * @Tick )',\r\n endAngle: '-90 + ( 19 * @Tick )',\r\n },\r\n label: 'Outline 19',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 19 * @Tick )',\r\n endAngle: '-90 + ( 20 * @Tick )',\r\n },\r\n label: 'Outline 20',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 20 * @Tick )',\r\n endAngle: '-90 + ( 21 * @Tick )',\r\n },\r\n label: 'Outline 21',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n {\r\n shape: {\r\n type: 'torus',\r\n x: '0',\r\n y: '0',\r\n innerRadius: '@Inner',\r\n outerRadius: '@Outer',\r\n startAngle: '-90 + ( 21 * @Tick )',\r\n endAngle: '-90 + ( 22 * @Tick )',\r\n },\r\n label: 'Outline 22',\r\n line: {\r\n width: '1',\r\n color: '#000000',\r\n alpha: '1',\r\n },\r\n fill: {\r\n color: '#ff00ea',\r\n alpha: '0',\r\n interpolateColor: {\r\n color2: '#ffffff',\r\n prc: '',\r\n },\r\n },\r\n repeating: false,\r\n },\r\n ],\r\n variables: [\r\n {\r\n name: 'Tick',\r\n value: '16.3636363636363636',\r\n },\r\n {\r\n name: 'Inner',\r\n value: '66',\r\n },\r\n {\r\n name: 'Outer',\r\n value: '80',\r\n },\r\n {\r\n name: 'Scale',\r\n value: '1.8',\r\n },\r\n ],\r\n effect: '',\r\n label: 'Spell Slot Ring',\r\n },\r\n group: 'Spell Slot Ring',\r\n i: 0,\r\n },\r\n {\r\n id: '3IAo8ZUu',\r\n label: 'Spell Slot Numbers',\r\n expression: '',\r\n imgName: '',\r\n imgSrc: '',\r\n priority: 60,\r\n config: {},\r\n overlay: true,\r\n alwaysOn: true,\r\n disabled: false,\r\n overlayConfig: {\r\n id: '3IAo8ZUu',\r\n parentID: '',\r\n underlay: false,\r\n bottom: false,\r\n top: true,\r\n inheritTint: false,\r\n linkRotation: false,\r\n animation: {\r\n relative: false,\r\n rotate: false,\r\n duration: '5000',\r\n clockwise: true,\r\n },\r\n linkMirror: false,\r\n linkScale: false,\r\n linkDimensionsX: false,\r\n linkDimensionsY: false,\r\n linkOpacity: false,\r\n linkStageScale: false,\r\n loop: true,\r\n playOnce: false,\r\n img: '',\r\n repeating: false,\r\n alpha: '1',\r\n tint: '',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n width: '{{object.w}} * @Scale',\r\n height: '{{object.w}} * @Scale',\r\n scaleX: '1',\r\n scaleY: '1',\r\n angle: '1',\r\n offsetX: '0',\r\n offsetY: '0.009',\r\n anchor: {\r\n x: 0.5,\r\n y: 0.5,\r\n },\r\n filter: 'NONE',\r\n alwaysVisible: false,\r\n limitedToOwner: true,\r\n limitedUsers: [],\r\n limitOnHover: true,\r\n limitOnHighlight: false,\r\n limitOnControl: false,\r\n limitOnEffect: '',\r\n limitOnProperty: '',\r\n text: {\r\n text: '4455566778911112223334',\r\n repeating: false,\r\n fontFamily: 'Signika',\r\n fill: '#ffffff',\r\n interpolateColor: {\r\n color2: '',\r\n prc: '',\r\n },\r\n fontSize: '45',\r\n align: 'left',\r\n letterSpacing: '41.5',\r\n dropShadow: null,\r\n strokeThickness: '4',\r\n stroke: '#111111',\r\n wordWrap: false,\r\n wordWrapWidth: '200',\r\n breakWords: false,\r\n maxHeight: '0',\r\n curve: {\r\n angle: '360',\r\n radius: '220',\r\n invert: false,\r\n },\r\n },\r\n variables: [\r\n {\r\n name: 'Scale',\r\n value: '1.85',\r\n },\r\n ],\r\n effect: '',\r\n label: 'Spell Slot Numbers',\r\n },\r\n group: 'Spell Slot Ring',\r\n i: 1,\r\n },\r\n ],\r\n id: 'FeFzTjjE',\r\n },\r\n];\r\n","import { CORE_TEMPLATES } from '../scripts/mappingTemplates.js';\r\nimport { TVA_CONFIG, updateSettings } from '../scripts/settings.js';\r\nimport { showMappingSelectDialog, showUserTemplateCreateDialog } from './dialogs.js';\r\n\r\nexport class Templates extends FormApplication {\r\n constructor({ mappings = null, callback = null } = {}) {\r\n super({}, {});\r\n this.mappings = mappings;\r\n this.callback = callback;\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-templates',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/templates.html',\r\n resizable: false,\r\n minimizable: false,\r\n title: 'Mapping Templates',\r\n width: 500,\r\n height: 'auto',\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n\r\n if (!this.category) this.category = TVA_CONFIG.templateMappings?.length ? 'user' : 'core';\r\n if (this.category === 'user') {\r\n this.templates = TVA_CONFIG.templateMappings;\r\n } else if (this.category === 'core') {\r\n this.templates = CORE_TEMPLATES;\r\n } else {\r\n this.templates = await communityTemplates();\r\n }\r\n\r\n for (const template of this.templates) {\r\n template.hint = template.hint?.replace(/(\\r\\n|\\n|\\r)/gm, '<br>');\r\n }\r\n\r\n data.category = this.category;\r\n data.templates = this.templates;\r\n data.allowDelete = this.category === 'user';\r\n data.allowCreate = this.category === 'user';\r\n data.allowCopy = this.category === 'community' || this.category === 'core';\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n\r\n // Position tooltip\r\n const appWindow = html.closest('#token-variants-templates');\r\n html.find('.template').on('mouseover', (event) => {\r\n const template = $(event.target).closest('.template');\r\n const pos = template.position();\r\n const tooltip = template.find('.tooltiptext');\r\n const windowPos = appWindow.position();\r\n tooltip.css('top', windowPos.top + pos.top).css('left', windowPos.left + pos.left);\r\n\r\n // Lazy load image\r\n const img = template.find('img');\r\n if (!img.attr('src')) img.attr('src', img.data('src'));\r\n });\r\n\r\n if (this.callback) {\r\n html.find('.template').on('click', async (event) => {\r\n const li = $(event.target).closest('.template');\r\n const id = li.data('id');\r\n const url = li.data('url');\r\n let mappings;\r\n let templateName;\r\n if (url) {\r\n const template = await getTemplateFromFileURL(url);\r\n if (template) mappings = template.mappings;\r\n } else if (id) {\r\n const template = this.templates.find((t) => t.id === id);\r\n if (template) {\r\n templateName = template.name;\r\n mappings = template.mappings;\r\n }\r\n }\r\n\r\n if (mappings) this.callback(templateName, mappings);\r\n });\r\n }\r\n\r\n html.find('.search').on('input', () => {\r\n const filter = html.find('.search').val().trim().toLowerCase();\r\n html.find('.template-list li').each(function () {\r\n const li = $(this);\r\n const description = li.find('.description').text().trim().toLowerCase();\r\n const name = li.data('name').trim().toLowerCase();\r\n const createdBy = li.data('creator').trim().toLowerCase();\r\n if (name.includes(filter) || description.includes(filter) || createdBy.includes(filter)) li.show();\r\n else li.hide();\r\n });\r\n });\r\n\r\n html.find('[name=\"category\"]').on('change', (event) => {\r\n this.category = event.target.value;\r\n this.render(true);\r\n });\r\n\r\n html.find('.delete').on('click', async (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const id = $(event.target).closest('.template').data('id');\r\n if (id) {\r\n await updateSettings({\r\n templateMappings: TVA_CONFIG.templateMappings.filter((m) => m.id !== id),\r\n });\r\n this.render(true);\r\n }\r\n });\r\n\r\n html.find('.copy').on('click', async (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n const id = $(event.target).closest('.template').data('id');\r\n if (id) {\r\n let template;\r\n if (this.category === 'core') {\r\n template = deepClone(CORE_TEMPLATES.find((t) => t.id === id));\r\n } else {\r\n const fileURL = $(event.target).closest('.template').data('url');\r\n if (fileURL) template = await getTemplateFromFileURL(fileURL);\r\n }\r\n\r\n if (template) {\r\n TVA_CONFIG.templateMappings.push(template);\r\n await updateSettings({\r\n templateMappings: TVA_CONFIG.templateMappings,\r\n });\r\n ui.notifications.info(`Template {${template.name}} copied to User templates.`);\r\n this.render(true);\r\n }\r\n }\r\n });\r\n\r\n html.find('.create').on('click', () => {\r\n showMappingSelectDialog(this.mappings, {\r\n title1: 'Create Template',\r\n callback: (selectedMappings) => {\r\n if (selectedMappings.length) showUserTemplateCreateDialog(selectedMappings);\r\n },\r\n });\r\n });\r\n }\r\n\r\n _getHeaderButtons() {\r\n const buttons = super._getHeaderButtons();\r\n buttons.unshift({\r\n label: 'Upload Template',\r\n class: '.token-variants-submit-template',\r\n icon: 'fa-solid fa-cloud-arrow-up',\r\n onclick: () => {\r\n new TemplateSubmissionForm().render(true);\r\n },\r\n });\r\n return buttons;\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {}\r\n}\r\n\r\nclass TemplateSubmissionForm extends FormApplication {\r\n constructor() {\r\n super({}, {});\r\n }\r\n\r\n static apiKey = 'AIzaSyCJpwIkpjrG10jaHwcpllvSChxRPawcMXE';\r\n\r\n static get pk() {\r\n const k2 = 'AIzaSyCJpw';\r\n const k1 = 'IkpjrG10jaHwcpllv';\r\n const k3 = 'SChxRPawcMXE';\r\n return k2 + k1 + k3;\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-template-submission',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/templateSubmission.html',\r\n resizable: true,\r\n minimizable: false,\r\n closeOnSubmit: false,\r\n title: 'Upload Template',\r\n width: 500,\r\n height: 'auto',\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n\r\n data.systemID = game.system.id;\r\n data.systemTitle = game.system.title;\r\n data.templates = TVA_CONFIG.templateMappings;\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n if (!formData.template) return;\r\n let template = TVA_CONFIG.templateMappings.find((t) => t.id === formData.template);\r\n if (!template) return;\r\n\r\n const name = formData.name.trim() || template.name;\r\n const hint = formData.hint.trim() || template.hint?.trim();\r\n const createdBy = formData.createdBy.trim();\r\n const system = formData.system;\r\n const id = randomID();\r\n const img = formData.img.trim();\r\n\r\n const result = submitTemplate({ id, name, hint, img, createdBy, system, mappings: template.mappings });\r\n if (result) this.close();\r\n }\r\n}\r\n\r\nfunction _setStringField(template, fields, field) {\r\n if (template[field] && template[field] !== '') {\r\n fields[field] = { stringValue: template[field] };\r\n }\r\n}\r\n\r\nasync function submitTemplate(template) {\r\n const fields = {};\r\n ['name', 'hint', 'img', 'id', 'createdBy', 'system'].forEach((field) => _setStringField(template, fields, field));\r\n fields.mappings = { stringValue: JSON.stringify(template.mappings) };\r\n fields.createTime = { integerValue: new Date().getTime() };\r\n fields.approved = { booleanValue: false };\r\n\r\n const response = await fetch(\r\n `https://firestore.googleapis.com/v1/projects/tva---templates/databases/(default)/documents/templates?key=${TemplateSubmissionForm.pk}`,\r\n {\r\n method: 'POST',\r\n body: JSON.stringify({\r\n fields: fields,\r\n }),\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n },\r\n }\r\n );\r\n\r\n if (response.ok && response.status === 200) {\r\n ui.notifications.info('Template submission completed.');\r\n return true;\r\n } else {\r\n ui.notifications.warn('Template submission failed.');\r\n return false;\r\n }\r\n}\r\n\r\nconst SEARCH_QUERY = {\r\n structuredQuery: {\r\n select: {\r\n fields: [\r\n {\r\n fieldPath: 'id',\r\n },\r\n {\r\n fieldPath: 'name',\r\n },\r\n {\r\n fieldPath: 'hint',\r\n },\r\n {\r\n fieldPath: 'createdBy',\r\n },\r\n {\r\n fieldPath: 'img',\r\n },\r\n {\r\n fieldPath: 'system',\r\n },\r\n ],\r\n },\r\n where: {\r\n fieldFilter: {\r\n field: {\r\n fieldPath: 'approved',\r\n },\r\n op: 'EQUAL',\r\n value: {\r\n booleanValue: true,\r\n },\r\n },\r\n },\r\n from: [{ collectionId: 'templates' }],\r\n orderBy: [\r\n {\r\n field: {\r\n fieldPath: 'createTime',\r\n },\r\n },\r\n ],\r\n offset: 0,\r\n limit: 50,\r\n },\r\n};\r\n\r\nasync function communityTemplates(search = null) {\r\n const response = await fetch(\r\n `https://firestore.googleapis.com/v1/projects/tva---templates/databases/(default)/documents:runQuery?key=${TemplateSubmissionForm.pk}`,\r\n {\r\n method: 'POST',\r\n body: JSON.stringify(SEARCH_QUERY),\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n },\r\n }\r\n );\r\n\r\n const templates = [];\r\n if (response.ok && response.status === 200) {\r\n const documents = await response.json();\r\n\r\n for (let doc of documents) {\r\n if ('document' in doc) templates.push(_docToTemplate(doc.document));\r\n }\r\n } else {\r\n ui.notifications.warn('Failed to retrieve Community templates.');\r\n }\r\n return templates;\r\n}\r\n\r\nfunction _docToTemplate(doc) {\r\n const template = {};\r\n ['id', 'name', 'mappings', 'createdBy', 'img', 'hint', 'system'].forEach((f) => {\r\n template[f] = doc.fields[f]?.stringValue || '';\r\n });\r\n if (template.mappings) template.mappings = JSON.parse(template.mappings);\r\n else template.fileURL = doc.name;\r\n\r\n if (!template.createdBy) template.createdBy = 'Anonymous';\r\n return template;\r\n}\r\n\r\nasync function getTemplateFromFileURL(fileURL) {\r\n const response = await fetch(`https://firestore.googleapis.com/v1/${fileURL}?key=${TemplateSubmissionForm.pk}`, {\r\n method: 'GET',\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n },\r\n });\r\n\r\n if (response.ok && response.status === 200) {\r\n const doc = await response.json();\r\n return _docToTemplate(doc);\r\n }\r\n return null;\r\n}\r\n","export default class RandomizerConfig extends FormApplication {\r\n constructor(obj) {\r\n super({}, {});\r\n this.actor = game.actors.get(obj.actorId);\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-token-flags',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/randomizerConfig.html',\r\n resizable: true,\r\n minimizable: false,\r\n title: 'Randomizer',\r\n width: 500,\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n const settings = this.actor.getFlag('token-variants', 'randomizerSettings') || {};\r\n data.randomizer = settings;\r\n data.hasSettings = !isEmpty(settings);\r\n data.nameForgeActive = game.modules.get('nameforge')?.active;\r\n if (data.randomizer.nameForge?.models && Array.isArray(data.randomizer.nameForge.models)) {\r\n data.randomizer.nameForge.models = data.randomizer.nameForge.models.join(',');\r\n }\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n html.find('.selectNameForgeModels').click(this._selectNameForgeModels.bind(this));\r\n\r\n // Can't have both tokenName and actorName checkboxes checked at the same time\r\n const tokenName = html.find('input[name=\"randomizer.tokenName\"]');\r\n const actorName = html.find('input[name=\"randomizer.actorName\"]');\r\n tokenName.change(() => {\r\n if (tokenName.is(':checked')) actorName.prop('checked', false);\r\n });\r\n actorName.change(() => {\r\n if (actorName.is(':checked')) tokenName.prop('checked', false);\r\n });\r\n }\r\n\r\n _selectNameForgeModels(event) {\r\n const inputSelected = $(event.target).siblings('input');\r\n const selected = inputSelected.val().split(',');\r\n const genCheckbox = function (name, value) {\r\n return `\r\n <div class=\"form-group\">\r\n <label>${name}</label>\r\n <div class=\"form-fields\">\r\n <input type=\"checkbox\" name=\"model\" value=\"${value}\" data-dtype=\"Boolean\" ${\r\n selected?.find((v) => v === value) ? 'checked' : ''\r\n }>\r\n </div>\r\n </div>\r\n `;\r\n };\r\n\r\n let content = '<form style=\"overflow-y: scroll; height:400px;\">';\r\n\r\n const models = game.modules.get('nameforge').models;\r\n for (const [k, v] of Object.entries(models.defaultModels)) {\r\n content += genCheckbox(v.name, 'defaultModels.' + k);\r\n }\r\n for (const [k, v] of Object.entries(models.userModels)) {\r\n content += genCheckbox(v.name, 'userModels.' + k);\r\n }\r\n content += `</form>`;\r\n\r\n new Dialog({\r\n title: `Name Forge Models`,\r\n content: content,\r\n buttons: {\r\n Ok: {\r\n label: `Select`,\r\n callback: async (html) => {\r\n const selectedModels = [];\r\n html.find('input[type=\"checkbox\"]').each(function () {\r\n if (this.checked) selectedModels.push(this.value);\r\n });\r\n inputSelected.val(selectedModels.join(','));\r\n },\r\n },\r\n },\r\n }).render(true);\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n if (event.submitter.value === 'remove') {\r\n await this.actor.unsetFlag('token-variants', 'randomizerSettings');\r\n } else {\r\n const expanded = expandObject(formData);\r\n if (expanded.randomizer.nameForge?.models) {\r\n expanded.randomizer.nameForge.models = expanded.randomizer.nameForge.models.split(',');\r\n }\r\n this.actor.setFlag('token-variants', 'randomizerSettings', expanded.randomizer);\r\n }\r\n }\r\n}\r\n","import { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\n\r\nconst feature_id = 'UserMappings';\r\n\r\nexport function registerUserMappingHooks() {\r\n if (!FEATURE_CONTROL[feature_id]) {\r\n ['updateToken', 'updateTile', 'sightRefresh'].forEach((id) => unregisterHook(feature_id, id));\r\n return;\r\n }\r\n\r\n registerHook(feature_id, 'updateToken', _updateToken);\r\n registerHook(feature_id, 'updateTile', _updateTile);\r\n registerHook(feature_id, 'sightRefresh', _sightRefresh);\r\n}\r\n\r\nasync function _updateToken(token, change) {\r\n // Update User Specific Image\r\n if (change.flags?.['token-variants']) {\r\n if ('userMappings' in change.flags['token-variants'] || '-=userMappings' in change.flags['token-variants']) {\r\n const t = canvas.tokens.get(token.id);\r\n if (t) {\r\n await t.draw();\r\n canvas.effects.visibility.restrictVisibility();\r\n }\r\n }\r\n }\r\n}\r\n\r\nasync function _updateTile(tile, change) {\r\n // Update User Specific Image\r\n if (change.flags?.['token-variants']) {\r\n if ('userMappings' in change.flags['token-variants'] || '-=userMappings' in change.flags['token-variants']) {\r\n const t = canvas.tiles.get(tile.id);\r\n if (t) {\r\n await t.draw();\r\n canvas.effects.visibility.restrictVisibility();\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction _sightRefresh() {\r\n if (!game.user.isGM) {\r\n for (let t of canvas.tokens.placeables) {\r\n if (_isInvisible(t)) t.visible = false;\r\n }\r\n for (let t of canvas.tiles.placeables) {\r\n if (_isInvisible(t)) t.visible = false;\r\n }\r\n }\r\n}\r\n\r\nfunction _isInvisible(obj) {\r\n const img = (obj.document.getFlag('token-variants', 'userMappings') || {})?.[game.userId];\r\n return img === TVA_CONFIG.invisibleImage;\r\n}\r\n","import { insertArtSelectButton } from '../../applications/artSelect.js';\r\nimport { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { SEARCH_TYPE, updateTokenImage } from '../utils.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\n\r\nconst feature_id = 'Wildcards';\r\n\r\nexport function registerWildcardHooks() {\r\n if (!FEATURE_CONTROL[feature_id]) {\r\n ['renderTokenConfig', 'preCreateToken'].forEach((name) => unregisterHook(feature_id, name));\r\n return;\r\n }\r\n\r\n // Insert default random image field\r\n registerHook(feature_id, 'renderTokenConfig', _renderTokenConfig);\r\n\r\n // Set Default Wildcard images if needed\r\n registerHook(feature_id, 'preCreateToken', _preCreateToken);\r\n}\r\n\r\nasync function _renderTokenConfig(config, html) {\r\n const checkboxRandomize = html.find('input[name=\"randomImg\"]');\r\n if (checkboxRandomize.length && !html.find('.token-variants-proto').length) {\r\n const defaultImg =\r\n config.actor?.prototypeToken?.flags['token-variants']?.['randomImgDefault'] ||\r\n config.actor?.prototypeToken?.flags['token-hud-wildcard']?.['default'] ||\r\n '';\r\n\r\n const field = await renderTemplate('/modules/token-variants/templates/protoTokenElement.html', {\r\n defaultImg,\r\n disableHUDButton: config.object?.getFlag('token-variants', 'disableHUDButton'),\r\n });\r\n checkboxRandomize.closest('.form-group').after(field);\r\n\r\n const tvaFieldset = html.find('.token-variants-proto');\r\n\r\n tvaFieldset.find('button').click((event) => {\r\n event.preventDefault();\r\n const input = tvaFieldset.find('input');\r\n new FilePicker({ current: input.val(), field: input[0] }).browse(defaultImg);\r\n });\r\n\r\n insertArtSelectButton(tvaFieldset, 'flags.token-variants.randomImgDefault', {\r\n search: config.object.name,\r\n searchType: SEARCH_TYPE.TOKEN,\r\n });\r\n\r\n // Hide/Show Default Img Form Group\r\n const rdmImgFormGroup = tvaFieldset.find('.imagevideo').closest('.form-group');\r\n const showHideGroup = function (checked) {\r\n if (checked) {\r\n rdmImgFormGroup.show();\r\n } else {\r\n rdmImgFormGroup.hide();\r\n }\r\n config.setPosition();\r\n };\r\n checkboxRandomize.on('click', (event) => showHideGroup(event.target.checked));\r\n showHideGroup(checkboxRandomize.is(':checked'));\r\n }\r\n}\r\n\r\nfunction _preCreateToken(tokenDocument, data, options, userId) {\r\n if (game.user.id !== userId) return;\r\n const update = {};\r\n if (tokenDocument.actor?.prototypeToken?.randomImg) {\r\n const defaultImg =\r\n tokenDocument.actor?.prototypeToken?.flags['token-variants']?.['randomImgDefault'] ||\r\n tokenDocument.actor?.prototypeToken?.flags['token-hud-wildcard']?.['default'] ||\r\n '';\r\n if (defaultImg) update['texture.src'] = defaultImg;\r\n }\r\n\r\n if (TVA_CONFIG.imgNameContainsDimensions || TVA_CONFIG.imgNameContainsFADimensions) {\r\n updateTokenImage(update['texture.src'] ?? tokenDocument.texture.src, {\r\n token: tokenDocument,\r\n update,\r\n });\r\n }\r\n\r\n if (!isEmpty(update)) tokenDocument.updateSource(update);\r\n}\r\n","import { showArtSelect } from '../../token-variants.mjs';\r\nimport { doRandomSearch, doSyncSearch } from '../search.js';\r\nimport { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { keyPressed, nameForgeRandomize, SEARCH_TYPE, updateActorImage, updateTokenImage } from '../utils.js';\r\nimport { registerHook, unregisterHook } from './hooks.js';\r\n\r\nconst feature_id = 'PopUpAndRandomize';\r\n\r\nexport function registerPopRandomizeHooks() {\r\n if (FEATURE_CONTROL[feature_id]) {\r\n registerHook(feature_id, 'createActor', _createActor);\r\n registerHook(feature_id, 'createToken', _createToken);\r\n } else {\r\n ['createActor', 'createToken'].forEach((name) => unregisterHook(feature_id, name));\r\n }\r\n}\r\n\r\nasync function _createToken(token, options, userId) {\r\n if (userId && game.user.id != userId) return;\r\n\r\n // Check if random search is enabled and if so perform it\r\n const actorRandSettings = game.actors.get(token.actorId)?.getFlag('token-variants', 'randomizerSettings');\r\n const randSettings = mergeObject(TVA_CONFIG.randomizer, actorRandSettings ?? {}, {\r\n inplace: false,\r\n recursive: false,\r\n });\r\n\r\n let vDown = keyPressed('v');\r\n const flagTarget = token.actor ? game.actors.get(token.actor.id) : token.document ?? token;\r\n const popupFlag = flagTarget.getFlag('token-variants', 'popups');\r\n\r\n if ((vDown && randSettings.tokenCopyPaste) || (!vDown && randSettings.tokenCreate)) {\r\n let performRandomSearch = true;\r\n if (!actorRandSettings) {\r\n if (randSettings.representedActorDisable && token.actor) performRandomSearch = false;\r\n if (randSettings.linkedActorDisable && token.actorLink) performRandomSearch = false;\r\n if (_disableRandomSearchForType(randSettings, token.actor)) performRandomSearch = false;\r\n } else {\r\n performRandomSearch = Boolean(actorRandSettings);\r\n }\r\n\r\n if (performRandomSearch) {\r\n // Randomize Token Name if need be\r\n const randomName = await nameForgeRandomize(randSettings);\r\n if (randomName) {\r\n token.update({ name: randomName });\r\n }\r\n\r\n const img = await doRandomSearch(token.name, {\r\n searchType: SEARCH_TYPE.TOKEN,\r\n actor: token.actor,\r\n randomizerOptions: randSettings,\r\n });\r\n if (img) {\r\n await updateTokenImage(img[0], {\r\n token: token,\r\n actor: token.actor,\r\n imgName: img[1],\r\n });\r\n }\r\n\r\n if (!img) return;\r\n\r\n if (randSettings.diffImages) {\r\n let imgPortrait;\r\n if (randSettings.syncImages) {\r\n imgPortrait = await doSyncSearch(token.name, img[1], {\r\n actor: token.actor,\r\n searchType: SEARCH_TYPE.PORTRAIT,\r\n randomizerOptions: randSettings,\r\n });\r\n } else {\r\n imgPortrait = await doRandomSearch(token.name, {\r\n searchType: SEARCH_TYPE.PORTRAIT,\r\n actor: token.actor,\r\n randomizerOptions: randSettings,\r\n });\r\n }\r\n\r\n if (imgPortrait) {\r\n await updateActorImage(token.actor, imgPortrait[0]);\r\n }\r\n } else if (randSettings.tokenToPortrait) {\r\n await updateActorImage(token.actor, img[0]);\r\n }\r\n return;\r\n }\r\n if (popupFlag == null && !randSettings.popupOnDisable) {\r\n return;\r\n }\r\n } else if (randSettings.tokenCreate || randSettings.tokenCopyPaste) {\r\n return;\r\n }\r\n\r\n // Check if pop-up is enabled and if so open it\r\n if (!TVA_CONFIG.permissions.popups[game.user.role]) {\r\n return;\r\n }\r\n\r\n let dirKeyDown = keyPressed('popupOverride');\r\n\r\n if (vDown && TVA_CONFIG.popup.disableAutoPopupOnTokenCopyPaste) {\r\n return;\r\n }\r\n\r\n if (!dirKeyDown || (dirKeyDown && vDown)) {\r\n if (TVA_CONFIG.popup.disableAutoPopupOnTokenCreate && !vDown) {\r\n return;\r\n } else if (popupFlag == null && _disablePopupForType(token.actor)) {\r\n return;\r\n } else if (popupFlag != null && !popupFlag) {\r\n return;\r\n }\r\n }\r\n\r\n showArtSelect(token.name, {\r\n callback: async function (imgSrc, imgName) {\r\n if (TVA_CONFIG.popup.twoPopups) {\r\n await updateActorImage(token.actor, imgSrc);\r\n _twoPopupPrompt(token.actor, imgSrc, imgName, token);\r\n } else {\r\n updateTokenImage(imgSrc, {\r\n actor: token.actor,\r\n imgName: imgName,\r\n token: token,\r\n });\r\n }\r\n },\r\n searchType: TVA_CONFIG.popup.twoPopups ? SEARCH_TYPE.PORTRAIT : SEARCH_TYPE.TOKEN,\r\n object: token,\r\n preventClose: TVA_CONFIG.popup.twoPopups && TVA_CONFIG.popup.twoPopupsNoDialog,\r\n });\r\n}\r\n\r\nasync function _createActor(actor, options, userId) {\r\n if (userId && game.user.id != userId) return;\r\n\r\n // Check if random search is enabled and if so perform it\r\n const randSettings = TVA_CONFIG.randomizer;\r\n if (randSettings.actorCreate) {\r\n let performRandomSearch = true;\r\n if (randSettings.linkedActorDisable && actor.prototypeToken.actorLink) performRandomSearch = false;\r\n if (_disableRandomSearchForType(randSettings, actor)) performRandomSearch = false;\r\n\r\n if (performRandomSearch) {\r\n const img = await doRandomSearch(actor.name, {\r\n searchType: SEARCH_TYPE.PORTRAIT,\r\n actor: actor,\r\n });\r\n if (img) {\r\n await updateActorImage(actor, img[0]);\r\n }\r\n\r\n if (!img) return;\r\n\r\n if (randSettings.diffImages) {\r\n let imgToken;\r\n if (randSettings.syncImages) {\r\n imgToken = await doSyncSearch(actor.name, img[1], { actor: actor });\r\n } else {\r\n imgToken = await doRandomSearch(actor.name, {\r\n searchType: SEARCH_TYPE.TOKEN,\r\n actor: actor,\r\n });\r\n }\r\n\r\n if (imgToken) {\r\n await updateTokenImage(imgToken[0], { actor: actor, imgName: imgToken[1] });\r\n }\r\n }\r\n return;\r\n }\r\n if (!randSettings.popupOnDisable) {\r\n return;\r\n }\r\n }\r\n\r\n // Check if pop-up is enabled and if so open it\r\n if (!TVA_CONFIG.permissions.popups[game.user.role]) {\r\n return;\r\n }\r\n\r\n if (TVA_CONFIG.popup.disableAutoPopupOnActorCreate && !keyPressed('popupOverride')) {\r\n return;\r\n } else if (_disablePopupForType(actor)) {\r\n return;\r\n }\r\n\r\n showArtSelect(actor.name, {\r\n callback: async function (imgSrc, name) {\r\n const actTokens = actor.getActiveTokens();\r\n const token = actTokens.length === 1 ? actTokens[0] : null;\r\n await updateActorImage(actor, imgSrc);\r\n if (TVA_CONFIG.popup.twoPopups) _twoPopupPrompt(actor, imgSrc, name, token);\r\n else {\r\n updateTokenImage(imgSrc, {\r\n actor: actor,\r\n imgName: name,\r\n token: token,\r\n });\r\n }\r\n },\r\n searchType: TVA_CONFIG.popup.twoPopups ? SEARCH_TYPE.PORTRAIT : SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n object: actor,\r\n preventClose: TVA_CONFIG.popup.twoPopups && TVA_CONFIG.popup.twoPopupsNoDialog,\r\n });\r\n}\r\n\r\nfunction _disableRandomSearchForType(randSettings, actor) {\r\n if (!actor) return false;\r\n return randSettings[`${actor.type}Disable`] ?? false;\r\n}\r\n\r\nfunction _disablePopupForType(actor) {\r\n if (!actor) return false;\r\n return TVA_CONFIG.popup[`${actor.type}Disable`] ?? false;\r\n}\r\n\r\nfunction _twoPopupPrompt(actor, imgSrc, imgName, token) {\r\n if (TVA_CONFIG.popup.twoPopups && TVA_CONFIG.popup.twoPopupsNoDialog) {\r\n showArtSelect((token ?? actor.prototypeToken).name, {\r\n callback: (imgSrc, name) =>\r\n updateTokenImage(imgSrc, {\r\n actor: actor,\r\n imgName: name,\r\n token: token,\r\n }),\r\n searchType: SEARCH_TYPE.TOKEN,\r\n object: token ? token : actor,\r\n force: true,\r\n });\r\n } else if (TVA_CONFIG.popup.twoPopups) {\r\n let d = new Dialog({\r\n title: 'Portrait -> Token',\r\n content: `<p>${game.i18n.localize('token-variants.windows.art-select.apply-same-art')}</p>`,\r\n buttons: {\r\n one: {\r\n icon: '<i class=\"fas fa-check\"></i>',\r\n callback: () => {\r\n updateTokenImage(imgSrc, {\r\n actor: actor,\r\n imgName: imgName,\r\n token: token,\r\n });\r\n const artSelects = Object.values(ui.windows).filter((app) => app instanceof ArtSelect);\r\n for (const app of artSelects) {\r\n app.close();\r\n }\r\n },\r\n },\r\n two: {\r\n icon: '<i class=\"fas fa-times\"></i>',\r\n callback: () => {\r\n showArtSelect((token ?? actor.prototypeToken).name, {\r\n callback: (imgSrc, name) =>\r\n updateTokenImage(imgSrc, {\r\n actor: actor,\r\n imgName: name,\r\n token: token,\r\n }),\r\n searchType: SEARCH_TYPE.TOKEN,\r\n object: token ? token : actor,\r\n force: true,\r\n });\r\n },\r\n },\r\n },\r\n default: 'one',\r\n });\r\n d.render(true);\r\n }\r\n}\r\n","import { registerEffectIconWrappers } from './effectIconWrappers.js';\r\nimport { registerHideElementWrappers } from './hideElementWrappers.js';\r\nimport { registerHUDWrappers } from './hudWrappers.js';\r\nimport { registerUserMappingWrappers } from './userMappingWrappers.js';\r\n\r\nexport const REGISTERED_WRAPPERS = {};\r\n\r\nexport function registerWrapper(feature_id, name, fn, method = 'WRAPPER') {\r\n if (typeof libWrapper !== 'function') return;\r\n if (!(feature_id in REGISTERED_WRAPPERS)) REGISTERED_WRAPPERS[feature_id] = {};\r\n if (name in REGISTERED_WRAPPERS[feature_id]) return;\r\n\r\n REGISTERED_WRAPPERS[feature_id][name] = libWrapper.register('token-variants', name, fn, method);\r\n}\r\n\r\nexport function unregisterWrapper(feature_id, name) {\r\n if (typeof libWrapper !== 'function') return;\r\n if (feature_id in REGISTERED_WRAPPERS && name in REGISTERED_WRAPPERS[feature_id]) {\r\n libWrapper.unregister('token-variants', REGISTERED_WRAPPERS[feature_id][name]);\r\n delete REGISTERED_WRAPPERS[feature_id][name];\r\n }\r\n}\r\n\r\nexport function registerAllWrappers() {\r\n // User to Image mappings for Tile and Tokens\r\n registerUserMappingWrappers();\r\n // Hide effect icons\r\n registerEffectIconWrappers();\r\n // Token HUD Variants Management\r\n registerHUDWrappers();\r\n // Hide Core Token Elements\r\n registerHideElementWrappers();\r\n}\r\n","import { getAllEffectMappings } from '../hooks/effectMappingHooks.js';\r\nimport { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { registerWrapper, unregisterWrapper } from './wrappers.js';\r\n\r\nconst feature_id = 'EffectIcons';\r\n\r\nexport function registerEffectIconWrappers() {\r\n unregisterWrapper(feature_id, 'Token.prototype.drawEffects');\r\n unregisterWrapper(feature_id, 'CombatTracker.prototype.getData');\r\n if (!FEATURE_CONTROL[feature_id]) return;\r\n\r\n if (\r\n !TVA_CONFIG.disableEffectIcons &&\r\n TVA_CONFIG.filterEffectIcons &&\r\n !['pf1e', 'pf2e'].includes(game.system.id)\r\n ) {\r\n registerWrapper(feature_id, 'Token.prototype.drawEffects', _drawEffects, 'OVERRIDE');\r\n } else if (TVA_CONFIG.disableEffectIcons) {\r\n registerWrapper(\r\n feature_id,\r\n 'Token.prototype.drawEffects',\r\n _drawEffects_fullReplace,\r\n 'OVERRIDE'\r\n );\r\n } else if (TVA_CONFIG.displayEffectIconsOnHover) {\r\n registerWrapper(feature_id, 'Token.prototype.drawEffects', _drawEffects_hoverOnly, 'WRAPPER');\r\n }\r\n\r\n if (TVA_CONFIG.disableEffectIcons || TVA_CONFIG.filterCustomEffectIcons) {\r\n registerWrapper(\r\n feature_id,\r\n 'CombatTracker.prototype.getData',\r\n _combatTrackerGetData,\r\n 'WRAPPER'\r\n );\r\n }\r\n}\r\n\r\nasync function _drawEffects_hoverOnly(wrapped, ...args) {\r\n let result = await wrapped(...args);\r\n this.effects.visible = this.hover;\r\n return result;\r\n}\r\n\r\nasync function _drawEffects_fullReplace(...args) {\r\n this.effects.removeChildren().forEach((c) => c.destroy());\r\n this.effects.bg = this.effects.addChild(new PIXI.Graphics());\r\n this.effects.overlay = null;\r\n}\r\n\r\nasync function _combatTrackerGetData(wrapped, ...args) {\r\n let data = await wrapped(...args);\r\n\r\n if (data && data.combat && data.turns) {\r\n const combat = data.combat;\r\n for (const turn of data.turns) {\r\n const combatant = combat.combatants.find((c) => c.id === turn.id);\r\n if (combatant) {\r\n if (TVA_CONFIG.disableEffectIcons) {\r\n turn.effects = new Set();\r\n } else if (TVA_CONFIG.filterEffectIcons) {\r\n const restrictedEffects = _getRestrictedEffects(combatant.token);\r\n\r\n // Copied from CombatTracker.getData(...)\r\n turn.effects = new Set();\r\n if (combatant.token) {\r\n combatant.token.effects.forEach((e) => turn.effects.add(e));\r\n if (combatant.token.overlayEffect) turn.effects.add(combatant.token.overlayEffect);\r\n }\r\n\r\n // modified to filter restricted effects\r\n if (combatant.actor) {\r\n for (const effect of combatant.actor.temporaryEffects) {\r\n if (effect.statuses.has(CONFIG.specialStatusEffects.DEFEATED)) {\r\n } else if (effect.icon && !restrictedEffects.includes(effect.name ?? effect.label))\r\n turn.effects.add(effect.icon);\r\n }\r\n }\r\n // end of copy\r\n }\r\n }\r\n }\r\n }\r\n return data;\r\n}\r\n\r\nasync function _drawEffects(...args) {\r\n this.effects.renderable = false;\r\n this.effects.removeChildren().forEach((c) => c.destroy());\r\n this.effects.bg = this.effects.addChild(new PIXI.Graphics());\r\n this.effects.overlay = null;\r\n\r\n // Categorize new effects\r\n let tokenEffects = this.document.effects;\r\n let actorEffects = this.actor?.temporaryEffects || [];\r\n let overlay = {\r\n src: this.document.overlayEffect,\r\n tint: null,\r\n };\r\n\r\n // Modified from the original token.drawEffects\r\n if (TVA_CONFIG.displayEffectIconsOnHover) this.effects.visible = this.hover;\r\n if (tokenEffects.length || actorEffects.length) {\r\n const restrictedEffects = _getRestrictedEffects(this.document);\r\n actorEffects = actorEffects.filter((ef) => !restrictedEffects.includes(ef.name ?? ef.label));\r\n tokenEffects = tokenEffects.filter(\r\n // check if it's a string here\r\n // for tokens without representing actors effects are just stored as paths to icons\r\n (ef) => typeof ef === 'string' || !restrictedEffects.includes(ef.name ?? ef.label)\r\n );\r\n }\r\n // End of modifications\r\n\r\n // Draw status effects\r\n if (tokenEffects.length || actorEffects.length) {\r\n const promises = [];\r\n\r\n // Draw actor effects first\r\n for (let f of actorEffects) {\r\n if (!f.icon) continue;\r\n const tint = Color.from(f.tint ?? null);\r\n if (f.getFlag('core', 'overlay')) {\r\n overlay = { src: f.icon, tint };\r\n continue;\r\n }\r\n promises.push(this._drawEffect(f.icon, tint));\r\n }\r\n\r\n // Next draw token effects\r\n for (let f of tokenEffects) promises.push(this._drawEffect(f, null));\r\n await Promise.all(promises);\r\n }\r\n\r\n // Draw overlay effect\r\n this.effects.overlay = await this._drawOverlay(overlay.src, overlay.tint);\r\n this._refreshEffects();\r\n this.effects.renderable = true;\r\n}\r\n\r\nfunction _getRestrictedEffects(tokenDoc) {\r\n let restrictedEffects = TVA_CONFIG.filterIconList;\r\n if (TVA_CONFIG.filterCustomEffectIcons) {\r\n const mappings = getAllEffectMappings(tokenDoc);\r\n if (mappings) restrictedEffects = restrictedEffects.concat(mappings.map((m) => m.expression));\r\n }\r\n return restrictedEffects;\r\n}\r\n","import { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { registerWrapper, unregisterWrapper } from './wrappers.js';\r\n\r\nconst feature_id = 'HideElement';\r\n\r\nexport function registerHideElementWrappers() {\r\n unregisterWrapper(feature_id, 'Token.prototype._getTooltipText');\r\n if (FEATURE_CONTROL[feature_id] && TVA_CONFIG.hideElevationTooltip) {\r\n registerWrapper(feature_id, 'Token.prototype._getTooltipText', _getTooltipText, 'WRAPPER');\r\n }\r\n\r\n unregisterWrapper(feature_id, 'Token.prototype._refreshBorder');\r\n if (FEATURE_CONTROL[feature_id] && TVA_CONFIG.hideTokenBorder) {\r\n registerWrapper(feature_id, 'Token.prototype._refreshBorder', _refreshVisibility, 'OVERRIDE');\r\n }\r\n}\r\n\r\nfunction _getTooltipText(wrapped, ...args) {\r\n wrapped(...args);\r\n return '';\r\n}\r\n\r\nfunction _refreshVisibility(...args) {}\r\n","import { TOKEN_HUD_VARIANTS } from '../../applications/tokenHUD.js';\r\nimport { Reticle } from '../reticle.js';\r\nimport { FEATURE_CONTROL, TVA_CONFIG } from '../settings.js';\r\nimport { registerWrapper, unregisterWrapper } from './wrappers.js';\r\n\r\nconst feature_id = 'HUD';\r\n\r\nexport function registerHUDWrappers() {\r\n unregisterWrapper(feature_id, 'TokenHUD.prototype.clear');\r\n if (FEATURE_CONTROL[feature_id]) {\r\n registerWrapper(feature_id, 'TokenHUD.prototype.clear', _clear, 'MIXED');\r\n }\r\n}\r\n\r\nfunction _clear(wrapped, ...args) {\r\n _applyVariantFlags();\r\n\r\n // HUD should not close if we're in assisted overlay positioning mode\r\n if (Reticle.active && Reticle.mode === 'hud') return;\r\n return wrapped(...args);\r\n}\r\n\r\nasync function _applyVariantFlags() {\r\n const { actor, variants } = TOKEN_HUD_VARIANTS;\r\n if (actor) {\r\n if (!variants?.length) {\r\n actor.unsetFlag('token-variants', 'variants');\r\n } else {\r\n actor.setFlag('token-variants', 'variants', variants);\r\n }\r\n }\r\n TOKEN_HUD_VARIANTS.actor = null;\r\n TOKEN_HUD_VARIANTS.variants = null;\r\n}\r\n","import EffectMappingForm from '../applications/effectMappingForm.js';\r\nimport { OverlayConfig } from '../applications/overlayConfig.js';\r\nimport { TVAOverlay } from './sprite/TVAOverlay.js';\r\nimport { evaluateOverlayExpressions } from './token/overlay.js';\r\n\r\nexport class Reticle {\r\n static app;\r\n static fields;\r\n static reticleOverlay;\r\n static active = false;\r\n static hitTest;\r\n static token = null;\r\n static dialog = null;\r\n\r\n // Offset calculation controls\r\n static mode = 'tooltip';\r\n static increment = 1;\r\n\r\n static _onReticleMove(event) {\r\n if (this.reticleOverlay.isMouseDown) {\r\n let pos = event.data.getLocalPosition(this.reticleOverlay);\r\n\r\n this.config.pOffsetX = 0;\r\n this.config.pOffsetY = 0;\r\n this.config.offsetX = 0;\r\n this.config.offsetY = 0;\r\n\r\n if (this.mode === 'token') {\r\n this.config.linkRotation = true;\r\n this.config.linkMirror = true;\r\n }\r\n\r\n this.tvaOverlay.refresh(this.config, { preview: true });\r\n\r\n const tCoord = { x: this.tvaOverlay.x, y: this.tvaOverlay.y };\r\n\r\n if (this.tvaOverlay.overlayConfig.parentID) {\r\n let parent = this.tvaOverlay;\r\n do {\r\n parent = parent.parent;\r\n tCoord.x += parent.x;\r\n tCoord.y += parent.y;\r\n } while (!(parent instanceof TVAOverlay));\r\n }\r\n\r\n let dx = pos.x - tCoord.x;\r\n let dy = pos.y - tCoord.y;\r\n\r\n let angle = 0;\r\n if (!this.config.animation.relative) {\r\n angle = this.config.angle;\r\n if (this.config.linkRotation) angle += this.tvaOverlay.object.document.rotation;\r\n }\r\n\r\n [dx, dy] = rotate(0, 0, dx, dy, angle);\r\n dx = round(dx, this.increment);\r\n dy = round(dy, this.increment);\r\n\r\n // let lPos = event.data.getLocalPosition(this.tvaOverlay);\r\n // console.log(lPos);\r\n // // let dx = lPos.x;\r\n // // let dy = lPos.y;\r\n\r\n if (this.mode === 'static') {\r\n this.config.pOffsetX = dx;\r\n this.config.pOffsetY = dy;\r\n } else if (this.mode === 'token') {\r\n this.config.offsetX = -dx / this.tvaOverlay.object.w;\r\n this.config.offsetY = -dy / this.tvaOverlay.object.h;\r\n } else {\r\n let token = this.tvaOverlay.object;\r\n\r\n let pWidth;\r\n let pHeight;\r\n\r\n if (this.tvaOverlay.overlayConfig.parentID) {\r\n pWidth =\r\n (this.tvaOverlay.parent.shapesWidth ?? this.tvaOverlay.parent.width) / this.tvaOverlay.parent.scale.x;\r\n pHeight =\r\n (this.tvaOverlay.parent.shapesHeight ?? this.tvaOverlay.parent.height) / this.tvaOverlay.parent.scale.y;\r\n } else {\r\n pWidth = token.w;\r\n pHeight = token.h;\r\n }\r\n\r\n if (this.mode === 'tooltip') {\r\n if (Math.abs(dx) >= pWidth / 2) {\r\n this.config.offsetX = 0.5 * (dx < 0 ? 1 : -1);\r\n dx += (pWidth / 2) * (dx < 0 ? 1 : -1);\r\n } else {\r\n this.config.offsetX = -dx / this.tvaOverlay.object.w;\r\n dx = 0;\r\n }\r\n\r\n if (Math.abs(dy) >= pHeight / 2) {\r\n this.config.offsetY = 0.5 * (dy < 0 ? 1 : -1);\r\n dy += (pHeight / 2) * (dy < 0 ? 1 : -1);\r\n } else {\r\n this.config.offsetY = -dy / this.tvaOverlay.object.h;\r\n dy = 0;\r\n }\r\n } else {\r\n if (Math.abs(dx) >= pWidth / 2) {\r\n this.config.offsetX = 0.5 * (dx < 0 ? 1 : -1);\r\n dx += (pWidth / 2) * (dx < 0 ? 1 : -1);\r\n } else if (Math.abs(dy) >= pHeight / 2) {\r\n this.config.offsetY = 0.5 * (dy < 0 ? 1 : -1);\r\n dy += (pHeight / 2) * (dy < 0 ? 1 : -1);\r\n } else {\r\n this.config.offsetX = -dx / this.tvaOverlay.object.w;\r\n dx = 0;\r\n this.config.offsetY = -dy / this.tvaOverlay.object.h;\r\n dy = 0;\r\n }\r\n }\r\n\r\n this.config.pOffsetX = dx;\r\n this.config.pOffsetY = dy;\r\n }\r\n\r\n this.tvaOverlay.refresh(this.config, { preview: true });\r\n }\r\n }\r\n\r\n static minimizeApps() {\r\n Object.values(ui.windows).forEach((app) => {\r\n if (app instanceof OverlayConfig || app instanceof EffectMappingForm) {\r\n app.minimize();\r\n }\r\n });\r\n }\r\n\r\n static maximizeApps() {\r\n Object.values(ui.windows).forEach((app) => {\r\n if (app instanceof OverlayConfig || app instanceof EffectMappingForm) {\r\n app.maximize();\r\n }\r\n });\r\n }\r\n\r\n static activate({ tvaOverlay = null, config = {} } = {}) {\r\n if (this.deactivate() || !canvas.ready) return false;\r\n if (!tvaOverlay || !config) return false;\r\n\r\n if (this.reticleOverlay) {\r\n this.reticleOverlay.destroy(true);\r\n }\r\n\r\n const interaction = canvas.app.renderer.plugins.interaction;\r\n if (!interaction.cursorStyles['reticle']) {\r\n interaction.cursorStyles['reticle'] = \"url('modules/token-variants/img/reticle.webp'), auto\";\r\n }\r\n\r\n this.tvaOverlay = tvaOverlay;\r\n\r\n this.minimizeApps();\r\n this.config = evaluateOverlayExpressions(deepClone(config), this.tvaOverlay.object, {\r\n overlayConfig: config,\r\n });\r\n\r\n // Setup the overlay to be always visible while we're adjusting its position\r\n this.config.alwaysVisible = true;\r\n\r\n this.active = true;\r\n\r\n // Create the reticle overlay\r\n this.reticleOverlay = new PIXI.Container();\r\n this.reticleOverlay.hitArea = canvas.dimensions.rect;\r\n this.reticleOverlay.cursor = 'reticle';\r\n this.reticleOverlay.interactive = true;\r\n this.reticleOverlay.zIndex = Infinity;\r\n\r\n const stopEvent = function (event) {\r\n event.preventDefault();\r\n // event.stopPropagation();\r\n };\r\n\r\n this.reticleOverlay.on('mousedown', (event) => {\r\n event.preventDefault();\r\n\r\n if (event.data.originalEvent.which != 2 && event.data.originalEvent.nativeEvent.which != 2) {\r\n this.reticleOverlay.isMouseDown = true;\r\n this._onReticleMove(event);\r\n }\r\n });\r\n this.reticleOverlay.on('pointermove', (event) => {\r\n event.preventDefault();\r\n // event.stopPropagation();\r\n this._onReticleMove(event);\r\n });\r\n this.reticleOverlay.on('mouseup', (event) => {\r\n event.preventDefault();\r\n this.reticleOverlay.isMouseDown = false;\r\n });\r\n this.reticleOverlay.on('click', (event) => {\r\n event.preventDefault();\r\n if (event.data.originalEvent.which == 2 || event.data.originalEvent.nativeEvent.which == 2) {\r\n this.deactivate();\r\n }\r\n });\r\n\r\n canvas.stage.addChild(this.reticleOverlay);\r\n this.dialog = displayControlDialog();\r\n return true;\r\n }\r\n\r\n static deactivate() {\r\n if (this.active) {\r\n if (this.reticleOverlay) this.reticleOverlay.parent?.removeChild(this.reticleOverlay);\r\n this.active = false;\r\n this.tvaOverlay = null;\r\n if (this.dialog && this.dialog._state !== Application.RENDER_STATES.CLOSED) this.dialog.close(true);\r\n this.dialog = null;\r\n this.maximizeApps();\r\n\r\n const app = Object.values(ui.windows).find((app) => app instanceof OverlayConfig);\r\n if (!app) {\r\n this.config = null;\r\n return;\r\n }\r\n const form = $(app.form);\r\n\r\n ['pOffsetX', 'pOffsetY', 'offsetX', 'offsetY'].forEach((field) => {\r\n if (field in this.config) {\r\n form.find(`[name=\"${field}\"]`).val(this.config[field]);\r\n }\r\n });\r\n\r\n if (this.mode === 'token') {\r\n ['linkRotation', 'linkMirror'].forEach((field) => {\r\n form.find(`[name=\"${field}\"]`).prop('checked', true);\r\n });\r\n ['linkDimensionsX', 'linkDimensionsY'].forEach((field) => {\r\n form.find(`[name=\"${field}\"]`).prop('checked', false);\r\n });\r\n } else {\r\n ['linkRotation', 'linkMirror'].forEach((field) => {\r\n form.find(`[name=\"${field}\"]`).prop('checked', false);\r\n });\r\n }\r\n\r\n if (this.mode === 'hud') {\r\n form.find('[name=\"ui\"]').prop('checked', true).trigger('change');\r\n }\r\n\r\n form.find('[name=\"anchor.x\"]').val(this.config.anchor.x);\r\n form.find('[name=\"anchor.y\"]').val(this.config.anchor.y).trigger('change');\r\n this.config = null;\r\n\r\n return true;\r\n }\r\n }\r\n}\r\n\r\nfunction displayControlDialog() {\r\n const d = new Dialog({\r\n title: 'Set Overlay Position',\r\n content: `\r\n <style>\r\n .images { display: flex; }\r\n .images a { flex: 20%; width: 50px; margin: 2px; }\r\n .images a.active img { border-color: orange; border-width: 2px; }\r\n .anchorlbl {margin: auto; display: table; }\r\n </style>\r\n <div class=\"images\">\r\n <a data-id=\"token\"><img src=\"modules/token-variants/img/token_mode.png\"></img></a>\r\n <a data-id=\"tooltip\"><img src=\"modules/token-variants/img/tooltip_mode.png\"></img></a>\r\n <a data-id=\"hud\"><img src=\"modules/token-variants/img/hud_mode.png\"></img></a>\r\n <a data-id=\"static\"><img src=\"modules/token-variants/img/static_mode.png\"></img></a>\r\n </div>\r\n <br>\r\n <label class=\"anchorlbl\">Anchor</label>\r\n <div class=\"tva-anchor\">\r\n <input type=\"radio\" class=\"top left\" name=\"anchor\">\r\n <input type=\"radio\" class=\"top center\" name=\"anchor\">\r\n <input type=\"radio\" class=\"top right\" name=\"anchor\">\r\n <input type=\"radio\" class=\"mid left\" name=\"anchor\">\r\n <input type=\"radio\" class=\"mid center\" name=\"anchor\">\r\n <input type=\"radio\" class=\"mid right\" name=\"anchor\">\r\n <input type=\"radio\" class=\"bot left\" name=\"anchor\">\r\n <input type=\"radio\" class=\"bot center\" name=\"anchor\">\r\n <input type=\"radio\" class=\"bot right\" name=\"anchor\">\r\n </div>\r\n <div class=\"form-group\">\r\n <label>Step Size</label>\r\n <div class=\"form-fields\">\r\n <input type=\"number\" name=\"step\" min=\"0\" step=\"1\" value=\"${Reticle.increment}\">\r\n </div>\r\n </div>\r\n <p class=\"notes\"><b>Left-Click</b> to move the overlay</p>\r\n <p class=\"notes\"><b>Middle-Click</b> or <b>Close Dialog</b> to exit overlay positioning</p>\r\n `,\r\n buttons: {},\r\n render: (html) => {\r\n // Mode Images\r\n const images = html.find('.images a');\r\n html.find('.images a').on('click', (event) => {\r\n images.removeClass('active');\r\n const target = $(event.target).closest('a');\r\n target.addClass('active');\r\n Reticle.mode = target.data('id');\r\n });\r\n html.find(`[data-id=\"${Reticle.mode}\"]`).addClass('active');\r\n\r\n // Anchor\r\n let anchorX = Reticle.config?.anchor?.x || 0;\r\n let anchorY = Reticle.config?.anchor?.y || 0;\r\n\r\n let classes = '';\r\n if (anchorX < 0.5) classes += '.left';\r\n else if (anchorX > 0.5) classes += '.right';\r\n else classes += '.center';\r\n\r\n if (anchorY < 0.5) classes += '.top';\r\n else if (anchorY > 0.5) classes += '.bot';\r\n else classes += '.mid';\r\n\r\n html.find('.tva-anchor').find(classes).prop('checked', true);\r\n // end - Pre-select anchor\r\n\r\n html.find('input[name=\"anchor\"]').on('change', (event) => {\r\n const anchor = $(event.target);\r\n let x;\r\n let y;\r\n if (anchor.hasClass('left')) x = 0;\r\n else if (anchor.hasClass('center')) x = 0.5;\r\n else x = 1;\r\n\r\n if (anchor.hasClass('top')) y = 0;\r\n else if (anchor.hasClass('mid')) y = 0.5;\r\n else y = 1;\r\n\r\n Reticle.config.anchor.x = x;\r\n Reticle.config.anchor.y = y;\r\n });\r\n\r\n html.find('[name=\"step\"]').on('input', (event) => {\r\n Reticle.increment = $(event.target).val() || 1;\r\n });\r\n },\r\n close: () => Reticle.deactivate(),\r\n });\r\n d.render(true);\r\n setTimeout(() => d.setPosition({ left: 200, top: window.innerHeight / 2, height: 'auto' }), 100);\r\n return d;\r\n}\r\n\r\nfunction round(number, increment, offset = 0) {\r\n return Math.ceil((number - offset) / increment) * increment + offset;\r\n}\r\n\r\nfunction rotate(cx, cy, x, y, angle) {\r\n var radians = (Math.PI / 180) * angle,\r\n cos = Math.cos(radians),\r\n sin = Math.sin(radians),\r\n nx = cos * (x - cx) + sin * (y - cy) + cx,\r\n ny = cos * (y - cy) - sin * (x - cx) + cy;\r\n return [nx, ny];\r\n}\r\n","import { TVA_CONFIG } from '../settings.js';\r\nimport { decodeURISafely } from '../utils.js';\r\nimport { registerWrapper } from './wrappers.js';\r\n\r\nconst feature_id = 'UserMappings';\r\n\r\nexport function registerUserMappingWrappers() {\r\n registerWrapper(feature_id, 'Tile.prototype.draw', _draw);\r\n registerWrapper(feature_id, 'Token.prototype.draw', _draw);\r\n}\r\n\r\nasync function _draw(wrapped, ...args) {\r\n let result;\r\n\r\n // If the Token/Tile has a UserToImage mappings momentarily set document.texture.src to it\r\n // so that it's texture gets loaded instead of the actual Token image\r\n const mappings = this.document.getFlag('token-variants', 'userMappings') || {};\r\n const img = mappings[game.userId];\r\n let previous;\r\n if (img) {\r\n previous = this.document.texture.src;\r\n this.document.texture.src = img;\r\n this.tva_iconOverride = img;\r\n result = await wrapped(...args);\r\n this.document.texture.src = previous;\r\n overrideVisibility(this, img);\r\n } else {\r\n overrideVisibility(this);\r\n result = await wrapped(...args);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * If the img is the same as TVA_CONFIG.invisibleImage then we'll override the isVisible\r\n * getter to return false of this client if it's not a GM. Reset it to default if not.\r\n * @param {*} obj object whose isVisible is to be overriden\r\n * @param {*} img UserToImage mapping\r\n */\r\nfunction overrideVisibility(obj, img) {\r\n if (img && decodeURISafely(img) === TVA_CONFIG.invisibleImage && !obj.tva_customVisibility) {\r\n const originalIsVisible = _getIsVisibleDescriptor(obj).get;\r\n Object.defineProperty(obj, 'isVisible', {\r\n get: function () {\r\n const isVisible = originalIsVisible.call(this);\r\n if (isVisible && !game.user.isGM) return false;\r\n return isVisible;\r\n },\r\n configurable: true,\r\n });\r\n obj.tva_customVisibility = true;\r\n } else if (!img && obj.tva_customVisibility) {\r\n Object.defineProperty(obj, 'isVisible', _getIsVisibleDescriptor(obj));\r\n delete obj.tva_customVisibility;\r\n }\r\n}\r\n\r\nfunction _getIsVisibleDescriptor(obj) {\r\n let iObj = Object.getPrototypeOf(obj);\r\n let descriptor = null;\r\n while (iObj) {\r\n descriptor = Object.getOwnPropertyDescriptor(iObj, 'isVisible');\r\n if (descriptor) break;\r\n iObj = Object.getPrototypeOf(iObj);\r\n }\r\n return descriptor;\r\n}\r\n\r\n/**\r\n * Assign an image to be displayed to only that user.\r\n * @param {*} token token the image is to be applied to\r\n * @param {*} img image to be displayed, if no image is provided unassignUserSpecificImage(...) will be called\r\n * @param {*} opts.userName name of the user that the image is to be displayed to\r\n * @param {*} opts.id id of the user that the image is to be displayed to\r\n * @returns\r\n */\r\nexport function assignUserSpecificImage(token, img, { userName = null, userId = null } = {}) {\r\n if (!img) return unassignUserSpecificImage(token, { userName, userId });\r\n\r\n if (userName instanceof Array) {\r\n for (const name of userName) assignUserSpecificImage(token, img, { userName: name });\r\n return;\r\n }\r\n\r\n if (userId instanceof Array) {\r\n for (const id of userId) assignUserSpecificImage(token, img, { userId: id });\r\n return;\r\n }\r\n\r\n let id = userId;\r\n if (!id && userName) {\r\n id = game.users.find((u) => u.name === userName)?.id;\r\n }\r\n if (!id) return;\r\n\r\n const doc = token.document ?? token;\r\n const mappings = doc.getFlag('token-variants', 'userMappings') || {};\r\n\r\n mappings[id] = img;\r\n doc.setFlag('token-variants', 'userMappings', mappings);\r\n}\r\n\r\n/**\r\n * Calls assignUserSpecificImage passing in all currently selected tokens.\r\n * @param {*} img image to be displayed\r\n * @param {*} opts id or name of the user as per assignUserSpecificImage(...)\r\n */\r\nexport function assignUserSpecificImageToSelected(img, opts = {}) {\r\n const selected = [...canvas.tokens.controlled];\r\n for (const t of selected) assignUserSpecificImage(t, img, opts);\r\n}\r\n\r\n/**\r\n * Un-assign image if one has been set to be displayed to a user.\r\n * @param {*} token token the image is to be removed from\r\n * @param {*} opts.userName name of the user that the image is to be removed for\r\n * @param {*} opts.id id of the user that the image is to be removed for\r\n */\r\nexport function unassignUserSpecificImage(token, { userName = null, userId = null } = {}) {\r\n if (userName instanceof Array) {\r\n for (const name of userName) unassignUserSpecificImage(token, { userName: name });\r\n return;\r\n }\r\n\r\n if (userId instanceof Array) {\r\n for (const id of userId) unassignUserSpecificImage(token, { userId: id });\r\n return;\r\n }\r\n\r\n let id = userId;\r\n if (!id && userName) {\r\n id = game.users.find((u) => u.name === userName)?.id;\r\n }\r\n if (!id) {\r\n if (!userName && !userId) (token.document ?? token).unsetFlag('token-variants', 'userMappings');\r\n } else {\r\n const update = {};\r\n update['flags.token-variants.userMappings.-=' + id] = null;\r\n (token.document ?? token).update(update);\r\n }\r\n}\r\n\r\n/**\r\n * Calls unassignUserSpecificImage passing in all currently selected tokens.\r\n * @param {*} opts id or name of the user as per unassignUserSpecificImage(...)\r\n */\r\nexport function unassignUserSpecificImageFromSelected(opts = {}) {\r\n const selected = [...canvas.tokens.controlled];\r\n for (const t of selected) unassignUserSpecificImage(t, opts);\r\n}\r\n","import { showArtSelect } from '../token-variants.mjs';\r\nimport {\r\n BASE_IMAGE_CATEGORIES,\r\n SEARCH_TYPE,\r\n updateActorImage,\r\n updateTokenImage,\r\n userRequiresImageCache,\r\n} from '../scripts/utils.js';\r\nimport { addToQueue, ArtSelect, renderFromQueue } from './artSelect.js';\r\nimport { getSearchOptions, TVA_CONFIG, updateSettings } from '../scripts/settings.js';\r\nimport ConfigureSettings from './configureSettings.js';\r\nimport MissingImageConfig from './missingImageConfig.js';\r\nimport { cacheImages, doImageSearch } from '../scripts/search.js';\r\n\r\nasync function autoApply(actor, image1, image2, formData, typeOverride) {\r\n let portraitFound = formData.ignorePortrait;\r\n let tokenFound = formData.ignoreToken;\r\n\r\n if (formData.diffImages) {\r\n let results = [];\r\n\r\n if (!formData.ignorePortrait) {\r\n results = await doImageSearch(actor.name, {\r\n searchType: typeOverride ?? SEARCH_TYPE.PORTRAIT,\r\n simpleResults: true,\r\n searchOptions: formData.searchOptions,\r\n });\r\n\r\n if ((results ?? []).length != 0) {\r\n portraitFound = true;\r\n await updateActorImage(actor, results[0], false, formData.compendium);\r\n }\r\n }\r\n\r\n if (!formData.ignoreToken) {\r\n results = await doImageSearch(actor.prototypeToken.name, {\r\n searchType: SEARCH_TYPE.TOKEN,\r\n simpleResults: true,\r\n searchOptions: formData.searchOptions,\r\n });\r\n\r\n if ((results ?? []).length != 0) {\r\n tokenFound = true;\r\n updateTokenImage(results[0], {\r\n actor: actor,\r\n pack: formData.compendium,\r\n applyDefaultConfig: false,\r\n });\r\n }\r\n }\r\n } else {\r\n let results = await doImageSearch(actor.name, {\r\n searchType: typeOverride ?? SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n simpleResults: true,\r\n searchOptions: formData.searchOptions,\r\n });\r\n\r\n if ((results ?? []).length != 0) {\r\n portraitFound = tokenFound = true;\r\n updateTokenImage(results[0], {\r\n actor: actor,\r\n actorUpdate: { img: results[0] },\r\n pack: formData.compendium,\r\n applyDefaultConfig: false,\r\n });\r\n }\r\n }\r\n\r\n if (!(tokenFound && portraitFound) && formData.autoDisplayArtSelect) {\r\n addToArtSelectQueue(actor, image1, image2, formData, typeOverride);\r\n }\r\n}\r\n\r\nfunction addToArtSelectQueue(actor, image1, image2, formData, typeOverride) {\r\n if (formData.diffImages) {\r\n if (!formData.ignorePortrait && !formData.ignoreToken) {\r\n addToQueue(actor.name, {\r\n searchType: typeOverride ?? SEARCH_TYPE.PORTRAIT,\r\n object: actor,\r\n preventClose: true,\r\n image1: image1,\r\n image2: image2,\r\n displayMode: ArtSelect.IMAGE_DISPLAY.PORTRAIT,\r\n searchOptions: formData.searchOptions,\r\n callback: async function (imgSrc, _) {\r\n await updateActorImage(actor, imgSrc);\r\n showArtSelect(actor.prototypeToken.name, {\r\n searchType: typeOverride ?? SEARCH_TYPE.TOKEN,\r\n object: actor,\r\n force: true,\r\n image1: imgSrc,\r\n image2: image2,\r\n displayMode: ArtSelect.IMAGE_DISPLAY.TOKEN,\r\n searchOptions: formData.searchOptions,\r\n callback: (imgSrc, name) =>\r\n updateTokenImage(imgSrc, {\r\n actor: actor,\r\n imgName: name,\r\n applyDefaultConfig: false,\r\n }),\r\n });\r\n },\r\n });\r\n } else if (formData.ignorePortrait) {\r\n addToQueue(actor.name, {\r\n searchType: typeOverride ?? SEARCH_TYPE.TOKEN,\r\n object: actor,\r\n image1: image1,\r\n image2: image2,\r\n displayMode: ArtSelect.IMAGE_DISPLAY.TOKEN,\r\n searchOptions: formData.searchOptions,\r\n callback: async function (imgSrc, name) {\r\n updateTokenImage(imgSrc, {\r\n actor: actor,\r\n imgName: name,\r\n applyDefaultConfig: false,\r\n });\r\n },\r\n });\r\n } else if (formData.ignoreToken) {\r\n addToQueue(actor.name, {\r\n searchType: typeOverride ?? SEARCH_TYPE.PORTRAIT,\r\n object: actor,\r\n image1: image1,\r\n image2: image2,\r\n displayMode: ArtSelect.IMAGE_DISPLAY.PORTRAIT,\r\n searchOptions: formData.searchOptions,\r\n callback: async function (imgSrc, name) {\r\n await updateActorImage(actor, imgSrc);\r\n },\r\n });\r\n }\r\n } else {\r\n addToQueue(actor.name, {\r\n searchType: typeOverride ?? SEARCH_TYPE.PORTRAIT_AND_TOKEN,\r\n object: actor,\r\n image1: image1,\r\n image2: image2,\r\n displayMode: ArtSelect.IMAGE_DISPLAY.PORTRAIT_TOKEN,\r\n searchOptions: formData.searchOptions,\r\n callback: async function (imgSrc, name) {\r\n await updateActorImage(actor, imgSrc);\r\n updateTokenImage(imgSrc, {\r\n actor: actor,\r\n imgName: name,\r\n applyDefaultConfig: false,\r\n });\r\n },\r\n });\r\n }\r\n}\r\n\r\nexport default class CompendiumMapConfig extends FormApplication {\r\n constructor() {\r\n super({}, {});\r\n this.searchOptions = deepClone(getSearchOptions());\r\n mergeObject(this.searchOptions, deepClone(TVA_CONFIG.compendiumMapper.searchOptions));\r\n this._fixSearchPaths();\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-compendium-map-config',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/compendiumMap.html',\r\n resizable: false,\r\n minimizable: false,\r\n title: game.i18n.localize('token-variants.settings.compendium-mapper.Name'),\r\n width: 500,\r\n });\r\n }\r\n\r\n async getData(options) {\r\n let data = super.getData(options);\r\n data = mergeObject(data, TVA_CONFIG.compendiumMapper);\r\n\r\n const supportedPacks = ['Actor', 'Cards', 'Item', 'Macro', 'RollTable'];\r\n data.supportedPacks = supportedPacks.join(', ');\r\n\r\n const packs = [];\r\n game.packs.forEach((pack) => {\r\n if (!pack.locked && supportedPacks.includes(pack.documentName)) {\r\n packs.push({ title: pack.title, id: pack.collection, type: pack.documentName });\r\n }\r\n });\r\n data.compendiums = packs;\r\n data.compendium = TVA_CONFIG.compendiumMapper.compendium;\r\n\r\n data.categories = BASE_IMAGE_CATEGORIES.concat(TVA_CONFIG.customImageCategories);\r\n data.category = TVA_CONFIG.compendiumMapper.category;\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n html.find('.token-variants-override-category').change(this._onCategoryOverride).trigger('change');\r\n html.find('.token-variants-auto-apply').change(this._onAutoApply);\r\n html.find('.token-variants-diff-images').change(this._onDiffImages);\r\n html.find(`.token-variants-search-options`).on('click', this._onSearchOptions.bind(this));\r\n html.find(`.token-variants-missing-images`).on('click', this._onMissingImages.bind(this));\r\n\r\n $(html).find('[name=\"compendium\"]').change(this._onCompendiumSelect.bind(this)).trigger('change');\r\n }\r\n\r\n async _onAutoApply(event) {\r\n $(event.target).closest('form').find('.token-variants-auto-art-select').prop('disabled', !event.target.checked);\r\n }\r\n\r\n async _onCategoryOverride(event) {\r\n $(event.target).closest('form').find('.token-variants-category').prop('disabled', !event.target.checked);\r\n }\r\n\r\n async _onDiffImages(event) {\r\n $(event.target).closest('form').find('.token-variants-tp-ignore').prop('disabled', !event.target.checked);\r\n }\r\n\r\n async _onCompendiumSelect(event) {\r\n const compendium = game.packs.get($(event.target).val());\r\n if (compendium) {\r\n $(event.target)\r\n .closest('form')\r\n .find('.token-specific')\r\n .css('visibility', compendium.documentName === 'Actor' ? 'visible' : 'hidden');\r\n }\r\n }\r\n\r\n _fixSearchPaths() {\r\n if (!this.searchOptions.searchPaths?.length) {\r\n this.searchOptions.searchPaths = deepClone(TVA_CONFIG.searchPaths);\r\n }\r\n }\r\n\r\n async _onSearchOptions(event) {\r\n this._fixSearchPaths();\r\n new ConfigureSettings(this.searchOptions, {\r\n searchPaths: true,\r\n searchFilters: true,\r\n searchAlgorithm: true,\r\n randomizer: false,\r\n features: false,\r\n popup: false,\r\n permissions: false,\r\n worldHud: false,\r\n misc: false,\r\n activeEffects: false,\r\n }).render(true);\r\n }\r\n\r\n async _onMissingImages(event) {\r\n new MissingImageConfig().render(true);\r\n }\r\n\r\n async startMapping(formData) {\r\n if (formData.diffImages && formData.ignoreToken && formData.ignorePortrait) {\r\n return;\r\n }\r\n\r\n const originalSearchPaths = TVA_CONFIG.searchPaths;\r\n if (formData.searchOptions.searchPaths?.length) {\r\n TVA_CONFIG.searchPaths = formData.searchOptions.searchPaths;\r\n }\r\n\r\n if (formData.cache || !userRequiresImageCache() || formData.searchOptions.searchPaths?.length) {\r\n await cacheImages();\r\n }\r\n\r\n const endMapping = function () {\r\n if (formData.searchOptions.searchPaths?.length) {\r\n TVA_CONFIG.searchPaths = originalSearchPaths;\r\n cacheImages();\r\n }\r\n };\r\n\r\n const compendium = game.packs.get(formData.compendium);\r\n let missingImageList = TVA_CONFIG.compendiumMapper.missingImages\r\n .filter((mi) => mi.document === 'all' || mi.document === compendium.documentName)\r\n .map((mi) => mi.image);\r\n const typeOverride = formData.overrideCategory ? formData.category : null;\r\n let artSelectDisplayed = false;\r\n\r\n let processItem;\r\n if (compendium.documentName === 'Actor') {\r\n processItem = async function (item) {\r\n const actor = await compendium.getDocument(item._id);\r\n if (actor.name === '#[CF_tempEntity]') return; // Compendium Folders module's control entity\r\n\r\n let hasPortrait = actor.img !== CONST.DEFAULT_TOKEN && !missingImageList.includes(actor.img);\r\n let hasToken =\r\n actor.prototypeToken.texture.src !== CONST.DEFAULT_TOKEN &&\r\n !missingImageList.includes(actor.prototypeToken.texture.src);\r\n if (formData.syncImages && hasPortrait !== hasToken) {\r\n if (hasPortrait) {\r\n await updateTokenImage(actor.img, { actor: actor, applyDefaultConfig: false });\r\n } else {\r\n await updateActorImage(actor, actor.prototypeToken.texture.src);\r\n }\r\n hasPortrait = hasToken = true;\r\n }\r\n\r\n let includeThisActor = !(formData.missingOnly && hasPortrait) && !formData.ignorePortrait;\r\n let includeThisToken = !(formData.missingOnly && hasToken) && !formData.ignoreToken;\r\n\r\n const image1 = formData.showImages ? actor.img : '';\r\n const image2 = formData.showImages ? actor.prototypeToken.texture.src : '';\r\n\r\n if (includeThisActor || includeThisToken) {\r\n if (formData.autoApply) {\r\n await autoApply(actor, image1, image2, formData, typeOverride);\r\n } else {\r\n artSelectDisplayed = true;\r\n addToArtSelectQueue(actor, image1, image2, formData, typeOverride);\r\n }\r\n }\r\n };\r\n } else {\r\n processItem = async function (item) {\r\n const doc = await compendium.getDocument(item._id);\r\n if (doc.name === '#[CF_tempEntity]') return; // Compendium Folders module's control entity\r\n\r\n let defaultImg = '';\r\n if (doc.schema.fields.img || doc.schema.fields.texture) {\r\n defaultImg = (doc.schema.fields.img ?? doc.schema.fields.texture).initial();\r\n }\r\n const hasImage = doc.img != null && doc.img !== defaultImg && !missingImageList.includes(doc.img);\r\n\r\n let imageFound = false;\r\n if (formData.missingOnly && hasImage) return;\r\n if (formData.autoApply) {\r\n let results = await doImageSearch(doc.name, {\r\n searchType: typeOverride ?? compendium.documentName,\r\n simpleResults: true,\r\n searchOptions: formData.searchOptions,\r\n });\r\n\r\n if ((results ?? []).length != 0) {\r\n imageFound = true;\r\n await updateActorImage(doc, results[0], false, formData.compendium);\r\n }\r\n }\r\n\r\n if (!formData.autoApply || (formData.autoDisplayArtSelect && !imageFound)) {\r\n artSelectDisplayed = true;\r\n addToQueue(doc.name, {\r\n searchType: typeOverride ?? compendium.documentName,\r\n object: doc,\r\n image1: formData.showImages ? doc.img : '',\r\n displayMode: ArtSelect.IMAGE_DISPLAY.IMAGE,\r\n searchOptions: formData.searchOptions,\r\n callback: async function (imgSrc, name) {\r\n await updateActorImage(doc, imgSrc);\r\n },\r\n });\r\n }\r\n };\r\n }\r\n\r\n const allItems = [];\r\n compendium.index.forEach((k) => {\r\n allItems.push(k);\r\n });\r\n\r\n if (formData.autoApply) {\r\n let processing = true;\r\n let stopProcessing = false;\r\n let processed = 0;\r\n let counter = $(`<p>CACHING 0/${allItems.length}</p>`);\r\n let d;\r\n\r\n const startProcessing = async function () {\r\n while (processing && processed < allItems.length) {\r\n await new Promise((resolve, reject) => {\r\n setTimeout(async () => {\r\n await processItem(allItems[processed]);\r\n resolve();\r\n }, 10);\r\n });\r\n processed++;\r\n counter.html(`${processed}/${allItems.length}`);\r\n }\r\n if (stopProcessing || processed === allItems.length) {\r\n d?.close(true);\r\n addToQueue('DUMMY', { execute: endMapping });\r\n renderFromQueue();\r\n }\r\n };\r\n\r\n d = new Dialog({\r\n title: `Mapping: ${compendium.title}`,\r\n content: `\r\n <div style=\"text-align:center;\" class=\"fa-3x\"><i class=\"fas fa-spinner fa-pulse\"></i></div>\r\n <div style=\"text-align:center;\" class=\"counter\"></div>\r\n <button style=\"width:100%;\" class=\"pause\"><i class=\"fas fa-play-circle\"></i> Pause/Start</button>`,\r\n buttons: {\r\n cancel: {\r\n icon: '<i class=\"fas fa-stop-circle\"></i>',\r\n label: 'Cancel',\r\n },\r\n },\r\n default: 'cancel',\r\n render: (html) => {\r\n html.find('.counter').append(counter);\r\n const spinner = html.find('.fa-spinner');\r\n html.find('.pause').on('click', () => {\r\n if (processing) {\r\n processing = false;\r\n spinner.removeClass('fa-pulse');\r\n } else {\r\n processing = true;\r\n startProcessing();\r\n spinner.addClass('fa-pulse');\r\n }\r\n });\r\n setTimeout(async () => startProcessing(), 1000);\r\n },\r\n close: () => {\r\n if (!stopProcessing) {\r\n stopProcessing = true;\r\n if (!processing) startProcessing();\r\n else processing = false;\r\n }\r\n },\r\n });\r\n d.render(true);\r\n } else {\r\n const tasks = allItems.map(processItem);\r\n Promise.all(tasks).then(() => {\r\n addToQueue('DUMMY', { execute: endMapping });\r\n renderFromQueue();\r\n if (formData.missingOnly && !artSelectDisplayed) {\r\n ui.notifications.warn('Token Variant Art: No documents found containing missing images.');\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n // If search paths are the same, remove them from searchOptions\r\n if (\r\n !this.searchOptions.searchPaths?.length ||\r\n isEmpty(diffObject(this.searchOptions.searchPaths, TVA_CONFIG.searchPaths))\r\n ) {\r\n this.searchOptions.searchPaths = [];\r\n }\r\n\r\n formData.searchOptions = this.searchOptions;\r\n\r\n await updateSettings({ compendiumMapper: formData });\r\n if (formData.compendium) {\r\n this.startMapping(formData);\r\n }\r\n }\r\n}\r\n","import { cacheImages } from '../scripts/search.js';\r\nimport { TVA_CONFIG, updateSettings } from '../scripts/settings.js';\r\nimport { getFileName } from '../scripts/utils.js';\r\nimport EffectMappingForm from './effectMappingForm.js';\r\nimport { showPathSelectCategoryDialog, showPathSelectConfigForm } from './dialogs.js';\r\n\r\nexport default class ConfigureSettings extends FormApplication {\r\n constructor(\r\n dummySettings,\r\n {\r\n searchPaths = true,\r\n searchFilters = true,\r\n searchAlgorithm = true,\r\n randomizer = true,\r\n popup = true,\r\n permissions = true,\r\n worldHud = true,\r\n misc = true,\r\n activeEffects = true,\r\n features = false,\r\n } = {}\r\n ) {\r\n super({}, {});\r\n this.enabledTabs = {\r\n searchPaths,\r\n searchFilters,\r\n searchAlgorithm,\r\n randomizer,\r\n features,\r\n popup,\r\n permissions,\r\n worldHud,\r\n misc,\r\n activeEffects,\r\n };\r\n this.settings = foundry.utils.deepClone(TVA_CONFIG);\r\n if (dummySettings) {\r\n this.settings = mergeObject(this.settings, dummySettings, { insertKeys: false });\r\n this.dummySettings = dummySettings;\r\n }\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-configure-settings',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/configureSettings.html',\r\n resizable: false,\r\n minimizable: false,\r\n title: 'Configure Settings',\r\n width: 700,\r\n height: 'auto',\r\n tabs: [{ navSelector: '.sheet-tabs', contentSelector: '.content', initial: 'searchPaths' }],\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n const settings = this.settings;\r\n\r\n data.enabledTabs = this.enabledTabs;\r\n\r\n // === Search Paths ===\r\n const paths = settings.searchPaths.map((path) => {\r\n const r = {};\r\n r.text = path.text;\r\n r.icon = this._pathIcon(path.source || '');\r\n r.cache = path.cache;\r\n r.source = path.source || '';\r\n r.types = path.types.join(',');\r\n r.config = JSON.stringify(path.config ?? {});\r\n r.hasConfig = path.config && !isEmpty(path.config);\r\n return r;\r\n });\r\n data.searchPaths = paths;\r\n\r\n // === Search Filters ===\r\n data.searchFilters = settings.searchFilters;\r\n for (const filter in data.searchFilters) {\r\n data.searchFilters[filter].label = filter;\r\n }\r\n\r\n // === Algorithm ===\r\n data.algorithm = deepClone(settings.algorithm);\r\n data.algorithm.fuzzyThreshold = 100 - data.algorithm.fuzzyThreshold * 100;\r\n\r\n // === Randomizer ===\r\n // Get all actor types defined by the game system\r\n data.randomizer = deepClone(settings.randomizer);\r\n const actorTypes = (game.system.entityTypes ?? game.system.documentTypes)['Actor'];\r\n data.randomizer.actorTypes = actorTypes.reduce((obj, t) => {\r\n const label = CONFIG['Actor']?.typeLabels?.[t] ?? t;\r\n obj[t] = {\r\n label: game.i18n.has(label) ? game.i18n.localize(label) : t,\r\n disable: settings.randomizer[`${t}Disable`] ?? false,\r\n };\r\n return obj;\r\n }, {});\r\n\r\n data.randomizer.tokenToPortraitDisabled =\r\n !(settings.randomizer.tokenCreate || settings.randomizer.tokenCopyPaste) ||\r\n data.randomizer.diffImages;\r\n\r\n // === Pop-up ===\r\n data.popup = deepClone(settings.popup);\r\n // Get all actor types defined by the game system\r\n data.popup.actorTypes = actorTypes.reduce((obj, t) => {\r\n const label = CONFIG['Actor']?.typeLabels?.[t] ?? t;\r\n obj[t] = {\r\n type: t,\r\n label: game.i18n.has(label) ? game.i18n.localize(label) : t,\r\n disable: settings.popup[`${t}Disable`] ?? false,\r\n };\r\n return obj;\r\n }, {});\r\n\r\n // Split into arrays of max length 3\r\n let allTypes = [];\r\n let tempTypes = [];\r\n let i = 0;\r\n for (const [key, value] of Object.entries(data.popup.actorTypes)) {\r\n tempTypes.push(value);\r\n i++;\r\n if (i % 3 == 0) {\r\n allTypes.push(tempTypes);\r\n tempTypes = [];\r\n }\r\n }\r\n if (tempTypes.length > 0) allTypes.push(tempTypes);\r\n data.popup.actorTypes = allTypes;\r\n\r\n // === Permissions ===\r\n data.permissions = settings.permissions;\r\n\r\n // === Token HUD ===\r\n data.worldHud = deepClone(settings.worldHud);\r\n data.worldHud.tokenHUDWildcardActive = game.modules.get('token-hud-wildcard')?.active;\r\n\r\n // === Internal Effects ===\r\n data.internalEffects = deepClone(settings.internalEffects);\r\n\r\n // === Misc ===\r\n data.keywordSearch = settings.keywordSearch;\r\n data.excludedKeywords = settings.excludedKeywords;\r\n data.systemHpPath = settings.systemHpPath;\r\n data.runSearchOnPath = settings.runSearchOnPath;\r\n data.imgurClientId = settings.imgurClientId;\r\n data.enableStatusConfig = settings.enableStatusConfig;\r\n data.disableNotifs = settings.disableNotifs;\r\n data.staticCache = settings.staticCache;\r\n data.staticCacheFile = settings.staticCacheFile;\r\n data.stackStatusConfig = settings.stackStatusConfig;\r\n data.mergeGroup = settings.mergeGroup;\r\n data.customImageCategories = settings.customImageCategories.join(',');\r\n data.disableEffectIcons = settings.disableEffectIcons;\r\n data.displayEffectIconsOnHover = settings.displayEffectIconsOnHover;\r\n data.filterEffectIcons = settings.filterEffectIcons;\r\n data.hideElevationTooltip = settings.hideElevationTooltip;\r\n data.hideTokenBorder = settings.hideTokenBorder;\r\n data.filterCustomEffectIcons = settings.filterCustomEffectIcons;\r\n data.filterIconList = settings.filterIconList.join(',');\r\n data.tilesEnabled = settings.tilesEnabled;\r\n data.updateTokenProto = settings.updateTokenProto;\r\n data.imgNameContainsDimensions = settings.imgNameContainsDimensions;\r\n data.imgNameContainsFADimensions = settings.imgNameContainsFADimensions;\r\n data.playVideoOnHover = settings.playVideoOnHover;\r\n data.pauseVideoOnHoverOut = settings.pauseVideoOnHoverOut;\r\n data.disableImageChangeOnPolymorphed = settings.disableImageChangeOnPolymorphed;\r\n data.disableImageUpdateOnNonPrototype = settings.disableImageUpdateOnNonPrototype;\r\n data.disableTokenUpdateAnimation = settings.disableTokenUpdateAnimation;\r\n data.mappingsCurrentSceneOnly = settings.mappingsCurrentSceneOnly;\r\n\r\n // Controls\r\n data.pathfinder = ['pf1e', 'pf2e'].includes(game.system.id);\r\n data.dnd5e = game.system.id === 'dnd5e';\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n\r\n // Search Paths\r\n super.activateListeners(html);\r\n html.find('a.create-path').click(this._onCreatePath.bind(this));\r\n html.on('input', '.searchSource', this._onSearchSourceTextChange.bind(this));\r\n $(html).on('click', 'a.delete-path', this._onDeletePath.bind(this));\r\n $(html).on('click', 'a.convert-imgur', this._onConvertImgurPath.bind(this));\r\n $(html).on('click', 'a.convert-json', this._onConvertJsonPath.bind(this));\r\n $(html).on('click', '.path-image.source-icon a', this._onBrowseFolder.bind(this));\r\n $(html).on('click', 'a.select-category', showPathSelectCategoryDialog.bind(this));\r\n $(html).on('click', 'a.select-config', showPathSelectConfigForm.bind(this));\r\n\r\n // Search Filters\r\n html.on('input', 'input.filterRegex', this._validateRegex.bind(this));\r\n\r\n // Active Effects\r\n const disableEffectIcons = html.find('[name=\"disableEffectIcons\"]');\r\n const filterEffectIcons = html.find('[name=\"filterEffectIcons\"]');\r\n disableEffectIcons\r\n .on('change', (e) => {\r\n if (e.target.checked) filterEffectIcons.prop('checked', false);\r\n })\r\n .trigger('change');\r\n filterEffectIcons.on('change', (e) => {\r\n if (e.target.checked) disableEffectIcons.prop('checked', false);\r\n });\r\n\r\n // Algorithm\r\n const algorithmTab = $(html).find('div[data-tab=\"searchAlgorithm\"]');\r\n algorithmTab.find(`input[name=\"algorithm.exact\"]`).change((e) => {\r\n $(e.target)\r\n .closest('form')\r\n .find('input[name=\"algorithm.fuzzy\"]')\r\n .prop('checked', !e.target.checked);\r\n });\r\n algorithmTab.find(`input[name=\"algorithm.fuzzy\"]`).change((e) => {\r\n $(e.target)\r\n .closest('form')\r\n .find('input[name=\"algorithm.exact\"]')\r\n .prop('checked', !e.target.checked);\r\n });\r\n algorithmTab.find('input[name=\"algorithm.fuzzyThreshold\"]').change((e) => {\r\n $(e.target).siblings('.token-variants-range-value').html(`${e.target.value}%`);\r\n });\r\n\r\n // Randomizer\r\n const tokenCreate = html.find('input[name=\"randomizer.tokenCreate\"]');\r\n const tokenCopyPaste = html.find('input[name=\"randomizer.tokenCopyPaste\"]');\r\n const tokenToPortrait = html.find('input[name=\"randomizer.tokenToPortrait\"]');\r\n const _toggle = () => {\r\n tokenToPortrait.prop(\r\n 'disabled',\r\n !(tokenCreate.is(':checked') || tokenCopyPaste.is(':checked'))\r\n );\r\n };\r\n tokenCreate.change(_toggle);\r\n tokenCopyPaste.change(_toggle);\r\n\r\n const diffImages = html.find('input[name=\"randomizer.diffImages\"]');\r\n const syncImages = html.find('input[name=\"randomizer.syncImages\"]');\r\n diffImages.change(() => {\r\n syncImages.prop('disabled', !diffImages.is(':checked'));\r\n tokenToPortrait.prop('disabled', diffImages.is(':checked'));\r\n });\r\n\r\n // Token HUD\r\n html.find('input[name=\"worldHud.updateActorImage\"]').change((event) => {\r\n $(event.target)\r\n .closest('form')\r\n .find('input[name=\"worldHud.useNameSimilarity\"]')\r\n .prop('disabled', !event.target.checked);\r\n });\r\n\r\n // Static Cache\r\n html.find('button.token-variants-cache-images').click((event) => {\r\n const tab = $(event.target).closest('.tab');\r\n const staticOn = tab.find('input[name=\"staticCache\"]');\r\n const staticFile = tab.find('input[name=\"staticCacheFile\"]');\r\n cacheImages({ staticCache: staticOn.is(':checked'), staticCacheFile: staticFile.val() });\r\n });\r\n\r\n // Global Mappings\r\n html.find('button.token-variants-global-mapping').click(() => {\r\n const setting = game.settings.get('core', DefaultTokenConfig.SETTING);\r\n const data = new foundry.data.PrototypeToken(setting);\r\n const token = new TokenDocument(data, { actor: null });\r\n new EffectMappingForm(token, { globalMappings: true }).render(true);\r\n });\r\n }\r\n\r\n /**\r\n * Validates regex entered into Search Filter's RegEx input field\r\n */\r\n async _validateRegex(event) {\r\n if (this._validRegex(event.target.value)) {\r\n event.target.style.backgroundColor = '';\r\n } else {\r\n event.target.style.backgroundColor = '#ff7066';\r\n }\r\n }\r\n\r\n _validRegex(val) {\r\n if (val) {\r\n try {\r\n new RegExp(val);\r\n } catch (e) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Open a FilePicker so the user can select a local folder to use as an image source\r\n */\r\n async _onBrowseFolder(event) {\r\n const pathInput = $(event.target).closest('.table-row').find('.path-text input');\r\n const sourceInput = $(event.target).closest('.table-row').find('.path-source input');\r\n\r\n let activeSource = sourceInput.val() || 'data';\r\n let current = pathInput.val();\r\n\r\n if (activeSource.startsWith('s3:')) {\r\n const bucketName = activeSource.replace('s3:', '');\r\n current = `${game.data.files.s3?.endpoint.protocol}//${bucketName}.${game.data.files.s3?.endpoint.host}/${current}`;\r\n } else if (activeSource.startsWith('rolltable')) {\r\n let content = `<select style=\"width: 100%;\" name=\"table-name\" id=\"output-tableKey\">`;\r\n\r\n game.tables.forEach((rollTable) => {\r\n content += `<option value='${rollTable.name}'>${rollTable.name}</option>`;\r\n });\r\n\r\n content += `</select>`;\r\n\r\n new Dialog({\r\n title: `Select a Rolltable`,\r\n content: content,\r\n buttons: {\r\n yes: {\r\n icon: \"<i class='fas fa-check'></i>\",\r\n label: 'Select',\r\n callback: (html) => {\r\n pathInput.val();\r\n const tableName = html.find(\"select[name='table-name']\").val();\r\n pathInput.val(tableName);\r\n },\r\n },\r\n },\r\n default: 'yes',\r\n }).render(true);\r\n return;\r\n }\r\n\r\n if (activeSource === 'json') {\r\n new FilePicker({\r\n type: 'text',\r\n activeSource: 'data',\r\n current: current,\r\n callback: (path, fp) => {\r\n pathInput.val(path);\r\n },\r\n }).render(true);\r\n } else {\r\n new FilePicker({\r\n type: 'folder',\r\n activeSource: activeSource,\r\n current: current,\r\n callback: (path, fp) => {\r\n pathInput.val(fp.result.target);\r\n if (fp.activeSource === 's3') {\r\n sourceInput.val(`s3:${fp.result.bucket}`);\r\n } else {\r\n sourceInput.val(fp.activeSource);\r\n }\r\n },\r\n }).render(true);\r\n }\r\n }\r\n\r\n /**\r\n * Converts Imgur path to a rolltable\r\n */\r\n async _onConvertImgurPath(event) {\r\n event.preventDefault();\r\n\r\n const pathInput = $(event.target).closest('.table-row').find('.path-text input');\r\n const sourceInput = $(event.target).closest('.table-row').find('.path-source input');\r\n\r\n const albumHash = pathInput.val();\r\n const imgurClientId =\r\n TVA_CONFIG.imgurClientId === '' ? 'df9d991443bb222' : TVA_CONFIG.imgurClientId;\r\n\r\n fetch('https://api.imgur.com/3/gallery/album/' + albumHash, {\r\n headers: {\r\n Authorization: 'Client-ID ' + imgurClientId,\r\n Accept: 'application/json',\r\n },\r\n })\r\n .then((response) => response.json())\r\n .then(\r\n async function (result) {\r\n if (!result.success && location.hostname === 'localhost') {\r\n ui.notifications.warn(\r\n game.i18n.format('token-variants.notifications.warn.imgur-localhost')\r\n );\r\n return;\r\n }\r\n\r\n const data = result.data;\r\n\r\n let resultsArray = [];\r\n data.images.forEach((img, i) => {\r\n resultsArray.push({\r\n type: 0,\r\n text: img.title ?? img.description ?? '',\r\n weight: 1,\r\n range: [i + 1, i + 1],\r\n collection: 'Text',\r\n drawn: false,\r\n img: img.link,\r\n });\r\n });\r\n\r\n await RollTable.create({\r\n name: data.title,\r\n description:\r\n 'Token Variant Art auto generated RollTable: https://imgur.com/gallery/' + albumHash,\r\n results: resultsArray,\r\n replacement: true,\r\n displayRoll: true,\r\n img: 'modules/token-variants/img/token-images.svg',\r\n });\r\n\r\n pathInput.val(data.title);\r\n sourceInput.val('rolltable').trigger('input');\r\n }.bind(this)\r\n )\r\n .catch((error) => console.warn('TVA | ', error));\r\n }\r\n\r\n /**\r\n * Converts Json path to a rolltable\r\n */\r\n async _onConvertJsonPath(event) {\r\n event.preventDefault();\r\n\r\n const pathInput = $(event.target).closest('.table-row').find('.path-text input');\r\n const sourceInput = $(event.target).closest('.table-row').find('.path-source input');\r\n\r\n const jsonPath = pathInput.val();\r\n\r\n fetch(jsonPath, {\r\n headers: {\r\n Accept: 'application/json',\r\n },\r\n })\r\n .then((response) => response.json())\r\n .then(\r\n async function (result) {\r\n if (!result.length > 0) {\r\n ui.notifications.warn(\r\n game.i18n.format('token-variants.notifications.warn.json-localhost')\r\n );\r\n return;\r\n }\r\n\r\n const data = result;\r\n data.title = getFileName(jsonPath);\r\n\r\n let resultsArray = [];\r\n data.forEach((img, i) => {\r\n resultsArray.push({\r\n type: 0,\r\n text: img.name ?? '',\r\n weight: 1,\r\n range: [i + 1, i + 1],\r\n collection: 'Text',\r\n drawn: false,\r\n img: img.path,\r\n });\r\n });\r\n\r\n await RollTable.create({\r\n name: data.title,\r\n description: 'Token Variant Art auto generated RollTable: ' + jsonPath,\r\n results: resultsArray,\r\n replacement: true,\r\n displayRoll: true,\r\n img: 'modules/token-variants/img/token-images.svg',\r\n });\r\n\r\n pathInput.val(data.title);\r\n sourceInput.val('rolltable').trigger('input');\r\n }.bind(this)\r\n )\r\n .catch((error) => console.warn('TVA | ', error));\r\n }\r\n\r\n /**\r\n * Generates a new search path row\r\n */\r\n async _onCreatePath(event) {\r\n event.preventDefault();\r\n const table = $(event.currentTarget).closest('.token-variant-table');\r\n let row = `\r\n <li class=\"table-row flexrow\">\r\n <div class=\"path-image source-icon\">\r\n <a><i class=\"${this._pathIcon('')}\"></i></a>\r\n </div>\r\n <div class=\"path-source\">\r\n <input class=\"searchSource\" type=\"text\" name=\"searchPaths.source\" value=\"\" placeholder=\"data\"/>\r\n </div>\r\n <div class=\"path-text\">\r\n <input class=\"searchPath\" type=\"text\" name=\"searchPaths.text\" value=\"\" placeholder=\"Path to folder\"/>\r\n </div>\r\n <div class=\"imgur-control\">\r\n <a class=\"convert-imgur\" title=\"Convert to Rolltable\"><i class=\"fas fa-angle-double-left\"></i></a>\r\n </div>\r\n <div class=\"json-control\">\r\n <a class=\"convert-json\" title=\"Convert to Rolltable\"><i class=\"fas fa-angle-double-left\"></i></a>\r\n </div>\r\n <div class=\"path-category\">\r\n <a class=\"select-category\" title=\"Select image categories/filters\"><i class=\"fas fa-swatchbook\"></i></a>\r\n <input type=\"hidden\" name=\"searchPaths.types\" value=\"Portrait,Token,PortraitAndToken\">\r\n </div>\r\n <div class=\"path-config\">\r\n <a class=\"select-config\" title=\"Apply configuration to images under this path.\"><i class=\"fas fa-cog fa-lg\"></i></a>\r\n <input type=\"hidden\" name=\"searchPaths.config\" value=\"{}\">\r\n </div>\r\n <div class=\"path-cache\">\r\n <input type=\"checkbox\" name=\"searchPaths.cache\" data-dtype=\"Boolean\" checked/>\r\n </div>\r\n <div class=\"path-controls\">\r\n <a class=\"delete-path\" title=\"Delete path\"><i class=\"fas fa-trash\"></i></a>\r\n </div>\r\n </li>\r\n `;\r\n table.append(row);\r\n\r\n this._reIndexPaths(table);\r\n\r\n this.setPosition(); // Auto-resize window\r\n }\r\n\r\n async _reIndexPaths(table) {\r\n table\r\n .find('.path-source')\r\n .find('input')\r\n .each(function (index) {\r\n $(this).attr('name', `searchPaths.${index}.source`);\r\n });\r\n\r\n table\r\n .find('.path-text')\r\n .find('input')\r\n .each(function (index) {\r\n $(this).attr('name', `searchPaths.${index}.text`);\r\n });\r\n\r\n table\r\n .find('.path-cache')\r\n .find('input')\r\n .each(function (index) {\r\n $(this).attr('name', `searchPaths.${index}.cache`);\r\n });\r\n table\r\n .find('.path-category')\r\n .find('input')\r\n .each(function (index) {\r\n $(this).attr('name', `searchPaths.${index}.types`);\r\n });\r\n table\r\n .find('.path-config')\r\n .find('input')\r\n .each(function (index) {\r\n $(this).attr('name', `searchPaths.${index}.config`);\r\n });\r\n }\r\n\r\n async _onDeletePath(event) {\r\n event.preventDefault();\r\n\r\n const li = event.currentTarget.closest('.table-row');\r\n li.remove();\r\n\r\n const table = $(event.currentTarget).closest('.token-variant-table');\r\n this._reIndexPaths(table);\r\n\r\n this.setPosition(); // Auto-resize window\r\n }\r\n\r\n async _onSearchSourceTextChange(event) {\r\n const image = this._pathIcon(event.target.value);\r\n const imgur = image === 'fas fa-info';\r\n const json = image === 'fas fa-brackets-curly';\r\n\r\n const imgurControl = $(event.currentTarget).closest('.table-row').find('.imgur-control');\r\n if (imgur) imgurControl.addClass('active');\r\n else imgurControl.removeClass('active');\r\n\r\n const jsonControl = $(event.currentTarget).closest('.table-row').find('.json-control');\r\n if (json) jsonControl.addClass('active');\r\n else jsonControl.removeClass('active');\r\n\r\n $(event.currentTarget).closest('.table-row').find('.path-image i').attr('class', image);\r\n }\r\n\r\n // Return icon appropriate for the path provided\r\n _pathIcon(source) {\r\n if (source.startsWith('s3')) {\r\n return 'fas fa-database';\r\n } else if (source.startsWith('rolltable')) {\r\n return 'fas fa-dice';\r\n } else if (source.startsWith('forgevtt') || source.startsWith('forge-bazaar')) {\r\n return 'fas fa-hammer';\r\n } else if (source.startsWith('imgur')) {\r\n return 'fas fa-info';\r\n } else if (source.startsWith('json')) {\r\n return 'fas fa-brackets-curly';\r\n }\r\n\r\n return 'fas fa-folder';\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n const settings = this.settings;\r\n formData = expandObject(formData);\r\n\r\n // Search Paths\r\n settings.searchPaths = formData.hasOwnProperty('searchPaths')\r\n ? Object.values(formData.searchPaths)\r\n : [];\r\n settings.searchPaths.forEach((path) => {\r\n if (!path.source) path.source = 'data';\r\n if (path.types) path.types = path.types.split(',');\r\n else path.types = [];\r\n if (path.config) {\r\n try {\r\n path.config = JSON.parse(path.config);\r\n } catch (e) {\r\n delete path.config;\r\n }\r\n } else delete path.config;\r\n });\r\n\r\n // Search Filters\r\n for (const filter in formData.searchFilters) {\r\n if (!this._validRegex(formData.searchFilters[filter].regex))\r\n formData.searchFilters[filter].regex = '';\r\n }\r\n mergeObject(settings.searchFilters, formData.searchFilters);\r\n\r\n // Algorithm\r\n formData.algorithm.fuzzyLimit = parseInt(formData.algorithm.fuzzyLimit);\r\n if (isNaN(formData.algorithm.fuzzyLimit) || formData.algorithm.fuzzyLimit < 1)\r\n formData.algorithm.fuzzyLimit = 50;\r\n formData.algorithm.fuzzyThreshold = (100 - formData.algorithm.fuzzyThreshold) / 100;\r\n mergeObject(settings.algorithm, formData.algorithm);\r\n\r\n // Randomizer\r\n mergeObject(settings.randomizer, formData.randomizer);\r\n\r\n // Pop-up\r\n mergeObject(settings.popup, formData.popup);\r\n\r\n // Permissions\r\n mergeObject(settings.permissions, formData.permissions);\r\n\r\n // Token HUD\r\n mergeObject(settings.worldHud, formData.worldHud);\r\n\r\n // Internal Effects\r\n mergeObject(settings.internalEffects, formData.internalEffects);\r\n\r\n // Misc\r\n mergeObject(settings, {\r\n keywordSearch: formData.keywordSearch,\r\n excludedKeywords: formData.excludedKeywords,\r\n systemHpPath: formData.systemHpPath?.trim(),\r\n runSearchOnPath: formData.runSearchOnPath,\r\n imgurClientId: formData.imgurClientId,\r\n enableStatusConfig: formData.enableStatusConfig,\r\n disableNotifs: formData.disableNotifs,\r\n staticCache: formData.staticCache,\r\n staticCacheFile: formData.staticCacheFile,\r\n tilesEnabled: formData.tilesEnabled,\r\n stackStatusConfig: formData.stackStatusConfig,\r\n mergeGroup: formData.mergeGroup,\r\n customImageCategories: (formData.customImageCategories || '')\r\n .split(',')\r\n .map((t) => t.trim())\r\n .filter((t) => t),\r\n disableEffectIcons: formData.disableEffectIcons,\r\n displayEffectIconsOnHover: formData.displayEffectIconsOnHover,\r\n filterEffectIcons: formData.filterEffectIcons,\r\n hideElevationTooltip: formData.hideElevationTooltip,\r\n hideTokenBorder: formData.hideTokenBorder,\r\n filterCustomEffectIcons: formData.filterCustomEffectIcons,\r\n filterIconList: (formData.filterIconList || '')\r\n .split(',')\r\n .map((t) => t.trim())\r\n .filter((t) => t),\r\n updateTokenProto: formData.updateTokenProto,\r\n imgNameContainsDimensions: formData.imgNameContainsDimensions,\r\n imgNameContainsFADimensions: formData.imgNameContainsFADimensions,\r\n playVideoOnHover: formData.playVideoOnHover,\r\n pauseVideoOnHoverOut: formData.pauseVideoOnHoverOut,\r\n disableImageChangeOnPolymorphed: formData.disableImageChangeOnPolymorphed,\r\n disableImageUpdateOnNonPrototype: formData.disableImageUpdateOnNonPrototype,\r\n disableTokenUpdateAnimation: formData.disableTokenUpdateAnimation,\r\n mappingsCurrentSceneOnly: formData.mappingsCurrentSceneOnly,\r\n });\r\n\r\n // Global Mappings\r\n settings.globalMappings = TVA_CONFIG.globalMappings;\r\n\r\n // Save Settings\r\n if (this.dummySettings) {\r\n mergeObjectFix(this.dummySettings, settings, { insertKeys: false });\r\n } else {\r\n updateSettings(settings);\r\n }\r\n }\r\n}\r\n\r\n// ========================\r\n// v8 support, broken merge\r\n// ========================\r\nexport function mergeObjectFix(\r\n original,\r\n other = {},\r\n {\r\n insertKeys = true,\r\n insertValues = true,\r\n overwrite = true,\r\n recursive = true,\r\n inplace = true,\r\n enforceTypes = false,\r\n } = {},\r\n _d = 0\r\n) {\r\n other = other || {};\r\n if (!(original instanceof Object) || !(other instanceof Object)) {\r\n throw new Error('One of original or other are not Objects!');\r\n }\r\n const options = { insertKeys, insertValues, overwrite, recursive, inplace, enforceTypes };\r\n\r\n // Special handling at depth 0\r\n if (_d === 0) {\r\n if (!inplace) original = deepClone(original);\r\n if (Object.keys(original).some((k) => /\\./.test(k))) original = expandObject(original);\r\n if (Object.keys(other).some((k) => /\\./.test(k))) other = expandObject(other);\r\n }\r\n\r\n // Iterate over the other object\r\n for (let k of Object.keys(other)) {\r\n const v = other[k];\r\n if (original.hasOwnProperty(k)) _mergeUpdate(original, k, v, options, _d + 1);\r\n else _mergeInsertFix(original, k, v, options, _d + 1);\r\n }\r\n return original;\r\n}\r\n\r\nfunction _mergeInsertFix(original, k, v, { insertKeys, insertValues } = {}, _d) {\r\n // Recursively create simple objects\r\n if (v?.constructor === Object && insertKeys) {\r\n original[k] = mergeObjectFix({}, v, { insertKeys: true, inplace: true });\r\n return;\r\n }\r\n\r\n // Delete a key\r\n if (k.startsWith('-=')) {\r\n delete original[k.slice(2)];\r\n return;\r\n }\r\n\r\n // Insert a key\r\n const canInsert = (_d <= 1 && insertKeys) || (_d > 1 && insertValues);\r\n if (canInsert) original[k] = v;\r\n}\r\n\r\nfunction _mergeUpdate(\r\n original,\r\n k,\r\n v,\r\n { insertKeys, insertValues, enforceTypes, overwrite, recursive } = {},\r\n _d\r\n) {\r\n const x = original[k];\r\n const tv = getType(v);\r\n const tx = getType(x);\r\n\r\n // Recursively merge an inner object\r\n if (tv === 'Object' && tx === 'Object' && recursive) {\r\n return mergeObjectFix(\r\n x,\r\n v,\r\n {\r\n insertKeys: insertKeys,\r\n insertValues: insertValues,\r\n overwrite: overwrite,\r\n inplace: true,\r\n enforceTypes: enforceTypes,\r\n },\r\n _d\r\n );\r\n }\r\n\r\n // Overwrite an existing value\r\n if (overwrite) {\r\n if (tx !== 'undefined' && tv !== tx && enforceTypes) {\r\n throw new Error(`Mismatched data types encountered during object merge.`);\r\n }\r\n original[k] = v;\r\n }\r\n}\r\n","import { TVA_CONFIG, updateSettings } from '../scripts/settings.js';\r\nimport { getFileName } from '../scripts/utils.js';\r\nimport { showArtSelect } from '../token-variants.mjs';\r\n\r\nexport default class MissingImageConfig extends FormApplication {\r\n constructor() {\r\n super({}, {});\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-missing-images',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/missingImageConfig.html',\r\n resizable: true,\r\n minimizable: false,\r\n title: 'Define Missing Images',\r\n width: 560,\r\n height: 'auto',\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n\r\n if (!this.missingImages)\r\n this.missingImages = deepClone(TVA_CONFIG.compendiumMapper.missingImages);\r\n\r\n data.missingImages = this.missingImages;\r\n\r\n data.documents = ['all', 'Actor', 'Cards', 'Item', 'Macro', 'RollTable'];\r\n return data;\r\n }\r\n\r\n _processFormData(formData) {\r\n if (!Array.isArray(formData.document)) {\r\n formData.document = [formData.document];\r\n formData.image = [formData.image];\r\n }\r\n\r\n const missingImages = [];\r\n for (let i = 0; i < formData.document.length; i++) {\r\n missingImages.push({ document: formData.document[i], image: formData.image[i] });\r\n }\r\n return missingImages;\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n\r\n html.on('click', '.add-row', () => {\r\n const formData = this._getSubmitData();\r\n this.missingImages = this._processFormData(formData);\r\n this.missingImages.push({ document: 'all', image: CONST.DEFAULT_TOKEN });\r\n this.render();\r\n });\r\n\r\n html.on('click', '.delete-row', (event) => {\r\n const formData = this._getSubmitData();\r\n this.missingImages = this._processFormData(formData);\r\n const index = $(event.target).closest('li')[0].dataset.index;\r\n this.missingImages.splice(index, 1);\r\n this.render();\r\n });\r\n\r\n html.on('click', '.file-picker', (event) => {\r\n new FilePicker({\r\n type: 'imagevideo',\r\n callback: (path) => {\r\n $(event.target).closest('li').find('[name=\"image\"]').val(path);\r\n $(event.target).closest('li').find('img').attr('src', path);\r\n },\r\n }).render();\r\n });\r\n\r\n html.on('click', '.duplicate-picker', (event) => {\r\n let content = `<select style=\"width: 100%;\" name=\"compendium\">`;\r\n\r\n game.packs.forEach((pack) => {\r\n content += `<option value='${pack.collection}'>${pack.title}</option>`;\r\n });\r\n\r\n content += `</select>`;\r\n\r\n new Dialog({\r\n title: `Compendiums`,\r\n content: content,\r\n buttons: {\r\n yes: {\r\n icon: \"<i class='far fa-search'></i>\",\r\n label: 'Search for Duplicates',\r\n callback: (html) => {\r\n const found = new Set();\r\n const duplicates = new Set();\r\n const compendium = game.packs.get(html.find(\"[name='compendium']\").val());\r\n compendium.index.forEach((k) => {\r\n if (found.has(k.img)) {\r\n duplicates.add(k.img);\r\n }\r\n found.add(k.img);\r\n });\r\n if (!duplicates.size) {\r\n ui.notifications.info('No duplicates found in: ' + compendium.title);\r\n }\r\n\r\n const images = Array.from(duplicates).map((img) => {\r\n return { path: img, name: getFileName(img) };\r\n });\r\n const allImages = new Map();\r\n allImages.set('Duplicates', images);\r\n\r\n showArtSelect('Duplicates', {\r\n allImages,\r\n callback: (img) => {\r\n $(event.target).closest('li').find('[name=\"image\"]').val(img);\r\n $(event.target).closest('li').find('img').attr('src', img);\r\n },\r\n });\r\n },\r\n },\r\n },\r\n default: 'yes',\r\n }).render(true);\r\n });\r\n }\r\n\r\n async _updateObject(event, formData) {\r\n updateSettings({\r\n compendiumMapper: { missingImages: this._processFormData(formData) },\r\n });\r\n }\r\n}\r\n","import { TVA_CONFIG, updateSettings } from '../scripts/settings.js';\r\nimport { showPathSelectCategoryDialog, showPathSelectConfigForm } from './dialogs.js';\r\n\r\nexport class ForgeSearchPaths extends FormApplication {\r\n constructor() {\r\n super({}, {});\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-search-paths',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/forgeSearchPaths.html',\r\n resizable: true,\r\n minimizable: false,\r\n closeOnSubmit: false,\r\n title: game.i18n.localize('token-variants.settings.search-paths.Name'),\r\n width: 592,\r\n height: 'auto',\r\n scrollY: ['ol.token-variant-table'],\r\n dragDrop: [{ dragSelector: null, dropSelector: null }],\r\n });\r\n }\r\n\r\n async getData(options) {\r\n if (!this.object.paths) this.object.paths = await this._getPaths();\r\n\r\n const paths = this.object.paths.map((path) => {\r\n const r = {};\r\n r.text = path.text;\r\n r.cache = path.cache;\r\n r.share = path.share;\r\n r.types = path.types.join(',');\r\n r.config = JSON.stringify(path.config ?? {});\r\n return r;\r\n });\r\n\r\n const data = super.getData(options);\r\n data.paths = paths;\r\n data.apiKey = this.apiKey;\r\n return data;\r\n }\r\n\r\n async _getPaths() {\r\n const forgePaths = deepClone(TVA_CONFIG.forgeSearchPaths) || {};\r\n this.userId = typeof ForgeAPI !== 'undefined' ? await ForgeAPI.getUserId() : 'tempUser'; // TODO\r\n this.apiKey = forgePaths[this.userId]?.apiKey;\r\n return forgePaths[this.userId]?.paths || [];\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n html.find('a.create-path').click(this._onCreatePath.bind(this));\r\n $(html).on('click', 'a.select-category', showPathSelectCategoryDialog.bind(this));\r\n $(html).on('click', 'a.select-config', showPathSelectConfigForm.bind(this));\r\n html.find('a.delete-path').click(this._onDeletePath.bind(this));\r\n html.find('button.reset').click(this._onReset.bind(this));\r\n html.find('button.update').click(this._onUpdate.bind(this));\r\n $(html).on('click', '.path-image.source-icon a', this._onBrowseFolder.bind(this));\r\n }\r\n\r\n /**\r\n * Open a FilePicker so the user can select a local folder to use as an image source\r\n */\r\n async _onBrowseFolder(event) {\r\n const pathInput = $(event.target).closest('.table-row').find('.path-text input');\r\n\r\n new FilePicker({\r\n type: 'folder',\r\n activeSource: 'forgevtt',\r\n current: pathInput.val(),\r\n callback: (path, fp) => {\r\n if (fp.activeSource !== 'forgevtt') {\r\n ui.notifications.warn(\"Token Variant Art: Only 'Assets Library' paths are supported\");\r\n } else {\r\n pathInput.val(fp.result.target);\r\n }\r\n },\r\n }).render(true);\r\n }\r\n\r\n async _onCreatePath(event) {\r\n event.preventDefault();\r\n await this._onSubmit(event);\r\n\r\n this.object.paths.push({\r\n text: '',\r\n cache: true,\r\n share: true,\r\n types: ['Portrait', 'Token', 'PortraitAndToken'],\r\n });\r\n this.render();\r\n }\r\n\r\n async _onDeletePath(event) {\r\n event.preventDefault();\r\n await this._onSubmit(event);\r\n\r\n const li = event.currentTarget.closest('.table-row');\r\n this.object.paths.splice(li.dataset.index, 1);\r\n this.render();\r\n }\r\n\r\n _onReset(event) {\r\n event.preventDefault();\r\n this.object.paths = this._getPaths();\r\n this.render();\r\n }\r\n\r\n async _onUpdate(event) {\r\n event.preventDefault();\r\n await this._onSubmit(event);\r\n this._updatePaths();\r\n }\r\n\r\n async _updateObject(event, formData) {\r\n const expanded = expandObject(formData);\r\n expanded.paths = expanded.hasOwnProperty('paths') ? Object.values(expanded.paths) : [];\r\n expanded.paths.forEach((path, index) => {\r\n this.object.paths[index] = {\r\n text: path.text,\r\n cache: path.cache,\r\n share: path.share,\r\n source: path.source,\r\n types: path.types.split(','),\r\n };\r\n if (path.config) {\r\n try {\r\n path.config = JSON.parse(path.config);\r\n if (!isEmpty(path.config)) {\r\n this.object.paths[index].config = path.config;\r\n }\r\n } catch (e) {}\r\n }\r\n });\r\n this.apiKey = expanded.apiKey;\r\n }\r\n\r\n _cleanPaths() {\r\n // Cleanup empty and duplicate paths\r\n let uniquePaths = new Set();\r\n let paths = this.object.paths.filter((path) => {\r\n if (!path.text || uniquePaths.has(path.text)) return false;\r\n uniquePaths.add(path.text);\r\n return true;\r\n });\r\n return paths;\r\n }\r\n\r\n _updatePaths() {\r\n if (this.userId) {\r\n const forgePaths = deepClone(TVA_CONFIG.forgeSearchPaths) || {};\r\n forgePaths[this.userId] = {\r\n paths: this._cleanPaths(),\r\n apiKey: this.apiKey,\r\n };\r\n\r\n if (game.user.isGM) {\r\n updateSettings({ forgeSearchPaths: forgePaths });\r\n } else {\r\n // Workaround for forgeSearchPaths setting to be updated by non-GM clients\r\n const message = {\r\n handlerName: 'forgeSearchPaths',\r\n args: forgePaths,\r\n type: 'UPDATE',\r\n };\r\n game.socket?.emit('module.token-variants', message);\r\n }\r\n }\r\n }\r\n\r\n async close(options = {}) {\r\n await this._onSubmit(event);\r\n this._updatePaths();\r\n return super.close(options);\r\n }\r\n}\r\n","import { TVA_CONFIG } from '../scripts/settings.js';\r\n\r\nexport default class TokenHUDClientSettings extends FormApplication {\r\n constructor() {\r\n super({}, { title: `Token HUD Settings` });\r\n }\r\n\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-hud-settings',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/tokenHUDClientSettings.html',\r\n resizable: false,\r\n minimizable: false,\r\n title: '',\r\n width: 500,\r\n });\r\n }\r\n\r\n async getData(options) {\r\n const data = super.getData(options);\r\n return mergeObject(data, TVA_CONFIG.hud);\r\n }\r\n\r\n /**\r\n * @param {Event} event\r\n * @param {Object} formData\r\n */\r\n async _updateObject(event, formData) {\r\n game.settings.set('token-variants', 'hudSettings', mergeObject(TVA_CONFIG.hud, formData));\r\n }\r\n}\r\n","import { importSettingsFromJSON, exportSettingsToJSON } from '../scripts/settings.js';\r\n\r\nexport default class ImportExport extends FormApplication {\r\n static get defaultOptions() {\r\n return mergeObject(super.defaultOptions, {\r\n id: 'token-variants-import-export',\r\n classes: ['sheet'],\r\n template: 'modules/token-variants/templates/importExport.html',\r\n resizable: false,\r\n minimizable: false,\r\n title: 'Import/Export',\r\n width: 250,\r\n });\r\n }\r\n\r\n /**\r\n * @param {JQuery} html\r\n */\r\n activateListeners(html) {\r\n super.activateListeners(html);\r\n html.find('.import').click(this._importFromJSONDialog.bind(this));\r\n html.find('.export').click(() => {\r\n exportSettingsToJSON();\r\n this.close();\r\n });\r\n }\r\n\r\n async _importFromJSONDialog() {\r\n const content = await renderTemplate('templates/apps/import-data.html', {\r\n entity: 'token-variants',\r\n name: 'settings',\r\n });\r\n let dialog = new Promise((resolve, reject) => {\r\n new Dialog(\r\n {\r\n title: game.i18n.localize('token-variants.settings.import-export.window.import-dialog'),\r\n content: content,\r\n buttons: {\r\n import: {\r\n icon: '<i class=\"fas fa-file-import\"></i>',\r\n label: game.i18n.localize('token-variants.common.import'),\r\n callback: (html) => {\r\n const form = html.find('form')[0];\r\n if (!form.data.files.length)\r\n return ui.notifications?.error('You did not upload a data file!');\r\n readTextFromFile(form.data.files[0]).then((json) => {\r\n importSettingsFromJSON(json);\r\n resolve(true);\r\n });\r\n },\r\n },\r\n no: {\r\n icon: '<i class=\"fas fa-times\"></i>',\r\n label: 'Cancel',\r\n callback: (html) => resolve(false),\r\n },\r\n },\r\n default: 'import',\r\n },\r\n {\r\n width: 400,\r\n }\r\n ).render(true);\r\n });\r\n this.close();\r\n return await dialog;\r\n }\r\n}\r\n"],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","self","window","global","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","OverlayConfig","FILTERS","$ce8jp","$dmUqi","$bFZU7","$eeGZt","$coMHP","$eYkM9","$9IngI","$bZ3HW","FormApplication","constructor","config11","callback11","id11","token11","config","callback","token","canvas","tokens","_id","previewConfig","deepClone","defaultOptions","mergeObject","classes","template","resizable","minimizable","title","width","height","tabs","navSelector","contentSelector","initial","activateListeners","html","find","on","event11","icons11","getPreviewIcons","length","Reticle","activate","tvaOverlay","icon","app","imgLinkDisable","disabled11","prop","chkBox11","$","target","closest","button11","is","removeClass","addClass","Boolean","imgLinked","fieldset11","content11","checked","show","hide","setPosition","shapeLegends","each","i31","legend11","append","shapes","label","_onAddShape","bind","_onAddEvent","_onDeleteShape","_onDeleteEvent","_onMoveShapeUp","_onMoveShapeDown","_onCloneShape","_onInputChange","parentId","value","trigger","val","empty","filterOptions11","genFilterOptionControls","click","showArtSelect","name","searchType","SEARCH_TYPE","TOKEN","imgSrc11","imgName11","presetName11","preset11","TokenMagic","getPreset","JSON","stringify","scaleState","locked","siblings","lockButtons","sliderScaleWidth","sliderScaleHeight","sliderWidth","sliderHeight","event","params","textarea","eval","console","warn","param","Array","isArray","i","promptParamChoice","game","modules","api","showGenericForm","filterType","inputChangeCallback","selected11","inplace","underlay","top","bottom","change","linkScale","linkDimensions","linkStageScale","limitOnProperty","input11","match","VALID_EXPRESSION","_onCreateVariable","_onDeleteVariable","index11","data","_getSubmitData","variables","splice","render","push","shape11","OVERLAY_SHAPES","CORE_SHAPE","shape","listener11","interactivity","listener","macro","script","nShape11","_swapShapes","i111","i211","temp11","_convertColor","colString11","c11","Color","fromString","rgba11","rgb","e11","type","color11","_applyPreviews","tokens11","placeables","previewIcons11","tkn11","tvaOverlays","overlayConfig","getFlagMappings","m11","targets11","target11","preview11","evaluateOverlayExpressions","refresh","preview","previewTexture","genTexture","_removePreviews","getData","options11","data11","filters","keys","PIXI","sort","tmfxActive","active","tmfxPresets","getPresets","map","p11","unshift","settings11","DEFAULT_OVERLAY_CONFIG","ceActive","ceEffects","dfreds","effects","all","ef11","macros","filter","filterOptions","users","u11","selected","limitedUsers","includes","fonts","CONFIG","fontDefinitions","allMappings11","getAllEffectMappings","_11","groupedMappings11","sortMappingsToGroups","shapeName11","parents","parentID","anchor","x","y","getTemplate","allShapes","textAlignmentOptions","linkDimensionsX","linkDimensionsY","_getHeaderButtons","buttons11","class","onclick","Dialog","content","buttons","close","formData11","expandObject","repeating","repeat","text","values","forEach","trim","tmfxPreset","ceEffect","v11","getType","uid11","limitOnEffect","Number","_updateObject","OutlineOverlayFilter","defaultValues","outlineColor","trueThickness","animate","controls","min","max","step","argType","AlphaFilter","alpha","BlurFilter","strength","quality","BlurFilterPass","horizontal","NoiseFilter","noise","seed","AdjustmentFilter","gamma","saturation","contrast","brightness","red","green","blue","AdvancedBloomFilter","threshold","bloomScale","blur","AsciiFilter","size","BevelFilter","rotation","thickness","lightColor","lightAlpha","shadowColor","shadowAlpha","BloomFilter","BulgePinchFilter","radius","CRTFilter","curvature","lineWidth","lineContrast","verticalLine","noiseSize","vignetting","vignettingAlpha","vignettingBlur","time","DotFilter","scale","angle","DropShadowFilter","distance","color","shadowOnly","EmbossFilter","GlitchFilter","slices","offset","direction","fillMode","average","minSize","sampleSize","options","GlowFilter","outerStrength","innerStrength","knockout","GodrayFilter","gain","lacunarity","parallel","KawaseBlurFilter","clamp","OldFilmFilter","sepia","scratch","scratchDensity","scratchWidth","OutlineFilter","PixelateFilter","RGBSplitFilter","RadialBlurFilter","center","ReflectionFilter","mirror","boundary","amplitude","waveLength","DisplacementFilter","sprite","textureScale","displacementScale","filterName11","values11","getControlValues","controls11","controlsHTML11","control11","genControl","fromRGB","toString","from","val11","name11","label11","charAt","toUpperCase","slice","type11","select11","opt11","params11","Promise","resolve11","reject11","filterId","dialog11","$8e6d3d7077a33868$export$49d6e2dab8292a11","$8e6d3d7077a33868$export$c702aa0e0c4769fd","$8e6d3d7077a33868$export$7ce049e9aaa9e189","$8e6d3d7077a33868$export$90019cfa1f313e2c","expression","codeExp","imgName","imgSrc","priority","overlay","alwaysOn","undefined","disabled","targetActors","group","img","scaleX","scaleY","offsetX","offsetY","inheritTint","linkRotation","linkMirror","linkOpacity","linkDimensionX","linkDimensionY","tint","loop","playOnce","animation","rotate","duration","clockwise","relative","limitedToOwner","alwaysVisible","align","canvasTextStyle","fontSize","fontFamily","fill","dropShadow","strokeThickness","stroke","curve","invert","letterSpacing","wordWrap","wordWrapWidth","breakWords","maxHeight","ui","Rectangle","Ellipse","Polygon","points","Torus","innerRadius","outerRadius","startAngle","endAngle","line","color2","prc","EFFECT_M_TIMER","registerEffectMappingHooks","updateWithEffectMapping","getTokenEffects","setOverlayVisibility","toggleTemplate","toggleTemplateOnSelected","getTokenHP","evaluateComparator","$e9LRe","$hClLE","EXPRESSION_MATCH_RE","PF2E_ITEM_TYPES","ITEM_TYPES","feature_id","FEATURE_CONTROL","unregisterHook","user","isGM","registerHook","_refreshTokenMappings","activeEffect11","userId11","parent","userId","effectName11","_updateImageOnEffectChange","_preUpdateActiveEffect","_updateActiveEffect","_preUpdateToken","_preUpdateActor","_updateActor","_updateToken","_createToken","_createCombatant","combatant11","_deleteCombatant","_preUpdateCombat","_updateCombat","combat11","combatants","applicable_item_types11","system","item11","change11","_preUpdateAssign","_updateItem","_token","tokenId","actor","added","added11","removed11","_updateImageOnMultiEffectChange","actorId","preUpdateEffects11","setProperty","isPolymorphed","object","ov11","htmlOverlay","addedEffects11","removedEffects11","getProperty","postUpdateEffects11","determineAddedRemovedEffects","removed","hidden","actor11","flags","tokenVariantFlags11","getAllActorTokens","TVA_CONFIG","mappingsCurrentSceneOnly","filterEffectIcons","drawEffects","_preUpdateCheck","internalEffects","hpChange","enabled","applyHpChangeEffect","pAdded11","pRemoved11","round11","combatantId","combatant","nextCombatantId","nextCombatant","previousCombatantId11","previousNextCombatantId11","currentCombatantId11","currentNextCombatantId11","updateCombatant11","message11","handlerName","args","sceneId","scene","socket","emit","EFFECT_M_QUEUES","callUpdateWithEffectMapping11","_updateWithEffectMapping","opts","clearTimeout","opts11","a11","add","Set","setTimeout","updateCall11","placeable11","_object","document","tokenImgName11","getFlag","getFileName","texture","src","tokenDefaultImg11","animate11","disableTokenUpdateAnimation","tokenUpdateObj11","hadActiveHUD11","hasActiveHUD","toggleStatus11","hud","_statusEffects","effects11","ef31","findIndex","s11","mappings11","mapping11","evaluateMappingExpression","executeOnCallback11","deferredUpdateScripts11","script11","tv_script","onRemove","action","macroOnApply","onApply","macroOnRemove","ef111","ef211","disableImageUpdate11","disableImageChangeOnPolymorphed","disableImageUpdateOnNonPrototype","prototypeToken","tknImg11","newImg11","iSrc11","has","effect","stackStatusConfig","defaultImg","updateTokenImage","tokenUpdate","_postTokenUpdateProcessing","tv_executeScript","tvaUpdate","broadcastOverlayRedraw","scripts11","scr11","_toggleStatusEffects","applyTMFXPreset","applyCEEffect","executeMacro","includeDisabled11","unique11","mergeGroup","applicableGlobal11","globalMappings","actorType11","concat","userName","userName11","group11","visible","visible11","tokenMappings11","globalMappings11","updateToken11","updateGlobal11","updateMappings11","found11","overlayConfig11","updateSettings","actors","setFlag","drawOverlays","_getTemplateMappings","templateName11","templateMappings","t11","CORE_TEMPLATES","mappings","applyTemplate","templateMappings11","tm11","actMappings11","mergeMappings","removeTemplate","m211","unsetFlag","some","controlled","getHPChangeEffect","internals11","delta11","isNewerVersion","version","duration11","newHpValue11","systemHpPath","currentHpVal11","update","includeExpressions11","tokenInCombat11","combats","combat","started","actorLink","getEffectsFromActor","delta","items","_activePF2EItem","isSuppressed","evaluateComparatorEffects","evaluateStateEffects","evaluation11","equipped","isEquipped","RegExp","expression11","match11","currVal11","maxVal11","property11","sign11","isNaN","substring","isEmpty","isPercentage11","toCompare11","passed11","matched11","expressions11","split","exp11","deathIcon11","settings","overlayEffect","_findReplaceBracketWildcard","nExp11","lIndex11","indexOf","join","_testRegExEffect","effect11","re11","replace","replaceAll","test","mapping","arrExpression","temp","hasAdded","hasRemoved","exp","EXPRESSION_OPERATORS","evaluation","_getTokenHPv11","attributes11","actorData","$712a45c6d8b5799c$export$ab258e1978c780a6","$712a45c6d8b5799c$export$b055032cc483774b","$712a45c6d8b5799c$export$6628c94500a3bf7b","$712a45c6d8b5799c$export$ddc69df64ec0f5ef","$712a45c6d8b5799c$export$f558026a994b6051","$712a45c6d8b5799c$export$cb45a5664e48b54e","$712a45c6d8b5799c$export$fa17ec2953e9bd4a","$712a45c6d8b5799c$export$1144645bfcc7effc","$712a45c6d8b5799c$export$1474fedcea3afc96","$bhyh6","$3pmR9","$dxtrh","$aDMsz","$fVv34","$8MWlo","$3pMx9","debug","disableNotifs","searchPaths","cache","source","ForgeAPI","types","forgeSearchPaths","worldHud","displayOnlySharedImages","disableIfTHWEnabled","includeKeywords","updateActorImage","useNameSimilarity","includeWildcard","showFullPath","enableSideMenu","displayAsImage","imageOpacity","keywordSearch","excludedKeywords","runSearchOnPath","searchFilters","algorithm","exact","fuzzy","fuzzyLimit","fuzzyThreshold","fuzzyArtSelectPercentSlider","tokenConfigs","randomizer","actorCreate","tokenCreate","tokenCopyPaste","tokenName","keywords","shared","wildcard","representedActorDisable","linkedActorDisable","popupOnDisable","diffImages","syncImages","popup","disableAutoPopupOnActorCreate","disableAutoPopupOnTokenCreate","disableAutoPopupOnTokenCopyPaste","twoPopups","twoPopupsNoDialog","imgurClientId","staticCache","staticCacheFile","tilesEnabled","compendiumMapper","missingOnly","showImages","autoDisplayArtSelect","overrideCategory","category","missingImages","image","CONST","DEFAULT_TOKEN","searchOptions","permissions","popups","portrait_right_click","image_path_button","hudFullAccess","statusConfig","customImageCategories","displayEffectIconsOnHover","disableEffectIcons","filterCustomEffectIcons","filterIconList","updateTokenProto","imgNameContainsDimensions","imgNameContainsFADimensions","playVideoOnHover","pauseVideoOnHoverOut","invisibleImage","hideElevationTooltip","hideTokenBorder","EffectMappings","EffectIcons","Overlays","UserMappings","Wildcards","PopUpAndRandomize","HUD","HideElement","scope","default","onChange","registerAllHooks","registerAllWrappers","registerMenu","hint","restricted","systemHpPaths","lfg","worldbuilding","twodsix","Default","diff","$712a45c6d8b5799c$export$be92d635d4f8ae80","requiresImageCache","userRequiresImageCache","tkn","waitForTokenTexture","cacheImages","cacheFile","saveCache","tooltip","_getTooltipText","border","i18n","localize","ForgeSearchPaths","uid","BASE_IMAGE_CATEGORIES","cat","include","exclude","regex","paths","p","tiles","Hooks","once","nMappings","entries","randomID","combMappings","m","doc","filename","saveDataToFile","json","parse","portraitFilterInclude","Portrait","portraitFilterExclude","portraitFilterRegex","Token","tokenFilterInclude","tokenFilterExclude","tokenFilterRegex","PortraitAndToken","generalFilterInclude","generalFilterExclude","generalFilterRegex","$712a45c6d8b5799c$var$_refreshFilters","customCategories","updateTVAConfig","categories","newSettings","insertKeys","original","other","inner","_difference","v0","v1","t0","$712a45c6d8b5799c$var$_arrayEquality","d","reduce","obj","key","isDifferent","difference","a1","a2","every","$a5d3b883bf9e749e$export$313cceabf063c648","$a5d3b883bf9e749e$export$71ce8fbad5957261","$a5d3b883bf9e749e$export$bb3b35fb4fbd121a","$a5d3b883bf9e749e$export$a9fe6b4c86ebbf2c","$a5d3b883bf9e749e$export$9a81af9500bcd927","$a5d3b883bf9e749e$export$1396dd911f86baee","$a5d3b883bf9e749e$export$853901ce27596d97","$a5d3b883bf9e749e$export$e09b512eecac7579","$a5d3b883bf9e749e$export$2e69de36ed96343","$a5d3b883bf9e749e$export$cf2a4e460992a64b","$a5d3b883bf9e749e$export$99dcb6b6e71c8ec3","$a5d3b883bf9e749e$export$205603ad3b38424c","$a5d3b883bf9e749e$export$4569d268217979d8","$a5d3b883bf9e749e$export$a8ae171f556d108c","$a5d3b883bf9e749e$export$1cb6eb118298c3f6","$a5d3b883bf9e749e$export$7a9d66609c223fd8","$a5d3b883bf9e749e$export$245a8ae5fac6ab9","$a5d3b883bf9e749e$export$b7039c4b5522f566","$a5d3b883bf9e749e$export$fb85bc5d6d9ef19b","$a5d3b883bf9e749e$export$ac5608bbe92d6fdc","$a5d3b883bf9e749e$export$a3fc2fee1fd32b75","$a5d3b883bf9e749e$export$1933a9fe712fc1fd","$a5d3b883bf9e749e$export$e97747128355dc59","$a5d3b883bf9e749e$export$81af53b76c17cdd8","$a5d3b883bf9e749e$export$1a1482e70c3f8ffc","$a5d3b883bf9e749e$export$da928b76213541d1","$a5d3b883bf9e749e$export$4efd75b42b486b4d","$a5d3b883bf9e749e$export$e43fe9e17895939b","$a5d3b883bf9e749e$export$961a6e71d6289ec6","$a5d3b883bf9e749e$export$8a36ba247bf4b0d0","$a5d3b883bf9e749e$export$6fc760b2ad2335ff","$a5d3b883bf9e749e$export$5afaac5d3dad358c","$a5d3b883bf9e749e$export$c60cd2bc191c0655","$a5d3b883bf9e749e$export$7c70b8725990bcc9","$a5d3b883bf9e749e$export$1bad3b5e11592c24","$a5d3b883bf9e749e$export$2b4b146f5cd9519c","$a5d3b883bf9e749e$export$488134d4acacca33","$cs88A","$a5d3b883bf9e749e$var$simplifyRegex","PORTRAIT","PORTRAIT_AND_TOKEN","TILE","ITEM","JOURNAL","MACRO","$a5d3b883bf9e749e$export$b9f1c298ac3e67","popupOverride","$a5d3b883bf9e749e$var$BATCH_UPDATES","TOKEN_CALLBACKS","TOKEN_CONTEXT","ACTOR","ACTOR_CONTEXT","ticker","updateEmbeddedDocuments","then","cb","Actor","updateDocuments","$a5d3b883bf9e749e$export$2ab69819310737f7","$a5d3b883bf9e749e$export$fbec16849efa95ca","context","actorUpdate","pack","applyDefaultConfig","images","$a5d3b883bf9e749e$export$b62bf063b9928bd7","Math","floor","random","getDefaultConfig","configEntries","tokenData","fromEntries","constructDefaultConfig","origData","customConfig","flatOrigData","flattenObject","$a5d3b883bf9e749e$export$7fe60b94e2075390","dataToForm","flatCustomConfig","filtered","filterObject","k","startsWith","splitK","tokenUpdateObj","tokenCustomConfig","$a5d3b883bf9e749e$export$f5cd0e7fffe879fe","usingCustomConfig","defaultConfig","$a5d3b883bf9e749e$export$defc74b45e490df8","toObject","defConf","formToData","directUpdate","$a5d3b883bf9e749e$var$showTileArtSelect","tile","tileName","keyboard","downKeys","keybindings","editable","onDown","onUp","precedence","KEYBINDING_PRECEDENCE","NORMAL","modifiers","setting","DefaultTokenConfig","SETTING","foundry","PrototypeToken","TokenDocument","toggleTemplateDialog","flat","tvImgSrc","tvImgName","tokenConfig","path","imgConfig","$a5d3b883bf9e749e$export$5a727c8601678802","tcIndex","deleteConfig","pop","toLowerCase","word","extension","apiKey","resolve","reject","ForgeVTT","usingTheForge","url","FORGE_URL","xhr","XMLHttpRequest","withCredentials","open","setRequestHeader","getXSRFToken","responseType","onreadystatechange","readyState","response","onerror","error","message","formData","recursive","send","perm","role","checks","mesh","results","flattened","insertValues","overwrite","enforceTypes","_d","hasOwnProperty","$a5d3b883bf9e749e$var$_modMergeUpdate","$a5d3b883bf9e749e$var$_modMergeInsert","canInsert","tv","tx","speaker","ChatMessage","getSpeaker","character","ready","AsyncFunction","fn","notifications","macroName","execute","presetName","preset","addUpdateFilters","deleteFilters","hasFilterId","tokenDoc","apply","remove","uuid","effectInterface","addEffect","effectName","origin","removeEffect","toggleEffect","uuids","abs","mirrorX","mirrorY","addedEffects","removedEffects","newEffects","oldEffects","ef","browseOptions","bucket","keyPrefix","FilePicker","parseS3URL","browse","files","randomizerSettings","nameForgeSettings","nameForge","randomize","models","randomNames","modelKey","modelProp","model","createModel","generateName","renderTexture","$a5d3b883bf9e749e$var$captureToken","b64","renderer","extract","base64","res","fetch","blob","file","File","upload","viewPosition","_viewPosition","resize","screen","screenDimensions","stage","position","pan","RenderTexture","create","resolution","cacheParent","enableTempParent","updateTransform","disableTempParent","spritesToRender","skipUpdateTransform","clear","_onResize","linked","isToken","scenes","dimensions","parseFloat","parseInt","hexString","utils","string2hex","uri","decodeURI","decodeURIComponent","to","changedIDs","pID","$08fa2328c7dd0741$export$3f95c6f800b78024","$08fa2328c7dd0741$export$7515bad222171dd9","$7OP4c","$kPeJW","$08fa2328c7dd0741$var$MODULE_INITIALIZED","$08fa2328c7dd0741$var$onInit","$08fa2328c7dd0741$var$initialize","FONT_LOADING","loading","FontConfig","loadFont","editor","urls","removeChildren","c","destroy","bg","addChild","Graphics","startBatchUpdater","ArtSelect","executing","isResponsibleGM","isActive","getActiveTokens","search","force","preventClose","image1","image2","displayMode","IMAGE_DISPLAY","NONE","multipleSelection","allImages","isCaching","artSelects","windows","addToArtSelectQueue","doImageSearch","registerSettings","registerKeybinds","doRandomSearch","exportSettingsToJSON","assignUserSpecificImage","assignUserSpecificImageToSelected","unassignUserSpecificImage","unassignUserSpecificImageFromSelected","REGISTERED_HOOKS","REGISTERED_WRAPPERS","$5b14d0b148b3890b$export$9627cb8e26eb867b","$5b14d0b148b3890b$export$ccc8aa552c95ef88","$5b14d0b148b3890b$export$30665681cb9a2b60","$5b14d0b148b3890b$export$abbc2a15ff9ed201","$5b14d0b148b3890b$export$746cd8e50fad2f01","$7P4Bo","queue","callData","shift","$5b14d0b148b3890b$var$delay","ms","timer","instance","PORTRAIT_TOKEN","IMAGE","closeOnSubmit","WIDTH","HEIGHT","left","LEFT","TOP","getSearchOptions","constructorName","prototype","_typeSelect","_performSearch","Item","item","description","fuzzySearch","allButtons","Map","artFound","genLabel","str","indices","start","end","fillChar","fillStr","lastIndex","index","genTitle","percent","ceil","score","imageObj","vid","isVideo","isImage","hasConfig","displaySlider","toFixed","autoplay","boxes","hover","play","pause","currentTime","box","addEventListener","keyPressed","dataset","toggleClass","searchInput","focus","selectionStart","selectionEnd","getAttribute","appId","button","input","after","$5b20ddaff598079e$export$2e2bcd8739ae039","TokenConfig","updateData","form","fd","FormDataExtended","editors","detectionModes","_","tva_checkbox","attr","saved","setTokenConfig","applyCustomConfig","getTokenConfig","el","_onCheckboxChange","processFormGroup","formGroup","savedField","flatConfig","checkbox","before","_onRemoveConfig","activeElement","mutate","mutations","mutation","addedNodes","node","nodeName","className","observer","MutationObserver","observe","characterData","attributes","childList","subtree","$5b20ddaff598079e$var$onInputChange","css","parentNode","removeMarkedOverlays","interpolateColor","$8QbcE","tva_drawing_overlays","processedMappings11","m31","m111","overlays11","_markAllOverlaysForRemoval","overlaySort11","underlaySort11","sprite11","_findTVAOverlay","diff11","diffObject","setTexture","configuration","removeChild","layer11","primary","parent11","tvaRemove","addChildAuto","TVAOverlay","overlaySort","_removeAllOverlays","conf11","img11","generateImage","generateTextTexture","generateShapeTexture","loadTexture","images11","wildcardImageSearch","texture11","fallback","numRepeats11","repeat11","isPercentage","maxValue","increment","n11","rows11","maxRows11","maxRows","Infinity","xOffset11","yOffset11","paddingX11","paddingX","paddingY11","paddingY","container11","Container","Sprite","perRow","_renderContainer","resolution11","width11","height11","bounds11","getLocalBounds","matrix11","Matrix","ty","renderTexture11","transform","destroyable","_drawShape","graphics11","drawRoundedRect","drawEllipse","drawPolygon","i11","drawTorus","toRadians","PI","shapes11","obj11","beginFill","lineStyle","string2Hex","shapesWidth","shapesHeight","Texture","EMPTY","x11","y11","innerRadius11","outerRadius11","startArc11","endArc11","drawCircle","beginHole","endHole","finishPoly","arc","minColor11","interpolate11","rString11","_interpolateV10","percentage11","maxColor11","minHsv11","rgb2hsv","maxHsv11","deltaHue11","deltaAngle11","targetHue11","targetSaturation11","targetValue11","result11","h","toHex","toNumber","hex2rgb","fromHSV","r11","g11","b11","h11","CORE_VARIABLES","grid","_evaluateString","str11","variables11","re211","substr","_executeString","evalString","result","k11","_evaluateObjExpressions","evalString11","tmp11","style11","PreciseText","getTextStyle","text11","updateText","curve11","textLabel","letterSpacing11","radius11","maxRopePoints11","step11","ropePoints11","round","points11","cos","sin","Point","rope11","SimpleRope","child11","sprites11","actorId11","$4rd87","$1u5p6","$8ZZXW","TokenMesh","pTexture11","pseudoTexture","addHTMLOverlay","_registerHooks","_tvaPlay","_customVisible","eventMode","enableInteractivity","mouseInteractionManager","removeAllListeners","cursor","runInteraction11","preventDefault","stopPropagation","toggleCEEffect","toggleTMFXPreset","permissions11","hoverIn","hoverOut","clickLeft","clickLeft2","clickRight","clickRight2","dragStart","callbacks11","dragLeftStart","dragLeftMove","dragLeftDrop","dragLeftCancel","dragRightStart","dragRightMove","dragRightDrop","dragRightCancel","longPress","mgr11","MouseInteractionManager","owner","speaker11","limitOnHover","limitOnControl","limitOnHighlight","limitOnHUD","limitOnTarget","limitOnAnyTarget","ruler","_state","Ruler","STATES","INACTIVE","highlightObjects","_highlight","targeted","_lastSortedIndex","elevation","elevation11","source11","tagName","cloneNode","onended","tvaVideoEnded","oncanplay","resourceOptions","autoPlay","volume","playing","video","children11","refresh11","configuration11","_swapChildren","originalTexture","_destroyTexture","fullRefresh","fullRefresh11","previewTexture11","stop","dimensions11","scale11","aspect11","w","xOff11","yOff11","pivot","pOffsetX11","pOffsetX","pOffsetY11","pOffsetY","anchor11","pWidth11","pHeight11","tint11","stopAnimation","_applyFilters","children","ch11","_activateTicker","_deactivateTicker","updatePosition","UPDATE_PRIORITY","HIGH","coord11","canvasCoordinatesFromClient","innerWidth","innerHeight","filter11","FilterClass11","args11","applyTVAFilters","constructTMFXFilters","removeTVAFilters","applyReverseMask","removeReverseMask","f11","tvaReverse","filters11","reverseMask11","ReverseMaskFilter","uMaskSampler","tokensRenderTexture","channel","tvaFilter","animationName","CanvasAnimation","terminateAnimation","sourceId","newAngle11","rotate11","attribute","completed11","registerOverlayRefreshHook","unregisterOverlayRefreshHooks","to11","from11","removeHTMLOverlay","baseTexture","resource","calculateTrimmedVertices","HTMLOverlay","paramsArray","TMFXFilterTypes","rank","filterInternalId","gms","user11","filterOwner","updateId","filterClass","getTMFXFilter","assignPlaceable","targetPlaceable","placeableImg","_TMFXsetAnimeFlag","LOADED_TMFXFilters","className11","fxModule11","adjustment","distortion","oldfilm","glow","outline","bevel","xbloom","shadow","twist","zoomblur","bulgepinch","zapshadow","ray","fog","xfog","electric","wave","shockwave","fire","fumes","smoke","flood","field","xray","liquid","xglow","pixel","web","ripples","globes","splash","polymorph","xfire","replaceColor","ddTint","createFragmentShader","CONSTANTS","WAVE","performance","mode","CANVAS_PERFORMANCE_MODES","LOW","MED","$114cc8e60adcf175$export$dfc93b4a68593ad7","$114cc8e60adcf175$export$eb523686b30ccac9","$114cc8e60adcf175$export$83fe15bb1b8a7c6e","$114cc8e60adcf175$var$feature_id","child","hudRendered","$114cc8e60adcf175$var$REFRESH_HOOKS","hookName","unregister","hook","container","renderQueue","hudReady","force11","element","renderTemplate","left11","top11","angle11","origin11","ratio11","position11","listeners","_templateCache","_compile","stringHTML11","Handlebars","compile","constructTemplate","ovConfig11","compiled11","registerPartial","template11","log","allowProtoMethodsByDefault","allowProtoPropertiesByDefault","$a4e70777a71079ac$export$886510d4c7ede60a","$a4e70777a71079ac$export$d94509b1766d8915","$a4e70777a71079ac$export$edf411798a018b13","$a4e70777a71079ac$export$bcab441347d0cde","$aVtQz","$6Jwr7","$1MaGd","$7Bay0","$4VMEk","$aTVyJ","info","num","off","registerEffectIconHooks","registerOverlayHooks","registerArtSelectButtonHooks","registerHUDHooks","registerWildcardHooks","registerUserMappingHooks","registerPopRandomizeHooks","$7f466139f88e16a7$export$2d8503e635b61305","$7f466139f88e16a7$var$feature_id","$4e701b3a6ed20c89$export$802e6d785977eba8","$4e701b3a6ed20c89$var$feature_id","$4e701b3a6ed20c89$var$_modActorSheet","$4e701b3a6ed20c89$var$_modItemSheet","$4e701b3a6ed20c89$var$_modJournalSheet","$4e701b3a6ed20c89$var$_modRollTableSheet","$4e701b3a6ed20c89$var$_modTileConfig","$4e701b3a6ed20c89$var$_modTemplateConfig","$4e701b3a6ed20c89$var$_modTokenConfig","$4e701b3a6ed20c89$var$_modDrawingConfig","$4e701b3a6ed20c89$var$_modNoteConfig","$4e701b3a6ed20c89$var$_modSceneConfig","$4e701b3a6ed20c89$var$_modMacroConfig","$4e701b3a6ed20c89$var$_modActiveEffectConfig","insertArtSelectButton","tileConfig","effectConfig","inserted","itemSheet","macroConfig","journalSheet","journal","sheet","table","_onSubmit","actorSheet","profile","profileQueries","pf2e","query","querySelector","ev","$14b28eedf6a68dc7$export$c5e0f603443ce4af","$io0n7","$6aWyX","$14b28eedf6a68dc7$var$feature_id","renderTileHUD","renderTokenHUD","$d62ac1bb767e4dbd$export$1ae1322ef97d28bb","$byeN2","$aBy72","tileData","searchText","fp_files","hudSettings","last","$d62ac1bb767e4dbd$var$_deactivateTokenVariantsSideSelector","$d62ac1bb767e4dbd$var$_onButtonClick","contextmenu","$d62ac1bb767e4dbd$var$_onButtonRightClick","$d62ac1bb767e4dbd$var$setNameDialog","variantsWrap","hasClass","$d62ac1bb767e4dbd$var$renderSideSelect","contextMenu","$d62ac1bb767e4dbd$var$_onImageSearchKeyUp","fp","activeSource","f","sideSelect","controlIcon","dataAction","worldHudSettings","FULL_ACCESS","variants","imageDuplicates","pushImage","variant","names","directoryFlag","dirFlagImages","noSearch","artSearch","tileImageName","imagesParsed","userMappings","style","$d62ac1bb767e4dbd$var$genTitleAndStyle","route","used","unknownType","imageDisplay","$d62ac1bb767e4dbd$var$_onImageClick","$d62ac1bb767e4dbd$var$_onImageRightClick","imgButton","regenStyle","del","updated","fNames","keyCode","Ok","$868e57a95aec1c35$export$2e2bcd8739ae039","Tile","objectToFlag","isTile","disableNameSearch","directory","popupsSetFlag","disableNameSearchSetFlag","directorySource","directorySetFlag","sourceEl","flag","$66601058d336fefc$export$ee0468762b49c68b","$66601058d336fefc$export$4f3cb237ec0aee8a","$66601058d336fefc$export$54814896b5b3f706","$66601058d336fefc$export$829ee1305b7ab4f9","$66601058d336fefc$export$78c2454638ec157e","$66601058d336fefc$export$7a1d85371c4f69","$66601058d336fefc$export$10bf6393bd6f131d","$RzsBm","$66601058d336fefc$var$caching","$66601058d336fefc$var$CACHED_IMAGES","simpleResults","searches","parseKeywords","reverse","usedImages","$66601058d336fefc$var$findImages","pathObj","randomizerOptions","flattenSearchResults","$66601058d336fefc$var$_randSearchUtil","randImageNum","fuse","Fuse","minMatchCharLength","ignoreLocation","fResults","randSettings","actorName","delete","sharedVariants","sv","protoImg","getTokenImages","_tokenImages","wildcardImages","$66601058d336fefc$var$walkFindImages","found_images","typeKey","callForgeVTT","headers","Authorization","Accept","success","rtName","link","$66601058d336fefc$var$_addToFound","decodeURISafely","catch","tables","contents","t","baseTableData","rtPath","rollTableName","format","tags","tokenSrc","f_dir","dirs","$66601058d336fefc$var$walkAllPaths","$66601058d336fefc$var$_filterPathsByType","getUserId","share","forceSearchName","getFilters","includeScore","includeMatches","imgObj","$66601058d336fefc$var$_imagePassesFilter","getIndex","docs","r","matches","$66601058d336fefc$var$findImagesExact","simpleName","simplifyName","matchedImages","imgOBj","$66601058d336fefc$var$_exactSearchMatchesImage","sOptions","simplifiedSearch","imagePath","imageName","simplified","simplifyPath","decodeURIComponentSafely","getFileNameWithExt","caches","getFilePath","isInitialized","$66601058d336fefc$var$_readCacheFromFile","imageCount","count","fileName","jQuery","getJSON","$0a1075082161df65$var$ownKeys","enumerableOnly","getOwnPropertySymbols","symbols","sym","getOwnPropertyDescriptor","$0a1075082161df65$var$_objectSpread2","arguments","$0a1075082161df65$var$_defineProperty","getOwnPropertyDescriptors","defineProperties","$0a1075082161df65$var$_typeof","Symbol","iterator","$0a1075082161df65$var$_classCallCheck","Constructor","TypeError","$0a1075082161df65$var$_defineProperties","props","descriptor","writable","$0a1075082161df65$var$_createClass","protoProps","staticProps","$0a1075082161df65$var$_inherits","subClass","superClass","$0a1075082161df65$var$_setPrototypeOf","$0a1075082161df65$var$_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","$0a1075082161df65$var$_isNativeReflectConstruct","Reflect","construct","sham","Proxy","valueOf","$0a1075082161df65$var$_assertThisInitialized","ReferenceError","$0a1075082161df65$var$_possibleConstructorReturn","$0a1075082161df65$var$_createSuper","Derived","hasNativeReflectConstruct","Super","NewTarget","$0a1075082161df65$var$_toConsumableArray","arr","$0a1075082161df65$var$_arrayWithoutHoles","$0a1075082161df65$var$_iterableToArray","$0a1075082161df65$var$_unsupportedIterableToArray","$0a1075082161df65$var$_nonIterableSpread","$0a1075082161df65$var$_arrayLikeToArray","iter","minLen","len","arr2","$0a1075082161df65$var$isArray","$0a1075082161df65$var$getTag","$0a1075082161df65$export$93605f466b8506d8","$0a1075082161df65$var$INFINITY","$0a1075082161df65$var$baseToString","$0a1075082161df65$var$toString","$0a1075082161df65$var$isString","$0a1075082161df65$var$isNumber","$0a1075082161df65$var$isBoolean","$0a1075082161df65$var$isObjectLike","$0a1075082161df65$var$isObject","$0a1075082161df65$var$isDefined","$0a1075082161df65$var$isBlank","$0a1075082161df65$var$INCORRECT_INDEX_TYPE","$0a1075082161df65$var$LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY","$0a1075082161df65$var$PATTERN_LENGTH_TOO_LARGE","$0a1075082161df65$var$MISSING_KEY_PROPERTY","$0a1075082161df65$var$INVALID_KEY_WEIGHT_VALUE","$0a1075082161df65$var$hasOwn","$0a1075082161df65$var$KeyStore","KeyStore","_this","_keys","_keyMap","totalWeight","$0a1075082161df65$var$createKey","weight","keyId","$0a1075082161df65$var$createKeyPath","$0a1075082161df65$var$createKeyId","$0a1075082161df65$var$MatchOptions","findAllMatches","$0a1075082161df65$var$FuzzyOptions","location","$0a1075082161df65$var$AdvancedOptions","useExtendedSearch","getFn","list","deepGet","ignoreFieldNorm","fieldNormWeight","$0a1075082161df65$var$Config","isCaseSensitive","shouldSort","sortFn","a","b","idx","$0a1075082161df65$var$SPACE","$0a1075082161df65$var$norm","mantissa","pow","numTokens","norm","$0a1075082161df65$var$FuseIndex","FuseIndex","_ref","_ref$getFn","_ref$fieldNormWeight","isCreated","setIndexRecords","records","_keysMap","_this2","docIndex","_addString","_addObject","record","_this3","keyIndex","subRecords","stack","nestedArrIndex","_stack$pop","_value","subRecord","$0a1075082161df65$var$createIndex","_ref2","_ref2$getFn","_ref2$fieldNormWeight","myIndex","setKeys","setSources","$0a1075082161df65$var$parseIndex","_ref3","_ref3$getFn","_ref3$fieldNormWeight","$0a1075082161df65$var$computeScore$1","pattern","_ref$errors","errors","_ref$currentLocation","currentLocation","_ref$expectedLocation","expectedLocation","_ref$distance","_ref$ignoreLocation","accuracy","proximity","$0a1075082161df65$var$convertMaskToIndices","matchmask","$0a1075082161df65$var$MAX_BITS","$0a1075082161df65$var$search","patternAlphabet","_ref$location","_ref$threshold","_ref$findAllMatches","_ref$minMatchCharLeng","_ref$includeMatches","patternLen","textLen","currentThreshold","bestLocation","computeMatches","matchMask","lastBitArr","finalScore","binMax","mask","_i","binMin","binMid","_score2","finish","bitArr","j","charMatch","_score","isMatch","$0a1075082161df65$var$createPatternAlphabet","_char","$0a1075082161df65$var$BitapSearch","BitapSearch","_ref$isCaseSensitive","chunks","addChunk","startIndex","alphabet","remainder","_this$options","_result","_this$options2","allIndices","totalScore","hasMatches","_search","$0a1075082161df65$var$BaseMatch","BaseMatch","$0a1075082161df65$var$getMatch","multiRegex","singleRegex","$0a1075082161df65$var$ExactMatch","_BaseMatch","ExactMatch","_super","$0a1075082161df65$var$InverseExactMatch","InverseExactMatch","$0a1075082161df65$var$PrefixExactMatch","PrefixExactMatch","$0a1075082161df65$var$InversePrefixExactMatch","InversePrefixExactMatch","$0a1075082161df65$var$SuffixExactMatch","SuffixExactMatch","endsWith","$0a1075082161df65$var$InverseSuffixExactMatch","InverseSuffixExactMatch","$0a1075082161df65$var$FuzzyMatch","FuzzyMatch","_bitapSearch","searchIn","$0a1075082161df65$var$IncludeMatch","IncludeMatch","$0a1075082161df65$var$searchers","$0a1075082161df65$var$searchersLen","$0a1075082161df65$var$SPACE_RE","$0a1075082161df65$var$OR_TOKEN","$0a1075082161df65$var$parseQuery","queryItem","found","searcher","isMultiMatch","_searcher","isSingleMatch","$0a1075082161df65$var$MultiMatchSet","$0a1075082161df65$var$ExtendedSearch","ExtendedSearch","numMatches","qLen","searchers","pLen","_searcher$search","$0a1075082161df65$var$registeredSearchers","$0a1075082161df65$var$register","$0a1075082161df65$var$createSearcher","searcherClass","condition","$0a1075082161df65$var$LogicalOperator","AND","OR","$0a1075082161df65$var$KeyType","PATH","PATTERN","$0a1075082161df65$var$isExpression","$0a1075082161df65$var$isPath","$0a1075082161df65$var$isLeaf","$0a1075082161df65$var$convertToExplicit","$0a1075082161df65$var$parse","_ref3$auto","auto","next","isQueryPath","operator","$0a1075082161df65$var$computeScore","_ref$ignoreFieldNorm","EPSILON","$0a1075082161df65$var$transformMatches","refIndex","$0a1075082161df65$var$transformScore","$0a1075082161df65$var$format","_ref$includeScore","transformers","transformer","$0a1075082161df65$var$Fuse$1","_keyStore","setCollection","_docs","_myIndex","predicate","removeAt","_ref$limit","limit","_searchStringList","_searchObjectList","_searchLogical","_searcher$searchIn","evaluate","_findMatches","getValueForItemAtKeyId","resultMap","expResults","_ref4","_resultMap$idx$matche","_this$_myIndex","_ref5","_ref6","_ref7","_searcher$searchIn2","_searcher$searchIn3","createIndex","parseIndex","parseQuery","$7b87d21eb93bfe57$export$2e2bcd8739ae039","avatar","affectedImages","$47f11a959bac7657$export$584c9acde3dd56ba","$47f11a959bac7657$export$42b0bd17e532cdc8","$9Z21J","$47f11a959bac7657$var$activateStatusEffectListeners","PARTIAL_ACCESS","disableHUDButton","tokenActor","randomImg","$47f11a959bac7657$var$_deactivateTokenVariantsSideSelector","$47f11a959bac7657$var$_onButtonClick","$47f11a959bac7657$var$_onButtonRightClick","$47f11a959bac7657$var$renderSideSelect","$47f11a959bac7657$var$_onImageSearchKeyUp","actorVariants","$47f11a959bac7657$var$getVariants","tokenImageName","$47f11a959bac7657$var$genTitleAndStyle","tokenHud","$47f11a959bac7657$var$_onImageClick","$47f11a959bac7657$var$_onImageRightClick","toggleCog","cog","$47f11a959bac7657$var$updateActorWithSimilarName","$47f11a959bac7657$var$setVariants","findImagesFuzzy","createMapping","$ae66c8e3e88183ab$var$TOGGLED_GROUPS","$ae66c8e3e88183ab$export$2e2bcd8739ae039","$ae66c8e3e88183ab$export$94ded7fcdb9fe2e4","$b9QOF","$4pjFr","$fTFXO","$ae66c8e3e88183ab$var$NO_IMAGE","scrollY","_processConfig","hasTokenConfig","hasCodeExp","highlightedExpression","$ae66c8e3e88183ab$var$highlightOperators","hasScript","tokensString","tokenIDs","NO_IMAGE","effectMappings","_getNewEffectConfig","m1","m2","priorityDiff","localeCompare","sMappings","groupedMappings","groups","_onRemove","_onClone","_onCreate","_onSaveMappings","_onImageClick","mousedown","_onImageMouseDown","_onConfigureApplicableActors","_onImageRightClick","_onConfigClick","_onConfigEditClick","_onConfigScriptClick","_onOverlayConfigClick","_onOverlayConfigRightClick","_onOverlayChange","_onExpressionChange","_onGroupToggle","groupName","_onDisable","_onGroupDisable","_onGroupDelete","_onGroupChange","_onExpressionSwitch","focusout","Application","RENDER_STATES","RENDERED","_onTokensRemove","li","currentTarget","divInput","disableGroupToggle","checkboxes","numChecked","chks","toggle","innerText","childNodes","sel","getSelection","focusNode","focusOffset","ch","$ae66c8e3e88183ab$var$setCaretPosition","gear","showOverlayJsonConfigDialog","_toggleActiveControls","configEdit","scriptEdit","_removeImage","which","current","clone","DEFAULT_ACTIVE_EFFECT_CONFIG","_exportConfigs","_importConfigs","Templates","templateName","_insertMappings","_copyGlobalConfig","showTokenCaptureDialog","entity","dialog","import","readTextFromFile","migrateMappings","no","showMappingSelectDialog","title1","title2","buttonTitle","cMappings","actorTypes","entityTypes","documentTypes","typeLabels","act","String","fromCharCode","re","op","pos","nodeType","range","createRange","setStart","collapse","removeAllRanges","addRange","$81f98126905c9c34$export$2e2bcd8739ae039","_validateJSON","shiftKey","_onFormat","submit","$3358c0bca9192065$export$2e2bcd8739ae039","$910e697db31bb090$export$d4bc2f83b9e95fdf","$910e697db31bb090$export$184d7e04bfe8244d","$910e697db31bb090$export$1d34adfb3ae1b","$910e697db31bb090$export$e032b3f67a64b8e9","$910e697db31bb090$export$398865504eddc155","$910e697db31bb090$export$667fc7c48dd97753","$910e697db31bb090$export$51c95b54ea3e6a53","yes","typesInput","selectedTypes","splits","currSplit","configInput","conf","uploadTokenImage","mappingGroups","selectedMappings","cMapping","cancel","$cd36ded98345a0c2$export$8af7a3ae7ecba113","$b92c8b33d06c705b$export$b78c417a59fec2a7","templates","$b92c8b33d06c705b$var$communityTemplates","allowDelete","allowCreate","allowCopy","appWindow","windowPos","$b92c8b33d06c705b$var$getTemplateFromFileURL","createdBy","fileURL","showUserTemplateCreateDialog","$b92c8b33d06c705b$var$TemplateSubmissionForm","pk","k2","k1","k3","systemID","systemTitle","$b92c8b33d06c705b$var$submitTemplate","$b92c8b33d06c705b$var$_setStringField","fields","stringValue","createTime","integerValue","Date","getTime","approved","booleanValue","method","body","ok","status","$b92c8b33d06c705b$var$SEARCH_QUERY","structuredQuery","select","fieldPath","where","fieldFilter","collectionId","orderBy","documents","$b92c8b33d06c705b$var$_docToTemplate","$744b620dabd5c2e6$export$2e2bcd8739ae039","hasSettings","nameForgeActive","_selectNameForgeModels","inputSelected","genCheckbox","defaultModels","userModels","selectedModels","submitter","expanded","$58842ba3ff7a72d1$export$891f7c0c71a87222","$58842ba3ff7a72d1$var$feature_id","$58842ba3ff7a72d1$var$_updateToken","$58842ba3ff7a72d1$var$_updateTile","$58842ba3ff7a72d1$var$_sightRefresh","draw","visibility","restrictVisibility","$58842ba3ff7a72d1$var$_isInvisible","$3972390c18f47754$export$ca2abc1047677dc9","$3972390c18f47754$var$feature_id","$3972390c18f47754$var$_renderTokenConfig","$3972390c18f47754$var$_preCreateToken","checkboxRandomize","tvaFieldset","rdmImgFormGroup","showHideGroup","tokenDocument","updateSource","$7efbb077f7553c7f$export$419d00c58c7e40a5","$7efbb077f7553c7f$var$feature_id","$7efbb077f7553c7f$var$_createActor","$7efbb077f7553c7f$var$_createToken","actorRandSettings","vDown","flagTarget","popupFlag","performRandomSearch","$7efbb077f7553c7f$var$_disableRandomSearchForType","randomName","nameForgeRandomize","imgPortrait","doSyncSearch","tokenToPortrait","dirKeyDown","$7efbb077f7553c7f$var$_disablePopupForType","$7efbb077f7553c7f$var$_twoPopupPrompt","imgToken","actTokens","one","two","$27c95aabd6b0cb79$export$fc1d449abe42f670","$27c95aabd6b0cb79$export$4e224afa9c6f52f3","$27c95aabd6b0cb79$export$d52c0d8a14cf2845","$27c95aabd6b0cb79$export$84e6c54a990a03d8","$fFpXf","$9znht","$56MAr","libWrapper","registerUserMappingWrappers","registerEffectIconWrappers","registerHUDWrappers","registerHideElementWrappers","$b67ed160259a7178$export$3a8ef264ac3111f8","$b67ed160259a7178$var$feature_id","unregisterWrapper","registerWrapper","$b67ed160259a7178$var$_drawEffects_fullReplace","$b67ed160259a7178$var$_drawEffects_hoverOnly","$b67ed160259a7178$var$_drawEffects","$b67ed160259a7178$var$_combatTrackerGetData","wrapped","turns","turn","restrictedEffects","$b67ed160259a7178$var$_getRestrictedEffects","temporaryEffects","statuses","specialStatusEffects","DEFEATED","renderable","tokenEffects","actorEffects","promises","_drawEffect","_drawOverlay","_refreshEffects","$6f79710a2c22071f$export$ad041355fd382ef2","$6f79710a2c22071f$var$feature_id","$6f79710a2c22071f$var$_getTooltipText","$6f79710a2c22071f$var$_refreshVisibility","$3b83339781f1ddc1$export$4ed4ca6a96642941","$3b83339781f1ddc1$var$feature_id","$3b83339781f1ddc1$var$_clear","$3b83339781f1ddc1$var$_applyVariantFlags","TOKEN_HUD_VARIANTS","$8b98447900c587c7$export$9d1b0e5bb156c053","reticleOverlay","hitTest","_onReticleMove","isMouseDown","getLocalPosition","tCoord","dx","dy","$8b98447900c587c7$var$rotate","$8b98447900c587c7$var$round","pWidth","pHeight","minimizeApps","minimize","maximizeApps","maximize","deactivate","interaction","plugins","cursorStyles","hitArea","rect","interactive","zIndex","originalEvent","nativeEvent","$8b98447900c587c7$var$displayControlDialog","CLOSED","anchorX","anchorY","number","cx","cy","radians","$f294011ce9211d57$export$1a9a3a33e776f780","$f294011ce9211d57$export$649a7855fe41be7","$f294011ce9211d57$export$b035d326d57db09a","$f294011ce9211d57$export$c27a4515fabd8fad","$f294011ce9211d57$export$779b84c2df9c577f","$f294011ce9211d57$var$feature_id","$f294011ce9211d57$var$_draw","previous","tva_iconOverride","$f294011ce9211d57$var$overrideVisibility","tva_customVisibility","originalIsVisible","$f294011ce9211d57$var$_getIsVisibleDescriptor","isVisible","iObj","u","$9db5316d801b7bc5$export$2e2bcd8739ae039","$2jMtH","$9db5316d801b7bc5$var$autoApply","typeOverride","portraitFound","ignorePortrait","tokenFound","ignoreToken","compendium","$9db5316d801b7bc5$var$addToArtSelectQueue","addToQueue","_fixSearchPaths","supportedPacks","packs","documentName","collection","compendiums","_onCategoryOverride","_onAutoApply","_onDiffImages","_onSearchOptions","_onMissingImages","_onCompendiumSelect","searchAlgorithm","features","misc","activeEffects","startMapping","processItem","originalSearchPaths","endMapping","missingImageList","mi","artSelectDisplayed","getDocument","hasPortrait","hasToken","includeThisActor","includeThisToken","autoApply","schema","hasImage","imageFound","allItems","processing","stopProcessing","processed","counter","startProcessing","renderFromQueue","spinner","tasks","$b9844373b5bc97a8$export$2e2bcd8739ae039","dummySettings","enabledTabs","_pathIcon","disable","tokenToPortraitDisabled","allTypes","tempTypes","tokenHUDWildcardActive","enableStatusConfig","pathfinder","dnd5e","_onCreatePath","_onSearchSourceTextChange","_onDeletePath","_onConvertImgurPath","_onConvertJsonPath","_onBrowseFolder","showPathSelectCategoryDialog","showPathSelectConfigForm","_validateRegex","algorithmTab","_toggle","tab","staticOn","staticFile","_validRegex","backgroundColor","pathInput","sourceInput","bucketName","s3","endpoint","protocol","host","rollTable","tableName","albumHash","hostname","resultsArray","drawn","RollTable","replacement","displayRoll","jsonPath","row","_reIndexPaths","imgur","imgurControl","jsonControl","$b9844373b5bc97a8$export$a503acf01ac4867a","$b9844373b5bc97a8$var$_mergeUpdate","$b9844373b5bc97a8$var$_mergeInsertFix","$1b02f5d547721e51$export$2e2bcd8739ae039","_processFormData","duplicates","$836bde882c8ca1a7$export$5713be0477a7b0d8","dragDrop","dragSelector","dropSelector","_getPaths","forgePaths","_onReset","_onUpdate","event1","_updatePaths","_cleanPaths","uniquePaths","$27b56faf6a0f3c08$export$2e2bcd8739ae039","$7bf322fefda9f6a3$export$2e2bcd8739ae039","_importFromJSONDialog","importSettingsFromJSON"],"version":3,"file":"bundle.js.map"}
|