/*************************************************************************
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2021 Adobe
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe and its suppliers, if any. The intellectual
* and technical concepts contained herein are proprietary to Adobe
* and its suppliers and are protected by all applicable intellectual
* property laws, including trade secret and copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe.
**************************************************************************/

define("pdmplugins/oauthdialog/js/ac-oauthdialog",["plugins-common/ac-plugins"],function(i){var t=i.OauthDialog;return t||(t=i.OauthDialog={}),t.PLUGIN_ID||(t.PLUGIN_ID="oauthdialog"),t}),define("pdmplugins/oauthdialog/js/ops/op-factory",["core/ac-core-init","pdmplugins/oauthdialog/js/ac-oauthdialog"],function(i,t){t.OpFactory=i.Op.extend({create:function(i,o){var e=t[i];return e?new e(o):void LOG(0,"AcOauthDialog.OpFactory.create: Unrecognized class: "+i)}})}),define("pdmplugins/oauthdialog/js/nls/ui-strings",{root:!0,"xx-xx":!0,"ar-ae":!0,"ca-es":!0,"cs-cz":!0,"da-dk":!0,"de-de":!0,"en-ae":!0,"en-gb":!0,"en-il":!0,"es-es":!0,"eu-es":!0,"fi-fi":!0,"fr-fr":!0,"fr-ma":!0,"he-il":!0,"hr-hr":!0,"hu-hu":!0,"it-it":!0,"ja-jp":!0,"ko-kr":!0,"nb-no":!0,"nl-nl":!0,"pl-pl":!0,"pt-br":!0,"ro-ro":!0,"ru-ru":!0,"sk-sk":!0,"sl-si":!0,"sl-sl":!0,"sv-se":!0,"tr-tr":!0,"uk-ua":!0,"zh-cn":!0,"zh-tw":!0,"bg-bg":!0}),define("pdmplugins/oauthdialog/js/nls/root/ui-strings",{OAUTHDIALOG_1:"Waiting...",OAUTHDIALOG_2:"We have opened a new browser tab for you to sign in.",OAUTHDIALOG_3:"After you finish authentication in the browser, you will automatically continue within the app.",OAUTHDIALOG_TROUBLE:"Trouble getting in?",OAUTHDIALOG_TIMEOUT_1:"We did not manage to sign you in. Please try again.",CANCEL_BUTTON_TEXT:"Cancel",CANCEL_BUTTON_TEXT_2:"Close",OAUTHDIALOG_HEADING_2:"Sign in failed"}),define("pdmplugins/oauthdialog/js/templates/oauth-dialog-template",[],function(){return'<div class="ui-theme theme-text oauthdialog-container"><div class= "sanitize-content-txt"><div class = "oauth-Dialog-Waiting-Heading" tabindex="13"><%= OAUTHDIALOG_1 %></div><div class="oauthdialog-below-Waiting"></div><div class="oauthdialog-line"></div><div class="oauthdialog-above-Body"></div><div class = "oauthdialog-content-body"  tabindex="13"><%= OAUTHDIALOG_2 %><br><br><%= OAUTHDIALOG_3 %> </div><div class="oauthdialog-below-Body"></div></div><div class = "oauthdialog-footer" ><a class="oauthDialog-TroubleGettingIn theme-hyperlink" tabindex="13"><%= OAUTHDIALOG_TROUBLE %></a></div><input  class="oauthdialog-dlg-cancel-btn 				 control-button button-grey 				 theme-button-gray-label" 				 id="oauthdialog-footer-cancel" 				 type="button" 				 aria-label= "<%=CANCEL_BUTTON_TEXT%>" 				 value="<%=CANCEL_BUTTON_TEXT%>"  /></div>'}),define("pdmplugins/oauthdialog/js/views/oauth-dialog-view",["core/ac-core","pdmplugins/oauthdialog/js/ac-oauthdialog","pdmplugins/oauthdialog/js/templates/oauth-dialog-template","core/utils/view-util","i18n!pdmplugins/oauthdialog/js/nls/ui-strings"],function(i,t,o,e,n){t.ShowOauthDialogView=i.View.extend({events:{"click   .oauthdialog-dlg-cancel-btn":"_closeOauthDialog","click   .oauthDialog-TroubleGettingIn":"_onTroubleGettingInBtnClick","keydown .oauthDialog-TroubleGettingIn":"_onButtonKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(o)},render:function(){i.PluginContentView.prototype.render.call(this),this.$el.children().length>0||(0===this.$el.children().length&&this.$el.html(this._template({OAUTHDIALOG_1:n.OAUTHDIALOG_1,OAUTHDIALOG_2:n.OAUTHDIALOG_2,OAUTHDIALOG_3:n.OAUTHDIALOG_3,OAUTHDIALOG_TROUBLE:n.OAUTHDIALOG_TROUBLE,CANCEL_BUTTON_TEXT:n.CANCEL_BUTTON_TEXT})),setTimeout(this._onTimeout,6e5))},_onTimeout:function(){var i="WebConnectors",t="OauthDialog",o="Timeout";this.options.appApi.siteCatalystApi.logScEvent([i,t,o]),this.options.appApi.rnaApi.done(_.bind(function(i){i.invokeMethod({methodName:"connectorSigninTimeout",methodArgs:""})},this))},_onButtonKeyDown:function(i){var t=i.keyCode,o=$(i.target),e=$.Event("click");switch(t){case 13:o.trigger(e),i.preventDefault()}},_closeOauthDialog:function(){var i="WebConnectors",t="OauthDialog",o="Cancelled";this.options.appApi.siteCatalystApi.logScEvent([i,t,o]),this.options.appApi.rnaApi.done(_.bind(function(i){i.invokeMethod({methodName:"closeConnectorOauthDialog",methodArgs:""})},this))},_onTroubleGettingInBtnClick:function(){var i="WebConnectors",t="OauthDialog",o="TroubleGettingIn";this.options.appApi.siteCatalystApi.logScEvent([i,t,o]),this.options.appApi.rnaApi.done(_.bind(function(i){i.invokeMethod({methodName:"troubleGettingInBtnClick",methodArgs:""})},this))}})}),define("pdmplugins/oauthdialog/js/templates/on-timeout-template",[],function(){return'<div class="ui-theme theme-text oauthdialog-container"><div class= "sanitize-content-txt"><div class = "oauth-Dialog-Waiting-Heading" tabindex="13"><%= OAUTHDIALOG_HEADING_2 %><div class="info-image-timeout"></div></div><div class="oauthdialog-below-Waiting"></div><div class="oauthdialog-line"></div><div class="oauthdialog-above-Body"></div><div class = "oauthdialog-timeout-content-body" tabindex="13"><%= OAUTHDIALOG_TIMEOUT_1 %> </div></div><div class = "oauthdialog-footer-timeout" ><a class="oauthDialog-TroubleGettingIn theme-hyperlink" tabindex="13"><%= OAUTHDIALOG_TROUBLE %></a></div><input  class="oauthdialog-dlg-cancel-btn 				 control-button button-grey 				 theme-button-gray-label" 				 id="oauthdialog-footer-cancel-timeout" 				 type="button" 				 aria-label= "<%=CANCEL_BUTTON_TEXT_2%>" 				 value="<%=CANCEL_BUTTON_TEXT_2%>"  /></div>'}),define("pdmplugins/oauthdialog/js/views/on-timeout-view",["core/ac-core","pdmplugins/oauthdialog/js/ac-oauthdialog","pdmplugins/oauthdialog/js/templates/on-timeout-template","core/utils/view-util","i18n!pdmplugins/oauthdialog/js/nls/ui-strings"],function(i,t,o,e,n){t.onTimeoutView=i.View.extend({events:{"click   .oauthdialog-dlg-cancel-btn":"_closeOauthDialog","click   .oauthDialog-TroubleGettingIn":"_onTroubleGettingInBtnClick","keydown .oauthDialog-TroubleGettingIn":"_onButtonKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(o)},render:function(){i.PluginContentView.prototype.render.call(this),this.$el.children().length>0||0===this.$el.children().length&&this.$el.html(this._template({OAUTHDIALOG_TIMEOUT_1:n.OAUTHDIALOG_TIMEOUT_1,OAUTHDIALOG_TROUBLE:n.OAUTHDIALOG_TROUBLE,OAUTHDIALOG_HEADING_2:n.OAUTHDIALOG_HEADING_2,CANCEL_BUTTON_TEXT_2:n.CANCEL_BUTTON_TEXT_2}))},_onButtonKeyDown:function(i){var t=i.keyCode,o=$(i.target),e=$.Event("click");switch(t){case 13:o.trigger(e),i.preventDefault()}},_closeOauthDialog:function(){var i="WebConnectors",t="OauthDialog",o="Cancelled";this.options.appApi.siteCatalystApi.logScEvent([i,t,o]),this.options.appApi.rnaApi.done(_.bind(function(i){i.invokeMethod({methodName:"closeConnectorOauthDialog",methodArgs:""})},this))},_onTroubleGettingInBtnClick:function(){var i="WebConnectors",t="OauthDialog",o="TroubleGettingIn";this.options.appApi.siteCatalystApi.logScEvent([i,t,o]),this.options.appApi.rnaApi.done(_.bind(function(i){i.invokeMethod({methodName:"troubleGettingInBtnClick",methodArgs:""})},this))}})}),define("pdmplugins/oauthdialog/js/views/plugin-view",["core/ac-core","pdmplugins/oauthdialog/js/ac-oauthdialog","i18n!pdmplugins/oauthdialog/js/nls/ui-strings","core/utils/view-util","core/utils/focus-util","core/utils/event-util","core/utils/sc-analytics","pdmplugins/oauthdialog/js/views/oauth-dialog-view","pdmplugins/oauthdialog/js/views/on-timeout-view","core/views/plugin-content-view"],function(i,t){return t.PluginView=i.PluginContentView.extend({initialize:function(){i.PluginContentView.prototype.initialize.call(this)},teardown:function(){this.$el.empty()},render:function(){var t=this.$el;window.$el=t,i.PluginContentView.prototype.render.call(this);var o=this.options.appApi.routerApi.parseQueryParams(window.location.href.slice(window.location.href.indexOf("?")));"other"===o.theme?(t.append(_.template('<div id="oauth-dialog-view" class="theme-oauthdialog-container border"></div>')),this._renderChildViews(this.options)):(t.append(_.template('<div id="oauth-dialog-view" class="theme-oauthdialog-container"></div>')),this._renderChildViews(this.options))},_renderChildViews:function(){var i=this.options.appApi.routerApi.parseQueryParams(window.location.href.slice(window.location.href.indexOf("?")));"waiting"===i.dialogID?this._renderChildView("_showWebConnectorOauthDialogView",t.ShowOauthDialogView,this.$el.find("#oauth-dialog-view"),this.options):"onTimeout"===i.dialogID&&this._renderChildView("_showWebConnectorOauthDialogView",t.onTimeoutView,this.$el.find("#oauth-dialog-view"),this.options)},_resizeDialog:function(i){var t=$.Deferred(),o=450,e=500;return o=Math.min(o,i.height),e=Math.min(e,i.width),this.options.appApi.rnaApi.done(_.bind(function(i){i.cefBrowserApi({methodName:"setContainerSize",parameters:[Math.floor(e),Math.floor(o)]}).done(function(){t.resolve()})},this)),t.promise()},selectPlugin:function(){{var i=this.options;i.appApi}this.options.appApi.displayApi.applyUIThemeStyles(this.$el).then(_.bind(function(){this.render(),this.options.appApi.displayApi.showSpinner(!1)},this))},_startPlugin:function(){var i=this._getResolvedPromise();return i}}),t.PluginView}),define("pdmplugins/oauthdialog/js/oauthdialog",["pdmplugins/oauthdialog/js/ac-oauthdialog","pdmplugins/oauthdialog/js/ops/op-factory","pdmplugins/oauthdialog/js/views/plugin-view"],function(i){_.extend(i,{init:function(){i.opFactory=new i.OpFactory}})}),define("pdmplugins/oauthdialog/js/plugin",["core/ac-core-init","pdmplugins/oauthdialog/js/ac-oauthdialog","pdmplugins/oauthdialog/js/oauthdialog"],function(i,t){t.init()});