{"version":3,"file":"discourse-templates.js","names":["define","_exports","_component","_component2","_tracking","_object","_runloop","_service","_ajax","_ajaxError","_decorators","_tagDrop","_templateFactory","Object","defineProperty","value","default","__COLOCATED_TEMPLATE__","createTemplateFactory","id","block","moduleName","isStrictMode","DTemplatesFilterableList","static","dt7948","g","this","prototype","inject","siteSettings","i","tracked","loading","listFilter","replies","ALL_TAGS_ID","selectedTag","availableTags","filteredReplies","filterTitle","toLowerCase","map","template","score","title","includes","content","filter","NO_TAG_ID","tags","length","sort","a","b","n","computed","load","results","ajax","templates","tagging_enabled","values","reduce","forEach","tag","count","name","e","popupAjaxError","schedule","document","querySelector","focus","bind","changeSelectedTag","tagId","action","insertTemplate","args","onBeforeInsertTemplate","onInsertTemplate","onAfterInsertTemplate","setComponentTemplate","_templateOnly","DTemplatesItem","apply","type","catch","Form","service","appEvents","constructor","super","arguments","closeModal","on","willDestroy","off","DTemplatesTagDrop","topTags","search","defaultItem","tagFilter","onChange","onChangeSelectedTag","_form","DTemplatesModalContainer","dTemplatesModal","scope","_getOwner","SELECTOR_EDITOR_PREVIEW","p","setupComponent","component","setProperties","templatesVisible","model","getOwnerWithFallback","lookup","teardownComponent","shouldRender","site","mobileView","show","_ref","elemEditorPreview","style","display","set","hide","_debounce","DiscourseTemplatesButton","outletArgs","helper","is_template","currentUser","can_create_topic","composer","copyConfirm","fetchRaw","topic","dataType","createNewTopic","text","openNewTopic","body","copy","navigator","clipboard","writeText","resetCopyButton","_keyboardShortcuts","_pluginApi","_variablesChatChannel","_variablesChatThread","initialize","container","discourse_templates_enabled","can_use_templates","withPluginApi","api","dTemplates","addComposerToolbarPopupMenuOption","icon","label","showComposerUI","addOptionsMenuItem","addKeyboardShortcut","PLATFORM_KEY_MODIFIER","event","preventDefault","isComposerFocused","target","_templateShortcutTargets","isTextAreaFocused","isFocused","activeElement","showTextAreaUI","variables","global","help","category","definition","keys1","keysDelimiter","userCanChat","channelVariablesExtractor","chat","activeChannel","currentMessage","draft","router","threadVariablesExtractor","activeThread","registerChatComposerButton","position","contextVariablesExtractor","context","textarea","displayed","push","element","addChatIntegration","DTemplatesModalService","_application","_replaceVariables","_textareaManipulator","_variablesComposer","DTemplatesService","modal","insertTemplateIntoComposer","showModal","showComposerPreviewUI","variablesExtractor","undefined","isTextArea","insertTemplateIntoTextArea","extractVariables","contains","classList","modalModel","activeModal","opts","composerModel","getOwner","composerElement","nodeName","highjackModal","trigger","replaceTemplateVariables","addBlock","templateVariables","replaceVariables","my_username","username","my_name","displayName","_user","TEMPLATES_ALLOWED_VARIABLES","modelVariables","current","key","replace","RegExp","freeze","_textareaTextManipulation","TextareaManipulator","extend","owner","setOwner","_textarea","ready","init","_addBlock","getSelected","channel","message","inReplyTo","channelVariables","chat_channel_name","chat_channel_url","routeModels","urlFor","reply_to_username","user","reply_to_name","context_title","context_url","thread","originalMessage","threadVariables","chat_thread_name","chat_thread_url","composerVariables","topic_title","topic_url","url","original_poster_username","details","created_by","original_poster_name","post","last_poster_username","reply_to_or_last_poster_username"],"sources":["discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list.js","discourse/plugins/discourse-templates/discourse/components/d-templates/item-content.js","discourse/plugins/discourse-templates/discourse/components/d-templates/item.js","discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form.js","discourse/plugins/discourse-templates/discourse/components/d-templates/tag-drop.js","discourse/plugins/discourse-templates/discourse/connectors/below-footer/d-templates-modal-container.js","discourse/plugins/discourse-templates/discourse/connectors/editor-preview/d-templates.js","discourse/plugins/discourse-templates/discourse/connectors/topic-above-posts/discourse-templates-button.js","discourse/plugins/discourse-templates/discourse/initializers/d-templates.js","discourse/plugins/discourse-templates/discourse/services/d-templates-modal.js","discourse/plugins/discourse-templates/discourse/services/d-templates.js","discourse/plugins/discourse-templates/discourse/templates/connectors/editor-preview/d-templates.js","discourse/plugins/discourse-templates/discourse/templates/connectors/topic-above-posts/discourse-templates-button.js","discourse/plugins/discourse-templates/lib/replace-variables.js","discourse/plugins/discourse-templates/lib/textarea-manipulator.js","discourse/plugins/discourse-templates/lib/variables-chat-channel.js","discourse/plugins/discourse-templates/lib/variables-chat-thread.js","discourse/plugins/discourse-templates/lib/variables-composer.js"],"sourcesContent":["define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list\", [\"exports\", \"@ember/component\", \"@glimmer/component\", \"@glimmer/tracking\", \"@ember/object\", \"@ember/runloop\", \"@ember/service\", \"discourse/lib/ajax\", \"discourse/lib/ajax-error\", \"discourse-common/utils/decorators\", \"select-kit/components/tag-drop\", \"@ember/template-factory\"], function (_exports, _component, _component2, _tracking, _object, _runloop, _service, _ajax, _ajaxError, _decorators, _tagDrop, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const __COLOCATED_TEMPLATE__ = (0, _templateFactory.createTemplateFactory)(\n  /*\n    <div class=\"templates-filterable-list\" {{did-insert this.load}}>\n  \n    <ConditionalLoadingSpinner @condition={{this.loading}}>\n      <div class=\"templates-filter-bar\">\n        {{#if this.siteSettings.tagging_enabled}}\n          <DTemplates::TagDrop\n            @availableTags={{this.availableTags}}\n            @tagId={{this.selectedTag}}\n            @onChangeSelectedTag={{this.changeSelectedTag}}\n          />\n        {{/if}}\n        <TextField\n          class=\"templates-filter\"\n          @value={{this.listFilter}}\n          placeholder={{i18n \"templates.filter_hint\"}}\n        />\n      </div>\n      <div class=\"templates-list\">\n        {{#each this.filteredReplies as |r|}}\n          <DTemplates::Item\n            @template={{r}}\n            @model={{@model}}\n            @onInsertTemplate={{this.insertTemplate}}\n          />\n        {{/each}}\n      </div>\n    </ConditionalLoadingSpinner>\n  </div>\n  */\n  {\n    \"id\": \"MxdRx2Ru\",\n    \"block\": \"[[[11,0],[24,0,\\\"templates-filterable-list\\\"],[4,[38,0],[[30,0,[\\\"load\\\"]]],null],[12],[1,\\\"\\\\n\\\\n  \\\"],[8,[39,1],null,[[\\\"@condition\\\"],[[30,0,[\\\"loading\\\"]]]],[[\\\"default\\\"],[[[[1,\\\"\\\\n    \\\"],[10,0],[14,0,\\\"templates-filter-bar\\\"],[12],[1,\\\"\\\\n\\\"],[41,[30,0,[\\\"siteSettings\\\",\\\"tagging_enabled\\\"]],[[[1,\\\"        \\\"],[8,[39,3],null,[[\\\"@availableTags\\\",\\\"@tagId\\\",\\\"@onChangeSelectedTag\\\"],[[30,0,[\\\"availableTags\\\"]],[30,0,[\\\"selectedTag\\\"]],[30,0,[\\\"changeSelectedTag\\\"]]]],null],[1,\\\"\\\\n\\\"]],[]],null],[1,\\\"      \\\"],[8,[39,4],[[24,0,\\\"templates-filter\\\"],[16,\\\"placeholder\\\",[28,[37,5],[\\\"templates.filter_hint\\\"],null]]],[[\\\"@value\\\"],[[30,0,[\\\"listFilter\\\"]]]],null],[1,\\\"\\\\n    \\\"],[13],[1,\\\"\\\\n    \\\"],[10,0],[14,0,\\\"templates-list\\\"],[12],[1,\\\"\\\\n\\\"],[42,[28,[37,7],[[28,[37,7],[[30,0,[\\\"filteredReplies\\\"]]],null]],null],null,[[[1,\\\"        \\\"],[8,[39,8],null,[[\\\"@template\\\",\\\"@model\\\",\\\"@onInsertTemplate\\\"],[[30,1],[30,2],[30,0,[\\\"insertTemplate\\\"]]]],null],[1,\\\"\\\\n\\\"]],[1]],null],[1,\\\"    \\\"],[13],[1,\\\"\\\\n  \\\"]],[]]]]],[1,\\\"\\\\n\\\"],[13]],[\\\"r\\\",\\\"@model\\\"],false,[\\\"did-insert\\\",\\\"conditional-loading-spinner\\\",\\\"if\\\",\\\"d-templates/tag-drop\\\",\\\"text-field\\\",\\\"i18n\\\",\\\"each\\\",\\\"-track-array\\\",\\\"d-templates/item\\\"]]\",\n    \"moduleName\": \"discourse/plugins/discourse-templates/discourse/components/d-templates/filterable-list.hbs\",\n    \"isStrictMode\": false\n  });\n  class DTemplatesFilterableList extends _component2.default {\n    static #_ = (() => dt7948.g(this.prototype, \"siteSettings\", [_service.inject]))();\n    #siteSettings = (() => (dt7948.i(this, \"siteSettings\"), void 0))();\n    static #_2 = (() => dt7948.g(this.prototype, \"loading\", [_tracking.tracked], function () {\n      return true;\n    }))();\n    #loading = (() => (dt7948.i(this, \"loading\"), void 0))();\n    static #_3 = (() => dt7948.g(this.prototype, \"listFilter\", [_tracking.tracked], function () {\n      return \"\";\n    }))();\n    #listFilter = (() => (dt7948.i(this, \"listFilter\"), void 0))();\n    static #_4 = (() => dt7948.g(this.prototype, \"replies\", [_tracking.tracked], function () {\n      return [];\n    }))();\n    #replies = (() => (dt7948.i(this, \"replies\"), void 0))();\n    static #_5 = (() => dt7948.g(this.prototype, \"selectedTag\", [_tracking.tracked], function () {\n      return _tagDrop.ALL_TAGS_ID;\n    }))();\n    #selectedTag = (() => (dt7948.i(this, \"selectedTag\"), void 0))();\n    static #_6 = (() => dt7948.g(this.prototype, \"availableTags\", [_tracking.tracked], function () {\n      return [];\n    }))();\n    #availableTags = (() => (dt7948.i(this, \"availableTags\"), void 0))();\n    get filteredReplies() {\n      const filterTitle = this.listFilter.toLowerCase();\n      return this.replies.map(template => {\n        /* Give a relevant score to each template. */\n        template.score = 0;\n        if (template.title.toLowerCase().includes(filterTitle)) {\n          template.score += 2;\n        } else if (template.content.toLowerCase().includes(filterTitle)) {\n          template.score += 1;\n        }\n        return template;\n      })\n      // Filter irrelevant replies.\n      .filter(template => template.score !== 0)\n      // Filter only replies tagged with the selected tag.\n      .filter(template => {\n        if (this.selectedTag === _tagDrop.ALL_TAGS_ID) {\n          return true;\n        }\n        if (this.selectedTag === _tagDrop.NO_TAG_ID && template.tags.length === 0) {\n          return true;\n        }\n        return template.tags.includes(this.selectedTag);\n      }).sort((a, b) => {\n        /* Sort replies by relevance and title. */\n        if (a.score !== b.score) {\n          return a.score > b.score ? -1 : 1; /* descending */\n        } else if (a.title !== b.title) {\n          return a.title < b.title ? -1 : 1; /* ascending */\n        }\n        return 0;\n      });\n    }\n    static #_7 = (() => dt7948.n(this.prototype, \"filteredReplies\", [(0, _object.computed)(\"replies\", \"selectedTag\", \"listFilter\")]))();\n    async load() {\n      try {\n        this.loading = true;\n        const results = await (0, _ajax.ajax)(\"/discourse_templates\");\n        this.replies = results.templates;\n        if (this.siteSettings.tagging_enabled) {\n          this.availableTags = Object.values(this.replies.reduce((availableTags, template) => {\n            template.tags.forEach(tag => {\n              if (availableTags[tag]) {\n                availableTags[tag].count += 1;\n              } else {\n                availableTags[tag] = {\n                  id: tag,\n                  name: tag,\n                  count: 1\n                };\n              }\n            });\n            return availableTags;\n          }, {}));\n        }\n      } catch (e) {\n        this.loading = false;\n        (0, _ajaxError.popupAjaxError)(e);\n      } finally {\n        this.loading = false;\n        (0, _runloop.schedule)(\"afterRender\", () => document.querySelector(\".templates-filter\")?.focus());\n      }\n    }\n    static #_8 = (() => dt7948.n(this.prototype, \"load\", [_decorators.bind]))();\n    changeSelectedTag(tagId) {\n      this.selectedTag = tagId;\n    }\n    static #_9 = (() => dt7948.n(this.prototype, \"changeSelectedTag\", [_object.action]))();\n    insertTemplate(template) {\n      this.args.onBeforeInsertTemplate?.();\n      this.args.onInsertTemplate?.(template);\n      this.args.onAfterInsertTemplate?.();\n    }\n    static #_10 = (() => dt7948.n(this.prototype, \"insertTemplate\", [_object.action]))();\n  }\n  _exports.default = DTemplatesFilterableList;\n  (0, _component.setComponentTemplate)(__COLOCATED_TEMPLATE__, DTemplatesFilterableList);\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/item-content\", [\"exports\", \"@ember/component\", \"@ember/component/template-only\", \"@ember/template-factory\"], function (_exports, _component, _templateOnly, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const __COLOCATED_TEMPLATE__ = (0, _templateFactory.createTemplateFactory)(\n  /*\n    <div class=\"templates-content\">\n    <LinkTo\n      class=\"template-item-source-link\"\n      @route=\"topic\"\n      @models={{array @template.slug @template.id}}\n    >\n      {{d-icon \"crosshairs\"}}\n      {{i18n \"templates.source\"}}\n    </LinkTo>\n    <CookText @rawText={{@template.content}} />\n  </div>\n  */\n  {\n    \"id\": \"r2J+FHK0\",\n    \"block\": \"[[[10,0],[14,0,\\\"templates-content\\\"],[12],[1,\\\"\\\\n  \\\"],[8,[39,0],[[24,0,\\\"template-item-source-link\\\"]],[[\\\"@route\\\",\\\"@models\\\"],[\\\"topic\\\",[28,[37,1],[[30,1,[\\\"slug\\\"]],[30,1,[\\\"id\\\"]]],null]]],[[\\\"default\\\"],[[[[1,\\\"\\\\n    \\\"],[1,[28,[35,2],[\\\"crosshairs\\\"],null]],[1,\\\"\\\\n    \\\"],[1,[28,[35,3],[\\\"templates.source\\\"],null]],[1,\\\"\\\\n  \\\"]],[]]]]],[1,\\\"\\\\n  \\\"],[8,[39,4],null,[[\\\"@rawText\\\"],[[30,1,[\\\"content\\\"]]]],null],[1,\\\"\\\\n\\\"],[13]],[\\\"@template\\\"],false,[\\\"link-to\\\",\\\"array\\\",\\\"d-icon\\\",\\\"i18n\\\",\\\"cook-text\\\"]]\",\n    \"moduleName\": \"discourse/plugins/discourse-templates/discourse/components/d-templates/item-content.hbs\",\n    \"isStrictMode\": false\n  });\n  var _default = _exports.default = (0, _component.setComponentTemplate)(__COLOCATED_TEMPLATE__, (0, _templateOnly.default)());\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/item\", [\"exports\", \"@ember/component\", \"@glimmer/component\", \"@ember/object\", \"discourse/lib/ajax\", \"discourse/lib/ajax-error\", \"@ember/template-factory\"], function (_exports, _component, _component2, _object, _ajax, _ajaxError, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const __COLOCATED_TEMPLATE__ = (0, _templateFactory.createTemplateFactory)(\n  /*\n    <details class=\"template-item\" id=\"template-item-{{@template.id}}\">\n    <summary class=\"template-item-title\">\n      <div class=\"template-item-title-text\">{{@template.title}}</div>\n  \n      <div class=\"actions\">\n        <DButton\n          class=\"templates-apply\"\n          @action={{action \"apply\"}}\n          @icon=\"far-clipboard\"\n        />\n      </div>\n    </summary>\n  \n    <DTemplates::ItemContent @template={{@template}} />\n  </details>\n  */\n  {\n    \"id\": \"6/xlvlVX\",\n    \"block\": \"[[[10,\\\"details\\\"],[14,0,\\\"template-item\\\"],[15,1,[29,[\\\"template-item-\\\",[30,1,[\\\"id\\\"]]]]],[12],[1,\\\"\\\\n  \\\"],[10,\\\"summary\\\"],[14,0,\\\"template-item-title\\\"],[12],[1,\\\"\\\\n    \\\"],[10,0],[14,0,\\\"template-item-title-text\\\"],[12],[1,[30,1,[\\\"title\\\"]]],[13],[1,\\\"\\\\n\\\\n    \\\"],[10,0],[14,0,\\\"actions\\\"],[12],[1,\\\"\\\\n      \\\"],[8,[39,0],[[24,0,\\\"templates-apply\\\"]],[[\\\"@action\\\",\\\"@icon\\\"],[[28,[37,1],[[30,0],\\\"apply\\\"],null],\\\"far-clipboard\\\"]],null],[1,\\\"\\\\n    \\\"],[13],[1,\\\"\\\\n  \\\"],[13],[1,\\\"\\\\n\\\\n  \\\"],[8,[39,2],null,[[\\\"@template\\\"],[[30,1]]],null],[1,\\\"\\\\n\\\"],[13]],[\\\"@template\\\"],false,[\\\"d-button\\\",\\\"action\\\",\\\"d-templates/item-content\\\"]]\",\n    \"moduleName\": \"discourse/plugins/discourse-templates/discourse/components/d-templates/item.hbs\",\n    \"isStrictMode\": false\n  });\n  class DTemplatesItem extends _component2.default {\n    apply() {\n      // run parametrized action to insert the template\n      this.args.onInsertTemplate?.(this.args.template);\n      (0, _ajax.ajax)(`/discourse_templates/${this.args.template.id}/use`, {\n        type: \"POST\"\n      }).catch(_ajaxError.popupAjaxError);\n    }\n    static #_ = (() => dt7948.n(this.prototype, \"apply\", [_object.action]))();\n  }\n  _exports.default = DTemplatesItem;\n  (0, _component.setComponentTemplate)(__COLOCATED_TEMPLATE__, DTemplatesItem);\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form\", [\"exports\", \"@ember/component\", \"@glimmer/component\", \"@ember/service\", \"@ember/template-factory\"], function (_exports, _component, _component2, _service, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const __COLOCATED_TEMPLATE__ = (0, _templateFactory.createTemplateFactory)(\n  /*\n    <DModal\n    @closeModal={{@closeModal}}\n    @title={{i18n \"templates.insert_template\"}}\n    class=\"d-templates d-templates-modal\"\n  >\n    <:body>\n      <DTemplates::FilterableList\n        @textarea={{@model.textarea}}\n        @onInsertTemplate={{@model.onInsertTemplate}}\n        @onAfterInsertTemplate={{@closeModal}}\n      />\n    </:body>\n  </DModal>\n  */\n  {\n    \"id\": \"StqqkQ0S\",\n    \"block\": \"[[[8,[39,0],[[24,0,\\\"d-templates d-templates-modal\\\"]],[[\\\"@closeModal\\\",\\\"@title\\\"],[[30,1],[28,[37,1],[\\\"templates.insert_template\\\"],null]]],[[\\\"body\\\"],[[[[1,\\\"\\\\n    \\\"],[8,[39,2],null,[[\\\"@textarea\\\",\\\"@onInsertTemplate\\\",\\\"@onAfterInsertTemplate\\\"],[[30,2,[\\\"textarea\\\"]],[30,2,[\\\"onInsertTemplate\\\"]],[30,1]]],null],[1,\\\"\\\\n  \\\"]],[]]]]]],[\\\"@closeModal\\\",\\\"@model\\\"],false,[\\\"d-modal\\\",\\\"i18n\\\",\\\"d-templates/filterable-list\\\"]]\",\n    \"moduleName\": \"discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form.hbs\",\n    \"isStrictMode\": false\n  });\n  class Form extends _component2.default {\n    static #_ = (() => dt7948.g(this.prototype, \"appEvents\", [_service.service]))();\n    #appEvents = (() => (dt7948.i(this, \"appEvents\"), void 0))();\n    constructor() {\n      super(...arguments);\n      if (this.args.closeModal) {\n        this.appEvents.on(\"page:changed\", this, this.args.closeModal);\n      }\n    }\n    willDestroy() {\n      super.willDestroy(...arguments);\n      if (this.args.closeModal) {\n        this.appEvents.off(\"page:changed\", this, this.args.closeModal);\n      }\n    }\n  }\n  _exports.default = Form;\n  (0, _component.setComponentTemplate)(__COLOCATED_TEMPLATE__, Form);\n});","define(\"discourse/plugins/discourse-templates/discourse/components/d-templates/tag-drop\", [\"exports\", \"@ember/object\", \"select-kit/components/tag-drop\"], function (_exports, _object, _tagDrop) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesTagDrop extends _tagDrop.default {\n    get topTags() {\n      // sort tags descending by count and ascending by name\n      return (this.availableTags || []).sort((a, b) => {\n        if (a.count !== b.count) {\n          return b.count - a.count;\n        } // descending\n        if (a.name !== b.name) {\n          return a.name < b.name ? -1 : 1;\n        } // ascending\n        return 0;\n      });\n    }\n    static #_ = (() => dt7948.n(this.prototype, \"topTags\", [(0, _object.computed)(\"availableTags.[]\")]))();\n    search(filter) {\n      return (this.content || []).map(tag => {\n        if (tag.id && tag.name) {\n          return tag;\n        }\n        return this.defaultItem(tag, tag);\n      }).filter(tag => {\n        if (filter == null) {\n          return true;\n        }\n        const tagFilter = filter.toLowerCase();\n        return tag.id.toLowerCase().includes(tagFilter) || tag.name.toLowerCase().includes(tagFilter);\n      });\n    }\n    onChange(tagId, tag) {\n      // overrides the action onChange of the parent with the value received in\n      // the property onChangeSelectedTag in the handlebars template\n      this.onChangeSelectedTag?.(tagId, tag);\n    }\n    static #_2 = (() => dt7948.n(this.prototype, \"onChange\", [_object.action]))();\n  }\n  _exports.default = DTemplatesTagDrop;\n});","define(\"discourse/plugins/discourse-templates/discourse/connectors/below-footer/d-templates-modal-container\", [\"exports\", \"@glimmer/component\", \"@ember/service\", \"discourse/plugins/discourse-templates/discourse/components/d-templates/modal/form\", \"@ember/component\", \"@ember/template-factory\"], function (_exports, _component, _service, _form, _component2, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesModalContainer extends _component.default {\n    static #_ = (() => dt7948.g(this.prototype, \"dTemplatesModal\", [_service.inject]))();\n    #dTemplatesModal = (() => (dt7948.i(this, \"dTemplatesModal\"), void 0))();\n    static #_2 = (() => (0, _component2.setComponentTemplate)((0, _templateFactory.createTemplateFactory)(\n    /*\n      \n        {{#if this.dTemplatesModal.model}}\n          <div class=\"modal-container d-templates-modal-container\">\n            <DTemplatesModalForm\n              @closeModal={{this.dTemplatesModal.hide}}\n              @model={{this.dTemplatesModal.model}}\n            />\n          </div>\n        {{/if}}\n      \n    */\n    {\n      \"id\": \"zWRPcu1e\",\n      \"block\": \"[[[1,\\\"\\\\n\\\"],[41,[30,0,[\\\"dTemplatesModal\\\",\\\"model\\\"]],[[[1,\\\"      \\\"],[10,0],[14,0,\\\"modal-container d-templates-modal-container\\\"],[12],[1,\\\"\\\\n        \\\"],[8,[32,0],null,[[\\\"@closeModal\\\",\\\"@model\\\"],[[30,0,[\\\"dTemplatesModal\\\",\\\"hide\\\"]],[30,0,[\\\"dTemplatesModal\\\",\\\"model\\\"]]]],null],[1,\\\"\\\\n      \\\"],[13],[1,\\\"\\\\n\\\"]],[]],null],[1,\\\"  \\\"]],[],false,[\\\"if\\\"]]\",\n      \"moduleName\": \"/srv/discourse/app/app/assets/javascripts/discourse/discourse/plugins/discourse-templates/discourse/connectors/below-footer/d-templates-modal-container.js\",\n      \"scope\": () => [_form.default],\n      \"isStrictMode\": true\n    }), this))();\n  }\n  _exports.default = DTemplatesModalContainer;\n});","define(\"discourse/plugins/discourse-templates/discourse/connectors/editor-preview/d-templates\", [\"exports\", \"@ember/object\", \"discourse-common/lib/get-owner\"], function (_exports, _object, _getOwner) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  const SELECTOR_EDITOR_PREVIEW = \"#reply-control .d-editor-preview-wrapper > .d-editor-preview\";\n  var _default = _exports.default = dt7948.p({\n    setupComponent(args, component) {\n      component.setProperties({\n        templatesVisible: false,\n        model: (0, _getOwner.getOwnerWithFallback)(this).lookup(\"controller:composer\").model\n      });\n      this.appEvents.on(\"discourse-templates:show\", this, \"show\");\n      this.appEvents.on(\"discourse-templates:hide\", this, \"hide\");\n    },\n    teardownComponent() {\n      this.appEvents.off(\"discourse-templates:show\", this, \"show\");\n      this.appEvents.off(\"discourse-templates:hide\", this, \"hide\");\n    },\n    shouldRender(args, component) {\n      return !component.site.mobileView;\n    },\n    show(_ref) {\n      let {\n        onInsertTemplate\n      } = _ref;\n      const elemEditorPreview = document.querySelector(SELECTOR_EDITOR_PREVIEW);\n      if (elemEditorPreview) {\n        elemEditorPreview.style.display = \"none\";\n      }\n      this.set(\"onInsertTemplate\", onInsertTemplate);\n      this.set(\"templatesVisible\", true);\n    },\n    hide() {\n      const elemEditorPreview = document.querySelector(SELECTOR_EDITOR_PREVIEW);\n      if (elemEditorPreview) {\n        elemEditorPreview.style.display = \"\";\n      }\n      this.set(\"templatesVisible\", false);\n    }\n  }, [[\"method\", \"show\", [_object.action]], [\"method\", \"hide\", [_object.action]]]);\n});","define(\"discourse/plugins/discourse-templates/discourse/connectors/topic-above-posts/discourse-templates-button\", [\"exports\", \"@glimmer/component\", \"@glimmer/tracking\", \"@ember/object\", \"@ember/service\", \"discourse/lib/ajax\", \"discourse-common/lib/debounce\"], function (_exports, _component, _tracking, _object, _service, _ajax, _debounce) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DiscourseTemplatesButton extends _component.default {\n    static shouldRender(outletArgs, helper) {\n      return outletArgs.model.is_template && helper.currentUser?.can_create_topic;\n    }\n    static #_ = (() => dt7948.g(this.prototype, \"composer\", [_service.inject]))();\n    #composer = (() => (dt7948.i(this, \"composer\"), void 0))();\n    static #_2 = (() => dt7948.g(this.prototype, \"copyConfirm\", [_tracking.tracked], function () {\n      return false;\n    }))();\n    #copyConfirm = (() => (dt7948.i(this, \"copyConfirm\"), void 0))();\n    async fetchRaw() {\n      const topic = this.args.outletArgs.model;\n      return await (0, _ajax.ajax)(`/raw/${topic.id}/1`, {\n        dataType: \"text\"\n      });\n    }\n    async createNewTopic() {\n      const text = await this.fetchRaw();\n      this.composer.openNewTopic({\n        body: text\n      });\n    }\n    static #_3 = (() => dt7948.n(this.prototype, \"createNewTopic\", [_object.action]))();\n    async copy() {\n      const text = await this.fetchRaw();\n      navigator.clipboard.writeText(text);\n      this.copyConfirm = true;\n      (0, _debounce.default)(this.resetCopyButton, 2000);\n    }\n    static #_4 = (() => dt7948.n(this.prototype, \"copy\", [_object.action]))();\n    resetCopyButton() {\n      this.copyConfirm = false;\n    }\n    static #_5 = (() => dt7948.n(this.prototype, \"resetCopyButton\", [_object.action]))();\n  }\n  _exports.default = DiscourseTemplatesButton;\n});","define(\"discourse/plugins/discourse-templates/discourse/initializers/d-templates\", [\"exports\", \"discourse/lib/keyboard-shortcuts\", \"discourse/lib/plugin-api\", \"discourse-common/lib/get-owner\", \"discourse/plugins/discourse-templates/lib/variables-chat-channel\", \"discourse/plugins/discourse-templates/lib/variables-chat-thread\"], function (_exports, _keyboardShortcuts, _pluginApi, _getOwner, _variablesChatChannel, _variablesChatThread) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  var _default = _exports.default = {\n    name: \"discourse-templates-add-ui-builder\",\n    initialize(container) {\n      const siteSettings = container.lookup(\"service:site-settings\");\n      const currentUser = container.lookup(\"service:current-user\");\n      if (siteSettings.discourse_templates_enabled && currentUser?.can_use_templates) {\n        (0, _pluginApi.withPluginApi)(\"1.13.0\", api => {\n          addOptionsMenuItem(api);\n          addKeyboardShortcut(api, container);\n          addChatIntegration(api, container);\n        });\n      }\n    }\n  };\n  function addOptionsMenuItem(api) {\n    const dTemplates = api.container.lookup(\"service:d-templates\");\n    api.addComposerToolbarPopupMenuOption({\n      icon: \"far-clipboard\",\n      label: \"templates.insert_template\",\n      action: () => {\n        dTemplates.showComposerUI();\n      }\n    });\n  }\n  const _templateShortcutTargets = [];\n  function addKeyboardShortcut(api, container) {\n    api.addKeyboardShortcut(`${_keyboardShortcuts.PLATFORM_KEY_MODIFIER}+shift+i`, event => {\n      event.preventDefault();\n      const dTemplates = container.lookup(\"service:d-templates\");\n      if (dTemplates.isComposerFocused) {\n        dTemplates.showComposerUI();\n        return;\n      }\n      for (const target of _templateShortcutTargets) {\n        if (dTemplates.isTextAreaFocused && target?.isFocused?.(document.activeElement)) {\n          dTemplates.showTextAreaUI(target?.variables);\n          return;\n        }\n      }\n      if (dTemplates.isTextAreaFocused) {\n        dTemplates.showTextAreaUI();\n      }\n    }, {\n      global: true,\n      help: {\n        category: \"templates\",\n        name: \"templates.insert_template\",\n        definition: {\n          keys1: [_keyboardShortcuts.PLATFORM_KEY_MODIFIER, \"shift\", \"I\"],\n          keysDelimiter: \"plus\"\n        }\n      }\n    });\n  }\n  function addChatIntegration(api, container) {\n    if (!container.lookup(\"service:chat\")?.userCanChat) {\n      return;\n    }\n    const channelVariablesExtractor = function () {\n      const chat = (0, _getOwner.getOwnerWithFallback)(this).lookup(\"service:chat\");\n      const activeChannel = chat?.activeChannel;\n      const currentMessage = activeChannel?.draft;\n      const router = (0, _getOwner.getOwnerWithFallback)(this).lookup(\"service:router\");\n      return (0, _variablesChatChannel.default)(activeChannel, currentMessage, router);\n    };\n    const threadVariablesExtractor = function () {\n      const chat = (0, _getOwner.getOwnerWithFallback)(this).lookup(\"service:chat\");\n      const activeThread = chat?.activeChannel?.activeThread;\n      const currentMessage = activeThread?.draft;\n      const router = (0, _getOwner.getOwnerWithFallback)(this).lookup(\"service:router\");\n      return (0, _variablesChatThread.default)(activeThread, currentMessage, router);\n    };\n\n    // add a custom chat composer button\n    api.registerChatComposerButton({\n      id: \"d-templates-chat-insert-template-btn\",\n      icon: \"far-clipboard\",\n      label: \"templates.insert_template\",\n      position: \"dropdown\",\n      action: function () {\n        let contextVariablesExtractor;\n        switch (this.context) {\n          case \"channel\":\n            contextVariablesExtractor = channelVariablesExtractor.bind(this);\n            break;\n          case \"thread\":\n            contextVariablesExtractor = threadVariablesExtractor.bind(this);\n            break;\n          default:\n            contextVariablesExtractor = null;\n        }\n        const textarea = this.composer?.textarea?.textarea; // this.composer.textarea is a TextareaInteractor instance\n\n        (0, _getOwner.getOwnerWithFallback)(this).lookup(\"service:d-templates\").showTextAreaUI(contextVariablesExtractor, textarea);\n      },\n      displayed() {\n        return this.composer?.textarea && (this.context === \"channel\" || this.context === \"thread\");\n      }\n    });\n\n    // add custom keyboard shortcut handlers for the chat channel composer and chat thread composer\n    _templateShortcutTargets.push({\n      isFocused: element => element?.id === \"channel-composer\",\n      variables: channelVariablesExtractor\n    }, {\n      isFocused: element => element?.id === \"thread-composer\",\n      variables: threadVariablesExtractor\n    });\n  }\n});","define(\"discourse/plugins/discourse-templates/discourse/services/d-templates-modal\", [\"exports\", \"@glimmer/tracking\", \"@ember/object\", \"@ember/service\"], function (_exports, _tracking, _object, _service) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesModalService extends _service.default {\n    static #_ = (() => dt7948.g(this.prototype, \"model\", [_tracking.tracked], function () {\n      return null;\n    }))();\n    #model = (() => (dt7948.i(this, \"model\"), void 0))();\n    show(model) {\n      this.model = model;\n    }\n    static #_2 = (() => dt7948.n(this.prototype, \"show\", [_object.action]))();\n    hide() {\n      // return the focus back to the textarea\n      this.model?.textarea?.focus();\n\n      // clear the model\n      this.model = null;\n    }\n    static #_3 = (() => dt7948.n(this.prototype, \"hide\", [_object.action]))();\n  }\n  _exports.default = DTemplatesModalService;\n});","define(\"discourse/plugins/discourse-templates/discourse/services/d-templates\", [\"exports\", \"@ember/application\", \"@ember/service\", \"discourse/plugins/discourse-templates/lib/replace-variables\", \"discourse/plugins/discourse-templates/lib/textarea-manipulator\", \"discourse/plugins/discourse-templates/lib/variables-composer\"], function (_exports, _application, _service, _replaceVariables, _textareaManipulator, _variablesComposer) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class DTemplatesService extends _service.default {\n    static #_ = (() => dt7948.g(this.prototype, \"appEvents\", [_service.inject]))();\n    #appEvents = (() => (dt7948.i(this, \"appEvents\"), void 0))();\n    static #_2 = (() => dt7948.g(this.prototype, \"modal\", [_service.inject]))();\n    #modal = (() => (dt7948.i(this, \"modal\"), void 0))();\n    static #_3 = (() => dt7948.g(this.prototype, \"site\", [_service.inject]))();\n    #site = (() => (dt7948.i(this, \"site\"), void 0))();\n    static #_4 = (() => dt7948.g(this.prototype, \"currentUser\", [_service.inject]))();\n    #currentUser = (() => (dt7948.i(this, \"currentUser\"), void 0))();\n    static #_5 = (() => dt7948.g(this.prototype, \"dTemplatesModal\", [_service.inject]))();\n    #dTemplatesModal = (() => (dt7948.i(this, \"dTemplatesModal\"), void 0))();\n    showComposerUI() {\n      const onInsertTemplate = this.#insertTemplateIntoComposer.bind(this);\n      if (this.site.mobileView) {\n        this.#showModal(null, onInsertTemplate); // textarea must be empty when targeting the composer\n      } else {\n        this.#showComposerPreviewUI(onInsertTemplate);\n      }\n    }\n    showTextAreaUI() {\n      let variablesExtractor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n      let textarea = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.activeElement;\n      if (!this.#isTextArea(textarea)) {\n        return;\n      }\n      const modal = document.querySelector(\".d-modal\");\n      const onInsertTemplate = this.#insertTemplateIntoTextArea.bind(this);\n      const extractVariables = model => variablesExtractor?.(model);\n      if (modal?.contains(textarea)) {\n        if (!modal.classList.contains(\"d-templates\")) {\n          this.#showModal(textarea, template => {\n            const modalModel = this.modal.activeModal?.opts?.model;\n            onInsertTemplate(textarea, template, extractVariables(modalModel));\n          });\n        }\n      } else {\n        this.#showModal(textarea, template => onInsertTemplate(textarea, template, extractVariables()));\n      }\n    }\n    get isComposerFocused() {\n      const activeElement = document.activeElement;\n      const composerModel = (0, _application.getOwner)(this).lookup(\"controller:composer\").model;\n      const composerElement = document.querySelector(\".d-editor\");\n      return composerModel && composerElement?.contains(activeElement);\n    }\n    get isTextAreaFocused() {\n      return this.#isTextArea(document.activeElement);\n    }\n    #isTextArea(element) {\n      return element?.nodeName === \"TEXTAREA\";\n    }\n    #highjackModal(textarea, onInsertTemplate) {\n      this.appEvents.trigger(\"discourse-templates:hijack-modal\", {\n        textarea,\n        onInsertTemplate\n      });\n    }\n    #showModal(textarea, onInsertTemplate) {\n      this.dTemplatesModal.show({\n        textarea,\n        onInsertTemplate\n      });\n    }\n    #showComposerPreviewUI(onInsertTemplate) {\n      this.appEvents.trigger(\"composer-messages:close\");\n      this.appEvents.trigger(\"composer:show-preview\");\n      this.appEvents.trigger(\"discourse-templates:show\", {\n        onInsertTemplate\n      });\n    }\n    #insertTemplateIntoTextArea(textarea, template, variables) {\n      template = this.#replaceTemplateVariables(template.title, template.content, variables);\n      new _textareaManipulator.default((0, _application.getOwner)(this), textarea).addBlock(template.content);\n    }\n    #insertTemplateIntoComposer(template) {\n      const composerModel = (0, _application.getOwner)(this).lookup(\"controller:composer\").model;\n      const templateVariables = (0, _variablesComposer.default)(composerModel);\n      template = this.#replaceTemplateVariables(template.title, template.content, templateVariables);\n\n      // insert the title if blank\n      if (composerModel && !composerModel.title) {\n        composerModel.set(\"title\", template.title);\n      }\n\n      // insert the content of the template in the composer\n      this.appEvents.trigger(\"composer:insert-block\", template.content);\n    }\n    #replaceTemplateVariables(title, content) {\n      let variables = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n      return (0, _replaceVariables.replaceVariables)(title, content, {\n        ...variables,\n        my_username: this.currentUser?.username,\n        my_name: this.currentUser?.displayName\n      });\n    }\n  }\n  _exports.default = DTemplatesService;\n});","define(\"discourse/plugins/discourse-templates/discourse/templates/connectors/editor-preview/d-templates\", [\"exports\", \"@ember/template-factory\"], function (_exports, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  var _default = _exports.default = (0, _templateFactory.createTemplateFactory)(\n  /*\n    {{#if this.templatesVisible}}\n    <div class=\"d-templates-container\">\n      <DButton\n        class=\"modal-close close btn-flat\"\n        @action={{action \"hide\"}}\n        @icon=\"times\"\n      />\n      <DTemplates::FilterableList\n        @onInsertTemplate={{this.onInsertTemplate}}\n        @onAfterInsertTemplate={{action \"hide\"}}\n      />\n    </div>\n  {{/if}}\n  */\n  {\n    \"id\": \"IBGlp3aJ\",\n    \"block\": \"[[[41,[30,0,[\\\"templatesVisible\\\"]],[[[1,\\\"  \\\"],[10,0],[14,0,\\\"d-templates-container\\\"],[12],[1,\\\"\\\\n    \\\"],[8,[39,1],[[24,0,\\\"modal-close close btn-flat\\\"]],[[\\\"@action\\\",\\\"@icon\\\"],[[28,[37,2],[[30,0],\\\"hide\\\"],null],\\\"times\\\"]],null],[1,\\\"\\\\n    \\\"],[8,[39,3],null,[[\\\"@onInsertTemplate\\\",\\\"@onAfterInsertTemplate\\\"],[[30,0,[\\\"onInsertTemplate\\\"]],[28,[37,2],[[30,0],\\\"hide\\\"],null]]],null],[1,\\\"\\\\n  \\\"],[13],[1,\\\"\\\\n\\\"]],[]],null]],[],false,[\\\"if\\\",\\\"d-button\\\",\\\"action\\\",\\\"d-templates/filterable-list\\\"]]\",\n    \"moduleName\": \"discourse/plugins/discourse-templates/discourse/templates/connectors/editor-preview/d-templates.hbs\",\n    \"isStrictMode\": false\n  });\n});","define(\"discourse/plugins/discourse-templates/discourse/templates/connectors/topic-above-posts/discourse-templates-button\", [\"exports\", \"@ember/template-factory\"], function (_exports, _templateFactory) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  var _default = _exports.default = (0, _templateFactory.createTemplateFactory)(\n  /*\n    <div class=\"template-topic-controls\">\n    <DButton\n      @icon={{if this.copyConfirm \"check\" \"copy\"}}\n      @action={{this.copy}}\n      @label=\"templates.copy\"\n      class={{concat-class\n        \"btn-default\"\n        \"template-copy\"\n        (if this.copyConfirm \"ok\")\n      }}\n    />\n    <DButton\n      @action={{this.createNewTopic}}\n      @label=\"templates.new_topic\"\n      @icon=\"plus\"\n      class=\"template-new-topic\"\n    />\n  </div>\n  */\n  {\n    \"id\": \"JxzWUf6/\",\n    \"block\": \"[[[10,0],[14,0,\\\"template-topic-controls\\\"],[12],[1,\\\"\\\\n  \\\"],[8,[39,0],[[16,0,[28,[37,1],[\\\"btn-default\\\",\\\"template-copy\\\",[52,[30,0,[\\\"copyConfirm\\\"]],\\\"ok\\\"]],null]]],[[\\\"@icon\\\",\\\"@action\\\",\\\"@label\\\"],[[52,[30,0,[\\\"copyConfirm\\\"]],\\\"check\\\",\\\"copy\\\"],[30,0,[\\\"copy\\\"]],\\\"templates.copy\\\"]],null],[1,\\\"\\\\n  \\\"],[8,[39,0],[[24,0,\\\"template-new-topic\\\"]],[[\\\"@action\\\",\\\"@label\\\",\\\"@icon\\\"],[[30,0,[\\\"createNewTopic\\\"]],\\\"templates.new_topic\\\",\\\"plus\\\"]],null],[1,\\\"\\\\n\\\"],[13]],[],false,[\\\"d-button\\\",\\\"concat-class\\\",\\\"if\\\"]]\",\n    \"moduleName\": \"discourse/plugins/discourse-templates/discourse/templates/connectors/topic-above-posts/discourse-templates-button.hbs\",\n    \"isStrictMode\": false\n  });\n});","define(\"discourse/plugins/discourse-templates/lib/replace-variables\", [\"exports\", \"discourse/models/user\"], function (_exports, _user) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.TEMPLATES_ALLOWED_VARIABLES = void 0;\n  _exports.replaceVariables = replaceVariables;\n  // keep this list synchronized with the list in spec/plugin_helper.rb\n  const TEMPLATES_ALLOWED_VARIABLES = _exports.TEMPLATES_ALLOWED_VARIABLES = Object.freeze([\"my_username\", \"my_name\", \"chat_channel_name\", \"chat_channel_url\", \"chat_thread_name\", \"chat_thread_url\", \"context_title\", \"context_url\", \"topic_title\", \"topic_url\", \"original_poster_username\", \"original_poster_name\", \"reply_to_username\", \"reply_to_name\", \"last_poster_username\", \"reply_to_or_last_poster_username\"]);\n  function replaceVariables(title, content, modelVariables) {\n    const currentUser = _user.default.current();\n    const variables = {\n      ...(modelVariables || {}),\n      my_username: currentUser?.username,\n      my_name: currentUser?.displayName\n    };\n    if (variables && typeof variables === \"object\") {\n      for (const key of TEMPLATES_ALLOWED_VARIABLES) {\n        if (variables[key]) {\n          title = title.replace(new RegExp(`%{${key}(,fallback:.[^}]*)?}`, \"g\"), variables[key]);\n          content = content.replace(new RegExp(`%{${key}(,fallback:.[^}]*)?}`, \"g\"), variables[key]);\n        } else {\n          title = title.replace(new RegExp(`%{${key},fallback:(.[^}]*)}`, \"g\"), \"$1\");\n          title = title.replace(new RegExp(`%{${key}}`, \"g\"), \"\");\n          content = content.replace(new RegExp(`%{${key},fallback:(.[^}]*)}`, \"g\"), \"$1\");\n          content = content.replace(new RegExp(`%{${key}}`, \"g\"), \"\");\n        }\n      }\n    }\n    return {\n      title,\n      content\n    };\n  }\n});","define(\"discourse/plugins/discourse-templates/lib/textarea-manipulator\", [\"exports\", \"@ember/application\", \"@ember/object\", \"discourse/mixins/textarea-text-manipulation\"], function (_exports, _application, _object, _textareaTextManipulation) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  class TextareaManipulator extends _object.default.extend(_textareaTextManipulation.default) {\n    constructor(owner, textarea) {\n      super(...arguments);\n      (0, _application.setOwner)(this, owner);\n      this._textarea = textarea;\n      this.element = this._textarea;\n      this.ready = true;\n      this.init();\n    }\n    addBlock(text) {\n      this._addBlock(this.getSelected(), text);\n    }\n  }\n  _exports.default = TextareaManipulator;\n});","define(\"discourse/plugins/discourse-templates/lib/variables-chat-channel\", [\"exports\"], function (_exports) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = extractVariablesFromChatChannel;\n  function extractVariablesFromChatChannel(channel, message, router) {\n    if (!channel && !message) {\n      return {};\n    }\n    const inReplyTo = message?.inReplyTo;\n    const channelVariables = {\n      chat_channel_name: channel?.title,\n      chat_channel_url: channel?.routeModels ? router?.urlFor(\"chat.channel\", ...channel.routeModels) : null,\n      reply_to_username: inReplyTo?.user?.username,\n      reply_to_name: inReplyTo?.user?.name\n    };\n    return {\n      ...channelVariables,\n      context_title: channelVariables.chat_channel_name,\n      context_url: channelVariables.chat_channel_url\n    };\n  }\n});","define(\"discourse/plugins/discourse-templates/lib/variables-chat-thread\", [\"exports\", \"discourse/plugins/discourse-templates/lib/variables-chat-channel\"], function (_exports, _variablesChatChannel) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = extractVariablesFromChatThread;\n  function extractVariablesFromChatThread(thread, message, router) {\n    if (!thread && !message) {\n      return {};\n    }\n    const channel = thread?.channel;\n    const inReplyTo = thread?.originalMessage;\n    const channelVariables = (0, _variablesChatChannel.default)(channel, message, router);\n    const threadVariables = {\n      chat_thread_name: thread?.title,\n      chat_thread_url: thread?.routeModels ? router?.urlFor(\"chat.channel.thread\", ...thread.routeModels) : null,\n      reply_to_username: inReplyTo?.user?.username,\n      reply_to_name: inReplyTo?.user?.name\n    };\n    return {\n      ...channelVariables,\n      ...threadVariables,\n      context_title: threadVariables.chat_thread_name || channelVariables.chat_channel_name,\n      context_url: threadVariables.chat_thread_url || channelVariables.chat_channel_url\n    };\n  }\n});","define(\"discourse/plugins/discourse-templates/lib/variables-composer\", [\"exports\"], function (_exports) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = extractVariablesFromComposerModel;\n  function extractVariablesFromComposerModel(model) {\n    if (!model) {\n      return {};\n    }\n    const composerVariables = {\n      topic_title: model.topic?.title,\n      topic_url: model.topic?.url,\n      original_poster_username: model.topic?.details.created_by.username,\n      original_poster_name: model.topic?.details.created_by.name,\n      reply_to_username: model.post?.username,\n      reply_to_name: model.post?.name,\n      last_poster_username: model.topic?.last_poster_username,\n      reply_to_or_last_poster_username: model.post?.username || model.topic?.last_poster_username\n    };\n    return {\n      ...composerVariables,\n      context_title: composerVariables.topic_title,\n      context_url: composerVariables.topic_url\n    };\n  }\n});"],"mappings":"AAAAA,OAAA,4WAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,GACA;AAEAC,OAAAC,eAAAb,EAAA,cACAc,OAAA,IAEAd,EAAAe,aAAA;AACA,MAAAC,GAAA,EAAAL,EAAAM,uBA+BA,CACAC,GAAA,WACAC,MAAA,gnCACAC,WAAA,6FACAC,cAAA;AAEA,MAAAC,UAAApB,EAAAa,QACAQ,SAAA,KAAAC,OAAAC,EAAAC,KAAAC,UAAA,gBAAArB,EAAAsB,SAAA;AACAC,GAAA,MAAAL,OAAAM,EAAAJ,KAAA;AACAH,SAAA,KAAAC,OAAAC,EAAAC,KAAAC,UAAA,WAAAxB,EAAA4B,UAAA,WACA,QACA,IAFA;AAGAC,GAAA,MAAAR,OAAAM,EAAAJ,KAAA;AACAH,SAAA,KAAAC,OAAAC,EAAAC,KAAAC,UAAA,cAAAxB,EAAA4B,UAAA,WACA,QACA,IAFA;AAGAE,GAAA,MAAAT,OAAAM,EAAAJ,KAAA;AACAH,SAAA,KAAAC,OAAAC,EAAAC,KAAAC,UAAA,WAAAxB,EAAA4B,UAAA,WACA,QACA,IAFA;AAGAG,GAAA,MAAAV,OAAAM,EAAAJ,KAAA;AACAH,SAAA,KAAAC,OAAAC,EAAAC,KAAAC,UAAA,eAAAxB,EAAA4B,UAAA,WACA,OAAArB,EAAAyB,WACA,IAFA;AAGAC,GAAA,MAAAZ,OAAAM,EAAAJ,KAAA;AACAH,SAAA,KAAAC,OAAAC,EAAAC,KAAAC,UAAA,iBAAAxB,EAAA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