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

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

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

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

/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2016 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/

define("acplugins/add-account/js/ac-add-account",["plugins-common/ac-plugins"],function(e){var t=e.AddAccount;return t||(t=e.AddAccount={}),t}),define("acplugins/add-account-select/js/ac-add-account-select",["plugins-common/ac-plugins"],function(e){var t=e.AddAccountSelect;return t||(t=e.AddAccountSelect={}),t.PLUGIN_ID||(t.PLUGIN_ID="add_account_select"),t}),define("acplugins/add-account/js/views/view-events",["acplugins/add-account/js/ac-add-account"],function(e){e.ViewEvents={DISCOVER_EMAIL:"AddAccount:discover-email-id",SHOW_SWITCHER:"AddAccount:show-switcher"}}),define("acplugins/add-account/js/ops/plugin/listening-for-view-events-op",["core/ac-core","acplugins/add-account/js/ac-add-account","core/ops/op","core/views/view-events","acplugins/add-account/js/views/view-events","acplugins/add-account/js/ops/op-factory"],function(e,t){t.ListeningForViewEventsOp=e.Op.extend({initialize:function(){e.Op.prototype.initialize.call(this),this._initEventMap()},run:function(){var e=$.Deferred();return this.options.rootView.on("all",this._onViewEvent),this._deferred=e,e.promise()},_onViewEvent:function(e,t){var n,i;n=this._eventMap[e],n&&(i=n[0].create(n[1],t)),i&&i.run().then(function(){return void 0},function(){return void 0})},_mapEvent:function(e,t,n,i,o){e[t]=[n,i,o]},_initEventMap:function(){var e,n,i,o;e=this._eventMap={},n=this._mapEvent,i=t.opFactory,o=t.ViewEvents,n(e,o.DISCOVER_EMAIL,i,"ShowingEmailDiscoveryDlgOp")}})}),define("acplugins/add-account/js/constants/add-account-constants",{MICROSOFT:"Microsoft",ODCONNECTORKEY:"onedrive",ODBUSINESSCONNECTORKEY:"onedrivebusiness",ODCONNECTORLABEL:"OneDrive",ODBUSINESSCONNECTORLABEL:"OneDrive for Business",ODANALYTICSKEY:"Connector.OneDrive",OD_MSACCOUNT:"msaccount",OD_ORGID:"orgid,placeholder",OD_BOTH:"both",OD_NEITHER:"neither",EMAIL_DIALOG:"EmailDialog",SWITCHER_DIALOG:"SwitcherDialog",SHOWN:"Shown",CANCELLED:"Cancelled",CONTINUED:"Continued",SELECTED_PERSONAL:"Selected:Personal",SELECTED_BUSINESS:"Selected:Business",DELAY_ADDCONNECTOR_INTERVAL:120,ANALYTICS_INITIATED:"Initiated",ANALYTICS_HOME_VIEW:"Initiated:FromHomeView",ANALYTICS_SELECTION_DIALOG:"Initiated:FromFileSelectionDlg",ANALYTICS_SAVE_AS_DIALOG:"Initiated:FromFileSaveAsDlg",ADD_ACCOUNT:"AddAccount",FAILURE:"Failure"}),define("acplugins/add-account/js/templates/connectors-discover-email-dlg-template",[],function(){return'<div class="discover-email-dlg-email-container">   <label for="discover-email-input" class="discover-email-dlg-email-label theme-text">       <%= emailText %>   </label>    <input id="discover-email-input" class="discover-email-dlg-email <%= locale %> ui-theme theme-container theme-text" type="text"           title="<%= tooltip %>" spellcheck="false"           value="<%= email %>" /></div> <div class="dialog-buttons">    <input class="discover-email-dlg-cancel-btn control-button                  dialog-control-button                  button-grey ui-theme theme-text"           type="button"           id="discover-email-dlg-cancel-btn"           aria-label="<%= cancel %>"           value="<%= cancel %>" />    <input class="discover-email-dlg-continue-btn control-button                  dialog-control-button disabled theme-button theme-button-label"           type="button"           id="discover-email-dlg-continue-btn"           aria-label="<%= proceed %>"           value="<%= proceed %>"           disabled="disabled" /></div>'}),define("acplugins/add-account/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("acplugins/add-account/js/nls/root/ui-strings",{ADD_BUTTON:"Add",ADD_BUTTON_ARIA_LABEL:"<%= connectorName %> Add",ADD_ACCOUNT_TITLE:"Add Account",ADD_ACCOUNT_MESSAGE:"You already have an account for this storage set up. Please remove that account and then try again.",ADD_BUTTON_ONE_CONNECTOR:"Add Account",CONNECTOR_DESC:"Connect to Microsoft SharePoint Server or SharePoint Online to access your files from within application.",COMING_SOON_MSG:"More account types coming soon...",ADD_ACCOUNT_HEADER_TITLE:"Add a Storage Account",ADD_ACCOUNT_HEADER_DESCRIPTION:"Connect to your account to access your files from within Acrobat.",ADD_ACCOUNT_HEADER_DESCRIPTION_2:"You may be redirected to a web browser to sign in.",SIGN_IN_TO_TITLE:"Sign in to <%= connectorName %>",ENTER_EMAIL_ID:"Email",CHOOSE_ACCOUNT:"Choose <%= connectorName %> Account",PERSONAL_ACCOUNT_MSG:"Sign in with your <%= MSBrandName %> account",BUSINESS_ACCOUNT_MSG:"Sign in with your work or school account",ENTER_EMAIL_ID_TOOLTIP:"Enter the email of the <%= connectorName %> account you want to add"}),define("acplugins/add-account/js/views/discover-email-dlg-view",["core/ac-core","acplugins/add-account/js/ac-add-account","acplugins/add-account/js/templates/connectors-discover-email-dlg-template","i18n!acplugins/add-account/js/nls/ui-strings","i18n!core/nls/ui-strings","core/utils/truncate","core/utils/util","core/utils/view-util","acplugins/add-account/js/constants/add-account-constants","core/utils/sc-analytics","core/views/dialog-view"],function(e,t,n,i,o,c,s,a,l){var r=!1;t.DiscoverEmailDlgView=e.DialogView.extend({events:function(){return _.extend({},e.DialogView.prototype.events,{"keydown .discover-email-dlg-email":"_onEmailKeyDown","keyup   .discover-email-dlg-email":"_onEmailKeyUp","paste   .discover-email-dlg-email":"_onEmailPaste","click   .discover-email-dlg-continue-btn":"_onContinueClick","click   .discover-email-dlg-cancel-btn":"_onCancelClick"})},initialize:function(){e.DialogView.prototype.initialize.call(this),s.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()&&this.setElement($(".alert-dialog-container")),this._template=_.template(n),this._addUiModelEventListeners()},render:function(){var t,n=this._getTitle();return e.DialogView.prototype.render.call(this),t=_.template(i.ENTER_EMAIL_ID_TOOLTIP,{connectorName:l.ODCONNECTORLABEL}),this._appendToDialog(this._template({email:"",proceed:o.CONTINUE,cancel:o.CANCEL,tooltip:t,emailText:i.ENTER_EMAIL_ID,locale:e.Locale.getLocale()})),this._setTitle(n),this._initWrappers(),this._setDlgDimension(),a.setElementFontByLocale(this.$el,"input"),this._center(),s.isWindows()&&a.swapChildElements(this.$dlgControlBtns),this._initTabLimits(),_.defer(this._selectEmail),this._truncateText(),this._updateControls(),this._logHLEvent(l.EMAIL_DIALOG,l.SHOWN),this},open:function(){var t=e.DialogView.prototype.open.call(this);return s.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()&&$("#modal-mask").addClass("alert"),t},close:function(t,n){var i,o;i=_.bind(function(){s.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()&&$("#modal-mask").removeClass("alert"),e.DialogView.prototype.close.call(this,t,n)},this),r||(t?(o=this._getEmailId(),i()):(this._logHLEvent(l.EMAIL_DIALOG,l.CANCELLED),this._logHLEvent(l.ADD_ACCOUNT,l.FAILURE),o=void 0,i()))},_initWrappers:function(){e.DialogView.prototype._initWrappers.call(this),this.$dlg=this.$(".generic-dialog"),this.$email=this.$(".discover-email-dlg-email"),this.$dlgControlBtns=this.$(".dialog-buttons"),this.$continueBtn=this.$(".discover-email-dlg-continue-btn"),this.$cancelBtn=this.$(".discover-email-dlg-cancel-btn")},_setDlgDimension:function(){var e=this.$dlg;e.css("width",530),e.css("height",170),e.css("z-index",13002)},_getTitle:function(){var e=_.template(i.SIGN_IN_TO_TITLE,{connectorName:l.ODCONNECTORLABEL});return e},_getEmailId:function(){return $.trim(this.$email.val())},_truncateText:function(){c.truncateButtonLabel(this.$continueBtn),c.truncateButtonLabel(this.$cancelBtn)},_updateControls:function(){var e,t,n=this._getEmailId();e=n.length>0,e&&(t=/^\S+@\S+\.\S+$/,n=$.trim(n),e=e&&(n.match(t)?!0:!1)),a.enableInput(this.$continueBtn,e),this._initTabLimits()},_selectEmail:function(){var e=this.$email;e.select(),e.focus()},_getAccountDetails:function(){var e=this.options,n=e.appApi,i=n.connectorsApi,o=this._getEmailId();!r&&o&&0!==o.length&&(this._logHLEvent(l.EMAIL_DIALOG,l.CONTINUED),n.displayApi.showSpinner(!0),r=!0,t.opFactory.create("OneDriveEmailDisambiguationOp",_.extend({},e,{email:o})).run().then(_.bind(function(t){t=t.toLowerCase(),r=!1,n.displayApi.showSpinner(!1),this.close(!0),t===l.OD_MSACCOUNT||t===l.OD_NEITHER?_.delay(function(){i.addConnector(l.ODCONNECTORKEY,void 0,{email:o})},l.DELAY_ADDCONNECTOR_INTERVAL):t===l.OD_ORGID?_.delay(function(){i.addConnector(l.ODBUSINESSCONNECTORKEY,void 0,{email:o})},l.DELAY_ADDCONNECTOR_INTERVAL):this._showSwitcherDialog({connectorName:e.connectorName,parentView:e.parentView,emailId:o})},this),_.bind(function(){r=!1,n.displayApi.showSpinner(!1),this.close(!0),this._showSwitcherDialog({connectorName:e.connectorName,parentView:e.parentView,emailId:o})},this)))},_getSiteCatalystContext:function(){return void 0},_onCloseBtnClick:function(){this._onCancelClick()},_onEmailKeyDown:function(e){13===e.which&&a.isInputEnabled(this.$continueBtn)&&this._getAccountDetails()},_onEmailKeyUp:function(){this._updateControls()},_onEmailPaste:function(){_.defer(this._updateControls)},_onContinueClick:function(e){var t=$(e.currentTarget);a.isInputEnabled(t)&&this._getAccountDetails()},_showSwitcherDialog:function(e){var n=_.extend({},_.omit(this.options,"el"));e&&_.extend(n,e),t.opFactory.create("ShowSwitcherDlgOp",n).run()},_onCancelClick:function(){this.close(!1),this.options.appApi.rnaApi.done(_.bind(function(e){e.invokeMethod({methodName:"connectorODSPFileOpen",methodArgs:!0})},this))},_logHLEvent:function(e,t){var n=l.ODANALYTICSKEY;this.options.appApi.rnaApi.done(function(i){i.analyticsAPI({methodName:"logAnalyticsEvent",methodArgs:[n,e,t]})})},_addUiModelEventListeners:function(){var t=e.uiModelFactory.create("DialogUiModel"),n=e.uiModelFactory.create("DialogsUiModel");this._dialogUiModel=t,this.options.dialogsUiModel=n,this.listenTo(t,"change:close",this._onCloseChange)},_onCloseChange:function(e,t){this.close(t)},_onKeyDown:function(t){var n=t.which,i=!1,o=$(t.target);switch(n){case 27:(o.closest("[role=dialog]").is(this.$dlg)&&0===o.closest("[role=menu]").length||0===o.closest(this.$dlg).length)&&(this._onCloseBtnClick(),this._consumeEvent(t),i=!0);break;default:i=e.DialogView.prototype._onKeyDown.call(this,t)}return i}})}),define("acplugins/add-account/js/ops/plugin/showing-email-discovery-dlg-op",["core/ac-core","acplugins/add-account/js/ac-add-account","i18n!app/nls/ui-strings","acplugins/add-account/js/constants/add-account-constants","acplugins/add-account/js/views/discover-email-dlg-view","core/ops/op"],function(e,t,n,i){t.ShowingEmailDiscoveryDlgOp=e.Op.extend({run:function(){var e,o=this.options,c=o.appApi,s=c.dialogApi;return c.networkConnectivityApi.isOnline()?(e=new t.DiscoverEmailDlgView(o),e.open(o.parentView)):(s.displayTextAlert(s.SEVERITY_ERROR,n.NO_CONNECTION_TITLE,n.NO_CONNECTION_MSG),this.options.appApi.rnaApi.done(function(e){e.analyticsAPI({methodName:"logAnalyticsEvent",methodArgs:[i.ODANALYTICSKEY,i.ADD_ACCOUNT,i.FAILURE]})}),this._getResolvedPromise())}})}),define("acplugins/add-account/js/templates/connectors-switcher-dlg-template",[],function(){return'<div class="show-switcher-dlg dialog-buttons">    <div class="show-switcher-dlg control-button-blk personal-account-blk">       <input class="show-switcher-dlg-personal-account-btn show-switcher-dlg control-button                  dialog-control-button                  theme-button theme-button-label"           type="button"           id="show-switcher-dlg-personal-account-btn"           aria-label="<%= personalLabel %>"           value="<%= personal %>"/>        <div class="show-switcher-dlg sign-in-text-blk theme-text"> <%= personalAccMsg %> </div>    </div>    <div class="show-switcher-dlg control-button-blk business-account-blk">       <input class="show-switcher-dlg-business-account-btn show-switcher-dlg control-button                  dialog-control-button theme-button theme-button-label"           type="button"           id="show-switcher-dlg-business-account-btn"           aria-label="<%= businessLabel %>"           value="<%= business %>"/>        <div class="show-switcher-dlg sign-in-text-blk theme-text"> <%= businessAccMsg %> </div>    </div></div>'}),define("acplugins/add-account/js/views/show-switcher-dlg-view",["core/ac-core","acplugins/add-account/js/ac-add-account","acplugins/add-account/js/templates/connectors-switcher-dlg-template","i18n!acplugins/add-account/js/nls/ui-strings","core/utils/truncate","core/utils/util","core/utils/view-util","acplugins/add-account/js/constants/add-account-constants","core/utils/sc-analytics","core/views/dialog-view","acplugins/add-account/js/views/view-events"],function(e,t,n,i,o,c,s,a){var l;t.ShowSwitcherDlgView=e.DialogView.extend({events:function(){return _.extend({},e.DialogView.prototype.events,{"click   .show-switcher-dlg-personal-account-btn":"_onPersonalAccClick","click   .show-switcher-dlg-business-account-btn":"_onBusinessAccClick"})},initialize:function(){e.DialogView.prototype.initialize.call(this),c.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()&&this.setElement($(".alert-dialog-container")),this._template=_.template(n),this._addUiModelEventListeners()},render:function(){var t,n,o,c,r=this._getTitle();return e.DialogView.prototype.render.call(this),t=a.ODCONNECTORLABEL,n=a.ODBUSINESSCONNECTORLABEL,o=_.template(i.PERSONAL_ACCOUNT_MSG,{MSBrandName:a.MICROSOFT}),c=i.BUSINESS_ACCOUNT_MSG,this._appendToDialog(this._template({personal:t,personalLabel:this._getConnectorButtonAriaLabel(t),business:n,businessLabel:this._getConnectorButtonAriaLabel(n),title:r,locale:e.Locale.getLocale(),personalAccMsg:o,businessAccMsg:c})),this._setTitle(r),this._initWrappers(),this._setDlgDimension(),s.setElementFontByLocale(this.$el,"input"),this._center(),this._initTabLimits(),_.defer(this._selectPersonalAccBtn),this._truncateText(),l=this.$body.hasClass("suppress-focus-outline"),l&&this.$body.toggleClass("suppress-focus-outline",!1),this._logHLEvent(a.SWITCHER_DIALOG,a.SHOWN),this},_getConnectorButtonAriaLabel:function(e){return _.template(i.CHOOSE_ACCOUNT,{connectorName:e})},open:function(){var t=e.DialogView.prototype.open.call(this);return c.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()&&$("#modal-mask").addClass("alert"),t},close:function(t,n){var i,o;i=_.bind(function(){c.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()&&$("#modal-mask").removeClass("alert"),e.DialogView.prototype.close.call(this,t,n)},this),this.$body.toggleClass("suppress-focus-outline",l),t&&(o=n),i()},_initWrappers:function(){e.DialogView.prototype._initWrappers.call(this),this.$body=$("body"),this.$dlg=this.$(".generic-dialog"),this.$personalAccBtn=this.$(".show-switcher-dlg-personal-account-btn"),this.$businessAccBtn=this.$(".show-switcher-dlg-business-account-btn")},_setDlgDimension:function(){var e=this.$dlg;e.css("width",530),e.css("height",220),e.css("z-index",13002)},_getTitle:function(){var e=_.template(i.CHOOSE_ACCOUNT,{connectorName:a.ODCONNECTORLABEL});return e},_truncateText:function(){o.truncateButtonLabel(this.$businessAccBtn),o.truncateButtonLabel(this.$personalAccBtn)},_selectPersonalAccBtn:function(){var e=this.$personalAccBtn;e.select(),e.focus()},_getSiteCatalystContext:function(){return void 0},_onCloseBtnClick:function(){this._logHLEvent(a.SWITCHER_DIALOG,a.CANCELLED),this._logHLEvent(a.ADD_ACCOUNT,a.FAILURE),this.close(!1),this.options.appApi.rnaApi.done(_.bind(function(e){e.invokeMethod({methodName:"connectorODSPFileOpen",methodArgs:!0})},this))},_onBusinessAccClick:function(){var e=this.options,t=e.appApi,n=t.connectorsApi,i=e.emailId;this.close(!0,a.ODBUSINESSCONNECTORKEY),_.delay(function(){n.addConnector(a.ODBUSINESSCONNECTORKEY,void 0,{email:i})},a.DELAY_ADDCONNECTOR_INTERVAL),this._logHLEvent(a.SWITCHER_DIALOG,a.SELECTED_BUSINESS)},_onPersonalAccClick:function(){var e=this.options,t=e.appApi,n=t.connectorsApi,i=e.emailId;this.close(!0,a.ODCONNECTORKEY),_.delay(function(){n.addConnector(a.ODCONNECTORKEY,void 0,{email:i})},a.DELAY_ADDCONNECTOR_INTERVAL),this._logHLEvent(a.SWITCHER_DIALOG,a.SELECTED_PERSONAL)},_logHLEvent:function(e,t){var n=a.ODANALYTICSKEY;this.options.appApi.rnaApi.done(function(i){i.analyticsAPI({methodName:"logAnalyticsEvent",methodArgs:[n,e,t]})})},_addUiModelEventListeners:function(){var t=e.uiModelFactory.create("DialogUiModel"),n=e.uiModelFactory.create("DialogsUiModel");this._dialogUiModel=t,this.options.dialogsUiModel=n,this.listenTo(t,"change:close",this._onCloseChange)},_onCloseChange:function(e,t){this.close(t)},_onKeyDown:function(t){var n=t.which,i=!1,o=$(t.target);switch(n){case 27:(o.closest("[role=dialog]").is(this.$dlg)&&0===o.closest("[role=menu]").length||0===o.closest(this.$dlg).length)&&(this._onCloseBtnClick(),this._consumeEvent(t),i=!0);break;default:i=e.DialogView.prototype._onKeyDown.call(this,t)}return i}})}),define("acplugins/add-account/js/ops/plugin/showing-switcher-dlg-op",["core/ac-core","acplugins/add-account/js/ac-add-account","acplugins/add-account/js/views/show-switcher-dlg-view","core/ops/op"],function(e,t){t.ShowSwitcherDlgOp=e.Op.extend({run:function(){var e,n=this.options;return e=new t.ShowSwitcherDlgView(n),e.open(n.parentView)}})}),define("acplugins/add-account/js/ops/plugin/rna-listen-for-async-request-completion-op",["core/ac-core","acplugins/add-account/js/ac-add-account","core/ops/op"],function(e,t){return t.ListenForAsyncRequestCompletionOp=e.Op.extend({run:function(){var e=this.options,t=e.progressObj,n=e.resultPromise;t._addEventListener("custom:requestComplete",function(e,t){!t.params||t.params.errorSet?n.reject():n.resolve(t.params.result)})}}),t.ListenForAsyncRequestCompletionOp}),define("acplugins/add-account/js/ops/plugin/rna-onedrive-email-disambiguation-op",["core/ac-core","acplugins/add-account/js/ac-add-account","core/ops/op"],function(e,t){t.OneDriveEmailDisambiguationOp=e.Op.extend({run:function(){var e,n=this.options,i=(n.appApi,$.Deferred()),o=n.connectorName,c=n.email;return n.appApi.rnaApi?(n.appApi.rnaApi.done(_.bind(function(s){e=s.connectorsAPI({methodName:"oneDriveDisambiguation",methodArgs:[o,c]}),e.done(function(e){var o;e.errorSet?i.reject():(o={progressObj:e.progressObj,resultPromise:i},t.opFactory.create("ListenForAsyncRequestCompletionOp",_.extend(n,o)).run())}).fail(function(){i.reject()})},this)).fail(_.bind(function(){i.reject()})),i):this._getRejectedPromise()}})}),define("acplugins/add-account/js/ops/op-factory",["core/ac-core","acplugins/add-account/js/ac-add-account","acplugins/add-account/js/ops/plugin/listening-for-view-events-op","acplugins/add-account/js/ops/plugin/showing-email-discovery-dlg-op","acplugins/add-account/js/ops/plugin/showing-switcher-dlg-op","acplugins/add-account/js/ops/plugin/rna-listen-for-async-request-completion-op","acplugins/add-account/js/ops/plugin/rna-onedrive-email-disambiguation-op","core/ops/op"],function(e,t){t.OpFactory=e.Op.extend({create:function(e,n){var i=t[e];return i?new i(n):void LOG(0,"AcAddAccount.OpFactory.create: Unrecognized class: "+e)}})}),define("acplugins/ac-bh",[],function(){var e=Ac.Bh;return e||(e=Ac.Bh={}),e}),define("acplugins/add-account/js/templates/connectors-collection-template",[],function(){return'<div class="connectors-container ui-theme theme-container"><div class="connectors-collection ui-theme theme-container"><div class="connectors-collection-items ui-theme theme-container"></div></div></div>'}),define("acplugins/add-account/js/templates/connectors-collection-template-noaddstorage",[],function(){return'<div class="connectors-container-noaddstorage ui-theme theme-container"><div class="connectors-collection-noaddstorage ui-theme theme-container"><div class="connectors-collection-items-noaddstorage ui-theme theme-container"></div></div></div>'}),define("acplugins/add-account/js/templates/connectors-collection-header-template",[],function(){return'<div class="connectors-collection-header" ui-theme theme-container"><div class="connectors-collection-header-title theme-text unselectable connectors-collection-header"        role="heading" aria-level="2" aria-label="<%= headerTitle %>" tabindex=1><%= headerTitle %></div><div class="connectors-collection-header-title-desc theme-text unselectable connectors-collection-header"        role="heading" aria-level="2"  aria-label="<%= headerDescription %> <%= headerDescription2 %>" tabindex=2><%= headerDescription %><br><%= headerDescription2 %></div>'}),define("acplugins/add-account/js/templates/connectors-collection-section-header-template",[],function(){return'<div class="connectors-collection-section-title theme-text unselectable"        role="heading" aria-level="2"><%= sectionTitle %></div>'}),define("acplugins/add-account/js/views/connectors-collection-section-header-view",["core/ac-core","acplugins/add-account/js/ac-add-account","acplugins/add-account/js/templates/connectors-collection-section-header-template","i18n!acplugins/add-account/js/nls/ui-strings","core/views/view"],function(e,t,n){return t.ConnectorsCollectionHeaderView=e.View.extend({initialize:function(){e.View.prototype.initialize.call(this)},render:function(){var t=this.$el;return e.View.prototype.render.call(this),t.append(_.template(n)({sectionTitle:this.options.connectorsCollectionHeader})),this._initWrappers(),this},_initWrappers:function(){this.$sectionTitle=this.$(".connectors-collection-section-title")}}),t.ConnectorsCollectionHeaderView}),define("acplugins/add-account/js/templates/connectors-collection-item-template",[],function(){return'<div class="connectors-collection-item-info-container"        role="group">    <img class="connectors-collection-item-thumb" alt=""/>    <div class="connectors-collection-item-label theme-text"         role="heading" aria-level="3"></div>    <button class="connectors-collection-item-add button-light-blue-small theme-primary-button theme-primary-button-label">        <%= addTitle %></button></div>'}),define("acplugins/add-account/js/templates/connectors-collection-item-one-connector-template",[],function(){return'<div class="connectors-collection-item-info-container-one-connector ui-theme theme-container"        role="group"        aria-labelledby="connectors-collection-item-label-<%= viewId %>"        aria-describedby="connectors-collection-item-desc-<%= viewId %>">    <img class="connectors-collection-item-thumb one-connector" alt="" />    <div class="connectors-collection-item-label one-connector theme-text"         role="heading" aria-level="3"         id="connectors-collection-item-label-<%= viewId %>"></div>    <div class="connectors-collection-item-desc theme-text"         id="connectors-collection-item-desc-<%= viewId %>">        <%= connectorDesc %></div>    <button class="connectors-collection-item-add control-button theme-primary-button theme-primary-button-label">        <%= addTitle %></button>    <div class="connectors-coming-soon-msg theme-text"><%= comingSoonMsg %></div></div>'}),define("acplugins/add-account/js/views/connectors-collection-item-view",["core/ac-core","acplugins/add-account/js/ac-add-account","core/utils/image-loader","i18n!acplugins/add-account/js/nls/ui-strings","core/utils/util","core/utils/focus-util","acplugins/add-account/js/constants/add-account-constants","core/views/view","acplugins/add-account/js/views/view-events"],function(e,t,n,i,o,c,s){return t.ConnectorsCollectionItemView=e.View.extend({events:{"click    .connectors-collection-item-add":"_onAddClick","keydown  .connectors-collection-item-add":"_onKeyDown"},initialize:function(){e.View.prototype.initialize.call(this)},render:function(){return this._initWrappers(),this._updateFields(),this},_initWrappers:function(){this.$icon=this.$("img.connectors-collection-item-thumb"),this.$label=this.$(".connectors-collection-item-label"),this.$addBtn=this.$(".connectors-collection-item-add")},_getLabel:function(){return this.model.label},_updateLabel:function(e){this.$label.text(e)},_getSignInUri:function(){return this.model.sign_in_uri},_getIcon:function(){return o.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()?o.isRetina()?this.model.icon_lg_retina:this.model.icon_lg:o.isRetina()?this.model.icon_sm_retina:this.model.icon_sm},_updateIcon:function(e){n.loadImage(this.$icon,e,void 0,!0).then(_.bind(function(){this._setIconPosition(),this.$icon.on("dragstart",function(e){e.preventDefault()})},this),_.bind(function(){return void 0},this))},_updateFields:function(){var e=this.$label,t=this._getLabel(),n=this.$icon,i=this._getIcon();i!==n.attr("src")&&this._updateIcon(i),t!==e.text()&&(this._updateLabel(t),this._updateAriaLabel(t))},_updateAriaLabel:function(e){var t=_.template(i.ADD_BUTTON_ARIA_LABEL,{connectorName:e});this.$addBtn.attr("aria-label",t)},_setIconPosition:function(){var e,t,n,i;e=this.$icon,i=e.width(),t=e.parent(),n=t.width(),e.css("left",(n-i)/2-16)},_onKeyDown:function(e){o.isCEF()||(13===e.which?this._onAddClick():c.nextElem(e))},_onAddClick:function(){var e=this._getResolvedPromise(),t=this.$el.data("name");this.options.appApi.connectorsApi.isDesktopConnector(t)||(e=this.options.appApi.sessionApi.ensureSignedIn()),e.then(_.bind(function(){this._onAddClickInternal()},this))},_onAddClickInternal:function(){var e=this.options,n=e.appApi,i=n.connectorsApi,o=this.$el.data("name");this._logAddAccountHLEvent(),this._checkIfSupportsMultipleAccounts().done(_.bind(function(e){e&&(i.isDesktopConnector(o)&&o===s.ODCONNECTORKEY?this._triggerViewEvent(t.ViewEvents.DISCOVER_EMAIL,{connectorName:s.ODCONNECTORKEY,parentView:this}):i.addConnector(o))},this))},_logAddAccountHLEvent:function(){var e=this.model.site_catalyst_name,t=s.ADD_ACCOUNT,n=s.ANALYTICS_INITIATED,i=s.ANALYTICS_HOME_VIEW,c=this.options.appApi,a=c.selectionApi;o.isCEF()&&(a.isRunningInFileSelection()&&(i=c.saveAsApi.isRunningInFileSaveAs()?s.ANALYTICS_SAVE_AS_DIALOG:s.ANALYTICS_SELECTION_DIALOG),c.rnaApi.done(function(o){o.analyticsAPI({methodName:"logAnalyticsEvent",methodArgs:[e,t,n]}),o.analyticsAPI({methodName:"logAnalyticsEvent",methodArgs:[e,t,i]})}))},_checkIfSupportsMultipleAccounts:function(){var e,t=$.Deferred(),n=$.Deferred(),c=this.options.appApi,s=c.dialogApi,a=c.connectorsApi,l=this.$el.data("name"),r=a.supportsMultipleAccounts(l);return o.isCEF()?c.rnaApi.done(function(e){n=e.getSystemFoldersData(!1,!1)}):n.resolve(),n.done(_.bind(function(){e=a.getConnector(l),e.length>0&&!r?(s.displayTextAlert(s.SEVERITY_ERROR,i.ADD_ACCOUNT_TITLE,i.ADD_ACCOUNT_MESSAGE),t.resolve(!1)):t.resolve(!0)},this)),t.promise()}}),t.ConnectorsCollectionItemView}),define("acplugins/add-account/js/views/connectors-collection-items-view",["core/ac-core","acplugins/add-account/js/ac-add-account","acplugins/add-account/js/templates/connectors-collection-item-template","acplugins/add-account/js/templates/connectors-collection-section-header-template","acplugins/add-account/js/templates/connectors-collection-item-one-connector-template","i18n!acplugins/add-account/js/nls/ui-strings","acplugins/add-account/js/constants/add-account-constants","acplugins/add-account/js/views/connectors-collection-item-view","core/views/view"],function(e,t,n,i,o,c,s){return t.ConnectorsCollectionItemsView=e.View.extend({render:function(){var o=this.options,a=this.$el;e.View.prototype.render.call(this),0===a.children().length&&(o.noAddStorage||a.append(_.template(i)({sectionTitle:this.options.connectorsCollectionHeader})),_.each(o.addOrder,_.bind(function(e){var i,l;this.collection[e.name]&&e.name!==s.ODBUSINESSCONNECTORKEY&&(this._template=_.template(n),a.append(this._template({addTitle:c.ADD_BUTTON})),l=a.children().last(),l.data("name",e.name),i=new t.ConnectorsCollectionItemView(_.extend({},o,{model:this.collection[e.name]})),i.setElement(l),this.addChildView(i))},this))),this._renderChildViews()},_renderChildViews:function(){var e=this.getChildViews();_.each(e,function(e){e instanceof t.ConnectorsCollectionItemView&&e.render()},this)},_clickOnAddForConnectorID:function(e){"onedrivebusiness"==e&&(e="onedrive");var n=this.getChildViews();_.each(n,function(n){n instanceof t.ConnectorsCollectionItemView&&n.$el.data("name")==e&&n.$addBtn.click()},this)}}),t.ConnectorsCollectionItemsView}),define("acplugins/add-account/js/views/connectors-collection-view",["core/ac-core","acplugins/add-account/js/ac-add-account","core/utils/util","acplugins/add-account/js/views/connectors-collection-section-header-view","acplugins/add-account/js/views/connectors-collection-items-view","core/views/view"],function(e,t){return t.ConnectorsCollectionView=e.View.extend({initialize:function(){e.View.prototype.initialize.call(this)},render:function(){return e.View.prototype.render.call(this),this._initWrappers(),this._renderChildViews(),this},_initWrappers:function(){this.$section=this.$(".connectors-collection-section"),this.$items=this.$(".connectors-collection-items")},_renderChildViews:function(){this._renderItemsView()},_renderItemsView:function(){this._renderChildView("_itemsView",t.ConnectorsCollectionItemsView,this.$items,{collection:this.options.connectorsCollection,addOrder:this.options.addOrder})},_renderHeaderView:function(){this._renderChildView("_headerView",t.ConnectorsCollectionHeaderView,this.$section,{sectionTitle:this.options.connectorsCollectionHeader})}}),t.ConnectorsCollectionView}),define("acplugins/add-account/js/views/connectors-collection-view-noaddstorage",["core/ac-core","acplugins/add-account/js/ac-add-account","core/utils/util","acplugins/add-account/js/views/connectors-collection-section-header-view","acplugins/add-account/js/views/connectors-collection-items-view","core/views/view"],function(e,t,n){return t.ConnectorsCollectionNoAddStorageView=e.View.extend({initialize:function(){e.View.prototype.initialize.call(this)},render:function(){return e.View.prototype.render.call(this),this._initWrappers(),this._renderChildViews(),this._resizeConnectors(),this.options.appApi.windowApi.addWindowResizeCallback(this._onWindowResize),this},_initWrappers:function(){this.$items=this.$(".connectors-collection-items-noaddstorage")},_renderChildViews:function(){this._renderItemsView()},_renderItemsView:function(){this._renderChildView("_itemsView",t.ConnectorsCollectionItemsView,this.$items,{collection:this.options.connectorsCollection,addOrder:this.options.addOrder,noAddStorage:this.options.noAddStorage})},_onWindowResize:function(){this._resizeConnectors()},_resizeConnectors:function(){var e,t,i,o,c,s,a,l,r;o=parseFloat(this.$(".connectors-collection-item-info-container").css("margin-left")),c=parseFloat(this.$(".connectors-collection-item-info-container").css("margin-right")),s=parseFloat(this.$(".connectors-collection-item-info-container").css("margin-top")),a=parseFloat(this.$(".connectors-collection-item-info-container").css("margin-bottom")),e=this.$(".connectors-collection-noaddstorage").width(),t=this.$(".connectors-collection-item-info-container").width()+o+c,r=this.$(".connectors-collection-item-info-container").height(),l=this.$(".connectors-collection-items-noaddstorage").children().length,this.$(".connectors-collection-items-noaddstorage").css("margin-left","auto"),this.$(".connectors-collection-items-noaddstorage").css("margin-right","auto"),i=5*t,this.$(".connectors-collection-items-noaddstorage").width(i),2!=l&&5*t>e&&e>4*t?this.$(".connectors-collection-items-noaddstorage").width(4*t):4*t>e&&e>3*t?this.$(".connectors-collection-items-noaddstorage").width(3*t):3*t>e&&e>2*t&&this.$(".connectors-collection-items-noaddstorage").width(2*t),4>=l&&e>l*t&&this.$(".connectors-collection-items-noaddstorage").width(l*t),n.isCEF()&&this.options.appApi.selectionApi.isRunningInFileSelection()&&3>=l&&(this.$(".connectors-collection-items-noaddstorage").width(l*t),this.$(".connectors-collection-items-noaddstorage").css("position","absolute"),this.$(".connectors-collection-items-noaddstorage").css("top","50%"),this.$(".connectors-collection-items-noaddstorage").css("left","50%"),this.$(".connectors-collection-items-noaddstorage").css("margin-top",-(r/2+s+a)),this.$(".connectors-collection-items-noaddstorage").css("margin-left",-(l*t)/2))
},_clickOnAddForConnectorID:function(e){this._itemsView&&this._itemsView._clickOnAddForConnectorID(e)}}),t.ConnectorsCollectionNoAddStorageView}),define("acplugins/bh-plugin-view",["core/ac-core","acplugins/ac-bh","core/views/plugin-content-view"],function(e,t){return t.PluginView=e.PluginContentView.extend({getAppApiVersion:function(){return Ac.Plugins.groups.blue_heron.FRAMEWORK_VERSION}}),t.PluginView}),define("acplugins/add-account/js/views/plugin-view",["acplugins/ac-bh","acplugins/add-account/js/ac-add-account","acplugins/add-account/js/templates/connectors-collection-template","acplugins/add-account/js/templates/connectors-collection-template-noaddstorage","i18n!acplugins/add-account/js/nls/ui-strings","acplugins/add-account/js/templates/connectors-collection-header-template","core/utils/util","core/utils/css-util","acplugins/add-account/js/views/connectors-collection-view","acplugins/add-account/js/views/connectors-collection-view-noaddstorage","acplugins/bh-plugin-view"],function(e,t,n,i,o,c,s,a){return t.PluginView=e.PluginView.extend({initialize:function(){e.PluginView.prototype.initialize.call(this),s.isCEF()&&a.loadCss("static/js/plugins/add-account/css/desktop-connectors-collection.css")},render:function(){var s,a,l,r,d=!1,u=this.$el,p=0;e.PluginView.prototype.render.call(this),0===u.children().length&&(u.append(_.template(c)({headerTitle:o.ADD_ACCOUNT_HEADER_TITLE,headerDescription:o.ADD_ACCOUNT_HEADER_DESCRIPTION,headerDescription2:o.ADD_ACCOUNT_HEADER_DESCRIPTION_2})),s=this.options.appApi.connectorsApi.getConnectorsUiHelpers(),a=s.connectors,l=s.order_for_add,_.each(l,function(e){p+=e.section_order.length}),d=this._checkValidSectionsForConnector(a,l)>1?!1:!0,_.each(l,_.bind(function(e){if(!e.section_order||0!==e.section_order.length){var o={connectorsCollection:a,addOrder:e.section_order,connectorsCollectionHeader:e.section_label,totalConnectorCount:p,noAddStorage:d};d?(u.append(_.template(i)),r=new t.ConnectorsCollectionNoAddStorageView(_.extend({},this.options,o))):(u.append(_.template(n)),r=new t.ConnectorsCollectionView(_.extend({},this.options,o))),r.setElement(u.children().last()),this.addChildView(r)}},this))),this._renderChildViews(d)},selectPlugin:function(){var e=this.options,t=e.appApi;return this._startPlugin().done(_.bind(function(){return s.isCEF()?t.rnaApi.done(_.bind(function(n){n.getConnectorsUIHelperData(!1,!1).then(_.bind(function(){t.routerApi.navigate(e.pluginId),this.options.appApi.displayApi.applyUIThemeStyles(this.$el).then(_.bind(function(){this.render(),this.options.appApi.displayApi.showSpinner(!1),this._checkShouldClickOnAddForConnectorID()},this))},this))},this)):(t.routerApi.navigate(e.pluginId),void this.render())},this))},getSiteCatalystName:function(){return"AddAccount"},_startPlugin:function(){var e=this._getResolvedPromise();return this._viewListener||(this._viewListener=t.opFactory.create("ListeningForViewEventsOp",this.options),this._viewListener.run()),e},_checkValidSectionsForConnector:function(e,t){var n=0,i=0;return _.each(t,function(t){t.section_order.length&&(_.some(t.section_order,function(t){return e[t.name]?(n=1,!0):void 0}),1===n&&i++),n=0}),i},_renderChildViews:function(e){var n=this.getChildViews();e?_.each(n,function(e){e instanceof t.ConnectorsCollectionNoAddStorageView&&e.render()},this):_.each(n,function(e){e instanceof t.ConnectorsCollectionView&&e.render()},this)},_clickOnAddForConnectorID:function(e,n){this.options.childRendered=!1;var i=this.getChildViews();_.each(i,function(e){e instanceof t.ConnectorsCollectionNoAddStorageView&&e._clickOnAddForConnectorID(n.connectorId)},this)},_checkShouldClickOnAddForConnectorID:function(){this.options.appApi.rnaApi.done(_.bind(function(e){e.invokeMethod({methodName:"checkShouldClickOnAddForConnectorID",methodArgs:""}).done(_.bind(function(e){if(e&&e.length){var t={};t.connectorId=e,this._clickOnAddForConnectorID(null,t)}},this))},this))}}),t.PluginView}),define("acplugins/add-account/js/add-account",["acplugins/add-account/js/ac-add-account","acplugins/add-account/js/ops/op-factory","acplugins/add-account/js/views/plugin-view"],function(e){_.extend(e,{init:function(){return void(e.opFactory=new e.OpFactory)}})}),define("acplugins/add-account-select/js/views/plugin-view",["acplugins/add-account/js/ac-add-account","acplugins/add-account-select/js/ac-add-account-select","acplugins/add-account/js/views/plugin-view"],function(e,t){return t.PluginView=e.PluginView.extend({initialize:function(){e.PluginView.prototype.initialize.call(this),_.extend(this.options,{noUrlUpdate:!0})},render:function(){return this.$el.addClass("add-account-select"),e.PluginView.prototype.render.call(this),this},selectPlugin:function(){var t=this.options.appApi.saveAsApi;return t.isRunningInFileSaveAs()&&t.setCanSave(!1),this.options.appApi.done(_.bind(function(){this.options.appApi.displayApi.showSpinner(!1)},this)),e.PluginView.prototype.selectPlugin.call(this),this._getResolvedPromise()}}),t.PluginView}),define("acplugins/add-account-select/js/add-account-select",["acplugins/add-account/js/ac-add-account","acplugins/add-account-select/js/ac-add-account-select","acplugins/add-account/js/views/plugin-view","acplugins/add-account-select/js/views/plugin-view"],function(e,t){_.extend(t,{init:function(){e.init()}})}),define("acplugins/add-account-select/js/plugin",["acplugins/add-account/js/ac-add-account","acplugins/add-account-select/js/ac-add-account-select","acplugins/add-account/js/add-account","acplugins/add-account-select/js/add-account-select"],function(e,t){t.init()});