/*************************************************************************
* 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 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 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 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 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 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 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 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.
 **************************************************************************/

/*************************************************************************
 * 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 copyright laws.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

define("digsig/js/ac-digsig",["plugins-common/ac-plugins"],function(i){var e=i.DigSig;return e||(i.DigSig=e={}),e.Reader||(e.Reader={}),e.APP_API_VERSION="dev",e}),define("digsig/js/constants/digsig-constants",{CONFIGURE_DIGITAL_ID_DIALOG:"CONFIGURE_DIGITAL_ID_DIALOG",SIGNATURE_CREATION_DEVICE_DIALOG:"SIGNATURE_CREATION_DEVICE_DIALOG",FIND_DIGITAL_ID:"FIND DIGITAL ID",ADD_DIGITAL_ID_FILE:"ADD_DIGITAL_ID_FILE",ADD_DIGITAL_ID_SIGNATURE_DEVICE:"ADD_DIGITAL_ID_SIGN_DEVICE",CREATE_SELF_SIGNED_ID_OPTIONS:"CREATE_SELF_SIGNED_ID_OPTIONS",CREATE_SELF_SIGNED_ID_FILE:"CREATE_SELF_SIGNED_ID_FILE",CREATE_SELF_SIGNED_ID_KEYCHAIN:"CREATE_SELF_SIGNED_ID_KEYCHAIN",SAVE_DIGITAL_ID:"SAVE_DIGITAL_ID"}),define("digsig/js/models/ui/digsig-ui-model",["core/ac-core","digsig/js/ac-digsig","digsig/js/constants/digsig-constants","core/models/ui/ui-model"],function(i,e,t){return e.DigSigUiModel=i.UiModel.extend({recognized:{Currentdialog:{type:"object",optional:!1},dialogsStack:{type:"array",optional:!1},reasonText:{type:"string",optional:""},locationText:{type:"string",optional:""},contactInfo:{type:"string",optional:""},appearanceIndex:{type:"number",optional:0},selectedId:{type:"number",optional:0},digitalIdName:{type:"string",optional:""},isShowPassword:{type:"boolean",optional:!0},mode:{type:"number",optional:0},lockDocument:{type:"boolean",optional:!1},isCertifyingSignature:{type:"boolean",optional:!1},isReasonControlEnabled:{type:"boolean",optional:!1},isReasonControlEditable:{type:"boolean",optional:!1},hasReasonSeedValue:{type:"boolean",optional:!1},isLocationContactControlEnabled:{type:"boolean",optional:!1},selectedApText:{type:"string",optional:""},lockDocControlEnabled:{type:"boolean",optional:!0},lockDocControlVal:{type:"boolean",optional:!1},lockDocControlVisible:{type:"boolean",optional:!0},savedLocationText:{type:"string",optional:!0},savedContactInfoText:{type:"string",optional:!0},isMDPEnabled:{type:"boolean",optional:!0},selectedMDPSetting:{type:"number",optional:1},isSinatureVisible:{type:"boolean",optional:!0},isAppearanceMenuEnabled:{type:"boolean",optional:!0},disableAppearanceModification:{type:"boolean",optional:!0},requireDocWarningReviewed:{type:"boolean",optional:!1},isShowReviewSection:{type:"boolean",optional:!0},numofAppearances:{type:"number",optional:1},selectedCustomPreview:{type:"string",optional:""},docWindowWidth:{type:"number",optional:1},docWindowHeight:{type:"number",optional:1},nativeDigitsSelIndex:{type:"number",optional:0},isSigned:{type:"boolean",optional:!1},isBlank:{type:"boolean",optional:!1},disableSelfSignFilepath:{type:"boolean",optional:!0}},defaults:{Currentdialog:{name:t.CONFIGURE_DIGITAL_ID_DIALOG,prev:{name:""}},dialogsStack:[],reasonText:"",locationText:"",contactInfo:"",appearanceIndex:0,selectedId:0,digitalIdName:"",isShowPassword:!0,mode:0,lockDocument:!1,isCertifyingSignature:!1,isReasonControlEnabled:!1,isReasonControlEditable:!1,hasReasonSeedValue:!1,isLocationContactControlEnabled:!1,selectedApText:"",lockDocControlEnabled:!0,lockDocControlVal:!1,lockDocControlVisible:!0,savedLocationText:"",savedContactInfoText:"",isMDPEnabled:!0,selectedMDPSetting:1,isSinatureVisible:!0,isAppearanceMenuEnabled:!0,disableAppearanceModification:!1,requireDocWarningReviewed:!1,isShowReviewSection:!0,numofAppearances:0,selectedCustomPreview:"",docWindowHeight:0,docWindowWidth:0,nativeDigitsSelIndex:0,isSigned:!1,isBlank:!1,disableSelfSignFilepath:!0},initialize:function(e,t){this.options=t,i.UiModel.prototype.initialize.call(this,e)},init:function(i){this.set(_.extend({},this.defaults,i)),_.bindAll(this)},reset:function(){this.clear({silent:!0}),this.set(this.defaults,{silent:!0})}}),e.DigSigUiModel}),define("digsig/js/ops/plugin/starting-plugin-op",["core/ac-core","files/ac-files","digsig/js/ac-digsig","core/ops/op","digsig/js/models/ui/digsig-ui-model"],function(i,e,t){t.StartingPluginOp=i.Op.extend({run:function(){var n=i.modelFactory,s=i.uiModelFactory,o=e.uiModelFactory;return _.extend(this.options,{baseCloudUrisModel:n.create("BaseCloudUrisModel"),baseFilesUrisModel:n.create("BaseFilesUrisModel"),folderModel:n.create("FolderModel"),collectionsUiModel:s.create("CollectionsUiModel"),dialogsUiModel:s.create("DialogsUiModel"),folderUiModel:s.create("FolderUiModel"),hoverPreviewUiModel:s.create("HoverPreviewUiModel"),keyUiModel:s.create("KeyUiModel"),searchUiModel:s.create("SearchUiModel"),selectionUiModel:s.create("SelectionUiModel"),sortUiModel:s.create("SortUiModel"),filesUiModel:o.create("FilesUiModel"),DigSigUiModel:t.modelFactory.create("DigSigUiModel")}),$.Deferred().resolve().promise()}})}),define("digsig/js/views/view-events",["digsig/js/ac-digsig"],function(i){i.ViewEvents={CLOSE_DIGSIG_DIALOG:"DigSig:close-digsig-dialog",VIEW_DETAILS_FOR_IDENTITY:"DigSig:view-details",DIGSIG_FIRST_RIGHT_BUTTON_CLICK:"DigSig:first-right-button-click",DIGSIG_SECOND_RIGHT_BUTTON_CLICK:"DigSig:second-right-button-click",DIGSIG_THIRD_RIGHT_BUTTON_CLICK:"DigSig:third-right-button-click",DIGSIG_FIRST_LEFT_BUTTON_CLICK:"DigSig:first-left-button-click"}}),define("digsig/js/ops/listening-for-view-events-op",["core/ac-core","digsig/js/ac-digsig","core/ops/op","core/views/view-events","digsig/js/views/view-events","digsig/js/ops/op-factory"],function(i,e){e.ListeningForViewEventsOp=i.Op.extend({initialize:function(){i.Op.prototype.initialize.call(this),this._initEventMap()},run:function(){var i=$.Deferred();return this.options.rootView.on("all",this._onViewEvent),this._deferred=i,i.promise()},_onViewEvent:function(i,e){var t,n;t=this._eventMap[i],t&&(n=t[0].create(t[1],e)),n&&n.run().then(function(){return void 0},function(){return void 0})},_mapEvent:function(i,e,t,n,s){i[e]=[t,n,s]},_initEventMap:function(){var i,t,n,s;i=this._eventMap={},t=this._mapEvent,n=e.opFactory,s=e.ViewEvents,t(i,s.CLOSE_DIGSIG_DIALOG,n,"CloseDigSigDialogOp"),t(i,s.VIEW_DETAILS_FOR_IDENTITY,n,"LaunchViewDetailsDialogOp")}})}),define("digsig/js/nls/ui-strings",{root:!0,"ar-ae":!0,"bg-bg":!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}),define("digsig/js/nls/root/ui-strings",{IDENTITY_LIST_HEADER_TEXT:"Sign with a Digital ID",IDENTITY_LIST_DESCRIPTION:"Choose the Digital ID that you want to use for signing:",REFRESH_BUTTON_TEXT:"Refresh",CANCEL_BUTTON_TEXT:"Cancel",BACK_BUTTON_TEXT:"Back",CONTINUE_BUTTON_TEXT:"Continue",SAVE_BUTTON_TEXT:"Save",CREATE_NEW_BUTTON_TEXT:"Create New Digital ID",CONFIGURE_NEW_BUTTON_TEXT:"Configure New Digital ID",MANAGE_DIGITAL_ID_BUTTON_TEXT:"Manage Digital ID",HELP_BUTTON_TEXT:"Help",VIEW_DETAILS_LINK_TEXT:"View Details",NO_IDENTITY_LABEL:"No Identities Found. Please create New Identity.",CONFIGURE_DIALOG_HEADER:"Configure a Digital ID for signing",CONFIGURE_DIALOG_LEFT_SIDE_DESCIPTION:"A Digital ID is required to create a digital signature.The most secure Digital ID are issued by trusted Certificate authorities and are based on secure devices like smart card or token. Some are based on files.",CONFIGURE_DIALOG_LEFT_SIDE_SUB_DESCIPTION:"You can also create a new Digital ID, but they provide a low level of identity assurance.",CONFIGURE_DIALOG_OPTIONS_INTRO:"Select the type of Digital ID:",CONFIG_OPTION_1_HEADING:"Use a Signature Creation Device",CONFIG_OPTION_1_SUB_HEADING:"Configure a smart card or token connected to your computer",CONFIG_OPTION_2_HEADING:"Use a Digital ID from a file",CONFIG_OPTION_2_SUB_HEADING:"Import an existing Digital ID that you have obtained as a file",CONFIG_OPTION_3_HEADING:"Create a new Digital ID",CONFIG_OPTION_3_SUB_HEADING:"Create your self-signed Digital ID",SIGNATURE_CREATION_DEVICE_DIALOG_HEADER:"Use a Signature Creation Device",SIGNATURE_CREATION_DEVICE_DIALOG_LEFT_SIDE_DESCIPTION:"Digital ID from hardware Signature Creation Devices like smart card and USB token should be automatically available for use as long as the device is properly connected.",SIGNATURE_CREATION_DEVICE_DIALOG_LEFT_SIDE_SUB_DESCIPTION:"Follow these steps or ask the device manufacturer for assistance in case additional configuraiton is required.",SIGNATURE_CREATION_OPTION_1_HEADING:"Order a Signature Device from a Partner",SIGNATURE_CREATION_OPTION_1_SUB_HEADING:"If you do not have a signature device, you can order one from our partners. ",SIGNATURE_CREATION_OPTION_2_HEADING:"Download & Install Drivers",SIGNATURE_CREATION_OPTION_2_SUB_HEADING:"Make sure that you have downloaded and installed all the necessary drivers. Visit the website of the device manufacturer for help.",SIGNATURE_CREATION_OPTION_3_HEADING:"Connect the Signature Device",SIGNATURE_CREATION_OPTION_3_SUB_HEADING:"Make sure that signature device is properly connected to your computer. Smart card may require a reader.",CONNECTED_HARDWARE_HEADING:"Connected Hardware",CONNECTED_HARDWARE_SUB_HEADING:"Make sure that your device is connected to your computer through USB port",CONNECTED_DEVICE_DRIVER_HEADING:"Download & Install Drivers",CONNECTED_DEVICE_DRIVER_SUB_HEADING:"Make sure that you have downloaded and installed all the necessary drivers. Visit the website of the device manufacturer for help",CONNECTED_DEVICE_ORDER_HEADING:"Order a Device from a Partner",CONNECTED_DEVICE_ORDER_SUBHEADING:"if you donot have a connected device, you can order from one of our partners.",FIND_DIGITAL_ID_HEADER:"Find a Digital ID file",FIND_DIGITAL_ID_BROWSE_HEADING:"Browse for a Digital ID file. Digital ID files are password protected. You cannot access the Digital ID if you don't know its password.",FIND_DIGITAL_ID_PASSWORD_HEADING:"Enter the Digital ID password",BROWSE_BUTTON:"Browse",FIND_DIGITAL_ID_LEFT_PANE_DESCIPTION:"Digital ID files generally have a PFX or P12 extension and contain the public key file (Certificate) and the associated private key file.",FIND_DIGITAL_ID_LEFT_PANE_SUB_DESCIPTION:"To sign with a digital ID available as a file, follow the prompts to browse and select the file and type the password protecting the private key.",CREATE_LOCAL_CERTIFICATE_HEADER:"Create a self-signed Digital ID",ADD_DIGITAL_ID_FILE_HEADER:"Add Digital IDs from a file",ADD_DIGITAL_ID_SIGNATURE_DEVICE_HEADER:"Add Digital IDs from a Signature Creation Device",ADD_DIGITAL_ID_DESC:"The following Digital ID will be added to your list of Digital ID that you can use for digitally signing:",SAVE_DIGITAL_ID_HEADER:"Save the self-signed Digital ID to a file",SAVE_DIGITAL_ID_BROWSE_HEADING:"Your Digital ID will be saved at the following location :",SAVE_DIGITAL_ID_PASSWORD:"Apply a password to protect the Digital ID:",SAVE_DIGITAL_ID_CONFIRM_PASSWORD:"Confirm the password:",CREATE_OPTIONS_HEADER:"Select the destination of the new Digital ID",CREATE_OPTIONS_LEFT_PANE_DESCRIPTION:"Digital IDs are typically issued by trusted providers that assure the validity of the identity.<br> Self-signed Digital ID may not provide the same level of assurance and may not be accepted in some use cases.",CREATE_OPTIONS_LEFT_PANE_SUB_DESCRIPTION:"Consult with your recipients if this is an acceptable form of authentication.",CREATE_FORM_LEFT_PANE_DESCRIPTION:"Enter the identity information to be used for creating the self-signed Digital ID.",CREATE_FORM_LEFT_PANE_SUB_DESCRIPTION:"Digital IDs that are self-signed by individuals do not provide the assurance that the identity information is valid. For this reason they may not be accepted in some use cases.",SAVE_DIALOG_LEFT_PANE_DESCRIPTION:"Add a password to protect the private key of the Digital ID. You will need this password again to use the Digital ID for signing.",SAVE_DIALOG_LEFT_PANE_SUB_DESCRIPTION:"Save the Digital ID file in a known location so that you can copy it or back it up.",SAVE_TO_APPLE_KEYCHAIN_HEADER:"Save to Apple Keychain",SAVE_TO_APPLE_KEYCHAIN_DESC:"Save the Digital ID to Apple Keychain to be shared with other applications",SAVE_TO_FILE_HEADER:"Save to File",SAVE_TO_FILE_DESC:"Save the Digital ID to a file in your computer",SAVE_TO_WIN_HEADER:"Save to Windows Certificate Store",SAVE_TO_WIN_DESC:"Save the Digital ID to Windows Certificate Store to be shared with other applications",EXPIRE_TEXT:"Expires",FILE_PASSWORD_ERROR:"Password is incorrect. Please re-enter the password.",SAVE_FILE_PASSWORD_MISMATCH:"Passwords do not match",ISSUED_BY_TEXT:"Issued by:",LEARN_MORE_TEXT:"Learn More",NAME_LABEL_TEXT:"Name",ORG_UNIT_LABEL_TEXT:"Organizational Unit",ORG_NAME_LABEL_TEXT:"Organization Name",EMAIL_ADDRESS_LABEL_TEXT:"Email Address",COUNTRY_LABEL_TEXT:"Country/Region",KEY_ALGO_LABEL_TEXT:"Key Algorithm",KEY_USAGE_LABEL_TEXT:"Use Digital ID for",NAME_PLACEHOLDER_TEXT:"Enter Name...",ORG_UNIT_PLACEHOLDER_TEXT:"Enter Organizational Unit...",ORG_NAME_PLACEHOLDER_TEXT:"Enter Organization Name...",EMAIL_ADDRESS_PLACEHOLDER_TEXT:"Enter Email...",SIGN_AS_TEXT:"Sign as ",APPEARANCE_LABEL_TEXT:"Appearance",EDIT_BUTTON_TEXT:"Edit",CREATE_BUTTON_TEXT:"Create",VIEW_CERTIFICATE_DETAILS_LABEL_TEXT:"View Certificate Details",LOCK_DOCUMENT_AFTER_SIGNING_LABEL_TEXT:"Lock document after signing",REASON_LABEL_TEXT:"Reason",LOCATION_LABEL_TEXT:"Location",CONTACT_INFO_LABEL_TEXT:"Contact Info",PERMITTED_ACTION_AFTER_SIGNING_LABEL_TEXT:"Permitted Actions After Certifying",REVIEW_DOCUMENT_CONTENT_LABEL_TEXT:"Review document content that may affect signing",DOCUMENT_HAS_BEEN_REVIEWED_LABEL_TEXT:"Document warnings have been reviewed",REVIEW_BUTTON_TEXT:"Review",SIGNING_DIALOG_PASSWORD_PLACEHOLDER_TEXT:"Enter the Digital ID PIN or Password...",SIGN_BUTTON_TEXT:"Sign",CUTOMIZE_DIALOG_TITLE_TEXT:"Customize the Signature Appearance",TEXT_BUTTON_TEXT:"Text",IMAGE_BUTTON_TEXT:"Image",DRAW_BUTTON_TEXT:"Draw",NONE_BUTTON_TEXT:"None",INCLUDE_TEXT_LABEL_TEXT:"Include Text",NAME_CHECKBOX_LABEL_TEXT:"Name",DATE_CHECKBOX_LABEL_TEXT:"Date",LOCATION_CHECKBOX_LABEL_TEXT:"Location",REASON_CHECKBOX_LABEL_TEXT:"Reason",DN_CHECKBOX_LABEL_TEXT:"Distinguished Name",VERSION_CHECKBOX_LABEL_TEXT:"Adobe Acrobat Version",LOGO_CHECKBOX_LABEL_TEXT:"Logo",LABEL_CHECKBOX_LABEL_TEXT:"Labels",DIGITS_FORMAT_LABEL_TEXT:"Digits format",DIGITS_LABEL_TEXT:"Digits",TEXT_DIRECTION_LABEL_TEXT:"Text Direction",AUTO_LABEL_TEXT:"Auto",CLEAR_LABEL_TEXT:"Clear",PRESET_NAME_TEXT:"Preset name",OK_BUTTON_TEXT:"OK",CLICK_TO_DRAW_TEXT:"Click here to Draw",APPLY_BUTTON_TEXT:"Apply",INVALID_EMAIL_ADDRESS:"Email address is not valid",PASSWORD_LENGTH_ERROR:"Inadequate password. Password must be at least six characters long",CERTIFICATE_ANNOT_WARNING:"Annotations can be used to add visual elements to the document that may appear as original content. Are you sure you want to permit adding Annotations after certifying?"}),define("digsig/js/ops/close-digsig-dialog-op",["core/ac-core","files/ac-files","digsig/js/ac-digsig","i18n!digsig/js/nls/ui-strings","core/ops/op"],function(i,e,t){t.CloseDigSigDialogOp=i.Op.extend({run:function(){var i=this.options.args;return this.options.appApi.rnaApi.done(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"closeDigSigCEFDialog",methodArgs:i})})}})}),define("digsig/js/ops/launch-view-identity-details-op",["core/ac-core","files/ac-files","digsig/js/ac-digsig","i18n!digsig/js/nls/ui-strings","core/ops/op"],function(i,e,t){t.LaunchViewDetailsDialogOp=i.Op.extend({run:function(i){return this.options.appApi.rnaApi.done(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"showDetailsDigSigCEFDialog",methodArgs:i})})}})}),define("digsig/js/ops/op-factory",["core/ac-core","digsig/js/ac-digsig","digsig/js/ops/plugin/starting-plugin-op","digsig/js/ops/listening-for-view-events-op","digsig/js/ops/close-digsig-dialog-op","digsig/js/ops/launch-view-identity-details-op"],function(i,e){e.OpFactory=i.Op.extend({create:function(i,t){var n=e[i];return n?new n(t):void LOG(0,"AcDigSig.OpFactory.create: Unrecognized class: "+i)}})}),define("digsig/js/models/model-factory",["core/ac-core","digsig/js/ac-digsig","digsig/js/models/ui/digsig-ui-model"],function(i,e){e.ModelFactory=i.Model.extend({create:function(i,t,n){var s=e[i];return s?(console.log("new model created"),new s(t,n)):void LOG.error("AcDigSig.ModelFactory.create: Unrecognized class: "+i)}})}),define("digsig/js/models/identity-model",["digsig/js/ac-digsig","core/ac-core"],function(i,e){return i.IdentityModel=e.Model.extend({idAttribute:"Id",defaults:{image:"identity-image",Id:"",name:"",credential_type:"",issued_by:"",expiration_date:"",show_password:!0,is_selected:!1,credential_type_id:0},fetch:function(){return $.Deferred().resolve().promise()},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()}}),i.IdentityModel}),define("digsig/js/collection/identity-collection",["digsig/js/ac-digsig","core/ac-core","i18n!digsig/js/nls/ui-strings","digsig/js/models/identity-model"],function(i,e){return i.IdentityCollection=e.Collection.extend({model:i.IdentityModel,fetch:function(e,t){this.reset();var n;return $.each(e,_.bind(function(s){var o=e[s];n={Id:o.Id,name:o.name,credential_type:o.credential_type,issued_by:o.issued_by,expiration_date:o.expiration_date,show_password:o.show_password,credential_type_id:o.credential_type_id},o.Id==t&&(n.is_selected=!0),this.push(new i.IdentityModel(n))},this)),$.Deferred().resolve().promise()}}),i.IdentityCollection}),define("digsig/js/identity-list",["core/ac-core","digsig/js/ac-digsig","i18n!digsig/js/nls/ui-strings"],function(i,e){var t={Id:"0",name:"Peter Baird",credential_type:"Local Credential",issued_by:"Peter Baird",expiration_date:"2019.05.19",show_password:!1},n={Id:"1",name:"Arjun Malik",credential_type:"Online Credential",issued_by:"Arjun Malik",expiration_date:"2018.05.19",show_password:!1},s={Id:"2",name:"Avinash Gupta",credential_type:"Local Credential",issued_by:"Avinash Gupta",expiration_date:"2017.05.19",show_password:!1},o={Id:"3",name:"Rahul Gandhi",credential_type:"Online Credential",issued_by:"Rahul Gandhi",expiration_date:"2016.05.19",show_password:!1},a={Id:"4",name:"Rahul Dubey",credential_type:"Local Credential",issued_by:"Rahul Dubey",expiration_date:"2015.05.19",show_password:!1};e.IdentityList=[t,n,s,o,a]}),define("digsig/js/templates/configure-digital-id-template",[],function(){return'<div class="setup-option-intro theme-text"><b><%=setup_options_intro%></b></div><div class ="setup-option"><div class="setup-radio"><input name="setup-choice" id="configure_option_1" type="radio" value="1" checked="checked"/><label for="configure_option_1" id="setup-choice-label">  </label></div><div class="setup-details theme-digsig-list-background" tabindex="0" aria-labelledby="setup-name1 setup-description1"><div class="digsig-image setup-img-signature-device"></div><div class="setup-item"><div class="setup-name theme-text" id="setup-name1"><b><%=option1_heading%></b></div><div class="setup-description theme-text" id="setup-description1"><%=option1_sub_heading%></div></div></div></div><div class ="setup-option"><div class="setup-radio"><input name="setup-choice" id="configure_option_2" type="radio" value="2" /><label for="configure_option_2" id="setup-choice-label">  </label></div><div class="setup-details theme-digsig-list-background"  tabindex="0" aria-labelledby="setup-name2 setup-description2"><div class="digsig-image setup-img-from-file"></div><div class="setup-item"><div class="setup-name theme-text" id="setup-name2"><b><%=option2_heading%></b></div><div class="setup-description theme-text" id="setup-description2"><%=option2_sub_heading%></div></div></div></div><div class ="setup-option" id="setup-option-3"><div class="setup-radio"><input name="setup-choice" id="configure_option_3" type="radio" value="3" /><label for="configure_option_3" id="setup-choice-label">  </label></div><div class="setup-details theme-digsig-list-background" id="setup-details-3" tabindex="0" aria-labelledby="setup-name3 setup-description3"><div class="digsig-image setup-img-new-dig-id"></div><div class="setup-item"><div class="setup-name theme-text" id="setup-name3"><b><%=option3_heading%></b></div><div class="setup-description theme-text" id="setup-description3"><%=option3_sub_heading%></div></div></div></div>'}),define("digsig/js/templates/digsig-dialog-footer-template",[],function(){return'<div class="digsig-footer"><div id="digsig-dlg-left-btn1" class="digsig-button digsig-dlg-left-btn1 core-help-icon help-icon-img" tabindex="0" role="button" aria-label="Help"></div><div class="digsig-footer-right-set-buttons"><input class="digsig-button digsig-dlg-right-btn1 				 control-button button-grey				 theme-button-gray-label" 				 id="digsig-dlg-right-btn1" 				 type="button"				 aria-label="<%=FIRST_RIGHT_BUTTON_TEXT%>"				 value="<%=FIRST_RIGHT_BUTTON_TEXT%>" /><input class="digsig-button digsig-dlg-right-btn2 				 control-button button-grey 				 theme-button-gray-label" 				 id="digsig-dlg-right-btn2" 				 type="button"				 aria-label="<%=SECOND_RIGHT_BUTTON_TEXT%>"				 value="<%=SECOND_RIGHT_BUTTON_TEXT%>" /><input class="digsig-button digsig-dlg-right-btn3 				 control-button				 theme-button-label" 				 id="digsig-dlg-help-btn" 				 type="button"				 aria-label="<%=THIRD_RIGHT_BUTTON_TEXT%>"				 value="<%=THIRD_RIGHT_BUTTON_TEXT%>" /></div></div>'}),define("digsig/js/views/digsig-dialog-footer-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/digsig-dialog-footer-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants"],function(i,e,t,n,s,o){return e.ShowDigSigDialogFooterView=i.View.extend({events:{"click   .digsig-dlg-right-btn1":"_onFirstRightButtonClick","click   .digsig-dlg-right-btn2":"_onSecondRightButtonClick","click   .digsig-dlg-right-btn3":"_onThirdRightButtonClick","click   .digsig-dlg-left-btn1":"_onFirstLeftButtonClick","keydown .digsig-dlg-left-btn1":"_onFirstLeftButtonKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t),this._addUiModelEventListeners()},_initWrapper:function(){},render:function(){return this.$el.html(this._template({FIRST_RIGHT_BUTTON_TEXT:this.options.FIRST_RIGHT_BUTTON_TEXT,SECOND_RIGHT_BUTTON_TEXT:this.options.SECOND_RIGHT_BUTTON_TEXT,THIRD_RIGHT_BUTTON_TEXT:this.options.THIRD_RIGHT_BUTTON_TEXT,FIRST_LEFT_BUTTON_TEXT:this.options.FIRST_LEFT_BUTTON_TEXT})),this.options.shouldHideRightButton1&&this.$el.find(".digsig-dlg-right-btn1").hide(),this},_onFirstRightButtonClick:function(i){i&&1!==i.which||this._triggerViewEvent(e.ViewEvents.DIGSIG_FIRST_RIGHT_BUTTON_CLICK)},_onSecondRightButtonClick:function(i){i&&1!==i.which||this._triggerViewEvent(e.ViewEvents.DIGSIG_SECOND_RIGHT_BUTTON_CLICK)},_onThirdRightButtonClick:function(i){i&&1!==i.which||this._triggerViewEvent(e.ViewEvents.DIGSIG_THIRD_RIGHT_BUTTON_CLICK)},_onFirstLeftButtonClick:function(i){(1==i.which||32==i.keyCode||13==i.keyCode)&&this._triggerViewEvent(e.ViewEvents.DIGSIG_FIRST_LEFT_BUTTON_CLICK)},_onFirstLeftButtonKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onFirstLeftButtonClick(i)},_addUiModelEventListeners:function(){this.listenTo(this.options.DigSigUiModel,"change:Currentdialog",this._onDialogChanged)},_onDialogChanged:function(){var i=this.options.DigSigUiModel.get("Currentdialog"),e=this.$el.find(".digsig-dlg-left-btn1"),t=this.$el.find(".digsig-dlg-right-btn1"),n=this.$el.find(".digsig-dlg-right-btn2"),a=this.$el.find(".digsig-dlg-right-btn3");i.name==o.CONFIGURE_DIGITAL_ID_DIALOG?(t.hide(),n.val(s.CANCEL_BUTTON_TEXT),n.attr("aria-label",s.CANCEL_BUTTON_TEXT),a.val(s.CONTINUE_BUTTON_TEXT),a.attr("aria-label",s.CONTINUE_BUTTON_TEXT),e.val(s.HELP_BUTTON_TEXT),e.attr("aria-label",s.HELP_BUTTON_TEXT)):i.name==o.SIGNATURE_CREATION_DEVICE_DIALOG?(t.show(),t.val(s.MANAGE_DIGITAL_ID_BUTTON_TEXT),t.attr("aria-label",s.MANAGE_DIGITAL_ID_BUTTON_TEXT),n.val(s.BACK_BUTTON_TEXT),n.attr("aria-label",s.BACK_BUTTON_TEXT),a.val(s.CONTINUE_BUTTON_TEXT),a.attr("aria-label",s.CONTINUE_BUTTON_TEXT),e.val(s.HELP_BUTTON_TEXT),e.attr("aria-label",s.HELP_BUTTON_TEXT)):i.name==o.FIND_DIGITAL_ID?(t.show(),t.val(s.CREATE_NEW_BUTTON_TEXT),t.attr("aria-label",s.CREATE_NEW_BUTTON_TEXT),this.options.canCreateSSCert||t.hide(),n.val(s.BACK_BUTTON_TEXT),n.attr("aria-label",s.BACK_BUTTON_TEXT),a.val(s.CONTINUE_BUTTON_TEXT),a.attr("aria-label",s.CONTINUE_BUTTON_TEXT),e.val(s.HELP_BUTTON_TEXT),e.attr("aria-label",s.HELP_BUTTON_TEXT)):i.name==o.ADD_DIGITAL_ID_FILE||i.name==o.CREATE_SELF_SIGNED_ID_OPTIONS||i.name==o.CREATE_SELF_SIGNED_ID_FILE||i.name==o.ADD_DIGITAL_ID_SIGNATURE_DEVICE?(t.hide(),n.val(s.BACK_BUTTON_TEXT),n.attr("aria-label",s.BACK_BUTTON_TEXT),a.val(s.CONTINUE_BUTTON_TEXT),a.attr("aria-label",s.CONTINUE_BUTTON_TEXT),e.val(s.HELP_BUTTON_TEXT),e.attr("aria-label",s.HELP_BUTTON_TEXT)):(i.name==o.CREATE_SELF_SIGNED_ID_KEYCHAIN||i.name==o.SAVE_DIGITAL_ID)&&(t.hide(),n.val(s.BACK_BUTTON_TEXT),n.attr("aria-label",s.BACK_BUTTON_TEXT),a.val(s.SAVE_BUTTON_TEXT),a.attr("aria-label",s.SAVE_BUTTON_TEXT),e.val(s.HELP_BUTTON_TEXT),e.attr("aria-label",s.HELP_BUTTON_TEXT))}}),e.ShowDigSigDialogFooterView}),define("digsig/js/templates/digsig-dialog-header-template",[],function(){return'<div class="digsig-header"><span class="digsig-header-text theme-text" id="digsig-header-text"><%=Digsig_Header_Text%></span><span id="close-label" style="display:none">Close</span><span class="close-digsig-modal core-remove-x" tabindex="0" role="button" aria-labelledby="digsig-header-text close-label" aria-label="Close"></span></div><hr class="digsig-hr">'}),define("digsig/js/views/digsig-dialog-header-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/digsig-dialog-header-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants"],function(i,e,t,n,s,o){return e.ShowDigSigDialogHeaderView=i.View.extend({events:{"click   .close-digsig-modal":"_onDigSigCloseModalClick","keydown   .close-digsig-modal":"_onDigSigCloseModalKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t),this._addUiModelEventListeners()},_initWrapper:function(){},render:function(){return this.$el.html(this._template({Digsig_Header_Text:this.options.headerText})),this},_onDigSigCloseModalClick:function(i){return i&&"keydown"==i.type?void((13==i.keyCode||32==i.keyCode||0==i.keyCode)&&this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:"close"}})):void this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:"close"}})},_onDigSigCloseModalKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onDigSigCloseModalClick(i)},_addUiModelEventListeners:function(){this.listenTo(this.options.DigSigUiModel,"change:Currentdialog",this._onDialogChanged)},_onDialogChanged:function(){var i=this.options.DigSigUiModel.get("Currentdialog"),e=this.$el.find(".digsig-header-text");i.name==o.CONFIGURE_DIGITAL_ID_DIALOG?e.html(s.CONFIGURE_DIALOG_HEADER):i.name==o.SIGNATURE_CREATION_DEVICE_DIALOG?e.html(s.SIGNATURE_CREATION_DEVICE_DIALOG_HEADER):i.name==o.FIND_DIGITAL_ID?e.html(s.FIND_DIGITAL_ID_HEADER):i.name==o.ADD_DIGITAL_ID_FILE?e.html(s.ADD_DIGITAL_ID_FILE_HEADER):i.name==o.ADD_DIGITAL_ID_SIGNATURE_DEVICE?e.html(s.ADD_DIGITAL_ID_SIGNATURE_DEVICE_HEADER):i.name==o.CREATE_SELF_SIGNED_ID_FILE||i.name==o.CREATE_SELF_SIGNED_ID_KEYCHAIN?e.html(s.CREATE_LOCAL_CERTIFICATE_HEADER):i.name==o.CREATE_SELF_SIGNED_ID_OPTIONS?e.html(s.CREATE_OPTIONS_HEADER):i.name==o.SAVE_DIGITAL_ID&&e.html(s.SAVE_DIGITAL_ID_HEADER)}}),e.ShowDigSigDialogHeaderView}),define("digsig/js/views/configure-digital-id-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/configure-digital-id-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/collection/identity-collection"],function(i,e,t,n,s){e.CofigureDigitalIDDialogView=i.View.extend({events:{"click   input[name='setup-choice']":"_changedRadioButton","keydown .setup-details":"_handleKeyDownOnSetupItem","click .setup-details":"_SelectTheRadioButton"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t)},_initWrapper:function(){this.$rightBtn3=$el.find(".digsig-modal").find(".digsig-dlg-right-btn3")},render:function(){return i.View.prototype.render.call(this),0===this.$el.children().length&&this.$el.html(this._template({setup_options_intro:s.CONFIGURE_DIALOG_OPTIONS_INTRO,option1_heading:s.CONFIG_OPTION_1_HEADING,option1_sub_heading:s.CONFIG_OPTION_1_SUB_HEADING,option2_heading:s.CONFIG_OPTION_2_HEADING,option2_sub_heading:s.CONFIG_OPTION_2_SUB_HEADING,option3_heading:s.CONFIG_OPTION_3_HEADING,option3_sub_heading:s.CONFIG_OPTION_3_SUB_HEADING})),this._initWrapper(),this._UpdateControls(),this._disableCreatingSSCert(),this},_disableCreatingSSCert:function(){var i=this.options.canCreateSSCert;i||(this.$("#setup-details-3").attr("tabIndex",-1),this.$("#setup-option-3").addClass("option-disabled"))},_UpdateControls:function(){var i=this.$("input[name='setup-choice']").is(":checked");n.enableInput(this.$rightBtn3,i)},_changedRadioButton:function(i){var e;this._UpdateControls(),e=$(i.target.parentElement.nextElementSibling),_.isUndefined(e)||_.isEmpty(e)||e.focus()},_FocusOnIdentity:function(i){this._SelectTheRadioButton(i)},_SelectTheRadioButton:function(i){$(i.currentTarget.parentNode.childNodes[0].childNodes[0]).prop("checked","true"),this._UpdateControls()},_handleKeyDownOnSetupItem:function(i){var e=i.target;if(40==i.keyCode){if(e.parentNode.nextSibling&&!$(e.parentNode.nextSibling).hasClass("option-disabled")&&e.parentNode.nextSibling.hasChildNodes())return e.parentNode.nextSibling.childNodes[1].focus(),$(e.parentNode.nextSibling.childNodes[0].childNodes[0]).prop("checked",!0),this._UpdateControls(),!1}else if(38==i.keyCode){if(e.parentNode.previousSibling&&!$(e.parentNode.previousSibling).hasClass("option-disabled")&&e.parentNode.previousSibling.hasChildNodes())return e.parentNode.previousSibling.childNodes[1].focus(),$(e.parentNode.previousSibling.childNodes[0].childNodes[0]).prop("checked",!0),this._UpdateControls(),!1}else 32==i.keyCode&&this._SelectTheRadioButton(i)},_closeOnESC:function(){this.options.appApi.rnaApi.done(function(i){i.rnaFteAPI.invokeMethod({methodName:"shouldCloseOnESC",methodArgs:[!0]})})}})}),define("digsig/js/templates/local-certificate-dialog-template",[],function(){return'<div class="digsig-modal ui-theme theme-digsig-container"><div class="digsig-header-container"></div><div class="digsig-body-container"><div class="digsig-left-pane-container ui-theme theme-container-prominent"></div><div class="digsig-right-pane-container"><div class="right-sub-container" id="digsig-find-digital-id"></div><div class="right-sub-container" id="digsig-add-digital-id-file"></div><div class="right-sub-container" id="digsig-create-options-container"></div><div class="right-sub-container" id="digsig-configure-digital-id"></div><div class="right-sub-container" id="digsig-create-digital-id-form"></div><div class="right-sub-container" id="digsig-save-digital-id"></div><div class="right-sub-container" id="use-signature-creation-device"></div><div class="right-sub-container" id="digsig-add-digital-id-sign-device"></div></div></div><div class="digsig-footer-container"></div></div>'}),define("digsig/js/templates/digsig-left-pane-template",[],function(){return'<div class= "dialog-left-side-description theme-text"><%=dialog_left_side_description%></div><br><div  class= "dialog-left-side-sub-description theme-text" ><%=dialog_left_side_sub_description%></div>'}),define("digsig/js/views/digsig-left-pane-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/digsig-left-pane-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants"],function(i,e,t,n,s,o){return e.ShowDigSigDialogLeftPaneView=i.View.extend({events:{},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t),this._addUiModelEventListeners()
},_initWrapper:function(){},_addUiModelEventListeners:function(){this.listenTo(this.options.DigSigUiModel,"change:Currentdialog",this._onDialogChanged)},render:function(){return this.$el.html(this._template({dialog_left_side_description:this.options.dialog_left_side_description,dialog_left_side_sub_description:this.options.dialog_left_side_sub_description})),this},_onDialogChanged:function(){var i=this.options.DigSigUiModel.get("Currentdialog"),e=this.$el.find(".dialog-left-side-description"),t=this.$el.find(".dialog-left-side-sub-description");i.name==o.CONFIGURE_DIGITAL_ID_DIALOG?(e.html(s.CONFIGURE_DIALOG_LEFT_SIDE_DESCIPTION),t.html(s.CONFIGURE_DIALOG_LEFT_SIDE_SUB_DESCIPTION)):i.name==o.SIGNATURE_CREATION_DEVICE_DIALOG?(e.html(s.SIGNATURE_CREATION_DEVICE_DIALOG_LEFT_SIDE_DESCIPTION),t.html(s.SIGNATURE_CREATION_DEVICE_DIALOG_LEFT_SIDE_SUB_DESCIPTION)):i.name==o.FIND_DIGITAL_ID?(e.html(s.FIND_DIGITAL_ID_LEFT_PANE_DESCIPTION),t.html(s.FIND_DIGITAL_ID_LEFT_PANE_SUB_DESCIPTION)):i.name==o.CREATE_SELF_SIGNED_ID_OPTIONS?(e.html(s.CREATE_OPTIONS_LEFT_PANE_DESCRIPTION),t.html(s.CREATE_OPTIONS_LEFT_PANE_SUB_DESCRIPTION)):i.name==o.CREATE_SELF_SIGNED_ID_FILE||i.name==o.CREATE_SELF_SIGNED_ID_KEYCHAIN?(e.html(s.CREATE_FORM_LEFT_PANE_DESCRIPTION),t.html(s.CREATE_FORM_LEFT_PANE_SUB_DESCRIPTION)):i.name==o.SAVE_DIGITAL_ID&&(e.html(s.SAVE_DIALOG_LEFT_PANE_DESCRIPTION),t.html(s.SAVE_DIALOG_LEFT_PANE_SUB_DESCRIPTION))}}),e.ShowDigSigDialogLeftPaneView}),define("digsig/js/templates/local-certificate-create-new-options-template",[],function(){return'<div class="create-new-options"><div class ="setup-option"><div class="setup-radio"><input name="create-choice" id="create_option_1" type="radio" value="1" checked="checked"/><label for="create_option_1" id="create-choice-label">  </label></div><div class="setup-details theme-digsig-list-background" tabindex="0"><div class="digsig-image create-img-file"></div><div class="setup-item"><div class="setup-name theme-text"><b><%=save_option_1_heading%></b></div><div class="setup-description theme-text"><%=save_option_1_desc%></div></div></div></div><div class ="setup-option" ><div class="setup-radio"><input name="create-choice" id="create_option_2" type="radio" value="2" checked="checked"/><label for="create_option_2" id="create-choice-label">  </label></div><div class="setup-details theme-digsig-list-background"  tabindex="0"><div id="create-img" class="digsig-image"></div><div class="setup-item"><div class="setup-name theme-text"><b><%=save_option_2_heading%></b></div><div class="setup-description theme-text"><%=save_option_2_desc%></div></div></div></div></div>'}),define("digsig/js/views/local-certificate-create-new-options-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/local-certificate-create-new-options-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/views/digsig-left-pane-view","digsig/js/collection/identity-collection"],function(i,e,t,n,s){e.LocalCertificateCreateNewOptionsView=i.View.extend({events:{"click   input[name='create-choice']":"_changedRadioButton","keydown .setup-details":"_handleKeyDownOnSetupItem","click   .setup-details":"_SelectTheRadioButton"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t)},_initWrapper:function(){console.log("in Identity view initialize"),this.$rightBtn3=$el.find(".digsig-modal").find(".digsig-dlg-right-btn3")},render:function(){var e,t;return i.View.prototype.render.call(this),0===this.$el.children().length&&(i.Util.isWindows()?(e=s.SAVE_TO_WIN_HEADER,t=s.SAVE_TO_WIN_DESC):(e=s.SAVE_TO_APPLE_KEYCHAIN_HEADER,t=s.SAVE_TO_APPLE_KEYCHAIN_DESC),this.$el.html(this._template({save_option_1_heading:s.SAVE_TO_FILE_HEADER,save_option_1_desc:s.SAVE_TO_FILE_DESC,save_option_2_heading:e,save_option_2_desc:t}))),this._initWrapper(),this._UpdateControls(),this._UpdateImageAsPerWinOrMac(),this},_UpdateImageAsPerWinOrMac:function(){this.$("#create-img").addClass(i.Util.isWindows()?"create-img-win":"create-img-mac")},_UpdateControls:function(){var i=this.$("input[name='create-choice']").is(":checked");n.enableInput(this.$rightBtn3,i)},_changedRadioButton:function(i){var e;this._UpdateControls(),e=$(i.target.parentElement.nextElementSibling),_.isUndefined(e)||_.isEmpty(e)||e.focus()},_FocusOnIdentity:function(i){this._SelectTheRadioButton(i)},_SelectTheRadioButton:function(i){$(i.currentTarget.parentNode.childNodes[0].childNodes[0]).prop("checked","true"),this._UpdateControls()},_handleKeyDownOnSetupItem:function(i){var e=i.target;if(40==i.keyCode){if(e.parentNode.nextSibling&&e.parentNode.nextSibling.hasChildNodes())return e.parentNode.nextSibling.childNodes[1].focus(),$(e.parentNode.nextSibling.childNodes[0].childNodes[0]).prop("checked",!0),this._UpdateControls(),!1}else if(38==i.keyCode){if(e.parentNode.previousSibling&&e.parentNode.previousSibling.hasChildNodes())return e.parentNode.previousSibling.childNodes[1].focus(),$(e.parentNode.previousSibling.childNodes[0].childNodes[0]).prop("checked",!0),this._UpdateControls(),!1}else 32==i.keyCode&&this._SelectTheRadioButton(i)}})}),define("digsig/js/templates/use-local-certificate-template",[],function(){return'<div class="local-files"><div id="findDigitalIDDesc" class="browse-description theme-text"><%=browse_heading%></div><br><div class="browse-id-block"><input type="text" class="browse-id-input theme-input-box theme-text " id="browse-file-input" aria-label="Browser for the File"><input class="digsig-button browser-id-button        control-button button-grey         theme-button-gray-label"         type="button"        aria-labelledby="findDigitalIDDesc"        value="<%=browse_button%>" /></div><div id="findDigitalIDPasswordInput" class="password-description theme-text"><%=password_heading%></div><input type="password" class="password-input theme-input-box theme-text " id="browse-file-password" aria-labelledby="findDigitalIDPasswordInput"><div class="password-error-heading theme-error-message" id="file-password-error"><%=password_error_heading%></div></div>'}),define("digsig/js/views/use-local-certificate-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/use-local-certificate-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/views/digsig-left-pane-view","digsig/js/collection/identity-collection","digsig/js/views/local-certificate-create-new-options-view"],function(i,e,t,n,s,o){e.UseLocalCertificateView=i.View.extend({events:{"click    .browser-id-button":"_onBrowseButtonClick","click    .create-new-file":"_onCreateNewFileClick","focusin   input#browse-file-password":"_removePasswordErrorLabel","change   input#browse-file-input":"_FilePathValueChanged","change   input#browse-file-password":"_PasswordValueChanged","input   input#browse-file-input":"_FilePathValueChanged","input   input#browse-file-password":"_PasswordValueChanged","paste   #browse-file-password":"_PasswordPaste"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t)},_initWrapper:function(){this.$FilePathInput=this.$("#browse-file-input"),this.$passwordInput=this.$("#browse-file-password"),this.$rightBtn3=$el.find(".digsig-modal").find(".digsig-dlg-right-btn3")},render:function(){return i.View.prototype.render.call(this),0===this.$el.children().length&&this.$el.html(this._template({browse_button:s.BROWSE_BUTTON,browse_heading:s.FIND_DIGITAL_ID_BROWSE_HEADING,password_heading:s.FIND_DIGITAL_ID_PASSWORD_HEADING,password_error_heading:s.FILE_PASSWORD_ERROR})),this._initWrapper(),this._UpdateControls(),this._DisableInputBoxIfReader(),this},_DisableInputBoxIfReader:function(){i.Util.isReader()&&this.$FilePathInput.prop("disabled",!0)},_removePasswordErrorLabel:function(){this.$("#file-password-error").hide()},_selectAndOpenFile:function(){this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"showOpenDialogDigitalId",methodArgs:this.$FilePathInput.val()}).done(_.bind(function(i){void 0!=i.selected_path&&(this.$FilePathInput.val(i.selected_path),this._UpdateControls())},this))},this))},_onBrowseButtonClick:function(){this._selectAndOpenFile()},_onCreateNewFileClick:function(){var i={name:o.CREATE_LOCAL_CERTIFICATE_OPTIONS,prev:this.options.DigSigUiModel.get("Currentdialog").name};this.options.DigSigUiModel.set("Currentdialog",i)},_UpdateControls:function(){var i=!1;this.$FilePathInput.val().length&&this.$passwordInput.val().length&&(i=!0),this.$FilePathInput.val().length>0?this.$FilePathInput.css("border-color","#cbcbcb"):this.$FilePathInput.css("border-color","#DD9090"),this.$passwordInput.val().length>0?this.$passwordInput.css("border-color","#cbcbcb"):this.$passwordInput.css("border-color","#DD9090"),n.enableInput(this.$rightBtn3,i)},_FilePathValueChanged:function(){this._UpdateControls()},_PasswordValueChanged:function(){this._UpdateControls()},_PasswordPaste:function(){setTimeout(_.bind(function(){this._UpdateControls()},this),100)},_handleKeyDownOnSetupItem:function(i){var e=i.target;if(40==i.keyCode){if(e.parentNode.nextSibling&&e.parentNode.nextSibling.hasChildNodes())return e.parentNode.nextSibling.childNodes[1].focus(),!1}else if(38==i.keyCode&&e.parentNode.previousSibling&&e.parentNode.previousSibling.hasChildNodes())return e.parentNode.previousSibling.childNodes[1].focus(),!1}})}),define("digsig/js/templates/add-digital-id-from-file-template",[],function(){return'<div class="add-file-id-container"><div class="add-file-id-list-desc theme-text"><%=add_file_id_desc%></div><div class="file-identity-list-details"></div></div>'}),define("digsig/js/templates/add-digital-id-template",[],function(){return'<div class ="identity-container" id="<%= Id %>" tabindex="0"><div class="digsig-image" id="identity-img<%= Id %>"></div><div class="identity-details"><div class="identity-name theme-list-item-text"><span class="identity-name-text"><%= name %></span> </div><div class="identity-issue-details theme-list-item-text"><span class="issued-by-text"><%=issued_by_text%></span> <span class="issued-by-name"><%= issued_by %></span>, <span class="expire-details"><%=expire_string%>: <%=expiration_date%> </span></div></div><a id="<%= viewId %>" class="identity-view-details theme-hyperlink" tabindex="0" role="link"><%=add_view_details_text%></a></div>'}),define("digsig/js/views/add-digital-id-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/add-digital-id-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/views/digsig-left-pane-view","digsig/js/collection/identity-collection","digsig/js/views/local-certificate-create-new-options-view"],function(i,e,t,n,s){e.AddDigitalIDView=i.View.extend({events:{},initialize:function(){i.View.prototype.initialize.call(this),this.model=this.options.model,this._template=_.template(t)},_initWrapper:function(){},render:function(){return i.View.prototype.render.call(this),this.$el.append(this._template({Id:this.model.Id,name:this.model.name,issued_by:this.model.issued_by,expiration_date:this.model.expiration_date,viewId:this.model.Id,expire_string:s.EXPIRE_TEXT,issued_by_text:s.ISSUED_BY_TEXT,add_view_details_text:s.VIEW_DETAILS_LINK_TEXT})),this._setTheImageForTheIdentity(),this},_setTheImageForTheIdentity:function(){var i=this.model.Id;this.$("#identity-img"+i).addClass("identity-img-others")},_handleKeyDownOnSetupItem:function(i){var e=i.target;if(40==i.keyCode){if(e.parentNode.nextSibling&&e.parentNode.nextSibling.hasChildNodes())return e.parentNode.nextSibling.childNodes[1].focus(),!1}else if(38==i.keyCode&&e.parentNode.previousSibling&&e.parentNode.previousSibling.hasChildNodes())return e.parentNode.previousSibling.childNodes[1].focus(),!1}})}),define("digsig/js/views/add-digital-id-from-file-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/add-digital-id-from-file-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/views/add-digital-id-view","digsig/js/collection/identity-collection","digsig/js/views/local-certificate-dialog-view"],function(i,e,t,n,s){e.AddDigitalIDFromFile=i.View.extend({events:{"click .identity-view-details":"_handleViewDetailsClick","keydown .identity-view-details":"_onViewDetailsKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this.collection=new e.IdentityCollection,this._template=_.template(t)},_initWrapper:function(){this.$identityContainer=this.$(".file-identity-list-details")},render:function(){this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"getCredentialsListFromFileDigitalId",methodArgs:{}}).done(_.bind(function(i){this.$el.html(this._template({add_file_id_desc:s.ADD_DIGITAL_ID_DESC})),this._initWrapper(),this._renderChildViews(i)},this))},this))},_renderChildViews:function(i){var e=0,t=this.getChildViews();_.each(t,_.bind(function(i){this.removeChildViewById(i.options.viewId)},this)),$.each(i,_.bind(function(t){var n=i[t],s=n.issued_by;s.length>26&&(s=s.substring(0,22),s=s.concat("..."));var o={Id:n.Id,name:n.name,issued_by:s,expiration_date:n.expiration_date};this._renderIdentityViews(e,o),e++},this))},_renderIdentityViews:function(i,t){this._renderChildView("_identityViewFile"+i,e.AddDigitalIDView,this.$identityContainer,{model:t})},_onViewDetailsKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._handleViewDetailsClick(i)},_FocusOnIdentity:function(){},_handleKeyDownOnIdentityItem:function(i){var e=i.target;if(40==i.keyCode){if(e.nextSibling)return e.nextSibling.focus(),!1}else if(38==i.keyCode&&e.previousSibling)return e.previousSibling.focus(),!1},_handleViewDetailsClick:function(i){var e=i.target.parentNode.id;this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"showCertificateViewerFromCredential",methodArgs:e})})}})}),define("digsig/js/templates/create-digital-id-form-template",[],function(){return'<div class ="create-digital-id-form"><div class="form-item-details"><div class="form-item-label theme-text " id="create-dig-id-name"><%=name_label%></div><div class="form-item-input-type"><input type="text" class="create-dig-id-name theme-input-box theme-text " name="create-dig-id-name" placeholder="<%=name_placeholder%>" aria-labelledby="create-dig-id-name"></div></div><div class="form-item-details"><div class="form-item-label theme-text" id="create-dig-id-orgUnit"><%=org_unit_label%></div><div class="form-item-input-type"><input type="text" class="create-dig-id-orgUnit theme-input-box theme-text " name="create-dig-id-orgUnit"  placeholder="<%=org_unit_placeholder %>" aria-labelledby="create-dig-id-orgUnit"></div></div><div class="form-item-details"><div class="form-item-label theme-text" id="create-dig-id-orgName"><%=org_name_label%></div><div class="form-item-input-type"><input type="text" class="create-dig-id-orgName theme-input-box theme-text " name="create-dig-id-orgName"  placeholder="<%=org_name_placeholder%>" aria-labelledby="create-dig-id-orgName"></div></div><div class="form-item-details"><div class="form-item-label theme-text" id="create-dig-id-emailId"><%=email_address_label%></div><div class="form-item-input-type"><input type="text" class="create-dig-id-emailId theme-input-box theme-text" name="create-dig-id-email-id" placeholder="<%=email_placeholder%>" aria-labelledby="create-dig-id-emailId"></div></div><div class="form-item-details"><div class="form-item-label theme-text" id="country-dropDown-label"><%=country_dropdown_label%></div><div class="form-item-input-type" id = "countrySelectDropdown">   		 <div class="digsig-relative-wrapper digsig-overflow-visible">                       <div class="digsig dropdown-btn digsig-select digsig-select-country theme-input-box theme-text">                           <div class="digsig digsig-selected-dropdown-item digsig-selected-country site-catalyst theme-text" id="digsig-selected-country"></div>                           <div class="digsig digsig-country-menu-container digsig-menu-container theme-input-box theme-text"></div>                           <div class="core-down-triangle digsig digsig-select-dropdown digsig-country-select-dropdown" role="button" tabindex="0"  aria-labelledby="country-dropDown-label digsig-selected-country"> </div>                       </div>            </div></div></div><div class="form-item-details"><div class="form-item-label theme-text" id="KeyAlgo-dropDown-label"><%=key_algo_dropdown_label%></div><div class="form-item-input-type">   		 <div class="digsig-relative-wrapper digsig-overflow-visible">                       <div class="digsig dropdown-btn digsig-select digsig-select-keyAlgo theme-input-box theme-text">                           <div class="digsig digsig-selected-dropdown-item digsig-selected-keyAlgo site-catalyst theme-text" id="digsig-selected-keyAlgo"></div>                           <div class="digsig digsig-keyAlgo-menu-container digsig-menu-container theme-input-box theme-text"></div>                           <div class="core-down-triangle digsig digsig-select-dropdown digsig-keyAlgo-select-dropdown" role="button" tabindex="0"  aria-labelledby="KeyAlgo-dropDown-label digsig-selected-keyAlgo"> </div>                       </div>            </div></div></div><div class="form-item-details"><div class="form-item-label theme-text" id="keyUsage-dropDown-label"><%=key_usage_dropdown_label%></div><div class="form-item-input-type">   		 <div class="digsig-relative-wrapper digsig-overflow-visible">                       <div class="digsig dropdown-btn digsig-select digsig-select-keyUsage theme-input-box theme-text">                           <div class="digsig digsig-selected-dropdown-item digsig-selected-keyUsage site-catalyst theme-text" id="digsig-selected-keyUsage"></div>                           <div class="digsig digsig-keyUsage-menu-container digsig-menu-container theme-input-box theme-text"></div>                           <div class="core-down-triangle digsig digsig-select-dropdown digsig-keyUsage-select-dropdown" role="button" tabindex="0"  aria-labelledby="keyUsage-dropDown-label digsig-selected-keyUsage"> </div>                       </div>            </div></div></div><input type="hidden" class= "create-dig-id-inital-path" name="initial-path" value=""><div class="invalid-email-id-desc theme-error-message" id="invalid-email-id"><br><%=invalid_email_address%></div></div>'}),define("digsig/js/views/digsig-dropdown-view",["digsig/js/ac-digsig","core/utils/event-util","core/ac-core"],function(i,e,t){return i.DigSigDropdownMenuView=t.View.extend({events:{"click li":"_onMenuItemClick","keydown li":"_onMenuItemKeyDown"},initialize:function(i){t.View.prototype.initialize.call(this),this.menuItems=[],i&&i.menuItems&&(this.menuItems=i.menuItems)},render:function(){t.View.prototype.render.call(this),this.$el.empty(),this.menuItems.map(_.bind(function(i){this.$el.append(_.template('<li class="theme-text theme-hoverable" tabindex="0" role="menuitem" data-code="<%= code %>"><%= name %></li>',i))},this));return this},_focusOnMenuItem:function(){var i=this.$el,e=i.children("li")[0];e.focus()},show:function(){return this.$el.show(),this._addMenuEventListeners(),this._focusOnMenuItem(),this._settingEscEvent(!0),this.deferred=$.Deferred(),this.deferred.promise()},close:function(i,e){var t,n;this.deferred&&this.deferred.resolve(i,e),this._removeMenuEventListeners(),this._settingEscEvent(!1),this.$el.hide(),t=this.$el.parent(),_.isUndefined(t)||_.isEmpty(t)||(n=t.find(".core-down-triangle"),_.isUndefined(n)||_.isEmpty(n)||n.focus())},_settingEscEvent:function(){},_onMenuItemClick:function(i){i.stopPropagation(),this.close($(i.currentTarget).data("code"),$(i.currentTarget).text())},_onMenuItemKeyDown:function(i){var e=i.keyCode,t=$(i.currentTarget);switch(e){case 38:var n=t.prev();if(n.length>0)t.prev().focus();else{var s=t.siblings(":last");s.focus()}break;case 40:var o=t.next();if(o.length>0)t.next().focus();else{var a=t.siblings(":first");a.focus()}break;case 27:case 27:return i.stopPropagation(),this.close(),!1;case 13:case 32:this._onMenuItemClick(i);break;case 9:this.close()}},_addMenuEventListeners:function(){e.addDomEventListener(document.body,"click",this._onBodyClick,!0)},_removeMenuEventListeners:function(){e.removeDomEventListener(document.body,"click",this._onBodyClick,!0)},_onKeyDown:function(i){return this.options.appApi.displayApi.isModal()||27!==i.which?void 0:(this.close(),!0)},_onBodyClick:function(i){0===e.getEventTarget(i).closest(this.$el).length&&(i.stopPropagation(),this.close())}}),i.DigSigDropdownMenuView}),define("digsig/js/views/create-digital-id-form-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/create-digital-id-form-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants","digsig/js/views/digsig-dropdown-view","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/views/digsig-left-pane-view","digsig/js/collection/identity-collection","digsig/js/views/local-certificate-create-new-options-view"],function(i,e,t,n,s){e.CreateDigitalIDFormView=i.View.extend({events:{"change   input.create-dig-id-name":"_NameValueChanged","change   input.create-dig-id-emailId":"_EmailAddressValueChanged","input   input.create-dig-id-name":"_NameValueChanged","input   input.create-dig-id-emailId":"_EmailAddressValueChanged","focusout input.create-dig-id-emailId":"_ValidateEmailAddress","click   .digsig-select-keyUsage":"_onKeyUsageSelectClick","click   .digsig-select-keyAlgo":"_onKeyAlgoSelectClick","click   .digsig-select-country":"_onCountrySelectClick","keydown .digsig-country-select-dropdown":"_onCountryArrowKeydown","keydown .digsig-keyAlgo-select-dropdown":"_onKeyAlgoArrowKeyDown","keydown .digsig-keyUsage-select-dropdown":"_onKeyUsageArrowKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t)},_initWrapper:function(){this.$Name=this.$(".create-dig-id-name"),this.$OrgUnit=this.$(".create-dig-id-orgUnit"),this.$OrgName=this.$(".create-dig-id-orgName"),this.$EmailAddress=this.$(".create-dig-id-emailId"),this.$IntialPath=this.$(".create-dig-id-inital-path"),this.$CountryDropDown=this.$(".create-dig-id-country-dropdown"),this.$KeyAlgoDropDown=this.$(".create-dig-id-keyAlgo-dropdown"),this.$KeyUsageDropDown=this.$(".create-dig-id-keyUsage-dropdown"),this.$rightBtn3=$el.find(".digsig-modal").find(".digsig-dlg-right-btn3"),this.$inValidEmail=this.$("#invalid-email-id"),this.$countryContainer=this.$el.find(".digsig.digsig-country-menu-container"),this.$selectedCountry=this.$el.find(".digsig.digsig-selected-country"),this.$keyAlgoContainer=this.$(".digsig.digsig-keyAlgo-menu-container"),this.$selectedKeyAlgo=this.$(".digsig.digsig-selected-keyAlgo"),this.$keyUsageContainer=this.$(".digsig.digsig-keyUsage-menu-container"),this.$selectedKeyUsage=this.$(".digsig.digsig-selected-keyUsage")},render:function(){if(i.View.prototype.render.call(this),0===this.$el.children().length){this.$el.html(this._template({name_label:s.NAME_LABEL_TEXT,name_placeholder:s.NAME_PLACEHOLDER_TEXT,org_unit_label:s.ORG_UNIT_LABEL_TEXT,org_unit_placeholder:s.ORG_UNIT_PLACEHOLDER_TEXT,org_name_label:s.ORG_NAME_LABEL_TEXT,org_name_placeholder:s.ORG_NAME_PLACEHOLDER_TEXT,email_address_label:s.EMAIL_ADDRESS_LABEL_TEXT,email_placeholder:s.EMAIL_ADDRESS_PLACEHOLDER_TEXT,country_dropdown_label:s.COUNTRY_LABEL_TEXT,key_algo_dropdown_label:s.KEY_ALGO_LABEL_TEXT,key_usage_dropdown_label:s.KEY_USAGE_LABEL_TEXT,invalid_email_address:s.INVALID_EMAIL_ADDRESS})),this._initWrapper();var e=this._PopulateTheDropDowns();e.then(_.bind(function(){this._UpdateControls()},this))}return this._UpdateControls(),this},_onKeyUsageArrowKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onKeyUsageSelectClick(i)},_onKeyAlgoArrowKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onKeyAlgoSelectClick(i)},_onCountryArrowKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onCountrySelectClick(i)},_PopulateTheDropDowns:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"getNewDigitalIDParams",methodArgs:{}}).done(_.bind(function(e){this._populateCountry(e),this._populateKeyAlgorithm(e),this._populateKeyUsage(e),this._populateOtherFormInputs(e),i.resolve()},this))},this)),i.promise()},_populateOtherFormInputs:function(i){i.cn&&this.$Name.val(i.cn),i.o&&this.$OrgName.val(i.o),i.ou&&this.$OrgUnit.val(i.ou),i.e&&this.$EmailAddress.val(i.e),i.initial_path&&this.$IntialPath.val(i.initial_path)},_populateCountry:function(i){var t=this.$CountryDropDown;t.empty();var n=i.country,s=[];$.each(n,_.bind(function(i){var e=n[i],o={code:i,name:e};s.push(o),t.append($("<option></option>").val(i).html(e))},this));var o=_.extend({menuItems:s},this.options);this.countryMenuView=this._renderChildView("_countryView",e.DigSigDropdownMenuView,this.$countryContainer,o),this.$selectedCountry.text(i.country[i.default_country]),this.$selectedCountry.val(i.default_country)},_populateKeyAlgorithm:function(i){var t=this.$KeyAlgoDropDown;t.empty();var n=i.key_algorithm,s=[];$.each(n,_.bind(function(i){var e=n[i],o={code:i,name:e};s.push(o),t.append($("<option></option>").val(i).html(e))},this));var o=_.extend({menuItems:s},this.options);this.keyAlgoMenuView=this._renderChildView("_keyAlgoView",e.DigSigDropdownMenuView,this.$keyAlgoContainer,o),this.$selectedKeyAlgo.text(i.key_algorithm[i.default_key_algorithm]),this.$selectedKeyAlgo.val(i.default_key_algorithm)},_populateKeyUsage:function(i){var t=this.$KeyUsageDropDown;t.empty();var n=i.key_usage,s=[];$.each(n,_.bind(function(i){var e=n[i],o={code:i,name:e};s.push(o),t.append($("<option></option>").val(i).html(e))},this));var o=_.extend({menuItems:s},this.options);this.keyUsageMenuView=this._renderChildView("_keyUsageView",e.DigSigDropdownMenuView,this.$keyUsageContainer,o),this.$selectedKeyUsage.text(i.key_usage[i.default_key_usage]),this.$selectedKeyUsage.val(i.default_key_usage)},_UpdateControls:function(){var i=!1;this.$Name.val().trim().length&&this.$EmailAddress.val().length&&this.validateEmail(this.$EmailAddress.val())&&(i=!0),this.$EmailAddress.val().length>0?this.$EmailAddress.css("border-color","#cbcbcb").css("border-width","1px"):this.$EmailAddress.css("border-color","#DD9090").css("border-width","1px"),this.$Name.val().trim().length>0?this.$Name.css("border-color","#cbcbcb").css("border-width","1px"):this.$Name.css("border-color","#DD9090").css("border-width","1px"),n.enableInput(this.$rightBtn3,i)},_NameValueChanged:function(){this._UpdateControls()},_EmailAddressValueChanged:function(){var i=this.$EmailAddress.val(),e=i.length>0&&this.validateEmail(i);e?(this._UpdateControls(),this.$("#invalid-email-id").hide()):this._UpdateControls()},_ValidateEmailAddress:function(){var i=this.$EmailAddress.val(),e=i.length>0&&this.validateEmail(i);e?(this._UpdateControls(),this.$("#invalid-email-id").hide()):(this._UpdateControls(),this.$("#invalid-email-id").show())},validateEmail:function(i){var e=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(i)},_onCountrySelectClick:function(){this.countryMenuView.show().done(_.bind(function(i,e){i&&(this.$selectedCountry.text(e),this.$selectedCountry.val(i))},this))},_onKeyAlgoSelectClick:function(){this.keyAlgoMenuView.show().done(_.bind(function(i,e){void 0!=i&&(this.$selectedKeyAlgo.text(e),this.$selectedKeyAlgo.val(i))},this))},_onKeyUsageSelectClick:function(){this.keyUsageMenuView.show().done(_.bind(function(i,e){void 0!=i&&(this.$selectedKeyUsage.text(e),this.$selectedKeyUsage.val(i))},this))}})}),define("digsig/js/templates/save-self-signed-digital-id-template",[],function(){return'<div class="local-files"><div class="save-dlg-browse-description theme-text" id="save-dlg-browse-description-id"><%=browse_heading%></div><br><div class="browse-id-block"><input type="text" class="browse-id-input theme-input-box theme-text " id="save-dlg-browser-file-input" aria-label="Browser for the File"><input class="digsig-button save-dialog-browser-id-button        control-button button-grey         theme-button-gray-label"         id="digsig-dlg-left-btn1"         type="button"        aria-labelledby="save-dlg-browse-description-id"        value="<%=browse_button%>" /></div><div class="password-description theme-text" id="password-description-id"><%=password_heading%></div><input type="password" class="password-input theme-input-box theme-text " id="save-dlg-password" aria-labelledby="password-description-id"> <meter min="0" max="4" id="save-local-cert-password-strength-meter" class="password-strength-meter"/><div class="password-description theme-text" id="password-description-id"><%=confirm_password_heading%></div><input type="password" class="password-input theme-input-box theme-text" id="save-dlg-confirm-password" aria-labelledby="password-description-id"><div class="password-mismatch-heading theme-error-message" id="file-password-mismatch"><%=password_mismatch_heading%></div><div class="password-error theme-error-message" id="file-password-length-error"><%=password_length_error%></div></div>'}),define("digsig/js/views/save-self-signed-digital-id-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/save-self-signed-digital-id-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/views/digsig-left-pane-view","digsig/js/collection/identity-collection","digsig/js/views/local-certificate-create-new-options-view"],function(i,e,t,n,s){e.SaveDigitalIDView=i.View.extend({events:{"click    .save-dialog-browser-id-button":"_onBrowseButtonClick","change   input#save-dlg-browser-file-input":"_FilePathValueChanged","change   input#save-dlg-password":"_PasswordValueChanged","change   input#save-dlg-confirm-password":"_ConfirmPasswordValueChanged","input    input#save-dlg-browser-file-input":"_FilePathValueChanged","input    input#save-dlg-password":"_PasswordValueChanged","input    input#save-dlg-confirm-password":"_ConfirmPasswordValueChanged","paste   input#save-dlg-password":"_PasswordPasted","paste   input#save-dlg-confirm-password":"_ConfirmPasswordPasted"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t)},_removePasswordErrorLabel:function(){this.$("#file-password-length-error").hide(),this.$("#file-password-mismatch").hide()},_initWrapper:function(){this.$FilePathInput=this.$("#save-dlg-browser-file-input"),this.$passwordInput=this.$("#save-dlg-password"),this.$passwordStrengthMeter=this.$("#save-local-cert-password-strength-meter")[0],this.$confirmPasswordInput=this.$("#save-dlg-confirm-password"),this.$rightBtn3=$el.find(".digsig-modal").find(".digsig-dlg-right-btn3")},render:function(){return i.View.prototype.render.call(this),0===this.$el.children().length&&this.$el.html(this._template({browse_button:s.BROWSE_BUTTON,browse_heading:s.SAVE_DIGITAL_ID_BROWSE_HEADING,password_heading:s.SAVE_DIGITAL_ID_PASSWORD,confirm_password_heading:s.SAVE_DIGITAL_ID_CONFIRM_PASSWORD,password_mismatch_heading:s.SAVE_FILE_PASSWORD_MISMATCH,password_length_error:s.PASSWORD_LENGTH_ERROR})),this._initWrapper(),this._UpdateTheFilepathWithNameAndExtensions(),this._DisableInputBox(),this._UpdateControls(),this._UpdatePasswordStrength(),this},_DisableInputBox:function(){i.Util.isReader()?this.$FilePathInput.prop("disabled",!0):this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"SetDisableSelfSignFilepath",methodArgs:""}).done(_.bind(function(i){i&&this.$FilePathInput.prop("disabled",!0)
},this))},this))},_UpdateTheFilepathWithNameAndExtensions:function(){var e,t,n,s,o=!1;e=this.options.name,n=this.options.initial_path,s=n.substr(n.length-1),("\\"==s||"/"==s)&&(o=!0),t=n,t=i.Util.isWindows()?o?t+e.replace(/\s+/g,"")+".pfx":t+"\\"+e.replace(/\s+/g,"")+".pfx":o?t+e.replace(/\s+/g,"")+".p12":t+"\\"+e.replace(/\s+/g,"")+".p12",this.$FilePathInput.val(t)},_selectAndOpenFile:function(){this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"showSaveAsDialogDigitalId",methodArgs:this.$FilePathInput.val()}).done(_.bind(function(i){this.$FilePathInput.val(i.selected_path),this._UpdateControls()},this))},this))},_onBrowseButtonClick:function(){this._selectAndOpenFile()},_UpdateControls:function(){var i=!1;this.$FilePathInput.val().length&&this.$passwordInput.val().length&&this.$confirmPasswordInput.val().length&&(i=!0),this.$FilePathInput.val().length>0?this.$FilePathInput.css("border-color","#cbcbcb"):this.$FilePathInput.css("border-color","#DD9090"),this.$passwordInput.val().length>0?this.$passwordInput.css("border-color","#cbcbcb"):this.$passwordInput.css("border-color","#DD9090"),this.$confirmPasswordInput.val().length>0?this.$confirmPasswordInput.css("border-color","#cbcbcb"):this.$confirmPasswordInput.css("border-color","#DD9090"),n.enableInput(this.$rightBtn3,i)},_FilePathValueChanged:function(){this._UpdateControls()},_PasswordValueChanged:function(){this._UpdateControls(),this._removePasswordErrorLabel(),this._UpdatePasswordStrength()},_PasswordPasted:function(){setTimeout(_.bind(function(){this._PasswordValueChanged()},this),100)},_ConfirmPasswordValueChanged:function(){this._UpdateControls(),this._removePasswordErrorLabel()},_ConfirmPasswordPasted:function(){setTimeout(_.bind(function(){this._ConfirmPasswordValueChanged()},this),100)},_UpdatePasswordStrength:function(){this.$passwordInput.val().length>0?this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"getPasswordStrength",methodArgs:this.$passwordInput.val()}).done(_.bind(function(i){console.log("Strength : "+i.strength),this.$passwordStrengthMeter.value=i.strength,this.$("#save-local-cert-password-strength-meter").show()},this))},this)):this.$("#save-local-cert-password-strength-meter").hide()}})}),define("digsig/js/templates/signature-creation-device-template",[],function(){return'<div class ="signature-creation-option"><div class="signature-creation-details" tabindex="0" aria-labelledby="signature-creation-name1 signature-creation-description1"><div class="digsig-image signature-creation-img-option1"></div><div class="signature-creation-item"><div class="signature-creation-name theme-text" id="signature-creation-name1"><b><%=option1_heading%></b></div><div class="signature-creation-description theme-text" id="signature-creation-description1"><%=option1_sub_heading%><span class="learn-more-link theme-hyperlink" tabindex="0" role="link"><%=learn_more_text%></span></div></div></div></div><div class ="signature-creation-option" ><div class="signature-creation-details"  tabindex="0" aria-labelledby="signature-creation-name2 signature-creation-description2"><div class="digsig-image signature-creation-img-option2"></div><div class="signature-creation-item"><div class="signature-creation-name theme-text" id="signature-creation-name2"><b><%=option2_heading%></b></div><div class="signature-creation-description theme-text" id="signature-creation-description2"><%=option2_sub_heading%></div></div></div></div><div class ="signature-creation-option"><div class="signature-creation-details" tabindex="0" aria-labelledby="signature-creation-name3 signature-creation-description3"><div class="digsig-image signature-creation-img-option3"></div><div class="signature-creation-item"><div class="signature-creation-name theme-text" id="signature-creation-name3"><b><%=option3_heading%></b></div><div class="signature-creation-description theme-text" id="signature-creation-description3"><%=option3_sub_heading%></div></div></div></div>'}),define("digsig/js/views/signature-creation-device-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/signature-creation-device-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/collection/identity-collection"],function(i,e,t,n,s){e.SignatureCreationDeviceDialogView=i.View.extend({events:{"click   input[name='setup-choice']":"_changedRadioButton","keydown .signature-creation-details":"_handleKeyDownOnSetupItem","click   .learn-more-link":"_LearnMoreLinkClicked","keydown .learn-more-link":"_onLearnMoreLinkKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t)},_initWrapper:function(){this.$digsigHeaderContainer=this.$(".digsig-header-container"),this.$digsigFooterContainer=this.$(".digsig-footer-container"),this.$continueButton=this.$(".digsig-dlg-primary-btn")},render:function(){return i.View.prototype.render.call(this),0===this.$el.children().length&&this.$el.html(this._template({option1_heading:s.SIGNATURE_CREATION_OPTION_1_HEADING,option1_sub_heading:s.SIGNATURE_CREATION_OPTION_1_SUB_HEADING,option2_heading:s.SIGNATURE_CREATION_OPTION_2_HEADING,option2_sub_heading:s.SIGNATURE_CREATION_OPTION_2_SUB_HEADING,option3_heading:s.SIGNATURE_CREATION_OPTION_3_HEADING,option3_sub_heading:s.SIGNATURE_CREATION_OPTION_3_SUB_HEADING,learn_more_text:s.LEARN_MORE_TEXT})),this},_FocusOnIdentity:function(){},_handleKeyDownOnSetupItem:function(i){var e=i.target;if(40==i.keyCode){if(e.parentNode.nextSibling&&e.parentNode.nextSibling.hasChildNodes())return e.parentNode.nextSibling.childNodes[1].focus(),!1}else if(38==i.keyCode&&e.parentNode.previousSibling&&e.parentNode.previousSibling.hasChildNodes())return e.parentNode.previousSibling.childNodes[1].focus(),!1},_closeOnESC:function(){this.options.appApi.rnaApi.done(function(i){i.rnaFteAPI.invokeMethod({methodName:"shouldCloseOnESC",methodArgs:[!0]})})},_LearnMoreLinkClicked:function(){console.log("Learn More Link clicked"),this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"launchGoURLDigSig",methodArgs:""})})},_onLearnMoreLinkKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._LearnMoreLinkClicked(i)}})}),define("digsig/js/templates/add-digital-id-from-sign-creation-device-template",[],function(){return'<div class="add-file-id-container"><div class="add-file-id-list-desc theme-text"><%=add_file_id_desc%></div><div class="sign-creation-identity-list-details"></div></div>'}),define("digsig/js/views/add-digital-id-from-sign-creation-device-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/add-digital-id-from-sign-creation-device-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/views/add-digital-id-view","digsig/js/collection/identity-collection","digsig/js/views/local-certificate-dialog-view"],function(i,e,t,n,s){e.AddDigitalIDFromSignatureDevice=i.View.extend({events:{"click .identity-view-details":"_handleViewDetailsClick","keydown .identity-view-details":"_onViewDetailsKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this.collection=new e.IdentityCollection,this._template=_.template(t)},_initWrapper:function(){this.$identityContainer=this.$(".sign-creation-identity-list-details")},render:function(){this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"loadPKCS11Credentials",methodArgs:{}}).done(_.bind(function(i){this.$el.html(this._template({add_file_id_desc:s.ADD_DIGITAL_ID_DESC})),this._initWrapper(),this._renderChildViews(i)},this))},this))},_renderChildViews:function(i){var e=0,t=this.getChildViews();_.each(t,_.bind(function(i){this.removeChildViewById(i.options.viewId)},this)),$.each(i,_.bind(function(t){var n=i[t],s={Id:n.Id,name:n.name,issued_by:n.issued_by,expiration_date:n.expiration_date};this._renderIdentityViews(e,s),e++},this))},_renderIdentityViews:function(i,t){this._renderChildView("_identityViewSignCreation"+i,e.AddDigitalIDView,this.$identityContainer,{model:t})},_FocusOnIdentity:function(){},_handleKeyDownOnIdentityItem:function(i){var e=i.target;if(40==i.keyCode){if(e.nextSibling)return e.nextSibling.focus(),!1}else if(38==i.keyCode&&e.previousSibling)return e.previousSibling.focus(),!1},_handleViewDetailsClick:function(i){var e=i.target.id;this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"showCertificateViewerFromPKCS11Credential",methodArgs:e})})},_onViewDetailsKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._handleViewDetailsClick(i)},_closeOnESC:function(){this.options.appApi.rnaApi.done(function(i){i.rnaFteAPI.invokeMethod({methodName:"shouldCloseOnESC",methodArgs:[!0]})})}})}),define("digsig/js/views/local-certificate-dialog-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/local-certificate-dialog-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/constants/digsig-constants","digsig/js/views/digsig-dialog-footer-view","digsig/js/views/digsig-dialog-header-view","digsig/js/views/digsig-left-pane-view","digsig/js/collection/identity-collection","digsig/js/views/local-certificate-create-new-options-view","digsig/js/views/use-local-certificate-view","digsig/js/views/add-digital-id-from-file-view","digsig/js/views/create-digital-id-form-view","digsig/js/views/save-self-signed-digital-id-view","digsig/js/views/configure-digital-id-view","digsig/js/views/signature-creation-device-view","digsig/js/views/add-digital-id-from-sign-creation-device-view"],function(i,e,t,n,s,o){e.LocalCertificateDialogView=i.View.extend({events:{},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t),this._addUiModelEventListeners(),this.$isGoingBack=!1},_initWrapper:function(){this.$digsigHeaderContainer=this.$(".digsig-header-container"),this.$digsigFooterContainer=this.$(".digsig-footer-container"),this.$digsigLeftPanecontainer=this.$(".digsig-left-pane-container"),this.$digsigRightPanecontainer=this.$(".digsig-right-pane-container"),this.$continueButton=this.$(".digsig-dlg-primary-btn")},_addUiModelEventListeners:function(){this.listenTo(this.options.DigSigUiModel,"change:Currentdialog",this._renderRightContainerView)},render:function(){return i.View.prototype.render.call(this),this.$el.html(this._template({})),this._renderChildViews(),this._closeOnESC(),this},_renderChildViews:function(){{var i=_.extend({headerText:s.CONFIGURE_DIALOG_HEADER,FIRST_RIGHT_BUTTON_TEXT:s.CREATE_NEW_BUTTON_TEXT,SECOND_RIGHT_BUTTON_TEXT:s.CANCEL_BUTTON_TEXT,THIRD_RIGHT_BUTTON_TEXT:s.CONTINUE_BUTTON_TEXT,FIRST_LEFT_BUTTON_TEXT:s.HELP_BUTTON_TEXT,dialog_left_side_description:s.CONFIGURE_DIALOG_LEFT_SIDE_DESCIPTION,dialog_left_side_sub_description:s.CONFIGURE_DIALOG_LEFT_SIDE_SUB_DESCIPTION,shouldHideRightButton1:!0},this.options),t=(this._renderChildView("_localCertHeaderView",e.ShowDigSigDialogHeaderView,this.$el.find(".digsig-header-container"),i),this._renderChildView("_localCertFooterView",e.ShowDigSigDialogFooterView,this.$el.find(".digsig-footer-container"),i));this._renderChildView("_localCertLeftPaneView",e.ShowDigSigDialogLeftPaneView,this.$el.find(".digsig-left-pane-container"),i)}this._renderRightContainerView(),this.listenTo(t,"DigSig:first-right-button-click",this._onFirstRightButtonClick),this.listenTo(t,"DigSig:second-right-button-click",this._onSecondRightButtonClick),this.listenTo(t,"DigSig:third-right-button-click",this._onThirdRightButtonClick),this.listenTo(t,"DigSig:first-left-button-click",this._onFirstLeftButtonClick),this._initWrapper()},_renderRightContainerView:function(){var i=this.options.DigSigUiModel.get("Currentdialog"),t=this.options.DigSigUiModel.get("dialogsStack");if(this.$(".digsig-left-pane-container").show(),this.$(".digsig-right-pane-container").css("width","450px"),this.$isGoingBack||t.push(i.prev),i.name==o.CONFIGURE_DIGITAL_ID_DIALOG){var n=_.extend({},this.options);this._renderChildView("_CofigureDigitalIDDialogView",e.CofigureDigitalIDDialogView,this.$el.find("#digsig-configure-digital-id"),n),this.$(".right-sub-container").hide(),this.$("#digsig-configure-digital-id").show()}else if(i.name==o.SIGNATURE_CREATION_DEVICE_DIALOG){var n=_.extend({},this.options);this._renderChildView("_SignatureCreationDeviceDialogView",e.SignatureCreationDeviceDialogView,this.$el.find("#use-signature-creation-device"),n),this.$(".right-sub-container").hide(),this.$("#use-signature-creation-device").show()}else if(i.name==o.FIND_DIGITAL_ID){var n=_.extend({},this.options);this._renderChildView("_UseLocalCertificateView",e.UseLocalCertificateView,this.$el.find("#digsig-find-digital-id"),n),this.$(".right-sub-container").hide(),this.$("#digsig-find-digital-id").show()}else if(i.name==o.ADD_DIGITAL_ID_FILE){var n=_.extend({},this.options);this._renderChildView("_AddDigitalIDFromFile",e.AddDigitalIDFromFile,this.$el.find("#digsig-add-digital-id-file"),n),this.$(".right-sub-container").hide(),this.$("#digsig-add-digital-id-file").show(),this.$(".digsig-left-pane-container").hide(),this.$(".digsig-right-pane-container").css("width","100%")}else if(i.name==o.ADD_DIGITAL_ID_SIGNATURE_DEVICE){var n=_.extend({},this.options);this._renderChildView("_AddDigitalIDFromSignatureDevice",e.AddDigitalIDFromSignatureDevice,this.$el.find("#digsig-add-digital-id-sign-device"),n),this.$(".right-sub-container").hide(),this.$("#digsig-add-digital-id-sign-device").show(),this.$(".digsig-left-pane-container").hide(),this.$(".digsig-right-pane-container").css("width","100%")}else if(i.name==o.CREATE_SELF_SIGNED_ID_OPTIONS)this._renderChildView("_CreateLocalCertificateOptions",e.LocalCertificateCreateNewOptionsView,this.$el.find("#digsig-create-options-container"),this.options),this.$(".right-sub-container").hide(),this.$("#digsig-create-options-container").show();else if(i.name==o.CREATE_SELF_SIGNED_ID_FILE){var n=_.extend({},this.options);this._renderChildView("_CreateDigitalIDFormView",e.CreateDigitalIDFormView,this.$el.find("#digsig-create-digital-id-form"),n),this.$(".right-sub-container").hide(),this.$("#digsig-create-digital-id-form").show()}else if(i.name==o.CREATE_SELF_SIGNED_ID_KEYCHAIN){var n=_.extend({},this.options);this._renderChildView("_CreateDigitalIDFormView",e.CreateDigitalIDFormView,this.$el.find("#digsig-create-digital-id-form"),n),this.$(".right-sub-container").hide(),this.$("#digsig-create-digital-id-form").show()}else if(i.name==o.SAVE_DIGITAL_ID){var s=this.$(".create-dig-id-inital-path").val(),a=this.$(".create-dig-id-name").val(),n=_.extend({initial_path:s,name:a},this.options);this._renderChildView("_SaveDigitalIDView",e.SaveDigitalIDView,this.$el.find("#digsig-save-digital-id"),n),this.$(".right-sub-container").hide(),this.$("#digsig-save-digital-id").show()}},_onFirstRightButtonClick:function(){var i=this.options.DigSigUiModel.get("Currentdialog");if(i.name==o.FIND_DIGITAL_ID){var e,t;t=o.CREATE_SELF_SIGNED_ID_OPTIONS,e={name:t,prev:{name:i.name}},this.options.DigSigUiModel.set("Currentdialog",e)}else i.name==o.SIGNATURE_CREATION_DEVICE_DIALOG&&this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"launchPKCS11Dialog",methodArgs:{}})})},_onSecondRightButtonClick:function(){var i=this.options.DigSigUiModel.get("Currentdialog");if(i.name==o.CONFIGURE_DIGITAL_ID_DIALOG)this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"listDigitalIdsDigSigCEFDialog",methodArgs:{}}).done(_.bind(function(i){i.id_count?this._renderIdentityListView():this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:"cancel"}})},this))},this));else{this.$isGoingBack=!0;var t=this.options.DigSigUiModel.get("dialogsStack");this.options.DigSigUiModel.set("Currentdialog",t.pop()),this.$isGoingBack=!1}},_CheckIfPasswordForTheFileIsCorrect:function(){var i=$.Deferred(),e=this.$("#browse-file-input").val(),t=this.$("#browse-file-password").val();return this.options.appApi.rnaApi.done(_.bind(function(n){n.rnaDigSigAPI.invokeMethod({methodName:"loadCredentialsFromFileDigitalId",methodArgs:[{file_path:e,password:t}]}).done(_.bind(function(e){var t=e.result;return i.resolve(t)},this))},this)),i.promise()},_CheckIfPasswordAndConfirmPasswordMatches:function(){var i=this.$("#save-dlg-password").val(),e=this.$("#save-dlg-confirm-password").val();return i==e?!0:!1},_CheckIfPasswordLengthIsValid:function(){var i=this.$("#save-dlg-password").val(),e=this.$("#save-dlg-confirm-password").val();return i.length>=6&&e.length>=6?!0:!1},_getFormValues:function(){var i={name:this.$(".create-dig-id-name").val().trim(),orgName:this.$(".create-dig-id-orgName").val(),orgUnit:this.$(".create-dig-id-orgUnit").val(),email:this.$(".create-dig-id-emailId").val(),country:this.$(".digsig.digsig-selected-country").val(),keySize:this.$(".digsig.digsig-selected-keyAlgo").val(),keyUsage:this.$(".digsig.digsig-selected-keyUsage").val(),initial_path:this.$(".create-dig-id-inital-path").val(),file_path:this.$("#save-dlg-browser-file-input").val(),password:this.$("#save-dlg-password").val()};return i},_saveTheNewlyCreatedDigitalID:function(i){var e,t=this._getFormValues();e=i?{cn:t.name,o:t.orgName,ou:t.orgUnit,e:t.email,c:t.country,certspec_keysize:t.keySize,key_usage:t.keyUsage,file_path:t.file_path,password:t.password}:{cn:t.name,o:t.orgName,ou:t.orgUnit,e:t.email,c:t.country,certspec_keysize:t.keySize,key_usage:t.keyUsage},this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"saveSelfSignedCertificate",methodArgs:e}).done(_.bind(function(i){i.result&&this._renderIdentityListView()},this))},this))},_onThirdRightButtonClick:function(){var i=this.options.DigSigUiModel.get("Currentdialog");if(i.name==o.CONFIGURE_DIGITAL_ID_DIALOG){var e,t,n=this.$("input[name='setup-choice']:checked").attr("id");"configure_option_1"==n?t=o.SIGNATURE_CREATION_DEVICE_DIALOG:"configure_option_2"==n?t=o.FIND_DIGITAL_ID:"configure_option_3"==n&&(t=o.CREATE_SELF_SIGNED_ID_OPTIONS),e={name:t,prev:{name:i.name}},this.options.DigSigUiModel.set("Currentdialog",e)}else if(i.name==o.FIND_DIGITAL_ID){var s=this._CheckIfPasswordForTheFileIsCorrect();s.then(_.bind(function(e){if(e){var t,n;n=o.ADD_DIGITAL_ID_FILE,t={name:n,prev:{name:i.name}},this.options.DigSigUiModel.set("Currentdialog",t)}else this.$("#file-password-error").show()},this))}else if(i.name==o.CREATE_SELF_SIGNED_ID_OPTIONS){var e,t,n=this.$("input[name='create-choice']:checked").attr("id");t="create_option_1"==n?o.CREATE_SELF_SIGNED_ID_FILE:o.CREATE_SELF_SIGNED_ID_KEYCHAIN,e={name:t,prev:{name:i.name}},this.options.DigSigUiModel.set("Currentdialog",e)}else if(i.name==o.CREATE_SELF_SIGNED_ID_FILE){var e,t;t=o.SAVE_DIGITAL_ID,e={name:t,prev:{name:i.name}},this.options.DigSigUiModel.set("Currentdialog",e)}else i.name==o.CREATE_SELF_SIGNED_ID_KEYCHAIN?this._saveTheNewlyCreatedDigitalID(!1):i.name==o.SIGNATURE_CREATION_DEVICE_DIALOG?this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"findPKCS11Credentials",methodArgs:{}}).done(_.bind(function(e){if(console.log(e),e.result){var t,n;n=o.ADD_DIGITAL_ID_SIGNATURE_DEVICE,t={name:n,prev:{name:i.name}},this.options.DigSigUiModel.set("Currentdialog",t)}},this))},this)):i.name==o.SAVE_DIGITAL_ID?this._CheckIfPasswordLengthIsValid()?this._CheckIfPasswordAndConfirmPasswordMatches()?this._saveTheNewlyCreatedDigitalID(!0):this.$("#file-password-mismatch").show():this.$("#file-password-length-error").show():i.name==o.ADD_DIGITAL_ID_FILE?this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"saveCredentialsFromFileDigitalId",methodArgs:""}).done(_.bind(function(i){i.result&&this._renderIdentityListView()},this))},this)):i.name==o.ADD_DIGITAL_ID_SIGNATURE_DEVICE&&this._renderIdentityListView()},_unbindEventsandRemoveChildViews:function(){this.applyMethodRecursively("undelegateEvents"),this.undelegateEvents(),this.removeAllChildViews()},_renderIdentityListView:function(){"newID"==e.QueryParams.dialog?this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:"save"}}):(this._unbindEventsandRemoveChildViews(),this.remove(),this.$el.hide(),window.$el.find("#digsig-show-identity-list").show(),this._renderChildView("_showIdentityDialogView",e.ShowIdentityDialogView,window.$el.find("#digsig-show-identity-list"),this.options))},_onFirstLeftButtonClick:function(){console.log("Help Button Clicked"),this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"launchHelpDigSig",methodArgs:"Dlg_SigningID"})})},_FocusOnIdentity:function(){},_handleKeyDownOnSetupItem:function(i){var e=i.target;if(40==i.keyCode){if(e.parentNode.nextSibling&&e.parentNode.nextSibling.hasChildNodes())return e.parentNode.nextSibling.childNodes[1].focus(),!1}else if(38==i.keyCode&&e.parentNode.previousSibling&&e.parentNode.previousSibling.hasChildNodes())return e.parentNode.previousSibling.childNodes[1].focus(),!1},_escapeHtml:function(i){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;","(":"&#040;",")":"&#041;","/":"&#047;","\\":"&#092;"};return i.replace(/[&<>"']/g,function(i){return e[i]})},_closeOnESC:function(){this.options.appApi.rnaApi.done(function(i){i.rnaFteAPI.invokeMethod({methodName:"shouldCloseOnESC",methodArgs:[!0]})})}})}),define("digsig/js/templates/digsig-show-identity-dialog-template",[],function(){return'<div class="identity-modal"><div class="identity-header"><span class="identity-header-text theme-text" id="identity-header-text"><%=Identity_Header_Text%></span><span id="close-label" style="display:none">Close</span><span class="close-identity-modal core-remove-x" tabindex="0" role="button" aria-labelledby="identity-header-text close-label"></span></div><hr class="header-horizontal-line"><div class="identity-list"><div class="identity-list-present"><div class="list-digital-id-heading"><div class="identity-list-description theme-text"><%=Identity_Description%></div><input class="identity-button identity-dlg-refresh-btn 				 control-button button-grey 				 theme-button-gray-label" 				 id="identity-dlg-refresh-btn" 				 type="button"				 aria-label="<%=REFRESH_BUTTON_TEXT%>"				 value="<%=REFRESH_BUTTON_TEXT%>" /></div><div class="identity-list-details"></div></div></div><div class="identity-footer"><div  id="identity-dlg-help-btn" class="identity-button identity-dlg-help-btn core-help-icon help-icon-img" tabindex="0" role="Button" aria-label="Help"></div><div class="identity-footer-right-set-buttons"><input class="identity-button identity-dlg-new-identity-btn 				 control-button button-grey 				 theme-button-gray-label" 				 id="identity-dlg-new-identity-btn" 				 type="button"				 aria-label="<%=NEW_IDENTITY_BUTTON_TEXT%>"				 value="<%=NEW_IDENTITY_BUTTON_TEXT%>" /><input class="identity-button identity-dlg-cancel-btn 				 control-button button-grey 				 theme-button-gray-label" 				 id="identity-dlg-cancel-btn" 				 type="button"				 aria-label="<%=CANCEL_BUTTON_TEXT%>"				 value="<%=CANCEL_BUTTON_TEXT%>" /><input class="identity-button identity-dlg-continue-btn 				 control-button				 theme-button-label" 				 id="identity-dlg-continue-btn" 				 type="button"				 aria-label="<%=CONTINUE_BUTTON_TEXT%>"				 value="<%=CONTINUE_BUTTON_TEXT%>" /></div></div></div>'}),define("digsig/js/templates/identity",[],function(){return'<div class ="identity-container theme-digsig-list-background" id="<%= viewId %>"><div class=" setup-radio"><input type="radio" name="identity-choice" id="<%= Id %>"  value="<%= name %>" tabindex="-1" ><label for="identity-choice" id="identity-choice-label">  </label> </div><div class="digsig-image" id="identity-img<%= Id %>"></div><div class="identity-details"><div class="identity-name theme-list-item-text"><span class="identity-name-text"><%= name %></span> <span class="identity-credential-type">(<%=credential_type%>)</span></div><div class="identity-issue-details theme-list-item-text"><span class="issued-by-text"><%=issued_by_text%></span> <span class="issued-by-name"><%= issued_by %></span>, <span class="expire-details"><%=expire_string%>: <%=expiration_date%> </span></div></div><div id="<%= viewId %>" class="identity-view-details theme-hyperlink" aria-label="<%=view_details_text%>" role="link"><%=view_details_text%></div></div>'}),define("digsig/js/views/identity-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/identity","i18n!digsig/js/nls/ui-strings","core/utils/truncate"],function(i,e,t,n,s){e.IdentityView=i.View.extend({events:{},initialize:function(){i.View.prototype.initialize.call(this),this.model=this.options.model,this._template=_.template(t)},_initWrapper:function(){console.log("in Identity view initialize"),this.$identityName=this.$(".identity-name"),this.$identityDetails=this.$(".identity-issue-details")},render:function(){var i=this.model.get("issued_by");i.length>32&&(i=i.substring(0,28),i=i.concat("...")),this.$el.append(_.template(t,{Id:this.model.get("Id"),name:this._escapeHtml(this.model.get("name")),credential_type:this.model.get("credential_type"),issued_by:this._escapeHtml(i),expiration_date:this.model.get("expiration_date"),viewId:this.model.get("Id"),expire_string:n.EXPIRE_TEXT,issued_by_text:n.ISSUED_BY_TEXT,view_details_text:n.VIEW_DETAILS_LINK_TEXT})),this._initWrapper(),this._selectTheDefaultID(),this._setTheImageForTheIdentity()},truncateToFit:function(){s.truncateElementText(this.$identityName),s.truncateElementText(this.$identityDetails)},_selectTheDefaultID:function(){this.model.get("is_selected")&&this.$("input[name='identity-choice']").prop("checked",!0)},_setTheImageForTheIdentity:function(){var i=this.model.get("Id"),e=this.model.get("credential_type_id");this.$("#identity-img"+i).addClass(3==e?"create-img-win":4==e?"create-img-mac":"identity-img-others")},_escapeHtml:function(i){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;","(":"&#040;",")":"&#041;","/":"&#047;","\\":"&#092;"};return i.replace(/[&<>"']/g,function(i){return e[i]})}})}),define("digsig/js/templates/digsig-show-signature-dialog-template",[],function(){return'<div class="digsig-signature-dlg-header"><span class="digsig-signature-dlg-header-text theme-text" id="digsig-signature-dlg-header-text"><%=Sign_As_Label%>"<%=Id_Name%>"</span><span id="close-label" style="display:none">Close</span><span class="digsig-signature-dlg-close core-remove-x" tabindex="0" role="button" aria-labelledby="digsig-signature-dlg-header-text close-label"></span></div><div><hr class="header-horizontal-line"></div><div class="appearance-customize"><div id="signature-appearance-menu">                <div class="appearance-menu-label  theme-text" id="apearance-menu-label1"><%=Appearance_Label%></div>                <div class="appearance-menu-container">                   <div class="digsig-relative-wrapper digsig-overflow-visible">                       <div class="digsig dropdown-btn digsig-select digsig-select-appearance theme-input-box theme-text" id="appearanceDropdown">                           <div class="digsig digsig-selected-dropdown-item digsig-selected-appearance site-catalyst theme-text" id="ocrLang"></div>                           <div class="digsig digsig-appearance-menu-container digsig-menu-container theme-input-box theme-text"></div>                           <div class="core-down-triangle digsig digsig-select-dropdown digsig-appearance-dropdown" role="button" tabindex="0" aria-labelledby="apearance-menu-label1 ocrLang"> </div>                       </div>                   </div>                </div> </div><div class="customization-btns"><input class="create-customization-btn               control-button button-grey               theme-button-gray-label"                id="create-customization-btn"               type="button"               aria-label="<%=Create_Btn_Label%>"               value="<%=Create_Btn_Label%>"/><input class="edit-customization-btn               control-button button-grey               theme-button-gray-label"                id="edit-customization-btn"               type="button"               aria-label="<%=Edit_Btn_Label%>"               value="<%=Edit_Btn_Label%>"/></div></div><div class="digsig-signature-dlg-preview"><img id="digsig-signature-dlg-preview-img"/></div><div class="prefsMenu"><div class="lockpref-viewdetails"><div class="digsig-checkbox-group"><div class="digsig-image-as-checkbox">   <input class="lock-document-checkbox" type="checkbox" id="lock-document-checkbox" role="checkbox"/>   <label for="lock-document-checkbox" > </label>   <div class="theme-text checkbox-label-text">  <%=Lock_Doc_Label%> </div></div></div><div id="<%= viewId %>" class="cert-view-details theme-hyperlink" tabindex="0" aria-label="<%=View_Certificate_Details_Label%>" role="link"><%=View_Certificate_Details_Label%></div></div><div class="reason-contact"><div class="reason-menu"><div class="reason-menu-label theme-text" id="reason-menu-label"><%=Reason_Label%></div><div class="reason-menu-containter">                   <div class="digsig-relative-wrapper digsig-overflow-visible">                       <div class="digsig dropdown-btn digsig-select digsig-select-reason theme-input-box theme-text">                           <div class="digsig digsig-selected-dropdown-item digsig-selected-reason reason-text-noneditable site-catalyst theme-text" id="digsig-selected-reason-label"></div>                           <input class="digsig digsig-selected-dropdown-item digsig-selected-reason reason-text-box site-catalyst theme-input-box  theme-text" id="reasonTextId"/>                           <div class="digsig digsig-reason-menu-container digsig-menu-container theme-input-box theme-text"></div>                           <div class=" digsig digsig-reason-dropdown-btn">                               <div class="core-down-triangle digsig digsig-select-dropdown digsig-reason-select-dropdown" tabindex="0" role="button" aria-labelledby="reason-menu-label digsig-selected-reason-label reasonTextId"> </div>                           </div>                       </div>                   </div></div></div><div class="location-menu"><div class="location-menu-label theme-text"><%=Location_Label%></div><input class="location-menu-field theme-input-box  theme-text "   id="location-menu-field"   type="text"/></div><div class="contact-info"><div class="contact-info-label theme-text"><%=Contact_Info_Label%></div><input class="contact-info-field theme-input-box  theme-text "   id="contact-info-field"   type="text"/></div></div><div class="reason-contact-hr"><hr class="reason-horizontal-line"></div></div><div class="certify-signature-controls"><div class="permitted-action-menu" ><div class="permitted-action-label theme-text" id="permitted-action-label"><%=Permitted_Action_Label%></div><div class="permitted-action-container">                   <div class="digsig-relative-wrapper digsig-overflow-visible">                       <div class="digsig dropdown-btn digsig-select digsig-select-permitted-action theme-input-box theme-text" id = "permittedActionDropdown" tabindex = "0">                           <div class="digsig digsig-selected-dropdown-item digsig-selected-permitted-action site-catalyst theme-text" id="mdpActionId"></div>                           <div class="digsig digsig-permitted-action-menu-container digsig-menu-container theme-input-box theme-text"></div>                           <div class="core-down-triangle digsig digsig-select-dropdown digsig-permitted-action-select-dropdown" tabindex="0" role="button" aria-labelledby="permitted-action-label permittedActionDropdown"> </div>                       </div>                   </div></div></div><div class="review-document-menu"><div class="review-document-label theme-text"><%=Review_Doc_Label%></div><input class="review-document-btn               control-button button-grey               theme-button-gray-label"                id="review-document-btn"               type="button"               aria-label="<%=Review_Btn_Label%>"               value="<%=Review_Btn_Label%>"/></div><div><hr class="reason-horizontal-line"></div></div><div class="digsig-signature-dlg-footer"><div class="password-menu"><input class="digsig-signature-dlg-password-field theme-input-box theme-text"               id="digsig-signature-dlg-password-field"               type="password"               aria-label="password field"               placeholder="<%=Password_Field_Placeholder_Label%>"/><div class="password-incorrect"><%=Password_Incorrect_Label%></div></div><div class="btn-container-right"><input class="digsig-signature-dlg-back-btn               control-button button-grey               theme-button-gray-label"                id="digsig-signature-back-btn"               type="button"               aria-label="<%=Back_Btn_Label%>"               value="<%=Back_Btn_Label%>"/><input class="digsig-signature-dlg-sign-btn               control-button               theme-button-label"                id="digsig-signature-sign-btn"               type="button"               aria-label="<%=Sign_Btn_Label%>"               value="<%=Sign_Btn_Label%>"/></div></div>'
}),define("digsig/js/templates/digsig-show-customization-dialog-template",[],function(){return'<div class="customization-dlg-header"><span class="customization-dlg-header-text theme-text" id="customization-dlg-header-text"><%=Customize_Dialog_Title_Label%></span><span id="close-label" style="display:none">Close</span><span class="customization-dlg-close core-remove-x" tabindex="0" role="button" aria-labelledby="customization-dlg-header-text close-label"></span></div><div><hr class="header-horizontal-line"></div><div class="customization-title-bar"><button class="text-customization-btn customization-sig-kind-btn"><div class="text-customization-btn-icon customization-sig-btn-icon"></div><span class="text-customization-btn-label customization-sig-btn-label theme-text"><%=Text_Btn_Label%></span></button><button class="draw-customization-btn customization-sig-kind-btn"><div class="draw-customization-btn-icon customization-sig-btn-icon"></div><span class="draw-customization-btn-label customization-sig-btn-label"><%=Draw_Btn_Label%></span></button><button class="image-customization-btn customization-sig-kind-btn"><div class="image-customization-btn-icon customization-sig-btn-icon"></div><span class="image-customization-btn-label customization-sig-btn-label theme-text"><%=Image_Btn_Label%></span></button><button class="none-customization-btn customization-sig-kind-btn"><div class="none-customization-btn-icon customization-sig-btn-icon"></div><span class="none-customization-btn-label customization-sig-btn-label  theme-text"><%=None_Btn_Label%></span></button><div role="presentation" class="toolbar-selection-pointer"></div></div><div class="customization-dlg-signature-preview"><img id="customization-dlg-signature-preview-img"/></div><div class="image-controls"><div class="image-control-buttons"><div class="browse-image-control theme-hyperlink" tabindex="0" role="link"><%=Browse_Label%></div><div class="clear-image-control theme-hyperlink" tabindex="0" role="link"><%=Clear_Label%></div></div></div><div class="draw-controls"><div class="draw-again-control theme-hyperlink" tabindex="0" role="link"><%=Draw_Again_Label%></div></div><div class="appearance-controls"><div class="include-text-menu"><div class="include-text-label theme-text"><%=Include_Text_Label%></div><div class="include-text-checkbox-group"><div class="include-text-checkbox-group-left"><div class="name-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox"><input type="checkbox" name="Name" class="name-checkbox" id="nameCheckbox" aria-labelledby="name-checkbox-label"><label for="nameCheckbox" class="name-checkbox-label include-text-checkbox-controls-label theme-text" id="name-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=Name_Checkbox_Label%></div></div><div class="date-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox" ><input type="checkbox" name="Date" class="date-checkbox" id="dateCheckbox" aria-labelledby="date-checkbox-label"><label for="dateCheckbox" class="date-checkbox-label include-text-checkbox-controls-label theme-text" id="date-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=Date_Checkbox_Label%></div></div><div class="logo-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox"><input type="checkbox" name="Logo" class="logo-checkbox" id="logoCheckbox" aria-labelledby="logo-checkbox-label"><label for="logoCheckbox" class="logo-checkbox-label include-text-checkbox-controls-label theme-text" id="logo-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=Logo_Checkbox_Label%></div></div><div class="reason-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox"><input type="checkbox" name="Reason" class="reason-checkbox" id="reasonCheckbox" aria-labelledby="reason-checkbox-label"><label for="reasonCheckbox" class="reason-checkbox-label include-text-checkbox-controls-label theme-text" id="reason-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=Reason_Checkbox_Label%></div></div></div><div class="include-text-checkbox-group-right "><div class="dn-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox"><input type="checkbox" name="DN" class="dn-checkbox" id="DNCheckbox" aria-labelledby="dn-checkbox-label"><label for="DNCheckbox" class="dn-checkbox-label include-text-checkbox-controls-label theme-text" id="dn-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=DN_Checkbox_Label%></div></div><div class="version-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox"><input type="checkbox" name="Version" class="version-checkbox" id="versionCheckbox" aria-labelledby="version-checkbox-label"><label for="versionCheckbox" class="version-checkbox-label include-text-checkbox-controls-label theme-text" id="version-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=Version_Checkbox_Label%></div></div><div class="location-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox" ><input type="checkbox" name="Location" class="location-checkbox" id="locationCheckbox" aria-labelledby="location-checkbox-label"><label for="locationCheckbox" class="location-checkbox-label include-text-checkbox-controls-label theme-text" id="location-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=Location_Checkbox_Label%></div></div><br><div class="label-checkbox-container include-text-checkbox-controls digsig-image-as-checkbox"><input type="checkbox" name="Label" class="label-checkbox" id="labelCheckbox" aria-labelledby="label-checkbox-label"><label for="labelCheckbox" class="label-checkbox-label include-text-checkbox-controls-label theme-text" id="label-checkbox-label"></label></span><div class="checkbox-label-text theme-text"><%=Labels_Checkbox_Label%></div></div></div></div></div><div class="digits-menu"><div class="digits-format"><div class="digits-format-label theme-text" id="digits-format-label1"><%=Digits_Format_Label%></div><div class="digits-format-container"><button class="auto-format-btn"><label class="auto-format-label theme-text"><%=Auto_Format_Label%></label></button><button class="lefttoright-format-btn"><div class="lefttoright-format-btn-icon customization-sig-btn-icon"></div></button><button class="righttoleft-format-btn"><div class="righttoleft-format-btn-icon customization-sig-btn-icon"></div></button></div></div><div class="digits-type"><div class="digits-type-label theme-text" id="digits-type-label1"><%=Digits_Label%></div><div class="digits-type-container">                   <div class="digsig-relative-wrapper digsig-overflow-visible">                       <div class="digsig dropdown-btn digsig-select digsig-select-digits theme-input-box theme-text" id = "appearanceDropdown">                           <div class="digsig digsig-selected-dropdown-item digsig-selected-digits site-catalyst theme-text" id="digitsSelectId"></div>                           <div class="digsig digsig-digits-menu-container digsig-menu-container theme-input-box theme-text"></div>                           <div class="core-down-triangle digsig digsig-select-dropdown digsig-digits-select-dropdown" tabindex="0" role="button" aria-labelledby="digits-type-label1 digitsSelectId"> </div>                       </div>                   </div></div></div></div></div><div class="customization-dialog-footer"><div class="appearance-name-container"><div class="appearance-name-label theme-text" id="appearance-name-label1"><%=Preset_Name_Label%></div><input class="appearance-name-field theme-input-box  theme-text" aria-labelledby="appearance-name-label1"	id="appearance-name-field"	type="text"/></div><div class="btn-container-right"><input class="customization-dlg-cancel-btn               control-button button-grey               theme-button-gray-label"                id="customization-dlg-cancel-btn"               type="button"               aria-label="<%=Cancel_Btn_Label%>"               value="<%=Cancel_Btn_Label%>"/><input class="customization-dlg-save-btn				control-button				theme-button-label" 				id="customization-dlg-save-btn"				type="button"				aria-label="<%=Save_Btn_Label%>"				value="<%=Save_Btn_Label%>"/></div></div><div id="myModal" class="modal"><div class="modal-content ui-theme theme-container"><div class="digsig-draw-model-dlg-header"><span id="close-label" style="display:none">Close</span><span class="draw-model-dlg-close core-remove-x" tabindex="0" role="button" aria-labelledby="close-label"></span></div><div class="draw-area-container"><canvas id="digsig-sig-draw" class="scribble-canvas"></canvas></div><div class="draw-dialog-footer"><input class="draw-dlg-clear-btn               control-button button-grey               theme-button-gray-label"                id="draw-dlg-clear-btn"               type="button"               aria-label="<%=Clear_Btn_Label%>"               value="<%=Clear_Btn_Label%>"/><input class="draw-dlg-apply-btn               control-button               theme-button-label"                id="draw-dlg-apply-btn"               type="button"               aria-label="<%=Apply_Btn_Label%>"               value="<%=Apply_Btn_Label%>"/><input class="draw-dlg-cancel-btn               control-button button-grey               theme-button-gray-label"                id="draw-dlg-cancel-btn"               type="button"               aria-label="<%=Cancel_Btn_Label%>"               value="<%=Cancel_Btn_Label%>"/></div></div>'}),define("digsig/js/xlib/digsig-draw-util",["core/ac-core","digsig/js/ac-digsig"],function(i,e){function t(i){function t(){var i=$.Deferred(),t={methodName:"SetDrawPreviewData",methodArgs:[{state:"start"}]};return e.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:t.methodName,methodArgs:t.methodArgs}).done(_.bind(function(){i.resolve()},this)).fail(function(){i.reject("Failed to startSaveSignature")})},this)),i.promise()}function n(i,t,n){function s(i,t,n){var a={methodName:"SetDrawPreviewData",methodArgs:[{state:"continue"}]},d=i.length;t+n>=d?(a.methodArgs[0].imgData=i.substr(t),e.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:a.methodName,methodArgs:a.methodArgs}).done(_.bind(function(){o.resolve()},this)).fail(function(){o.reject("Failed to saveSignatureData")})},this))):(a.methodArgs[0].imgData=i.substr(t,n),e.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:a.methodName,methodArgs:a.methodArgs}).done(_.bind(function(){s(i,t+n,n)},this)).fail(function(){o.reject("Failed to saveSignatureData")})},this)))}var o=$.Deferred();return s(i,t,n),o.promise()}function s(){var i=$.Deferred(),t={methodName:"SetDrawPreviewData",methodArgs:[{state:"complete"}]};return e.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:t.methodName,methodArgs:t.methodArgs}).done(_.bind(function(){i.resolve()},this)).fail(function(){i.reject("Failed to saveSignatureData")})},this)),i.promise()}var o=$.Deferred(),a=51200,d=i.pngData;return t().then(function(){return n(d,0,a)}).then(s).done(function(){o.resolve()}).fail(function(i){o.reject("Error saving signature: "+i)}),o.promise()}return{saveSignature:t}}),define("digsig/js/views/digsig-show-customization-dialog-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/digsig-show-customization-dialog-template","i18n!digsig/js/nls/ui-strings","core/utils/css-util","dc-scribble-capture","dc-scribble-utils","digsig/js/xlib/digsig-draw-util","digsig/js/views/digsig-dropdown-view","digsig/js/views/digsig-show-signature-dialog-view"],function(i,e,t,n,s,o,a,d){var r="dcscribble";e.ShowCustomizationDialogView=i.View.extend({events:{"change	.name-checkbox":"_setAppearancePreview","change	.date-checkbox":"_setAppearancePreview","change	.location-checkbox":"_setAppearancePreview","change	.reason-checkbox":"_setAppearancePreview","change	.dn-checkbox":"_setAppearancePreview","change	.version-checkbox":"_setAppearancePreview","change	.logo-checkbox":"_setAppearancePreview","change	.label-checkbox":"_setAppearancePreview","click	.customization-dlg-save-btn":"_saveCustomAppearance","click 	.browse-image-control":"_onBrowseImageClick","keydown 	.browse-image-control":"_onBrowseImageKeydown","click 	.image-customization-btn":"_onImageBtnClick","click  .text-customization-btn":"_onTextBtnClick","click  .none-customization-btn":"_onNoneBtnClick","click  .customization-dlg-cancel-btn":"_onCancelBtnClick","change	.digits-type-dropdown":"_setAppearancePreview","change .digits-format-dropdown":"_setAppearancePreview","click  .customization-dlg-close":"_onCancelBtnClick","keydown  .customization-dlg-close":"_onCancelBtnKeyDown","click  .draw-model-dlg-close":"_onCloseModelWindowClick","click  .draw-dlg-cancel-btn":"_onCloseModelWindowClick","click  .draw-customization-btn":"_onDrawBtnClick","click  .clear-image-control":"_onClearImageClick","keydown  .clear-image-control":"_onClearImageKeydown","click  .auto-format-btn":"_onAutoFormatClick","click  .lefttoright-format-btn":"_onLeftToRightBtnClick","click  .righttoleft-format-btn":"_onRightToLeftBtnClick","click  .digsig.digsig-select-digits":"_onDigitsSelectClick","change .include-text-checkbox-controls":"_onCheckboxChange","keydown .digsig-digits-select-dropdown":"_onDigitsArrowKeydown","click  .draw-dlg-apply-btn":"_onDrawApplyBtnClick","click  .draw-dlg-clear-btn":"_onDrawClearBtnClick","click  .draw-again-control":"_onDrawBtnClick","keydown .draw-again-control":"_onDrawBtnKeydown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t),this.isSetPreviewOptions=!1,this.previewType=1,this.digitsFormat=0,this._addUiModelEventListeners(),this.isDirectInkActivated=0},render:function(){return i.View.prototype.render.call(this),this.$el.html(this._template({Customize_Dialog_Title_Label:n.CUTOMIZE_DIALOG_TITLE_TEXT,Text_Btn_Label:n.TEXT_BUTTON_TEXT,Image_Btn_Label:n.IMAGE_BUTTON_TEXT,None_Btn_Label:n.NONE_BUTTON_TEXT,Clear_Label:n.CLEAR_LABEL_TEXT,Browse_Label:n.BROWSE_BUTTON,Include_Text_Label:n.INCLUDE_TEXT_LABEL_TEXT,Name_Checkbox_Label:n.NAME_CHECKBOX_LABEL_TEXT,Date_Checkbox_Label:n.DATE_CHECKBOX_LABEL_TEXT,Location_Checkbox_Label:n.LOCATION_CHECKBOX_LABEL_TEXT,Reason_Checkbox_Label:n.REASON_CHECKBOX_LABEL_TEXT,DN_Checkbox_Label:n.DN_CHECKBOX_LABEL_TEXT,Version_Checkbox_Label:n.VERSION_CHECKBOX_LABEL_TEXT,Logo_Checkbox_Label:n.LOGO_CHECKBOX_LABEL_TEXT,Labels_Checkbox_Label:n.LABEL_CHECKBOX_LABEL_TEXT,Digits_Format_Label:n.TEXT_DIRECTION_LABEL_TEXT,Digits_Label:n.DIGITS_FORMAT_LABEL_TEXT,Preset_Name_Label:n.PRESET_NAME_TEXT,Save_Btn_Label:n.SAVE_BUTTON_TEXT,Cancel_Btn_Label:n.CANCEL_BUTTON_TEXT,Draw_Btn_Label:n.DRAW_BUTTON_TEXT,Auto_Format_Label:n.AUTO_LABEL_TEXT,Apply_Btn_Label:n.APPLY_BUTTON_TEXT,Clear_Btn_Label:n.CLEAR_LABEL_TEXT,Draw_Again_Label:n.CLICK_TO_DRAW_TEXT})),this._initWrappers(),this._resizeDialog().then(_.bind(function(){this._initializeCurretnView()},this)),this},_initializeCurretnView:function(){2==this.options.DigSigUiModel.get("mode")&&this.$customAppearanceName.val(this.options.DigSigUiModel.get("selectedApText"));var i=this._setAppearancePreview(),t=this._populateDigitsTypeMenu();t.then(_.bind(function(i){var t=_.extend({menuItems:i},this.options);this.nativeDigitsData=i,this.$selectedDigits.text(i[0].name),this.digitsMenuView=this._renderChildView("_digitsMenuView",e.DigSigDropdownMenuView,this.$digitsContainer,t)},this)),Promise.all([i,t]).then(_.bind(function(){this._initPreviewOptionsData().then(_.bind(function(){this._updateCSS(),this._enableDisablePreviewBtns()},this))},this))},_initWrappers:function(){this.$preview=this.$el.find("#customization-dlg-signature-preview-img"),this.$nameCheckbox=this.$el.find(".name-checkbox"),this.$dateCheckbox=this.$el.find(".date-checkbox"),this.$locationCheckbox=this.$el.find(".location-checkbox"),this.$reasonCheckbox=this.$el.find(".reason-checkbox"),this.$dnCheckbox=this.$el.find(".dn-checkbox"),this.$versionCheckbox=this.$el.find(".version-checkbox"),this.$logoCheckbox=this.$el.find(".logo-checkbox"),this.$labelCheckbox=this.$el.find(".label-checkbox"),this.$customAppearanceName=this.$el.find(".appearance-name-field"),this.$appearanceControl=this.$el.find(".appearance-controls"),this.$previewArea=this.$el.find(".customization-dlg-signature-preview"),this.$imageControls=this.$el.find(".image-controls"),this.$drawControls=this.$el.find(".draw-controls"),this.$digitsDropdown=this.$el.find(".digits-type-dropdown"),this.$digitsFormatDropdown=this.$el.find(".digits-format-dropdown"),this.$underline=this.$el.find(".toolbar-selection-pointer"),this.$digitsContainer=this.$el.find(".digsig.digsig-digits-menu-container"),this.$selectedDigits=this.$el.find(".digsig.digsig-selected-digits"),this.$drawCanvas=this.$el.find("#digsig-sig-draw"),this.$drawAreaContainer=this.$el.find(".draw-area-container")},_onDigitsArrowKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onDigitsSelectClick(i)},_resizeDialog:function(){var i=window.$el.find("#digsig-customization")[0].scrollHeight+2,e=700,t=this.options.docWindowWidth,n=this.options.docWindowHeight;i=Math.min(i,n),e=Math.min(e,t);var s=$.Deferred();return $(document).ready(_.bind(function(){this.options.appApi.rnaApi.done(_.bind(function(t){t.cefBrowserApi({methodName:"setContainerSize",parameters:[Math.floor(e),Math.floor(i)]}).done(function(){s.resolve()})},this))},this)),s.promise()},_populateDigitsTypeMenu:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"GetNativeDigitsTypeMenu",methodArgs:{}}).done(_.bind(function(e){var t=this.$digitsDropdown,n=[];$.each(e,_.bind(function(i){var s=e[i],o={code:i,name:s};n.push(o),t.append($("<option></option>").val(i).html(s))},this)),i.resolve(n)},this))},this)),i.promise()},_getPreviewOptionsControls:function(){return{nameCheckbox:this.$nameCheckbox.prop("checked"),dateCheckbox:this.$dateCheckbox.prop("checked"),locationCheckbox:this.$locationCheckbox.prop("checked"),reasonCheckbox:this.$reasonCheckbox.prop("checked"),dnCheckbox:this.$dnCheckbox.prop("checked"),versionCheckbox:this.$versionCheckbox.prop("checked"),logoCheckbox:this.$logoCheckbox.prop("checked"),labelCheckbox:this.$labelCheckbox.prop("checked"),pictureLayout:this.previewType,nativeDigitsSelIndex:this.options.DigSigUiModel.get("nativeDigitsSelIndex"),textDirection:this.digitsFormat}},_initAppearancePreview:function(){var i=630,e=200,t=this.options.DigSigUiModel.get("appearanceIndex"),n=this.options.DigSigUiModel.get("selectedId"),s=this.options.DigSigUiModel.get("reasonText"),o=this.options.DigSigUiModel.get("locationText"),a=this.options.DigSigUiModel.get("mode"),d=null;this.isSetPreviewOptions?d=this._getPreviewOptionsControls():(d=null,this.isSetPreviewOptions=!0);var r=[{previewSize:{width:i,height:e},appearanceId:t,digitalId:n,reasonText:s,locationText:o,previewOptions:d,mode:a}];return r},_onCheckboxChange:function(i){var e=$(i.target);e.is(":checked")?e.attr("aria-checked","true"):e.attr("aria-checked","false")},_setAppearancePreview:function(){var e=$.Deferred(),t=this._initAppearancePreview();return this.options.appApi.rnaApi.done(_.bind(function(n){n.rnaDigSigAPI.invokeMethod({methodName:"signAppearancePreview",methodArgs:t}).done(_.bind(function(t){var n=new i.RNAModel(void 0,_.extend({_proxy:t})),s=n.get("signApPreviewURL");s&&this.$preview.attr("src",s),e.resolve()},this))},this)),e.promise()},_initPreviewOptionsData:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"GetPreviewOptionsData",methodArgs:{}}).done(_.bind(function(e){this._updatePreviewOptions(e),i.resolve()},this))},this)),i.promise()},_updatePreviewOptions:function(i){this.$nameCheckbox.prop("checked",i.nameCheckbox),this.$nameCheckbox.attr("aria-checked",i.nameCheckbox.toString()),this.$dateCheckbox.prop("checked",i.dateCheckbox),this.$dateCheckbox.attr("aria-checked",i.dateCheckbox.toString()),this.$locationCheckbox.prop("checked",i.locationCheckbox),this.$locationCheckbox.attr("aria-checked",i.locationCheckbox.toString()),this.$reasonCheckbox.prop("checked",i.reasonCheckbox),this.$reasonCheckbox.attr("aria-checked",i.reasonCheckbox.toString()),this.$dnCheckbox.prop("checked",i.dnCheckbox),this.$dnCheckbox.attr("aria-checked",i.dnCheckbox.toString()),this.$versionCheckbox.prop("checked",i.versionCheckbox),this.$versionCheckbox.attr("aria-checked",i.versionCheckbox.toString()),this.$logoCheckbox.prop("checked",i.logoCheckbox),this.$logoCheckbox.attr("aria-checked",i.logoCheckbox.toString()),this.$labelCheckbox.prop("checked",i.labelCheckbox),this.$labelCheckbox.attr("aria-checked",i.labelCheckbox.toString()),this.options.DigSigUiModel.set("nativeDigitsSelIndex",i.nativeDigitsSelIndex),this.$selectedDigits.text(this.nativeDigitsData[i.nativeDigitsSelIndex].name),this.previewType=i.pictureLayout,this.digitsFormat=i.textDirection,this._updateDigitsFormatCSS()},_saveCustomAppearance:function(){var i=this.$customAppearanceName.val();this.options.appApi.rnaApi.done(_.bind(function(t){t.rnaDigSigAPI.invokeMethod({methodName:"SaveCustomAppearance",methodArgs:[{appearanceName:i}]}).done(_.bind(function(i){if(i.isSavedSuccessfully){if(1==this.options.DigSigUiModel.get("mode")){var t=this.options.DigSigUiModel.get("numofAppearances");this.options.DigSigUiModel.set("appearanceIndex",t)}this._unbindEventsandRemoveChildViews(),this.$el.hide(),window.$el.find("#digsig-signature").show(),this._renderChildView("_showSignatureDialogView",e.ShowSignatureDialogView,window.$el.find("#digsig-signature"),this.options)}},this))},this))},_updateCSS:function(){3==this.previewType?(this.$drawControls.hide(),this.$previewArea.css("margin-bottom","0px"),this.$appearanceControl.css("margin-top","0px"),this.$imageControls.show()):2==this.previewType?(this.$imageControls.hide(),this.$previewArea.css("margin-bottom","0px"),this.$appearanceControl.css("margin-top","0px"),this.$drawControls.show()):(this.$imageControls.hide(),this.$drawControls.hide(),this.$appearanceControl.css("margin-top","25px"),this.$previewArea.css("margin-bottom","25px"))},_BrowseCustomImage:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"BrowseCustomImage",methodArgs:{}}).done(_.bind(function(e){i.resolve(e.isImageSelected)},this))},this)),i.promise()},_onBrowseImageClick:function(){var i=this._BrowseCustomImage();i.then(_.bind(function(i){i&&this._setAppearancePreview()},this))},_onBrowseImageKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onBrowseImageClick(i)},_ClearImagePreview:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"ClearImagePreview",methodArgs:[{previewType:this.previewType}]}).done(_.bind(function(e){e.isImageCleared&&i.resolve()},this))},this)),i.promise()},_onClearImageClick:function(){var i=this._ClearImagePreview();i.then(_.bind(function(){this._setAppearancePreview()},this))},_onClearImageKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onClearImageClick(i)},_onImageBtnClick:function(){this.previewType=3,this._enableDisablePreviewBtns(),this._setAppearancePreview().then(_.bind(function(){this._updateCSS()},this))},_onTextBtnClick:function(){this.previewType=1,this._updateCSS(),this._enableDisablePreviewBtns(),this._setAppearancePreview()},_onNoneBtnClick:function(){this.previewType=4,this._updateCSS(),this._enableDisablePreviewBtns(),this._setAppearancePreview()},_trimDrawData:function(i){var e=$.Deferred(),t=i.scribble,n=t.getImageData(a.TRIM_POLICY_WIDTH,10,0,500);return e.resolve({newArea:{height:n.height,width:n.width},imgData:n.data}),e.promise()},_clearDrawData:function(){var i=this._ClearImagePreview();i.then(_.bind(function(){this._setAppearancePreview(),this._onCloseModelWindowClick()},this))},_onDrawClearBtnClick:function(){this.options.appApi.rnaApi.done(function(i){i.sendSignatureToDirectInk("Clear","0")});var i=this._scribble(this.$drawCanvas);i&&i.clear()},_onDirectInkUpdate:function(){var i=this.$drawCanvas;if(i)if(1==this.options.DigSigUiModel.attributes.isBlank)this._clearDrawData();else{var e=({$canvas:i,scribble:this._scribble(i)},{pngData:"testing",imageSize:{width:1,height:1}});d.saveSignature(e).then(_.bind(function(){this._setAppearancePreview(),this._onCloseModelWindowClick()},this))}},_onDrawApplyBtnClick:function(){this.isDirectInkActivated?this.options.appApi.rnaApi.done(function(i){i.sendSignatureToDirectInk("setsign","0")}):this._onDrawApplyBtnClickConventional()},_onDrawApplyBtnClickConventional:function(){var i=this.$drawCanvas;if(i)if(this._scribbleBlank(i))this._clearDrawData();else{var e={$canvas:i,scribble:this._scribble(i)};this._trimDrawData(e).then(_.bind(function(i){var e={pngData:i.imgData,imageSize:{width:i.newArea.width,height:i.newArea.height}};d.saveSignature(e).then(_.bind(function(){this._setAppearancePreview(),this._onCloseModelWindowClick()},this))},this))}},_addUiModelEventListeners:function(){this.listenTo(this.options.DigSigUiModel,"change:isSigned",this._onDirectInkUpdate)},_scribble:function(i){return i.data(r)},_scribbleBlank:function(i){var e=this._scribble(i);return e?e.isEmpty():!0},_initializeDrawCanvas:function(){var i=this.$drawCanvas,e=this._scribble(i);e||(i.data(r,new o(i[0])),e=this._scribble(i),e.penWidthRatio=.018),e.intent=a.INTENT_SIGNATURE,e.height=this.$drawAreaContainer.height(),e.width=this.$drawAreaContainer.width();var t=e.width.toString();t+="+",t+=e.height.toString(),t+="+",t+=i.offset().left.toString(),t+="+",t+=i.offset().top.toString(),t+="+",t+=window.devicePixelRatio.toString();var n=this,s={event:"draw",info:t};this.options.appApi.rnaApi.done(function(i){i.rnaServicesTestAPI.invokeMethod({methodName:"directInkEvent",methodArgs:s}).then(_.bind(function(i){return i?(n.isDirectInkActivated=1,e.penColor="#FFF"):n.isDirectInkActivated=0,e},this))})},_onDrawBtnClick:function(){this.previewType=2,this._updateCSS(),this._enableDisablePreviewBtns(),this._setAppearancePreview().then(_.bind(function(){this._updateCSS(),this.$el.find(".modal").show(),this._initializeDrawCanvas()},this))},_onDrawBtnKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onDrawBtnClick(i)},_unbindEventsandRemoveChildViews:function(){this.undelegateEvents(),this.removeAllChildViews()},_onCancelBtnClick:function(){this._unbindEventsandRemoveChildViews(),this.$el.hide(),window.$el.find("#digsig-signature").show(),this._renderChildView("_showSignatureDialogView",e.ShowSignatureDialogView,window.$el.find("#digsig-signature"),this.options)},_onCancelBtnKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onCancelBtnClick(i)},_onCloseModelWindowClick:function(){this.options.appApi.rnaApi.done(function(i){i.sendSignatureToDirectInk("Cancel","0")}),this.$el.find(".modal").hide()},_onCheckboxClick:function(i){i.target.id},_setCustomPreview:function(){1==this.previewType?this.options.DigSigUiModel.set("selectedCustomPreview","text"):2==this.previewType?this.options.DigSigUiModel.set("selectedCustomPreview","draw"):3==this.previewType?this.options.DigSigUiModel.set("selectedCustomPreview","image"):4==this.previewType&&this.options.DigSigUiModel.set("selectedCustomPreview","none")},_enableDisablePreviewBtns:function(){this._setCustomPreview();var i=this.options.DigSigUiModel.get("selectedCustomPreview");this.$allBtns=this.$el.find(".customization-sig-kind-btn");var e,t=this.$el.find("."+i+"-customization-btn"),n=t.length>0&&t[0];for(e=0;e<this.$allBtns.length;e++){var o=$(this.$allBtns[e]);if(o.is(n)){o.addClass("selected-custom-preview").prop("disabled","true"),o.css("cursor","default");var a=s.getFullWidth(o);this.$underline.width(o.find(".customization-sig-btn-label").width()),this.$underline.show().css("left",o.position().left+1+(a-this.$underline.width())/2+"px")}else o.removeClass("selected-custom-preview").prop("disabled",!1),o.css("cursor","");n||this.$underline.hide()}},_updateDigitsFormatCSS:function(){0==this.digitsFormat?(this.$el.find(".auto-format-btn").css("background-color","#dddddd"),this.$el.find(".auto-format-btn").removeClass("theme-input-box"),this.$el.find(".auto-format-label").addClass("auto-format-btn-text-color").removeClass("theme-text")):(this.$el.find(".auto-format-btn").addClass("theme-input-box"),this.$el.find(".auto-format-label").removeClass("auto-format-btn-text-color").addClass("theme-text")),2==this.digitsFormat?(this.$el.find(".lefttoright-format-btn").css("background-color","#dddddd"),this.$el.find(".lefttoright-format-btn").removeClass("theme-input-box")):this.$el.find(".lefttoright-format-btn").addClass("theme-input-box"),1==this.digitsFormat?(this.$el.find(".righttoleft-format-btn").css("background-color","#dddddd"),this.$el.find(".righttoleft-format-btn").removeClass("theme-input-box")):this.$el.find(".righttoleft-format-btn").addClass("theme-input-box")},_onAutoFormatClick:function(){this.digitsFormat=0,this._updateDigitsFormatCSS(),this._setAppearancePreview()},_onLeftToRightBtnClick:function(){this.digitsFormat=2,this._updateDigitsFormatCSS(),this._setAppearancePreview()},_onRightToLeftBtnClick:function(){this.digitsFormat=1,this._updateDigitsFormatCSS(),this._setAppearancePreview()},_onDigitsSelectClick:function(){this.digitsMenuView.show().done(_.bind(function(i,e){null!=i&&(this.$selectedDigits.text(e),this.options.DigSigUiModel.set("nativeDigitsSelIndex",i),this._setAppearancePreview())},this))}})}),define("digsig/js/views/digsig-show-signature-dialog-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/digsig-show-signature-dialog-template","i18n!digsig/js/nls/ui-strings","core/utils/view-util","digsig/js/views/digsig-dropdown-view","digsig/js/models/ui/digsig-ui-model","digsig/js/views/digsig-show-customization-dialog-view"],function(i,e,t,n,s){e.ShowSignatureDialogView=i.View.extend({events:{"click .digsig-signature-dlg-sign-btn":"_initiateSigning","click .cert-view-details":"_handleViewDetailsClick","keydown .cert-view-details":"_handleViewDetailsKeydown","click   .digsig-signature-dlg-close":"_closeSignatureDialog","keydown   .digsig-signature-dlg-close":"_closeSignatureDialog","focusout	.location-menu-field":"_setAppearancePreview","focusout	.reason-text-box":"_setAppearancePreview","click .create-customization-btn":"_onCreateBtnClick","click .edit-customization-btn":"_onEditBtnClick","click 	.digsig-signature-dlg-back-btn":"_onBackBtnClick","click  .review-document-btn":"_onReviewDocClick","input	.digsig-signature-dlg-password-field":"_onPasswordInputChange","paste  .digsig-signature-dlg-password-field":"_onPasswordPaste","click .digsig.digsig-select-appearance":"_onAppearanceMenuClick","click .digsig.digsig-reason-dropdown-btn":"_onReasonMenuClick","click .digsig.digsig-select-permitted-action":"_onPermittedActionMenuClick","click .digsig.reason-text-noneditable":"_onReasonMenuClick","keydown .digsig-appearance-dropdown":"_onAppearanceArrowKeydown","keydown .digsig-reason-select-dropdown":"_onReasonArrowKeydown"},initialize:function(){i.View.prototype.initialize.call(this),this._template=_.template(t),this.backBtnClicked=!1,this.isReviewBtnClicked=!1,this.isReasonEditable=!0,this.isPassworkFieldOk=!1,this.reasonData=[]},_initWrappers:function(){this.$preview=this.$el.find("#digsig-signature-dlg-preview-img"),this.$appearanceMenuDropdown=this.$el.find("#appearance-menu-dropdown"),this.$reasonMenuDropdown=this.$el.find("#reason-menu-dropdown"),this.$reasonText=this.$el.find(".reason-text-box"),this.$reasonMenu=this.$el.find(".reason-menu"),this.$locationMenu=this.$el.find(".location-menu"),this.$locationText=this.$el.find(".location-menu-field"),this.$contactInfo=this.$el.find(".contact-info"),this.$passwordField=this.$el.find(".digsig-signature-dlg-password-field"),this.$contactInfoText=this.$el.find(".contact-info-field"),this.$mdpMenuDropdown=this.$el.find(".permitted-action-dropdown"),this.$lockDocContainer=this.$el.find(".digsig-checkbox-group"),this.$lockDocControl=this.$el.find(".lock-document-checkbox"),this.$appearanceCustomize=this.$el.find(".appearance-customize"),this.$appearancePreviewContainer=this.$el.find(".digsig-signature-dlg-preview"),this.$reviewDocMenu=this.$el.find(".review-document-menu"),this.$reasonContact=this.$el.find(".reason-contact"),this.$editAppearanceBtn=this.$el.find(".edit-customization-btn"),this.$createAppearanceBtn=this.$el.find(".create-customization-btn"),this.$signBtn=this.$el.find(".digsig-signature-dlg-sign-btn"),this.$passwordMenu=this.$el.find(".password-menu"),this.$appearanceContainer=this.$el.find(".digsig.digsig-appearance-menu-container"),this.$selectedAppearance=this.$el.find(".digsig.digsig-selected-appearance"),this.$reasonContainer=this.$el.find(".digsig.digsig-reason-menu-container"),this.$reasonDropdownSelect=this.$el.find(".digsig.digsig-reason-select-dropdown"),this.$permittedActionContainter=this.$el.find(".digsig.digsig-permitted-action-menu-container"),this.$selectedPermittedAction=this.$el.find(".digsig.digsig-selected-permitted-action"),this.$reasonNotEditable=this.$el.find(".digsig.reason-text-noneditable")
},render:function(){return i.View.prototype.render.call(this),this.$el.html(this._template({viewId:this.options.DigSigUiModel.get("selectedId"),Id_Name:this.options.DigSigUiModel.get("digitalIdName"),Sign_As_Label:n.SIGN_AS_TEXT,Appearance_Label:n.APPEARANCE_LABEL_TEXT,Create_Btn_Label:n.CREATE_BUTTON_TEXT,Edit_Btn_Label:n.EDIT_BUTTON_TEXT,Lock_Doc_Label:n.LOCK_DOCUMENT_AFTER_SIGNING_LABEL_TEXT,View_Certificate_Details_Label:n.VIEW_CERTIFICATE_DETAILS_LABEL_TEXT,Reason_Label:n.REASON_LABEL_TEXT,Location_Label:n.LOCATION_LABEL_TEXT,Contact_Info_Label:n.CONTACT_INFO_LABEL_TEXT,Permitted_Action_Label:n.PERMITTED_ACTION_AFTER_SIGNING_LABEL_TEXT,Review_Doc_Label:n.REVIEW_DOCUMENT_CONTENT_LABEL_TEXT,Review_Btn_Label:n.REVIEW_BUTTON_TEXT,Password_Field_Placeholder_Label:n.SIGNING_DIALOG_PASSWORD_PLACEHOLDER_TEXT,Sign_Btn_Label:n.SIGN_BUTTON_TEXT,Back_Btn_Label:n.BACK_BUTTON_TEXT,Password_Incorrect_Label:n.FILE_PASSWORD_ERROR})),this._initWrappers(),this._initializeCurrentView(),this},_onAppearanceArrowKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onAppearanceMenuClick(i)},_onReasonArrowKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onReasonMenuClick(i)},_initializeCurrentView:function(){this._getOtherSigningPrefs().then(_.bind(function(){this._renderCurrentView()},this))},_renderCurrentView:function(){var i=!0;this.options.DigSigUiModel.get("isSignatureVisible")&&(i=this._setAppearanceMenuView(),i.then(_.bind(function(i){var t=_.extend({menuItems:i},this.options);this.options.DigSigUiModel.set("numofAppearances",i.length);var n=this.options.DigSigUiModel.get("appearanceIndex");this.$selectedAppearance.text(i[n].name),this.appearanceMenuView=this._renderChildView("_appearanceDropdownView",e.DigSigDropdownMenuView,this.$appearanceContainer,t)},this)));var t=!0,n=!0;this.options.DigSigUiModel.get("isReasonControlEnabled")&&(t=this._populateReasonMenu(),t.then(_.bind(function(i){var t=_.extend({menuItems:i},this.options);i.length>0&&(this.options.DigSigUiModel.get("isReasonControlEditable")?this.$reasonText.val(i[0].name):this.$reasonNotEditable.text(i[0].name)),this.reasonData=i,this.reasonMenuView=this._renderChildView("_reasonDropDownView",e.DigSigDropdownMenuView,this.$reasonContainer,t)},this))),this.options.DigSigUiModel.get("isCertifyingSignature")&&(n=this._populateMDPMenu(),n.then(_.bind(function(i){var t=_.extend({menuItems:i},this.options),n=this.options.DigSigUiModel.get("selectedMDPSetting");this.$selectedPermittedAction.text(i[n].name),this.$mdpActionMenuView=this._renderChildView("_mdpActionMenuView",e.DigSigDropdownMenuView,this.$permittedActionContainter,t)},this))),Promise.all([i,t,n]).then(_.bind(function(){this._ShowHideSigningPrefUiControls(),this._setAppearancePreview()},this))},_initAppearancePreview:function(){var i=630,e=200,t=this.options.DigSigUiModel.get("appearanceIndex");0==t?this.$editAppearanceBtn.hide():this.$editAppearanceBtn.show();var n=this.options.DigSigUiModel.get("selectedId"),s="";s=this.isReasonEditable?this.$reasonText.val():this.$reasonNotEditable.text(),"none"==s&&(s="<"+s+">");var o=this.$locationText.val(),a=[{previewSize:{width:i,height:e},appearanceId:t,digitalId:n,reasonText:s,locationText:o,mode:0}];return a},_setAppearancePreview:function(){if(this.options.DigSigUiModel.get("isSignatureVisible")){var e=this._initAppearancePreview();this.options.appApi.rnaApi.done(_.bind(function(t){t.rnaDigSigAPI.invokeMethod({methodName:"signAppearancePreview",methodArgs:e}).done(_.bind(function(e){var t=new i.RNAModel(void 0,_.extend({_proxy:e})),n=t.get("signApPreviewURL");n&&this.$preview.attr("src",n)},this))},this))}},_setAppearanceMenuView:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"GetAppearanceMenu",methodArgs:{}}).done(_.bind(function(e){var t=this.$appearanceMenuDropdown,n=[];$.each(e,_.bind(function(i){var s=e[i],o={code:i,name:s};n.push(o);var a=$("<option></option>");a.val(i),a.html(s),a.attr("role","listitem"),t.append(a)},this)),i.resolve(n)},this))},this)),i.promise()},_renderAppearancePreview:function(){var i=this._setAppearancePreview();i&&this.$preview.attr("src",i)},_getDialogSize:function(){var i=500;return i=window.$el.find("#digsig-signature")[0].scrollHeight,this.backBtnClicked&&(i=500),i},_resizeDialog:function(){var i=this._getDialogSize()+2,e=700,t=this.options.docWindowWidth,n=this.options.docWindowHeight;i=Math.min(i,n),e=Math.min(e,t);var s=$.Deferred();return $(document).ready(_.bind(function(){this.options.appApi.rnaApi.done(_.bind(function(t){t.cefBrowserApi({methodName:"setContainerSize",parameters:[Math.floor(e),Math.floor(i)]}).done(function(){s.resolve()})},this))},this)),s.promise()},_populateReasonMenu:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"GetReasonMenu",methodArgs:{}}).done(_.bind(function(e){var t=this.$reasonMenuDropdown,n=[];$.each(e,_.bind(function(i){var s=e[i];"<none>"==s&&(s=s.substring(1,s.length-1));var o={code:i,name:s};n.push(o),t.append($("<option></option>").val(i).html(s))},this)),i.resolve(n)},this))},this)),i.promise()},_populateMDPMenu:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"GetMDPMenu",methodArgs:{}}).done(_.bind(function(e){var t=this.$mdpMenuDropdown,n=[];$.each(e,_.bind(function(i){var s=e[i],o={code:i,name:s};n.push(o),t.append($("<option></option>").val(i).html(s))},this)),i.resolve(n)},this))},this)),i.promise()},_setReasonText:function(){this.$reasonText.val(this.$reasonMenuDropdown.find(":selected").html()),this._setAppearancePreview()},_checkPassword:function(){var i=$.Deferred(),e=this.$passwordField.val(),t=this.options.DigSigUiModel.get("isShowPassword"),n=this.options.DigSigUiModel.get("selectedId");return this.options.appApi.rnaApi.done(_.bind(function(s){s.rnaDigSigAPI.invokeMethod({methodName:"IsPasswordCorrect",methodArgs:[{idPassword:e,selectedId:n,showPassword:t}]}).then(_.bind(function(e){var t=e.isPasswordOk;return t?this.$el.find(".password-incorrect").hide():this.$el.find(".password-incorrect").show(),i.resolve(t)},this),_.bind(function(){window.$el.find("#digsig-signature").show(),this.options.appApi.displayApi.showSpinner(!1)},this))},this)),i.promise()},_createOutputData:function(){var i=this.options.DigSigUiModel.get("appearanceIndex"),e="";e=this.isReasonEditable?this.$reasonText.val():this.$reasonNotEditable.text(),"none"==e&&(e="<"+e+">");var t=this.$locationText.val(),n=this.$contactInfoText.val(),s=this.options.DigSigUiModel.get("selectedMDPSetting").toString(),o=this.$lockDocControl.prop("checked"),a=[{appearanceId:i,reasonText:e,locationText:t,contactInfoText:n,mdpSetting:s,lockDocument:o}];return a},_initiateSigning:function(){window.$el.find("#digsig-signature").hide(),this.options.appApi.displayApi.showSpinner(!0);var i=this._checkPassword();i.then(_.bind(function(i){if(i){var e=this._createOutputData(),t=this._setSigningOutputData(e);t.then(_.bind(function(){this.options.appApi.displayApi.showSpinner(!1),this._closeSignatureDialog()},this))}else window.$el.find("#digsig-signature").show(),this.options.appApi.displayApi.showSpinner(!1)},this))},_setSigningOutputData:function(i){var e=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(t){t.rnaDigSigAPI.invokeMethod({methodName:"SetSigningOutputData",methodArgs:i}).done(_.bind(function(){return e.resolve()},this))},this)),e.promise()},_getOtherSigningPrefs:function(){var i=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaDigSigAPI.invokeMethod({methodName:"GetOtherSigningPrefs",methodArgs:{}}).done(_.bind(function(e){this.options.DigSigUiModel.set("isCertifyingSignature",e.isCertifyingSignature),this.options.DigSigUiModel.set("isReasonControlEnabled",e.isReasonControlEnabled),this.options.DigSigUiModel.set("isReasonControlEditable",e.isReasonControlEditable),this.options.DigSigUiModel.set("hasReasonSeedValue",e.hasReasonSeedValue),this.options.DigSigUiModel.set("isLocationContactControlEnabled",e.isLocationContactControlEnabled),this.options.DigSigUiModel.set("lockDocControlEnabled",e.lockDocControlEnabled),this.options.DigSigUiModel.set("lockDocControlVal",e.lockDocControlVal),this.options.DigSigUiModel.set("lockDocControlVisible",e.lockDocControlVisible),this.options.DigSigUiModel.set("savedLocationText",e.savedLocationText),this.options.DigSigUiModel.set("savedContactInfoText",e.savedContactInfoText),this.options.DigSigUiModel.set("isMDPEnabled",e.isMDPEnabled),this.options.DigSigUiModel.set("selectedMDPSetting",e.selectedMDPSetting),this.options.DigSigUiModel.set("isSignatureVisible",e.isSignatureVisible),this.options.DigSigUiModel.set("isAppearanceMenuEnabled",e.isAppearanceMenuEnabled),this.options.DigSigUiModel.set("isShowReviewSection",e.isShowReviewSection),this.options.DigSigUiModel.set("requireDocWarningReviewed",e.requireDocWarningReviewed),-1==this.options.DigSigUiModel.get("appearanceIndex")&&this.options.DigSigUiModel.set("appearanceIndex",e.selectedApId),this.options.DigSigUiModel.set("disableAppearanceModification",e.disableAppearanceModification),i.resolve()},this))},this)),i.promise()},_ShowHideSigningPrefUiControls:function(){this.$appearanceContainer.hide(),this.options.DigSigUiModel.get("disableAppearanceModification")&&(this.$editAppearanceBtn.prop("disabled",!0),this.$createAppearanceBtn.prop("disabled",!0)),this.options.DigSigUiModel.get("isReasonControlEnabled")?(this.$reasonMenu.show(),this.options.DigSigUiModel.get("isReasonControlEditable")?(this.$reasonText.show(),this.$reasonNotEditable.hide(),this.isReasonEditable=!0):(this.$reasonText.hide(),this.$reasonNotEditable.show(),this.isReasonEditable=!1,this.options.DigSigUiModel.get("hasReasonSeedValue")&&this.reasonData.length>0&&this.$el.find(".digsig.digsig-select.digsig-select-reason").css("border-color","#DD9090").css("border-width","2px"))):this.$reasonMenu.hide(),this.options.DigSigUiModel.get("isLocationContactControlEnabled")?(this.$locationMenu.show(),this.$locationText.val(this.options.DigSigUiModel.get("savedLocationText")),this.$contactInfo.show(),this.$contactInfoText.val(this.options.DigSigUiModel.get("savedContactInfoText"))):(this.$locationMenu.hide(),this.$contactInfo.hide()),this.options.DigSigUiModel.get("isCertifyingSignature")||this.options.DigSigUiModel.get("isShowReviewSection")?this.$el.find(".certify-signature-controls").show():this.$el.find(".certify-signature-controls").hide(),this.options.DigSigUiModel.get("isCertifyingSignature")?(this.$el.find(".permitted-action-menu").show(),this.$mdpMenuDropdown.val(this.options.DigSigUiModel.get("selectedMDPSetting").toString()),this.$mdpMenuDropdown.prop("disabled",!this.options.DigSigUiModel.get("isMDPEnabled")),this.options.DigSigUiModel.get("isMDPEnabled")||this.$el.off("click",".digsig.digsig-select-permitted-action")):this.$el.find(".permitted-action-menu").hide(),this.options.DigSigUiModel.get("isShowReviewSection")?this.$reviewDocMenu.show():this.$reviewDocMenu.hide(),this.options.DigSigUiModel.get("isSignatureVisible")?(this.$appearanceCustomize.show(),this.$appearancePreviewContainer.show(),this.$appearanceMenuDropdown.val(this.options.DigSigUiModel.get("appearanceIndex").toString()),this.$appearanceMenuDropdown.prop("disabled",!this.options.DigSigUiModel.get("isAppearanceMenuEnabled"))):(this.$appearanceCustomize.hide(),this.$appearancePreviewContainer.hide()),this.options.DigSigUiModel.get("isShowPassword")?(this.$passwordMenu.show(),this.$passwordField.focus(),this.isPassworkFieldOk=!1,this._isEnableSignBtn(),this.$passwordField.css("border-color","#DD9090")):(this.$passwordMenu.hide(),this.isPassworkFieldOk=!0,this._isEnableSignBtn()),this.options.DigSigUiModel.get("requireDocWarningReviewed")&&this.$el.find(".review-document-btn").css("border-color","#DD9090").css("border-width","2px"),this.options.DigSigUiModel.get("isLocationContactControlEnabled")||this.options.DigSigUiModel.get("isReasonControlEnabled")?this._resizeDialog():(this.$reasonContact.hide(),this.$el.find(".reason-contact-hr").hide(),this.$el.find(".lockpref-viewdetails").width("100%"),this.$el.find(".digsig-checkbox-group").css("display","inline-block"),this.$el.find(".cert-view-details").css("display","inline-block"),this.$el.find(".cert-view-details").css("padding-top","0px"),setTimeout(_.bind(function(){this.$el.find(".cert-view-details").css("float","right"),this._resizeDialog()},this),0)),this.options.DigSigUiModel.get("lockDocControlVisible")?(this.$lockDocContainer.show(),this.$lockDocControl.prop("checked",this.options.DigSigUiModel.get("lockDocControlVal")),this.$lockDocControl.prop("disabled",!this.options.DigSigUiModel.get("lockDocControlEnabled"))):this.$lockDocContainer.hide()},_handleViewDetailsClick:function(i){var e=i.target.id;this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"showDetailsDigSigCEFDialog",methodArgs:e})})},_handleViewDetailsKeydown:function(i){(32==i.keyCode||13==i.keyCode)&&this._handleViewDetailsClick(i)},_unbindEventsandRemoveChildViews:function(){this.undelegateEvents(),this.removeAllChildViews()},_closeSignatureDialog:function(i){return i&&"keydown"==i.type?void((13==i.keyCode||32==i.keyCode||0==i.keyCode)&&(this._unbindEventsandRemoveChildViews(),this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:"close"}}))):void this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:"close"}})},_onCreateBtnClick:function(){var i=this.options.DigSigUiModel.get("appearanceIndex"),t=this.options.DigSigUiModel.get("selectedId"),n="";n=this.isReasonEditable?this.$reasonText.val():this.$reasonNotEditable.text();var s=this.$locationText.val();this.options.DigSigUiModel.set("appearanceIndex",i),this.options.DigSigUiModel.set("selectedId",t),this.options.DigSigUiModel.set("reasonText",n),this.options.DigSigUiModel.set("locationText",s),this.options.DigSigUiModel.set("mode",1),this._unbindEventsandRemoveChildViews(),this.$el.hide(),window.$el.find("#digsig-customization").show(),this._renderChildView("_showCustomizationDialogView",e.ShowCustomizationDialogView,window.$el.find("#digsig-customization"),this.options)},_onEditBtnClick:function(){var i=this.options.DigSigUiModel.get("appearanceIndex"),t=this.$selectedAppearance.text(),n=this.options.DigSigUiModel.get("selectedId"),s="";s=this.isReasonEditable?this.$reasonText.val():this.$reasonNotEditable.text();var o=this.$locationText.val();this.options.DigSigUiModel.set("appearanceIndex",i),this.options.DigSigUiModel.set("selectedId",n),this.options.DigSigUiModel.set("reasonText",s),this.options.DigSigUiModel.set("locationText",o),this.options.DigSigUiModel.set("mode",2),this.options.DigSigUiModel.set("selectedApText",t),this._unbindEventsandRemoveChildViews(),this.$el.hide(),window.$el.find("#digsig-customization").show(),this._renderChildView("_showCustomizationDialogView",e.ShowCustomizationDialogView,window.$el.find("#digsig-customization"),this.options)},_onBackBtnClick:function(){this.backBtnClicked=!0,this._resizeDialog(),this._unbindEventsandRemoveChildViews(),this.$el.hide(),window.$el.find("#digsig-show-identity-list").show(),this._renderChildView("_showIdentityDialogView",e.ShowIdentityDialogView,window.$el.find("#digsig-show-identity-list"),this.options)},_onReviewDocClick:function(){this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"SetReviewWarning",methodArgs:[{currentMdpSetting:this.options.DigSigUiModel.get("selectedMDPSetting").toString()}]}).done(_.bind(function(i){i.isWarningReviewed&&(this.$el.find(".review-document-label").html(n.DOCUMENT_HAS_BEEN_REVIEWED_LABEL_TEXT),this.isReviewBtnClicked=!0,this.$el.find(".review-document-btn").css("border-color","#707070").css("border-width","2px"),this._isEnableSignBtn())},this))},this))},_onPasswordInputChange:function(){var i=this.$passwordField.val().length;i>0?(this.$passwordField.css("border-color","#cbcbcb"),this.$el.find(".password-incorrect").hide(),this.isPassworkFieldOk=!0):(this.isPassworkFieldOk=!1,this.$passwordField.css("border-color","#DD9090")),this._isEnableSignBtn()},_onPasswordPaste:function(){setTimeout(_.bind(function(){this._onPasswordInputChange()},this),100)},_isReviewBtnOkFn:function(){return this.options.DigSigUiModel.get("requireDocWarningReviewed")?this.isReviewBtnClicked?!0:!1:!0},_isEnableSignBtn:function(){this._isReasonValOkFn()&&this.isPassworkFieldOk&&this._isReviewBtnOkFn()?s.enableInput(this.$signBtn,!0):s.enableInput(this.$signBtn,!1)},_isReasonValOkFn:function(){if(this.options.DigSigUiModel.get("isReasonControlEnabled")&&!this.isReasonEditable&&this.options.DigSigUiModel.get("hasReasonSeedValue")){var i=this.$reasonNotEditable.text();if(""==i&&0==this.reasonData.length)return!0;for(var e=this.reasonData.length,t=0;e>t;t++)if(this.reasonData[t].name==i)return!0;return!1}return!0},_onAppearanceMenuClick:function(){this.appearanceMenuView.show().done(_.bind(function(i,e){null!=i&&(this.$selectedAppearance.text(e),this.options.DigSigUiModel.set("appearanceIndex",i),this._setAppearancePreview())},this))},_onReasonMenuClick:function(){this.reasonMenuView.show().done(_.bind(function(i,e){null!=i&&(this.isReasonEditable?this.$reasonText.val(e):(this.$reasonNotEditable.text(e),this.options.DigSigUiModel.get("hasReasonSeedValue")&&this.reasonData.length>0&&this.$el.find(".digsig.digsig-select.digsig-select-reason").css("border-color","#cbcbcb").css("border-width","1px"),this._isEnableSignBtn()),this._setAppearancePreview())},this))},_onPermittedActionMenuClick:function(){this.$mdpActionMenuView.show().done(_.bind(function(i,e){null!=i&&(2==i?this.options.appApi.rnaApi.done(_.bind(function(t){t.rnaDigSigAPI.invokeMethod({methodName:"confirmMDPSelection",methodArgs:{}}).done(_.bind(function(){this.$selectedPermittedAction.text(e),this.options.DigSigUiModel.set("selectedMDPSetting",i)},this))},this)):(this.$selectedPermittedAction.text(e),this.options.DigSigUiModel.set("selectedMDPSetting",i)))},this))}})}),define("digsig/js/views/digsig-show-identity-dialog-view",["core/ac-core","digsig/js/ac-digsig","digsig/js/templates/digsig-show-identity-dialog-template","core/utils/view-util","i18n!digsig/js/nls/ui-strings","digsig/js/views/identity-view","digsig/js/collection/identity-collection","digsig/js/views/digsig-show-signature-dialog-view","digsig/js/views/local-certificate-dialog-view"],function(i,e,t,n,s){e.ShowIdentityDialogView=i.View.extend({events:{"click   .identity-dlg-refresh-btn":"_onRefreshClick","click   .identity-dlg-new-identity-btn":"_onNewIdentityClick","click   .identity-dlg-cancel-btn":"_closeIdentityDialog","click   .identity-dlg-continue-btn":"_onContinueClick","click   .close-identity-modal":"_closeIdentityDialog","keydown   .close-identity-modal":"_closeIdentityDialog","click   input[name='identity-choice']":"_changedRadioButton","change   input[name='identity-choice']":"_onIdentityFocus","keydown .identity-container":"_handleKeyDownOnIdentityItem","click .identity-container":"_onIdentityDetailsClick","click .identity-view-details":"_handleViewDetailsClick","click .identity-dlg-help-btn":"_onHelpClicked","keydown .identity-view-details":"_onViewDetailsKeyDown","keydown .identity-dlg-help-btn":"_onHelpKeyDown"},initialize:function(){i.View.prototype.initialize.call(this),this.collection=new e.IdentityCollection,this._template=_.template(t)},_initWrapper:function(){console.log("in Identity view initialize"),this.$identityContainer=this.$(".identity-list-details"),this.$continueButton=this.$(".identity-dlg-continue-btn"),this.$identityName=this.$("identity-name"),this.$identityDetails=this.$("identity-name")},render:function(){this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"listDigitalIdsDigSigCEFDialog",methodArgs:{}}).done(_.bind(function(i){this.collection.fetch(i.id_lists,i.selected_id).done(_.bind(function(){this.$el.html(this._template({Identity_Header_Text:s.IDENTITY_LIST_HEADER_TEXT,Identity_Description:s.IDENTITY_LIST_DESCRIPTION,noIdentityLabel:s.NO_IDENTITY_LABEL,REFRESH_BUTTON_TEXT:s.REFRESH_BUTTON_TEXT,NEW_IDENTITY_BUTTON_TEXT:s.CONFIGURE_NEW_BUTTON_TEXT,CANCEL_BUTTON_TEXT:s.CANCEL_BUTTON_TEXT,CONTINUE_BUTTON_TEXT:s.CONTINUE_BUTTON_TEXT,HELP_BUTTON_TEXT:s.HELP_BUTTON_TEXT})),this._initWrapper(),this._renderChildViews()},this))},this))},this))},_renderChildViews:function(){console.log("render the child views"),this._closeOnESC(),this._renderIdentityViews(),this._UpdateControls()},_UpdateControls:function(){var i=this.$("input[name='identity-choice']").is(":checked");n.enableInput(this.$continueButton,i)},_renderIdentityViews:function(){var i,t=this.getChildViews();_.each(t,function(i){i.$el==this.$identityContainer&&this.removeChildViewById(i.options.viewId)},this);var n=0;_(this.collection.models).each(_.bind(function(i){var t="_identityView"+n;this._renderChildView(t,e.IdentityView,this.$identityContainer,{model:i}),n++},this)),i=this._findCheckedIdentityView(),i&&this._fixAccessibilityTarget(i)},_onRefreshClick:function(){this.options.appApi.rnaApi.done(_.bind(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"refreshDigitalIdsDigSigCEFDialog",methodArgs:{}}).done(_.bind(function(i){this.collection.fetch(i.id_lists,i.selected_id).done(_.bind(function(){this.$identityContainer.html(""),this._renderIdentityViews(),this.$("#identity-dlg-refresh-btn").blur(),this._UpdateControls()},this))},this))},this))},_findCheckedIdentityView:function(){var i,e;return i=this.$(".identity-container"),_.each(i,function(i){var t=$(i).find("input[name='identity-choice']:checked");0!==t.length&&(e=i)},this),e},_onNewIdentityClick:function(){this.options.DigSigUiModel.reset(),this.undelegateEvents(),this._removeNewIdentityView(),this.remove(),this.$el.hide(),window.$el.find("#digsig-setup-identity").show(),this._renderChildView("_showIdentitySetupDialogView",e.LocalCertificateDialogView,window.$el.find("#digsig-setup-identity"),this.options)},_onHelpClicked:function(){this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"launchHelpDigSig",methodArgs:"Dlg_SigningID"})})},_onViewDetailsKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._handleViewDetailsClick(i)},_onHelpKeyDown:function(i){(32==i.keyCode||13==i.keyCode)&&this._onHelpClicked(i)},_removeNewIdentityView:function(){var i=window.$el.find("#digsig-setup-identity"),e=this.getChildViews();_.each(e,function(e){e.$el.is(i)&&this.removeChildViewById(e.options.viewId)},this)},_removeSignatureViewChild:function(){var i=window.$el.find("#digsig-signature"),e=this.getChildViews();_.each(e,function(e){e.$el.is(i)&&this.removeChildViewById(e.options.viewId)},this)},_onContinueClick:function(){var i=this.$("input[name='identity-choice']:checked").attr("id");this.options.DigSigUiModel.set("selectedId",parseInt(i));var t=this.collection.get(i);this.options.DigSigUiModel.set("digitalIdName",t.get("name")),console.log(t.get("show_password")),this.options.DigSigUiModel.set("isShowPassword",t.get("show_password")),this.options.DigSigUiModel.set("appearanceIndex",-1),this.undelegateEvents(),this._removeSignatureViewChild(),this.$el.hide(),window.$el.find("#digsig-signature").show(),this._renderChildView("_showSignatureDialogView",e.ShowSignatureDialogView,window.$el.find("#digsig-signature"),this.options),console.log(this.collection.get(i))},_closeIdentityDialog:function(i){var t="close";return"identity-dlg-cancel-btn"===$(i.target).attr("id")&&(t="cancel"),i&&"keydown"==i.type?void((13==i.keyCode||32==i.keyCode||0==i.keyCode)&&this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:t}})):void this._triggerViewEvent(e.ViewEvents.CLOSE_DIGSIG_DIALOG,{args:{userAction:t}})},_changedRadioButton:function(){this._UpdateControls()},_removeTabIndexFromIdentity:function(i){var e;i=$(i),i.removeAttr("tabindex"),e=i.find(".identity-view-details"),_.each(e,function(i){$(i).removeAttr("tabindex")},this)},_removeTabIndex:function(){var i;i=$(".identity-container"),_.each(i,function(i){this._removeTabIndexFromIdentity(i)},this)},_fixAccessibilityTarget:function(i){var e;this._removeTabIndex(),$(i).attr("tabindex","0"),e=$(i).find(".identity-view-details"),0!==e.length&&(e=e[0],$(e).attr("tabindex","0"))},_fixAccessibility:function(i){var e;e=$(i.target).parent(),this._fixAccessibilityTarget(e)},_onIdentityFocus:function(i){this._fixAccessibility(i)},_selectIdentity:function(i){var e;i instanceof jQuery||(i=$(i)),e=$(i.children()[0]).children()[0],this._selectRadioButtonTarget($(e)),this._fixAccessibilityTarget(i),i.focus()},_handleKeyDownOnIdentityItem:function(i){var e=i.target;if(40==i.keyCode){if(e.nextSibling)return this._selectIdentity(e.nextSibling),!1}else if(38==i.keyCode){if(e.previousSibling)return this._selectIdentity(e.previousSibling),!1}else 32==i.keyCode&&this._SelectTheRadioButton(i)},_selectRadioButtonTarget:function(i){i.prop("checked","true"),this._UpdateControls()},_SelectTheRadioButton:function(i){this._selectRadioButtonTarget($(i.target.children[0]))},_findIdentityContainer:function(i){return i instanceof jQuery||(i=$(i)),i.hasClass("identity-container")?i:this._findIdentityContainer(i.parent())},_onIdentityDetailsClick:function(i){var e=$(i.target),t=this._findIdentityContainer(e);this._selectIdentity(t)},_handleViewDetailsClick:function(i){var e=i.target.id;this.options.appApi.rnaApi.done(function(i){i.rnaDigSigAPI.invokeMethod({methodName:"showDetailsDigSigCEFDialog",methodArgs:e})})},_closeOnESC:function(){this.options.appApi.rnaApi.done(function(i){i.rnaFteAPI.invokeMethod({methodName:"shouldCloseOnESC",methodArgs:[!0]})})}})}),define("digsig/js/views/plugin-view",["core/ac-core","digsig/js/ac-digsig","core/views/plugin-content-view","core/views/collection-items-view","digsig/js/collection/identity-collection","digsig/js/models/identity-model","digsig/js/identity-list","digsig/js/views/configure-digital-id-view","digsig/js/views/local-certificate-dialog-view","digsig/js/views/digsig-show-identity-dialog-view","digsig/js/models/ui/digsig-ui-model"],function(i,e){return e.PluginView=i.PluginContentView.extend({initialize:function(){i.PluginContentView.prototype.initialize.call(this)},render:function(){var e=this.$el;window.$el=e,i.PluginContentView.prototype.render.call(this),e.append(_.template('<div id="digsig-show-identity-list" class="theme-digsig-container"></div><div id="digsig-setup-identity" class="theme-digsig-container"></div><div id="digsig-signature" class="theme-digsig-container"></div><div id="digsig-customization" class="theme-digsig-container"></div>')),this._renderChildViews(this.options)},getAppApiVersion:function(){return e.APP_API_VERSION},setAppApi:function(t){i.PluginContentView.prototype.setAppApi.call(this,t),e.init(t)},selectPlugin:function(){this.options;return this._startPlugin().then(_.bind(function(){this.options.appApi.displayApi.applyUIThemeStyles(this.$el).then(_.bind(function(){this.render(),this.options.appApi.displayApi.showSpinner(!1)},this))},this))},getSiteCatalystName:function(){return"digsig"},directInkSignature:function(i){if(this.options.DigSigUiModel.attributes.isBlank=i.val?1:0,0==i.fillSignApplyStatus||1==i.fillSignApplyStatus);else{var e=!this.options.DigSigUiModel.attributes.isSigned;this.options.DigSigUiModel.set("isSigned",e)}},_getDocWindowSize:function(){var e=$.Deferred();return this.options.appApi.rnaApi.done(_.bind(function(t){t.rnaDigSigAPI.invokeMethod({methodName:"getDocWindowSizeDigSig",parameters:[]}).done(function(t){var n=JSON.parse(t);i.Util.isWindows()&&(n.width/=window.devicePixelRatio,n.height/=window.devicePixelRatio),this.options=_.extend({docWindowSize:n},this.options),e.resolve(n)})},this)),e.promise()},_resizeDialog:function(i){var e=$.Deferred(),t=500,n=700;return t=Math.min(t,i.height),n=Math.min(n,i.width),this.options.appApi.rnaApi.done(_.bind(function(i){i.cefBrowserApi({methodName:"setContainerSize",parameters:[Math.floor(n),Math.floor(t)]}).done(function(){e.resolve()})},this)),e.promise()},_renderChildViews:function(){this._getDocWindowSize().then(_.bind(function(i){this.options=_.extend({docWindowWidth:i.width,docWindowHeight:i.height},this.options),this._resizeDialog(i).then(_.bind(function(){var i=!0;i="true"==e.QueryParams.canCreateSSCert?!0:!1,this.options=_.extend({canCreateSSCert:i},this.options),"list"==e.QueryParams.dialog?($el.find("#digsig-setup-identity").hide(),this._renderChildView("_showIdentityDialogView",e.ShowIdentityDialogView,this.$el.find("#digsig-show-identity-list"),this.options)):"newID"==e.QueryParams.dialog&&($el.find("#digsig-show-identity-list").hide(),this._renderChildView("_showIdentitySetupDialogView",e.LocalCertificateDialogView,this.$el.find("#digsig-setup-identity"),this.options))},this))},this))},_startPlugin:function(){var i=this._startingPluginPromise;return i||(i=this._startingPluginPromise=e.opFactory.create("StartingPluginOp",this.options).run(),this._viewListener||(this._viewListener=e.opFactory.create("ListeningForViewEventsOp",this.options),this._viewListener.run())),i}}),e.PluginView}),define("digsig/js/digsig",["digsig/js/ac-digsig","digsig/js/ops/op-factory","digsig/js/models/model-factory","digsig/js/views/plugin-view"],function(i){_.extend(i,{init:function(e){return console.log("init 1"),this.initializedPromise||(this.initializedPromise=$.Deferred()),this.appApi||!e?(console.log("init 4"),this.initializedPromise.promise()):(console.log("init 2"),i.opFactory=new i.OpFactory,i.modelFactory=new i.ModelFactory,i.appApi=e,i.appApi.done(_.bind(function(){console.log("init 3"),this.initializedPromise.resolve()},this)),this.initializedPromise.promise())}})}),define("dc-scribble-utils",[],function(){function i(i,t,n){if(i&&i.render&&i.render.vector&&i.render.vector.sequences&&i.render.vector.sequences.length&&i.render.dimension&&i.render.dimension.width&&i.render.dimension.height){var l=0,c=0;if(n=isNaN(n)?10:n,t=t||a,t!==a){var g=e(i);if((t===d||t===o)&&(i.render.dimension.width=g.x2-g.x1+2*n,l=g.x1-n),t===r||t===o){var h=i.render.dimension.height,p=h-(g.y2+n),_=g.y1-n,u=p*s;if(_>=u)i.render.dimension.height=h-p-u,c=u;else{var v=_/s;i.render.dimension.height=h-_-v,c=_}var m=i.render.vector.penWidthRatio,b=i.render.dimension.height;if(m&&h!==b){var w=m*h;i.render.vector.penWidthRatio=w/b}}}for(var f=i.render.vector.sequences,D=f.length,I=0;D>I;I++)if(f[I].points)for(var E=f[I].points.length,T=0;E>T;T++){var C=f[I].points[T];C.x-=l,C.y-=c}}return i}function e(i){var e=i&&i.render.dimension&&i.render.dimension?i.render.dimension.width:0,t=i&&i.render.dimension&&i.render.dimension?i.render.dimension.height:0,n=-1,s=-1,o=e,a=t;if(i&&i.render&&i.render.vector&&i.render.vector.sequences&&i.render.vector.sequences.length)for(var d=i.render.vector.sequences,r=d.length,l=0;r>l;l++)if(d[l].points)for(var c=d[l].points.length,g=0;c>g;g++){var h=d[l].points[g];n=Math.max(n,h.x),s=Math.max(s,h.y),o=Math.min(o,h.x),a=Math.min(a,h.y)}return{x1:o,y1:a,x2:n,y2:s}}var t=.018,n=.64,s=n/(1-n),o="trim_policy_all",a="trim_policy_none",d="trim_policy_width",r="trim_policy_height";return{DEFAULT_PEN_WIDTH_RATIO:t,INTENT_SIGNATURE:"signature",INTENT_INITIALS:"initials",TRIM_POLICY_ALL:o,TRIM_POLICY_NONE:a,TRIM_POLICY_WIDTH:d,TRIM_POLICY_HEIGHT:r,TYPE_POLYLINE:"polyline",TYPE_SMOOTHED:"smoothed",BASELINE:n,trimVectorData:i}}),define("dc-scribble-capture",["dc-scribble-utils"],function(i){function e(e,o){this._canvas=e,this._context=e.getContext("2d"),this._type=i.TYPE_SMOOTHED,o=o||{},(!o.hasOwnProperty("intent")||o.intent!==i.INTENT_SIGNATURE&&o.intent!==i.INTENT_INITIALS)&&(o.intent=i.INTENT_SIGNATURE),n.call(this,o),s.call(this),this._canvas.addEventListener("mousedown",t(I,this),!1),this._canvas.addEventListener("mousemove",t(E,this),!1),this._canvas.addEventListener("mouseup",t(T,this),!1),this._canvas.addEventListener("mouseenter",t(f,this),!1),this._canvas.addEventListener("mouseleave",t(D,this),!1),this._canvas.addEventListener("touchstart",t(I,this),!1),this._canvas.addEventListener("touchmove",t(E,this),!1),this._canvas.addEventListener("touchend",t(T,this),!1)
}function t(i,e){return function(t){i.call(e,t)}}function n(e){e=e||{},e.hasOwnProperty("intent")&&(e.intent!==i.INTENT_INITIALS&&e.intent!==i.INTENT_SIGNATURE&&(e.intent=i.INTENT_SIGNATURE),this._intent=e.intent),e.hasOwnProperty("penWidthRatio")&&(this._penWidthRatio=e.penWidthRatio),e.hasOwnProperty("customAspectRatio")&&(this._customAspectRatio=e.customAspectRatio),e.hasOwnProperty("penColor")&&(this._context.fillStyle=e.penColor,this._context.strokeStyle=e.penColor),r.call(this,e.width,e.height)}function s(){this._context.clearRect(0,0,this.width,this.height),this._pointData&&this._pointData.length?(this._pointData=[],this._canvas.dispatchEvent(new CustomEvent("onScribbleChanged",{detail:this}))):this._pointData||(this._pointData=[]),this._intervalID&&clearInterval(this._intervalID),this._intervalID=0,this._touchHistory=[],this._startTime=-1,this._trackingActive=!1,this._didDrawStroke=!1,this._previousPathEnd={x:0,y:0},this._dynaDrawVelocity={x:0,y:0},this._previousPoint={x:0,y:0},this._mouseLeftActive=!1}function o(){var i={penWidthRatio:void 0,penColor:"#000000",customAspectRatio:void 0};n.call(this,i),s.call(this)}function a(){return!this._pointData||!this._pointData.length}function d(i){i=i||{};var e=h.call(this);i.hasOwnProperty("intent")&&(e.intent=i.intent,this._intent=i.intent),i.hasOwnProperty("penWidthRatio")&&(e.render.vector.penWidthRatio=i.penWidthRatio,this._penWidthRatio=i.penWidthRatio),i.hasOwnProperty("penColor")&&(e.penColor=i.penColor,this._context.fillStyle=i.penColor,this._context.strokeStyle=i.penColor),i.hasOwnProperty("customAspectRatio")&&(this._customAspectRatio=i.customAspectRatio),(i.hasOwnProperty("width")||i.hasOwnProperty("height")||i.hasOwnProperty("customAspectRatio")||i.hasOwnProperty("intent"))&&(r.call(this,i.width,i.height),this._intent||w(e,this.width,this.height)),v.call(this,e)}function r(i,e){this._devicePixelRatio=window.devicePixelRatio||1;var t=this._context.fillStyle,n=this._context.strokeStyle,s=this.aspectRatio;s?e?i=e*s:i?e=i/s:(e=this.height,i=e*s):(e=e||this.height,i=i||this.width),this._canvas.width=i*this._devicePixelRatio,this._canvas.height=e*this._devicePixelRatio,this._canvas.style.width=i+"px",this._canvas.style.height=e+"px",this._context.scale(this._devicePixelRatio,this._devicePixelRatio),this._context.fillStyle=t,this._context.strokeStyle=n}function l(){return Math.max(1,(this._penWidthRatio||i.DEFAULT_PEN_WIDTH_RATIO)*this.height)}function c(i,t,n,s){var o=document.createElement("canvas"),a=h.call(this,i,t),d=a.render.dimension.width/a.render.dimension.height,r=new e(o,{customAspectRatio:d});r.intent=void 0,r.render(a),!n&&s?r.height=s:n&&!s?r.width=n:n&&s&&(r.height=r.width/n<=r.height/s?s:n/d);var l=r._canvas.toDataURL("image/png").split(",")[1],c={width:r.width,height:r.height,data:l};return o.remove(),c}function g(i){return i&&i.render&&i.render.vector&&i.render.vector.sequences&&i.render.vector.sequences.length}function h(e,t){var n={intent:this._intent,penColor:this.penColor,render:{dimension:{width:this.width,height:this.height,baseline:i.BASELINE},vector:{type:this._type,sequences:[]}}};return n.render.vector.penWidthRatio=this._penWidthRatio||i.DEFAULT_PEN_WIDTH_RATIO,this._pointData&&0!==this._pointData.length?(n.render.vector.sequences=p(this._pointData),e&&e!==i.TRIM_POLICY_NONE?i.trimVectorData(n,e,t):n):n}function p(i){for(var e=[],t=i?i.length:0,n=0;t>n;n++){e.push({points:[]});for(var s=i[n].length,o=0;s>o;o++){var a=i[n][o],d={x:a.x,y:a.y,t:a.t};e[n].points.push(d)}}return e}function _(i){var e=[];if(g(i))for(var t=i.render.vector.sequences,n=t.length,s=0;n>s;s++)if(e.push([]),t[s].points)for(var o=t[s].points.length,a=0;o>a;a++){var d=t[s].points[a],r={x:d.x,y:d.y,t:d.t};e[s].push(r)}return e}function u(){var e=R[this._intent].aspectRatio,t=h.call(this);if(g(t)&&t.render.dimension&&t.render.dimension.width&&t.render.dimension.height){var n=t.render.dimension.width/t.render.dimension.height;if(n===e);else if(e>n)t.render.dimension.width=t.render.dimension.height*e;else{for(var s=t.render.dimension.width/e,o=t.render.dimension.height,a=s-o,d=a*i.BASELINE,r=t.render.vector.sequences,l=r.length,c=0;l>c;c++)if(r[c].points)for(var p=r[c].points.length,_=0;p>_;_++)r[c].points[_].y+=d;var u=t.render.vector.penWidthRatio;if(u&&o!==s){var v=u*o;t.render.vector.penWidthRatio=v/s}t.render.dimension.height=s}}if(t.render)return{render:t.render};throw new Error("DCScribble getVectorDataForSync: error getting vector data")}function v(i){if(s.call(this),g(i)&&i.render.dimension&&i.render.dimension.width&&i.render.dimension.height){var e=i.render.dimension.width,t=i.render.dimension.height,n=e/t;if(this._intent&&this.height){var o=this.height,a=o*n;w(i,a,o)}else r.call(this,e,t);this._pointData=_(i),this._type=i.render.vector.type,this._penWidthRatio=i.render.vector.penWidthRatio,i.penColor&&(this._context.fillStyle=i.penColor,this._context.strokeStyle=i.penColor),U[i.render.vector.type].call(this,i),this._canvas.dispatchEvent(new CustomEvent("onScribbleChanged",{detail:this}))}}function m(i){if(g(i))for(var e=i.render.vector.sequences,t=e.length,n=0;t>n;n++){var s=e[n];if(s.points){var o=s.points.length;if(1===o)x.call(this,s.points[0],!0);else if(o>1)for(var a=0;o>a;a++){var d=s.points[a];0===a?S.call(this,d):N.call(this,d)}}}}function b(i){if(g(i))for(var e=i.render.vector.sequences,t=e.length,n=0;t>n;n++){var s=e[n];if(s.points){var o=s.points.length;if(1===o)x.call(this,s.points[0]);else if(o>1){for(var a=0;o>a;a++){var d=s.points[a];0===a?S.call(this,d):k.call(this,d)}k.call(this,s.points[o-1],!0)}}}}function w(i,e,t){if(g(i)&&i.render.dimension&&i.render.dimension.width&&i.render.dimension.height){for(var n=i.render.vector.sequences,s=e/i.render.dimension.width,o=t/i.render.dimension.height,a=n.length,d=0;a>d;d++)if(n[d].points)for(var r=n[d].points.length,l=0;r>l;l++){var c=n[d].points[l];c.x=c.x*s,c.y=c.y*o}i.render.dimension.width=e,i.render.dimension.height=t}}function f(i){this._mouseLeftActive&&(1===i.buttons&&I.call(this,i),delete this._mouseLeftActive)}function D(i){this._trackingActive&&(this._mouseLeftActive=!0,T.call(this,i))}function I(i){if(i.preventDefault(),!this._trackingActive){this._trackingActive=!0,this._pointData.length&&this._pointData.push([]);var e=A.call(this,i);y.call(this,e.x,e.y),S.call(this,e),this._didDrawStroke=!1}}function E(i){if(i.preventDefault(),this._trackingActive){var e=A.call(this,i);y.call(this,e.x,e.y),k.call(this,e),this._didDrawStroke=!0,this._intervalID&&clearInterval(this._intervalID),this._intervalID=setInterval(t(function(){var i=C.call(this);i&&(y.call(this,i.x,i.y),k.call(this,i))},this),50)}}function T(i){if(i.preventDefault(),this._intervalID&&clearInterval(this._intervalID),this._intervalID=0,this._trackingActive){var e=C.call(this);e&&(this._didDrawStroke?k.call(this,e,!0):x.call(this,e)),this._trackingActive=!1}}function C(){var i=this._pointData.length;if(i>0){var e=this._pointData[i-1];if(e.length>0)return e[e.length-1]}return void 0}function A(i){var e=i;i.targetTouches&&i.targetTouches.length?e=i.targetTouches[0]:i.changedTouches&&i.changedTouches.length&&(e=i.changedTouches[0]);var t=this._canvas.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function y(i,e){this._pointData.length||(this._pointData.push([]),window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.firstTouch.postMessage("touched"));var t=(new Date).getTime();this._startTime<0&&(this._startTime=t);var n={x:i,y:e,t:t-this._startTime};this._pointData[this._pointData.length-1].push(n),this._canvas.dispatchEvent(new CustomEvent("onScribbleChanged",{detail:this}))}function S(i){this._dynaDrawVelocity={x:0,y:0},this._previousPoint={x:0,y:0},this._touchHistory[0]=this._touchHistory[1]=this._touchHistory[2]=this._previousPathEnd=i}function N(i){this._touchHistory[0]=this._touchHistory[1],this._touchHistory[1]=i;var e=this._touchHistory[0],t=this._touchHistory[1];this._context.beginPath(),this._context.moveTo(e.x,e.y),this._context.lineTo(t.x,t.y),this._context.lineWidth=l.call(this),this._context.lineCap="round",this._context.stroke()}function k(i,e){var t;t=i.x===this._previousPoint.x&&i.y===this._previousPoint.y?i:L.call(this,i,this._touchHistory[2]),this._previousPoint=i,this._touchHistory[0]=this._touchHistory[1],this._touchHistory[1]=this._touchHistory[2],this._touchHistory[2]=t;var n=this._previousPathEnd,s={x:(2*this._touchHistory[0].x+this._touchHistory[1].x)*(1/3),y:(2*this._touchHistory[0].y+this._touchHistory[1].y)*(1/3)},o={x:(2*this._touchHistory[1].x+this._touchHistory[0].x)*(1/3),y:(2*this._touchHistory[1].y+this._touchHistory[0].y)*(1/3)},a=e?i:{x:(this._touchHistory[0].x+4*this._touchHistory[1].x+this._touchHistory[2].x)*(1/6),y:(this._touchHistory[0].y+4*this._touchHistory[1].y+this._touchHistory[2].y)*(1/6)};this._context.beginPath(),this._context.moveTo(n.x,n.y),this._context.bezierCurveTo(s.x,s.y,o.x,o.y,a.x,a.y),this._context.lineWidth=l.call(this),this._context.lineCap="round",this._context.stroke(),this._previousPathEnd=a}function x(i){var e=.65*l.call(this);this._context.beginPath(),this._context.arc(i.x,i.y,e,0,2*Math.PI),this._context.fill()}function L(i,e){var t={x:(i.x-e.x)*O,y:(i.y-e.y)*O},n=this._dynaDrawVelocity;n={x:(n.x+t.x)*(1-$),y:(n.y+t.y)*(1-$)};var s={x:e.x+n.x,y:e.y+n.y};return this._dynaDrawVelocity={x:n.x*(1-$),y:n.y*(1-$)},s}!function(){function i(i,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var t=document.createEvent("CustomEvent");return t.initCustomEvent(i,e.bubbles,e.cancelable,e.detail),t}i.prototype=window.Event.prototype,window.CustomEvent=i}();var O=.6,$=.4,R={signature:{aspectRatio:3.25},initials:{aspectRatio:1.1667}},U={polyline:m,smoothed:b};return e.prototype={constructor:e,get type(){return this._type},set type(i){throw new Error("DCScribble type: readonly property")},get intent(){return this._intent},set intent(e){if(e&&e!==i.INTENT_SIGNATURE&&e!==i.INTENT_INITIALS)throw new Error("DCScribble intent: must be a 'signature' or 'initials'");d.call(this,{intent:e})},get height(){return this._canvas.height/this._devicePixelRatio},set height(i){if(isNaN(i)||0>=i)throw new Error("DCScribble height: must be a number greater than 0");d.call(this,{height:i})},get width(){return this._canvas.width/this._devicePixelRatio},set width(i){if(isNaN(i)||0>=i)throw new Error("DCScribble width: must be a number greater than 0");d.call(this,{width:i})},get penWidthRatio(){return this._penWidthRatio},set penWidthRatio(i){if(isNaN(i)||0>=i)throw new Error("DCScribble penWidthRatio: must be a number greater than 0");d.call(this,{penWidthRatio:i})},get penColor(){return this._context.fillStyle},set penColor(i){d.call(this,{penColor:i})},get aspectRatio(){return void 0===this._customAspectRatio?this._intent&&R.hasOwnProperty(this._intent)?R[this._intent].aspectRatio:void 0:this._customAspectRatio},get customAspectRatio(){return this._customAspectRatio},set customAspectRatio(i){if(void 0===i)d.call(this,{customAspectRatio:void 0});else if(isNaN(i)||0>=i)throw new Error("DCScribble customAspectRatio: must be a number greater than 0");d.call(this,{customAspectRatio:i})},clear:s,reset:o,isEmpty:a,render:v,getImageData:c,getVectorData:h,getVectorDataForSync:u},e}),define("dc-scribble-render",["dc-scribble-capture"],function(i){function e(i){this._canvas=i,this._context=i.getContext("2d")}return e.prototype.constructor=e,e.prototype=Object.create(i.prototype,{intent:{set:function(){}},aspectRatio:{get:function(){if(this.isEmpty())return void 0;var i=this.getVectorData();return i&&i.render&&i.render.dimension&&i.render.dimension.height?i.render.dimension.width/i.render.dimension.height:void 0}},customAspectRatio:{get:function(){return this.aspectRatio},set:function(){}},getVectorDataForSync:{value:function(){return void 0}}}),e}),define("dc-scribble",["dc-scribble-capture","dc-scribble-render","dc-scribble-utils"],function(i,e,t){return{utils:t,createCapture:function(e,t){return new i(e,t)},createRender:function(i){return new e(i)}}}),define("digsig/js/xlib/dc-scribble-all",function(){}),define("digsig/js/plugin",["core/ac-core-init","digsig/js/ac-digsig","digsig/js/digsig","digsig/js/xlib/dc-scribble-all"],function(i,e){e.init()});