(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@beanbag/spina')) :
    typeof define === 'function' && define.amd ? define(['exports', '@beanbag/spina'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RB = global.RB || {}, global.Spina));
})(this, (function (exports, spina) { 'use strict';

    /**
     * Base support for building extension hooks.
     *
     * This is a re-export of the base extension hook infrastructure found in
     * Djblets.
     *
     * Version Added:
     *     8.0
     */

    var _global_Djblets_ExtensionHook = Djblets.ExtensionHook;

    /**
     * Base support for building extension hook points.
     *
     * This is a re-export of the base extension hook point infrastructure found in
     * Djblets.
     *
     * Version Added:
     *     8.0
     */

    var _global_Djblets_ExtensionHookPoint = Djblets.ExtensionHookPoint;

    var _class$8;

    /**
     * Attributes for CommentDialogHook.
     *
     * Version Added:
     *     8.0
     */

    /**
     * Provides extensibility for the Comment Dialog.
     *
     * Users of this hook can provide a Backbone View that will have access to
     * the CommentDialog and its CommentEditor (through the commentDialog and
     * commentEditor options passed to the view). They can call public API on
     * the comment dialog and augment the contents of the dialog.
     *
     * Version Changed:
     *     8.0:
     *     This is now a modern ES6-style class and supports typing using
     *     TypeScript.
     */
    let CommentDialogHook = spina.spina(_class$8 = class CommentDialogHook extends _global_Djblets_ExtensionHook {
      static hookPoint = new _global_Djblets_ExtensionHookPoint();
      static defaults = {
        viewType: null
      };

      /**
       * Set up the hook.
       */
      setUpHook() {
        console.assert(this.get('viewType'), 'CommentDialogHook instance does not have a ' + '"viewType" attribute set.');
      }
    }) || _class$8;

    /**
     * Base support for building extensions.
     *
     * This is a re-export of the base extension infrastructure found in Djblets.
     *
     * Version Added:
     *     8.0
     */

    var _global_Djblets_Extension = Djblets.Extension;

    var _class$7;

    /**
     * Attributes for FileAttachmentThumbnailContainerHook.
     *
     * Version Added:
     *     8.0
     */

    /**
     * Provides extensibility for File Attachment thumbnails.
     *
     * This can be used to display additional UI on file attachment containers
     * and on the file attachment actions menu. This should not be used to create
     * or modify the thumbnail image itself, use :py:class:`~reviewboard
     * .extensions.hooks.FileAttachmentThumbnailHook` for that behavior instead.
     *
     * Users of this hook must provide a Backbone View (not an instance) which
     * will modify the File Attachment thumbnail. The view will have access to
     * the FileAttachmentThumbnailView and its FileAttachment model (through
     * the thumbnailView and fileAttachment options passed to the view).
     *
     * Version Changed:
     *     8.0:
     *     This is now a modern ES6-style class and supports typing using
     *     TypeScript.
     *
     * Version Added:
     *     6.0
     */
    let FileAttachmentThumbnailContainerHook = spina.spina(_class$7 = class FileAttachmentThumbnailContainerHook extends _global_Djblets_ExtensionHook {
      static hookPoint = new _global_Djblets_ExtensionHookPoint();
      static defaults = {
        viewType: null
      };

      /**
       * Set up the hook.
       */
      setUpHook() {
        console.assert(this.get('viewType'), 'FileAttachmentThumbnailContainerHook instance does ' + 'not have a "viewType" attribute set.');
      }
    }) || _class$7;

    var _class$6;

    /**
     * Attributes for ReviewDialogCommentHook.
     *
     * Version Added:
     *     8.0
     */

    /**
     * Adds additional rendering or UI for a comment in the review dialog.
     *
     * This can be used to display additional UI and even additional fields in
     * the review dialog, which can reflect and potentially modify extra data
     * for a comment.
     *
     * A View type (not an instance) must be provided for the viewType
     * attribute. When rendering comments in the dialog, an instance of the
     * provided view will be created and passed the comment as the view's model.
     *
     * Version Changed:
     *     8.0:
     *     This is now a modern ES6-style class and supports typing using
     *     TypeScript.
     */
    let ReviewDialogCommentHook = spina.spina(_class$6 = class ReviewDialogCommentHook extends _global_Djblets_ExtensionHook {
      static hookPoint = new _global_Djblets_ExtensionHookPoint();
      static defaults = {
        viewType: null
      };

      /**
       * Set up the hook.
       */
      setUpHook() {
        console.assert(this.get('viewType'), 'ReviewDialogCommentHook instance does not have a ' + '"viewType" attribute set.');
      }
    }) || _class$6;

    var _class$5;

    /**
     * Attributes for ReviewDialogHook.
     *
     * Version Added:
     *     8.0
     */

    /**
     * Adds additional rendering or UI to the top of the review dialog.
     *
     * This can be used to display additional UI and even additional fields in
     * the review dialog before all comments, below the Ship It checkbox.
     *
     * A Backbone View type (not an instance) must be provided for the viewType
     * attribute. When rendering comments in the dialog, an instance of the
     * provided view will be created and passed the comment as the view's model.
     *
     * Version Changed:
     *     8.0:
     *     This is now a modern ES6-style class and supports typing using
     *     TypeScript.
     */
    let ReviewDialogHook = spina.spina(_class$5 = class ReviewDialogHook extends _global_Djblets_ExtensionHook {
      static hookPoint = new _global_Djblets_ExtensionHookPoint();
      static defaults = {
        viewType: null
      };

      /**
       * Set up the hook.
       */
      setUpHook() {
        console.assert(this.get('viewType'), 'ReviewDialogHook instance does not have a ' + '"viewType" attribute set.');
      }
    }) || _class$5;

    var _class$4;

    /**
     * Attributes for ReviewRequestActionHook.
     *
     * Version Added:
     *     8.0
     */

    /**
     * A hook for providing callbacks for review request actions.
     *
     * Version Changed:
     *     8.0:
     *     This is now a modern ES6-style class and supports typing using
     *     TypeScript.
     *
     * Examples:
     *     .. code-block:: typescript
     *        :caption: TypeScript
     *
     *         import { spina } from '@beanbag/spina';
     *         import {
     *             Extension,
     *             ReviewRequestActionHook,
     *         } from '@beanbag/reviewboard/extensions';
     *
     *
     *         @spina
     *         export class RBSampleExtension extends Extension {
     *             initialize() {
     *                 super.initialize();
     *
     *                 const _onMyNewActionClicked = () => {
     *                 };
     *
     *                 new ReviewRequestActionHook({
     *                     extension: this,
     *                     callbacks: {
     *                         '#my-new-action': () => {
     *                             if (confirm(gettext('Are you sure?'))) {
     *                                 console.log('Confirmed!');
     *                             }
     *                             else {
     *                                 console.log('Not confirmed...');
     *                             }
     *                         },
     *                     },
     *                 });
     *             }
     *         }
     *
     *     .. code-block:: javascript
     *        :caption: JavaScript
     *
     *         RBSample = {};
     *
     *         RBSample.Extension = RB.Extension.extend({
     *             initialize: function() {
     *                 let _onMyNewActionClicked;
     *
     *                 RB.Extension.prototype.initialize.call(this);
     *
     *                 _onMyNewActionClicked = () => {
     *                     if (confirm(gettext('Are you sure?'))) {
     *                         console.log('Confirmed!');
     *                     } else {
     *                         console.log('Not confirmed...');
     *                     }
     *                 };
     *
     *                 new RB.ReviewRequestActionHook({
     *                     extension: this,
     *                     callbacks: {
     *                        '#my-new-action': _onMyNewActionClicked,
     *                     },
     *                 });
     *             },
     *         });
     */
    let ReviewRequestActionHook = spina.spina(_class$4 = class ReviewRequestActionHook extends _global_Djblets_ExtensionHook {
      static hookPoint = new _global_Djblets_ExtensionHookPoint();
      static defaults = {
        callbacks: null
      };

      /**
       * Set up the extension hook.
       */
      setUpHook() {
        console.assert(this.get('callbacks'), 'ReviewRequestActionHook instance does not have a ' + '"callbacks" attribute set.');
      }
    }) || _class$4;

    var _class$3;

    /**
     * Options for BaseCommentDialogHookView.
     *
     * Version Added:
     *     8.0
     */

    /**
     * A base view for rendering into a comment dialog.
     *
     * This is intended to be subclassed and passed in a view type to
     * :js:class:`RB.CommentDialogViewHook`. It takes in the comment dialog,
     * editor, and parent extension, and can then render into the dialog or
     * hook into behavior.
     *
     * Version Added:
     *     8.0
     */
    let BaseCommentDialogHookView = spina.spina(_class$3 = class BaseCommentDialogHookView extends spina.BaseView {
      /**********************
       * Instance variables *
       **********************/

      /** The comment dialog being rendered into. */

      /** The comment editor managing comments in the dialog. */

      /** The extension that owns the hook. */

      /**
       * Pre-initialize the view.
       *
       * This will set the instance attributes based on the options provided
       * before the subclass's initialization code runs.
       *
       * Args:
       *     options (CommentDialogHookViewOptions):
       *         The options for the view.
       */
      preinitialize(options) {
        this.commentDialog = options.commentDialog;
        this.commentEditor = options.commentEditor;
        this.extension = options.extension;
      }
    }) || _class$3;

    /**
     * A type representing a BaseCommentDialogHookView class.
     *
     * This types the constructor of the class such that it will properly return
     * an instance that is typed with the right constructor arguments and default
     * generics.
     *
     * Version Added:
     *     8.0
     */

    var _class$2;

    /**
     * Options for BaseFileAttachmentThumbnailContainerHookView.
     *
     * Version Added:
     *     8.0
     */

    /**
     * A base view for rendering into the file attachment thumbnail container.
     *
     * This is intended to be subclassed and passed in a view type to
     * :js:class:`RB.FileAttachmentThumbnailView`. It takes in the parent
     * extension and can then render into the container or hook into behavior.
     *
     * Version Added:
     *     8.0
     */
    let BaseFileAttachmentThumbnailContainerHookView = spina.spina(_class$2 = class BaseFileAttachmentThumbnailContainerHookView extends spina.BaseView {
      /**********************
       * Instance variables *
       **********************/

      /** The extension that owns the hook. */

      /** The file attachment being rendered. */

      /** The thumbnail view managing the thumbnail. */

      /**
       * Pre-initialize the view.
       *
       * This will set the instance attributes based on the options provided
       * before the subclass's initialization code runs.
       *
       * Args:
       *     options (FileAttachmentThumbnailContainerHookViewOptions):
       *         The options for the view.
       */
      preinitialize(options) {
        this.extension = options.extension;
        this.fileAttachment = options.fileAttachment;
        this.thumbnailView = options.thumbnailView;
      }
    }) || _class$2;

    /**
     * A type representing a BaseFileAttachmentThumbnailContainerHookView class.
     *
     * This types the constructor of the class such that it will properly return
     * an instance that is typed with the right constructor arguments and default
     * generics.
     *
     * Version Added:
     *     8.0
     */

    var _class$1;

    /**
     * Options for BaseReviewDialogCommentHookView.
     *
     * Version Added:
     *     8.0
     */

    /**
     * A base view for rendering into comment sections in the Review Dialog.
     *
     * This is intended to be subclassed and passed in a view type to
     * :js:class:`RB.ReviewDialogCommentViewHook`. It takes in the parent
     * extension and can then render into the dialog or hook into behavior.
     *
     * Version Added:
     *     8.0
     */
    let BaseReviewDialogCommentHookView = spina.spina(_class$1 = class BaseReviewDialogCommentHookView extends spina.BaseView {
      /**********************
       * Instance variables *
       **********************/

      /** The extension that owns the hook. */

      /**
       * Pre-initialize the view.
       *
       * This will set the instance attributes based on the options provided
       * before the subclass's initialization code runs.
       *
       * Args:
       *     options (ReviewDialogCommentHookViewOptions):
       *         The options for the view.
       */
      preinitialize(options) {
        this.extension = options.extension;
      }
    }) || _class$1;

    /**
     * A type representing a BaseReviewDialogCommentHookView class.
     *
     * This types the constructor of the class such that it will properly return
     * an instance that is typed with the right constructor arguments and default
     * generics.
     *
     * Version Added:
     *     8.0
     */

    var _class;

    /**
     * Options for BaseReviewDialogHookView.
     *
     * Version Added:
     *     8.0
     */

    /**
     * A base view for rendering into the Review Dialog.
     *
     * This is intended to be subclassed and passed in a view type to
     * :js:class:`RB.ReviewDialogViewHook`. It takes in the parent extension
     * and can then render into the dialog or hook into behavior.
     *
     * Version Added:
     *     8.0
     */
    let BaseReviewDialogHookView = spina.spina(_class = class BaseReviewDialogHookView extends spina.BaseView {
      /**********************
       * Instance variables *
       **********************/

      /** The extension that owns the hook. */

      /**
       * Pre-initialize the view.
       *
       * This will set the instance attributes based on the options provided
       * before the subclass's initialization code runs.
       *
       * Args:
       *     options (ReviewDialogHookViewOptions):
       *         The options for the view.
       */
      preinitialize(options) {
        this.extension = options.extension;
      }
    }) || _class;

    /**
     * A type representing a BaseReviewDialogHookView class.
     *
     * This types the constructor of the class such that it will properly return
     * an instance that is typed with the right constructor arguments and default
     * generics.
     *
     * Version Added:
     *     8.0
     */

    exports.BaseCommentDialogHookView = BaseCommentDialogHookView;
    exports.BaseFileAttachmentThumbnailContainerHookView = BaseFileAttachmentThumbnailContainerHookView;
    exports.BaseReviewDialogCommentHookView = BaseReviewDialogCommentHookView;
    exports.BaseReviewDialogHookView = BaseReviewDialogHookView;
    exports.CommentDialogHook = CommentDialogHook;
    exports.Extension = _global_Djblets_Extension;
    exports.ExtensionHook = _global_Djblets_ExtensionHook;
    exports.ExtensionHookPoint = _global_Djblets_ExtensionHookPoint;
    exports.FileAttachmentThumbnailContainerHook = FileAttachmentThumbnailContainerHook;
    exports.ReviewDialogCommentHook = ReviewDialogCommentHook;
    exports.ReviewDialogHook = ReviewDialogHook;
    exports.ReviewRequestActionHook = ReviewRequestActionHook;

    Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

}));
//# sourceMappingURL=index.js.map
