bullet_train-fields 1.0.13 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sources":["../../../node_modules/@hotwired/stimulus-webpack-helpers/dist/stimulus-webpack-helpers.js","../../javascript/controllers/fields/button_toggle_controller.js","../../javascript/controllers/fields/cloudinary_image_controller.js","../../javascript/controllers/fields/color_picker_controller.js","../../javascript/controllers/fields/date_controller.js","../../javascript/controllers/fields/file_field_controller.js","../../javascript/controllers/fields/password_controller.js","../../javascript/controllers/fields/phone_controller.js","../../javascript/controllers/fields/super_select_controller.js","../../javascript/controllers/index.js","../../javascript/trix_editor.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\"\n\nexport default class extends Controller {\n static targets = [ \"shadowField\" ]\n\n clickShadowField(event) {\n // we have to stop safari from doing what we originally expected.\n event.preventDefault();\n\n // then we need to manually click the hidden checkbox or radio button ourselves.\n this.shadowFieldTarget.click()\n }\n}","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [ \"uploadButton\", \"hiddenField\", \"thumbnail\" ]\n static values = { \n signaturesUrl: String,\n height: Number,\n width: Number,\n cloudName: String,\n apiKey: String,\n googleApiKey: String,\n urlFormat: String,\n sources: String,\n searchByRights: Boolean\n }\n static classes = [ \"thumbnailShown\" ]\n\n pickImageAndUpload(event) {\n // don't submit the form.\n event.preventDefault()\n\n // prepare the list of default sources a user can upload an image from.\n var defaultSources = ['local', 'url', 'camera']\n if (this.hasGoogleApiKeyValue) {\n defaultSources.push('image_search')\n }\n\n // configure cloudinary's uploader's options.\n // many of these are configurable at the point where the `shared/fields/cloudinary_image` partial is included.\n var options = {\n cloud_name: this.cloudNameValue,\n apiKey: this.apiKeyValue,\n upload_preset: this.uploadPresetValue,\n upload_signature: this.getCloudinarySignature.bind(this),\n multiple: false,\n sources: this.hasSourcesValue ? this.sourcesValue.split(',') : defaultSources,\n search_by_rights: this.hasSearchByRightsValue && this.searchByRightsValue === false ? false : true // default to true.\n }\n \n if (this.hasGoogleApiKeyValue) {\n options['google_api_key'] = this.googleApiKeyValue\n }\n \n // open cloudinary's upload widget.\n cloudinary.openUploadWidget(options, this.handleWidgetResponse.bind(this))\n }\n \n clearImage(event) {\n // don't submit the form.\n event.preventDefault()\n\n // clear the cloudinary id.\n this.hiddenFieldTarget.value = null\n \n // remove any existing image from the button.\n this.removeThumbnail()\n }\n \n getCloudinarySignature(callback, paramsToSign) {\n $.ajax({\n url: this.signaturesUrlValue,\n type: \"GET\",\n dataType: \"text\",\n data: {data: paramsToSign},\n complete: function() { console.log(\"complete\") },\n success: function(signature, textStatus, xhr) { callback(signature) },\n error: function(xhr, status, error) { console.log(xhr, status, error) }\n })\n }\n \n handleWidgetResponse(error, response) {\n // after the user has successfully uploaded a single file ..\n if (!error && response && response.event === \"success\") { \n const data = response.info\n \n // update the cloudinary id field in the form.\n this.hiddenFieldTarget.value = data.public_id\n\n // remove any existing image.\n this.removeThumbnail()\n\n // generate a new image preview url.\n this.addThumbnail(this.urlFormatValue.replace('CLOUDINARY_ID', data.public_id))\n }\n }\n \n addThumbnail(url) {\n var $imageElement = $(`<img src=\"${url}\" width=\"${this.widthValue}\" height=\"${this.heightValue}\" data-${this.identifier}-target=\"thumbnail\" />`)\n $(this.uploadButtonTarget).prepend($imageElement)\n\n // mark the image as present.\n this.uploadButtonTarget.classList.add(this.thumbnailShownClass)\n }\n \n removeThumbnail() {\n if (!this.hasThumbnailTarget) { return }\n this.uploadButtonTarget.removeChild(this.thumbnailTarget)\n this.uploadButtonTarget.classList.remove(this.thumbnailShownClass)\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport '@simonwep/pickr/dist/themes/monolith.min.css'\n\nimport Pickr from '@simonwep/pickr';\n\nexport default class extends Controller {\n static targets = [ \"colorPickerValue\", \"colorField\", \"colorInput\", \"userSelectedColor\", \"colorOptions\" ];\n static values = { initialColor: String }\n\n connect() {\n this.initPluginInstance()\n this.colorOptions = $(this.colorOptionsTarget).find('button').map(function (_, button) { return $(button).attr('data-color'); }).get()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n pickColor(event) {\n event.preventDefault();\n\n const targetEl = event.target;\n const color = targetEl.dataset.color;\n\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n $(this.userSelectedColorTarget).data('color', color);\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n this.pickr.setColor(color);\n\n targetEl.classList.add('ring-2', 'ring-offset-2');\n }\n\n pickRandomColor(event) {\n event.preventDefault();\n\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n\n this.pickr.setColor(`rgb ${r} ${g} ${b}`);\n const hexColor = this.pickr.getColor().toHEXA().toString();\n this.pickr.setColor(hexColor);\n\n this.showUserSelectedColor(hexColor);\n }\n\n showUserSelectedColor(color) {\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n $(this.userSelectedColorTarget)\n .addClass('ring-2')\n .addClass('ring-offset-2')\n .css('background-color', color)\n .css('--tw-ring-color', color)\n .attr('data-color', color)\n .show();\n }\n\n unpickColor(event) {\n event.preventDefault();\n $(this.colorPickerValueTarget).val('');\n $(this.colorInputTarget).val('');\n $(this.userSelectedColorTarget).hide();\n $('.button-color').removeClass('ring-2 ring-offset-2');\n }\n\n togglePickr(event) {\n event.preventDefault();\n }\n\n initPluginInstance() {\n this.pickr = Pickr.create({\n el: '.btn-pickr',\n theme: 'monolith',\n useAsButton: true,\n default: this.initialColorValue || '#1E90FF',\n components: {\n // Main components\n preview: true,\n hue: true,\n\n // Input / output Options\n interaction: {\n input: true,\n save: true,\n },\n }\n });\n\n this.pickr.on('save', (color, _instance) => {\n const hexaColor = color.toHEXA().toString()\n if (!this.colorOptions.includes(hexaColor)) {\n this.showUserSelectedColor(hexaColor);\n }\n this.pickr.hide();\n });\n\n const that = this\n\n $('input[type=\"text\"].pcr-result').on('keydown', function (e) {\n if (e.key === 'Enter') {\n that.pickr.applyColor(false)\n }\n })\n }\n\n teardownPluginInstance() {\n this.pickr.destroy()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"daterangepicker/daterangepicker.css\");\n\n// requires jQuery, moment, might want to consider a vanilla JS alternative\nimport 'daterangepicker';\n\nexport default class extends Controller {\n static targets = [ \"field\", \"clearButton\", \"currentTimeZoneWrapper\", \"timeZoneButtons\", \"timeZoneSelectWrapper\", \"timeZoneField\" ]\n static values = {\n includeTime: Boolean,\n defaultTimeZones: Array,\n cancelButtonLabel: { type: String, default: \"Cancel\" },\n applyButtonLabel: { type: String, default: \"Apply\" }\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 $(this.fieldTarget).val('')\n }\n\n applyDateToField(event, picker) {\n const format = this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n $(this.fieldTarget).val(picker.startDate.format(format))\n }\n\n showTimeZoneButtons(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).toggleClass('hidden')\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n }\n\n showTimeZoneSelectWrapper(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).toggleClass('hidden')\n }\n }\n\n resetTimeZoneUI(e) {\n e && e.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).removeClass('hidden')\n $(this.timeZoneButtonsTarget).addClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).addClass('hidden')\n }\n }\n\n setTimeZone(event) {\n // don't follow the anchor\n event.preventDefault()\n\n const currentTimeZoneEl = this.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target.dataset\n\n $(this.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n $(event.target).removeClass('button-alternative').addClass('button')\n\n this.resetTimeZoneUI()\n }\n\n initPluginInstance() {\n $(this.fieldTarget).daterangepicker({\n singleDatePicker: true,\n timePicker: this.includeTimeValue,\n timePickerIncrement: 5,\n autoUpdateInput: false,\n locale: {\n cancelLabel: this.cancelButtonLabelValue,\n applyLabel: this.applyButtonLabelValue,\n format: this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n }\n })\n\n $(this.fieldTarget).on('apply.daterangepicker', this.applyDateToField.bind(this))\n $(this.fieldTarget).on('cancel.daterangepicker', this.clearDate.bind(this))\n\n this.pluginMainEl = this.fieldTarget\n this.plugin = $(this.pluginMainEl).data('daterangepicker') // weird\n\n // Init time zone select\n if (this.includeTimeValue && this.hasTimeZoneSelectWrapperTarget) {\n this.timeZoneSelect = this.timeZoneSelectWrapperTarget.querySelector('select.select2')\n\n $(this.timeZoneSelect).select2({\n width: 'style'\n })\n\n const self = this\n\n $(this.timeZoneSelect).on('change.select2', function(event) {\n const currentTimeZoneEl = self.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target\n\n $(self.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n const selectedOptionTimeZoneButton = $('.selected-option-time-zone-button')\n\n if (self.defaultTimeZonesValue.includes(value)) {\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n selectedOptionTimeZoneButton.addClass('hidden').attr('hidden', true)\n $(`a[data-value=\"${value}\"`).removeClass('button-alternative').addClass('button')\n } else {\n // deselect any selected button\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n\n selectedOptionTimeZoneButton.text(value)\n selectedOptionTimeZoneButton.attr('data-value', value).removeAttr('hidden')\n selectedOptionTimeZoneButton.removeClass(['hidden', 'button-alternative']).addClass('button')\n }\n\n self.resetTimeZoneUI()\n })\n }\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n $(this.pluginMainEl).off('apply.daterangepicker')\n $(this.pluginMainEl).off('cancel.daterangepicker')\n\n // revert to original markup, remove any event listeners\n this.plugin.remove()\n\n if (this.includeTimeValue) {\n $(this.timeZoneSelect).select2('destroy');\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n static targets = [\n \"fileField\",\n \"removeFileFlag\",\n \"downloadFileButton\",\n \"removeFileButton\",\n \"selectFileButton\",\n \"progressBar\",\n ];\n\n connect() {\n // Add upload event listeners\n const initializeListener = document.addEventListener(\n \"direct-upload:initialize\",\n (event) => {\n this.selectFileButtonTarget.classList.add(\"hidden\");\n this.progressBarTarget.innerText = \"0%\";\n this.progressBarTarget.style.width = \"0%\";\n this.progressBarTarget.setAttribute(\"aria-valuenow\", 0);\n this.progressBarTarget.parentNode.classList.remove(\"hidden\");\n }\n );\n\n const progressListener = document.addEventListener(\n \"direct-upload:progress\",\n (event) => {\n const { progress } = event.detail;\n const width = `${progress.toFixed(1)}%`;\n\n this.progressBarTarget.innerText = width;\n this.progressBarTarget.setAttribute(\"aria-valuenow\", progress);\n this.progressBarTarget.style.width = width;\n }\n );\n\n const errorListener = document.addEventListener(\n \"direct-upload:error\",\n (event) => {\n event.preventDefault();\n\n const { error } = event.detail;\n this.progressBarTarget.innerText = error;\n }\n );\n\n this.uploadListeners = {\n \"direct-upload:initialize\": initializeListener,\n \"direct-upload:progress\": progressListener,\n \"direct-upload:error\": errorListener,\n };\n }\n\n disconnect() {\n // Teardown event listeners\n for (const event in this.uploadListeners) {\n document.removeEventListener(event, this.uploadListeners[event]);\n }\n }\n\n uploadFile() {\n this.fileFieldTarget.click();\n }\n\n removeFile() {\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.classList.add(\"hidden\");\n }\n\n this.removeFileButtonTarget.classList.add(\"hidden\");\n this.removeFileFlagTarget.value = true;\n }\n\n handleFileSelected() {\n const statusText = this.selectFileButtonTarget.querySelector(\"span\");\n const icon = this.selectFileButtonTarget.querySelector(\"i\");\n\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.remove();\n }\n\n statusText.innerText = \"Select Another File\";\n icon.classList.remove(\"ti-upload\");\n icon.classList.add(\"ti-check\");\n }\n}\n","import { Controller } from \"stimulus\";\nimport zxcvbn from \"zxcvbn\";\n\nexport default class extends Controller {\n static targets = [\"strengthIndicator\"];\n\n estimateStrength(e) {\n const result = zxcvbn(e.target.value);\n\n if (result.feedback) {\n this.strengthIndicatorTarget.innerText = `${result.feedback.warning}.`;\n this.strengthIndicatorTarget.classList.remove(\"hidden\");\n } else {\n this.strengthIndicatorTarget.classList.add(\"hidden\");\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"intl-tel-input/build/css/intlTelInput.css\");\nimport intlTelInput from 'intl-tel-input';\n\nexport default class extends Controller {\n static targets = [ \"field\" ]\n\n connect() {\n this.initPluginInstance()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n initPluginInstance() {\n let options = {\n hiddenInput: this.fieldTarget.dataset.method,\n customContainer: \"w-full\"\n }\n\n // TODO: add instructions on how to copy this asset into the application's assets path and write the meta tag into the head (via the engine?)\n const utilsScriptPath = metaContent(\"intl_tel_input_utils_path\")\n if (utilsScriptPath) {\n options['utilsScript'] = utilsScriptPath\n }\n\n this.plugin = intlTelInput(this.fieldTarget, options);\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n // revert to original markup, remove any event listeners\n this.plugin.destroy()\n }\n}\n\nfunction metaContent (name) {\n const element = document.head.querySelector(`meta[name=\"${name}\"]`)\n return element && element.content\n}","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"select2/dist/css/select2.min.css\");\nimport select2 from \"select2\";\n\nexport default class extends Controller {\n static targets = [ \"select\" ]\n static values = {\n acceptsNew: Boolean,\n enableSearch: Boolean,\n searchUrl: String,\n }\n \n // will be reissued as native dom events name prepended with '$' e.g. '$change', '$select2:closing', etc\n static jQueryEventsToReissue = [ \"change\", \"select2:closing\", \"select2:close\", \"select2:opening\", \"select2:open\", \"select2:selecting\", \"select2:select\", \"select2:unselecting\", \"select2:unselect\", \"select2:clearing\", \"select2:clear\" ]\n \n\n initialize() {\n this.dispatchNativeEvent = this.dispatchNativeEvent.bind(this)\n if (this.isSelect2LoadedOnWindowJquery) {\n select2(window.$)\n }\n }\n\n get isSelect2LoadedOnWindowJquery() {\n return (window.$ !== undefined && window.$.select2 === undefined)\n }\n\n connect() {\n if (this.isSelect2LoadedOnWindowJquery) {\n this.initPluginInstance()\n }\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n cleanupBeforeInit() {\n $(this.element).find('.select2-container--default').remove()\n }\n\n initPluginInstance() {\n let options = {};\n\n if (!this.enableSearchValue) {\n options.minimumResultsForSearch = -1;\n }\n\n options.tags = this.acceptsNewValue\n\n if (this.searchUrlValue) {\n options.ajax = {\n url: this.searchUrlValue,\n dataType: 'json',\n // We enable pagination by default here\n data: function(params) {\n var query = {\n search: params.term,\n page: params.page || 1\n }\n return query\n }\n // Any additional params go here...\n }\n }\n\n options.templateResult = this.formatState;\n options.templateSelection = this.formatState;\n options.width = 'style';\n\n this.cleanupBeforeInit() // in case improperly torn down\n this.pluginMainEl = this.selectTarget // required because this.selectTarget is unavailable on disconnect()\n $(this.pluginMainEl).select2(options);\n\n this.initReissuePluginEventsAsNativeEvents()\n }\n\n teardownPluginInstance() {\n if (this.pluginMainEl === undefined) { return }\n\n // ensure there are no orphaned event handlers\n this.teardownPluginEventsAsNativeEvents()\n \n // revert to original markup, remove any event listeners\n $(this.pluginMainEl).select2('destroy');\n }\n\n initReissuePluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).on(eventName, this.dispatchNativeEvent)\n })\n }\n \n teardownPluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).off(eventName)\n })\n }\n \n dispatchNativeEvent(event) {\n const nativeEventName = '$' + event.type // e.g. '$change.select2'\n this.element.dispatchEvent(new CustomEvent(nativeEventName, { detail: { event: event }, bubbles: true, cancelable: false }))\n }\n\n // https://stackoverflow.com/questions/29290389/select2-add-image-icon-to-option-dynamically\n formatState(opt) {\n var imageUrl = $(opt.element).attr('data-image');\n var imageHtml = \"\";\n if (imageUrl) {\n imageHtml = '<img src=\"' + imageUrl + '\" /> ';\n }\n return $('<span>' + imageHtml + sanitizeHTML(opt.text) + '</span>');\n }\n}\n\n// https://portswigger.net/web-security/cross-site-scripting/preventing\nfunction sanitizeHTML(str) {\n return str.replace(/[^\\w. ]/gi, function (c) {\n return '&#' + c.charCodeAt(0) + ';';\n });\n};\n","import { identifierForContextKey } from \"@hotwired/stimulus-webpack-helpers\"\n\nimport ButtonToggleController from './fields/button_toggle_controller'\nimport CloudinaryImageController from './fields/cloudinary_image_controller'\nimport ColorPickerController from './fields/color_picker_controller'\nimport DateController from './fields/date_controller'\nimport FileFieldController from './fields/file_field_controller'\nimport PasswordController from './fields/password_controller'\nimport PhoneController from './fields/phone_controller'\nimport SuperSelectController from './fields/super_select_controller'\n\nexport const controllerDefinitions = [\n [ButtonToggleController, 'fields/button_toggle_controller.js'],\n [CloudinaryImageController, 'fields/cloudinary_image_controller.js'],\n [ColorPickerController, 'fields/color_picker_controller.js'],\n [DateController, 'fields/date_controller.js'],\n [FileFieldController, 'fields/file_field_controller.js'],\n [PasswordController, 'fields/password_controller.js'],\n [PhoneController, 'fields/phone_controller.js'],\n [SuperSelectController, 'fields/super_select_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 ButtonToggleController,\n CloudinaryImageController,\n ColorPickerController,\n DateController,\n FileFieldController,\n PasswordController,\n PhoneController,\n SuperSelectController,\n}","import Tribute from 'tributejs'\nrequire(\"trix/dist/trix.css\");\n\nrequire(\"trix\")\nrequire(\"@rails/actiontext\")\n\n// only show the editor tool bar when the user is editing the field.\n// inspired by https://github.com/basecamp/trix/issues/343 and `app/assets/stylesheets/account/fields/trix_editor.scss`\n\nexport function trixEditor() {\n document.addEventListener('trix-initialize', function() {\n addEventListener(\"trix-focus\", updateTrixToolbarVisability);\n addEventListener(\"trix-blur\", updateTrixToolbarVisability);\n updateTrixToolbarVisability();\n initializeTribute();\n })\n}\n\nfunction updateTrixToolbarVisability() {\n document.querySelectorAll(\"trix-editor\").forEach((editorElement, index) => {\n var toolbarElement = editorElement.toolbarElement;\n if (editorElement == document.activeElement) {\n toolbarElement.classList.add('visible');\n } else {\n // don't hide the toolbar if we've unfocused to focus on the link dialog.\n if (!toolbarElement.contains(document.activeElement)) {\n toolbarElement.classList.remove('visible');\n }\n }\n })\n}\n\nfunction initializeTribute() {\n document.querySelectorAll(\"trix-editor\").forEach((el, index) => {\n var editor = el.editor;\n \n var mentionConfig = {\n trigger: '@',\n values: JSON.parse(editor.element.dataset.mentions),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var topicConfig = {\n trigger: '#',\n values: JSON.parse(editor.element.dataset.topics),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var tribute = new Tribute({\n collection: [topicConfig, mentionConfig],\n });\n \n tribute.attach(el);\n })\n}\n"],"names":["identifierForContextKey","key","logicalName","match","replace","Controller","clickShadowField","event","preventDefault","this","shadowFieldTarget","click","targets","pickImageAndUpload","defaultSources","hasGoogleApiKeyValue","push","options","cloud_name","cloudNameValue","apiKey","apiKeyValue","upload_preset","uploadPresetValue","upload_signature","getCloudinarySignature","bind","multiple","sources","hasSourcesValue","sourcesValue","split","search_by_rights","hasSearchByRightsValue","searchByRightsValue","googleApiKeyValue","cloudinary","openUploadWidget","handleWidgetResponse","clearImage","hiddenFieldTarget","value","removeThumbnail","callback","paramsToSign","$","ajax","url","signaturesUrlValue","type","dataType","data","complete","console","log","success","signature","textStatus","xhr","error","status","response","info","public_id","addThumbnail","urlFormatValue","$imageElement","widthValue","heightValue","identifier","uploadButtonTarget","prepend","classList","add","thumbnailShownClass","hasThumbnailTarget","removeChild","thumbnailTarget","remove","values","signaturesUrl","String","height","Number","width","cloudName","googleApiKey","urlFormat","searchByRights","Boolean","classes","connect","initPluginInstance","colorOptions","colorOptionsTarget","find","map","_","button","attr","get","disconnect","teardownPluginInstance","pickColor","targetEl","target","color","dataset","colorInputTarget","val","colorPickerValueTarget","userSelectedColorTarget","removeClass","pickr","setColor","pickRandomColor","r","Math","floor","random","g","b","hexColor","getColor","toHEXA","toString","showUserSelectedColor","addClass","css","show","unpickColor","hide","togglePickr","Pickr","create","el","theme","useAsButton","default","initialColorValue","components","preview","hue","interaction","input","save","on","_instance","hexaColor","includes","that","e","applyColor","destroy","initialColor","require","clearDate","fieldTarget","applyDateToField","picker","format","includeTimeValue","startDate","showTimeZoneButtons","currentTimeZoneWrapperTarget","toggleClass","timeZoneButtonsTarget","showTimeZoneSelectWrapper","hasTimeZoneSelectWrapperTarget","timeZoneSelectWrapperTarget","resetTimeZoneUI","setTimeZone","currentTimeZoneEl","querySelector","timeZoneFieldTarget","text","daterangepicker","singleDatePicker","timePicker","timePickerIncrement","autoUpdateInput","locale","cancelLabel","cancelButtonLabelValue","applyLabel","applyButtonLabelValue","pluginMainEl","plugin","timeZoneSelect","select2","self","selectedOptionTimeZoneButton","defaultTimeZonesValue","removeAttr","undefined","off","includeTime","defaultTimeZones","Array","cancelButtonLabel","applyButtonLabel","initializeListener","document","addEventListener","selectFileButtonTarget","progressBarTarget","innerText","style","setAttribute","parentNode","progressListener","progress","detail","toFixed","errorListener","uploadListeners","removeEventListener","uploadFile","fileFieldTarget","removeFile","hasDownloadFileButtonTarget","downloadFileButtonTarget","removeFileButtonTarget","removeFileFlagTarget","handleFileSelected","statusText","icon","estimateStrength","result","zxcvbn","feedback","strengthIndicatorTarget","warning","hiddenInput","method","customContainer","utilsScriptPath","name","element","head","content","metaContent","intlTelInput","initialize","dispatchNativeEvent","isSelect2LoadedOnWindowJquery","window","cleanupBeforeInit","enableSearchValue","minimumResultsForSearch","tags","acceptsNewValue","searchUrlValue","params","search","term","page","templateResult","formatState","templateSelection","selectTarget","initReissuePluginEventsAsNativeEvents","teardownPluginEventsAsNativeEvents","constructor","jQueryEventsToReissue","forEach","eventName","dispatchEvent","CustomEvent","bubbles","cancelable","opt","imageUrl","imageHtml","c","charCodeAt","acceptsNew","enableSearch","searchUrl","controllerDefinitions","ButtonToggleController","CloudinaryImageController","ColorPickerController","DateController","FileFieldController","PasswordController","PhoneController","SuperSelectController","d","controller","controllerConstructor","updateTrixToolbarVisability","querySelectorAll","editorElement","index","toolbarElement","activeElement","contains","editor","mentionConfig","trigger","JSON","parse","mentions","selectTemplate","item","original","protocol","model","id","label","menuItemTemplate","photo","string","requireLeadingSpace","replaceTextSuffix","topicConfig","topics","Tribute","collection","attach"],"mappings":"6XAqBA,SAASA,EAAwBC,GAC7B,MAAMC,GAAeD,EAAIE,MAAM,2CAA6C,IAAI,GAChF,GAAID,EACA,OAAOA,EAAYE,QAAQ,KAAM,KAAKA,QAAQ,MAAO,sBCtBhCC,aAG3BC,iBAAiBC,GAEfA,EAAMC,iBAGNC,KAAKC,kBAAkBC,WAPlBC,QAAU,CAAE,+BCDQP,aAe3BQ,mBAAmBN,GAEjBA,EAAMC,iBAGN,IAAIM,EAAiB,CAAC,QAAS,MAAO,UAClCL,KAAKM,sBACPD,EAAeE,KAAK,gBAKtB,IAAIC,EAAU,CACZC,WAAYT,KAAKU,eACjBC,OAAQX,KAAKY,YACbC,cAAeb,KAAKc,kBACpBC,iBAAkBf,KAAKgB,uBAAuBC,KAAKjB,MACnDkB,UAAU,EACVC,QAASnB,KAAKoB,gBAAkBpB,KAAKqB,aAAaC,MAAM,KAAOjB,EAC/DkB,kBAAkBvB,KAAKwB,yBAAuD,IAA7BxB,KAAKyB,qBAGpDzB,KAAKM,uBACPE,EAAO,eAAqBR,KAAK0B,mBAInCC,WAAWC,iBAAiBpB,EAASR,KAAK6B,qBAAqBZ,KAAKjB,OAGtE8B,WAAWhC,GAETA,EAAMC,iBAGNC,KAAK+B,kBAAkBC,MAAQ,KAG/BhC,KAAKiC,kBAGPjB,uBAAuBkB,EAAUC,GAC/BC,EAAEC,KAAK,CACLC,IAAKtC,KAAKuC,mBACVC,KAAM,MACNC,SAAU,OACVC,KAAM,CAACA,KAAMP,GACbQ,SAAU,WAAaC,QAAQC,IAAI,aACnCC,QAAS,SAASC,EAAWC,EAAYC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,EAASnK,EAAGmK,OAEZC,EAAgB,CAClBC,QAAS,IACT7N,OAAQ8N,KAAKC,MAAMJ,EAAO5D,QAAQnI,QAAQoM,UAC1CC,eAAgB,SAAUC,GAExB,MAAO,aADPA,EAAOA,EAAKC,UACcC,SAAW,MAAQF,EAAKG,MAAQ,IAAMH,EAAKI,GAAK,KAAOJ,EAAKK,MAAQ,QAEhGC,iBAAkB,SAAUN,GAC1B,MAAO,aAAeA,EAAKC,SAASM,MAAQ,QAAUP,EAAKQ,QAE7DC,qBAAqB,EACrBC,kBAAmB,IAGjBC,EAAc,CAChBhB,QAAS,IACT7N,OAAQ8N,KAAKC,MAAMJ,EAAO5D,QAAQnI,QAAQkN,QAC1Cb,eAAgB,SAAUC,GAExB,MAAO,aADPA,EAAOA,EAAKC,UACcC,SAAW,MAAQF,EAAKG,MAAQ,IAAMH,EAAKI,GAAK,KAAOJ,EAAKK,MAAQ,QAEhGC,iBAAkB,SAAUN,GAC1B,MAAO,aAAeA,EAAKC,SAASM,MAAQ,QAAUP,EAAKQ,QAE7DC,qBAAqB,EACrBC,kBAAmB,IAGP,IAAIG,UAAQ,CACxBC,WAAY,CAACH,EAAajB,KAGpBqB,OAAOzL"}
1
+ {"version":3,"file":"fields.js","sources":["../../../node_modules/@hotwired/stimulus-webpack-helpers/dist/stimulus-webpack-helpers.js","../../javascript/controllers/fields/button_toggle_controller.js","../../javascript/controllers/fields/cloudinary_image_controller.js","../../javascript/controllers/fields/color_picker_controller.js","../../javascript/controllers/fields/date_controller.js","../../javascript/controllers/fields/file_field_controller.js","../../javascript/controllers/fields/password_controller.js","../../javascript/controllers/fields/phone_controller.js","../../javascript/controllers/fields/super_select_controller.js","../../javascript/controllers/index.js","../../javascript/trix_editor.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\"\n\nexport default class extends Controller {\n static targets = [ \"shadowField\" ]\n\n clickShadowField(event) {\n // we have to stop safari from doing what we originally expected.\n event.preventDefault();\n\n // then we need to manually click the hidden checkbox or radio button ourselves.\n this.shadowFieldTarget.click()\n }\n}","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [ \"uploadButton\", \"hiddenField\", \"thumbnail\" ]\n static values = { \n signaturesUrl: String,\n height: Number,\n width: Number,\n cloudName: String,\n apiKey: String,\n googleApiKey: String,\n urlFormat: String,\n sources: String,\n searchByRights: Boolean\n }\n static classes = [ \"thumbnailShown\" ]\n\n pickImageAndUpload(event) {\n // don't submit the form.\n event.preventDefault()\n\n // prepare the list of default sources a user can upload an image from.\n var defaultSources = ['local', 'url', 'camera']\n if (this.hasGoogleApiKeyValue) {\n defaultSources.push('image_search')\n }\n\n // configure cloudinary's uploader's options.\n // many of these are configurable at the point where the `shared/fields/cloudinary_image` partial is included.\n var options = {\n cloud_name: this.cloudNameValue,\n apiKey: this.apiKeyValue,\n upload_preset: this.uploadPresetValue,\n upload_signature: this.getCloudinarySignature.bind(this),\n multiple: false,\n sources: this.hasSourcesValue ? this.sourcesValue.split(',') : defaultSources,\n search_by_rights: this.hasSearchByRightsValue && this.searchByRightsValue === false ? false : true // default to true.\n }\n \n if (this.hasGoogleApiKeyValue) {\n options['google_api_key'] = this.googleApiKeyValue\n }\n \n // open cloudinary's upload widget.\n cloudinary.openUploadWidget(options, this.handleWidgetResponse.bind(this))\n }\n \n clearImage(event) {\n // don't submit the form.\n event.preventDefault()\n\n // clear the cloudinary id.\n this.hiddenFieldTarget.value = null\n \n // remove any existing image from the button.\n this.removeThumbnail()\n }\n \n getCloudinarySignature(callback, paramsToSign) {\n $.ajax({\n url: this.signaturesUrlValue,\n type: \"GET\",\n dataType: \"text\",\n data: {data: paramsToSign},\n complete: function() { console.log(\"complete\") },\n success: function(signature, textStatus, xhr) { callback(signature) },\n error: function(xhr, status, error) { console.log(xhr, status, error) }\n })\n }\n \n handleWidgetResponse(error, response) {\n // after the user has successfully uploaded a single file ..\n if (!error && response && response.event === \"success\") { \n const data = response.info\n \n // update the cloudinary id field in the form.\n this.hiddenFieldTarget.value = data.public_id\n\n // remove any existing image.\n this.removeThumbnail()\n\n // generate a new image preview url.\n this.addThumbnail(this.urlFormatValue.replace('CLOUDINARY_ID', data.public_id))\n }\n }\n \n addThumbnail(url) {\n var $imageElement = $(`<img src=\"${url}\" width=\"${this.widthValue}\" height=\"${this.heightValue}\" data-${this.identifier}-target=\"thumbnail\" />`)\n $(this.uploadButtonTarget).prepend($imageElement)\n\n // mark the image as present.\n this.uploadButtonTarget.classList.add(this.thumbnailShownClass)\n }\n \n removeThumbnail() {\n if (!this.hasThumbnailTarget) { return }\n this.uploadButtonTarget.removeChild(this.thumbnailTarget)\n this.uploadButtonTarget.classList.remove(this.thumbnailShownClass)\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport '@simonwep/pickr/dist/themes/monolith.min.css'\n\nimport Pickr from '@simonwep/pickr';\n\nexport default class extends Controller {\n static targets = [ \"colorPickerValue\", \"colorField\", \"colorInput\", \"userSelectedColor\", \"colorOptions\" ];\n static values = { initialColor: String }\n\n connect() {\n this.initPluginInstance()\n this.colorOptions = $(this.colorOptionsTarget).find('button').map(function (_, button) { return $(button).attr('data-color'); }).get()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n pickColor(event) {\n event.preventDefault();\n\n const targetEl = event.target;\n const color = targetEl.dataset.color;\n\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n $(this.userSelectedColorTarget).data('color', color);\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n this.pickr.setColor(color);\n\n targetEl.classList.add('ring-2', 'ring-offset-2');\n }\n\n pickRandomColor(event) {\n event.preventDefault();\n\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n\n this.pickr.setColor(`rgb ${r} ${g} ${b}`);\n const hexColor = this.pickr.getColor().toHEXA().toString();\n this.pickr.setColor(hexColor);\n\n this.showUserSelectedColor(hexColor);\n }\n\n showUserSelectedColor(color) {\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n $(this.userSelectedColorTarget)\n .addClass('ring-2')\n .addClass('ring-offset-2')\n .css('background-color', color)\n .css('--tw-ring-color', color)\n .attr('data-color', color)\n .show();\n }\n\n unpickColor(event) {\n event.preventDefault();\n $(this.colorPickerValueTarget).val('');\n $(this.colorInputTarget).val('');\n $(this.userSelectedColorTarget).hide();\n $('.button-color').removeClass('ring-2 ring-offset-2');\n }\n\n togglePickr(event) {\n event.preventDefault();\n }\n\n initPluginInstance() {\n this.pickr = Pickr.create({\n el: '.btn-pickr',\n theme: 'monolith',\n useAsButton: true,\n default: this.initialColorValue || '#1E90FF',\n components: {\n // Main components\n preview: true,\n hue: true,\n\n // Input / output Options\n interaction: {\n input: true,\n save: true,\n },\n }\n });\n\n this.pickr.on('save', (color, _instance) => {\n const hexaColor = color.toHEXA().toString()\n if (!this.colorOptions.includes(hexaColor)) {\n this.showUserSelectedColor(hexaColor);\n }\n this.pickr.hide();\n });\n\n const that = this\n\n $('input[type=\"text\"].pcr-result').on('keydown', function (e) {\n if (e.key === 'Enter') {\n that.pickr.applyColor(false)\n }\n })\n }\n\n teardownPluginInstance() {\n this.pickr.destroy()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"daterangepicker/daterangepicker.css\");\n\n// requires jQuery, moment, might want to consider a vanilla JS alternative\nimport 'daterangepicker';\n\nexport default class extends Controller {\n static targets = [ \"field\", \"clearButton\", \"currentTimeZoneWrapper\", \"timeZoneButtons\", \"timeZoneSelectWrapper\", \"timeZoneField\" ]\n static values = {\n includeTime: Boolean,\n defaultTimeZones: Array,\n cancelButtonLabel: { type: String, default: \"Cancel\" },\n applyButtonLabel: { type: String, default: \"Apply\" }\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 $(this.fieldTarget).val('')\n }\n\n applyDateToField(event, picker) {\n const format = this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n $(this.fieldTarget).val(picker.startDate.format(format))\n }\n\n showTimeZoneButtons(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).toggleClass('hidden')\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n }\n\n showTimeZoneSelectWrapper(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).toggleClass('hidden')\n }\n }\n\n resetTimeZoneUI(e) {\n e && e.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).removeClass('hidden')\n $(this.timeZoneButtonsTarget).addClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).addClass('hidden')\n }\n }\n\n setTimeZone(event) {\n // don't follow the anchor\n event.preventDefault()\n\n const currentTimeZoneEl = this.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target.dataset\n\n $(this.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n $(event.target).removeClass('button-alternative').addClass('button')\n\n this.resetTimeZoneUI()\n }\n\n initPluginInstance() {\n $(this.fieldTarget).daterangepicker({\n singleDatePicker: true,\n timePicker: this.includeTimeValue,\n timePickerIncrement: 5,\n autoUpdateInput: false,\n locale: {\n cancelLabel: this.cancelButtonLabelValue,\n applyLabel: this.applyButtonLabelValue,\n format: this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n }\n })\n\n $(this.fieldTarget).on('apply.daterangepicker', this.applyDateToField.bind(this))\n $(this.fieldTarget).on('cancel.daterangepicker', this.clearDate.bind(this))\n\n this.pluginMainEl = this.fieldTarget\n this.plugin = $(this.pluginMainEl).data('daterangepicker') // weird\n\n // Init time zone select\n if (this.includeTimeValue && this.hasTimeZoneSelectWrapperTarget) {\n this.timeZoneSelect = this.timeZoneSelectWrapperTarget.querySelector('select.select2')\n\n $(this.timeZoneSelect).select2({\n width: 'style'\n })\n\n const self = this\n\n $(this.timeZoneSelect).on('change.select2', function(event) {\n const currentTimeZoneEl = self.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target\n\n $(self.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n const selectedOptionTimeZoneButton = $('.selected-option-time-zone-button')\n\n if (self.defaultTimeZonesValue.includes(value)) {\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n selectedOptionTimeZoneButton.addClass('hidden').attr('hidden', true)\n $(`a[data-value=\"${value}\"`).removeClass('button-alternative').addClass('button')\n } else {\n // deselect any selected button\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n\n selectedOptionTimeZoneButton.text(value)\n selectedOptionTimeZoneButton.attr('data-value', value).removeAttr('hidden')\n selectedOptionTimeZoneButton.removeClass(['hidden', 'button-alternative']).addClass('button')\n }\n\n self.resetTimeZoneUI()\n })\n }\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n $(this.pluginMainEl).off('apply.daterangepicker')\n $(this.pluginMainEl).off('cancel.daterangepicker')\n\n // revert to original markup, remove any event listeners\n this.plugin.remove()\n\n if (this.includeTimeValue) {\n $(this.timeZoneSelect).select2('destroy');\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n static targets = [\n \"fileField\",\n \"removeFileFlag\",\n \"downloadFileButton\",\n \"removeFileButton\",\n \"selectFileButton\",\n \"progressBar\",\n ];\n\n connect() {\n // Add upload event listeners\n const initializeListener = document.addEventListener(\n \"direct-upload:initialize\",\n (event) => {\n this.selectFileButtonTarget.classList.add(\"hidden\");\n this.progressBarTarget.innerText = \"0%\";\n this.progressBarTarget.style.width = \"0%\";\n this.progressBarTarget.setAttribute(\"aria-valuenow\", 0);\n this.progressBarTarget.parentNode.classList.remove(\"hidden\");\n }\n );\n\n const progressListener = document.addEventListener(\n \"direct-upload:progress\",\n (event) => {\n const { progress } = event.detail;\n const width = `${progress.toFixed(1)}%`;\n\n this.progressBarTarget.innerText = width;\n this.progressBarTarget.setAttribute(\"aria-valuenow\", progress);\n this.progressBarTarget.style.width = width;\n }\n );\n\n const errorListener = document.addEventListener(\n \"direct-upload:error\",\n (event) => {\n event.preventDefault();\n\n const { error } = event.detail;\n this.progressBarTarget.innerText = error;\n }\n );\n\n this.uploadListeners = {\n \"direct-upload:initialize\": initializeListener,\n \"direct-upload:progress\": progressListener,\n \"direct-upload:error\": errorListener,\n };\n }\n\n disconnect() {\n // Teardown event listeners\n for (const event in this.uploadListeners) {\n document.removeEventListener(event, this.uploadListeners[event]);\n }\n }\n\n uploadFile() {\n this.fileFieldTarget.click();\n }\n\n removeFile() {\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.classList.add(\"hidden\");\n }\n\n this.removeFileButtonTarget.classList.add(\"hidden\");\n this.removeFileFlagTarget.value = true;\n }\n\n handleFileSelected() {\n const statusText = this.selectFileButtonTarget.querySelector(\"span\");\n const icon = this.selectFileButtonTarget.querySelector(\"i\");\n\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.remove();\n }\n\n statusText.innerText = \"Select Another File\";\n icon.classList.remove(\"ti-upload\");\n icon.classList.add(\"ti-check\");\n }\n}\n","import { Controller } from \"stimulus\";\nimport zxcvbn from \"zxcvbn\";\n\nexport default class extends Controller {\n static targets = [\"strengthIndicator\"];\n\n estimateStrength(e) {\n const result = zxcvbn(e.target.value);\n\n if (result.feedback && result.feedback.warning.length > 0) {\n this.strengthIndicatorTarget.innerText = `${result.feedback.warning}.`;\n this.strengthIndicatorTarget.classList.remove(\"hidden\");\n } else {\n this.strengthIndicatorTarget.classList.add(\"hidden\");\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"intl-tel-input/build/css/intlTelInput.css\");\nimport intlTelInput from 'intl-tel-input';\n\nexport default class extends Controller {\n static targets = [ \"field\" ]\n\n connect() {\n this.initPluginInstance()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n initPluginInstance() {\n let options = {\n hiddenInput: this.fieldTarget.dataset.method,\n customContainer: \"w-full\"\n }\n\n // TODO: add instructions on how to copy this asset into the application's assets path and write the meta tag into the head (via the engine?)\n const utilsScriptPath = metaContent(\"intl_tel_input_utils_path\")\n if (utilsScriptPath) {\n options['utilsScript'] = utilsScriptPath\n }\n\n this.plugin = intlTelInput(this.fieldTarget, options);\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n // revert to original markup, remove any event listeners\n this.plugin.destroy()\n }\n}\n\nfunction metaContent (name) {\n const element = document.head.querySelector(`meta[name=\"${name}\"]`)\n return element && element.content\n}","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"select2/dist/css/select2.min.css\");\nimport select2 from \"select2\";\n\nexport default class extends Controller {\n static targets = [ \"select\" ]\n static values = {\n acceptsNew: Boolean,\n enableSearch: Boolean,\n searchUrl: String,\n }\n \n // will be reissued as native dom events name prepended with '$' e.g. '$change', '$select2:closing', etc\n static jQueryEventsToReissue = [ \"change\", \"select2:closing\", \"select2:close\", \"select2:opening\", \"select2:open\", \"select2:selecting\", \"select2:select\", \"select2:unselecting\", \"select2:unselect\", \"select2:clearing\", \"select2:clear\" ]\n \n\n initialize() {\n this.dispatchNativeEvent = this.dispatchNativeEvent.bind(this)\n if (this.isSelect2LoadedOnWindowJquery) {\n select2(window.$)\n }\n }\n\n get isSelect2LoadedOnWindowJquery() {\n return (window.$ !== undefined && window.$.select2 === undefined)\n }\n\n connect() {\n if (this.isSelect2LoadedOnWindowJquery) {\n this.initPluginInstance()\n }\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n cleanupBeforeInit() {\n $(this.element).find('.select2-container--default').remove()\n }\n\n initPluginInstance() {\n let options = {};\n\n if (!this.enableSearchValue) {\n options.minimumResultsForSearch = -1;\n }\n\n options.tags = this.acceptsNewValue\n\n if (this.searchUrlValue) {\n options.ajax = {\n url: this.searchUrlValue,\n dataType: 'json',\n // We enable pagination by default here\n data: function(params) {\n var query = {\n search: params.term,\n page: params.page || 1\n }\n return query\n }\n // Any additional params go here...\n }\n }\n\n options.templateResult = this.formatState;\n options.templateSelection = this.formatState;\n options.width = 'style';\n\n this.cleanupBeforeInit() // in case improperly torn down\n this.pluginMainEl = this.selectTarget // required because this.selectTarget is unavailable on disconnect()\n $(this.pluginMainEl).select2(options);\n\n this.initReissuePluginEventsAsNativeEvents()\n }\n\n teardownPluginInstance() {\n if (this.pluginMainEl === undefined) { return }\n\n // ensure there are no orphaned event handlers\n this.teardownPluginEventsAsNativeEvents()\n \n // revert to original markup, remove any event listeners\n $(this.pluginMainEl).select2('destroy');\n }\n\n initReissuePluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).on(eventName, this.dispatchNativeEvent)\n })\n }\n \n teardownPluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).off(eventName)\n })\n }\n \n dispatchNativeEvent(event) {\n const nativeEventName = '$' + event.type // e.g. '$change.select2'\n this.element.dispatchEvent(new CustomEvent(nativeEventName, { detail: { event: event }, bubbles: true, cancelable: false }))\n }\n\n // https://stackoverflow.com/questions/29290389/select2-add-image-icon-to-option-dynamically\n formatState(opt) {\n var imageUrl = $(opt.element).attr('data-image');\n var imageHtml = \"\";\n if (imageUrl) {\n imageHtml = '<img src=\"' + imageUrl + '\" /> ';\n }\n return $('<span>' + imageHtml + sanitizeHTML(opt.text) + '</span>');\n }\n}\n\n// https://portswigger.net/web-security/cross-site-scripting/preventing\nfunction sanitizeHTML(str) {\n return str.replace(/[^\\w. ]/gi, function (c) {\n return '&#' + c.charCodeAt(0) + ';';\n });\n};\n","import { identifierForContextKey } from \"@hotwired/stimulus-webpack-helpers\"\n\nimport ButtonToggleController from './fields/button_toggle_controller'\nimport CloudinaryImageController from './fields/cloudinary_image_controller'\nimport ColorPickerController from './fields/color_picker_controller'\nimport DateController from './fields/date_controller'\nimport FileFieldController from './fields/file_field_controller'\nimport PasswordController from './fields/password_controller'\nimport PhoneController from './fields/phone_controller'\nimport SuperSelectController from './fields/super_select_controller'\n\nexport const controllerDefinitions = [\n [ButtonToggleController, 'fields/button_toggle_controller.js'],\n [CloudinaryImageController, 'fields/cloudinary_image_controller.js'],\n [ColorPickerController, 'fields/color_picker_controller.js'],\n [DateController, 'fields/date_controller.js'],\n [FileFieldController, 'fields/file_field_controller.js'],\n [PasswordController, 'fields/password_controller.js'],\n [PhoneController, 'fields/phone_controller.js'],\n [SuperSelectController, 'fields/super_select_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 ButtonToggleController,\n CloudinaryImageController,\n ColorPickerController,\n DateController,\n FileFieldController,\n PasswordController,\n PhoneController,\n SuperSelectController,\n}","import Tribute from 'tributejs'\nrequire(\"trix/dist/trix.css\");\n\nrequire(\"trix\")\nrequire(\"@rails/actiontext\")\n\n// only show the editor tool bar when the user is editing the field.\n// inspired by https://github.com/basecamp/trix/issues/343 and `app/assets/stylesheets/account/fields/trix_editor.scss`\n\nexport function trixEditor() {\n document.addEventListener('trix-initialize', function() {\n addEventListener(\"trix-focus\", updateTrixToolbarVisability);\n addEventListener(\"trix-blur\", updateTrixToolbarVisability);\n updateTrixToolbarVisability();\n initializeTribute();\n })\n}\n\nfunction updateTrixToolbarVisability() {\n document.querySelectorAll(\"trix-editor\").forEach((editorElement, index) => {\n var toolbarElement = editorElement.toolbarElement;\n if (editorElement == document.activeElement) {\n toolbarElement.classList.add('visible');\n } else {\n // don't hide the toolbar if we've unfocused to focus on the link dialog.\n if (!toolbarElement.contains(document.activeElement)) {\n toolbarElement.classList.remove('visible');\n }\n }\n })\n}\n\nfunction initializeTribute() {\n document.querySelectorAll(\"trix-editor\").forEach((el, index) => {\n var editor = el.editor;\n \n var mentionConfig = {\n trigger: '@',\n values: JSON.parse(editor.element.dataset.mentions),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var topicConfig = {\n trigger: '#',\n values: JSON.parse(editor.element.dataset.topics),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var tribute = new Tribute({\n collection: [topicConfig, mentionConfig],\n });\n \n tribute.attach(el);\n })\n}\n"],"names":["identifierForContextKey","key","logicalName","match","replace","Controller","clickShadowField","event","preventDefault","this","shadowFieldTarget","click","targets","pickImageAndUpload","defaultSources","hasGoogleApiKeyValue","push","options","cloud_name","cloudNameValue","apiKey","apiKeyValue","upload_preset","uploadPresetValue","upload_signature","getCloudinarySignature","bind","multiple","sources","hasSourcesValue","sourcesValue","split","search_by_rights","hasSearchByRightsValue","searchByRightsValue","googleApiKeyValue","cloudinary","openUploadWidget","handleWidgetResponse","clearImage","hiddenFieldTarget","value","removeThumbnail","callback","paramsToSign","$","ajax","url","signaturesUrlValue","type","dataType","data","complete","console","log","success","signature","textStatus","xhr","error","status","response","info","public_id","addThumbnail","urlFormatValue","$imageElement","widthValue","heightValue","identifier","uploadButtonTarget","prepend","classList","add","thumbnailShownClass","hasThumbnailTarget","removeChild","thumbnailTarget","remove","values","signaturesUrl","String","height","Number","width","cloudName","googleApiKey","urlFormat","searchByRights","Boolean","classes","connect","initPluginInstance","colorOptions","colorOptionsTarget","find","map","_","button","attr","get","disconnect","teardownPluginInstance","pickColor","targetEl","target","color","dataset","colorInputTarget","val","colorPickerValueTarget","userSelectedColorTarget","removeClass","pickr","setColor","pickRandomColor","r","Math","floor","random","g","b","hexColor","getColor","toHEXA","toString","showUserSelectedColor","addClass","css","show","unpickColor","hide","togglePickr","Pickr","create","el","theme","useAsButton","default","initialColorValue","components","preview","hue","interaction","input","save","on","_instance","hexaColor","includes","that","e","applyColor","destroy","initialColor","require","clearDate","fieldTarget","applyDateToField","picker","format","includeTimeValue","startDate","showTimeZoneButtons","currentTimeZoneWrapperTarget","toggleClass","timeZoneButtonsTarget","showTimeZoneSelectWrapper","hasTimeZoneSelectWrapperTarget","timeZoneSelectWrapperTarget","resetTimeZoneUI","setTimeZone","currentTimeZoneEl","querySelector","timeZoneFieldTarget","text","daterangepicker","singleDatePicker","timePicker","timePickerIncrement","autoUpdateInput","locale","cancelLabel","cancelButtonLabelValue","applyLabel","applyButtonLabelValue","pluginMainEl","plugin","timeZoneSelect","select2","self","selectedOptionTimeZoneButton","defaultTimeZonesValue","removeAttr","undefined","off","includeTime","defaultTimeZones","Array","cancelButtonLabel","applyButtonLabel","initializeListener","document","addEventListener","selectFileButtonTarget","progressBarTarget","innerText","style","setAttribute","parentNode","progressListener","progress","detail","toFixed","errorListener","uploadListeners","removeEventListener","uploadFile","fileFieldTarget","removeFile","hasDownloadFileButtonTarget","downloadFileButtonTarget","removeFileButtonTarget","removeFileFlagTarget","handleFileSelected","statusText","icon","estimateStrength","result","zxcvbn","feedback","warning","length","strengthIndicatorTarget","hiddenInput","method","customContainer","utilsScriptPath","name","element","head","content","metaContent","intlTelInput","initialize","dispatchNativeEvent","isSelect2LoadedOnWindowJquery","window","cleanupBeforeInit","enableSearchValue","minimumResultsForSearch","tags","acceptsNewValue","searchUrlValue","params","search","term","page","templateResult","formatState","templateSelection","selectTarget","initReissuePluginEventsAsNativeEvents","teardownPluginEventsAsNativeEvents","constructor","jQueryEventsToReissue","forEach","eventName","dispatchEvent","CustomEvent","bubbles","cancelable","opt","imageUrl","imageHtml","c","charCodeAt","acceptsNew","enableSearch","searchUrl","controllerDefinitions","ButtonToggleController","CloudinaryImageController","ColorPickerController","DateController","FileFieldController","PasswordController","PhoneController","SuperSelectController","d","controller","controllerConstructor","updateTrixToolbarVisability","querySelectorAll","editorElement","index","toolbarElement","activeElement","contains","editor","mentionConfig","trigger","JSON","parse","mentions","selectTemplate","item","original","protocol","model","id","label","menuItemTemplate","photo","string","requireLeadingSpace","replaceTextSuffix","topicConfig","topics","Tribute","collection","attach"],"mappings":"uWAqBA,SAASA,EAAwBC,GAC7B,MAAMC,GAAeD,EAAIE,MAAM,2CAA6C,IAAI,GAChF,GAAID,EACA,OAAOA,EAAYE,QAAQ,KAAM,KAAKA,QAAQ,MAAO,sBCtBhCC,aAG3BC,iBAAiBC,GAEfA,EAAMC,iBAGNC,KAAKC,kBAAkBC,WAPlBC,QAAU,CAAE,+BCDQP,aAe3BQ,mBAAmBN,GAEjBA,EAAMC,iBAGN,IAAIM,EA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AW,MAAQF,EAAKG,MAAQ,IAAMH,EAAKI,GAAK,KAAOJ,EAAKK,MAAQ,QAEhGC,iBAAkB,SAAUN,GAC1B,MAAO,aAAeA,EAAKC,SAASM,MAAQ,QAAUP,EAAKQ,QAE7DC,qBAAqB,EACrBC,kBAAmB,IAGP,IAAIG,UAAQ,CACxBC,WAAY,CAACH,EAAajB,KAGpBqB,OAAO1L"}
@@ -1,2 +1,2 @@
1
- import{Controller as e}from"@hotwired/stimulus";import"@simonwep/pickr/dist/themes/monolith.min.css";import t from"@simonwep/pickr";import"daterangepicker";import{Controller as i}from"stimulus";import s from"zxcvbn";import a from"intl-tel-input";import n from"select2";import r from"tributejs";function l(e){const t=(e.match(/^(?:\.\/)?(.+)(?:[_-]controller\..+?)$/)||[])[1];if(t)return t.replace(/_/g,"-").replace(/\//g,"--")}class o extends e{clickShadowField(e){e.preventDefault(),this.shadowFieldTarget.click()}}o.targets=["shadowField"];class c extends e{pickImageAndUpload(e){e.preventDefault();var t=["local","url","camera"];this.hasGoogleApiKeyValue&&t.push("image_search");var i={cloud_name:this.cloudNameValue,apiKey:this.apiKeyValue,upload_preset:this.uploadPresetValue,upload_signature:this.getCloudinarySignature.bind(this),multiple:!1,sources:this.hasSourcesValue?this.sourcesValue.split(","):t,search_by_rights:!this.hasSearchByRightsValue||!1!==this.searchByRightsValue};this.hasGoogleApiKeyValue&&(i.google_api_key=this.googleApiKeyValue),cloudinary.openUploadWidget(i,this.handleWidgetResponse.bind(this))}clearImage(e){e.preventDefault(),this.hiddenFieldTarget.value=null,this.removeThumbnail()}getCloudinarySignature(e,t){$.ajax({url:this.signaturesUrlValue,type:"GET",dataType:"text",data:{data:t},complete:function(){console.log("complete")},success:function(t,i,s){e(t)},error:function(e,t,i){console.log(e,t,i)}})}handleWidgetResponse(e,t){if(!e&&t&&"success"===t.event){const e=t.info;this.hiddenFieldTarget.value=e.public_id,this.removeThumbnail(),this.addThumbnail(this.urlFormatValue.replace("CLOUDINARY_ID",e.public_id))}}addThumbnail(e){var t=$(`<img src="${e}" width="${this.widthValue}" height="${this.heightValue}" data-${this.identifier}-target="thumbnail" />`);$(this.uploadButtonTarget).prepend(t),this.uploadButtonTarget.classList.add(this.thumbnailShownClass)}removeThumbnail(){this.hasThumbnailTarget&&(this.uploadButtonTarget.removeChild(this.thumbnailTarget),this.uploadButtonTarget.classList.remove(this.thumbnailShownClass))}}c.targets=["uploadButton","hiddenField","thumbnail"],c.values={signaturesUrl:String,height:Number,width:Number,cloudName:String,apiKey:String,googleApiKey:String,urlFormat:String,sources:String,searchByRights:Boolean},c.classes=["thumbnailShown"];class d extends e{connect(){this.initPluginInstance(),this.colorOptions=$(this.colorOptionsTarget).find("button").map(function(e,t){return $(t).attr("data-color")}).get()}disconnect(){this.teardownPluginInstance()}pickColor(e){e.preventDefault();const t=e.target,i=t.dataset.color;$(this.colorInputTarget).val(i),$(this.colorPickerValueTarget).val(i),$(this.userSelectedColorTarget).data("color",i),$(".button-color").removeClass("ring-2 ring-offset-2"),this.pickr.setColor(i),t.classList.add("ring-2","ring-offset-2")}pickRandomColor(e){e.preventDefault();const t=Math.floor(256*Math.random()),i=Math.floor(256*Math.random()),s=Math.floor(256*Math.random());this.pickr.setColor(`rgb ${t} ${i} ${s}`);const a=this.pickr.getColor().toHEXA().toString();this.pickr.setColor(a),this.showUserSelectedColor(a)}showUserSelectedColor(e){$(this.colorInputTarget).val(e),$(this.colorPickerValueTarget).val(e),$(".button-color").removeClass("ring-2 ring-offset-2"),$(this.userSelectedColorTarget).addClass("ring-2").addClass("ring-offset-2").css("background-color",e).css("--tw-ring-color",e).attr("data-color",e).show()}unpickColor(e){e.preventDefault(),$(this.colorPickerValueTarget).val(""),$(this.colorInputTarget).val(""),$(this.userSelectedColorTarget).hide(),$(".button-color").removeClass("ring-2 ring-offset-2")}togglePickr(e){e.preventDefault()}initPluginInstance(){this.pickr=t.create({el:".btn-pickr",theme:"monolith",useAsButton:!0,default:this.initialColorValue||"#1E90FF",components:{preview:!0,hue:!0,interaction:{input:!0,save:!0}}}),this.pickr.on("save",(e,t)=>{const i=e.toHEXA().toString();this.colorOptions.includes(i)||this.showUserSelectedColor(i),this.pickr.hide()});const e=this;$('input[type="text"].pcr-result').on("keydown",function(t){"Enter"===t.key&&e.pickr.applyColor(!1)})}teardownPluginInstance(){this.pickr.destroy()}}d.targets=["colorPickerValue","colorField","colorInput","userSelectedColor","colorOptions"],d.values={initialColor:String},require("daterangepicker/daterangepicker.css");class u extends e{connect(){this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}clearDate(e){e.preventDefault(),$(this.fieldTarget).val("")}applyDateToField(e,t){const i=this.includeTimeValue?"MM/DD/YYYY h:mm A":"MM/DD/YYYY";$(this.fieldTarget).val(t.startDate.format(i))}showTimeZoneButtons(e){e.preventDefault(),$(this.currentTimeZoneWrapperTarget).toggleClass("hidden"),$(this.timeZoneButtonsTarget).toggleClass("hidden")}showTimeZoneSelectWrapper(e){e.preventDefault(),$(this.timeZoneButtonsTarget).toggleClass("hidden"),this.hasTimeZoneSelectWrapperTarget&&$(this.timeZoneSelectWrapperTarget).toggleClass("hidden")}resetTimeZoneUI(e){e&&e.preventDefault(),$(this.currentTimeZoneWrapperTarget).removeClass("hidden"),$(this.timeZoneButtonsTarget).addClass("hidden"),this.hasTimeZoneSelectWrapperTarget&&$(this.timeZoneSelectWrapperTarget).addClass("hidden")}setTimeZone(e){e.preventDefault();const t=this.currentTimeZoneWrapperTarget.querySelector("a"),{value:i}=e.target.dataset;$(this.timeZoneFieldTarget).val(i),$(t).text(i),$(".time-zone-button").removeClass("button").addClass("button-alternative"),$(e.target).removeClass("button-alternative").addClass("button"),this.resetTimeZoneUI()}initPluginInstance(){if($(this.fieldTarget).daterangepicker({singleDatePicker:!0,timePicker:this.includeTimeValue,timePickerIncrement:5,autoUpdateInput:!1,locale:{cancelLabel:this.cancelButtonLabelValue,applyLabel:this.applyButtonLabelValue,format:this.includeTimeValue?"MM/DD/YYYY h:mm A":"MM/DD/YYYY"}}),$(this.fieldTarget).on("apply.daterangepicker",this.applyDateToField.bind(this)),$(this.fieldTarget).on("cancel.daterangepicker",this.clearDate.bind(this)),this.pluginMainEl=this.fieldTarget,this.plugin=$(this.pluginMainEl).data("daterangepicker"),this.includeTimeValue&&this.hasTimeZoneSelectWrapperTarget){this.timeZoneSelect=this.timeZoneSelectWrapperTarget.querySelector("select.select2"),$(this.timeZoneSelect).select2({width:"style"});const e=this;$(this.timeZoneSelect).on("change.select2",function(t){const i=e.currentTimeZoneWrapperTarget.querySelector("a"),{value:s}=t.target;$(e.timeZoneFieldTarget).val(s),$(i).text(s);const a=$(".selected-option-time-zone-button");e.defaultTimeZonesValue.includes(s)?($(".time-zone-button").removeClass("button").addClass("button-alternative"),a.addClass("hidden").attr("hidden",!0),$(`a[data-value="${s}"`).removeClass("button-alternative").addClass("button")):($(".time-zone-button").removeClass("button").addClass("button-alternative"),a.text(s),a.attr("data-value",s).removeAttr("hidden"),a.removeClass(["hidden","button-alternative"]).addClass("button")),e.resetTimeZoneUI()})}}teardownPluginInstance(){void 0!==this.plugin&&($(this.pluginMainEl).off("apply.daterangepicker"),$(this.pluginMainEl).off("cancel.daterangepicker"),this.plugin.remove(),this.includeTimeValue&&$(this.timeZoneSelect).select2("destroy"))}}u.targets=["field","clearButton","currentTimeZoneWrapper","timeZoneButtons","timeZoneSelectWrapper","timeZoneField"],u.values={includeTime:Boolean,defaultTimeZones:Array,cancelButtonLabel:{type:String,default:"Cancel"},applyButtonLabel:{type:String,default:"Apply"}};class h extends e{connect(){const e=document.addEventListener("direct-upload:initialize",e=>{this.selectFileButtonTarget.classList.add("hidden"),this.progressBarTarget.innerText="0%",this.progressBarTarget.style.width="0%",this.progressBarTarget.setAttribute("aria-valuenow",0),this.progressBarTarget.parentNode.classList.remove("hidden")}),t=document.addEventListener("direct-upload:progress",e=>{const{progress:t}=e.detail,i=`${t.toFixed(1)}%`;this.progressBarTarget.innerText=i,this.progressBarTarget.setAttribute("aria-valuenow",t),this.progressBarTarget.style.width=i}),i=document.addEventListener("direct-upload:error",e=>{e.preventDefault();const{error:t}=e.detail;this.progressBarTarget.innerText=t});this.uploadListeners={"direct-upload:initialize":e,"direct-upload:progress":t,"direct-upload:error":i}}disconnect(){for(const e in this.uploadListeners)document.removeEventListener(e,this.uploadListeners[e])}uploadFile(){this.fileFieldTarget.click()}removeFile(){this.hasDownloadFileButtonTarget&&this.downloadFileButtonTarget.classList.add("hidden"),this.removeFileButtonTarget.classList.add("hidden"),this.removeFileFlagTarget.value=!0}handleFileSelected(){const e=this.selectFileButtonTarget.querySelector("span"),t=this.selectFileButtonTarget.querySelector("i");this.hasDownloadFileButtonTarget&&this.downloadFileButtonTarget.remove(),e.innerText="Select Another File",t.classList.remove("ti-upload"),t.classList.add("ti-check")}}h.targets=["fileField","removeFileFlag","downloadFileButton","removeFileButton","selectFileButton","progressBar"];class g extends i{estimateStrength(e){const t=s(e.target.value);t.feedback?(this.strengthIndicatorTarget.innerText=`${t.feedback.warning}.`,this.strengthIndicatorTarget.classList.remove("hidden")):this.strengthIndicatorTarget.classList.add("hidden")}}g.targets=["strengthIndicator"],require("intl-tel-input/build/css/intlTelInput.css");class p extends e{connect(){this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}initPluginInstance(){let e={hiddenInput:this.fieldTarget.dataset.method,customContainer:"w-full"};const t=function(e){const t=document.head.querySelector('meta[name="intl_tel_input_utils_path"]');return t&&t.content}();t&&(e.utilsScript=t),this.plugin=a(this.fieldTarget,e)}teardownPluginInstance(){void 0!==this.plugin&&this.plugin.destroy()}}p.targets=["field"],require("select2/dist/css/select2.min.css");class m extends e{initialize(){this.dispatchNativeEvent=this.dispatchNativeEvent.bind(this),this.isSelect2LoadedOnWindowJquery&&n(window.$)}get isSelect2LoadedOnWindowJquery(){return void 0!==window.$&&void 0===window.$.select2}connect(){this.isSelect2LoadedOnWindowJquery&&this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}cleanupBeforeInit(){$(this.element).find(".select2-container--default").remove()}initPluginInstance(){let e={};this.enableSearchValue||(e.minimumResultsForSearch=-1),e.tags=this.acceptsNewValue,this.searchUrlValue&&(e.ajax={url:this.searchUrlValue,dataType:"json",data:function(e){return{search:e.term,page:e.page||1}}}),e.templateResult=this.formatState,e.templateSelection=this.formatState,e.width="style",this.cleanupBeforeInit(),this.pluginMainEl=this.selectTarget,$(this.pluginMainEl).select2(e),this.initReissuePluginEventsAsNativeEvents()}teardownPluginInstance(){void 0!==this.pluginMainEl&&(this.teardownPluginEventsAsNativeEvents(),$(this.pluginMainEl).select2("destroy"))}initReissuePluginEventsAsNativeEvents(){this.constructor.jQueryEventsToReissue.forEach(e=>{$(this.pluginMainEl).on(e,this.dispatchNativeEvent)})}teardownPluginEventsAsNativeEvents(){this.constructor.jQueryEventsToReissue.forEach(e=>{$(this.pluginMainEl).off(e)})}dispatchNativeEvent(e){this.element.dispatchEvent(new CustomEvent("$"+e.type,{detail:{event:e},bubbles:!0,cancelable:!1}))}formatState(e){var t=$(e.element).attr("data-image"),i="";return t&&(i='<img src="'+t+'" /> '),$("<span>"+i+e.text.replace(/[^\w. ]/gi,function(e){return"&#"+e.charCodeAt(0)+";"})+"</span>")}}m.targets=["select"],m.values={acceptsNew:Boolean,enableSearch:Boolean,searchUrl:String},m.jQueryEventsToReissue=["change","select2:closing","select2:close","select2:opening","select2:open","select2:selecting","select2:select","select2:unselecting","select2:unselect","select2:clearing","select2:clear"];const v=[[o,"fields/button_toggle_controller.js"],[c,"fields/cloudinary_image_controller.js"],[d,"fields/color_picker_controller.js"],[u,"fields/date_controller.js"],[h,"fields/file_field_controller.js"],[g,"fields/password_controller.js"],[p,"fields/phone_controller.js"],[m,"fields/super_select_controller.js"]].map(function(e){const t=e[0];return{identifier:l(e[1]),controllerConstructor:t}});function f(){document.addEventListener("trix-initialize",function(){addEventListener("trix-focus",T),addEventListener("trix-blur",T),T(),document.querySelectorAll("trix-editor").forEach((e,t)=>{var i=e.editor,s={trigger:"@",values:JSON.parse(i.element.dataset.mentions),selectTemplate:function(e){return'<a href="'+(e=e.original).protocol+"://"+e.model+"/"+e.id+'">'+e.label+"</a>"},menuItemTemplate:function(e){return'<img src="'+e.original.photo+'" /> '+e.string},requireLeadingSpace:!0,replaceTextSuffix:""},a={trigger:"#",values:JSON.parse(i.element.dataset.topics),selectTemplate:function(e){return'<a href="'+(e=e.original).protocol+"://"+e.model+"/"+e.id+'">'+e.label+"</a>"},menuItemTemplate:function(e){return'<img src="'+e.original.photo+'" /> '+e.string},requireLeadingSpace:!0,replaceTextSuffix:""};new r({collection:[a,s]}).attach(e)})})}function T(){document.querySelectorAll("trix-editor").forEach((e,t)=>{var i=e.toolbarElement;e==document.activeElement?i.classList.add("visible"):i.contains(document.activeElement)||i.classList.remove("visible")})}require("trix/dist/trix.css"),require("trix"),require("@rails/actiontext");export{o as ButtonToggleController,c as CloudinaryImageController,d as ColorPickerController,u as DateController,h as FileFieldController,g as PasswordController,p as PhoneController,m as SuperSelectController,v as controllerDefinitions,f as trixEditor};
1
+ import{Controller as e}from"@hotwired/stimulus";import"@simonwep/pickr/dist/themes/monolith.min.css";import t from"@simonwep/pickr";import"daterangepicker";import i from"zxcvbn";import s from"intl-tel-input";import a from"select2";import n from"tributejs";function r(e){const t=(e.match(/^(?:\.\/)?(.+)(?:[_-]controller\..+?)$/)||[])[1];if(t)return t.replace(/_/g,"-").replace(/\//g,"--")}class l extends e{clickShadowField(e){e.preventDefault(),this.shadowFieldTarget.click()}}l.targets=["shadowField"];class o extends e{pickImageAndUpload(e){e.preventDefault();var t=["local","url","camera"];this.hasGoogleApiKeyValue&&t.push("image_search");var i={cloud_name:this.cloudNameValue,apiKey:this.apiKeyValue,upload_preset:this.uploadPresetValue,upload_signature:this.getCloudinarySignature.bind(this),multiple:!1,sources:this.hasSourcesValue?this.sourcesValue.split(","):t,search_by_rights:!this.hasSearchByRightsValue||!1!==this.searchByRightsValue};this.hasGoogleApiKeyValue&&(i.google_api_key=this.googleApiKeyValue),cloudinary.openUploadWidget(i,this.handleWidgetResponse.bind(this))}clearImage(e){e.preventDefault(),this.hiddenFieldTarget.value=null,this.removeThumbnail()}getCloudinarySignature(e,t){$.ajax({url:this.signaturesUrlValue,type:"GET",dataType:"text",data:{data:t},complete:function(){console.log("complete")},success:function(t,i,s){e(t)},error:function(e,t,i){console.log(e,t,i)}})}handleWidgetResponse(e,t){if(!e&&t&&"success"===t.event){const e=t.info;this.hiddenFieldTarget.value=e.public_id,this.removeThumbnail(),this.addThumbnail(this.urlFormatValue.replace("CLOUDINARY_ID",e.public_id))}}addThumbnail(e){var t=$(`<img src="${e}" width="${this.widthValue}" height="${this.heightValue}" data-${this.identifier}-target="thumbnail" />`);$(this.uploadButtonTarget).prepend(t),this.uploadButtonTarget.classList.add(this.thumbnailShownClass)}removeThumbnail(){this.hasThumbnailTarget&&(this.uploadButtonTarget.removeChild(this.thumbnailTarget),this.uploadButtonTarget.classList.remove(this.thumbnailShownClass))}}o.targets=["uploadButton","hiddenField","thumbnail"],o.values={signaturesUrl:String,height:Number,width:Number,cloudName:String,apiKey:String,googleApiKey:String,urlFormat:String,sources:String,searchByRights:Boolean},o.classes=["thumbnailShown"];class c extends e{connect(){this.initPluginInstance(),this.colorOptions=$(this.colorOptionsTarget).find("button").map(function(e,t){return $(t).attr("data-color")}).get()}disconnect(){this.teardownPluginInstance()}pickColor(e){e.preventDefault();const t=e.target,i=t.dataset.color;$(this.colorInputTarget).val(i),$(this.colorPickerValueTarget).val(i),$(this.userSelectedColorTarget).data("color",i),$(".button-color").removeClass("ring-2 ring-offset-2"),this.pickr.setColor(i),t.classList.add("ring-2","ring-offset-2")}pickRandomColor(e){e.preventDefault();const t=Math.floor(256*Math.random()),i=Math.floor(256*Math.random()),s=Math.floor(256*Math.random());this.pickr.setColor(`rgb ${t} ${i} ${s}`);const a=this.pickr.getColor().toHEXA().toString();this.pickr.setColor(a),this.showUserSelectedColor(a)}showUserSelectedColor(e){$(this.colorInputTarget).val(e),$(this.colorPickerValueTarget).val(e),$(".button-color").removeClass("ring-2 ring-offset-2"),$(this.userSelectedColorTarget).addClass("ring-2").addClass("ring-offset-2").css("background-color",e).css("--tw-ring-color",e).attr("data-color",e).show()}unpickColor(e){e.preventDefault(),$(this.colorPickerValueTarget).val(""),$(this.colorInputTarget).val(""),$(this.userSelectedColorTarget).hide(),$(".button-color").removeClass("ring-2 ring-offset-2")}togglePickr(e){e.preventDefault()}initPluginInstance(){this.pickr=t.create({el:".btn-pickr",theme:"monolith",useAsButton:!0,default:this.initialColorValue||"#1E90FF",components:{preview:!0,hue:!0,interaction:{input:!0,save:!0}}}),this.pickr.on("save",(e,t)=>{const i=e.toHEXA().toString();this.colorOptions.includes(i)||this.showUserSelectedColor(i),this.pickr.hide()});const e=this;$('input[type="text"].pcr-result').on("keydown",function(t){"Enter"===t.key&&e.pickr.applyColor(!1)})}teardownPluginInstance(){this.pickr.destroy()}}c.targets=["colorPickerValue","colorField","colorInput","userSelectedColor","colorOptions"],c.values={initialColor:String},require("daterangepicker/daterangepicker.css");class d extends e{connect(){this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}clearDate(e){e.preventDefault(),$(this.fieldTarget).val("")}applyDateToField(e,t){const i=this.includeTimeValue?"MM/DD/YYYY h:mm A":"MM/DD/YYYY";$(this.fieldTarget).val(t.startDate.format(i))}showTimeZoneButtons(e){e.preventDefault(),$(this.currentTimeZoneWrapperTarget).toggleClass("hidden"),$(this.timeZoneButtonsTarget).toggleClass("hidden")}showTimeZoneSelectWrapper(e){e.preventDefault(),$(this.timeZoneButtonsTarget).toggleClass("hidden"),this.hasTimeZoneSelectWrapperTarget&&$(this.timeZoneSelectWrapperTarget).toggleClass("hidden")}resetTimeZoneUI(e){e&&e.preventDefault(),$(this.currentTimeZoneWrapperTarget).removeClass("hidden"),$(this.timeZoneButtonsTarget).addClass("hidden"),this.hasTimeZoneSelectWrapperTarget&&$(this.timeZoneSelectWrapperTarget).addClass("hidden")}setTimeZone(e){e.preventDefault();const t=this.currentTimeZoneWrapperTarget.querySelector("a"),{value:i}=e.target.dataset;$(this.timeZoneFieldTarget).val(i),$(t).text(i),$(".time-zone-button").removeClass("button").addClass("button-alternative"),$(e.target).removeClass("button-alternative").addClass("button"),this.resetTimeZoneUI()}initPluginInstance(){if($(this.fieldTarget).daterangepicker({singleDatePicker:!0,timePicker:this.includeTimeValue,timePickerIncrement:5,autoUpdateInput:!1,locale:{cancelLabel:this.cancelButtonLabelValue,applyLabel:this.applyButtonLabelValue,format:this.includeTimeValue?"MM/DD/YYYY h:mm A":"MM/DD/YYYY"}}),$(this.fieldTarget).on("apply.daterangepicker",this.applyDateToField.bind(this)),$(this.fieldTarget).on("cancel.daterangepicker",this.clearDate.bind(this)),this.pluginMainEl=this.fieldTarget,this.plugin=$(this.pluginMainEl).data("daterangepicker"),this.includeTimeValue&&this.hasTimeZoneSelectWrapperTarget){this.timeZoneSelect=this.timeZoneSelectWrapperTarget.querySelector("select.select2"),$(this.timeZoneSelect).select2({width:"style"});const e=this;$(this.timeZoneSelect).on("change.select2",function(t){const i=e.currentTimeZoneWrapperTarget.querySelector("a"),{value:s}=t.target;$(e.timeZoneFieldTarget).val(s),$(i).text(s);const a=$(".selected-option-time-zone-button");e.defaultTimeZonesValue.includes(s)?($(".time-zone-button").removeClass("button").addClass("button-alternative"),a.addClass("hidden").attr("hidden",!0),$(`a[data-value="${s}"`).removeClass("button-alternative").addClass("button")):($(".time-zone-button").removeClass("button").addClass("button-alternative"),a.text(s),a.attr("data-value",s).removeAttr("hidden"),a.removeClass(["hidden","button-alternative"]).addClass("button")),e.resetTimeZoneUI()})}}teardownPluginInstance(){void 0!==this.plugin&&($(this.pluginMainEl).off("apply.daterangepicker"),$(this.pluginMainEl).off("cancel.daterangepicker"),this.plugin.remove(),this.includeTimeValue&&$(this.timeZoneSelect).select2("destroy"))}}d.targets=["field","clearButton","currentTimeZoneWrapper","timeZoneButtons","timeZoneSelectWrapper","timeZoneField"],d.values={includeTime:Boolean,defaultTimeZones:Array,cancelButtonLabel:{type:String,default:"Cancel"},applyButtonLabel:{type:String,default:"Apply"}};class u extends e{connect(){const e=document.addEventListener("direct-upload:initialize",e=>{this.selectFileButtonTarget.classList.add("hidden"),this.progressBarTarget.innerText="0%",this.progressBarTarget.style.width="0%",this.progressBarTarget.setAttribute("aria-valuenow",0),this.progressBarTarget.parentNode.classList.remove("hidden")}),t=document.addEventListener("direct-upload:progress",e=>{const{progress:t}=e.detail,i=`${t.toFixed(1)}%`;this.progressBarTarget.innerText=i,this.progressBarTarget.setAttribute("aria-valuenow",t),this.progressBarTarget.style.width=i}),i=document.addEventListener("direct-upload:error",e=>{e.preventDefault();const{error:t}=e.detail;this.progressBarTarget.innerText=t});this.uploadListeners={"direct-upload:initialize":e,"direct-upload:progress":t,"direct-upload:error":i}}disconnect(){for(const e in this.uploadListeners)document.removeEventListener(e,this.uploadListeners[e])}uploadFile(){this.fileFieldTarget.click()}removeFile(){this.hasDownloadFileButtonTarget&&this.downloadFileButtonTarget.classList.add("hidden"),this.removeFileButtonTarget.classList.add("hidden"),this.removeFileFlagTarget.value=!0}handleFileSelected(){const e=this.selectFileButtonTarget.querySelector("span"),t=this.selectFileButtonTarget.querySelector("i");this.hasDownloadFileButtonTarget&&this.downloadFileButtonTarget.remove(),e.innerText="Select Another File",t.classList.remove("ti-upload"),t.classList.add("ti-check")}}u.targets=["fileField","removeFileFlag","downloadFileButton","removeFileButton","selectFileButton","progressBar"];class h extends e{estimateStrength(e){const t=i(e.target.value);t.feedback&&t.feedback.warning.length>0?(this.strengthIndicatorTarget.innerText=`${t.feedback.warning}.`,this.strengthIndicatorTarget.classList.remove("hidden")):this.strengthIndicatorTarget.classList.add("hidden")}}h.targets=["strengthIndicator"],require("intl-tel-input/build/css/intlTelInput.css");class g extends e{connect(){this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}initPluginInstance(){let e={hiddenInput:this.fieldTarget.dataset.method,customContainer:"w-full"};const t=function(e){const t=document.head.querySelector('meta[name="intl_tel_input_utils_path"]');return t&&t.content}();t&&(e.utilsScript=t),this.plugin=s(this.fieldTarget,e)}teardownPluginInstance(){void 0!==this.plugin&&this.plugin.destroy()}}g.targets=["field"],require("select2/dist/css/select2.min.css");class p extends e{initialize(){this.dispatchNativeEvent=this.dispatchNativeEvent.bind(this),this.isSelect2LoadedOnWindowJquery&&a(window.$)}get isSelect2LoadedOnWindowJquery(){return void 0!==window.$&&void 0===window.$.select2}connect(){this.isSelect2LoadedOnWindowJquery&&this.initPluginInstance()}disconnect(){this.teardownPluginInstance()}cleanupBeforeInit(){$(this.element).find(".select2-container--default").remove()}initPluginInstance(){let e={};this.enableSearchValue||(e.minimumResultsForSearch=-1),e.tags=this.acceptsNewValue,this.searchUrlValue&&(e.ajax={url:this.searchUrlValue,dataType:"json",data:function(e){return{search:e.term,page:e.page||1}}}),e.templateResult=this.formatState,e.templateSelection=this.formatState,e.width="style",this.cleanupBeforeInit(),this.pluginMainEl=this.selectTarget,$(this.pluginMainEl).select2(e),this.initReissuePluginEventsAsNativeEvents()}teardownPluginInstance(){void 0!==this.pluginMainEl&&(this.teardownPluginEventsAsNativeEvents(),$(this.pluginMainEl).select2("destroy"))}initReissuePluginEventsAsNativeEvents(){this.constructor.jQueryEventsToReissue.forEach(e=>{$(this.pluginMainEl).on(e,this.dispatchNativeEvent)})}teardownPluginEventsAsNativeEvents(){this.constructor.jQueryEventsToReissue.forEach(e=>{$(this.pluginMainEl).off(e)})}dispatchNativeEvent(e){this.element.dispatchEvent(new CustomEvent("$"+e.type,{detail:{event:e},bubbles:!0,cancelable:!1}))}formatState(e){var t=$(e.element).attr("data-image"),i="";return t&&(i='<img src="'+t+'" /> '),$("<span>"+i+e.text.replace(/[^\w. ]/gi,function(e){return"&#"+e.charCodeAt(0)+";"})+"</span>")}}p.targets=["select"],p.values={acceptsNew:Boolean,enableSearch:Boolean,searchUrl:String},p.jQueryEventsToReissue=["change","select2:closing","select2:close","select2:opening","select2:open","select2:selecting","select2:select","select2:unselecting","select2:unselect","select2:clearing","select2:clear"];const m=[[l,"fields/button_toggle_controller.js"],[o,"fields/cloudinary_image_controller.js"],[c,"fields/color_picker_controller.js"],[d,"fields/date_controller.js"],[u,"fields/file_field_controller.js"],[h,"fields/password_controller.js"],[g,"fields/phone_controller.js"],[p,"fields/super_select_controller.js"]].map(function(e){const t=e[0];return{identifier:r(e[1]),controllerConstructor:t}});function v(){document.addEventListener("trix-initialize",function(){addEventListener("trix-focus",f),addEventListener("trix-blur",f),f(),document.querySelectorAll("trix-editor").forEach((e,t)=>{var i=e.editor,s={trigger:"@",values:JSON.parse(i.element.dataset.mentions),selectTemplate:function(e){return'<a href="'+(e=e.original).protocol+"://"+e.model+"/"+e.id+'">'+e.label+"</a>"},menuItemTemplate:function(e){return'<img src="'+e.original.photo+'" /> '+e.string},requireLeadingSpace:!0,replaceTextSuffix:""},a={trigger:"#",values:JSON.parse(i.element.dataset.topics),selectTemplate:function(e){return'<a href="'+(e=e.original).protocol+"://"+e.model+"/"+e.id+'">'+e.label+"</a>"},menuItemTemplate:function(e){return'<img src="'+e.original.photo+'" /> '+e.string},requireLeadingSpace:!0,replaceTextSuffix:""};new n({collection:[a,s]}).attach(e)})})}function f(){document.querySelectorAll("trix-editor").forEach((e,t)=>{var i=e.toolbarElement;e==document.activeElement?i.classList.add("visible"):i.contains(document.activeElement)||i.classList.remove("visible")})}require("trix/dist/trix.css"),require("trix"),require("@rails/actiontext");export{l as ButtonToggleController,o as CloudinaryImageController,c as ColorPickerController,d as DateController,u as FileFieldController,h as PasswordController,g as PhoneController,p as SuperSelectController,m as controllerDefinitions,v as trixEditor};
2
2
  //# sourceMappingURL=fields.modern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.modern.js","sources":["../../../node_modules/@hotwired/stimulus-webpack-helpers/dist/stimulus-webpack-helpers.js","../../javascript/controllers/fields/button_toggle_controller.js","../../javascript/controllers/fields/cloudinary_image_controller.js","../../javascript/controllers/fields/color_picker_controller.js","../../javascript/controllers/fields/date_controller.js","../../javascript/controllers/fields/file_field_controller.js","../../javascript/controllers/fields/password_controller.js","../../javascript/controllers/fields/phone_controller.js","../../javascript/controllers/fields/super_select_controller.js","../../javascript/controllers/index.js","../../javascript/trix_editor.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\"\n\nexport default class extends Controller {\n static targets = [ \"shadowField\" ]\n\n clickShadowField(event) {\n // we have to stop safari from doing what we originally expected.\n event.preventDefault();\n\n // then we need to manually click the hidden checkbox or radio button ourselves.\n this.shadowFieldTarget.click()\n }\n}","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [ \"uploadButton\", \"hiddenField\", \"thumbnail\" ]\n static values = { \n signaturesUrl: String,\n height: Number,\n width: Number,\n cloudName: String,\n apiKey: String,\n googleApiKey: String,\n urlFormat: String,\n sources: String,\n searchByRights: Boolean\n }\n static classes = [ \"thumbnailShown\" ]\n\n pickImageAndUpload(event) {\n // don't submit the form.\n event.preventDefault()\n\n // prepare the list of default sources a user can upload an image from.\n var defaultSources = ['local', 'url', 'camera']\n if (this.hasGoogleApiKeyValue) {\n defaultSources.push('image_search')\n }\n\n // configure cloudinary's uploader's options.\n // many of these are configurable at the point where the `shared/fields/cloudinary_image` partial is included.\n var options = {\n cloud_name: this.cloudNameValue,\n apiKey: this.apiKeyValue,\n upload_preset: this.uploadPresetValue,\n upload_signature: this.getCloudinarySignature.bind(this),\n multiple: false,\n sources: this.hasSourcesValue ? this.sourcesValue.split(',') : defaultSources,\n search_by_rights: this.hasSearchByRightsValue && this.searchByRightsValue === false ? false : true // default to true.\n }\n \n if (this.hasGoogleApiKeyValue) {\n options['google_api_key'] = this.googleApiKeyValue\n }\n \n // open cloudinary's upload widget.\n cloudinary.openUploadWidget(options, this.handleWidgetResponse.bind(this))\n }\n \n clearImage(event) {\n // don't submit the form.\n event.preventDefault()\n\n // clear the cloudinary id.\n this.hiddenFieldTarget.value = null\n \n // remove any existing image from the button.\n this.removeThumbnail()\n }\n \n getCloudinarySignature(callback, paramsToSign) {\n $.ajax({\n url: this.signaturesUrlValue,\n type: \"GET\",\n dataType: \"text\",\n data: {data: paramsToSign},\n complete: function() { console.log(\"complete\") },\n success: function(signature, textStatus, xhr) { callback(signature) },\n error: function(xhr, status, error) { console.log(xhr, status, error) }\n })\n }\n \n handleWidgetResponse(error, response) {\n // after the user has successfully uploaded a single file ..\n if (!error && response && response.event === \"success\") { \n const data = response.info\n \n // update the cloudinary id field in the form.\n this.hiddenFieldTarget.value = data.public_id\n\n // remove any existing image.\n this.removeThumbnail()\n\n // generate a new image preview url.\n this.addThumbnail(this.urlFormatValue.replace('CLOUDINARY_ID', data.public_id))\n }\n }\n \n addThumbnail(url) {\n var $imageElement = $(`<img src=\"${url}\" width=\"${this.widthValue}\" height=\"${this.heightValue}\" data-${this.identifier}-target=\"thumbnail\" />`)\n $(this.uploadButtonTarget).prepend($imageElement)\n\n // mark the image as present.\n this.uploadButtonTarget.classList.add(this.thumbnailShownClass)\n }\n \n removeThumbnail() {\n if (!this.hasThumbnailTarget) { return }\n this.uploadButtonTarget.removeChild(this.thumbnailTarget)\n this.uploadButtonTarget.classList.remove(this.thumbnailShownClass)\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport '@simonwep/pickr/dist/themes/monolith.min.css'\n\nimport Pickr from '@simonwep/pickr';\n\nexport default class extends Controller {\n static targets = [ \"colorPickerValue\", \"colorField\", \"colorInput\", \"userSelectedColor\", \"colorOptions\" ];\n static values = { initialColor: String }\n\n connect() {\n this.initPluginInstance()\n this.colorOptions = $(this.colorOptionsTarget).find('button').map(function (_, button) { return $(button).attr('data-color'); }).get()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n pickColor(event) {\n event.preventDefault();\n\n const targetEl = event.target;\n const color = targetEl.dataset.color;\n\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n $(this.userSelectedColorTarget).data('color', color);\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n this.pickr.setColor(color);\n\n targetEl.classList.add('ring-2', 'ring-offset-2');\n }\n\n pickRandomColor(event) {\n event.preventDefault();\n\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n\n this.pickr.setColor(`rgb ${r} ${g} ${b}`);\n const hexColor = this.pickr.getColor().toHEXA().toString();\n this.pickr.setColor(hexColor);\n\n this.showUserSelectedColor(hexColor);\n }\n\n showUserSelectedColor(color) {\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n $(this.userSelectedColorTarget)\n .addClass('ring-2')\n .addClass('ring-offset-2')\n .css('background-color', color)\n .css('--tw-ring-color', color)\n .attr('data-color', color)\n .show();\n }\n\n unpickColor(event) {\n event.preventDefault();\n $(this.colorPickerValueTarget).val('');\n $(this.colorInputTarget).val('');\n $(this.userSelectedColorTarget).hide();\n $('.button-color').removeClass('ring-2 ring-offset-2');\n }\n\n togglePickr(event) {\n event.preventDefault();\n }\n\n initPluginInstance() {\n this.pickr = Pickr.create({\n el: '.btn-pickr',\n theme: 'monolith',\n useAsButton: true,\n default: this.initialColorValue || '#1E90FF',\n components: {\n // Main components\n preview: true,\n hue: true,\n\n // Input / output Options\n interaction: {\n input: true,\n save: true,\n },\n }\n });\n\n this.pickr.on('save', (color, _instance) => {\n const hexaColor = color.toHEXA().toString()\n if (!this.colorOptions.includes(hexaColor)) {\n this.showUserSelectedColor(hexaColor);\n }\n this.pickr.hide();\n });\n\n const that = this\n\n $('input[type=\"text\"].pcr-result').on('keydown', function (e) {\n if (e.key === 'Enter') {\n that.pickr.applyColor(false)\n }\n })\n }\n\n teardownPluginInstance() {\n this.pickr.destroy()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"daterangepicker/daterangepicker.css\");\n\n// requires jQuery, moment, might want to consider a vanilla JS alternative\nimport 'daterangepicker';\n\nexport default class extends Controller {\n static targets = [ \"field\", \"clearButton\", \"currentTimeZoneWrapper\", \"timeZoneButtons\", \"timeZoneSelectWrapper\", \"timeZoneField\" ]\n static values = {\n includeTime: Boolean,\n defaultTimeZones: Array,\n cancelButtonLabel: { type: String, default: \"Cancel\" },\n applyButtonLabel: { type: String, default: \"Apply\" }\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 $(this.fieldTarget).val('')\n }\n\n applyDateToField(event, picker) {\n const format = this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n $(this.fieldTarget).val(picker.startDate.format(format))\n }\n\n showTimeZoneButtons(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).toggleClass('hidden')\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n }\n\n showTimeZoneSelectWrapper(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).toggleClass('hidden')\n }\n }\n\n resetTimeZoneUI(e) {\n e && e.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).removeClass('hidden')\n $(this.timeZoneButtonsTarget).addClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).addClass('hidden')\n }\n }\n\n setTimeZone(event) {\n // don't follow the anchor\n event.preventDefault()\n\n const currentTimeZoneEl = this.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target.dataset\n\n $(this.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n $(event.target).removeClass('button-alternative').addClass('button')\n\n this.resetTimeZoneUI()\n }\n\n initPluginInstance() {\n $(this.fieldTarget).daterangepicker({\n singleDatePicker: true,\n timePicker: this.includeTimeValue,\n timePickerIncrement: 5,\n autoUpdateInput: false,\n locale: {\n cancelLabel: this.cancelButtonLabelValue,\n applyLabel: this.applyButtonLabelValue,\n format: this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n }\n })\n\n $(this.fieldTarget).on('apply.daterangepicker', this.applyDateToField.bind(this))\n $(this.fieldTarget).on('cancel.daterangepicker', this.clearDate.bind(this))\n\n this.pluginMainEl = this.fieldTarget\n this.plugin = $(this.pluginMainEl).data('daterangepicker') // weird\n\n // Init time zone select\n if (this.includeTimeValue && this.hasTimeZoneSelectWrapperTarget) {\n this.timeZoneSelect = this.timeZoneSelectWrapperTarget.querySelector('select.select2')\n\n $(this.timeZoneSelect).select2({\n width: 'style'\n })\n\n const self = this\n\n $(this.timeZoneSelect).on('change.select2', function(event) {\n const currentTimeZoneEl = self.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target\n\n $(self.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n const selectedOptionTimeZoneButton = $('.selected-option-time-zone-button')\n\n if (self.defaultTimeZonesValue.includes(value)) {\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n selectedOptionTimeZoneButton.addClass('hidden').attr('hidden', true)\n $(`a[data-value=\"${value}\"`).removeClass('button-alternative').addClass('button')\n } else {\n // deselect any selected button\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n\n selectedOptionTimeZoneButton.text(value)\n selectedOptionTimeZoneButton.attr('data-value', value).removeAttr('hidden')\n selectedOptionTimeZoneButton.removeClass(['hidden', 'button-alternative']).addClass('button')\n }\n\n self.resetTimeZoneUI()\n })\n }\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n $(this.pluginMainEl).off('apply.daterangepicker')\n $(this.pluginMainEl).off('cancel.daterangepicker')\n\n // revert to original markup, remove any event listeners\n this.plugin.remove()\n\n if (this.includeTimeValue) {\n $(this.timeZoneSelect).select2('destroy');\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n static targets = [\n \"fileField\",\n \"removeFileFlag\",\n \"downloadFileButton\",\n \"removeFileButton\",\n \"selectFileButton\",\n \"progressBar\",\n ];\n\n connect() {\n // Add upload event listeners\n const initializeListener = document.addEventListener(\n \"direct-upload:initialize\",\n (event) => {\n this.selectFileButtonTarget.classList.add(\"hidden\");\n this.progressBarTarget.innerText = \"0%\";\n this.progressBarTarget.style.width = \"0%\";\n this.progressBarTarget.setAttribute(\"aria-valuenow\", 0);\n this.progressBarTarget.parentNode.classList.remove(\"hidden\");\n }\n );\n\n const progressListener = document.addEventListener(\n \"direct-upload:progress\",\n (event) => {\n const { progress } = event.detail;\n const width = `${progress.toFixed(1)}%`;\n\n this.progressBarTarget.innerText = width;\n this.progressBarTarget.setAttribute(\"aria-valuenow\", progress);\n this.progressBarTarget.style.width = width;\n }\n );\n\n const errorListener = document.addEventListener(\n \"direct-upload:error\",\n (event) => {\n event.preventDefault();\n\n const { error } = event.detail;\n this.progressBarTarget.innerText = error;\n }\n );\n\n this.uploadListeners = {\n \"direct-upload:initialize\": initializeListener,\n \"direct-upload:progress\": progressListener,\n \"direct-upload:error\": errorListener,\n };\n }\n\n disconnect() {\n // Teardown event listeners\n for (const event in this.uploadListeners) {\n document.removeEventListener(event, this.uploadListeners[event]);\n }\n }\n\n uploadFile() {\n this.fileFieldTarget.click();\n }\n\n removeFile() {\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.classList.add(\"hidden\");\n }\n\n this.removeFileButtonTarget.classList.add(\"hidden\");\n this.removeFileFlagTarget.value = true;\n }\n\n handleFileSelected() {\n const statusText = this.selectFileButtonTarget.querySelector(\"span\");\n const icon = this.selectFileButtonTarget.querySelector(\"i\");\n\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.remove();\n }\n\n statusText.innerText = \"Select Another File\";\n icon.classList.remove(\"ti-upload\");\n icon.classList.add(\"ti-check\");\n }\n}\n","import { Controller } from \"stimulus\";\nimport zxcvbn from \"zxcvbn\";\n\nexport default class extends Controller {\n static targets = [\"strengthIndicator\"];\n\n estimateStrength(e) {\n const result = zxcvbn(e.target.value);\n\n if (result.feedback) {\n this.strengthIndicatorTarget.innerText = `${result.feedback.warning}.`;\n this.strengthIndicatorTarget.classList.remove(\"hidden\");\n } else {\n this.strengthIndicatorTarget.classList.add(\"hidden\");\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"intl-tel-input/build/css/intlTelInput.css\");\nimport intlTelInput from 'intl-tel-input';\n\nexport default class extends Controller {\n static targets = [ \"field\" ]\n\n connect() {\n this.initPluginInstance()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n initPluginInstance() {\n let options = {\n hiddenInput: this.fieldTarget.dataset.method,\n customContainer: \"w-full\"\n }\n\n // TODO: add instructions on how to copy this asset into the application's assets path and write the meta tag into the head (via the engine?)\n const utilsScriptPath = metaContent(\"intl_tel_input_utils_path\")\n if (utilsScriptPath) {\n options['utilsScript'] = utilsScriptPath\n }\n\n this.plugin = intlTelInput(this.fieldTarget, options);\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n // revert to original markup, remove any event listeners\n this.plugin.destroy()\n }\n}\n\nfunction metaContent (name) {\n const element = document.head.querySelector(`meta[name=\"${name}\"]`)\n return element && element.content\n}","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"select2/dist/css/select2.min.css\");\nimport select2 from \"select2\";\n\nexport default class extends Controller {\n static targets = [ \"select\" ]\n static values = {\n acceptsNew: Boolean,\n enableSearch: Boolean,\n searchUrl: String,\n }\n \n // will be reissued as native dom events name prepended with '$' e.g. '$change', '$select2:closing', etc\n static jQueryEventsToReissue = [ \"change\", \"select2:closing\", \"select2:close\", \"select2:opening\", \"select2:open\", \"select2:selecting\", \"select2:select\", \"select2:unselecting\", \"select2:unselect\", \"select2:clearing\", \"select2:clear\" ]\n \n\n initialize() {\n this.dispatchNativeEvent = this.dispatchNativeEvent.bind(this)\n if (this.isSelect2LoadedOnWindowJquery) {\n select2(window.$)\n }\n }\n\n get isSelect2LoadedOnWindowJquery() {\n return (window.$ !== undefined && window.$.select2 === undefined)\n }\n\n connect() {\n if (this.isSelect2LoadedOnWindowJquery) {\n this.initPluginInstance()\n }\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n cleanupBeforeInit() {\n $(this.element).find('.select2-container--default').remove()\n }\n\n initPluginInstance() {\n let options = {};\n\n if (!this.enableSearchValue) {\n options.minimumResultsForSearch = -1;\n }\n\n options.tags = this.acceptsNewValue\n\n if (this.searchUrlValue) {\n options.ajax = {\n url: this.searchUrlValue,\n dataType: 'json',\n // We enable pagination by default here\n data: function(params) {\n var query = {\n search: params.term,\n page: params.page || 1\n }\n return query\n }\n // Any additional params go here...\n }\n }\n\n options.templateResult = this.formatState;\n options.templateSelection = this.formatState;\n options.width = 'style';\n\n this.cleanupBeforeInit() // in case improperly torn down\n this.pluginMainEl = this.selectTarget // required because this.selectTarget is unavailable on disconnect()\n $(this.pluginMainEl).select2(options);\n\n this.initReissuePluginEventsAsNativeEvents()\n }\n\n teardownPluginInstance() {\n if (this.pluginMainEl === undefined) { return }\n\n // ensure there are no orphaned event handlers\n this.teardownPluginEventsAsNativeEvents()\n \n // revert to original markup, remove any event listeners\n $(this.pluginMainEl).select2('destroy');\n }\n\n initReissuePluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).on(eventName, this.dispatchNativeEvent)\n })\n }\n \n teardownPluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).off(eventName)\n })\n }\n \n dispatchNativeEvent(event) {\n const nativeEventName = '$' + event.type // e.g. '$change.select2'\n this.element.dispatchEvent(new CustomEvent(nativeEventName, { detail: { event: event }, bubbles: true, cancelable: false }))\n }\n\n // https://stackoverflow.com/questions/29290389/select2-add-image-icon-to-option-dynamically\n formatState(opt) {\n var imageUrl = $(opt.element).attr('data-image');\n var imageHtml = \"\";\n if (imageUrl) {\n imageHtml = '<img src=\"' + imageUrl + '\" /> ';\n }\n return $('<span>' + imageHtml + sanitizeHTML(opt.text) + '</span>');\n }\n}\n\n// https://portswigger.net/web-security/cross-site-scripting/preventing\nfunction sanitizeHTML(str) {\n return str.replace(/[^\\w. ]/gi, function (c) {\n return '&#' + c.charCodeAt(0) + ';';\n });\n};\n","import { identifierForContextKey } from \"@hotwired/stimulus-webpack-helpers\"\n\nimport ButtonToggleController from './fields/button_toggle_controller'\nimport CloudinaryImageController from './fields/cloudinary_image_controller'\nimport ColorPickerController from './fields/color_picker_controller'\nimport DateController from './fields/date_controller'\nimport FileFieldController from './fields/file_field_controller'\nimport PasswordController from './fields/password_controller'\nimport PhoneController from './fields/phone_controller'\nimport SuperSelectController from './fields/super_select_controller'\n\nexport const controllerDefinitions = [\n [ButtonToggleController, 'fields/button_toggle_controller.js'],\n [CloudinaryImageController, 'fields/cloudinary_image_controller.js'],\n [ColorPickerController, 'fields/color_picker_controller.js'],\n [DateController, 'fields/date_controller.js'],\n [FileFieldController, 'fields/file_field_controller.js'],\n [PasswordController, 'fields/password_controller.js'],\n [PhoneController, 'fields/phone_controller.js'],\n [SuperSelectController, 'fields/super_select_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 ButtonToggleController,\n CloudinaryImageController,\n ColorPickerController,\n DateController,\n FileFieldController,\n PasswordController,\n PhoneController,\n SuperSelectController,\n}","import Tribute from 'tributejs'\nrequire(\"trix/dist/trix.css\");\n\nrequire(\"trix\")\nrequire(\"@rails/actiontext\")\n\n// only show the editor tool bar when the user is editing the field.\n// inspired by https://github.com/basecamp/trix/issues/343 and `app/assets/stylesheets/account/fields/trix_editor.scss`\n\nexport function trixEditor() {\n document.addEventListener('trix-initialize', function() {\n addEventListener(\"trix-focus\", updateTrixToolbarVisability);\n addEventListener(\"trix-blur\", updateTrixToolbarVisability);\n updateTrixToolbarVisability();\n initializeTribute();\n })\n}\n\nfunction updateTrixToolbarVisability() {\n document.querySelectorAll(\"trix-editor\").forEach((editorElement, index) => {\n var toolbarElement = editorElement.toolbarElement;\n if (editorElement == document.activeElement) {\n toolbarElement.classList.add('visible');\n } else {\n // don't hide the toolbar if we've unfocused to focus on the link dialog.\n if (!toolbarElement.contains(document.activeElement)) {\n toolbarElement.classList.remove('visible');\n }\n }\n })\n}\n\nfunction initializeTribute() {\n document.querySelectorAll(\"trix-editor\").forEach((el, index) => {\n var editor = el.editor;\n \n var mentionConfig = {\n trigger: '@',\n values: JSON.parse(editor.element.dataset.mentions),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var topicConfig = {\n trigger: '#',\n values: JSON.parse(editor.element.dataset.topics),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var tribute = new Tribute({\n collection: [topicConfig, mentionConfig],\n });\n \n tribute.attach(el);\n })\n}\n"],"names":["identifierForContextKey","key","logicalName","match","replace","Controller","clickShadowField","event","preventDefault","this","shadowFieldTarget","click","targets","pickImageAndUpload","defaultSources","hasGoogleApiKeyValue","push","options","cloud_name","cloudNameValue","apiKey","apiKeyValue","upload_preset","uploadPresetValue","upload_signature","getCloudinarySignature","bind","multiple","sources","hasSourcesValue","sourcesValue","split","search_by_rights","hasSearchByRightsValue","searchByRightsValue","googleApiKeyValue","cloudinary","openUploadWidget","handleWidgetResponse","clearImage","hiddenFieldTarget","value","removeThumbnail","callback","paramsToSign","$","ajax","url","signaturesUrlValue","type","dataType","data","complete","console","log","success","signature","textStatus","xhr","error","status","response","info","public_id","addThumbnail","urlFormatValue","$imageElement","widthValue","heightValue","identifier","uploadButtonTarget","prepend","classList","add","thumbnailShownClass","hasThumbnailTarget","removeChild","thumbnailTarget","remove","values","signaturesUrl","String","height","Number","width","cloudName","googleApiKey","urlFormat","searchByRights","Boolean","classes","connect","initPluginInstance","colorOptions","colorOptionsTarget","find","map","_","button","attr","get","disconnect","teardownPluginInstance","pickColor","targetEl","target","color","dataset","colorInputTarget","val","colorPickerValueTarget","userSelectedColorTarget","removeClass","pickr","setColor","pickRandomColor","r","Math","floor","random","g","b","hexColor","getColor","toHEXA","toString","showUserSelectedColor","addClass","css","show","unpickColor","hide","togglePickr","Pickr","create","el","theme","useAsButton","default","initialColorValue","components","preview","hue","interaction","input","save","on","_instance","hexaColor","includes","that","e","applyColor","destroy","initialColor","require","clearDate","fieldTarget","applyDateToField","picker","format","includeTimeValue","startDate","showTimeZoneButtons","currentTimeZoneWrapperTarget","toggleClass","timeZoneButtonsTarget","showTimeZoneSelectWrapper","hasTimeZoneSelectWrapperTarget","timeZoneSelectWrapperTarget","resetTimeZoneUI","setTimeZone","currentTimeZoneEl","querySelector","timeZoneFieldTarget","text","daterangepicker","singleDatePicker","timePicker","timePickerIncrement","autoUpdateInput","locale","cancelLabel","cancelButtonLabelValue","applyLabel","applyButtonLabelValue","pluginMainEl","plugin","timeZoneSelect","select2","self","selectedOptionTimeZoneButton","defaultTimeZonesValue","removeAttr","undefined","off","includeTime","defaultTimeZones","Array","cancelButtonLabel","applyButtonLabel","initializeListener","document","addEventListener","selectFileButtonTarget","progressBarTarget","innerText","style","setAttribute","parentNode","progressListener","progress","detail","toFixed","errorListener","uploadListeners","removeEventListener","uploadFile","fileFieldTarget","removeFile","hasDownloadFileButtonTarget","downloadFileButtonTarget","removeFileButtonTarget","removeFileFlagTarget","handleFileSelected","statusText","icon","estimateStrength","result","zxcvbn","feedback","strengthIndicatorTarget","warning","hiddenInput","method","customContainer","utilsScriptPath","name","element","head","content","metaContent","intlTelInput","initialize","dispatchNativeEvent","isSelect2LoadedOnWindowJquery","window","cleanupBeforeInit","enableSearchValue","minimumResultsForSearch","tags","acceptsNewValue","searchUrlValue","params","search","term","page","templateResult","formatState","templateSelection","selectTarget","initReissuePluginEventsAsNativeEvents","teardownPluginEventsAsNativeEvents","constructor","jQueryEventsToReissue","forEach","eventName","dispatchEvent","CustomEvent","bubbles","cancelable","opt","imageUrl","imageHtml","c","charCodeAt","acceptsNew","enableSearch","searchUrl","controllerDefinitions","ButtonToggleController","CloudinaryImageController","ColorPickerController","DateController","FileFieldController","PasswordController","PhoneController","SuperSelectController","d","controller","controllerConstructor","trixEditor","updateTrixToolbarVisability","querySelectorAll","index","editor","mentionConfig","trigger","JSON","parse","mentions","selectTemplate","item","original","protocol","model","id","label","menuItemTemplate","photo","string","requireLeadingSpace","replaceTextSuffix","topicConfig","topics","Tribute","collection","attach","editorElement","toolbarElement","activeElement","contains"],"mappings":"sSAqBA,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AOA,EAAKC,UACcC,SAAW,MAAQF,EAAKG,MAAQ,IAAMH,EAAKI,GAAK,KAAOJ,EAAKK,MAAQ,QAEhGC,iBAAkB,SAAUN,GAC1B,MAAO,aAAeA,EAAKC,SAASM,MAAQ,QAAUP,EAAKQ,QAE7DC,qBAAqB,EACrBC,kBAAmB,IAGP,IAAIG,EAAQ,CACxBC,WAAY,CAACH,EAAajB,KAGpBqB,OAAOtL,OAlDnB,SAAS6J,IACP1F,SAAS2F,iBAAiB,eAAe5B,QAAQ,CAACqD,EAAexB,KAC/D,IAAIyB,EAAiBD,EAAcC,eAC/BD,GAAiBpH,SAASsH,cAC5BD,EAAevP,UAAUC,IAAI,WAGxBsP,EAAeE,SAASvH,SAASsH,gBACpCD,EAAevP,UAAUM,OAAO,aAzBxC6E,QAAQ,sBAERA,QAAQ,QACRA,QAAQ"}
1
+ {"version":3,"file":"fields.modern.js","sources":["../../../node_modules/@hotwired/stimulus-webpack-helpers/dist/stimulus-webpack-helpers.js","../../javascript/controllers/fields/button_toggle_controller.js","../../javascript/controllers/fields/cloudinary_image_controller.js","../../javascript/controllers/fields/color_picker_controller.js","../../javascript/controllers/fields/date_controller.js","../../javascript/controllers/fields/file_field_controller.js","../../javascript/controllers/fields/password_controller.js","../../javascript/controllers/fields/phone_controller.js","../../javascript/controllers/fields/super_select_controller.js","../../javascript/controllers/index.js","../../javascript/trix_editor.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\"\n\nexport default class extends Controller {\n static targets = [ \"shadowField\" ]\n\n clickShadowField(event) {\n // we have to stop safari from doing what we originally expected.\n event.preventDefault();\n\n // then we need to manually click the hidden checkbox or radio button ourselves.\n this.shadowFieldTarget.click()\n }\n}","import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static targets = [ \"uploadButton\", \"hiddenField\", \"thumbnail\" ]\n static values = { \n signaturesUrl: String,\n height: Number,\n width: Number,\n cloudName: String,\n apiKey: String,\n googleApiKey: String,\n urlFormat: String,\n sources: String,\n searchByRights: Boolean\n }\n static classes = [ \"thumbnailShown\" ]\n\n pickImageAndUpload(event) {\n // don't submit the form.\n event.preventDefault()\n\n // prepare the list of default sources a user can upload an image from.\n var defaultSources = ['local', 'url', 'camera']\n if (this.hasGoogleApiKeyValue) {\n defaultSources.push('image_search')\n }\n\n // configure cloudinary's uploader's options.\n // many of these are configurable at the point where the `shared/fields/cloudinary_image` partial is included.\n var options = {\n cloud_name: this.cloudNameValue,\n apiKey: this.apiKeyValue,\n upload_preset: this.uploadPresetValue,\n upload_signature: this.getCloudinarySignature.bind(this),\n multiple: false,\n sources: this.hasSourcesValue ? this.sourcesValue.split(',') : defaultSources,\n search_by_rights: this.hasSearchByRightsValue && this.searchByRightsValue === false ? false : true // default to true.\n }\n \n if (this.hasGoogleApiKeyValue) {\n options['google_api_key'] = this.googleApiKeyValue\n }\n \n // open cloudinary's upload widget.\n cloudinary.openUploadWidget(options, this.handleWidgetResponse.bind(this))\n }\n \n clearImage(event) {\n // don't submit the form.\n event.preventDefault()\n\n // clear the cloudinary id.\n this.hiddenFieldTarget.value = null\n \n // remove any existing image from the button.\n this.removeThumbnail()\n }\n \n getCloudinarySignature(callback, paramsToSign) {\n $.ajax({\n url: this.signaturesUrlValue,\n type: \"GET\",\n dataType: \"text\",\n data: {data: paramsToSign},\n complete: function() { console.log(\"complete\") },\n success: function(signature, textStatus, xhr) { callback(signature) },\n error: function(xhr, status, error) { console.log(xhr, status, error) }\n })\n }\n \n handleWidgetResponse(error, response) {\n // after the user has successfully uploaded a single file ..\n if (!error && response && response.event === \"success\") { \n const data = response.info\n \n // update the cloudinary id field in the form.\n this.hiddenFieldTarget.value = data.public_id\n\n // remove any existing image.\n this.removeThumbnail()\n\n // generate a new image preview url.\n this.addThumbnail(this.urlFormatValue.replace('CLOUDINARY_ID', data.public_id))\n }\n }\n \n addThumbnail(url) {\n var $imageElement = $(`<img src=\"${url}\" width=\"${this.widthValue}\" height=\"${this.heightValue}\" data-${this.identifier}-target=\"thumbnail\" />`)\n $(this.uploadButtonTarget).prepend($imageElement)\n\n // mark the image as present.\n this.uploadButtonTarget.classList.add(this.thumbnailShownClass)\n }\n \n removeThumbnail() {\n if (!this.hasThumbnailTarget) { return }\n this.uploadButtonTarget.removeChild(this.thumbnailTarget)\n this.uploadButtonTarget.classList.remove(this.thumbnailShownClass)\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nimport '@simonwep/pickr/dist/themes/monolith.min.css'\n\nimport Pickr from '@simonwep/pickr';\n\nexport default class extends Controller {\n static targets = [ \"colorPickerValue\", \"colorField\", \"colorInput\", \"userSelectedColor\", \"colorOptions\" ];\n static values = { initialColor: String }\n\n connect() {\n this.initPluginInstance()\n this.colorOptions = $(this.colorOptionsTarget).find('button').map(function (_, button) { return $(button).attr('data-color'); }).get()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n pickColor(event) {\n event.preventDefault();\n\n const targetEl = event.target;\n const color = targetEl.dataset.color;\n\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n $(this.userSelectedColorTarget).data('color', color);\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n this.pickr.setColor(color);\n\n targetEl.classList.add('ring-2', 'ring-offset-2');\n }\n\n pickRandomColor(event) {\n event.preventDefault();\n\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n\n this.pickr.setColor(`rgb ${r} ${g} ${b}`);\n const hexColor = this.pickr.getColor().toHEXA().toString();\n this.pickr.setColor(hexColor);\n\n this.showUserSelectedColor(hexColor);\n }\n\n showUserSelectedColor(color) {\n $(this.colorInputTarget).val(color);\n $(this.colorPickerValueTarget).val(color);\n\n $('.button-color').removeClass('ring-2 ring-offset-2');\n\n $(this.userSelectedColorTarget)\n .addClass('ring-2')\n .addClass('ring-offset-2')\n .css('background-color', color)\n .css('--tw-ring-color', color)\n .attr('data-color', color)\n .show();\n }\n\n unpickColor(event) {\n event.preventDefault();\n $(this.colorPickerValueTarget).val('');\n $(this.colorInputTarget).val('');\n $(this.userSelectedColorTarget).hide();\n $('.button-color').removeClass('ring-2 ring-offset-2');\n }\n\n togglePickr(event) {\n event.preventDefault();\n }\n\n initPluginInstance() {\n this.pickr = Pickr.create({\n el: '.btn-pickr',\n theme: 'monolith',\n useAsButton: true,\n default: this.initialColorValue || '#1E90FF',\n components: {\n // Main components\n preview: true,\n hue: true,\n\n // Input / output Options\n interaction: {\n input: true,\n save: true,\n },\n }\n });\n\n this.pickr.on('save', (color, _instance) => {\n const hexaColor = color.toHEXA().toString()\n if (!this.colorOptions.includes(hexaColor)) {\n this.showUserSelectedColor(hexaColor);\n }\n this.pickr.hide();\n });\n\n const that = this\n\n $('input[type=\"text\"].pcr-result').on('keydown', function (e) {\n if (e.key === 'Enter') {\n that.pickr.applyColor(false)\n }\n })\n }\n\n teardownPluginInstance() {\n this.pickr.destroy()\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"daterangepicker/daterangepicker.css\");\n\n// requires jQuery, moment, might want to consider a vanilla JS alternative\nimport 'daterangepicker';\n\nexport default class extends Controller {\n static targets = [ \"field\", \"clearButton\", \"currentTimeZoneWrapper\", \"timeZoneButtons\", \"timeZoneSelectWrapper\", \"timeZoneField\" ]\n static values = {\n includeTime: Boolean,\n defaultTimeZones: Array,\n cancelButtonLabel: { type: String, default: \"Cancel\" },\n applyButtonLabel: { type: String, default: \"Apply\" }\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 $(this.fieldTarget).val('')\n }\n\n applyDateToField(event, picker) {\n const format = this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n $(this.fieldTarget).val(picker.startDate.format(format))\n }\n\n showTimeZoneButtons(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).toggleClass('hidden')\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n }\n\n showTimeZoneSelectWrapper(event) {\n // don't follow the anchor\n event.preventDefault()\n\n $(this.timeZoneButtonsTarget).toggleClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).toggleClass('hidden')\n }\n }\n\n resetTimeZoneUI(e) {\n e && e.preventDefault()\n\n $(this.currentTimeZoneWrapperTarget).removeClass('hidden')\n $(this.timeZoneButtonsTarget).addClass('hidden')\n\n if (this.hasTimeZoneSelectWrapperTarget) {\n $(this.timeZoneSelectWrapperTarget).addClass('hidden')\n }\n }\n\n setTimeZone(event) {\n // don't follow the anchor\n event.preventDefault()\n\n const currentTimeZoneEl = this.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target.dataset\n\n $(this.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n $(event.target).removeClass('button-alternative').addClass('button')\n\n this.resetTimeZoneUI()\n }\n\n initPluginInstance() {\n $(this.fieldTarget).daterangepicker({\n singleDatePicker: true,\n timePicker: this.includeTimeValue,\n timePickerIncrement: 5,\n autoUpdateInput: false,\n locale: {\n cancelLabel: this.cancelButtonLabelValue,\n applyLabel: this.applyButtonLabelValue,\n format: this.includeTimeValue ? 'MM/DD/YYYY h:mm A' : 'MM/DD/YYYY'\n }\n })\n\n $(this.fieldTarget).on('apply.daterangepicker', this.applyDateToField.bind(this))\n $(this.fieldTarget).on('cancel.daterangepicker', this.clearDate.bind(this))\n\n this.pluginMainEl = this.fieldTarget\n this.plugin = $(this.pluginMainEl).data('daterangepicker') // weird\n\n // Init time zone select\n if (this.includeTimeValue && this.hasTimeZoneSelectWrapperTarget) {\n this.timeZoneSelect = this.timeZoneSelectWrapperTarget.querySelector('select.select2')\n\n $(this.timeZoneSelect).select2({\n width: 'style'\n })\n\n const self = this\n\n $(this.timeZoneSelect).on('change.select2', function(event) {\n const currentTimeZoneEl = self.currentTimeZoneWrapperTarget.querySelector('a')\n const {value} = event.target\n\n $(self.timeZoneFieldTarget).val(value)\n $(currentTimeZoneEl).text(value)\n\n const selectedOptionTimeZoneButton = $('.selected-option-time-zone-button')\n\n if (self.defaultTimeZonesValue.includes(value)) {\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n selectedOptionTimeZoneButton.addClass('hidden').attr('hidden', true)\n $(`a[data-value=\"${value}\"`).removeClass('button-alternative').addClass('button')\n } else {\n // deselect any selected button\n $('.time-zone-button').removeClass('button').addClass('button-alternative')\n\n selectedOptionTimeZoneButton.text(value)\n selectedOptionTimeZoneButton.attr('data-value', value).removeAttr('hidden')\n selectedOptionTimeZoneButton.removeClass(['hidden', 'button-alternative']).addClass('button')\n }\n\n self.resetTimeZoneUI()\n })\n }\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n $(this.pluginMainEl).off('apply.daterangepicker')\n $(this.pluginMainEl).off('cancel.daterangepicker')\n\n // revert to original markup, remove any event listeners\n this.plugin.remove()\n\n if (this.includeTimeValue) {\n $(this.timeZoneSelect).select2('destroy');\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n static targets = [\n \"fileField\",\n \"removeFileFlag\",\n \"downloadFileButton\",\n \"removeFileButton\",\n \"selectFileButton\",\n \"progressBar\",\n ];\n\n connect() {\n // Add upload event listeners\n const initializeListener = document.addEventListener(\n \"direct-upload:initialize\",\n (event) => {\n this.selectFileButtonTarget.classList.add(\"hidden\");\n this.progressBarTarget.innerText = \"0%\";\n this.progressBarTarget.style.width = \"0%\";\n this.progressBarTarget.setAttribute(\"aria-valuenow\", 0);\n this.progressBarTarget.parentNode.classList.remove(\"hidden\");\n }\n );\n\n const progressListener = document.addEventListener(\n \"direct-upload:progress\",\n (event) => {\n const { progress } = event.detail;\n const width = `${progress.toFixed(1)}%`;\n\n this.progressBarTarget.innerText = width;\n this.progressBarTarget.setAttribute(\"aria-valuenow\", progress);\n this.progressBarTarget.style.width = width;\n }\n );\n\n const errorListener = document.addEventListener(\n \"direct-upload:error\",\n (event) => {\n event.preventDefault();\n\n const { error } = event.detail;\n this.progressBarTarget.innerText = error;\n }\n );\n\n this.uploadListeners = {\n \"direct-upload:initialize\": initializeListener,\n \"direct-upload:progress\": progressListener,\n \"direct-upload:error\": errorListener,\n };\n }\n\n disconnect() {\n // Teardown event listeners\n for (const event in this.uploadListeners) {\n document.removeEventListener(event, this.uploadListeners[event]);\n }\n }\n\n uploadFile() {\n this.fileFieldTarget.click();\n }\n\n removeFile() {\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.classList.add(\"hidden\");\n }\n\n this.removeFileButtonTarget.classList.add(\"hidden\");\n this.removeFileFlagTarget.value = true;\n }\n\n handleFileSelected() {\n const statusText = this.selectFileButtonTarget.querySelector(\"span\");\n const icon = this.selectFileButtonTarget.querySelector(\"i\");\n\n if (this.hasDownloadFileButtonTarget) {\n this.downloadFileButtonTarget.remove();\n }\n\n statusText.innerText = \"Select Another File\";\n icon.classList.remove(\"ti-upload\");\n icon.classList.add(\"ti-check\");\n }\n}\n","import { Controller } from \"stimulus\";\nimport zxcvbn from \"zxcvbn\";\n\nexport default class extends Controller {\n static targets = [\"strengthIndicator\"];\n\n estimateStrength(e) {\n const result = zxcvbn(e.target.value);\n\n if (result.feedback && result.feedback.warning.length > 0) {\n this.strengthIndicatorTarget.innerText = `${result.feedback.warning}.`;\n this.strengthIndicatorTarget.classList.remove(\"hidden\");\n } else {\n this.strengthIndicatorTarget.classList.add(\"hidden\");\n }\n }\n}\n","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"intl-tel-input/build/css/intlTelInput.css\");\nimport intlTelInput from 'intl-tel-input';\n\nexport default class extends Controller {\n static targets = [ \"field\" ]\n\n connect() {\n this.initPluginInstance()\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n initPluginInstance() {\n let options = {\n hiddenInput: this.fieldTarget.dataset.method,\n customContainer: \"w-full\"\n }\n\n // TODO: add instructions on how to copy this asset into the application's assets path and write the meta tag into the head (via the engine?)\n const utilsScriptPath = metaContent(\"intl_tel_input_utils_path\")\n if (utilsScriptPath) {\n options['utilsScript'] = utilsScriptPath\n }\n\n this.plugin = intlTelInput(this.fieldTarget, options);\n }\n\n teardownPluginInstance() {\n if (this.plugin === undefined) { return }\n\n // revert to original markup, remove any event listeners\n this.plugin.destroy()\n }\n}\n\nfunction metaContent (name) {\n const element = document.head.querySelector(`meta[name=\"${name}\"]`)\n return element && element.content\n}","import { Controller } from \"@hotwired/stimulus\"\nrequire(\"select2/dist/css/select2.min.css\");\nimport select2 from \"select2\";\n\nexport default class extends Controller {\n static targets = [ \"select\" ]\n static values = {\n acceptsNew: Boolean,\n enableSearch: Boolean,\n searchUrl: String,\n }\n \n // will be reissued as native dom events name prepended with '$' e.g. '$change', '$select2:closing', etc\n static jQueryEventsToReissue = [ \"change\", \"select2:closing\", \"select2:close\", \"select2:opening\", \"select2:open\", \"select2:selecting\", \"select2:select\", \"select2:unselecting\", \"select2:unselect\", \"select2:clearing\", \"select2:clear\" ]\n \n\n initialize() {\n this.dispatchNativeEvent = this.dispatchNativeEvent.bind(this)\n if (this.isSelect2LoadedOnWindowJquery) {\n select2(window.$)\n }\n }\n\n get isSelect2LoadedOnWindowJquery() {\n return (window.$ !== undefined && window.$.select2 === undefined)\n }\n\n connect() {\n if (this.isSelect2LoadedOnWindowJquery) {\n this.initPluginInstance()\n }\n }\n\n disconnect() {\n this.teardownPluginInstance()\n }\n\n cleanupBeforeInit() {\n $(this.element).find('.select2-container--default').remove()\n }\n\n initPluginInstance() {\n let options = {};\n\n if (!this.enableSearchValue) {\n options.minimumResultsForSearch = -1;\n }\n\n options.tags = this.acceptsNewValue\n\n if (this.searchUrlValue) {\n options.ajax = {\n url: this.searchUrlValue,\n dataType: 'json',\n // We enable pagination by default here\n data: function(params) {\n var query = {\n search: params.term,\n page: params.page || 1\n }\n return query\n }\n // Any additional params go here...\n }\n }\n\n options.templateResult = this.formatState;\n options.templateSelection = this.formatState;\n options.width = 'style';\n\n this.cleanupBeforeInit() // in case improperly torn down\n this.pluginMainEl = this.selectTarget // required because this.selectTarget is unavailable on disconnect()\n $(this.pluginMainEl).select2(options);\n\n this.initReissuePluginEventsAsNativeEvents()\n }\n\n teardownPluginInstance() {\n if (this.pluginMainEl === undefined) { return }\n\n // ensure there are no orphaned event handlers\n this.teardownPluginEventsAsNativeEvents()\n \n // revert to original markup, remove any event listeners\n $(this.pluginMainEl).select2('destroy');\n }\n\n initReissuePluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).on(eventName, this.dispatchNativeEvent)\n })\n }\n \n teardownPluginEventsAsNativeEvents() {\n this.constructor.jQueryEventsToReissue.forEach((eventName) => {\n $(this.pluginMainEl).off(eventName)\n })\n }\n \n dispatchNativeEvent(event) {\n const nativeEventName = '$' + event.type // e.g. '$change.select2'\n this.element.dispatchEvent(new CustomEvent(nativeEventName, { detail: { event: event }, bubbles: true, cancelable: false }))\n }\n\n // https://stackoverflow.com/questions/29290389/select2-add-image-icon-to-option-dynamically\n formatState(opt) {\n var imageUrl = $(opt.element).attr('data-image');\n var imageHtml = \"\";\n if (imageUrl) {\n imageHtml = '<img src=\"' + imageUrl + '\" /> ';\n }\n return $('<span>' + imageHtml + sanitizeHTML(opt.text) + '</span>');\n }\n}\n\n// https://portswigger.net/web-security/cross-site-scripting/preventing\nfunction sanitizeHTML(str) {\n return str.replace(/[^\\w. ]/gi, function (c) {\n return '&#' + c.charCodeAt(0) + ';';\n });\n};\n","import { identifierForContextKey } from \"@hotwired/stimulus-webpack-helpers\"\n\nimport ButtonToggleController from './fields/button_toggle_controller'\nimport CloudinaryImageController from './fields/cloudinary_image_controller'\nimport ColorPickerController from './fields/color_picker_controller'\nimport DateController from './fields/date_controller'\nimport FileFieldController from './fields/file_field_controller'\nimport PasswordController from './fields/password_controller'\nimport PhoneController from './fields/phone_controller'\nimport SuperSelectController from './fields/super_select_controller'\n\nexport const controllerDefinitions = [\n [ButtonToggleController, 'fields/button_toggle_controller.js'],\n [CloudinaryImageController, 'fields/cloudinary_image_controller.js'],\n [ColorPickerController, 'fields/color_picker_controller.js'],\n [DateController, 'fields/date_controller.js'],\n [FileFieldController, 'fields/file_field_controller.js'],\n [PasswordController, 'fields/password_controller.js'],\n [PhoneController, 'fields/phone_controller.js'],\n [SuperSelectController, 'fields/super_select_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 ButtonToggleController,\n CloudinaryImageController,\n ColorPickerController,\n DateController,\n FileFieldController,\n PasswordController,\n PhoneController,\n SuperSelectController,\n}","import Tribute from 'tributejs'\nrequire(\"trix/dist/trix.css\");\n\nrequire(\"trix\")\nrequire(\"@rails/actiontext\")\n\n// only show the editor tool bar when the user is editing the field.\n// inspired by https://github.com/basecamp/trix/issues/343 and `app/assets/stylesheets/account/fields/trix_editor.scss`\n\nexport function trixEditor() {\n document.addEventListener('trix-initialize', function() {\n addEventListener(\"trix-focus\", updateTrixToolbarVisability);\n addEventListener(\"trix-blur\", updateTrixToolbarVisability);\n updateTrixToolbarVisability();\n initializeTribute();\n })\n}\n\nfunction updateTrixToolbarVisability() {\n document.querySelectorAll(\"trix-editor\").forEach((editorElement, index) => {\n var toolbarElement = editorElement.toolbarElement;\n if (editorElement == document.activeElement) {\n toolbarElement.classList.add('visible');\n } else {\n // don't hide the toolbar if we've unfocused to focus on the link dialog.\n if (!toolbarElement.contains(document.activeElement)) {\n toolbarElement.classList.remove('visible');\n }\n }\n })\n}\n\nfunction initializeTribute() {\n document.querySelectorAll(\"trix-editor\").forEach((el, index) => {\n var editor = el.editor;\n \n var mentionConfig = {\n trigger: '@',\n values: JSON.parse(editor.element.dataset.mentions),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var topicConfig = {\n trigger: '#',\n values: JSON.parse(editor.element.dataset.topics),\n selectTemplate: function (item) {\n item = item.original;\n return '<a href=\"' + item.protocol + '://' + item.model + '/' + item.id + '\">' + item.label + '</a>';\n },\n menuItemTemplate: function (item) {\n return '<img src=\"' + item.original.photo + '\" /> ' + item.string;\n },\n requireLeadingSpace: true,\n replaceTextSuffix: ''\n }\n \n var tribute = new Tribute({\n collection: [topicConfig, mentionConfig],\n });\n \n tribute.attach(el);\n })\n}\n"],"names":["identifierForContextKey","key","logicalName","match","replace","Controller","clickShadowField","event","preventDefault","this","shadowFieldTarget","click","targets","pickImageAndUpload","defaultSources","hasGoogleApiKeyValue","push","options","cloud_name","cloudNameValue","apiKey","apiKeyValue","upload_preset","uploadPresetValue","upload_signature","getCloudinarySignature","bind","multiple","sources","hasSourcesValue","sourcesValue","split","search_by_rights","hasSearchByRightsValue","searchByRightsValue","googleApiKeyValue","cloudinary","openUploadWidget","handleWidgetResponse","clearImage","hiddenFieldTarget","value","removeThumbnail","callback","paramsToSign","$","ajax","url","signaturesUrlValue","type","dataType","data","complete","console","log","success","signature","textStatus","xhr","error","status","response","info","public_id","addThumbnail","urlFormatValue","$imageElement","widthValue","heightValue","identifier","uploadButtonTarget","prepend","classList","add","thumbnailShownClass","hasThumbnailTarget","removeChild","thumbnailTarget","remove","values","signaturesUrl","String","height","Number","width","cloudName","googleApiKey","urlFormat","searchByRights","Boolean","classes","connect","initPluginInstance","colorOptions","colorOptionsTarget","find","map","_","button","attr","get","disconnect","teardownPluginInstance","pickColor","targetEl","target","color","dataset","colorInputTarget","val","colorPickerValueTarget","userSelectedColorTarget","removeClass","pickr","setColor","pickRandomColor","r","Math","floor","random","g","b","hexColor","getColor","toHEXA","toString","showUserSelectedColor","addClass","css","show","unpickColor","hide","togglePickr","Pickr","create","el","theme","useAsButton","default","initialColorValue","components","preview","hue","interaction","input","save","on","_instance","hexaColor","includes","that","e","applyColor","destroy","initialColor","require","clearDate","fieldTarget","applyDateToField","picker","format","includeTimeValue","startDate","showTimeZoneButtons","currentTimeZoneWrapperTarget","toggleClass","timeZoneButtonsTarget","showTimeZoneSelectWrapper","hasTimeZoneSelectWrapperTarget","timeZoneSelectWrapperTarget","resetTimeZoneUI","setTimeZone","currentTimeZoneEl","querySelector","timeZoneFieldTarget","text","daterangepicker","singleDatePicker","timePicker","timePickerIncrement","autoUpdateInput","locale","cancelLabel","cancelButtonLabelValue","applyLabel","applyButtonLabelValue","pluginMainEl","plugin","timeZoneSelect","select2","self","selectedOptionTimeZoneButton","defaultTimeZonesValue","removeAttr","undefined","off","includeTime","defaultTimeZones","Array","cancelButtonLabel","applyButtonLabel","initializeListener","document","addEventListener","selectFileButtonTarget","progressBarTarget","innerText","style","setAttribute","parentNode","progressListener","progress","detail","toFixed","errorListener","uploadListeners","removeEventListener","uploadFile","fileFieldTarget","removeFile","hasDownloadFileButtonTarget","downloadFileButtonTarget","removeFileButtonTarget","removeFileFlagTarget","handleFileSelected","statusText","icon","estimateStrength","result","zxcvbn","feedback","warning","length","strengthIndicatorTarget","hiddenInput","method","customContainer","utilsScriptPath","name","element","head","content","metaContent","intlTelInput","initialize","dispatchNativeEvent","isSelect2LoadedOnWindowJquery","window","cleanupBeforeInit","enableSearchValue","minimumResultsForSearch","tags","acceptsNewValue","searchUrlValue","params","search","term","page","templateResult","formatState","templateSelection","selectTarget","initReissuePluginEventsAsNativeEvents","teardownPluginEventsAsNativeEvents","constructor","jQueryEventsToReissue","forEach","eventName","dispatchEvent","CustomEvent","bubbles","cancelable","opt","imageUrl","imageHtml","c","charCodeAt","acceptsNew","enableSearch","searchUrl","controllerDefinitions","ButtonToggleController","CloudinaryImageController","ColorPickerController","DateController","FileFieldController","PasswordController","PhoneController","SuperSelectController","d","controller","controllerConstructor","trixEditor","updateTrixToolbarVisability","querySelectorAll","index","editor","mentionConfig","trigger","JSON","parse","mentions","selectTemplate","item","original","protocol","model","id","label","menuItemTemplate","photo","string","requireLeadingSpace","replaceTextSuffix","topicConfig","topics","Tribute","collection","attach","editorElement","toolbarElement","activeElement","contains"],"mappings":"gQAqBA,SAASA,EAAwBC,GAC7B,MAAMC,GAAeD,EAAIE,MAAM,2CAA6C,IAAI,GAChF,GAAID,EACA,OAAOA,EAAYE,QAAQ,KAAM,KAAKA,QAAQ,MAAO,sBCtBhCC,EAG3BC,iBAAiBC,GAEfA,EAAMC,iBAGNC,KAAKC,kBAAkBC,WAPlBC,QAAU,CAAE,+BCDQP,EAe3BQ,mBAAmBN,GAEjBA,EAAMC,iBAGN,IAAIM,EAAiB,CAAC,QAAS,MAAO,UAClCL,KAAKM,sBACPD,EAAeE,KAAK,gBAKtB,IAAIC,EAAU,CACZC,WAAYT,KAAKU,eACjBC,OAAQX,KAAKY,YACbC,cAAeb,KAAKc,kBACpBC,iBAAkBf,KAAKgB,uBAAuBC,KAAKjB,MACnDkB,UAAU,EACVC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