{"version":3,"file":"matrixExtendedJs-10dfc73b.js","sources":["../../../../../static/src/js/matrixExtended.ts"],"sourcesContent":["(function (window: any) {\n const {Craft, Garnish, $} = window;\n if (!Craft || !Garnish || !$) {\n return;\n }\n\n /**\n * @see https://github.com/craftcms/cms/blob/5.x/src/web/assets/matrix/src/MatrixInput.js\n * @todo check, that it only initializes on Inline Editable views\n */\n Craft.MatrixExtended = Garnish.Base.extend({\n settings: {}, childParent: {}, helper: undefined, itemDrag: undefined,\n\n init: function (config: { settings: any, childParent: any }, helper: any) {\n const self = this;\n this.settings = config.settings || {};\n this.childParent = config.childParent || {};\n this.helper = helper;\n\n if (!Garnish.DisclosureMenu || !Craft.MatrixInput) {\n return;\n }\n\n const disclosureMenuShowFn = Garnish.DisclosureMenu.prototype.show;\n Garnish.DisclosureMenu.prototype.show = function (...args: any[]) {\n self.initDisclosureMenu(this);\n disclosureMenuShowFn.apply(this, args);\n };\n\n const disclosureMenuInitFn = Garnish.DisclosureMenu.prototype.init;\n Garnish.DisclosureMenu.prototype.init = function (...args: any[]) {\n disclosureMenuInitFn.apply(this, args);\n self.initAddButtonMenu(this);\n self.prepareEntryDropZones();\n };\n\n const matrixUpdateAddEntryBtnFn = Craft.MatrixInput.prototype.updateAddEntryBtn;\n Craft.MatrixInput.prototype.updateAddEntryBtn = function (...args: any[]) {\n matrixUpdateAddEntryBtnFn.apply(this, args);\n self.checkAddBtn(this);\n };\n\n if (!this.settings.experimentalFeatures || !this.settings.enableDragDrop) {\n return;\n }\n\n const matrixInitFn = Craft.MatrixInput.prototype.init;\n Craft.MatrixInput.prototype.init = function (...args: any[]) {\n matrixInitFn.apply(this, args);\n this.entrySort.allowDragging = () => false;\n this.entrySort.destroy();\n self.prepareEntryDropZones();\n };\n\n Craft.MatrixInput.prototype.canAddMoreEntries = function () {\n return (\n !this.maxEntries ||\n this.$entriesContainer.children(':not(.matrix-extended-drop-target):not(.matrix-extended-buttons)').length < this.maxEntries\n );\n };\n\n this.itemDrag = new Garnish.DragDrop({\n activeDropTargetClass: 'active',\n minMouseDist: 10,\n hideDraggee: false,\n moveHelperToCursor: true,\n handle: (item: any) => $(item).find('> .actions > .move, > .titlebar'),\n filter: () => this.itemDrag.$targetItem.closest('.matrixblock'),\n dropTargets: () => {\n if (!this.childParent) {\n return [];\n }\n\n const {entry, typeId} = this.itemDrag.$draggee.closest('.matrixblock').data();\n const matrix = entry.matrix;\n if (!matrix || !typeId) {\n return [];\n }\n // TODO check `canAddMore`, but only if drag and drop is between fields\n // const $allDropTargets = $('.matrix-extended-drop-target').filter((_, x) => !!$(x).data('canAddMore'));\n const $allDropTargets = $('.matrix-extended-drop-target')\n .filter((_: any, x: any) => (this.childParent[typeId] || []).includes($(x).data('entryTypeId')));\n\n return $allDropTargets.toArray().reverse();\n },\n onDragStart: () => {\n Garnish.$bod.addClass('dragging');\n this.itemDrag.$draggee.closest('.matrixblock').addClass('draggee');\n this.$dropEntry = this.itemDrag.$draggee.data('entry').$container;\n this.$pullBlock = this.$dropEntry.closest('.matrix-field');\n },\n // TODO find better way, like changing the owner. Currently clone & delete is used\n onDragStop: async () => {\n this.itemDrag.$draggee.closest('.matrixblock').removeClass('draggee');\n Garnish.$bod.removeClass('dragging');\n if (!this.$dropEntry || !this.$pullBlock) {\n return this.itemDrag.returnHelpersToDraggees();\n }\n const $dropEntry = this.$dropEntry;\n const $dropTarget = this.itemDrag.$activeDropTarget;\n\n if (!$dropEntry || !$dropTarget) {\n return this.itemDrag.returnHelpersToDraggees();\n }\n\n let $relationEntry;\n let relationPosition = 'insertBefore';\n if ($dropTarget.data('position') === 'button') {\n $relationEntry = $dropTarget.closest('.matrix-field').find('> .blocks');\n relationPosition = 'appendTo';\n } else {\n $relationEntry = $dropTarget.next('.matrixblock');\n }\n\n const $pullBlock = this.$pullBlock;\n const $dropBlock = $dropTarget.closest('.matrix-field');\n if ($pullBlock.is($dropBlock)) {\n if (relationPosition === 'appendTo') {\n $dropEntry.appendTo($relationEntry);\n } else {\n $dropEntry.insertBefore($relationEntry);\n }\n\n // only update one block\n $pullBlock.data('matrix').entrySelect.resetItemOrder();\n } else {\n const matrix = $dropBlock.data('matrix');\n const matrix2 = $pullBlock.data('matrix');\n const entry = $dropEntry.data('entry');\n const typeId = $dropEntry.data('typeId');\n await this.duplicateWithNewOwner($relationEntry, relationPosition, typeId, entry, matrix, matrix2)\n // matrix.entrySelect.resetItemOrder();\n // matrix2.entrySelect.resetItemOrder();\n }\n\n this.itemDrag.returnHelpersToDraggees();\n this.prepareEntryDropZones();\n this.$dropEntry = undefined;\n this.$pullBlock = undefined;\n },\n });\n },\n\n prepareEntryDropZones() {\n if (!this.settings.experimentalFeatures || !this.settings.enableDragDrop) {\n return;\n }\n\n const $fields = $('.matrix-field');\n const $blocks = $fields.find('.matrixblock');\n\n $('.matrix-extended-drop-target').remove();\n for (const block of $blocks) {\n const $block = $(block);\n\n let $entryTypeId = null;\n const entry = $block.data('entry');\n if (!entry) {\n return;\n }\n const matrix = entry.matrix;\n if (!matrix) {\n return;\n }\n\n $entryTypeId = matrix.settings.fieldId;\n\n const $dropTargetBefore = $(`
`);\n $dropTargetBefore.data($block.data());\n $dropTargetBefore.data('entryTypeId', $entryTypeId);\n $block.before($dropTargetBefore);\n }\n\n const $buttons = $fields.find('> .buttons');\n for (const button of $buttons) {\n const $button = $(button);\n\n const matrix = $button.closest('.matrix-field').data('matrix');\n if (!matrix) {\n continue;\n }\n\n const $dropTargetButton = $(`
`);\n $dropTargetButton.data('entryTypeId', matrix.settings.fieldId);\n $dropTargetButton.insertBefore($button);\n }\n\n this.itemDrag.removeAllItems();\n this.itemDrag.addItems($blocks);\n Garnish.$bod.addClass('matrix-extended-drag-drop');\n },\n\n initAddButtonMenu(disclosureMenu: any) {\n if (!this.settings.expandMenu) {\n return;\n }\n\n const {$trigger, $container} = disclosureMenu;\n const $parent = $trigger.parent();\n const $wrapper = $trigger.closest('.buttons').parent('.matrix-field');\n if (!$trigger || !$container || !$parent.hasClass('buttons') || !$wrapper.attr('id')) {\n return;\n }\n\n if ($trigger._hasMatrixExtensionButtonsInitialized) {\n return;\n }\n $trigger.hide();\n $trigger._hasMatrixExtensionButtonsInitialized = true;\n\n const $buttonContainer = $('
');\n const $actionButtons = $trigger\n .disclosureMenu()\n .data('disclosureMenu')\n .$container.find('button')\n .clone()\n .off()\n .on('activate', async (ev: any) => {\n const $button = $container.find('button').filter((_: any, x: any) => $(x).data('type') === $(ev.currentTarget).data('type'));\n $button.trigger('activate');\n });\n\n const id = $wrapper.attr('id');\n this.buildGroupedMenu($buttonContainer, $actionButtons, $trigger, id);\n\n $buttonContainer.appendTo($parent);\n },\n\n initDisclosureMenu(disclosureMenu: any) {\n const {$trigger, $container} = disclosureMenu;\n if (!$trigger || !$container || !$trigger.hasClass('action-btn')) {\n return;\n }\n const $element = $trigger.closest('.actions').parent('.matrixblock');\n if (!$element.length) {\n return;\n }\n const {typeId, entry} = $element.data();\n if (!typeId || !entry) {\n return;\n }\n\n const matrix = entry.matrix;\n if (!matrix) {\n return;\n }\n\n if (disclosureMenu._hasMatrixExtensionButtonsInitialized) {\n this.checkPaste($container, matrix);\n this.checkDuplicate($container, matrix);\n this.checkAdd($container, matrix);\n return;\n }\n disclosureMenu._hasMatrixExtensionButtonsInitialized = true;\n\n this.addMenu($container, typeId, entry, matrix);\n },\n\n pasteEntry: async function (_: any, typeId: any, entry: any, matrix: any) {\n if (matrix.addingEntry) {\n // only one new entry at a time\n return;\n }\n\n if (!matrix.canAddMoreEntries()) {\n matrix.updateStatusMessage();\n return;\n }\n\n matrix.addingEntry = true;\n\n if (matrix.elementEditor) {\n // First ensure we're working with drafts for all elements leading up\n // to this field’s element\n await matrix.elementEditor.setFormValue(matrix.settings.baseInputName, '*');\n }\n\n try {\n const entryId = matrix.elementEditor.getDraftElementId(entry.id);\n\n const {data} = await Craft.sendActionRequest('POST', 'matrix-extended/matrix-extended/paste-entry', {\n data: {\n fieldId: matrix.settings.fieldId,\n entryId,\n entryTypeId: typeId,\n ownerId: matrix.settings.ownerId,\n ownerElementType: matrix.settings.ownerElementType,\n siteId: matrix.settings.siteId,\n namespace: matrix.settings.namespace,\n staticEntries: matrix.settings.staticEntries,\n },\n });\n\n const $entry = $(data.blockHtml);\n\n // Pause the element editor\n matrix.elementEditor?.pause();\n $entry.insertAfter(entry.$container);\n\n matrix.trigger('entryAdded', {\n $entry: $entry,\n });\n\n $entry.css('margin-bottom', '');\n Craft.initUiElements($entry.children('.fields'));\n await Craft.appendHeadHtml(data.headHtml);\n await Craft.appendBodyHtml(data.bodyHtml);\n new Craft.MatrixInput.Entry(matrix, $entry);\n matrix.entrySort.addItems($entry);\n matrix.entrySelect.addItems($entry);\n matrix.updateAddEntryBtn();\n\n // Animate the entry into position\n $entry.css(matrix.getHiddenEntryCss($entry)).velocity({\n opacity: 1, 'margin-bottom': 10,\n }, 'fast',);\n\n Garnish.requestAnimationFrame(function () {\n // Resume the element editor\n matrix.elementEditor?.resume();\n });\n\n } catch (error) {\n this.addStatusMessage(Craft.t('matrix-extended', 'There was an error pasting the entry'), 'error');\n }\n\n matrix.addingEntry = false;\n entry.actionDisclosure.hide();\n },\n\n duplicateWithNewOwner: async function ($relationEntry: any, relationPosition: any, typeId: any, entry: any, matrix: any, matrix2: any) {\n if (matrix.addingEntry) {\n // only one new entry at a time\n return;\n }\n\n if (!matrix.canAddMoreEntries()) {\n matrix.updateStatusMessage();\n return;\n }\n\n matrix.addingEntry = true;\n\n if (matrix.elementEditor) {\n // First ensure we're working with drafts for all elements leading up\n // to this field’s element\n await matrix.elementEditor.setFormValue(matrix.settings.baseInputName, '*');\n }\n\n try {\n const entryId = matrix.elementEditor.getDraftElementId(entry.id);\n\n const {data} = await Craft.sendActionRequest('POST', 'matrix-extended/matrix-extended/duplicate-entry-with-new-owner', {\n data: {\n fieldId: matrix.settings.fieldId,\n entryId,\n entryTypeId: typeId,\n ownerId: matrix.settings.ownerId,\n ownerElementType: matrix.settings.ownerElementType,\n siteId: matrix.settings.siteId,\n namespace: matrix.settings.namespace,\n staticEntries: matrix.settings.staticEntries,\n },\n });\n\n const $entry = $(data.blockHtml);\n\n // Pause the element editor\n matrix.elementEditor?.pause();\n\n if (relationPosition === 'appendTo') {\n $entry.appendTo($relationEntry);\n } else {\n $entry.insertBefore($relationEntry);\n }\n entry.$container.hide();\n\n matrix.trigger('entryAdded', {\n $entry: $entry,\n });\n\n $entry.css('margin-bottom', '');\n Craft.initUiElements($entry.children('.fields'));\n await Craft.appendHeadHtml(data.headHtml);\n await Craft.appendBodyHtml(data.bodyHtml);\n new Craft.MatrixInput.Entry(matrix, $entry);\n matrix.entrySort.addItems($entry);\n matrix.entrySelect.addItems($entry);\n matrix.updateAddEntryBtn();\n\n // Animate the entry into position\n $entry.css(matrix.getHiddenEntryCss($entry)).velocity({\n opacity: 1, 'margin-bottom': 10,\n }, 'fast',);\n\n Garnish.requestAnimationFrame(function () {\n // Resume the element editor\n matrix.elementEditor?.resume();\n entry.selfDestruct();\n });\n } catch (error) {\n this.addStatusMessage(Craft.t('matrix-extended', 'There was an error dropping the entry'), 'error');\n }\n\n matrix.addingEntry = false;\n entry.actionDisclosure.hide();\n },\n\n copyEntry: async function ($menu: any, typeId: any, entry: any, matrix: any) {\n try {\n const entryId = matrix.elementEditor.getDraftElementId(entry.id);\n\n const {data} = await Craft.sendActionRequest('POST', 'matrix-extended/matrix-extended/copy-entry', {\n data: {\n fieldId: matrix.settings.fieldId,\n entryId,\n entryTypeId: typeId,\n ownerId: matrix.settings.ownerId,\n ownerElementType: matrix.settings.ownerElementType,\n siteId: matrix.settings.siteId,\n namespace: matrix.settings.namespace,\n staticEntries: matrix.settings.staticEntries,\n },\n });\n\n this.helper.setEntryReference(data.entryReference);\n this.checkPaste($menu, matrix);\n this.checkDuplicate($menu, matrix);\n this.checkAdd($menu, matrix);\n await Craft.appendHeadHtml(data.headHtml);\n await Craft.appendBodyHtml(data.bodyHtml);\n\n this.addStatusMessage(Craft.t('matrix-extended', 'Entry reference copied'));\n } catch (error) {\n this.addStatusMessage(Craft.t('matrix-extended', 'There was an error copying the entry reference'), 'error');\n }\n entry.actionDisclosure.hide();\n },\n\n duplicateEntry: async function (_: any, typeId: any, entry: any, matrix: any) {\n if (matrix.addingEntry) {\n // only one new entry at a time\n return;\n }\n\n if (!matrix.canAddMoreEntries()) {\n matrix.updateStatusMessage();\n return;\n }\n\n matrix.addingEntry = true;\n\n if (matrix.elementEditor) {\n // First ensure we're working with drafts for all elements leading up\n // to this field’s element\n await matrix.elementEditor.setFormValue(matrix.settings.baseInputName, '*');\n }\n\n const entryId = matrix.elementEditor.getDraftElementId(entry.id);\n\n try {\n const {data} = await Craft.sendActionRequest('POST', 'matrix-extended/matrix-extended/duplicate-entry', {\n data: {\n fieldId: matrix.settings.fieldId,\n entryId,\n entryTypeId: typeId,\n ownerId: matrix.settings.ownerId,\n ownerElementType: matrix.settings.ownerElementType,\n siteId: matrix.settings.siteId,\n namespace: matrix.settings.namespace,\n staticEntries: matrix.settings.staticEntries,\n },\n });\n\n const $entry = $(data.blockHtml);\n\n // Pause the element editor\n matrix.elementEditor?.pause();\n $entry.insertAfter(entry.$container);\n\n matrix.trigger('entryAdded', {\n $entry: $entry,\n });\n\n $entry.css('margin-bottom', '');\n Craft.initUiElements($entry.children('.fields'));\n await Craft.appendHeadHtml(data.headHtml);\n await Craft.appendBodyHtml(data.bodyHtml);\n new Craft.MatrixInput.Entry(matrix, $entry);\n matrix.entrySort.addItems($entry);\n matrix.entrySelect.addItems($entry);\n matrix.updateAddEntryBtn();\n\n // Animate the entry into position\n $entry.css(matrix.getHiddenEntryCss($entry)).velocity({\n opacity: 1, 'margin-bottom': 10,\n }, 'fast',);\n\n Garnish.requestAnimationFrame(function () {\n // Resume the element editor\n matrix.elementEditor?.resume();\n });\n } catch (error) {\n this.addStatusMessage(Craft.t('matrix-extended', 'There was an error duplicating the entry'), 'error');\n }\n\n matrix.addingEntry = false;\n entry.actionDisclosure.hide();\n },\n\n addMenu: function ($container: any, typeId: any, entry: any, matrix: any) {\n const $menu = $('');\n const $hr = $('
');\n\n this.addAddBlockButton($menu, typeId, entry, matrix);\n this.addDuplicateButton($menu, typeId, entry, matrix);\n this.addCopyButton($menu, typeId, entry, matrix);\n this.addPasteButton($menu, typeId, entry, matrix);\n this.addDeleteButton($menu, entry);\n this.checkPaste($menu, matrix);\n this.checkDuplicate($menu, matrix);\n this.checkAdd($menu, matrix);\n\n $menu.insertBefore($container.find('ul').eq(0));\n $hr.insertAfter($menu);\n\n if (this.settings.removeEntryTypesFromDiscloseMenu) {\n const $addButtonContainer = $container.find('[data-action=\"add\"]').parent().parent();\n $addButtonContainer.prev().remove();\n $addButtonContainer.remove();\n }\n },\n\n addPasteButton: function ($menu: any, typeId: any, entry: any, matrix: any) {\n if (!this.settings.enableCopyPaste) {\n return;\n }\n\n const $pasteButton = $(`
  • \n \n
  • `);\n $menu.append($pasteButton);\n\n $pasteButton.find('button').on('click', () => {\n this.pasteEntry($menu, typeId, entry, matrix);\n });\n },\n\n addAddBlockButton: function ($menu: any, _: any, entry: any, matrix: any) {\n if (!this.settings.enableAddBlockAbove) {\n return;\n }\n\n if (!matrix.$addEntryMenuBtn.length && !matrix.$addEntryBtn.length) {\n return;\n }\n\n const $addBlockButton = $(`
  • \n \n
  • `);\n $menu.append($addBlockButton);\n\n $addBlockButton.find('button').on('click', () => {\n const id = matrix.id;\n\n $('.matrix-extended-buttons-above').remove();\n $(`#matrix-extended-menu-${id}-all`).remove();\n\n const $buttonContainer = $('
    ');\n const $actionButtons =\n matrix.$addEntryMenuBtn.length\n ? matrix.$addEntryMenuBtn.data('disclosureMenu').$container.find('button').clone().off()\n : matrix.$addEntryBtn.clone().off();\n\n const $clone = Craft.ui\n .createButton({\n label: matrix.$addEntryMenuBtn.find('.label').text(), spinner: true,\n })\n .addClass('btn menubtn dashed add icon')\n .attr('aria-controls', `matrix-extended-menu-${id}-all`);\n\n const $menuContainer = $(`
    `);\n const $menu = $('');\n\n $menuContainer.append($menu);\n $(document.body).append($menuContainer);\n const disclosure = new Garnish.DisclosureMenu($clone);\n\n for (const button of $actionButtons) {\n const $li = $(`
  • `);\n const $button = $(button);\n $li.append($button)\n $menu.append($li);\n }\n\n $actionButtons.on('activate', async (ev: any) => {\n // only allow activation logic on \"super\" disclosure menu\n if (!$(ev.currentTarget).closest(`#matrix-extended-menu-${id}-all`).length) {\n return;\n }\n\n $clone.addClass('loading');\n\n try {\n await matrix.addEntry($(ev.currentTarget).data('type'), entry.$container[0].checkVisibility() ? entry.$container : undefined);\n } finally {\n disclosure.hide();\n $clone.remove();\n $menuContainer.remove();\n $buttonContainer.remove();\n }\n });\n\n if (this.settings.expandMenu) {\n const $container = $clone.data('disclosureMenu').$container;\n const $actionButtons = $container.find('button').clone(true, true);\n this.buildGroupedMenu($buttonContainer, $actionButtons, $clone, id, true);\n } else {\n $buttonContainer.append($clone);\n }\n\n $buttonContainer.insertBefore(entry.$container);\n entry.actionDisclosure.hide();\n });\n },\n\n addCopyButton: function ($menu: any, typeId: any, entry: any, matrix: any) {\n if (!this.settings.enableCopyPaste) {\n return;\n }\n\n const $copyButton = $(`
  • \n \n
  • `);\n $menu.append($copyButton);\n\n $copyButton.find('button').on('click', () => {\n this.copyEntry($menu, typeId, entry, matrix);\n });\n },\n\n addDuplicateButton: function ($menu: any, typeId: any, entry: any, matrix: any) {\n if (!this.settings.enableDuplicate) {\n return;\n }\n\n const $duplicateButton = $(`
  • \n \n
  • `);\n $menu.append($duplicateButton);\n\n $duplicateButton.find('button').on('click', () => {\n this.duplicateEntry($menu, typeId, entry, matrix);\n });\n },\n\n addDeleteButton: function ($menu: any, entry: any) {\n if (!this.settings.extraDeleteButton) {\n return;\n }\n\n const $deleteButton = $(`
  • \n \n
  • `);\n $menu.append($deleteButton);\n\n $deleteButton.find('button').on('click', function () {\n entry.selfDestruct();\n entry.actionDisclosure.hide();\n });\n },\n\n buildGroupedMenu: function ($buttonContainer: any, $actionButtons: any, $actionBtn: any, id: any, above = false) {\n const fieldIndex: string = id.replace(/.*fields-/, '');\n let $unused = $actionButtons;\n if (!this.settings.fields) {\n const $actionButtonContainer = $('
    ')\n $unused.first().addClass('add icon');\n $unused.addClass('btn dashed');\n $actionButtonContainer.append($unused);\n $buttonContainer.append($actionButtonContainer)\n return;\n }\n\n if (!this.settings.fields[fieldIndex]) {\n const $actionButtonContainer = $('
    ')\n $unused.first().addClass('add icon');\n $unused.addClass('btn dashed');\n $actionButtonContainer.append($unused);\n $buttonContainer.append($actionButtonContainer)\n return;\n }\n\n const fieldGroup: Record = this.settings.fields[fieldIndex];\n if (fieldGroup.oneLiner) {\n $buttonContainer.addClass('one-line');\n }\n for (const [index, group] of Object.entries(fieldGroup.groups)) {\n $(`#matrix-extended-menu-${id}-${index}${above ? '-above' : ''}`).remove();\n\n const $groupedMenuButton = Craft.ui\n .createButton({\n label: group.label, spinner: true,\n })\n .addClass('btn menubtn dashed add icon')\n .attr('aria-controls', `matrix-extended-menu-${id}-${index}${above ? '-above' : ''}`)\n .appendTo($buttonContainer);\n const $menuContainer = $(`
    `);\n const $menu = $('
      ');\n\n $menuContainer.append($menu);\n $(document.body).append($menuContainer);\n const disclosure = new Garnish.DisclosureMenu($groupedMenuButton);\n\n for (const type of group.types) {\n const $li = $(`
    • `);\n const $button = $actionButtons.filter((_: any, x: any) => $(x).data('type') === type);\n $unused = $unused.filter((_: any, x: any) => $(x).data('type') !== type);\n if (!$button.length) {\n console.warn(`Type ${type} not found in group ${id}`)\n continue;\n }\n $li.append($button);\n $menu.append($li);\n $button.on('activate', () => {\n if (!above) {\n disclosure.hide();\n return;\n }\n $menuContainer.remove();\n disclosure.destroy();\n });\n }\n }\n\n if (!$unused.length) {\n return;\n }\n\n if (this.settings.expandUngrouped) {\n const $actionButtonContainer = $('
      ')\n $unused.first().addClass('add icon');\n $unused.addClass('btn dashed');\n $actionButtonContainer.append($unused);\n\n switch (this.settings.ungroupedPosition) {\n case 'start':\n $buttonContainer.prepend($actionButtonContainer);\n break;\n case 'end':\n $buttonContainer.append($actionButtonContainer);\n break;\n }\n return;\n }\n\n $(`#matrix-extended-menu-${id}-others${above ? '-above' : ''}`).remove();\n const $groupedMenuButton = Craft.ui\n .createButton({\n label: $actionBtn.find('.label').text(), spinner: true,\n })\n .addClass('btn menubtn dashed add icon')\n .attr('aria-controls', `matrix-extended-menu-${id}-others${above ? '-above' : ''}`);\n\n switch (this.settings.ungroupedPosition) {\n case 'start':\n $groupedMenuButton.prependTo($buttonContainer);\n break;\n case 'end':\n $groupedMenuButton.appendTo($buttonContainer);\n break;\n }\n\n const $menuContainer = $(`
      `);\n const $menu = $('
        ');\n\n $menuContainer.append($menu);\n $(document.body).append($menuContainer);\n const disclosure = new Garnish.DisclosureMenu($groupedMenuButton);\n\n for (const button of $unused) {\n const $li = $(`
      • `);\n const $button = $(button);\n $li.append($button);\n $menu.append($li);\n $button.on('activate', () => {\n if (!above) {\n disclosure.hide();\n return;\n }\n $menuContainer.remove();\n disclosure.destroy();\n })\n }\n },\n\n checkAdd: function ($container: any, matrix: any) {\n const $addButton = $container.find('button[data-action=\"add-block\"]');\n $addButton.disable();\n const $parent = $addButton.parent();\n $parent.attr('title', '');\n\n if (!matrix.canAddMoreEntries()) {\n $parent.attr('title', Craft.t('matrix-extended', 'No more entries can be added.'));\n return;\n }\n\n $addButton.enable();\n },\n\n checkAddBtn: function (matrix: any) {\n if (!this.settings.expandMenu) {\n return;\n }\n\n const $btns = matrix.$container.find('> .blocks > .matrix-extended-buttons, > .buttons > .matrix-extended-buttons').find('button');\n $btns.disable();\n const $parent = $btns.parent();\n $parent.attr('title', '');\n\n if (!matrix.canAddMoreEntries()) {\n $parent.attr('title', Craft.t('matrix-extended', 'No more entries can be added.'));\n return;\n }\n\n $btns.enable();\n },\n\n checkDuplicate: function ($container: any, matrix: any) {\n const $duplicateButton = $container.find('button[data-action=\"duplicate\"]');\n $duplicateButton.disable();\n const $parent = $duplicateButton.parent();\n $parent.attr('title', '');\n\n if (!matrix.canAddMoreEntries()) {\n $parent.attr('title', Craft.t('matrix-extended', 'No more entries can be added.'));\n return;\n }\n\n $duplicateButton.enable();\n },\n\n checkPaste: function ($container: any, matrix: any) {\n const $pasteButton = $container.find('button[data-action=\"paste\"]');\n $pasteButton.disable();\n const $parent = $pasteButton.parent();\n $parent.attr('title', '');\n\n if (!this.helper.getEntryReference() || !this.helper.getEntryReference().entryTypeId) {\n $parent.attr('title', Craft.t('matrix-extended', 'There is nothing to paste.'));\n return;\n }\n\n if (!matrix.canAddMoreEntries()) {\n $parent.attr('title', Craft.t('matrix-extended', 'No more entries can be added.'));\n return;\n }\n\n if (!this.helper.isEntryReferenceAllowed(matrix.settings.fieldId)) {\n $parent.attr('title', Craft.t('matrix-extended', 'The copied entry is not allowed here.'));\n return;\n }\n\n $pasteButton.enable();\n },\n\n addStatusMessage: function (message: string, type: 'notice' | 'error' = 'notice') {\n if (type === 'notice') {\n Craft.cp.displayNotice(message);\n }\n\n if (type === 'error') {\n Craft.cp.displayError(message);\n }\n }\n });\n})(window);\n"],"names":["window","Craft","Garnish","$","config","helper","self","disclosureMenuShowFn","args","disclosureMenuInitFn","matrixUpdateAddEntryBtnFn","matrixInitFn","item","entry","typeId","_","x","$dropEntry","$dropTarget","$relationEntry","relationPosition","$pullBlock","$dropBlock","matrix","matrix2","$fields","$blocks","block","$block","$entryTypeId","$dropTargetBefore","$buttons","button","$button","$dropTargetButton","disclosureMenu","$trigger","$container","$parent","$wrapper","$buttonContainer","$actionButtons","ev","id","$element","_a","entryId","data","$entry","$menu","$hr","$addButtonContainer","$pasteButton","$addBlockButton","$clone","$menuContainer","disclosure","$li","$copyButton","$duplicateButton","$deleteButton","$actionBtn","above","fieldIndex","$unused","$actionButtonContainer","fieldGroup","index","group","$groupedMenuButton","type","$addButton","$btns","message"],"mappings":"CAAC,SAAUA,EAAa,CACpB,KAAM,CAAC,MAAAC,EAAO,QAAAC,EAAS,EAAAC,CAAA,EAAKH,EACxB,CAACC,GAAS,CAACC,GAAW,CAACC,IAQrBF,EAAA,eA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