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,KAAKJ,IACLP,EAAIU,QAAQC,KAAKJ,KACjBP,EAAIU,QAAQC,KAAKJ,IAAIM,QACrBb,EAAIU,QAAQC,KAAKJ,IAAIM,OAAOmE,gBAE5BT,EAAgBvE,EAAIU,QAAQC,KAAKJ,IAAIM,OAAOmE,eACrChF,EAAIU,QAAQ6D,GAAelC,QAAQc,MACxCxC,KAAKJ,GAAGe,QAAQiD,EAAgB,IAAK,IAAIjD,QAAQ,IAAK,MAKnDX,KAAK+D","sources":["src/dynamic-control.js"],"sourcesContent":["/**\n * The majority of the code in this file\n * is derived from the wp-customize-posts plugin\n * and the work of @westonruter to whom I am very grateful.\n *\n * @see https://github.com/xwp/wp-customize-posts\n */\n\n(function () {\n \"use strict\";\n\n /**\n * A dynamic color-alpha control.\n *\n * @class\n * @augments wp.customize.Control\n * @augments wp.customize.Class\n */\n wp.customize.kirkiDynamicControl = wp.customize.Control.extend({\n initialize: function (id, options) {\n let control = this;\n let args = options || {};\n\n args.params = args.params || {};\n\n if (!args.params.type) {\n args.params.type = \"kirki-generic\";\n }\n\n let className;\n\n if (args.content) {\n let splits = args.content.split('class=\"');\n splits = splits[1].split('\"');\n className = splits[0];\n } else {\n className = \"customize-control customize-control-\" + args.params.type;\n }\n\n if (!args.params.wrapper_attrs && args.params.wrapper_atts) {\n args.params.wrapper_attrs = args.params.wrapper_atts;\n }\n\n // Hijack the container to add wrapper_attrs.\n args.params.content = jQuery(\"<li></li>\");\n args.params.content.attr(\n \"id\",\n \"customize-control-\" + id.replace(/]/g, \"\").replace(/\\[/g, \"-\")\n );\n args.params.content.attr(\"class\", className);\n\n _.each(args.params.wrapper_attrs, function (val, key) {\n if (\"class\" === key) {\n val = val.replace(\"{default_class}\", className);\n }\n\n args.params.content.attr(key, val);\n });\n\n control.propertyElements = [];\n wp.customize.Control.prototype.initialize.call(control, id, args);\n wp.hooks.doAction(\"kirki.dynamicControl.init.after\", id, control, args);\n },\n\n /**\n * Add bidirectional data binding links between inputs and the setting(s).\n *\n * This is copied from wp.customize.Control.prototype.initialize(). It\n * should be changed in Core to be applied once the control is embedded.\n *\n * @private\n * @returns {void}\n */\n _setUpSettingRootLinks: function () {\n var control = this,\n nodes = control.container.find(\"[data-customize-setting-link]\");\n\n nodes.each(function () {\n var node = jQuery(this);\n\n wp.customize(node.data(\"customizeSettingLink\"), function (setting) {\n var element = new wp.customize.Element(node);\n control.elements.push(element);\n element.sync(setting);\n element.set(setting());\n });\n });\n },\n\n /**\n * Add bidirectional data binding links between inputs and the setting properties.\n *\n * @private\n * @returns {void}\n */\n _setUpSettingPropertyLinks: function () {\n var control = this,\n nodes;\n\n if (!control.setting) {\n return;\n }\n\n nodes = control.container.find(\"[data-customize-setting-property-link]\");\n\n nodes.each(function () {\n var node = jQuery(this),\n element,\n propertyName = node.data(\"customizeSettingPropertyLink\");\n\n element = new wp.customize.Element(node);\n control.propertyElements.push(element);\n element.set(control.setting()[propertyName]);\n\n element.bind(function (newPropertyValue) {\n var newSetting = control.setting();\n if (newPropertyValue === newSetting[propertyName]) {\n return;\n }\n newSetting = _.clone(newSetting);\n newSetting[propertyName] = newPropertyValue;\n control.setting.set(newSetting);\n });\n control.setting.bind(function (newValue) {\n if (newValue[propertyName] !== element.get()) {\n element.set(newValue[propertyName]);\n }\n });\n });\n },\n\n /**\n * @inheritdoc\n */\n ready: function () {\n var control = this;\n\n control._setUpSettingRootLinks();\n control._setUpSettingPropertyLinks();\n\n wp.customize.Control.prototype.ready.call(control);\n\n control.deferred.embedded.done(function () {\n control.initKirkiControl();\n wp.hooks.doAction(\n \"kirki.dynamicControl.ready.deferred.embedded.done\",\n control\n );\n });\n wp.hooks.doAction(\"kirki.dynamicControl.ready.after\", control);\n },\n\n /**\n * Embed the control in the document.\n *\n * Override the embed() method to do nothing,\n * so that the control isn't embedded on load,\n * unless the containing section is already expanded.\n *\n * @returns {void}\n */\n embed: function () {\n var control = this,\n sectionId = control.section();\n\n if (!sectionId) {\n return;\n }\n\n wp.customize.section(sectionId, function (section) {\n if (\n \"kirki-expanded\" === section.params.type ||\n section.expanded() ||\n wp.customize.settings.autofocus.control === control.id\n ) {\n control.actuallyEmbed();\n } else {\n section.expanded.bind(function (expanded) {\n if (expanded) {\n control.actuallyEmbed();\n }\n });\n }\n });\n wp.hooks.doAction(\"kirki.dynamicControl.embed.after\", control);\n },\n\n /**\n * Deferred embedding of control when actually\n *\n * This function is called in Section.onChangeExpanded() so the control\n * will only get embedded when the Section is first expanded.\n *\n * @returns {void}\n */\n actuallyEmbed: function () {\n var control = this;\n if (\"resolved\" === control.deferred.embedded.state()) {\n return;\n }\n control.renderContent();\n control.deferred.embedded.resolve(); // This triggers control.ready().\n wp.hooks.doAction(\"kirki.dynamicControl.actuallyEmbed.after\", control);\n },\n\n /**\n * This is not working with autofocus.\n *\n * @param {object} [args] Args.\n * @returns {void}\n */\n focus: function (args) {\n var control = this;\n control.actuallyEmbed();\n wp.customize.Control.prototype.focus.call(control, args);\n wp.hooks.doAction(\"kirki.dynamicControl.focus.after\", control);\n },\n\n /**\n * Additional actions that run on ready.\n *\n * @param {object} control - The control object. If undefined fallsback to the this.\n * @returns {void}\n */\n initKirkiControl: function (control) {\n control = control || this;\n wp.hooks.doAction(\"kirki.dynamicControl.initKirkiControl\", this);\n\n // Save the value\n control.container.on(\"change keyup paste click\", \"input\", function () {\n control.setting.set(jQuery(this).val());\n });\n },\n });\n})();\n\n(function (api) {\n /**\n * Set the value and trigger all bound callbacks.\n *\n * @since 1.0\n * @param {object} to - New value.\n * @returns {Object} - this\n */\n api.Value.prototype.set = function (to) {\n var from = this._value,\n parentSetting,\n newVal;\n\n to = this._setter.apply(this, arguments);\n to = this.validate(to);\n\n // Bail if the sanitized value is null or unchanged.\n if (null === to || _.isEqual(from, to)) {\n return this;\n }\n\n /**\n * Start Kirki mod.\n */\n if (\n this.id &&\n api.control(this.id) &&\n api.control(this.id).params &&\n api.control(this.id).params.parent_setting\n ) {\n parentSetting = api.control(this.id).params.parent_setting;\n newVal = {};\n newVal[this.id.replace(parentSetting + \"[\", \"\").replace(\"]\", \"\")] = to;\n api\n .control(parentSetting)\n .setting.set(\n jQuery.extend({}, api.control(parentSetting).setting._value, newVal)\n );\n }\n\n /**\n * End Kirki mod.\n */\n\n this._value = to;\n this._dirty = true;\n\n this.callbacks.fireWith(this, [to, from]);\n\n return this;\n };\n\n /**\n * Get the value.\n *\n * @returns {mixed} - Returns the value.\n */\n api.Value.prototype.get = function () {\n // Start Kirki mod.\n var parentSetting;\n if (\n this.id &&\n api.control(this.id) &&\n api.control(this.id).params &&\n api.control(this.id).params.parent_setting\n ) {\n parentSetting = api.control(this.id).params.parent_setting;\n return api.control(parentSetting).setting.get()[\n this.id.replace(parentSetting + \"[\", \"\").replace(\"]\", \"\")\n ];\n }\n // End Kirki mod.\n\n return this._value;\n };\n})(wp.customize);\n"],"names":["api","wp","customize","kirkiDynamicControl","Control","extend","initialize","id","options","className","control","this","args","params","type","content","splits","split","wrapper_attrs","wrapper_atts","jQuery","attr","replace","_","each","val","key","propertyElements","prototype","call","hooks","doAction","_setUpSettingRootLinks","container","find","node","data","setting","element","Element","elements","push","sync","set","_setUpSettingPropertyLinks","propertyName","bind","newPropertyValue","newSetting","clone","newValue","get","ready","deferred","embedded","done","initKirkiControl","embed","sectionId","section","expanded","settings","autofocus","actuallyEmbed","state","renderContent","resolve","focus","on","Value","to","parentSetting","newVal","from","_value","_setter","apply","arguments","validate","isEqual","parent_setting","_dirty","callbacks","fireWith"],"version":3,"file":"control.js.map"}