{"version":3,"file":"refine-stimulus.modern.js","sources":["../../../node_modules/@hotwired/stimulus-webpack-helpers/dist/stimulus-webpack-helpers.js","../../javascript/controllers/refine/server-refresh-controller.js","../../javascript/controllers/refine/add-controller.js","../../javascript/controllers/refine/criterion-form-controller.js","../../javascript/controllers/refine/defaults-controller.js","../../javascript/controllers/refine/delete-controller.js","../../javascript/controllers/refine/filter-pills-controller.js","../../javascript/controllers/refine/popup-controller.js","../../javascript/controllers/refine/modal-controller.js","../../javascript/controllers/refine/search-filter-controller.js","../../javascript/refine/helpers/index.js","../../javascript/controllers/refine/state-controller.js","../../javascript/controllers/refine/stored-filter-controller.js","../../javascript/controllers/refine/submit-form-controller.js","../../javascript/controllers/refine/toggle-controller.js","../../javascript/controllers/refine/turbo-stream-form-controller.js","../../javascript/controllers/refine/turbo-stream-link-controller.js","../../javascript/controllers/refine/typeahead-list-controller.js","../../javascript/controllers/refine/update-controller.js","../../javascript/controllers/refine/date-controller.js","../../javascript/controllers/index.js"],"sourcesContent":["/*\nStimulus Webpack Helpers 1.0.0\nCopyright © 2021 Basecamp, LLC\n */\nfunction definitionsFromContext(context) {\n return context.keys()\n .map((key) => definitionForModuleWithContextAndKey(context, key))\n .filter((value) => value);\n}\nfunction definitionForModuleWithContextAndKey(context, key) {\n const identifier = identifierForContextKey(key);\n if (identifier) {\n return definitionForModuleAndIdentifier(context(key), identifier);\n }\n}\nfunction definitionForModuleAndIdentifier(module, identifier) {\n const controllerConstructor = module.default;\n if (typeof controllerConstructor == \"function\") {\n return { identifier, controllerConstructor };\n }\n}\nfunction identifierForContextKey(key) {\n const logicalName = (key.match(/^(?:\\.\\/)?(.+)(?:[_-]controller\\..+?)$/) || [])[1];\n if (logicalName) {\n return logicalName.replace(/_/g, \"-\").replace(/\\//g, \"--\");\n }\n}\n\nexport { definitionForModuleAndIdentifier, definitionForModuleWithContextAndKey, definitionsFromContext, identifierForContextKey };\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n\n// Base class for controllers that reload form content from the server\nexport default class extends Controller {\n connect() {\n this.state.finishUpdate()\n }\n\n get state() {\n let currentElement = this.element\n\n while(currentElement !== document.body) {\n if (currentElement.matches('[data-controller~=\"refine--state\"]'))\n return this.application.getControllerForElementAndIdentifier(currentElement, 'refine--state')\n else {\n currentElement = currentElement.parentNode\n }\n }\n\n return null\n }\n\n async refreshFromServer(options = {}) {\n const { includeErrors } = options\n this.state.startUpdate()\n const request = new FetchRequest(\n \"GET\",\n this.state.refreshUrlValue,\n {\n responseKind: \"turbo-stream\",\n query: {\n \"refine_filters_builder[filter_class]\": this.state.filterName,\n \"refine_filters_builder[blueprint_json]\": JSON.stringify(this.state.blueprint),\n \"refine_filters_builder[client_id]\": this.state.clientIdValue,\n include_errors: !!includeErrors\n }\n }\n )\n await request.perform()\n }\n}\n","import ServerRefreshController from './server-refresh-controller'\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends ServerRefreshController {\n static values = {\n previousCriterionId: Number,\n }\n\n async criterion() {\n const isValid = await this.validateBlueprint()\n if (isValid) {\n this.state.addCriterion(this.previousCriterionIdValue)\n }\n this.refreshFromServer({includeErrors: !isValid})\n }\n\n async group() {\n const isValid = await this.validateBlueprint()\n if (isValid) {\n this.state.addGroup()\n }\n this.refreshFromServer({includeErrors: !isValid})\n }\n\n async validateBlueprint(blueprint) {\n const { state } = this\n\n const request = new FetchRequest(\n \"GET\",\n this.state.validateBlueprintUrlValue,\n {\n query: {\n \"refine_filters_builder[filter_class]\": this.state.filterName,\n \"refine_filters_builder[blueprint_json]\": JSON.stringify(this.state.blueprint),\n \"refine_filters_builder[client_id]\": this.state.clientIdValue\n }\n }\n )\n const response = await request.perform()\n return response.ok\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n This controller handles criteria forms\n (refine/inline/criteria/new|edit)\n*/\nexport default class extends Controller {\n static values = {\n url: String,\n formId: String\n }\n\n async refresh(_event) {\n // update the url with params from the form\n const formElement = document.getElementById(this.formIdValue)\n const formData = new FormData(formElement)\n\n const request = new FetchRequest(\n \"GET\",\n this.urlValue,\n {\n query: formData,\n responseKind: \"turbo-stream\"\n }\n )\n const response = await request.perform()\n }\n\n\n\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static values = {\n criterionId: Number,\n input: Object,\n };\n\n connect() {\n this.state = this.getStateController()\n\n this.state.updateInput(\n this.criterionIdValue,\n this.inputValue,\n );\n }\n\n getStateController() {\n let currentElement = this.element\n\n while(currentElement !== document.body) {\n const controller = this.application.getControllerForElementAndIdentifier(currentElement, 'refine--state')\n if (controller) {\n return controller\n } else {\n currentElement = currentElement.parentNode\n }\n }\n\n return null\n }\n}\n","import ServerRefreshController from './server-refresh-controller';\n\nexport default class extends ServerRefreshController {\n static values = {\n criterionId: Number,\n }\n\n criterion() {\n const { state, criterionIdValue } = this;\n state.deleteCriterion(criterionIdValue);\n this.refreshFromServer()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends Controller {\n static values = {\n submitUrl: String\n }\n\n connect() {\n const urlParams = new URLSearchParams(window.location.search)\n this.existingParams = urlParams\n this.existingParams.delete('stable_id')\n }\n\n delete(event) {\n const { criterionId } = event.currentTarget.dataset\n var index = parseInt(criterionId)\n this.stateController.deleteCriterion(index)\n this.reloadPage()\n }\n\n async reloadPage() {\n const {blueprint} = this.stateController\n const request = new FetchRequest(\n \"POST\",\n this.submitUrlValue,\n {\n responseKind: \"turbo-stream\",\n body: JSON.stringify({\n refine_filters_builder: {\n filter_class: this.stateController.filterName,\n blueprint_json: JSON.stringify(blueprint),\n client_id: this.stateController.clientIdValue\n }\n })\n }\n )\n await request.perform()\n }\n\n redirectToStableId(stableId) {\n const params = new URLSearchParams()\n if (stableId) {\n params.append('stable_id', stableId)\n }\n const allParams = new URLSearchParams({\n ...Object.fromEntries(this.existingParams),\n ...Object.fromEntries(params),\n }).toString()\n const url = `${window.location.pathname}?${allParams}`\n\n history.pushState({}, document.title, url)\n window.location.reload()\n }\n\n get stateController() {\n return this.element.refineStateController\n }\n\n get stabilizeFilterController() {\n return this.element.stabilizeFilterController\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { useClickOutside } from 'stimulus-use'\n\n// simple controller to hide/show the filter modal\nexport default class extends Controller {\n static targets = [\"frame\"]\n\n static values = {\n src: String,\n isOpen: {type: Boolean, default: false}\n }\n\n connect() {\n useClickOutside(this)\n this.boundHandleKeyUp = this.handleKeyUp.bind(this)\n document.addEventListener(\"keyup\", this.boundHandleKeyUp)\n }\n\n disconnect() {\n document.removeEventListener(\"keyup\", this.boundHandleKeyUp)\n }\n\n show(event) {\n event.preventDefault()\n this.frameTarget.src = this.srcValue;\n this.isOpenValue = true\n }\n\n hide(event) {\n if (this.isOpenValue) {\n event?.preventDefault()\n this.frameTarget.innerHTML = \"\";\n this.isOpenValue = false\n }\n }\n\n clickOutside(event) {\n this.hide(event)\n }\n\n handleKeyUp(event) {\n if (event.key === \"Escape\" || event.key === \"Esc\") {\n this.hide(event)\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { useClickOutside } from 'stimulus-use'\n\n// simple controller to hide/show the filter modal\nexport default class extends Controller {\n static targets = [\"frame\"]\n\n static values = {\n src: String,\n isOpen: {type: Boolean, default: false}\n }\n\n connect() {\n console.log(\"Connecting modal controller\")\n useClickOutside(this)\n }\n\n disconnect() {\n }\n\n open(event) {\n console.log(\"Opening modal!!!\", this.srcValue)\n event.preventDefault()\n this.frameTarget.src = this.srcValue;\n this.isOpenValue = true\n }\n\n close(event) {\n if (this.isOpenValue) {\n event?.preventDefault()\n this.frameTarget.innerHTML = \"\";\n this.isOpenValue = false\n }\n }\n\n clickOutside(event) {\n this.close(event)\n }\n\n\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\nexport default class extends Controller {\n static values = {\n submitUrl: String\n }\n\n\n search(event) {\n event.preventDefault()\n this.submitFilter()\n document.activeElement.blur()\n }\n\n async submitFilter() {\n const {blueprint} = this.stateController\n const request = new FetchRequest(\n \"POST\",\n this.submitUrlValue,\n {\n responseKind: \"turbo-stream\",\n body: JSON.stringify({\n refine_filters_builder: {\n filter_class: this.stateController.filterName,\n blueprint_json: JSON.stringify(blueprint),\n client_id: this.stateController.clientIdValue\n }\n })\n }\n )\n await request.perform()\n }\n\n get stateController() {\n return this\n .element\n .querySelector('[data-controller~=\"refine--state\"]')\n .refineStateController\n }\n\n loadResults({detail: {url}}) {\n console.log(\"filter submit success\")\n if (window.Turbo) {\n window.Turbo.visit(url)\n } else {\n window.location.href = url\n }\n }\n}\n","// Polyfill for custom events in IE9-11\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill\n;(function () {\n if (typeof window.CustomEvent === 'function') return false\n\n function CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: undefined }\n var evt = document.createEvent('CustomEvent')\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)\n return evt\n }\n\n CustomEvent.prototype = window.Event.prototype\n\n window.CustomEvent = CustomEvent\n\n // eslint expects a return here\n return true\n})()\n\nexport const filterStabilizedEvent = (element, stableId, filterName) => {\n const event = new CustomEvent('filter-stabilized', {\n bubbles: true,\n cancelable: true,\n detail: {\n stableId,\n filterName,\n },\n })\n element.dispatchEvent(event)\n}\n\nexport const filterUnstableEvent = (blueprint) => {\n const event = new CustomEvent('filter-unstable', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const filterInvalidEvent = ({blueprint, errors}) => {\n const event = new CustomEvent('filter-invalid', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n errors,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const filterStoredEvent = (storedFilterId) => {\n const event = new CustomEvent('filter-stored', {\n bubbles: true,\n cancelable: true,\n detail: {\n storedFilterId,\n },\n })\n window.dispatchEvent(event)\n}\n\nexport const blueprintUpdatedEvent = (element, {blueprint, formId}) => {\n const event = new CustomEvent('blueprint-updated', {\n bubbles: true,\n cancelable: true,\n detail: {\n blueprint,\n formId\n },\n })\n element.dispatchEvent(event)\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { delegate, abnegate } from 'jquery-events-to-dom-events'\nimport { blueprintUpdatedEvent } from '../../refine/helpers'\nimport { isEqual } from 'lodash'\n\nconst criterion = (id, depth, condition) => {\n const component = condition?.component\n const meta = condition?.meta || { clauses: [], options: {}}\n const refinements = condition?.refinements || []\n const { clauses, options } = meta\n let selected\n if (component === 'option-condition') {\n selected = options[0] ? [options[0].id] : []\n } else {\n selected = undefined\n }\n // Set newInput based on component\n\n let newInput = {\n clause: clauses[0]?.id,\n selected: selected,\n }\n\n // If refinements are present, add to input array\n refinements.forEach((refinement) => {\n const { meta, component } = refinement\n const { clauses, options } = meta\n let selected\n if (component === 'option-condition') {\n selected = options[0] ? [options[0].id] : []\n } else {\n selected = undefined\n }\n newInput[refinement.id] = {\n clause: clauses[0].id,\n selected: selected,\n }\n })\n\n return {\n depth,\n type: 'criterion',\n condition_id: id,\n input: newInput,\n }\n}\n\nconst or = function (depth) {\n depth = depth === undefined ? 0 : depth\n return {\n depth,\n type: 'conjunction',\n word: 'or',\n }\n}\n\nconst and = function (depth) {\n depth = depth === undefined ? 1 : depth\n return {\n depth,\n type: 'conjunction',\n word: 'and',\n }\n}\nexport default class extends Controller {\n static values = {\n blueprint: Array,\n conditions: Array,\n className: String,\n refreshUrl: String,\n clientId: String,\n validateBlueprintUrl: String,\n defaultConditionId: String\n }\n static targets = ['loading']\n\n\n connect() {\n // for select2 jquery events and datepicker\n this.element.refineStateController = this\n this.changeDelegate = delegate('change', ['event', 'picker'])\n this.blueprint = this.blueprintValue\n this.conditions = this.conditionsValue\n this.filterName = this.classNameValue\n this.conditionsLookup = this.conditions.reduce((lookup, condition) => {\n lookup[condition.id] = condition\n return lookup\n }, {})\n this.loadingTimeout = null\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n disconnect() {\n abnegate('change', this.changeDelegate)\n }\n\n startUpdate() {\n if (this.loadingTimeout) {\n window.clearTimeout(this.loadingTimeout)\n }\n // only show the loading overlay if it's taking a long time\n // to render the updates\n this.loadingTimeout = window.setTimeout(() => {\n this.loadingTarget.classList.remove('hidden')\n }, 1000)\n }\n\n finishUpdate() {\n if (this.loadingTimeout) {\n window.clearTimeout(this.loadingTimeout)\n }\n this.loadingTarget.classList.add('hidden')\n }\n\n conditionConfigFor(conditionId) {\n return this.conditionsLookup[conditionId]\n }\n\n addGroup() {\n const { blueprint, conditions } = this\n const condition = ( conditions.find(c => c.id == this.defaultConditionIdValue) || conditions[0] )\n const { meta } = condition\n\n if (this.blueprint.length > 0) {\n this.blueprint.push(or())\n }\n this.blueprint.push(criterion(condition.id, 1, condition))\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n addCriterion(previousCriterionId) {\n const { blueprint, conditions } = this\n const condition = ( conditions.find(c => c.id == this.defaultConditionIdValue) || conditions[0] )\n const { meta } = condition\n blueprint.splice(previousCriterionId + 1, 0, and(), criterion(condition.id, 1, condition))\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n deleteCriterion(criterionId) {\n /**\n To support 'groups' there is some complicated logic for deleting criterion.\n\n Imagine this simplified blueprint: [eq, and, sw, or, eq]\n\n User clicks to delete the last eq. We also have to delete the preceding or\n otherwise we're left with a hanging empty group\n\n What if the user deletes the sw? We have to clean up the preceding and.\n\n Imagine another scenario: [eq or sw and ew]\n Now we delete the first eq but this time we need to clean up the or.\n\n These conditionals cover these cases.\n **/\n const { blueprint } = this\n const previous = blueprint[criterionId - 1]\n const next = blueprint[criterionId + 1]\n\n const nextIsOr = next && next.word === 'or'\n const previousIsOr = previous && previous.word === 'or'\n\n const nextIsRightParen = nextIsOr || !next\n const previousIsLeftParen = previousIsOr || !previous\n\n const isFirstInGroup = previousIsLeftParen && !nextIsRightParen\n const isLastInGroup = previousIsLeftParen && nextIsRightParen\n const isLastCriterion = !previous && !next\n\n if (isLastCriterion) {\n this.blueprint = []\n } else if (isLastInGroup && previousIsOr) {\n blueprint.splice(criterionId - 1, 2)\n } else if (isLastInGroup && !previous) {\n blueprint.splice(criterionId, 2)\n } else if (isFirstInGroup) {\n blueprint.splice(criterionId, 2)\n } else {\n blueprint.splice(criterionId - 1, 2)\n }\n\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n /*\n Updates a criterion in the blueprint\n Returns true if an update was actually performed, or false if no-op\n */\n replaceCriterion(criterionId, conditionId, condition) {\n const criterionRow = this.blueprint[criterionId]\n if (criterionRow.type !== 'criterion') {\n throw new Error(\n `You can't call updateConditionId on a non-criterion type. Trying to update ${JSON.stringify(criterion)}`\n )\n }\n const existingCriterion = this.blueprint[criterionId]\n const newCriterion = criterion(conditionId, criterionRow.depth, condition)\n if (isEqual(existingCriterion, newCriterion)) {\n return false\n } else {\n this.blueprint[criterionId] = newCriterion\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n return true\n }\n }\n\n updateInput(criterionId, input, inputId) {\n // Input id is an array of hash keys that define the path for this input such as [\"input\", \"date_refinement\"]\n const { blueprint } = this\n const criterion = blueprint[criterionId]\n inputId = inputId || 'input'\n const blueprintPath = inputId.split(', ')\n // If the inputId contains more than one element, add input at appropriate depth\n if (blueprintPath.length > 1) {\n criterion[blueprintPath[0]][blueprintPath[1]] = { ...criterion[blueprintPath[0]][blueprintPath[1]], ...input }\n } else {\n criterion[inputId] = { ...criterion[inputId], ...input }\n }\n blueprintUpdatedEvent(this.element, {blueprint: this.blueprint, formId: this.formIdValue})\n }\n\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { filterStoredEvent } from '../../refine/helpers'\n\nexport default class extends Controller {\n static targets = ['blueprintField']\n static values = { formId: String, stateDomId: String }\n\n connect() {\n const stateController = document\n .getElementById(this.stateDomIdValue)\n .refineStateController\n this.blueprintFieldTarget.value = JSON.stringify(stateController.blueprint)\n console.log(\"connect\", this.blueprintFieldTarget.value)\n }\n\n updateBlueprintField(event) {\n if (event.detail.formId != this.formIdValue) { return null }\n const { detail } = event\n const { blueprint } = detail\n this.blueprintFieldTarget.value = JSON.stringify(blueprint)\n console.log(\"update blueprint\", this.blueprintFieldTarget.value)\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n submit(event) {\n event.preventDefault()\n this.element.requestSubmit()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\n// simple controller to hide/show the filter modal\nexport default class extends Controller {\n static targets = [\"content\"]\n\n toggle(_event) {\n this.contentTargets.forEach(node => {\n node.toggleAttribute(\"hidden\")\n })\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n attach to a form element to have it submit to a turbo-stream endpoint\n\n
refine--turbo-stream-form#submit\">\n\n Turbo is supposed to handle this natively but we're seeing issues when the form is inside an iframe\n*/\nexport default class extends Controller {\n async submit(event) {\n event.preventDefault()\n const request = new FetchRequest(\n (this.element.method || \"POST\"),\n this.element.action,\n {\n responseKind: \"turbo-stream\",\n body: new FormData(this.element)\n }\n )\n await request.perform()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport { FetchRequest } from '@rails/request.js'\n\n/*\n attach to a link element to have it request turbo stream responses\n\n Click me\n\n Turbo is supposed to handle this natively with data-turbo-stream but we're\n seeing issues using that attribute inside iframes\n*/\nexport default class extends Controller {\n async visit(event) {\n event.preventDefault()\n const request = new FetchRequest(\n (this.element.dataset.turboMethod || \"GET\"),\n this.element.href,\n {\n responseKind: \"turbo-stream\",\n }\n )\n await request.perform()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n\n static targets = ['listItem', 'category', 'recommended']\n\n filter(event) {\n const query = event.currentTarget.value.toLowerCase()\n const visibleCategories = new Set()\n\n // hide / show listItem links that match the query and note which\n // categories should be visible\n this.listItemTargets.forEach(listItemNode => {\n const listItemName = listItemNode.dataset.listItemValue.toLowerCase()\n if (listItemName.includes(query)) {\n listItemNode.hidden = false\n visibleCategories.add(listItemNode.dataset.category)\n } else {\n listItemNode.hidden = true\n }\n })\n\n this.recommendedTargets.forEach(recommendedNode => {\n (query !== '' && visibleCategories.size === 0) ? recommendedNode.hidden = true : recommendedNode.hidden = false\n })\n\n // hide / show category headers that have visible listItems\n this.categoryTargets.forEach(categoryNode => {\n const categoryName = categoryNode.innerHTML\n if (visibleCategories.has(categoryName)) {\n categoryNode.hidden = false\n } else {\n categoryNode.hidden = true\n }\n })\n }\n}\n","import ServerRefreshController from './server-refresh-controller'\nimport { debounce } from 'lodash'\n\nexport default class extends ServerRefreshController {\n static values = {\n criterionId: Number,\n }\n\n initialize() {\n this.updateBlueprint = debounce((event, value, inputKey) => {\n this.value(event, value, inputKey)\n }, 500)\n }\n\n refinedFilter(event) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n\n state.updateInput(\n criterionIdValue,\n {\n id: event.target.value,\n },\n inputId\n )\n this.refreshFromServer()\n }\n\n clause(event) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n state.updateInput(\n criterionIdValue,\n {\n clause: event.target.value,\n },\n inputId\n )\n this.refreshFromServer()\n }\n\n selected(event) {\n const { target: select } = event\n const options = Array.prototype.slice.call(select.options)\n const selectedOptions = options.filter((option) => option.selected)\n const selected = selectedOptions.map((option) => option.value)\n this.value(event, selected, 'selected')\n }\n\n value(event, value, inputKey) {\n const { criterionIdValue, state } = this\n const dataset = event.target.dataset\n const inputId = dataset.inputId\n inputKey = inputKey || dataset.inputKey || 'value'\n value = value || event.target.value\n state.updateInput(\n criterionIdValue,\n {\n [inputKey]: value,\n },\n inputId\n )\n }\n\n condition(event) {\n const { criterionIdValue, state } = this\n const element = event.target\n let newConditionId = element.value\n if (!newConditionId) newConditionId = element.querySelector('select').value \n const config = this.state.conditionConfigFor(newConditionId)\n const updatePerformed = state.replaceCriterion(criterionIdValue, newConditionId, config)\n if (updatePerformed) {\n this.refreshFromServer()\n }\n }\n\n // Prevent form submission when hitting enter in a text box\n cancelEnter(event) {\n if (event.code === \"Enter\") {\n event.preventDefault()\n event.stopPropagation()\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport moment from 'moment'\nrequire('daterangepicker/daterangepicker.css')\n\n// requires jQuery, moment, might want to consider a vanilla JS alternative\nimport $ from 'jquery' // ensure jquery is loaded before daterangepicker\nimport 'daterangepicker'\n\nexport default class extends Controller {\n static targets = [\n 'field',\n 'hiddenField',\n 'clearButton',\n ]\n\n static values = {\n includeTime: Boolean,\n futureOnly: Boolean,\n drops: String,\n inline: Boolean,\n dateFormat: String,\n timeFormat: String,\n isAmPm: Boolean,\n locale: { type: String, default: 'en' },\n datetimeFormat: { type: String, default: 'MM/DD/YYYY h:mm A' },\n pickerLocale: { type: Object, default: {} },\n }\n\n connect() {\n this.initPluginInstance()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n clearDate(event) {\n // don't submit the form, unless it originated from the cancel/clear button\n event.preventDefault()\n\n window.$(this.fieldTarget).val('')\n\n this.dispatch('value-cleared')\n }\n\n applyDateToField(event, picker) {\n const format = this.includeTimeValue ? this.timeFormatValue : this.dateFormatValue\n\n const momentVal = picker\n ? moment(picker.startDate.toISOString())\n : moment(this.fieldTarget.value, 'YYYY-MM-DDTHH:mm').format('YYYY-MM-DDTHH:mm')\n const displayVal = momentVal.format(format)\n const dataVal = this.includeTimeValue ? momentVal.toISOString(true) : momentVal.format('YYYY-MM-DD')\n\n this.fieldTarget.value = displayVal\n this.hiddenFieldTarget.value = dataVal\n // bubble up a change event when the input is updated for other listeners\n window.$(this.fieldTarget).trigger('change', picker)\n\n // emit native change event\n this.hiddenFieldTarget.dispatchEvent(new Event('change', { detail: picker, bubbles: true }))\n }\n\n initPluginInstance() {\n const localeValues = this.pickerLocaleValue\n const isAmPm = this.isAmPmValue\n localeValues['format'] = this.includeTimeValue ? this.timeFormatValue : this.dateFormatValue\n\n window.$(this.fieldTarget).daterangepicker({\n singleDatePicker: true,\n timePicker: this.includeTimeValue,\n timePickerIncrement: 5,\n autoUpdateInput: false,\n autoApply: true,\n minDate: this.futureOnlyValue ? new Date() : false,\n locale: localeValues,\n parentEl: $(this.element),\n drops: this.dropsValue ? this.dropsValue : 'down',\n timePicker24Hour: !isAmPm,\n })\n\n window.$(this.fieldTarget).on('apply.daterangepicker', this.applyDateToField.bind(this))\n window.$(this.fieldTarget).on('cancel.daterangepicker', this.clearDate.bind(this))\n window.$(this.fieldTarget).on('showCalendar.daterangepicker', this.showCalendar.bind(this))\n\n this.pluginMainEl = this.fieldTarget\n this.plugin = $(this.pluginMainEl).data('daterangepicker') // weird\n\n if (this.inlineValue) {\n this.element.classList.add('date-input--inline')\n }\n\n }\n \n teardownPluginInstance() {\n if (this.plugin === undefined) {\n return\n }\n\n $(this.pluginMainEl).off('apply.daterangepicker')\n $(this.pluginMainEl).off('cancel.daterangepicker')\n $(this.pluginMainEl).off('showCalendar.daterangepicker')\n\n // revert to original markup, remove any event listeners\n this.plugin.remove()\n\n }\n\n showCalendar() {\n this.dispatch('show-calendar')\n }\n\n}\n","import { identifierForContextKey } from \"@hotwired/stimulus-webpack-helpers\"\n\nimport AddController from './refine/add-controller'\nimport CriterionFormController from './refine/criterion-form-controller'\nimport DefaultsController from './refine/defaults-controller'\nimport DeleteController from './refine/delete-controller'\nimport FilterPillsController from './refine/filter-pills-controller'\nimport PopupController from './refine/popup-controller'\nimport ModalController from './refine/modal-controller'\nimport SearchFilterController from './refine/search-filter-controller'\nimport ServerRefreshController from './refine/server-refresh-controller'\nimport StateController from './refine/state-controller'\nimport StoredFilterController from './refine/stored-filter-controller'\nimport SubmitForm from './refine/submit-form-controller'\nimport ToggleController from './refine/toggle-controller'\nimport TurboStreamFormController from './refine/turbo-stream-form-controller'\nimport TurboStreamLinkController from './refine/turbo-stream-link-controller'\nimport TypeaheadListController from './refine/typeahead-list-controller'\nimport UpdateController from './refine/update-controller'\nimport DateController from './refine/date-controller'\n\nexport const controllerDefinitions = [\n [AddController, 'refine/add-controller.js'],\n [CriterionFormController, 'refine/criterion-form-controller.js'],\n [DefaultsController, 'refine/defaults-controller.js'],\n [DeleteController, 'refine/delete-controller.js'],\n [FilterPillsController, 'refine/filter-pills-controller.js'],\n [PopupController, 'refine/popup-controller.js'],\n [ModalController, 'refine/modal-controller.js'],\n [SearchFilterController, 'refine/search-filter-controller.js'],\n [ServerRefreshController, 'refine/server-refresh-controller.js'],\n [StateController, 'refine/state-controller.js'],\n [StoredFilterController, 'refine/stored-filter-controller.js'],\n [SubmitForm, 'refine/submit-form-controller.js'],\n [ToggleController, 'refine/toggle-controller.js'],\n [TurboStreamFormController, 'refine/turbo-stream-form-controller.js'],\n [TurboStreamLinkController, 'refine/turbo-stream-link-controller.js'],\n [TypeaheadListController, './refine/typeahead-list-controller.js'],\n [UpdateController, 'refine/update-controller.js'],\n [DateController, 'refine/date-controller.js']\n].map(function(d) {\n const key = d[1]\n const controller = d[0]\n return {\n identifier: identifierForContextKey(key),\n controllerConstructor: controller\n }\n})\n\nexport {\n AddController,\n CriterionFormController,\n DefaultsController,\n DeleteController,\n FilterPillsController,\n PopupController,\n ModalController,\n SearchFilterController,\n ServerRefreshController,\n StateController,\n StoredFilterController,\n SubmitForm,\n ToggleController,\n TurboStreamFormController,\n TurboStreamLinkController,\n TypeaheadListController,\n UpdateController,\n DateController\n}\n"],"names":["identifierForContextKey","key","logicalName","match","replace","Controller","connect","this","state","finishUpdate","currentElement","element","document","body","matches","application","getControllerForElementAndIdentifier","parentNode","async","options","includeErrors","startUpdate","request","FetchRequest","refreshUrlValue","responseKind","query","filterName","JSON","stringify","blueprint","clientIdValue","include_errors","perform","ServerRefreshController","isValid","validateBlueprint","addCriterion","previousCriterionIdValue","refreshFromServer","addGroup","validateBlueprintUrlValue","ok","values","previousCriterionId","Number","_event","formElement","getElementById","formIdValue","formData","FormData","urlValue","url","String","formId","getStateController","updateInput","criterionIdValue","inputValue","controller","criterionId","input","Object","criterion","deleteCriterion","urlParams","URLSearchParams","window","location","search","existingParams","delete","event","currentTarget","dataset","index","parseInt","stateController","reloadPage","submitUrlValue","refine_filters_builder","filter_class","blueprint_json","client_id","redirectToStableId","stableId","params","append","allParams","fromEntries","toString","pathname","history","pushState","title","reload","refineStateController","stabilizeFilterController","submitUrl","useClickOutside","boundHandleKeyUp","handleKeyUp","bind","addEventListener","disconnect","removeEventListener","show","preventDefault","frameTarget","src","srcValue","isOpenValue","hide","innerHTML","clickOutside","targets","isOpen","type","Boolean","default","console","log","open","close","_class","submitFilter","activeElement","blur","querySelector","loadResults","detail","Turbo","visit","href","CustomEvent","bubbles","cancelable","undefined","evt","createEvent","initCustomEvent","prototype","Event","blueprintUpdatedEvent","dispatchEvent","id","depth","condition","_clauses$","component","meta","clauses","refinements","selected","newInput","clause","forEach","refinement","condition_id","changeDelegate","delegate","blueprintValue","conditions","conditionsValue","classNameValue","conditionsLookup","reduce","lookup","loadingTimeout","abnegate","clearTimeout","setTimeout","loadingTarget","classList","remove","add","conditionConfigFor","conditionId","find","c","defaultConditionIdValue","length","push","word","splice","previous","next","previousIsOr","nextIsRightParen","previousIsLeftParen","isLastInGroup","replaceCriterion","criterionRow","Error","existingCriterion","newCriterion","isEqual","inputId","blueprintPath","split","Array","className","refreshUrl","clientId","validateBlueprintUrl","defaultConditionId","stateDomIdValue","blueprintFieldTarget","value","updateBlueprintField","stateDomId","submit","requestSubmit","toggle","contentTargets","node","toggleAttribute","TurboStreamFormController","method","action","turboMethod","filter","toLowerCase","visibleCategories","Set","listItemTargets","listItemNode","listItemValue","includes","hidden","category","recommendedTargets","recommendedNode","size","categoryTargets","categoryNode","has","initialize","updateBlueprint","debounce","inputKey","refinedFilter","target","select","slice","call","option","map","newConditionId","config","cancelEnter","code","stopPropagation","require","initPluginInstance","teardownPluginInstance","clearDate","$","fieldTarget","val","dispatch","applyDateToField","picker","format","includeTimeValue","timeFormatValue","dateFormatValue","momentVal","moment","startDate","toISOString","displayVal","dataVal","hiddenFieldTarget","trigger","localeValues","pickerLocaleValue","isAmPm","isAmPmValue","daterangepicker","singleDatePicker","timePicker","timePickerIncrement","autoUpdateInput","autoApply","minDate","futureOnlyValue","Date","locale","parentEl","drops","dropsValue","timePicker24Hour","on","showCalendar","pluginMainEl","plugin","data","inlineValue","off","includeTime","futureOnly","inline","dateFormat","timeFormat","datetimeFormat","pickerLocale","controllerDefinitions","AddController","CriterionFormController","DefaultsController","DeleteController","FilterPillsController","PopupController","ModalController","SearchFilterController","StateController","StoredFilterController","SubmitForm","ToggleController","TurboStreamLinkController","TypeaheadListController","UpdateController","DateController","d","identifier","controllerConstructor"],"mappings":"wUAqBA,SAASA,EAAwBC,GAC7B,MAAMC,GAAeD,EAAIE,MAAM,2CAA6C,IAAI,GAChF,GAAID,EACA,OAAOA,EAAYE,QAAQ,KAAM,KAAKA,QAAQ,MAAO,MCnBhCC,MAAAA,UAAAA,EAC3BC,UACEC,KAAKC,MAAMC,eAGTD,YACF,IAAIE,EAAiBH,KAAKI,QAE1B,KAAMD,IAAmBE,SAASC,MAAM,CACtC,GAAIH,EAAeI,QAAQ,sCACzB,OAAYC,KAAAA,YAAYC,qCAAqCN,EAAgB,iBAE7EA,EAAiBA,EAAeO,WAIpC,OACD,KAEsBC,wBAACC,EAAU,IAChC,MAAMC,cAAEA,GAAkBD,EAC1BZ,KAAKC,MAAMa,cACX,MAAMC,EAAU,IAAIC,EAClB,MACAhB,KAAKC,MAAMgB,gBACX,CACEC,aAAc,eACdC,MAAO,CACL,uCAAwCnB,KAAKC,MAAMmB,WACnD,yCAA0CC,KAAKC,UAAUtB,KAAKC,MAAMsB,WACpE,oCAAqCvB,KAAKC,MAAMuB,cACh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