{"version":3,"file":"gf_tooltip.js","names":["gftt","$","colorPickerChoicesDynamicPosition","form_id","find","each","$icon","this","$choice","parent","offset","width","toString","css","_initLabel","$label","forced","$gfLabel","closest","length","on","e","$target","target","hasClass","preventDefault","stopImmediatePropagation","$container","not","focus","click","_initTooltips","$el","tipID","data","$tip","$otherTip","tipPlacement","attr","userOptions","gform","applyFilters","mainOptions","manual","followMouse","mouseOnToPopup","smartPlacement","popupClass","placement","options","extend","powerTip","powerTipPreRender","addClass","powerTipRender","document","trigger","powerTipOpen","powerTipClose","removeClass","$customWrap","$self","init","$formWrapper","$this","window","setTimeout","reInitOptions","formId","fieldId","i","$option","option_label_reinit","fieldKey","hasOwnProperty","clearTimeout","gform_format_option_label","fullLabel","fieldLabel","priceLabel","selectedPrice","price","index","$field","imageChoices_gform_format_option_label","colorPicker_gform_format_option_label","event","current_page","globalDelay","parseInt","gf_tooltips_init_delay","delay","jQuery"],"sources":["gf_tooltip.js"],"sourcesContent":["var gftt = gftt || {};\r\n\r\n(function($){\r\n\t'use strict';\r\n\r\n\tgftt.colorPickerChoicesDynamicPosition = function( form_id ) {\r\n\t\tvar $formWrapper = ( typeof form_id !== \"undefined\" ) ? $('#gform_wrapper_'+form_id) : $(\".gform_wrapper\");\r\n\t\t$formWrapper.find('.color-picker-choice .gftt-icon').each(function(){\r\n\t\t\tvar $icon = $(this);\r\n\t\t\tvar $choice = $icon.parent();\r\n\t\t\tvar $label = $choice.find('> label');\r\n\t\t\tvar offset = ( $label.width() - $choice.width() ).toString();\r\n\t\t\t$icon.css('transform', 'translateX(' + offset + 'px)');\r\n\t\t});\r\n\t};\r\n\r\n\tgftt._initLabel = function( $label, forced ) {\r\n\r\n\t\tvar $gfLabel = $label.closest('.gfield_label');\r\n\t\tif ( !$gfLabel.length ) {\r\n\t\t\t$gfLabel = $label.closest('.gform-field-label');\r\n\t\t}\r\n\r\n\t\t$gfLabel.on('click', function(e){\r\n\t\t\tvar $target = $(e.target);\r\n\t\t\tif ( $target.hasClass('gftt-label') || $target.closest('.gftt-label').length ) {\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\te.stopImmediatePropagation();\r\n\t\t\t\tvar $container = $(this).closest('.gfield').find('.ginput_container');\r\n\t\t\t\tif ($container.length) {\r\n\t\t\t\t\tif ( $container.find('input:first').not(':radio').not(':checkbox').length ) {\r\n\t\t\t\t\t\t$container.find('input:first').not(':radio').not(':checkbox').focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if ( $container.find('textarea:first').length ) {\r\n\t\t\t\t\t\t$container.find('textarea:first').focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if ( $container.find('select:first').length ) {\r\n\t\t\t\t\t\t$container.find('select:first').focus();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tvar $choice = $(this).closest('[class*=\"gchoice\"]');\r\n\t\t\t\tif ( $choice.length ) {\r\n\t\t\t\t\t$choice.find('input').click();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t};\r\n\r\n\tgftt._initTooltips = function( $el, forced ) {\r\n\r\n\t\tvar tipID = $el.data('tid');\r\n\t\tvar $tip = $('#'+tipID);\r\n\t\tvar $otherTip = $tip.closest('form').find('.gftt-icon[data-placement]');\r\n\t\tvar tipPlacement = $tip.data('placement');\r\n\t\tif ( !tipPlacement ) {\r\n\t\t\tif ( $otherTip.length ) {\r\n\t\t\t\ttipPlacement = $otherTip.data('placement');\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\ttipPlacement = 'nw-alt';\r\n\t\t\t}\r\n\t\t\t$tip.data('placement', tipPlacement);\r\n\t\t\t$tip.attr('data-placement', tipPlacement);\r\n\t\t}\r\n\t\tif ( !$tip.attr('tabindex') && $otherTip.attr('tabindex') ) {\r\n\t\t\t$tip.attr('tabindex', $otherTip.attr('tabindex'));\r\n\t\t}\r\n\t\t$tip.data('powertiptarget', tipID+'-content');\r\n\t\tvar userOptions = gform.applyFilters( 'gftt_tooltip_custom_options', {} );\r\n\t\tvar mainOptions = {\r\n\t\t\tmanual: false,\r\n\t\t\tfollowMouse: false,\r\n\t\t\tmouseOnToPopup: true,\r\n\t\t\tsmartPlacement: true,\r\n\t\t\tpopupClass: tipID,\r\n\t\t\tplacement: tipPlacement\r\n\t\t};\r\n\t\tvar options = $.extend( true, mainOptions, userOptions );\r\n\t\t$tip.powerTip(options);\r\n\t\t$tip.on({\r\n\t\t\tpowerTipPreRender: function(){\r\n\t\t\t\t$('body').addClass('gftt_show');\r\n\t\t\t},\r\n\t\t\tpowerTipRender: function(){\r\n\t\t\t\tvar $self = $(this);\r\n\t\t\t\t$self.powerTip('reposition');\r\n\t\t\t\t$(document).trigger('gftt_tooltip_render', [this]);\r\n\t\t\t},\r\n\t\t\tpowerTipOpen: function(){\r\n\t\t\t\tvar $self = $(this);\r\n\t\t\t\t$self.data('tip-open', true);\r\n\t\t\t\t$(document).trigger('gftt_tooltip_open', [this]);\r\n\t\t\t},\r\n\t\t\tpowerTipClose: function(){\r\n\t\t\t\tvar $self = $(this);\r\n\t\t\t\t$self.data('tip-open', false);\r\n\t\t\t\t$('body').removeClass('gftt_show');\r\n\t\t\t\t$(document).trigger('gftt_tooltip_close', [this]);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tvar $customWrap = $el.closest('.gftt-custom');\r\n\t\tvar $gfLabel = $el.closest('.gform-field-label');\r\n\r\n\t\tif ( !$customWrap.length ) {\r\n\t\t\tvar $label = $gfLabel.find('.gftt-label');\r\n\t\t\tgftt._initLabel( $label );\r\n\t\t}\r\n\r\n\t\tvar $icon = ( $customWrap.length ) ? $customWrap.find('.gftt-icon') : $gfLabel.find('.gftt-icon');\r\n\t\t$icon.on('click', function(e){\r\n\t\t\te.preventDefault();\r\n\t\t\te.stopImmediatePropagation();\r\n\t\t\tvar $self = $(this);\r\n\t\t\tif ( $self.data('tip-open') === true ) {\r\n\t\t\t\t$self.powerTip('hide');\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t$self.powerTip('show');\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t};\r\n\r\n\tgftt.init = function( form_id, forced ){\r\n\r\n\t\tvar $formWrapper = $('#gform_wrapper_'+form_id);\r\n\r\n\t\t/*\r\n\t\tvar gfttHasInit = $formWrapper.data('gftt-init');\r\n\t\tif ( typeof gfttHasInit !== 'undefined' && gfttHasInit.toString() === 'true' && forced !== true ) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t*/\r\n\r\n\t\t$formWrapper.find('.gfield_label > .gftt-content > div, .gsection_title > .gftt-content > div, .gftt-custom .gftt-content > div').each(function(){\r\n\t\t\tvar $this = $(this);\r\n\t\t\tgftt._initTooltips( $this );\r\n\t\t});\r\n\r\n\t\t$formWrapper.find('[class*=\"gchoice\"] .gftt-content > div').each(function(){\r\n\t\t\tvar $this = $(this);\r\n\r\n\t\t\tvar $choice = $this.closest('[class*=\"gchoice\"]');\r\n\t\t\t$choice.addClass('gform-theme__no-reset--children');\r\n\r\n\t\t\tgftt._initTooltips( $this );\r\n\t\t});\r\n\r\n\r\n\t\tvar dynamicPosition = gform.applyFilters('gftt_dynamic_colorpicker_choices_position', true, form_id);\r\n\t\tif ( dynamicPosition ) {\r\n\t\t\t$(window).on('resize', function(){\r\n\t\t\t\tgftt.colorPickerChoicesDynamicPosition( form_id );\r\n\t\t\t});\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\tgftt.colorPickerChoicesDynamicPosition( form_id );\r\n\t\t\t}, 100);\r\n\t\t}\r\n\r\n\t\t$formWrapper.data('gftt-init', true);\r\n\r\n\t}\r\n\r\n\r\n\tgftt.reInitOptions = function(formId, fieldId) {\r\n\t\tvar $field = $('#gform_'+formId+' .gfield#field_'+formId+'_'+fieldId);\r\n\t\tvar $allOptions = $field.find('[class*=\"gchoice\"]');// TODO: Update to just .gchoice ?\r\n\t\t$allOptions.each(function(i){\r\n\t\t\tvar $option = $(this);\r\n\t\t\tgftt._initTooltips( $option.find('.gftt-content > div') );\r\n\t\t});\r\n\t};\r\n\r\n\tgftt.option_label_reinit = function(formId, fieldId) {\r\n\r\n\t\tvar fieldKey = `tt_${formId}_${fieldId}`;\r\n\t\tif ( window.hasOwnProperty(fieldKey) ) {\r\n\t\t\tclearTimeout(window[fieldKey]);\r\n\t\t}\r\n\t\twindow[fieldKey] = setTimeout(function(){\r\n\t\t\tgftt.reInitOptions( formId, fieldId );\r\n\t\t}, 100);\r\n\r\n\t}\r\n\r\n\twindow.gform_format_option_label = function(fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId, index) {\r\n\r\n\t\tgftt.option_label_reinit( formId, fieldId );\r\n\r\n\t\tvar $field = $('#field_'+formId+'_'+fieldId);\r\n\r\n\t\t// Add for cross compat with Image Choices\r\n\t\tif ($field.length && $field.hasClass('image-choices-field') && typeof window.imageChoices_gform_format_option_label === 'function') {\r\n\t\t\treturn window.imageChoices_gform_format_option_label(fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId, index);\r\n\t\t}\r\n\r\n\t\t// Add for cross compat with Color Picker\r\n\t\tif ( $field.length && $field.hasClass('color-picker-field') && typeof window.colorPicker_gform_format_option_label === 'function') {\r\n\t\t\treturn window.colorPicker_gform_format_option_label(fullLabel, fieldLabel, priceLabel, selectedPrice, price, formId, fieldId, index);\r\n\t\t}\r\n\r\n\t\treturn fullLabel;\r\n\t}\r\n\r\n\r\n\t$(document).on('gform_post_render', function(event, form_id, current_page){\r\n\t\tvar globalDelay = ( window.hasOwnProperty('gf_tooltips_init_delay') ) ? parseInt( window.gf_tooltips_init_delay, 10 ) : 0;\r\n\t\tvar delay = gform.applyFilters( 'gftt_tooltips_init_delay', globalDelay );\r\n\t\tif ( delay === 0 && $('#gform_' + form_id + ' .gpnf-nested-entries-container').length ) {\r\n\t\t\t// Seems we need to slightly delay the tooltip init if the form is using Gravity Wiz' Nested Forms and that field has a tooltip\r\n\t\t\tdelay = 1;\r\n\t\t}\r\n\t\tif ( delay > 0 ) {\r\n\t\t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