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

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

/*************************************************************************
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2015 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by all applicable intellectual property 
* laws, including trade secret and 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 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 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 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 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 2014 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by all applicable intellectual property
* laws, including trade secret and 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 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 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.
 **************************************************************************/

/*************************************************************************
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2017 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.
**************************************************************************/

/*!
 * jQuery TextChange Plugin
 * http://www.zurb.com/playground/jquery-text-change-custom-event
 *
 * Copyright 2010, ZURB
 * Released under the MIT License
 */

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

// Copyright (c) 2010 Nicholas C. Zakas. All rights reserved.

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

/*!
 * jQuery UI Droppable 1.11.4
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/droppable/
 */

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

define("fss/js/ac-faf",["plugins-common/ac-plugins"],function(e){var t=e.Faf;return t||(t=e.Faf={}),t.Reader||(t.Reader={}),t.PLUGIN_ID||(t.PLUGIN_ID="fillsign"),t._supports||(t._supports={}),t}),define("fss/js/lib/faf-polyfill",[],function(){return"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),"function"!=typeof Object.create&&!function(){var e=function(){};Object.create=function(t){if(arguments.length>1)throw new Error("Second argument not supported");if(null===t)throw new Error("Cannot set a null [[Prototype]]");if("object"!=typeof t)throw new TypeError("Argument must be an object");return e.prototype=t,new e}}(),Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),i=this,n=function(){},s=function(){return i.apply(this instanceof n&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return n.prototype=this.prototype,s.prototype=new n,s}),Object.keys||(Object.keys=function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),i=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=i.length;return function(s){if("object"!=typeof s&&("function"!=typeof s||null===s))throw new TypeError("Object.keys called on non-object");var o,a,r=[];for(o in s)e.call(s,o)&&r.push(o);if(t)for(a=0;n>a;a++)e.call(s,i[a])&&r.push(i[a]);return r}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){if(void 0===this||null===this)throw new TypeError('"this" is null or not defined');var i=this.length>>>0;for(t=+t||0,1/0===Math.abs(t)&&(t=0),0>t&&(t+=i,0>t&&(t=0));i>t;t++)if(this[t]===e)return t;return-1}),{}}),define("fss/js/lib/web/faf-web-util",["core/ac-core","plugins-common/ac-plugins","core/utils/http-util","fss/js/ac-faf"],function(e,t,i,n){return{getBaseFSSUrl:function(){return n.appApi.pluginsApi.getBaseUrl(n.PLUGIN_ID)},getPrefsUrl:function(){return n.appApi.pluginsApi.getFullUrl("acrobat","createpdf/api/users/me/prefs")},addClientId:function(e){var t=-1===e.indexOf("?")?"?":"&";return e+t+i.getClientIdQueryParam()},getRenditionUrl:function(){return n.appApi.baseFilesUrisApi.getRenditionUri()+"unmanaged/"},createRenditionUrl:function(e,t){var i=this.getRenditionUrl();return i+=e,i+="/png2200",t>0&&(i+="?page="+t),this.addClientId(i)},getFafViewInfo:function(){return{appViewChildren:[{attr:"_fafOrganizerView",cls:"FafOrganizerView",prop:"$organizerView"},{attr:"_fafEditorView",cls:"FafEditorView",prop:"$editorView"}],userDataViewClass:"FafUserDataView",hudViewClass:"FafHudView"}},getFafPrefsInfo:function(){return{ToolBarSignatureSaved:"user.ToolBarSignatureSaved"}},onExternalEsc:function(){return void 0},offExternalEsc:function(){return void 0},isLoggedIn:function(){return n.appApi.sessionApi.isSignedIn()},isSignedInAndConnected:function(){return n.appApi.sessionApi.isSignedIn()},hostEnvironment:function(){var e="unknown",t={local:/local-test/,dev:/\.dev\./,test:/\.test\./,stage:/\.stage\./},i=this.getBaseFSSUrl();for(var n in t)if(i.match(t[n])){e=n;break}return e},importImage:function(e){return e.fileInputElement?(e.fileInputElement.click(),$.Deferred().resolve().promise()):$.Deferred().reject().promise()},getAppApiVersion:function(){return t.groups.forms.FRAMEWORK_VERSION},runSignatureSyncOp:function(e){return n.opFactory.create("SignatureSyncOp",e).run()}}}),define("fss/js/lib/faf-data-validator",[],function(){function e(e){this.name="FillSignValidationError",this.message=e||"",LOG.error(this.name+":"+this.message)}var t=!0,i={"font-family":{type:"string",choices:["helvetica","courier"]},"font-weight":{type:"number",min:0,max:1e3,optional:!0},"font-size":{type:"string",choices:["6pt","7pt","8pt","9pt","10pt","11pt","12pt","13pt","14pt","16pt","18pt","20pt","22pt","24pt","26pt","28pt","32pt","36pt","40pt","44pt","48pt","56pt","64pt","72pt","80pt","88pt","96pt","112pt","128pt","144pt","160pt","176pt","192pt"]},"letter-spacing":{type:"string"},width:{type:"string"}},n={top:{type:"number",min:0},left:{type:"number",min:0},baseline:{type:"number",min:0,optional:!0}},s={id:{type:"string"},type:{type:"string",choices:["textfield","annotationImage","signature","initials"]},ui:{type:"string",optional:!0},styles:{type:"string",optional:!0},lastLetterSpacing:{type:"string",optional:!0},isComb:{type:"boolean",optional:!0},isFixedSize:{type:"boolean",optional:!0},height:{type:"number",min:0,optional:!0},width:{type:"number",min:0,optional:!0},position:{type:"dict",elSchema:n},style:{type:"dict",elSchema:i,optional:!0}},o={h:{type:"number",min:0},w:{type:"number",min:0}},a={pageSize:{type:"dict",elSchema:o},elements:{type:"array",maxLen:200,elSchema:s}},r={version:{type:"number",min:1},id:{type:"string"},scanID:{type:"string"},assetID:{type:"string"},collectionID:{type:"string"},sample:{type:"boolean",optional:!0},pages:{type:"array",maxLen:100,elSchema:a}},l={text:{type:"string",optional:!0},assetID:{type:"string",optional:!0},kind:{type:"string",choices:["scribble","input","image"],optional:!0},style:{type:"string",choices:["adobe-hand-a","adobe-hand-b","adobe-hand-c","adobe-hand-d"],optional:!0},type:{type:"string",choices:["textfield","annotationImage","signature","initials"]},ac_c:{type:"number",min:0,optional:!0},ac_s:{type:"number",min:0,optional:!0}},d={version:{type:"number",min:1},formValues:{type:"dict",elSchema:l,anyKey:!0}},f={array:function(t,i){if(!_.isArray(t))throw new e("Invalid type - "+t+" is not an array");if(t.length>i.maxLen)throw new e("Invalid array length");$.each(t,function(e,t){c(t,i.elSchema)})},string:function(t,i){if("string"!=typeof t)throw new e("Invalid type - "+t+" is not a string");var n=i.choices;if(n&&_.indexOf(n,t)<0)throw new e("Invalid value - "+t+" not present in "+n)},number:function(t,i){if("number"!=typeof t)throw new e("Invalid type - "+t+" is not a number");if(void 0!==i.min&&i.min>t)throw new e("Invalid value - provided value ("+t+") is less than the allowed minimum ("+i.min+")");if(void 0!==i.max&&i.max<t)throw new e("Invalid value - provided value ("+t+") is more than the allowed maximum ("+i.max+")")},"boolean":function(t){if("boolean"!=typeof t)throw new e("Invalid type - "+t+" is not a boolean")},dict:function(t,i){if("object"!=typeof t)throw new e("Invalid type - "+t+" is not a valid object");i.anyKey?$.each(t,function(e,t){c(t,i.elSchema)}):c(t,i.elSchema)}},c=function(t,i){if($.each(i,function(i,n){var s=t[i];if(void 0===s){if(n.optional)return;throw new e("Missing attribute "+i)}f[n.type](s,n),delete t[i]}),!$.isEmptyObject(t))throw new e("Invalid attribute(s) - "+Object.keys(t))},u=function(e,i){if(t){var n=$.extend(!0,{},e);c(n,i)}};return{validateFormFields:function(e){return u(e.form,r)},validateFormValues:function(e){return u(e.values,d)}}}),define("fss/js/lib/faf-log-util",[],function(){return{LOG_ERROR:LOG.ERROR,LOG_WARN:LOG.WARNING,LOG_INFO:LOG.INFO,LOG_DEBUG:LOG.DEBUG,minimalLogging:!0,logMsg:function(e,t,i){var n,s;if(e===this.LOG_ERROR)s=" ERROR";else if(e===this.LOG_WARN)s=" WARN";else{if(this.minimalLogging)return;s=""}return n="FillAndSign ["+(t||"")+"]"+s+": "+i,LOG(n,e),n},logInfo:function(e,t){return this.logMsg(this.LOG_INFO,e,t)},logDebug:function(e,t){return this.logMsg(this.LOG_DEBUG,e,t)},logError:function(e,t){return this.logMsg(this.LOG_ERROR,e,t)}}}),define("fss/js/lib/faf-profiler-util",["fss/js/lib/faf-log-util"],function(e){var t={};return{startTimer:function(i,n){t[i]&&e.logError("ERROR timer key already exists "+i+" : "+n);var s=(new Date).getTime();t[i]={startTime:s,message:n}},stopTimer:function(i){var n=(new Date).getTime(),s=t[i];e.logInfo(s.message+" took "+(n-s.startTime)+" ms"),delete t[i]},onImageLoaded:function(e){function t(){return n++,n>s?void i.reject(e):void(e.height()>0&&e.width()>0?i.resolve(e):setTimeout(t,100))}var i=$.Deferred(),n=0,s=30;return t(),i.promise()}}}),define("fss/js/lib/reader/faf-reader-js-wrapper",["core/ac-core","core/utils/crypto-util","fss/js/ac-faf","fss/js/lib/faf-data-validator","fss/js/lib/faf-log-util","fss/js/lib/faf-profiler-util"],function(e,t,i,n,s,o){function a(e,t){i.appApi.rnaApi.done(function(i){LOG[t](e)})}function r(e){a(e,"info")}function l(e){a(e,"error")}function d(t){o.startTimer("doGetRendition"+t,"total time to get a rendition for page "+t);var n=$.Deferred();return i.appApi.rnaApi.done(function(i){i.fssApi({methodName:"getRenditionShm",methodArgs:[t,z]}).done(function(i){var s=new e.RNAModel(void 0,_.extend({_proxy:i,shouldCache:!1}));s.hasProperty("renditionURL")?(o.stopTimer("doGetRendition"+t),n.resolve(s.get("renditionURL"))):s.once("change:renditionURL",function(){o.stopTimer("doGetRendition"+t),n.resolve(s.get("renditionURL"))})})}),n.promise()}function f(e,t,n,s,o,a){function d(t){return e&&e.error&&e.error(t),p.reject(t)}var f=(new Date).getTime(),u=e.type||"GET",h=t+" RNA.Api "+u+" "+e.url;r(h);for(var p=$.Deferred(),g=0;g<n.length;g++)c(n[g],h+" input "+g+" :");return i.appApi.rnaApi.done(function(i){i.fssApi({methodName:t,methodArgs:n}).done(function(i){var n={};try{n=JSON.parse(i)}catch(d){l("ERROR while calling "+t+" : "+d)}var u=s?s(n):n;if(o)try{o(u)}catch(d){l("ERROR in validation while calling "+t+" : "+d)}a&&(u=a(u));var g=(new Date).getTime();r(h+" done in "+(g-f)),e&&e.success&&e.success(u),c(u,h+" returned: \n"),p.resolve(u)}).fail(function(e){return d(e)})}),p.promise()}function c(e,t){_.isObject(e)&&(e=JSON.stringify(e,null,2)),r(t+e)}function u(){return f({url:"getUISettings"},"getUISettings",[])}function h(e){return f({url:"saveUISettings"},"setUISettings",[e])}function p(e){var t=e.url,i=t.replace("/formdata/","/form/"),n=t.replace("/formdata/","/values/"),s={},o=$.Deferred(),a=function(t,i,n){e.error&&e.error(t,i,n),o.reject(t,i,n)};return g(_.extend({},e,{url:i,success:null,error:null})).done(function(t){s.form=t,m(_.extend({},e,{url:n,success:null,error:null})).done(function(t,i,n){s.values=t,e.success&&e.success(s,i,n),o.resolve(s,i,n)}).fail(a)}).fail(a),o.promise()}function g(e){function t(e){var t={name:"",form:{scanID:"",collectionID:"",assetID:"",pages:e.pages,sample:!1,version:2,id:e.formID}};return t}return f(e,"getFormFields",[],t,n.validateFormFields)}function m(e){function t(e){var t={values:{version:1,formValues:e.formValues}};return t}return f(e,"getFormValues",[],t,n.validateFormValues)}function v(e){var t=e.url,i=t.replace("/formdata/","/form/"),n=t.replace("/formdata/","/values/"),s=JSON.parse(e.data),o=s.form,a=s.values,r=$.Deferred(),l=null;o&&(l=S(_.extend({},e,{url:i,success:null,error:null}),o));var d=null;return a&&(d=E(_.extend({},e,{url:n,success:null,error:null}),a)),$.when(l,d).done(function(){e.success&&e.success(),r.resolve()}).fail(function(t,i,n){e.error&&e.error(t,i,n),r.reject(t,i,n)}),r.promise()}function S(e,t){var i={pages:t.pages};return f(e,"saveFormFields",[i])}function E(e,t){var i={formValues:t.formValues};return f(e,"saveFormValues",[i])}function b(e,t){r("calling into stubFunc "+e.url);var i=$.Deferred();return e&&e.success&&e.success(t),i.resolve(t),i.promise()}function w(e){return b(e,{})}function F(e){var t=$.Deferred(),i={version:1,profiles:[{key:"default",value:[{key:"name",value:[{key:"display_name",text:"OFFLINE"},{key:"first_name"},{key:"middle_name"},{key:"last_name"}]},{key:"address",value:[{text:"Home",key:"group_home",value:[{key:"address_1"},{key:"address_2"},{key:"city"},{key:"state"},{key:"zip"},{text:"US",key:"country"}]}]},{key:"email",value:[{text:"Personal",key:"group_personal",value:[{key:"email"}]}]},{key:"phone",value:[{text:"Personal",key:"group_personal",value:[{key:"phone"}]}]}]}]},n=(new Date).getTime(),s="getGlobalSignatures RNA.Api "+e.url;return r(s),A().done(function(o){for(var a={key:"signature",value:[]},l=0;l<o.length;l++){var d={assetID:o[l].assetID,type:o[l].type,kind:"image"};a.value.push(d)}i.profiles[0].value.push(a),e&&e.success&&e.success(i);var f=(new Date).getTime();r(s+" done in "+(f-n)),c(i,s+" returned: \n"),t.resolve(i)}).fail(function(i){e&&e.error&&e.error(i),t.reject(i)}),t.promise()}function T(e){var t=$.Deferred(),n={methodName:"getToolbarButtonPosition",methodArgs:[e]};return i.appApi.rnaApi.done(function(e){e.fssApi(n).done(function(e){t.resolve(JSON.parse(e))}).fail(function(){t.reject("Failed to getToolbarButtonPosition")})}),t.promise()}function D(e){function t(){var e=$.Deferred(),t={methodName:"saveSignature",methodArgs:[{state:"start",addToForm:f,addToGlobal:u,initials:g,native_sign:h}]};return c(t,"saveSignature RNA.Api (start): "),i.appApi.rnaApi.done(function(i){i.fssApi(t).done(function(t){e.resolve(JSON.parse(t))}).fail(function(){e.reject("Failed to startSaveSignature")})}),e.promise()}function n(e){(f||h)&&a&&(e.assetID=a),u&&r&&(e.globalAssetID=r)}function s(e,t,s){function o(e,t,s){var r={methodName:"saveSignature",methodArgs:[{state:"continue"}]};n(r.methodArgs[0]);var l=e.length;c(r,"saveSignature RNA.Api (continue): "),t+s>=l?(r.methodArgs[0].imgData=e.substr(t),i.appApi.rnaApi.done(function(e){e.fssApi(r).done(function(){a.resolve()}).fail(function(){a.reject("Failed to saveSignatureData")})})):(r.methodArgs[0].imgData=e.substr(t,s),i.appApi.rnaApi.done(function(i){i.fssApi(r).done(function(){o(e,t+s,s)}).fail(function(){a.reject("Failed to saveSignatureData")})}))}var a=$.Deferred();return o(e,t,s),a.promise()}function o(){var e=$.Deferred(),t={methodName:"saveSignature",methodArgs:[{state:"complete",initials:g,noSignUpdate:p}]};return n(t.methodArgs[0]),c(t,"saveSignature RNA.Api (complete): "),i.appApi.rnaApi.done(function(i){i.fssApi(t).done(function(){e.resolve()}).fail(function(){e.reject("Failed to finishSaveSignature")})}),e.promise()}var a,r,l=$.Deferred();e=_.extend({addToForm:!0,addToGlobal:!1,native_sign:!1,noSignUpdate:!1,type:"signature"},e);var d=e.pngData,f=!!e.addToForm,u=!!e.addToGlobal,h=!!e.native_sign,p=!!e.noSignUpdate,g="initials"===e.type;return t().then(function(e){return a=e.assetID||"",r=e.globalAssetID||"",s(d,0,G)}).then(o).done(function(){var e={};n(e),l.resolve(e)}).fail(function(e){l.reject("Error saving signature: "+e)}),l.promise()}function y(t){var n=$.Deferred(),s={},o={methodName:"getSignature",methodArgs:[{assetID:t}]};return r("getSignature RNA.Api (start): "+t),i.appApi.rnaApi.done(function(t){t.fssApi(o).done(function(t){var i=new e.RNAModel(void 0,_.extend({_proxy:t,shouldCache:!1}));i.hasProperty("signatureURL")?(s.imgData=i.get("signatureURL"),c(s,"getSignature RNA.Api (resolve): "),n.resolve(s)):i.once("change:signatureURL",function(){s.imgData=i.get("signatureURL"),c(s,"getSignature RNA.Api (resolve): "),n.resolve(s)})}).fail(function(){n.reject("Error getting signature")})}),n.promise()}function A(){function t(e){var t={},i=[];try{t=JSON.parse(e.get("json")),_.each(t,function(e,t){e.url=window.atob(e.url),i.push(_.extend(e,{assetID:t}))}),c(i,"getGlobalSignatures RNA.Api (resolve): "),n.resolve(i)}catch(s){r("ERROR while calling getGlobalSignatures : "+s),n.reject("Error getting global signature")}}var n=$.Deferred(),s={methodName:"getGlobalSignatures"};return r("getGlobalSignatures RNA.Api (start)"),i.appApi.rnaApi.done(function(i){i.fssApi(s).done(function(i){var n=new e.RNAModel(void 0,_.extend({_proxy:i}));n.hasProperty("json")?t(n):n.once("change:json",function(){t(n)})}).fail(function(){n.reject("Error getting global signature")})}),n.promise()}function C(){function e(n,s){if(s===n.length)r("deleteGlobalSignatures (resolve)"),i?t.reject("Error deleting all global signatures"):t.resolve();else var o=P(n[s].assetID).always(function(){i=i||"rejected"===o.state(),r("deleteGlobalSignatures '"+n[s].assetID+"' deleted"),e(n,++s)})}var t=$.Deferred(),i=!1;return r("deleteGlobalSignatures (start)"),A().then(function(t){e(t,0)}).fail(function(){t.reject("Error deleting all global signatures")}),t.promise()}function P(e,t){var n=$.Deferred(),s={methodName:"deleteSignature",methodArgs:[{assetID:e,noSignUpdate:!!t}]};return r("deleteSignature RNA.Api (start): "+e+", noSignUpdate: "+t),i.appApi.rnaApi.done(function(e){e.fssApi(s).done(function(e){c(e,"deleteSignature RNA.Api (resolve): "),n.resolve(e)}).fail(function(){n.reject("Error deleting signature")})}),n.promise()}function R(e,t){var i=$.Deferred(),n=new Image;return n.onload=function(){var n=document.createElement("canvas");n.width=this.width,n.height=this.height;var s=n.getContext("2d");s.drawImage(this,0,0);var o=n.toDataURL("image/png").split(",")[1];n.remove(),r("readerJSWrapper got imgData from "+e),i.resolve({imgData:o,sigData:t})},n.onerror=function(){l("readerJSWrapper error loading imgData from "+e),i.reject()},n.src=e,i.promise()}function I(e,i){var n=$.Deferred();return r("deleteSignatureByHash (start) hash: "+e+", type: "+i),e&&i?require(["fss/js/lib/util"],function(s){var o;e=e.toUpperCase(),A().then(function(n){function a(i){if(i&&i.imgData){var n=t.getSha256(i.imgData);n.toUpperCase()===e&&(o=i.sigData)}}for(var r=[],l=0;!o&&l<n.length;l++){var d=n[l];d.type===i&&(d.hash.toUpperCase()===e?o=d:r.push(R(d.url,d).then(a)))}return s.whenDone(r)}).then(function(){return o?P(o.assetID):(require(["fss/js/lib/faf-common-util"],function(e){"sign_menu"!==e.desktopNativeSignCommand()&&l("Did not match hash for sig deletion!")}),$.Deferred().resolve({deleted:!1}).promise())}).then(function(e){r("deleteSignatureByHash (resolve)"),n.resolve(e)}).fail(function(e){l("deleteSignatureByHash (reject)"),n.reject(e)})}):(l("deleteSignatureByHash missing param (resolve)"),n.resolve({deleted:!1})),n.promise()}function O(e){var t=$.Deferred(),n={methodName:"signatureSynced",methodArgs:[{assetID:e||""}]};return r("signatureSynced RNA.Api (start): "+e),i.appApi.rnaApi.done(function(e){e.fssApi(n).done(function(e){c(e,"signatureSynced RNA.Api (resolve): "),t.resolve(e)}).fail(function(){t.reject("Error calling signatureSynced")})}),t.promise()}function M(e,t){var i=$.Deferred(),n={imgData:e,cleanupSessionID:t};return i.resolve(n).promise()}function x(t){var n=$.Deferred(),s={},o={methodName:"importImage",methodArgs:[{maxSize:t}]};return r("importImage RNA.Api (start)"),i.appApi.rnaApi.done(function(t){t.fssApi(o).done(function(t){var i=new e.RNAModel(void 0,_.extend({_proxy:t}));i.hasProperty("imageURL")?(s.imgData=i.get("imageURL"),c(s,"importImage RNA.Api (resolve): "),n.resolve(s)):i.once("change:imageURL",function(){s.imgData=i.get("imageURL"),c(s,"importImage RNA.Api (resolve): "),n.resolve(s)})}).fail(function(){n.reject("Error importing image")})}),n.promise()}function N(){if(i.Reader.getFssPrefsPromise)return i.Reader.getFssPrefsPromise;var e=$.Deferred();i.Reader.getFssPrefsPromise=e.promise();var t={methodName:"getFssPrefs",methodArgs:[{}]};return r("getFssPrefs RNA.Api (start)"),i.appApi.rnaApi.done(function(n){n.fssApi(t).done(function(t){try{var i=JSON.parse(t);c(i,"getFssPrefs RNA.Api (resolve): "),e.resolve(i)}catch(n){r("ERROR while calling getFssPrefs : "+n),e.reject("Error getting FSS preferences")}}).fail(function(){e.reject("Error getting FSS preferences"),delete i.Reader.getFssPrefsPromise})}),i.Reader.getFssPrefsPromise}function L(){return f({url:"getSessionPrefs"},"getSessionPrefs",[])}function U(e){return f({url:"setSessionPrefs"},"setSessionPrefs",[e])}function j(){return i.appApi.sessionApi.isSignedIn()&&!i._forceOfflineMode&&!i._disconnectedMode}function k(e){i.appApi.rnaApi.done(function(t){t.invokeMethod({methodName:"openDecoratedUrl",methodArgs:e})})}function V(e){f({url:"autoCompleteSuggestions"},"autoCompleteSuggestions",[{suggestions:e}])}var z=2200,G=51200,B={GET:{"/formdata/":{method:p,alwaysUse:!0},"/profiles":{method:F,alwaysUse:!1}},PUT:{"/formdata/":{method:v,alwaysUse:!0}},DELETE:{}};return{getWrapper:function(t,i){var n=e.getBaseFSSUrl(),s=t.indexOf(n)>=0,o=t.indexOf("/health")>=0;if(!s||o)return null;var a=!this.isSignedInAndConnected(),r=B[i],l=_.find(r,function(e,i){return t.indexOf(i)>-1&&(e.alwaysUse||a)?!0:void 0});return l?l.method:a?w:null},getUISettings:u,saveUISettings:h,getFssPrefs:N,doGetRendition:d,getBase64ImgDataFromURL:R,saveSignature:D,getSignature:y,deleteSignature:P,deleteSignatureByHash:I,deleteGlobalSignatures:C,getGlobalSignatures:A,signatureSynced:O,cleanImage:M,importImage:x,getToolbarButtonPosition:T,getSessionPrefs:L,setSessionPrefs:U,isSignedInAndConnected:j,openDecoratedUrl:k,sendAutoCompleteSuggestions:V}}),define("fss/js/lib/reader/faf-reader-util",["core/ac-core","fss/js/ac-faf","fss/js/lib/reader/faf-reader-js-wrapper"],function(e,t,i){return{getBaseFSSUrl:function(){return e.getBaseFSSUrl()},getPrefsUrl:function(){return e.getBaseAiCUrl()+"createpdf/api/users/me/prefs"},getRenditionUrl:function(){return"reader"},createRenditionUrl:function(){return"reader"},getFafViewInfo:function(){return{appViewChildren:[{attr:"_fafEditorView",cls:"FafEditorView",prop:"$editorView"}],userDataViewClass:"FafRhpReaderView",hudViewClass:"FafReaderHudView"}},getFafPrefsInfo:function(){return{ToolBarSignatureSaved:"session.ToolBarSignatureSaved"}},onExternalEsc:function(e){return t.Reader.readerEventListenerOp&&t.Reader.readerEventListenerOp.onEsc(e)},offExternalEsc:function(e){return t.Reader.readerEventListenerOp&&t.Reader.readerEventListenerOp.offEsc(e)},isLoggedIn:function(){return t.appApi.sessionApi.isSignedInReader()},isDesktopAndLoggedIn:function(){return this.isLoggedIn()},desktopNativeSignCommand:function(){if(void 0!==t.Reader.nativeSign)return t.Reader.nativeSign;var e=/fillsign\/([^\/|?]+)/,i=e.exec(document.title);return t.Reader.nativeSign=i?i[1]:!1,t.Reader.nativeSign},isSignedInAndConnected:function(){return i.isSignedInAndConnected()},hostEnvironment:function(){return"reader"},importImage:function(e){return i.importImage(e.maxSize)},getAppApiVersion:function(){return"dev"},getFssPrefs:function(){return i.getFssPrefs()},runSignatureSyncOp:function(e){return t.Reader.opFactory.create("SignatureSyncReaderOp",e).run()},signatureSynced:function(e){return i.signatureSynced(e)},scrollbarWidth:function(){if(void 0===this.width){var e=$('<div style="width:50px;height:50px;overflow:auto;"><div/></div>').appendTo("body"),t=e.children();this.width=t.innerWidth()-t.height(99).innerWidth(),e.remove()}return this.width}}}),define("fss/js/lib/faf-common-util",["core/utils/util","fss/js/ac-faf","fss/js/lib/web/faf-web-util","fss/js/lib/reader/faf-reader-util"],function(e,t,i,n){function s(){return e.isReader()||e.isAcrobat()}var o,a=s()?n:i;return{isDesktop:function(){return s()},isDesktopAndLoggedIn:function(){return a.isDesktopAndLoggedIn&&a.isDesktopAndLoggedIn()},desktopNativeSignCommand:function(){return a.desktopNativeSignCommand&&a.desktopNativeSignCommand()},isLoggedIn:function(){return a.isLoggedIn()},isSignedInAndConnected:function(){return a.isSignedInAndConnected()},hostEnvironment:function(){return o?o:o=a.hostEnvironment()},getBaseFSSUrl:function(){return a.getBaseFSSUrl()},getPrefsUrl:function(){return a.getPrefsUrl()},getRenditionUrl:function(){return a.getRenditionUrl()},addClientId:function(e){return a.addClientId&&(e=a.addClientId(e)),e},createRenditionUrl:function(e,t){return a.createRenditionUrl(e,t)},getFafViewInfo:function(){return a.getFafViewInfo()},getFafPrefsInfo:function(){return a.getFafPrefsInfo()},onExternalEsc:function(e){return a.onExternalEsc(e)},offExternalEsc:function(e){return a.offExternalEsc(e)},importImage:function(e){return a.importImage(e)},getAppApiVersion:function(){return a.getAppApiVersion()},runSignatureSyncOp:function(e,i){return i&&t._signatures&&delete t._signatures.signatureSyncPromise,a.runSignatureSyncOp(e)}}}),define("fss/js/lib/faf-env-util",["core/ac-core","core/utils/util","fss/js/ac-faf","fss/js/lib/faf-common-util"],function(e,t,i,n){return{browserAndVersion:function(e){if(e||!i._browserAndVersion){var t,s,o,a=navigator.appName,r=navigator.userAgent;t=r.match(/(trident|opera|chrome|safari|firefox|msie|ReaderServices|AcrobatServices)\/?\s*(\.?\d+(\.\d+)*)/i),t&&"Trident"===t[1]?(t[1]="MSIE",null!==(o=r.match(/rv:([\.\d]+)/i))&&(t[2]=o[1])):t&&(s=t[1].match(/(.*)Services$/))&&s[1]?t[1]="Reader":t&&null!==(o=r.match(/version\/([\.\d]+)/i))&&(t[2]=o[1]),t=t?[t[1],t[2]||"-?"]:[a,navigator.appVersion,"-?"],t.push(n.isSignedInAndConnected()?"online":"offline"),i._browserAndVersion=t}return i._browserAndVersion},isDesktop:function(){return n.isDesktop()},isIE8:function(){var e=this.browserAndVersion();return"MSIE"===e[0]&&8===parseInt(e[1],10)},isIE10:function(){var e=this.browserAndVersion();return"MSIE"===e[0]&&10===parseInt(e[1],10)},isSafari:function(){var e=this.browserAndVersion();return!_.isEmpty(e)&&"Safari"===e[0]},isSafari5orBelow:function(){var e=this.browserAndVersion();return"Safari"===e[0]&&parseInt(e[1],10)<=5},supportsPlaceholder:function(){if(!("placeholder"in i._supports)){var e="placeholder"in document.createElement("input");i._supports.placeholder=e}return i._supports.placeholder},supportsFileUpload:function(){if(!("fileupload"in i._supports)){var e=!this.isSafari5orBelow()&&!t.isIE9orBelow();i._supports.fileupload=e}return i._supports.fileupload},supportsCanvas:function(){if(!("canvas"in i._supports)){var e=!1,t=this.browserAndVersion(),n=parseFloat(t[1],10);switch(t[0]){case"MSIE":var s=$("<canvas/>"),o=s[0];o.getContext&&(e=!0);break;case"Firefox":n>=21&&(e=!0);break;case"Chrome":n>=27&&(e=!0);break;case"Safari":n>=5.1&&(e=!0);break;case"Opera":n>=15&&(e=!0);break;case"Reader":case"Acrobat":e=!0;break;default:this.logWarn("util","unknown browser ["+t[0]+", "+t[1]+"] for canvas from: "+navigator.userAgent)}i._supports.canvas=e}return i._supports.canvas},supportsWebFonts:function(){if(!("webfonts"in i._supports)){var e=!1,t=this.browserAndVersion(),n=parseFloat(t[1],10);switch(t[0]){case"MSIE":n>=9&&(e=!0);break;case"Firefox":n>=21&&(e=!0);break;case"Chrome":n>=27&&(e=!0);break;case"Safari":n>=5.1&&(e=!0);break;case"Opera":n>=15&&(e=!0);break;case"Reader":case"Acrobat":e=!0;break;default:this.logWarn("util","unknown browser ["+t[0]+", "+t[1]+"] for webfonts from: "+navigator.userAgent)}i._supports.webfonts=e}return i._supports.webfonts},supportsTouch:function(){return"ontouchstart"in window||!!navigator.msMaxTouchPoints}}}),define("fss/js/nls/ui-strings",{root:!0,"xx-xx":!0,"de-de":!0,"en-gb":!0,"es-es":!0,"fr-fr":!0,"it-it":!0,"ja-jp":!0,"da-dk":!0,"fi-fi":!0,"nb-no":!0,"nl-nl":!0,"pt-br":!0,"sv-se":!0,"zh-cn":!0,"zh-tw":!0,"ko-kr":!0,"cs-cz":!0,"hu-hu":!0,"pl-pl":!0,"ru-ru":!0,"uk-ua":!0,"tr-tr":!0,"sk-sk":!0,"sl-si":!0,"eu-es":!0,"hr-hr":!0,"ro-ro":!0,"ui-st":!0,"zz-zz":!0}),define("fss/js/nls/root/ui-strings",{FAF:"Fill & Sign",NullString:"",OK:"OK",Cancel:"Cancel",Close:"Close",Continue:"Continue",Delete:"Delete",Accept:"Accept",Apply:"Apply",Clear:"Clear",Back:"Back",Next:"Next",Done:"Done",ParserError:"Unable to understand response from server.",ObjectNotFound:"The requested object or document cannot be found.",UnboundFormFound:"The requested form cannot be opened.",UnsupportedFileType:"The file type you selected is currently not supported.",UnsupportedPDFTooManyPages:"We currently only support files that have less than 100 pages.",UnsupportedPDFType:"The PDF file you selected is currently not supported.",UnsupportedPDFTypeEditRestricted:"We cannot process this file because the author applied restrictions that prevent editing.",UnsupportedPDFTypeEncrypted:"We cannot process this file because the author has protected it with encryption.",UnsupportedPDFTypeInvalid:"The file you selected appears to be corrupt.",UnsupportedPDFTypeXFA:"You've selected a dynamic XFA file that is currently not supported. Try filling it in from Adobe Reader or Acrobat instead.",UnsupportedFileSize:"We currently only support files that are less than 100MB.",CreatePDFFailed:"We're having trouble processing this file. Try converting it to PDF before selecting it again.",Unauthorized:"You are not authorized to perform the requested action.",BadRequest:"There was an unknown problem. Try again.",Timeout:"The operation timed out.",Unknown:"An unexpected error occurred.",FilledPDFSuffix:"_filled",ErrorDownloadingPDF:"Unable to download the completed PDF. <%= message %>",RestrictedEditPermission:"The original author of this PDF applied usage restrictions to the file and we are unable to create a filled out PDF.",OutputFolderNotFound:"This form’s original folder does not exist anymore. Please download this form to your computer first.",UnsupportedFileTypeTitle:"Unsupported File Type",UnsupportedFileTypeMsg:"The file cannot be opened in Fill & Sign mode.",OrganizerSubTitle:"Easily fill and sign any form.",OrganizerSelectForm:"Select Any Form to Fill Out",OrganizerSelectFormTitle:"Select Form",OrganizerRecentFiles:"Recent Forms",OrganizerViewAll:"View All",OrganizerSampleForm:"Sample Form",OrganizerSampleGuide:"Don’t have a form to fill out? Try the sample form.",OrganizerSampleFileName:"Sample Membership",FileFilterLabel:"File Type: can be converted to forms",AddSelectedBtnLabel:"Open",PrepareDocument:"Preparing document...",OpenDocument:"Opening Form...",ToolBarTextTooltip:"Type Text",ToolBarCrossTooltip:"Crossmark",ToolBarCheckTooltip:"Checkmark",ToolBarRoundRectTooltip:"Circle",ToolBarLineTooltip:"Line",ToolBarDotTooltip:"Filled Dot",ToolBarSignTooltip:"Sign or Initial Form",ToolBarFillSign:"Fill &amp; Sign",ToolBarSign:"Sign",ToolBarPrint:"Print",ToolBarPrintTooltip:"Download as PDF then Print",ToolBarDownload:"Download as PDF",ToolBarDownloadToComputer:"Download PDF to My Computer",ToolBarDownloadToCloud:"Save PDF to <%= cloudName %>",ToolBarDownloadToFiles:"Save PDF to Adobe Document Cloud Files",ToolBarSavingDataMessage:"Saving...",ToolBarSavingGuide:"Your form has been saved as <%= fileName %>",ToolBarSavedDataMessage:"Autosaved",ToolBarAddSign:"Add Signature",ToolBarAddInitials:"Add Initials",ToolBarSignatureSaved:"Your signature has been saved here. You can use it again later.",ToolBarInitialsSaved:"Your initials have been saved here. You can use them again later.",HUDPreviousPage:"Previous Page",HUDNextPage:"Next Page",HUDPageNumber:"Page Number",HUDNumberOfPages:"Number of Pages",HUDFitPageWidth:"Fit Page Width",HUDFitFullPage:"Fit Full Page",HUDZoomIn:"Zoom In",HUDZoomOut:"Zoom Out",HUDZoomLevel:"Zoom Level",HUDInvalidPage:"There is no page numbered '<%= invalidPageNum %>' in this document.",changeSignatureStyle:"Change style",typeSignatureButtonLabel:"Type",drawSignatureButtonLabel:"Draw",importSignatureButtonLabel:"Image",importSignaturePlaceholder:"Select Image",typeYourNamePlaceholder:"Type your name here.",typeYourInitialsPlaceholder:"Type your initials here.",signHerePlaceholder:"Sign Here",initialsHerePlaceholder:"Initials Here",saveSignature:"Save signature",saveInitials:"Save initials",chooseSignatureTitle:"Choose Signature",chooseInitialsTitle:"Choose Initials",chooseSignatureMessage:"You have multiple signatures saved in your account. Choose which signature you would like to keep.",chooseInitialsMessage:"You have multiple initials saved in your account. Choose which initials you would like to keep.",removeAllSignatures:"Remove all signatures",removeAllInitials:"Remove all initials",FormViewSendUsFeedback:"Send Us Feedback",FormViewTypeTextHere:"Type text here",FormViewTextTooLongText:"You have exceeded the limit of <%= maxAllowedChars %> characters per field.<br><br>This field was reverted to its previous value.<br><br>You can create another field next to or below this one to hold the extra characters.",FormViewTooManyFieldsText:"You have exceeded the limit of <%= maxAllowedFields %> fields per page.",FormViewFRInfo:"We have recognized fields on this form.<br/><br/>You can use the tab key to move between fields and the space bar to toggle checkboxes. You can also click anywhere to create a new field.",SettingsUserDataHead:"My Profile",SettingsUserDataDesc:"Click to clear all saved information in My Profile",SettingsUserDataClear:"Clear All",SettingsUserDataClearConfirm:"Clear All",SettingsUserDataClearing:"Clearing…",SettingsUserDataGuideClear:"Clear all information recorded in My Profile. This action cannot be undone.",SettingsUserDataConfirmHtml:"This will clear all information recorded in My Profile. This action cannot be undone.",SettingsUserDataGuideCleared:"All recorded information in My Profile has been cleared.  You may enter new information at any time.",SettingsAutocompleteHead:"Suggestions",SettingsAutocompleteDesc:"Click to clear suggestions from data you have entered",SettingsAutocompleteClear:"Clear All",SettingsAutocompleteClearConfirm:"Clear All",SettingsAutocompleteClearing:"Clearing…",SettingsAutocompleteGuideClear:"Clear all form labels and suggestions recorded from forms you have filled out. This action cannot be undone.",SettingsAutocompleteGuideClearRdr:"Clear all suggestions recorded from data you have entered. This action cannot be undone.",SettingsAutocompleteConfirmHtml:"This will clear all suggestions recorded from data you have entered. This action cannot be undone.",SettingsAutocompleteGuideCleared:"All recorded suggestions have been cleared.",SettingsAutocompleteToggleDesc:"Suggest words or phrases based on form labels and information you have entered",SettingsAutocompleteToggleDescRdr:"Suggest words or phrases based on information you have entered",SettingsRecognitionDataHead:"Prediction",SettingsRecognitionDataClear:"Clear All",SettingsRecognitionDataClearConfirm:"Clear All",SettingsRecognitionDataClearing:"Clearing…",SettingsRecognitionDataGuideCleared:"All recorded information for prediction has been cleared.",SettingsRecognitionDataGuideClear:"Clear all information recorded for prediction. This action cannot be undone.",SettingsRecognitionDataConfirmHtml:"This will clear all information recorded for prediction. This action cannot be undone.",SettingsGuideClearErr:"Your recorded information or suggestions could not be cleared.",AutocompleteLabel_signature:"Signature",AutocompleteLabel_initials:"Initials",FormViewBadCharText:"You typed characters that are not currently supported. The following characters were changed to “#”:<br><br><%= badChars %>",FormViewFlattenFormWarning:"When you save a form with a signature or initials you will no longer be able to edit the existing form fields.",UserDataTitle:"MY PROFILE",UserDataManage:"Settings",UserDataSendUsFeedback:"Send Us Feedback",UserDataDragGuide:"You can drag any item onto the form.",UserDataSaveMessage:"Your profile and form information are stored in the cloud so you can easily complete your forms.<br/><br/>To manage your stored information click on 'Settings'.",UserDataSaveErrorMessage:"Unable to save profile data","UserData.name":"Name","UserData.name.display_name":"Full Name","UserData.name.first_name":"First Name","UserData.name.middle_name":"Middle Name","UserData.name.last_name":"Last Name","UserData.address":"Address","UserData.address.add":"Add Address","UserData.address.new":"New Address","UserData.address.group_home":"Home","UserData.address.address_1":"Street 1","UserData.address.address_2":"Street 2","UserData.address.city":"City","UserData.address.state":"State","UserData.address.zip":"Zip","UserData.address.country":"Country","UserData.email":"Email","UserData.email.add":"Add email","UserData.email.new":"New email","UserData.email.group_personal":"Personal","UserData.email.email":"Email address","UserData.phone":"Phone","UserData.phone.add":"Add Phone","UserData.phone.new":"New Phone","UserData.phone.group_personal":"Personal","UserData.phone.phone":"Phone Number","RHP.IPM.offline.title":"GET STARTED","RHP.IPM.offline.text":"Click on the page to fill in the form or choose a tool above.<br><br>Sign in to automatically save your responses for future use.","RHP.IPM.offline.help":'<a target="_blank" href="https://www.adobe.com/go/fillsigngetstarted">Learn More</a>',"RHP.IPM.offline.signin":"Sign In","RHP.Send.title":"SEND OPTIONS","RHP.Send.track":"Send & Track","RHP.Send.others":"Get Others to Sign",DblClkForSign:"Double click to sign",DblClkForInitials:"Double click to initial",FailedToLoadSign:"Signature could not be accessed. Exit the application and try again. You may also need to create a new signature.",DownloadingPDF:"Downloading PDF...",ImportingImage:"Importing signature image...",GeneratingPDF:"Generating filled PDF...",LoadingRHP:"Retrieving your information...",DisconnectedMessageRHP:"An Internet connection is required. Check your connection and try again.",DisconnectedBtnRHP:"Try again",GenericDialogTitle:"Error",GenericWarningTitle:"Warning",GenericDialogText:"Unknown error",UnsupportedFeatureDialogTitle:"Unsupported browser",UnsupportedFeatureDialogBrowser:"This browser is not supported.",UnsupportedFeatureDialogFeature:"This feature is not supported for your browser.",UnsupportedFeatureDialogText:'<%= browserOrFeature %><br><br>Please upgrade to the latest version of <a href="https://www.google.com/intl/en/chrome/browser/">Google Chrome</a>, <a href="http://windows.microsoft.com/en-us/internet-explorer/download-ie">Internet Explorer</a>, <a href="https://www.mozilla.org/en-US/firefox">Firefox</a> or <a href="http://support.apple.com/downloads/#safari">Safari</a><%= additionalText %>',UnsupportedFeatureDialogNoText:".",UploadDocErrorDialogText:"Upload service for this type of file is currently offline. Please try again later.",SignInToUploadDocDialogText:"You need to be signed in to upload this type of file.",UnsupportedFileFormatDialogText:"Unsupported file format.",UploadErrorText:"upload tier error",DefaultError401Text:"You have been signed out. Sign in and try again.",DefaultErrorDialogText:"Unexpected server error. Reload the page and try again.<%= additionalText %><%= additionalRef %>",DefaultErrorDialogAdditionalText:"<br><br><%= additionalText %>",DefaultErrorDialogLogRefText:"<br><br>[ref: <%= logRef %>]",SignatureComplicatedText:"Your signature contained something unexpected. Try creating a simpler signature.",SignaturePopupText:" to use signatures.",ToolbarFeatureText:" to use the tools palette.",UnsupportedPDFLearnMore:'<br><br><a target="_blank" href="https://helpx.adobe.com/acrobat-com/kb/supported-file-formats-fill-sign.html">Learn More</a>',LargeSignatureImage:"This image file is too large. Select a different file smaller than <%= sizeLimit %>MB and try again.",InvalidImage:"This image file is not supported. Select a different file and try again.",CorruptedFile:"This image file is corrupt. Select a different file and try again.",ConflictDetected:"You are editing an outdated version of this form. Do you want to overwrite the form with your changes?",OverwriteText:"Overwrite",DiscardText:"Discard",DownloadFormTitle:"Save PDF to Adobe Document Cloud Files",DownloadFormToCloudTitle:"Save PDF to <%= cloudName %>",DownloadFormWarningTitle:"Download Filled Form",DownloadFormNoItems:"You are about to download a form that has not been filled out. Click “Continue” to download the empty form.",SaveForm:"The filled form “<%= formName %>” has been saved to your Adobe Document Cloud Files.",SaveFormToCloud:"The filled form “<%= formName %>” has been saved to <%= cloudName %>.",PrintFormTitle:"Print Filled Form",DownloadFormToPrint:"You cannot print the form using the browser print button. Download the form as a PDF then print it using Adobe Reader.",DownloadButton:"Download",ConnectorBasedFormOpenedTitle:"Warning",ConnectorBasedFormOpenedMessage:"You are now editing a copy of this form stored in Document Cloud. Saving this form will create a PDF copy of it in its original location.",NPSheader:"Tell Us About Your Experience",RecommendNotLikely:"Not at all likely",RecommendLikely:"Extremely likely",AskForRecommend:"How likely are you to recommend Adobe Fill & Sign to others?",NPSFeedback:"What would make you more likely to recommend us to others?",UpgradeDialogTitle:"Upgrade",UpgradeDialogText:"Upgrade to use online features","FR.signatureDoesNotExist":"Please create a signature to place it on the form",SignTitle:"Sign with Adobe Acrobat Sign"}),define("fss/js/templates/faf-guide-template",[],function(){return'<div role="tooltip" class="faf-guide <%= guideType %>"><div class="faf-guide-content"><%= text %></div><div class="faf-guide-arrow"></div></div>'
}),define("fss/js/lib/utilUI",["fss/js/ac-faf","i18n!fss/js/nls/ui-strings","fss/js/templates/faf-guide-template"],function(e,t,i){function n(){d(t.UnsupportedFileFormatDialogText)}function s(e){var i,n=e.code;_.has(t,n)?(i=t[n],"RestrictedEditPermission"===n&&(i+=t.UnsupportedPDFLearnMore)):(i=t.Unknown,i+=e.logRef?_.template(t.DefaultErrorDialogLogRefText,{logRef:e.logRef}):t.NullString),d(_.template(t.ErrorDownloadingPDF,{message:i}))}function o(){d(t.SignInToUploadDocDialogText)}function a(){d(t.UploadDocErrorDialogText)}function r(e,i){d({title:t.UnsupportedFeatureDialogTitle,text:_.template(t.UnsupportedFeatureDialogText,{browserOrFeature:i?t.UnsupportedFeatureDialogBrowser:t.UnsupportedFeatureDialogFeature,additionalText:e||t.UnsupportedFeatureDialogNoText})})}function l(i){function n(){}var s=i.showOK&&(i.okText||t.OK),o=i.showCancel&&(i.cancelText||t.Cancel),a=i.title,r=i.text,l=i.severity||e.appApi.dialogApi.SEVERITY_ERROR,d=e.appApi.dialogApi.displayHtmlAlert(l,a,r,s,o,i.dlgOptions);d.always(function(){e.appApi&&e.appApi.displayApi&&e.appApi.displayApi.showModal(!1)});var f=i.okFunc||n,c=i.cancelFunc||n;o?d.then(function(){f(null,null,n)}).fail(function(){c(null,null,n)}):d.always(function(){f(null,null,n)})}function d(e){"string"==typeof e&&(e={text:e}),e=$.extend({title:t.GenericDialogTitle,text:t.GenericDialogText,okText:t.OK,showCancel:!1,cancelText:t.Cancel},e),l(e)}function f(t){if(t=_.extend({top:0,left:0,text:"",parent:$(document),duration:8e3,arrow:"up",arrowPosition:20,clickToRemove:!0,important:!1,getPreference:function(){return!!this.preference&&e._fafPreferencesModel.getPreference(this.preference)},setPreference:function(){this.preference&&e._fafPreferencesModel.setPreference(this.preference,!0)}},t),t.force||t.redo||!t.getPreference()){if(h){if(t.noQueueIfShowing&&u(function(e){return e.guideID===t.guideID}))return t;if(!t.important||h.important){for(var n=h;n.nextGuide;){if(t.important&&!n.nextGuide.important){t.nextGuide=n.nextGuide;break}n=n.nextGuide}return n.nextGuide=t,t}h.removeTimer&&(clearTimeout(h.removeTimer),delete h.removeTimer),h.guide.remove(),delete h.guide,h.redo=!0,t.nextGuide=h}t.redo||t.setPreference();var s=t.guide=$(_.template(i,{text:t.text,guideType:t.guideType||""})),o=s.find(".faf-guide-arrow");o.addClass(t.arrow),o.css("up"===t.arrow||"down"===t.arrow?"left":"top",t.arrowPosition),t.parent.append(s);var a="left";switch(t.arrow){case"up":t.initialPosition={left:t.left,top:t.top+o.height()};break;case"down":t.initialPosition={left:t.left,top:t.bottom-o.height()-s.outerHeight()};break;case"left":t.initialPosition={left:t.left+o.width(),top:t.top};break;case"right":t.initialPosition={left:t.right,top:t.top},a="right"}s.css("top",t.initialPosition.top+"px").css(a,t.initialPosition.left+"px"),t.width&&s.css("width",t.width+"px"),t.maxWidth&&s.css("max-width",t.maxWidth+"px"),s.css("cursor","default"),h=t,t.clickToRemove&&(s.css("cursor","pointer"),s.click(function(){c()})),t.addFunc&&!t.redo&&t.addFunc(s),t.duration&&(t.removeTimer=_.delay(function(e){delete e.removeTimer,s.fadeOut(function(){c()})},t.duration,t)),delete t.redo}return t}function c(e){if(e=e||h)if(e.guide&&e===h)e.removeTimer&&(clearTimeout(e.removeTimer),delete e.removeTimer),e.guide.remove(),e.removeFunc&&e.removeFunc(),h=null,e.nextGuide&&f(e.nextGuide);else{for(var t=h;t&&t.nextGuide!==e;)t=t.nextGuide;t&&(t.nextGuide=e.nextGuide),e.removeFunc&&e.removeFunc()}}function u(e){for(var t=h;t&&e&&!e(t);)t=t.nextGuide;return t}var h;return{showGenericDialog:d,showUnsupportedFeatureDialog:r,showUnsupportedFileFormatDialog:n,showSignInToUploadDocDialog:o,showUploadDocErrorDialog:a,showDownloadPDFErrorDialog:s,showGuide:f,hideGuide:c,findGuide:u}}),define("fss/js/lib/formstyler",[],function(){return{defaultValues:{statictext:{styles:{"font-size":"22px","font-weight":400,color:"#BA5D1D"},initialStyles:{"font-size":"22px","font-weight":400,color:"#BA5D1D"}},textfield:{styles:{"font-size":"12pt","line-height":"normal","font-family":"helvetica",height:"auto"},initialStyles:{"font-size":"12pt","line-height":"normal","font-family":"helvetica",height:"auto"}},combfield:{styles:{"font-size":"12pt","line-height":"normal","font-family":"courier",height:"auto","letter-spacing":"0px"},initialStyles:{"font-size":"12pt","line-height":"normal","font-family":"courier",height:"auto","letter-spacing":"0px"}},tool:{x:{size:{width:12,height:12},cursorOffset:{left:1,top:1}},check:{size:{width:12,height:12},cursorOffset:{left:1,top:1}},circle:{size:{width:20,height:20},cursorOffset:{left:1,top:1}},roundrect:{size:{width:50,height:25},maxLineWidth:3},dot:{size:{width:20,height:20}},line:{size:{width:20,height:6},cursorOffset:{left:-12,top:1},maxLineWidth:3,maxSize:{height:6},alignContentLeft:!0},text:{size:{width:1,height:1}},empty:{},signature:{input:{size:{height:50},ratio:1,fontSize:"16px"},scribble:{size:{height:50}},image:{size:{height:50}}},initials:{input:{size:{height:50},ratio:1,fontSize:"22px"},scribble:{size:{height:50}},image:{size:{height:50}}}},initialTool:{x:{size:{width:12,height:12},cursorOffset:{left:1,top:1}},check:{size:{width:12,height:12},cursorOffset:{left:1,top:1}},circle:{size:{width:20,height:20},cursorOffset:{left:1,top:1}},roundrect:{size:{width:50,height:25},maxLineWidth:3},dot:{size:{width:20,height:20}},line:{size:{width:20,height:6},cursorOffset:{left:-12,top:1},maxLineWidth:3,maxSize:{height:6},alignContentLeft:!0},text:{size:{width:1,height:1}},signature:{input:{size:{height:50},ratio:1,fontSize:"16px"},scribble:{size:{height:50}},image:{size:{height:50}}},initials:{input:{size:{height:50},ratio:1,fontSize:"22px"},scribble:{size:{height:50}},image:{size:{height:50}}}}},fontClasses:{arial:"Arial,Helvetica,sans-serif",arialblack:'"Arial Black",Gadget,sans-serif',georgia:"georgia",couriernew:'"Courier New",Courier,monospace',comicsans:'"Comic Sans MS",cursive'},resetToInitialStyles:function(){for(var e=this,t=["statictext","textfield","combfield"],i=0;i<t.length;i++){var n=e.defaultValues[t[i]];$.extend(!0,n.styles,n.initialStyles)}$.extend(!0,e.defaultValues.tool,e.defaultValues.initialTool)},expandStyle:function(e){var t={};if("string"==typeof e){var i=e.split(";");$.each(i,function(e,i){var n=i.split(":");2===n.length&&(t[n[0]]=n[1])})}else t=e;return t},setDefaults:function(e,t){this.defaultValues[e]&&this.defaultValues[e].styles||(this.defaultValues[e]={styles:{}}),$.extend(this.defaultValues[e].styles,t)}}}),define("fss/js/data/fafconstants",[],function(){return{APP_SAVE_DATA:"Faf.saveData",APP_WILL_SWITCH_VIEW:"Faf.appWillSwitchView",LOAD_MY_FORMS:"Faf.loadMyForm",FORM_CLOSED:"Faf.formClosed",FORM_FIELD_ADDED:"Faf.formFieldAdded",MOVE_RESIZE_FIELD:"FormMoveResizeField",WIDTH_AUTOCHANGE:"Faf.FieldWidthChange",FORM_FIELD_KEY:"Faf.formfieldController",FORM_FIELD_CHANGED:"Faf.formChangeField",FORM_FIELD_CHANGE_ID:"Faf.formChangeIdOfField",FORM_FIELD_CHANGE_STYLE:"Faf.formChangeStyle",FORM_ELEMENT_KEY:"Faf.formElement",FORM_FIELD_DIV_KEY:"Faf.formfieldDiv",FAF_INPUT_DATA_KEY:"textfield",FAF_INPUT_UNCHANGED_KEY:"Faf.unchangedVal",FAF_FIELD_LAST_LEGAL_VALUE:"Faf.lastLegalValue",FORM_CONTENT_TYPE:"application/vnd.adobe.form.fillsign",FIELD_VALUE_SET_FROM_USER:"Faf.fieldValueSetFromFormsCollection",MAX_NUM_OF_FIELDS:200,USER_VALUE_CHANGED_LOCALLY:"Faf.UserValueChangedLocally",NEW_SIGNATURE_ADDED:"Faf.NewSignatureAdded",MAX_NUMBER_OF_CACHED_RENDITIONS:50,MAX_LEN_AUTOCOMPLETE_STRINGS:100,MAX_FILE_SIZE_SIGNATURE:20971520,TEXT_EXTRA_SPACE:"Faf.extraSpaceAtEnd"}}),define("fss/js/lib/faf-ajax-util",["core/ac-core","core/utils/http-util","fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/lib/utilUI","fss/js/lib/faf-log-util","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o,a){function r(e,t,i,n,s){this.status=e,this.code=t,this.message=i,this.details=n,this.logRef=s,this.responseText=null}var l={400:"BadRequest",401:"Unauthorized",404:"ObjectNotFound"};return r.prototype.toJSONString=function(){var e={status:this.status,code:this.code,message:this.message,details:this.details,logRef:this.logRef};return null!==this.responseText&&(e.responseText=this.responseText),JSON.stringify(e)},{getBaseHeaders:function(e,i){var n=_.extend({isAicRequest:!0,excludeRequestID:!1,excludeContentType:!1},i);e=e||"GET";var s=t.getRequestHeaders(e.toUpperCase(),{},n.isAicRequest);return n.excludeRequestID&&delete s["x-request-id"],n.excludeContentType&&delete s["Content-Type"],s},getAjaxOptions:function(e,t,i){"string"!=typeof t&&(i=t,t=e,e=void 0);var s=this.getBaseHeaders(e);return $.extend({global:!1,modal:!1,url:n.getBaseFSSUrl()+"/api"+t,xhrFields:{withCredentials:!0},headers:s,dataType:"json"},e?{type:e}:{},i||{})},addDexiAjaxOptions:function(e,t){var i="application/vnd.adobe.dex+json";return t.version&&(i+=";version="+t.version),t.useCharset&&(i+=";charset=utf-8"),t.setContentType&&_.extend(e.headers,{"Content-Type":i}),t.setAccepts&&_.extend(e.headers,{Accept:i}),e},handleDexiErrorResponse:function(e){return function(t,s,o){var a,d,f,c;if(n.isDesktop()){var u=0===t.status||503===t.status||t.status>=400&&t.status<500&&404!==t.status;if(u){var h=i._fafSigninStateModel;h.setOffline(h.reason.ERROR)}}var p=null;try{p=t.responseJSON||JSON.parse(t.responseText)}catch(g){}!p&&t.responseText?a="ParserError":p&&p.error?(a=p.error.code||"Unknown",d=p.error.message,f=p.error.details,c=p.error.logRef):"timeout"===s?a="Timeout":(a=l[t.status]||"Unknown",d=o);var _=new r(t.status,a,d,f,c);"ParserError"===a&&(_.responseText=t.responseText.length<=250?t.responseText:t.responseText.substring(1,250)+"..."),e(t,_)}},defaultErrorHandler:function(e,t,r){if(!e||0!==e.status){var l=null;if(e&&401===e.status)s.showGenericDialog({text:a.DefaultError401Text,okFunc:function(){i.appApi.sessionApi.signedOut()}});else if(e&&412===e.status)l={text:a.ConflictDetected,okText:a.OverwriteText,showOK:!0,cancelText:a.DiscardText,showCancel:!0,dlgOptions:{okButtonClass:"faf-error-ok",cancelButtonClass:"faf-error-cancel"}},t&&(l.okFunc=t),r&&(l.cancelFunc=r),s.showGenericDialog(l);else{var d=n.hostEnvironment(),f=a.NullString;e&&"stage"!==d&&"unknown"!==d&&"reader"!==d&&(f=_.template(a.DefaultErrorDialogAdditionalText,{additionalText:e.toJSONString()}));var c=a.NullString;e&&e.logRef&&(c=_.template(a.DefaultErrorDialogLogRefText,{logRef:e.logRef})),l={},"reader"!==d?l.text=_.template(a.DefaultErrorDialogText,{additionalText:f,additionalRef:c}):(l.text=a.Unknown+c,e&&o.logError("FafAjaxUtil",e.toJSONString())),t&&(l.okFunc=t),n.desktopNativeSignCommand()||s.showGenericDialog(l)}}}}}),define("fss/js/lib/formcanvas",["fss/js/lib/faf-env-util","fss/js/lib/faf-log-util","fss/js/lib/formstyler","fss/js/ac-faf"],function(e,t,i,n){function s(e){require(["fss/js/lib/util"],function(t){t.logError("formcanvas",e)})}function o(e){return e?0===e.indexOf("http://")||0===e.indexOf("https://")?e:(0!==e.lastIndexOf(u,0)&&(e=h+e),e):""}function a(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}function r(e,t){var i=window.devicePixelRatio||1,n=a(t),s=i/n;if(i!==n){var o=$(e).outerWidth(),r=$(e).outerHeight();e.width=o*s,e.height=r*s,e.style.width=o+"px",e.style.height=r+"px",t.scale(s,s)}}function l(t,i){if(i.imageData){var n=t[0],s=n.getContext("2d");if(i.ignoreDevicePixelRatio||r(n,s),e.supportsCanvas()){var a=new Image,l=i.imageSize.width,f=i.imageSize.height;$(a).attr("width",l),$(a).attr("height",f),$(a).width(l),$(a).height(f),a.src=o(i.imageData);var c=i.canvasSize.width/l,u=i.canvasSize.height/f,h=Math.min(c,u),p=0,g=0;(void 0===i.centerImage||i.centerImage)&&(g=(i.canvasSize.width-h*l)/2,p=(i.canvasSize.height-h*f)/2),a.onload=function(){d(n,a,{scale:h,left:g,top:p}),t.data("loaded","true")}}}}function d(e,t,i){var n=e.getContext("2d"),s=i.scale,o=Math.ceil(Math.log(1/s)/Math.log(2)),r=document.createElement("canvas"),l=r.getContext("2d");r.width=t.width/2,r.height=t.height/2,l.drawImage(t,0,0,r.width,r.height);var d=e.width,f=e.height;t.width>=t.height?(d=e.width,f=d*t.height/t.width,f>e.height&&(d=d*e.height/f,f=e.height)):(f=e.height,d=e.height*t.width/t.height,d>e.width&&(f=f*e.width/d,d=e.width));var c=Math.abs(e.width-d)/2,u=Math.abs(e.height-f)/2,h=window.devicePixelRatio||1;if(o>1&&h===a(n)){for(var p=document.createElement("canvas"),g=p.getContext("2d"),_=r,m=0;o-2>m;m++)m%2===0?(p.width=r.width/2,p.height=r.height/2,g.drawImage(r,0,0,p.width,p.height),l.clearRect(0,0,r.width,r.height),_=p):(r.width=p.width/2,r.height=p.height/2,l.drawImage(p,0,0,r.width,r.height),g.clearRect(0,0,p.width,p.height),_=r);n.drawImage(_,0,0,_.width,_.height,c,u,d,f)}else n.scale(s,s),n.drawImage(t,i.left/s,i.top/s,t.width,t.height)}function f(t,o){if(e.supportsCanvas()){if(!o.imageType)return void s("No options.imageType");var a=o.canvasSize.width,l=o.canvasSize.height,d=(a+l)/20,f=o.pageScale||1;d/=f,d=Math.max(1,d);var c=i.defaultValues.tool[o.imageType];c.maxLineWidth&&(d=Math.min(c.maxLineWidth,d)),d=Math.max(1,d*f);var u=t[0],h=u.getContext("2d"),p=!0,g=a/2,_=l/2;switch(r(u,h),o.imageType){case"circle":h.save(),h.translate(g,_),h.scale(1,u.height/u.width),h.beginPath(),h.arc(0,0,.8*g,0,2*Math.PI,!1),h.restore();break;case"x":h.beginPath(),h.moveTo(d,d),h.lineTo(a-d,l-d),h.moveTo(a-d,d),h.lineTo(d,l-d);break;case"check":h.beginPath(),h.moveTo(d,l/2),h.lineTo(a/3,l-d),h.lineTo(a-d,d);break;case"line":h.beginPath(),h.moveTo(d,l/2),h.lineTo(a-d,l/2);break;case"dot":h.translate(g,_),h.arc(0,0,.6*g,0,2*Math.PI,!1),p=!1;break;case"roundrect":var m=Math.min(_,g);h.moveTo(d,m),h.bezierCurveTo(d,d,d,d,m,d),h.lineTo(a-m,d),h.bezierCurveTo(a-d,d,a-d,d,a-d,m),h.lineTo(a-d,l-m),h.bezierCurveTo(a-d,l-d,a-d,l-d,a-m,l-d),h.lineTo(m,l-d),h.bezierCurveTo(d,l-d,d,l-d,d,l-m),h.lineTo(d,m);break;case"empty":h.clearRect(0,0,a,l)}var v="#000000";n._fafAppLimitsModel.initialized().then(function(){var e=n._fafAppLimitsModel.getFRFeatureLevel();e&&e>0&&o.selected&&(v="#2175C8")}),h.lineWidth=d,h.lineCap="round",p?(h.strokeStyle=v,h.stroke()):(h.fillStyle=v,h.fill()),o.toolDoneCB&&o.toolDoneCB(t)}}function c(e,t,i,n){return"number"!=typeof e?!1:"number"==typeof t&&e-t>=50||"number"==typeof i&&e-i>=70?!0:"number"==typeof n&&e>=70&&20>n?!0:"number"==typeof t&&"number"==typeof n&&e-n>t+45?!0:!1}var u="data:",h="data:image/png;base64,";return{isSignatureType:function(e){return"signature"===e||"initials"===e?e:null},normalizeImageSrc:function(e){return o(e)},$baseCanvas:function(t,i){var n;return n=$(e.supportsCanvas()?"<canvas></canvas>":"<div></div>"),n.addClass("formCanvas"),n.css("width",t),n.css("height",i),n.attr("width",t),n.attr("height",i),n.prop("width",t),n.prop("height",i),n.css("background-color","transparent"),n},createCanvas:function(e){if(!e.imageType)return s("No imageType for canvas."),void(e.callback&&e.callback(null));var t=this,i=e.canvasSize.width,n=e.canvasSize.height,o=t.$baseCanvas(i,n);return e.callback&&e.callback(o),t.isSignatureType(e.imageType)?l(o,e):f(o,e),o},trimCanvas:function(e,t,i){i=!!i,t="number"==typeof t?{left:t,right:t,top:t,bottom:t}:t||{};var n=e[0],s=n.getContext("2d");if(!n.width||!n.height)return{left:0,top:0,width:0,height:0};for(var o=s.getImageData(0,0,n.width,n.height),a=o.data,r=!1,l=i?0:n.height,d=i?n.height:-1,f=n.width,c=-1,u=3,h=0;h<n.height;h++)for(var p=0;p<n.width;p++,u+=4)a[u]>0&&(r=!0,l>h&&(l=h),h>d&&(d=h),f>p&&(f=p),p>c&&(c=p));return r||(l=0,d=0,f=0,c=0),"left"in t&&(f-=t.left),"right"in t&&(c+=t.right),"top"in t&&(l-=t.top),"bottom"in t&&(d+=t.bottom),{left:f,top:l,width:c-f,height:d-l}},normalizedImageDataFromArea:function(e,t,i){var n;i.height=Math.ceil(i.height),i.width=Math.ceil(i.width);var s=e[0],o=$("<canvas></canvas>");o.css("position","absolute"),o.css("top","-9999px"),o.css("left","-9999px"),o.css("width",i.width+"px"),o.css("height",i.height+"px"),o[0].width=i.width,o[0].height=i.height,e.before(o);var a=o[0].getContext("2d");a.drawImage(s,-t.x,-t.y,s.width,s.height);var r=i.height,l=i.width;if(0>r||0>l)return[];var d=a.getImageData(0,0,l,r);o.remove();var f,c,u=d.data,h=0;for(n=new Array(r),f=0;r>f;f++)for(n[f]=new Array(l),c=0;l>c;c++){var p=u[h++],g=u[h++],_=u[h++],m=u[h++];n[f][c]=(765-(p+g+_))*(m/255)/3}var v=0,S=255;for(f=0;r>f;f++)for(c=0;l>c;c++){var E=n[f][c];E>v&&(v=E),S>E&&(S=E)}var b=v-S;for(f=0;r>f;f++)for(c=0;l>c;c++){var w=n[f][c];n[f][c]=(w-S)/b*255}return n},findHorizStripe:function(e,t){for(var i,n,s=Boolean(t&&t.up),o=s?e.length-1:0;;){var a,r=0,l=e[o];for(a=l.length-1;a>=0;a--)r+=e[o][a];r=Math.round(10*r/l.length)/10;var d=0;for(a=l.length-1;a>=0;a--)d+=Math.abs(e[o][a]-r);if(d=Math.round(10*d/l.length)/10,c(r,i,n,d))return o;if(n=i,i=r,s){if(o-=1,0>o)break}else if(o+=1,o>=e.length)break}return-1},addImageAfterScaling:function(e,t,i){var n=new Image,a=$.Deferred();return i||(i={}),n.onload=function(){for(var e=t[0],s=e.getContext("2d"),o=i.maxDim||{width:2500,height:2500},r=i.rescaleCanvas?Math.min(n.height,o.height):e.height,l=r*n.width/n.height,d=i.rescaleCanvas?Math.min(n.width,o.width):e.width;l>d&&r>0;)r--,l=r*n.width/n.height;s.clearRect(0,0,t.width(),t.height());var f=n.width,c=n.height,u=1;if(f>l&&(u=l/f,f=l,c*=u),c>r&&(u=r/c,c=r,f*=u),i.rescaleCanvas){var h=i.scaleToMax?l:f,p=i.scaleToMax?r:c;e.width=h,e.height=p,t.width(h),t.height(p)}var g=i.center?Math.abs((l-f)/2):0,_=i.center?Math.abs((r-c)/2):0;s.drawImage(n,g,_,f,c),a.resolve(e)},n.onerror=function(){s("Unable to load image"),a.reject()},n.src=o(e),a.promise()},findVertStripe:function(e,t){for(var i,n,s=Boolean(t&&t.left),o=e[0].length,a=s?o-1:0;;){var r,l=0;for(r=e.length-1;r>=0;r--)l+=e[r][a];l=Math.round(10*l/e.length)/10;var d=0;for(r=e.length-1;r>=0;r--)d+=Math.abs(e[r][a]-l);if(d=Math.round(10*d/e.length)/10,c(l,i,n,d))return a;if(n=i,i=l,s){if(a-=1,0>a)break}else if(r+=1,a>=o)break}return-1}}}),define("fss/js/lib/util",["core/ac-core","core/utils/http-util","fss/js/ac-faf","fss/js/lib/faf-polyfill","fss/js/lib/faf-env-util","fss/js/lib/faf-log-util","fss/js/lib/utilUI","fss/js/lib/formstyler","fss/js/data/fafconstants","i18n!fss/js/nls/ui-strings","core/utils/util","fss/js/lib/faf-ajax-util","fss/js/lib/faf-common-util","fss/js/lib/formcanvas"],function(e,t,i,n,s,o,a,r,l,d,f,c,u,h){function p(e){var t=D(e);if(!T(e)||t){var i=t?e:e.changedTouches[0];if("touchstart"===e.type||"pointerdown"===e.type?$(i.target).data("touching",!0):("touchend"===e.type||"touchcancel"===e.type||"pointerup"===e.type||"pointercancel"===e.type)&&$(i.target).data("touching",!1),!t){var n=document.createEvent("MouseEvent");if(n.initMouseEvent({touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",touchcancel:"mouseup"}[e.type],!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),"touchstart"===e.type){w={touch:i,timestamp:(new Date).getTime()};var s=document.createEvent("MouseEvent");s.initMouseEvent("mouseover",!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),s.lastTouchStart=w,i.target.dispatchEvent(s)}if(n.lastTouchStart=w,i.target.dispatchEvent(n),"touchend"===e.type&&w&&S(i,w)){var o=document.createEvent("MouseEvent");o.initMouseEvent("tap",!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),i.target.dispatchEvent(o)}e.preventDefault(),e.stopPropagation()}}}function g(){return navigator.platform.indexOf("in32")>0?"win":navigator.platform.indexOf("Mac")>=0?"mac":"other"}function m(e){for(var t=e.length,i=0,n=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],s=0;t--;)s+=n[i][parseInt(e.charAt(t),10)],i^=1;return s%10===0&&s>0}function v(e,t,i){return o.logMsg(e,t,i)}function S(e,t){if(e.originalEvent instanceof MouseEvent&&!t&&(e=e.originalEvent,t=e.lastTouchStart),!e||!t)return!1;var i=(new Date).getTime()-t.timestamp,n=Math.abs(t.touch.screenX-e.screenX)+Math.abs(t.touch.screenY-e.screenY);return 300>i&&10>n}function E(e){var t=0;return e.forEach(function(e){t+=e.length+1}),t-1}var b=$.Deferred().resolve().promise(),w=null,F="undefined"!=typeof PointerEvent,T=function(e){return e=e.originalEvent||e,F&&e instanceof PointerEvent},D=function(e){return e=e.originalEvent||e,"touch"===e.pointerType};return{adjustURLForPluginDomain:function(e,t){var i;if(e.indexOf("/")<0)i="/"+t+"/"+e;else{var n=document.createElement("a");n.href=e,i=n.pathname,0!==i.indexOf("/")&&(i="/"+i)}return this.pluginBaseURL()+i},createThumbnailUrl:function(e){var t=u.getRenditionUrl();return t+=e,t+="/thumbnail",u.addClientId(t)},createDownloadUrl:function(e,t){var n=i.appApi.baseFilesUrisApi.getDownloadUri()+"unmanaged/";return n+=e,n+="?dlticket="+t,u.addClientId(n)},createUploadUrl:function(){return i.appApi.baseFilesUrisApi.getUploadUri()+"unmanaged"},createDownloadTicketUrl:function(e){var t=i.appApi.baseFilesUrisApi.getApiUri()+"session/download_ticket";return t+="?id="+e},getDownloadTicket:function(e){var t=$.Deferred(),i={type:"GET",dataType:"json",modal:!1,url:this.createDownloadTicketUrl(e),headers:c.getBaseHeaders("GET",{excludeRequestID:!0,isAicRequest:!1}),success:function(e){t.resolve(e.download_ticket)},error:c.handleDexiErrorResponse(function(e,i){t.reject(e,i)})};return $.ajax(i),t.promise()},browserAndVersion:function(e){return s.browserAndVersion(e)},supportsPlaceholder:function(){return s.supportsPlaceholder()},supportsFileUpload:function(){return s.supportsFileUpload()},supportsCanvas:function(){return s.supportsCanvas()},supportsWebFonts:function(){return s.supportsWebFonts()},supportsTouch:function(){return s.supportsTouch()},isIE8:function(){return s.isIE8()},isIE10:function(){return s.isIE10()},isSafari:function(){return s.isSafari()},isSafari5orBelow:function(){return s.isSafari5orBelow()},extend:function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]},logError:function(e,t){var i=v(o.LOG_ERROR,e,t),n="ConsoleError";this.logEvent(null,n,n,{errorMessage:i},null,!0)},logWarn:function(e,t){var i=v(o.LOG_WARN,e,t),n="ConsoleWarn";this.logEvent(null,n,n,{errorMessage:i},null,!0)},logInfo:function(e,t){v(o.LOG_INFO,e,t)},logDebug:function(e,t){v(o.LOG_DEBUG,e,t)},showProgress:function(e){i.appApi.displayApi.showSpinner(!0);var t=i.appApi.displayApi.showFullOverlay(!0);t.html("<div class='faf-overlay'><div class='faf-overlay-title'>"+e+"</div></div>")},hideProgress:function(){i.appApi.displayApi.showSpinner(!1),i.appApi.displayApi.showFullOverlay(!1)},eventNumber:0,logEvent:function(e,t,n,s,o,a){function r(e){o&&o(e)}var l=i.appApi.rnaApiObj.rnaFssAPI.isFSSModernViewSupported(),d=l?"Tools:FSS:":"Tools:LegacyFSS:",f="Tools:FSST:",h=100,p=2,g=d;if(i._formManager&&i._formManager.form&&i._formManager.form.isSampleForm()&&(g=f),null!==e&&(e=g+e),null!==t&&(t=g+t),null!==n&&(n=g+n),!i.appApi.usersMeApi.isUserInCohort("fs-3rd-party-testers","testers")){var _=i.appApi.siteCatalystApi,m={category:e,action:t,label:n};for(var v in m)if(m.hasOwnProperty(v)){var S=m[v];if(S&&S.length>h){for(var b=S,w=S.split(":");w.length>p&&E(w)>h;)w.splice(p,1);S=w.join(":"),m[v]=S;var F="SiteCatalyst Message Too Long: value for '"+v+"' ("+b.length+" > "+h+"): '"+b+"' -- truncated to '"+S+"'";this.logToSplunk(F,"error")}}var T={},D=-1!==n.indexOf("Unknown[");D||(m.action&&(T.featureType=m.action),m.category&&(T.sectionName=m.category)),_.logScEvent([m.label],T)}var y={category:e,action:t,label:n};$.extend(y,s),i._formManager&&i._formManager.formID&&(y.documentID=i._formManager.formID);var A=this;a=a||u.isDesktop();var C=JSON.stringify(y);if(C)$.ajax(c.getAjaxOptions("POST","/event",{data:C,error:a?function(){}:c.handleDexiErrorResponse(function(e,t){c.defaultErrorHandler(t)})})).done(function(e){r(e)}).fail(function(){a||A.logError("util","logEvent error in $.post :"+y.category+":"+y.label),r({})});else{var P=["category","action","label"],R=[];P.forEach(function(e){e in y&&R.push(e+"="+y[e])});for(var I in y)-1===$.inArray(I,P)&&R.push(I+"="+y[I]);var O=R.join(":");$.ajax(c.getAjaxOptions("POST","/log",{data:JSON.stringify({message:O}),error:function(){}}))}return this.eventNumber++,this.eventNumber},logToSplunk:function(e,t){var i={message:e,level:t},n=c.getAjaxOptions("POST","/log",{data:JSON.stringify(i),error:c.handleDexiErrorResponse(function(e,t){c.defaultErrorHandler(t)})});$.ajax(n)},logErrorAndToSplunk:function(e,t){var i=v(o.LOG_ERROR,e,t);this.logToSplunk(i)},getQueryParams:function(e){e=e.split("+").join(" ");for(var t,i={},n=/[?&]?([^=]+)=([^&]*)/g;null!==(t=n.exec(e));)i[decodeURIComponent(t[1])]=decodeURIComponent(t[2]);return i},pluginBaseURL:function(){return i.appApi.pluginsApi.getBaseUrl(i.PLUGIN_ID)},loadImage:function(e,t){function i(){return s++,s>o?void n.reject(e):void(e.height()>0&&e.width()>0?n.resolve(e):setTimeout(i,333.33))}var n=$.Deferred();t=$.extend({timeoutSecs:10},t);var s=0,o=3*t.timeoutSecs;return i(),n.promise()},getRandomString:function(e){"undefined"==typeof e&&(e=24),0>=e&&(e=24),e>255&&(e=255);for(var t="",i=0;e>i;i++){var n=Math.floor(26*Math.random());t+=String.fromCharCode(n+97)}return t},handleTouchEventAsMouseEvent:function(e){this.supportsTouch()&&$(e).each(function(){this.addEventListener("touchstart",p,!0),this.addEventListener("touchmove",p,!0),this.addEventListener("touchend",p,!0),this.addEventListener("touchcancel",p,!0),this.addEventListener("pointerdown",p,!0),this.addEventListener("pointerup",p,!0),this.addEventListener("pointercancel",p,!0)})},posAplusB:function(e,t){return{left:e.left+t.left,top:e.top+t.top}},posAminusB:function(e,t){return{left:e.left-t.left,top:e.top-t.top}},offsetFromEvent:function(e,t,i){if(t instanceof $&&(i=t,t={}),t=$.extend({left:0,top:0},t),e.hasOwnProperty("offsetX")&&"undefined"!=typeof e.offsetX){var n=this.posAplusB({left:e.offsetX,top:e.offsetY},t);return i&&i[0]!==e.target&&(n=this.posAplusB(n,this.posAminusB($(e.target).offset(),i.offset()))),n}var s=i.offset();return this.posAminusB(this.posAplusB({left:e.clientX+$(window).scrollLeft(),top:e.clientY+$(window).scrollTop()},t),s)},roundThous:function(e){return"string"==typeof e&&(e=parseFloat(e,10)),Math.round(1e3*e)/1e3},cssNumTotal:function(e,t){var i=0;if("string"==typeof t)i=parseFloat(e.css(t),10)||0;else for(var n=0;n<t.length;n++)i+=this.cssNumTotal(e,t[n])||0;return i},cssWidth:function(e){return this.cssNumTotal(e,"width")},moveElementLeftBy:function(e,t){var i=this.cssNumTotal(e,"left");i&&e.css("left",i+t+"px")},comfortWidths:{},comfortWidth:function(e){var t=e.css("font-size");return this.comfortWidths[t]||(this.comfortWidths[t]=this.charWidthEx(e,"W","WWWWWWWWW")),this.comfortWidths[t]},charWidth:function(e){var t=e.val()||e.text()||this.placeholderText(e)||"0",i=t[0],n="xxxxxxxx".replace(/x/g,i);return this.charWidthEx(e,i,n)},charWidthEx:function(e,t,i){var n=e.clone();n.val(t);var s=this.sizeOfTextArea(n);n.val(i);var o=this.sizeOfTextArea(n);return(o.width-s.width)/(i.length-1)},legalFontFamily:function(e,t){var i=["helvetica","courier"];return i.indexOf(e)>-1?e:t?"helvetica":"courier"},fontlegalSizes:function(){return[6,7,8,9,10,11,12,13,14,16,18,20,22,24,26,28,32,36,40,44,48,56,64,72,80,88,96,112,128,144,160,176,192]},baselineAdjust:function(e,t){i._supports.baselines||(i._supports.baselines={}),i._supports.baselines.adjustments||(i._supports.baselines.adjustments={mac:{Chrome:{helvetica:{6:-1,7:0,8:0,9:-1,10:-2,11:0,12:-1,13:-1,14:-1,16:0,18:-1,20:-1,22:-1.5,24:-1,26:-1,28:-2,32:-2,36:-1.5,40:-2,44:-2.5,48:-2,56:-2,64:-3,72:-3,80:-3.5,88:-3.5,96:-3.5,112:-4.5,128:-6,144:-7}},Firefox:{helvetica:{6:-2,7:-2,8:1,9:1,10:0,11:1,12:1,13:2,14:1,16:1.5,18:3,20:2.5,22:3,24:4,26:4,28:4,32:0,36:4,40:5,44:6,48:6.5,56:7.5,64:7,72:7.5,80:9.5,88:9,96:9.5,112:10,128:12.5,144:12}}},win:{MSIE:{helvetica:{6:0,7:0,8:0,9:-1,10:-.5,11:.5,12:-1,13:0,14:-1,16:0,18:0,20:-.5,22:-.5,24:0,26:-.5,28:-1,32:0,36:-1,40:-1,44:-2,48:-1.5,56:-1,64:-1,72:-2,80:-1.5,88:-2,96:-2.5,112:-3,128:-4,144:-4.5}},Chrome:{helvetica:{6:0,7:0,8:-1,9:-1.5,10:-2,11:-1,12:-1.5,13:-1.5,14:-1,16:-1,18:-1.5,20:-2,22:-1.5,24:0,26:-2,28:-2,32:-1,36:-1.5,40:-1,44:-1.5,48:-4,56:-4,64:-3,72:-3,80:-2.5,88:-2.5,96:-3,112:-3.5,128:-5,144:-5}},Firefox:{helvetica:{6:-1,7:-2,8:-1,9:-2,10:-2,11:-.5,12:-1,13:-1,14:-2,16:-2,18:-2,20:-2,22:-2,24:-1,26:-2,28:-2,32:-1.5,36:-2.5,40:-3,44:-3,48:-3,56:-3,64:-3,72:-4.5,80:-4,88:-4,96:-5,112:-6,128:-6.5,144:-8}}}});var n=i._supports.baselines.adjustments;return(n=n[g()])&&(n=n[this.browserAndVersion()[0]])&&(n=n[t])&&n[e]},fontBaselines:function(){if(i._supports.baselines||(i._supports.baselines={}),!i._supports.baselines.heights){var e={mac:{Chrome:{large:.9,8:7,9:8,10:10.5,11:11,12:11.3,13:12.3,14:13.5,16:14.5,18:17.5,20:18.5,22:20,24:22.2,26:24.4,28:26.4,32:30.5,36:33.5},Firefox:{large:.8,8:12.5,9:12.5,10:12.5,11:12.5,12:12.5,13:12.5,14:12.5,16:14.5,18:15.5,20:17.5,22:18.5,24:20,26:22,28:23.5,32:26,36:29.5},Safari:{large:.9,8:7,9:8,10:10,11:10,12:11.3,13:12.3,14:13.5,16:14.5,18:17.5,20:18.5,22:20,24:21.5,26:23.5,28:25.5,32:29.5,36:32.5}},win:{Chrome:{large:.9,8:7,9:8,10:10.5,11:11,12:11.3,13:12.3,14:13.5,16:14.5,18:16.5,20:18.5,22:20.5,24:22,26:22.7,28:25.5,32:29.5,36:31.5},Firefox:{large:.9,8:10,9:9,10:9.5,11:10.5,12:11.5,13:12.5,14:12.5,16:14.5,18:16.5,20:18.5,22:19.5,24:21,26:24.5,28:25.5,32:29,36:32.5},MSIE:{large:.9,8:9,9:8,10:9,11:10,12:11,13:12,14:12.5,16:14.5,18:16.5,20:18.5,22:20,24:21.5,26:23.5,28:25.5,32:28.5,36:32.5}},dflt:{large:.75,8:7,9:8,10:10.5,11:11,12:11.3,13:12.3,14:13.5,16:14.5,18:17.5,20:19,22:20.6,24:22.2,26:24.4,28:26.4,32:30.5,36:33.5}},t=e[g()];t&&(i._supports.baselines.heights=t[this.browserAndVersion()[0]]),i._supports.baselines.heights||(i._supports.baselines.heights=e.dflt)}return i._supports.baselines.heights},baselineOfFontSize:function(e,t){var i=this.fontBaselines()[e];return i||t&&t.testing||((6>e||e>200)&&this.logError("util","Baseline asked for illegal font size of "+e),e>30?i=this.fontBaselines().large*e:8>e&&(i=this.fontBaselines()[8])),i},getBaselineForFont:function(e,t){var i="Aeyfjg",n=t?t.css("font-family"):"helvetica",s=t?t.height():0,o={width:"800px",height:"200px",position:"absolute",left:"200px",top:"300px",border:"1px solid black","z-index":"-9999"},a=$("<canvas></canvas>");a.attr("width",800),a.attr("height",200),a.css(o),$("#testSubjects").append(a);var r=a[0].getContext("2d");r.font=e+"px "+n,r.textBaseline="alphabetic",r.fillText(i,0,100);var l=h.trimCanvas(a,0);r.clearRect(0,0,800,200);var d=200-l.top;return{baseline:d,height:l.height,elHt:s}},pixelToPtRatio:function(){return 1},fontSizeOfElement:function(e){if(e.length>0){var t=e[0],i=t.style.fontSize,n=this.fontSizeInPx(i);return Math.round(n)}return this.logError("util","fontSizeOfElement couldn't get font size of "+e),16},fontSizeInPx:function(e){var t=parseFloat(e);return t?(e.indexOf("pt")>0&&(t*=this.pixelToPtRatio()),this.roundThous(t)):(this.logError("util","fontSizeInPx passed null"),16)},fontSizeInPt:function(e){var t=parseFloat(e);return t?(e.indexOf("px")>0&&(t/=this.pixelToPtRatio()),this.roundThous(t)):(this.logError("util","fontSizeInPt passed null"),12)},nearestLegalFontSize:function(e,t){var i=this.fontSizeInPx(e);if(t&&(i+=t),this.baselineOfFontSize(i,{testing:1}))return i;for(var n=this.fontlegalSizes(),s=-1,o=0,a=n.length;a>o;o++){var r=n[o];if(!(i>r))return 0>s?r:t>0?r:0>t?s:(s+r)/2>i?s:r;s=r}return n[n.length-1]},placeholderText:function(e){return e.attr("placeholder")||e.prevAll(".faf-placeholder").text()},realFontSize:function(e){var t=e[0].style.cssText.split(";"),i=0;return _.each(t,_.bind(function(e){(e.indexOf("fontSize")>=0||e.indexOf("font-size")>=0)&&(i=this.fontSizeInPx(e.split(":")[1]))},this)),i||(i=e.css("font-size")),i},sizeOfTextArea:function(e,t){var i={width:e.data("lastMeasuredWidth"),height:e.data("lastMeasuredHeight"),didChange:!1};if(t=$.extend({maxWidth:1e4,minWidth:0,comfortZone:0},t),!t.force&&e.hasClass("fixedSize"))return i;var n=e.val()||this.placeholderText(e);if(!t.force&&e.data("lastMeasuredValue")===n)return i;e.data("lastMeasuredValue",n),this.$widthDiv||(this.$widthDiv=$('<div class="width-tester"/>').css({position:"absolute",top:-9999,left:-9999,width:"auto"}),$("#testSubjects").append(this.$widthDiv)),this.$widthDiv.css({fontSize:t.forceFontSize||this.realFontSize(e),fontFamily:e.css("fontFamily"),fontWeight:e.css("fontWeight"),"padding-left":e.css("padding-left"),"padding-right":e.css("padding-right"),"padding-top":e.css("padding-top"),"padding-bottom":e.css("padding-bottom")});
var s=t.comfortZone,o=-1,a=n.split(/\r\n|\r|\n/),r=n.length;$.each(a,_.bind(function(e,i){var n=i.replace(/&/g,"&amp;").replace(/\s/g,"&nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");this.$widthDiv.html(n);var a=this.$widthDiv.width(),l=Math.max(a+s,t.minWidth);l>o&&(o=l,r=i.length)},this));var l=e.width(),d=l>o&&o>=t.minWidth||o>l&&o<t.maxWidth;e.data("lastMeasuredWidth",o);var f=e.data("lastMeasuredHeight");if(t.force||a.length!==e.data("lastMeasuredLines")){e.data("lastMeasuredLines",a.length);var c=parseInt(e.css("line-height"),10);c||(c=1.13*parseInt(e.css("font-size"),10)+1),f=c*a.length,e.data("lastMeasuredHeight",f),d=!0}return{width:o,height:f,didChange:d,longestLineChars:r}},localize:function(e){var t=d[e];return(null===t||void 0===t)&&(t="***** "+e+" *****"),t},getResolvedPromise:function(){return b},newViewOptions:function(e,t){return _.extend(t||{},{fafApp:i._app},_.omit(e,["el","$el","viewId","previewEls"]))},getCanvasSizeForText:function(e,t,i){var n='<div id="sig-capture" class="sig-font-capture"></div>';$("body").append(n);var s=$("#sig-capture");s.text(e),s.css("font_family",i||"adobe-hand-d"),s.css("font-size",t);var o={width:s.width(),height:s.height()};return e.length&&e.length<=3&&(o.width*=1+1/(e.length+.75)),s.remove(),o},getCanvasSize:function(e,t){var i=e.kind,n=e.type||"signature",s=r.defaultValues.tool[n][i],o=$.extend({},s.size);return o.width=o.height/t,o},whenDone:function(e,t,i){return t=t||$.Deferred(),0===e.length?i?t.reject():t.resolve():e[0].fail(_.bind(function(){i=!0,this.logError("util","whenDone: promise failed!")},this)).always(_.bind(function(){this.whenDone(_.rest(e),t,i)},this)),t.promise()},basename:function(e){var t=e.replace(/\\/g,"/").replace(/.*\//,"");return t},normalizeImageSrc:function(e){return h.normalizeImageSrc(e)},getSampleThumbnailUrl:function(){return i.appApi.pluginsApi.getBaseUrl(i.PLUGIN_ID)+"/static/img/sample-thumb.png"},isValidCCNumber:function(e){var t=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$","i"),i=e.replace(/[ -]/g,"");return t.test(i)&&m(i)},handleTitleDivHoverIn:function(e){function t(){i.attr("data-title",n)}var i=$(e.currentTarget),n=i.attr("data-title-temp");n&&""!==n.trim()&&_.delay(t,1e3)},handleTitleDivHoverOut:function(e){$(e.currentTarget).removeAttr("data-title")},forceCursor:function(e){var t=$("<div></div>");t.css({overflow:"hidden",position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%"});var i=$("<div></div>");i.css({width:"200%",height:"200%"}),t.append(i);var n=$(document.body);n.append(t);var s=n.css("cursor");s!==e&&n.css("cursor",e),t.scrollLeft(1),t.scrollLeft(0),t.remove(),s!==e&&n.css("cursor",s)},isTapping:S,elementInView:function(e,t){var i=e.offset();$.extend(i,{right:i.left+e.outerWidth(),bottom:i.top+e.outerHeight()});var n=t.offset();return $.extend(n,{right:n.left+t.innerWidth(),bottom:n.top+t.innerHeight()}),i.left>=n.left&&i.right<=n.right&&i.top>=n.top&&i.bottom<=n.bottom},hitTest:function(e,t){var i=e.offset(),n=t.offset(),s=i.left,o=n.left,a=i.top,r=n.top,l=e.width(),d=t.width(),f=e.height(),c=t.height(),u=!1,h=!1;return(s>=o&&o+d>=s||o>=s&&s+l>=o)&&(u=!0),(a>=r&&r+c>=a||r>=a&&a+f>=r)&&(h=!0),u&&h?!0:!1},positionRelativeTo:function(e,t){for(var i={left:0,top:0},n=e[0];n&&n!==t[0];n=n.offsetParent)i.left+=n.offsetLeft,i.top+=n.offsetTop;return i},isIEPointerEvent:T,isIETouchEvent:D,isIEPointerNotTouchEvent:function(e){return T(e)&&!D(e)},isIE:function(){return"MSIE"===s.browserAndVersion()[0]},setReadOnly:function(e,t){this.isIE()?e.attr("contenteditable",t?"false":"true"):t?e.attr("readonly","true"):e.removeAttr("readonly")},delay:function(e){var t=$.Deferred();return _.delay(function(){t.resolve()},e),t.promise()}}}),define("fss/js/ops/generating-pdf-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o){return e.Op.extend({init:function(){},postSave:function(){return this._warnIfEmptyForm()},done:function(){},run:function(){var e={run:function(){return $.Deferred().resolve().promise()}};this.options=_.extend({showStatusOp:e,hideStatusOp:e,opSource:"",purpose:""},this.options),this.init();var n=this.options.fafPreferencesModel,s=!!this.options.omitStartEvent,o=$.Deferred(),a=this.options.showStatusOp,r=this.options.hideStatusOp,l=this.options.opSource;return l&&!/^ *:/.test(l)&&(this.options.opSource=":"+l),n.getPreference("session.is_generating_pdf")?(i.logInfo("downloading-pdf-op","already generating pdf"),o.resolve().promise()):(n.setPreference("session.is_generating_pdf",!0),t._flushAllDirty().then(_.bind(function(){return s||t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_EMIT_OUTPUT_EVENT,{actionBody:this.options.intent+":1-Started"+this.options.opSource,labelSuffix:this.options.purpose,categoryOverride:"",fieldCount:this.options.fieldCount}),this.postSave()},this)).then(function(){return a.run()}).then(_.bind(function(){return this._generatePDF().always(function(){r.run()})},this)).always(function(){n.setPreference("session.is_generating_pdf",!1)}))},_warnIfEmptyForm:function(){var e=this.options,i=!!e.ignoreEmptyForm,n=e.appApi.dialogApi;return e.fieldCount>0||i?this._getResolvedPromise():n.displayTextAlert(n.SEVERITY_INFORMATIONAL,o.DownloadFormWarningTitle,o.DownloadFormNoItems,o.Continue,o.Cancel,{dlgClass:"faf-download-warning_dlg"}).fail(function(){t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_EMIT_OUTPUT_EVENT,{actionBody:e.intent+":DialogClosed",labelSuffix:e.purpose,categoryOverride:"",fieldCount:e.fieldCount})})},_logDocumentInfo:function(e){if(t._formManager.form){var n="client_generate_pdf, formId="+t._formManager.getFormID()+(e?" requestId="+e:""),s=0,o=[];_.each(t._formManager.form.pages,function(e){_.each(e.elements,function(e){if("textfield"===e.type){s++;var i=t._fafFormValuesCollection.where({fieldID:e.id});i.length||o.push(e.id)}})}),i.logToSplunk(n+" numTextFields="+s),o.length&&i.logToSplunk(n+" warning=text_fields_with_no_value fieldIds="+JSON.stringify(o));var a=0;_.each(t._fafFormView.pagesUI,function(e){var t=e.find(".faf-focusbox-outline textarea");a+=t.length}),s!==a&&i.logToSplunk(n+" warning=text_field_dom_mismatch numTextFields="+s+" numTextAreas="+a);var r=t._fafFormValuesCollection.where({type:"textfield"}),l=r.length;s!==l&&i.logToSplunk(n+" warning=text_field_value_mismatch numTextFields="+s+" numTextValues="+l)}},_generatePDF:function(){var e=$.Deferred(),a=this.options,r=this,l=a.fafPreferencesModel,d=l.getPreference("develop_options"),f=_.extend({formID:a.formID,saveInBH:a.saveInBH,name:a.name,addSuffix:!0,suffixValue:o.FilledPDFSuffix},d?{options:d}:{}),c=n.getAjaxOptions("POST","/createpdf",{timeout:36e4,data:JSON.stringify(f),error:n.handleDexiErrorResponse(function(e,n){var o="ServerError";switch(n.code){case"Timeout":o="TimeOut";break;case"RestrictedEditPermission":o="PermSet"}var l="Form:Output:"+(a.fieldCount>0?"Filled:":"NoFill:")+a.intent+":Error";if(t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_EMIT_OUTPUT_EVENT,{actionBody:a.intent+":Error:"+o+a.opSource,labelSuffix:a.purpose,categoryOverride:l,fieldCount:a.fieldCount}),i.logError("pdf","Could not generate PDF: "+n.toJSONString()),a.fafEditorUiModel.isFormSourceNative()||r.options.saveInBH!==!0||404!==e.status)s.showDownloadPDFErrorDialog(n);else{var d=_.bind(r._showCCSaveError,r);d()}})});return this._logDocumentInfo(c.headers["x-request-id"]),$.ajax(c).done(_.bind(function(i){t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_EMIT_OUTPUT_EVENT,{actionBody:a.intent+":2-Completed"+a.opSource,labelSuffix:a.purpose,categoryOverride:a.fieldCount>0?void 0:null,fieldCount:a.fieldCount}),this.done(i,e)},this)).fail(function(){e.reject()}),e.promise()},_showCCSaveError:function(){var e=_.template(o.ErrorDownloadingPDF,{message:o.OutputFolderNotFound});s.showGenericDialog({text:e,okText:o.DownloadButton,showOK:!0,showCancel:!0,okFunc:_.bind(function(){t._fafFormView._triggerViewEvent(t.ViewEvents.FAF_DOWNLOAD_PDF,{formID:this.options.fafEditorUiModel.get("form_id"),fieldCount:this.options.fafEditorUiModel.fieldCount(),showStatusOp:t.opFactory.create("ShowingProgressStatusOp",_.extend({},this.options,{message:o.GeneratingPDF})),hideStatusOp:t.opFactory.create("HidingStatusOp",this.options),formHasFields:this.options.fafEditorUiModel.fieldCount()>0})},this)})}})}),define("fss/js/ops/downloading-pdf-op",["fss/js/ac-faf","fss/js/lib/util","fss/js/lib/utilUI","fss/js/ops/generating-pdf-op"],function(e,t,i,n){e.DownloadingPDFOp=n.extend({init:function(){this.options.intent||(this.options.intent="SavePDF"),this.options.opSource||(this.options.opSource="FSTab"),this.options.purpose||(this.options.purpose="Local")},done:function(n,s){t.getDownloadTicket(n.assetID).done(_.bind(function(i){var o=t.createDownloadUrl(n.assetID,i);$("#faf-download")[0].src=o,s.resolve(),_.defer(_.bind(function(){e.opFactory.create("ShowingNPSDlgOp",this.options).run().then(function(t){e.opFactory.create("SavingNPSFeedbackOp",{resolveArgs:t}).run()})},this),2500)},this)).fail(function(e,n){t.logError("pdf","Could not generate PDF download ticket: "+n.toJSONString()),i.showDownloadPDFErrorDialog(n),s.reject()})}})}),define("fss/js/lib/fafa",["fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s){return{addEmptiness:function(e,t,i){var n="undefined"==typeof i?t.val():i;return e+=n?":WasNonEmpty":":WasEmpty"},defaultCategory:function(e){return e?e:this.viewName},defaultValue:function(t){var i="";if(t){var n=t.data("gaqIndex");if("number"==typeof n)i+=n;else{var s=t.attr("name");s&&(i+=s)}}if(e._formManager){var o=e._formManager.getFormID();o&&o.length>0&&(i.length>0&&(i+=":"),i+=o)}return i},setCurrentView:function(e){e!==this.viewName&&(this.viewName=e)},logEvent:function(e,n,s,o,a){var r;if("function"==typeof o?(a=o,o=null):"object"==typeof o&&(r=$.extend({},o),o=null),e=e||null,n=n||null,s=s||n,!o&&r){o={};var l;r.id?o.id=r.id:r.$idDiv?(l=r.$idDiv.data(t.FORM_ELEMENT_KEY),l&&(o.id=l.id)):r.$fieldDiv&&(l=r.$fieldDiv.data(t.FORM_ELEMENT_KEY),l&&(o.id=l.id)),r.posAbs?(o.posAbs={x:r.posAbs.x,y:r.posAbs.y},r.$fieldDiv&&(o.posRel={x:r.posAbs.x-r.$fieldDiv.position().left,y:r.posAbs.y-r.$fieldDiv.position().top})):r.$fieldDiv&&(o.posAbs={x:r.$fieldDiv.position().left,y:r.$fieldDiv.position().top}),!o.posRel&&r.posRel&&(o.posRel=r.posRel),o.posRel&&(o.posRel={x:Math.round(o.posRel.x),y:Math.round(o.posRel.y)}),o.posAbs&&(o.posAbs={x:Math.round(o.posAbs.x),y:Math.round(o.posAbs.y)}),["id","$idDiv","$fieldDiv","posRel","posAbs"].forEach(function(e){e in r&&delete r[e]}),$.extend(o,r)}return i.logEvent(e,n,s,o,a)},eventNumber:function(){return i.eventNumber},gaNameFromSigType:function(e){switch(e){case"signature":return"FullName";case"initials":return"Initials";default:return"Unknown["+e+"]"}},gaNameFromSigKind:function(e){switch(e){case"scribble":return"Scribble";case"input":return"Typed";case"image":return"Imported";default:return"Unknown["+e+"]"}},gaNameFromToolType:function(e){switch(e){case"check":return"Check";case"dot":return"Dot";case"line":return"Line";case"roundrect":return"RoundRect";case"x":return"X";case"text":return"Text";case"empty":return"Empty";default:return"Unknown["+e+"]"}},gaMidfixFromImageType:function(e){return require("fss/js/lib/formcanvas").isSignatureType(e)?":Sign":":Annot"},gaPostfixFromFormElement:function(t,i,n){var s=":",o=n&&e._signatures.formSignatures.getSignature(n.id);return require("fss/js/lib/formcanvas").isSignatureType(t)?(s+=this.gaNameFromSigType(t),i||(s+=":"+this.gaNameFromSigKind(o&&o.kind))):s+=this.gaNameFromToolType(t),s},knownUploadErrors:{UnsupportedFileType:"UnsupportedFile",UnsupportedPDFType:"UnsupportedPDFFile",UnsupportedPDFTypeEditRestricted:"UnsupportedPDFEditRestricted",UnsupportedPDFTypeEncrypted:"UnsupportedPDFEncrypted",UnsupportedPDFTypeInvalid:"UnsupportedPDFInvalid",UnsupportedPDFTypeXFA:"UnsupportedPDFXFA",UnsupportedPDFTooManyPages:"UnsupportedPDFTooManyPages"},reportUploadError:function(e,t){var i,o="Form:Upload:Error",a=t.code,r=s[a],l=!0;"CannotUploadFile"===a?i=o+":CannotUploadFile":"cpdf_"===a.substring(0,5)?(i=o+":NonPDFFailed",r=s.CreatePDFFailed):"UnsupportedFileSize"===a?i=o+":UnsupportedFileSize":400===e.status&&a in this.knownUploadErrors?i=o+":"+this.knownUploadErrors[a]:(l=!1,i=o+":Other",_.has(s,a)||(a="Unknown"),r=s[a]),500===t.status&&(r+=t&&t.logRef?_.template(s.DefaultErrorDialogLogRefText,{logRef:t.logRef}):s.NullString),l&&(r+=s.UnsupportedPDFLearnMore);var d={fileType:t.fileType,fileSize:t.fileSize,errorCode:a,errorMessage:r};this.logEvent(null,o,i,d),n.showGenericDialog(r)},propertyMap:{crypt:{action:":Secured"},form:{action:":Acroform"},xfa:{action:":XFAForm"},sig:{action:":DigSigFieldNotFilled"},signed:{action:":DigSigFieldFilled"},re:{action:":ReaderExt"},image_only:{action:":ImageOnly"},fss:{action:":FAFPDF_NotSigned"},fsssigned:{action:":FAFPDF_Signed"},email_submit:{action:":FormHasEmailSubmitButton"},web_submit:{action:":FormHasWebSubmitButton"},js_button:{action:":FieldHasAcroformJS",label:":Button"},js_choicebutton:{action:":FieldHasAcroformJS",label:":ChBtn"},js_choicelist:{action:":FieldHasAcroformJS",label:":ChList"},js_signature:{action:":FieldHasAcroformJS",label:":Sig"},js_text:{action:":FieldHasAcroformJS",label:":Text"}},reportPDFFormat:function(e){var t,i,n,s="Form:Upload:SpecialPDF",o=this;if(e&&"pdf"!==e){e=e.replace("form:xfa","xfa").replace("sig:signed","signed").replace("fss:signed","fsssigned");var a=e.split(":");a.shift(),a.forEach(function(e){_.has(o.propertyMap,e)&&(t=o.propertyMap[e],n=s+t.action,i=n+(_.has(t,"label")?t.label:""),o.logEvent(null,n,i))})}}}}),define("fss/js/templates/faf-filename-dlg-template",[],function(){return'<input class="faf-filename-dlg-name" type="text" tabindex="1"       value="<%- name %>"></input> <div class="dialog-buttons">    <input class="faf-filename-dlg-cancel-btn control-button                  dialog-control-button button-grey ui-theme theme-text"           type="button" id="faf-filename-dlg-cancel-btn"           tabindex="1" value="<%= cancel %>">    </input>    <input class="faf-filename-dlg-ok-btn control-button                  dialog-control-button"           type="button" id="faf-filename-dlg-ok-btn"           tabindex="1" value="<%= ok %>">    </input></div>'}),define("fss/js/views/faf-filename-dlg-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/faf-filename-dlg-template","i18n!fss/js/nls/ui-strings","core/utils/truncate","core/utils/view-util","core/views/dialog-view"],function(e,t,i,n,s,o){t.FafFilenameDlgView=e.DialogView.extend({events:function(){return _.extend({},e.DialogView.prototype.events,{"keydown .faf-filename-dlg-name":"_onNameKeyDown","keyup   .faf-filename-dlg-name":"_onNameKeyUp","paste   .faf-filename-dlg-name":"_onNamePaste","click   .faf-filename-dlg-ok-btn":"_onOKClick","click   .faf-filename-dlg-cancel-btn":"_onCancelClick"})},initialize:function(){e.DialogView.prototype.initialize.call(this),this._template=_.template(i)},render:function(){e.DialogView.prototype.render.call(this),this._appendToDialog(this._template({name:this._getName(),ok:n.Continue,cancel:n.Cancel})),this._initWrappers();var t=n.DownloadFormTitle,i=this.options.fafEditorUiModel.getFormSourceConnectorLabel();return i&&(t=_.template(n.DownloadFormToCloudTitle,{cloudName:i})),this._setTitle(t),this.options.maxLength&&(this.$name[0].maxLength=this.options.maxLength),o.setElementFontByLocale(this.$el,"input"),this._center(),this._initTabLimits(),_.defer(_.bind(function(){this.$name.focus().select()},this)),this._truncateText(),this},_initWrappers:function(){e.DialogView.prototype._initWrappers.call(this),this.$name=this.$(".faf-filename-dlg-name"),this.$okBtn=this.$(".faf-filename-dlg-ok-btn"),this.$cancelBtn=this.$(".faf-filename-dlg-cancel-btn")},_getName:function(){return this.options.name},_getNewName:function(){return $.trim(this.$name.val())},_getSuccessOptions:function(){return{resolveArgs:{name:this._getNewName()}}},_truncateText:function(){s.truncateButtonLabel(this.$okBtn),s.truncateButtonLabel(this.$cancelBtn)},_updateControls:function(){var e=this._getNewName();o.enableInput(this.$okBtn,e.length>0),this._initTabLimits()},_onNameKeyDown:function(e){13===e.which&&o.isInputEnabled(this.$okBtn)&&this.close(!0,this._getSuccessOptions())},_onNameKeyUp:function(){this._updateControls()},_onNamePaste:function(){_.defer(this._updateControls)},_onOKClick:function(e){var t=$(e.currentTarget);o.isInputEnabled(t)&&this.close(!0,this._getSuccessOptions())},_onCancelClick:function(){this.close(!1)}})}),define("fss/js/ops/saving-pdf-op",["fss/js/ac-faf","fss/js/lib/fafa","fss/js/ops/generating-pdf-op","i18n!fss/js/nls/ui-strings","fss/js/views/faf-filename-dlg-view"],function(e,t,i,n){var s=245,o=250;e.SavingPDFOp=i.extend({init:function(){this.options.opSource||(this.options.opSource="FSTab"),this.options.purpose||(this.options.purpose="Acom"),this.options.intent="SavePDF",this.options.saveInBH=!0},postSave:function(){var i,a=this.options,r=a.fafEditorUiModel.get("form_name");return this._warnIfEmptyForm().then(_.bind(function(){return e.opFactory.create("ShowingFilenameDlgOp",_.extend(this.options,{name:r.replace(/\.form$/,n.FilledPDFSuffix+".pdf"),maxLength:s})).run().then(_.bind(function(e){i=e.name,i.match(/\.pdf$/)||(i+=".pdf"),i.length>o&&(i=i.substring(0,Math.min(i.length,o)-4),i=i.trim()+".pdf"),this.options.name=i,t.logEvent(null,null,"Form:Output:"+(a.fieldCount>0?"Filled:":"NoFill:")+a.intent+":1.5-NameFile"+a.opSource+":"+a.purpose)},this))},this))},done:function(t,i){var s,o,a=this.options.appApi.dialogApi,r=this;i.resolve();var l=this.options.fafEditorUiModel.getFormSourceConnectorLabel();l?(s=_.template(n.SaveFormToCloud,{formName:t.name,cloudName:l}),o=_.template(n.DownloadFormToCloudTitle,{cloudName:l})):(s=_.template(n.SaveForm,{formName:t.name}),o=_.template(n.DownloadFormTitle,{}));var d='<div class="faf-word-wrapper">'+s+"</div>";a.displayHtmlAlert(a.SEVERITY_SUCCESS,o,d,n.OK).then(function(){_.defer(_.bind(function(){e.opFactory.create("ShowingNPSDlgOp",r.options).run().then(function(t){e.opFactory.create("SavingNPSFeedbackOp",{resolveArgs:t}).run()})},this),2500)})}})}),define("fss/js/ops/hiding-status-op",["core/ac-core","fss/js/ac-faf"],function(e,t){t.HidingStatusOp=e.Op.extend({run:function(){var e=t.appApi.statusMenuApi;return e.setStatus(t.PLUGIN_ID,e.STATUS_IDLE),e.hideStatusMenuItem(t.PLUGIN_ID),this._getResolvedPromise()}})}),define("fss/js/ops/initializing-plugin-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.InitializingPluginOp=e.Op.extend({run:function(){return $.Deferred().resolve().promise()}}),t.InitializingPluginOp}),define("fss/js/ops/init-user-op",["core/ac-core","fss/js/ac-faf","core/ops/op","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/fafa"],function(e,t,i,n,s,o){t.InitUserOp=e.Op.extend({run:function(){function e(e){return s.handleDexiErrorResponse(function(t,o){n.logError("init-user-op",e+o.toJSONString()),s.defaultErrorHandler(o),i.reject()})}function t(){$.ajax(s.getAjaxOptions("POST","/inituser",{data:JSON.stringify({})})).done(function(e){var t="UserType:"+(e.new_user?"NewUser":"ReturnUser");try{o.logEvent(t,t,t)}catch(s){n.logInfo(s)}i.resolve()}).fail(e("Error initializing user: "))}var i=$.Deferred();return t(),i.promise()}})}),define("fss/js/views/faf-view-events",["fss/js/ac-faf"],function(e){e.ViewEvents={FAF_DOWNLOAD_PDF:"faf:download-pdf",FAF_OPEN_FORM:"faf:open-form",FAF_CREATE_SAMPLE_FORM:"faf:create-sample-form",FAF_SCROLL_MODE_CLICK:"faf:scroll-mode-click",FAF_ZOOM_CLICK:"faf:zoom-click",FAF_IMAGE_CLEAN:"faf:image-clean",FAF_DOWNLOAD_PDF_CLICK:"faf:download-pdf-click",SELECT_DOWNLOAD_PDF_MENU_ITEM:"faf:select-download-pdf-menu-item",FAF_SAVE_PDF:"faf:save-pdf",FAF_PRINT_PDF:"faf:print-pdf",FAF_EMIT_OUTPUT_EVENT:"faf:emit-output-event",FAF_SIGNATURE_CLICK:"faf:signature-click",FAF_SIGNATURE_SHOW_POPUP:"faf:signature-show-dlg",FAF_SIGNATURE_START_DRAG:"faf:signature-start-drag",FAF_SIGNATURE_CANCEL:"faf:signature-cancel",FAF_SIGNATURE_OK:"faf:signature-ok",FAF_SIGNATURE_TOGGLE_FONT_MENU:"faf:signature-show-font-menu",FAF_SIGNATURE_CLEAR:"faf:signature:clear",FAF_SIGNATURE_DLG_WILL_OPEN:"faf:signature:dlg-will-show",FAF_SIGNATURE_DLG_WILL_CLOSE:"faf:signature:dlg-will-close",FAF_SIGNATURE_DLG_RESIZED:"faf:signature:dlg-resized",FAF_SIGN_IN_CLICK:"faf:sign-in-click"}}),define("fss/js/ops/listening-for-view-events-op",["core/ac-core","fss/js/ac-faf","core/views/view-events","fss/js/views/faf-view-events"],function(e,t){t.ListeningForViewEventsOp=e.Op.extend({initialize:function(){e.Op.prototype.initialize.call(this),this._initEventMap()},run:function(){return this.listenTo(this.options.rootView,"all",this._onViewEvent),(this._deferred=$.Deferred()).promise()},_onViewEvent:function(t,i){var n,s,o,a;return n=this._eventMap[t],n&&(s=n[0].create(n[1],i)),s?(o=s.options,o&&(a=o.parentDeferred),void s.run().then(function(){a&&a.resolve()},function(){a&&a.reject()})):void(t!==e.ViewEvents.MENU_CLOSED&&LOG("AcFaf.ListeningForViewEventsOp._onViewEvent ignoring "+t))},_mapEvent:function(e,t,i,n,s){e[t]=[i,n,s]},_initEventMap:function(){var e,i,n,s,o;e=this._eventMap={},i=this._mapEvent,n=t.opFactory,s=t.Reader.opFactory,o=t.ViewEvents,i(e,o.FAF_ZOOM_CLICK,n,"ZoomFormOp"),i(e,o.FAF_SCROLL_MODE_CLICK,n,"ScrollModeOp"),i(e,o.FAF_OPEN_FORM,n,"OpenFormOp"),i(e,o.FAF_CREATE_SAMPLE_FORM,n,"CreateAndOpenSampleFormOp"),i(e,o.FAF_DOWNLOAD_PDF_CLICK,n,"TogglingDownloadPDFMenuOp"),i(e,o.FAF_SIGNATURE_CLICK,n,"TogglingSignatureMenuOp"),i(e,o.FAF_DOWNLOAD_PDF,n,"DownloadingPDFOp"),i(e,o.FAF_SAVE_PDF,n,"SavingPDFOp"),i(e,o.FAF_PRINT_PDF,n,"DownloadingAsPrintFallbackOp"),i(e,o.FAF_SIGNATURE_SHOW_POPUP,n,"ShowSignPopupOp"),i(e,o.FAF_SIGNATURE_START_DRAG,n,"StartDragAfterSigSavedOp"),i(e,o.FAF_EMIT_OUTPUT_EVENT,n,"EmitOutputEventOp"),i(e,o.FAF_SIGN_IN_CLICK,s,"FafSignInOp")}})}),define("fss/js/data/reader/faf-reader-constants",[],function(){return{CLIENT_VERSION:"desktop/1.0.0",TOOL_TEXT:"custom:FSS:Tool:Text",TOOL_X:"custom:FSS:Tool:Crosscheck",TOOL_CHECK:"custom:FSS:Tool:Checkmark",TOOL_CIRCLE:"custom:FSS:Tool:Circle",TOOL_LINE:"custom:FSS:Tool:Line",TOOL_DOT:"custom:FSS:Tool:Dot",TOOL_SIGN:"custom:FSS:DigSig",TOOL_AC_SUGGEST:"custom:FSS:Tool:GetAutocompleteSuggestions",TOOL_AC_REMOVE:"custom:FSS:Tool:RemoveAutoCompleteSuggestion",TOOL_AC_REMOVE_ONLY_SERVER:"custom:FSS:Tool:RemoveAutoCompleteSuggestionOnlyServer",TOOL_AC_ADD:"custom:FSS:Tool:AddAutoCompleteSuggestion",TOOL_AC_ADD_SERVER:"custom:FSS:Tool:AddAutoCompleteSuggestionsOnServer",TOOL_AC_ADD_SERVER_CLOSE_TAB:"custom:FSS::CloseTab",TOOL_AC_ADD_SERVER_CLOSE_APP_WINDOW:"custom:FSS::CloseWindow",TOOL_REMOVE_SIGNATURE:"custom:FSS:Tool:RemoveSignature",SYNC_SIGNATURE:"custom:FSS:SyncSignature",KEY_ESC:"custom:ESCKeyCommand",CLOSE_APP:"custom:ExitApp",CMD_PRINT:"custom:Print",CMD_SAVE:"custom:Save",CMD_SAVEAS:"custom:SaveAs",CMD_ATTACHTOEMAIL:"custom:Share",DO_FLUSH:"Flush",DO_CLOSE:"Close",CALL_SAVE:"Save",CALL_SAVEAS:"SaveAs",EXECUTE_UI_COMMAND:"executeUICommand",UI_METHOD_ARGS_SIGN_IN:"SignIn",fssToReaderToolName:function(e){var t=null;switch(e){case"x":t=this.TOOL_X;break;case"check":t=this.TOOL_CHECK;break;case"roundrect":t=this.TOOL_CIRCLE;break;case"line":t=this.TOOL_LINE;break;case"dot":t=this.TOOL_DOT;break;case"text":t=this.TOOL_TEXT;break;case"signature":t=this.TOOL_SIGN}return t},readerToFssToolName:function(e){var t="text";switch(e){case this.TOOL_X:t="x";break;case this.TOOL_CHECK:t="check";break;case this.TOOL_CIRCLE:t="roundrect";break;case this.TOOL_LINE:t="line";break;case this.TOOL_DOT:t="dot";break;case this.TOOL_TEXT:t="text";break;case this.TOOL_SIGN:t="signature"}return t}}}),define("fss/js/ops/reader/getting-doc-cloud-services-status-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-log-util","fss/js/lib/faf-ajax-util","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-js-wrapper"],function(e,t,i,n,s,o){return t.Reader.GettingDocCloudServicesStatusOp=e.Op.extend({run:function(){var e=this.options.fafPreferencesModel,i=e.get("doc_cloud_status_promise");if(i){if(!this.options.ignorePrevStatus)return i;"pending"===i.state()&&this._error("Unresolved previous promise found!")}var n=$.Deferred();s.isLoggedIn()&&e.set("doc_cloud_status_promise",n.promise());var a={};return o.getFssPrefs().then(_.bind(function(){var e=t.Reader.prefs;a.docServices=1===e.bToggleAdobeDocumentServices?"enabled":"disabled",a.othersSignServices=1===e.bEnableGetOthersSignApp?"enabled":"disabled","enabled"!==a.docServices?n.resolve(a):this.options.appApi.rnaApi.done(_.bind(function(e){e.rnaServicesAPI?e.rnaServicesAPI.isEnterpriseUser()&&!e.rnaServicesAPI.isPDFServicesEnabled()&&(a.docServices="disabled"):(this._error("Cannot get rnaServicesApi"),a.docServices="error"),n.resolve(a)},this))},this)).fail(_.bind(function(){a.docServices=a.othersSignServices="error",this._error("ReaderFssPrefs failed."),n.resolve(a)},this)),n.promise()},_error:function(e){i.logError("Reader.GettingDocCloudServicesStatusOp",e)}}),t.Reader.GettingDocCloudServicesStatusOp}),define("fss/js/ops/reader/events-base-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","core/utils/date-util","fss/js/ops/reader/op-factory"],function(e,t,i,n){var s=!0;return t.Reader.EventsBaseOp=e.Op.extend({initialize:function(){n.logElapsedTime("FSS: starting EventsBaseOp"),e.Op.prototype.initialize.call(this),_.bindAll(this,"_getFssApi","_getEventProxy","_getSessionEventProxy"),this._initDefer=$.Deferred(),t.appApi.rnaApi.then(_.bind(function(e){return this._rnaApi=e,this._getFssApi()},this)).then(this._getEventProxy).then(this._getSessionEventProxy).done(_.bind(function(){n.logElapsedTime("FSS: starting EventsBaseOp: done"),this._initDefer.resolve()},this))},_getFssApi:function(){return this._fssApi=this._rnaApi.fssApi,this._fssApi({methodName:"getFSSEventsObject",methodArgs:[]})},_getEventProxy:function(t){this._eventProxy=new e.RNAModel(void 0,{_proxy:t,shouldCache:!1},this)},_getSessionEventProxy:function(){return this.options.readerContextModel?this.options.readerContextModel.done(_.bind(function(e){this._sessionAPIModel=e.get("rna").get("rnaAPI").get("sessionAPI")},this)):void 0},run:function(){return i.logDebug("ReaderEventsOpBase","run() called: subclass should override this!"),this._getResolvedPromise()},_logEvent:function(e,t){s&&i.logInfo(this._getLogClass(),this._getLogPrefix(e)+t)},_getLogClass:function(){return"EventsBaseOp"}}),t.Reader.EventsBaseOp}),define("fss/js/ops/reader/send-event-op",["core/ac-core","fss/js/ac-faf","fss/js/ops/reader/op-factory","fss/js/ops/reader/events-base-op"],function(e,t){return t.Reader.SendEventOp=t.Reader.EventsBaseOp.extend({run:function(){var e=$.Deferred();return this._initDefer.then(_.bind(function(){this._logEvent(this.options.eventName,"calling "+this.options.methodName+" with "+JSON.stringify(this.options.methodArgs));var t=this._fssApi({methodName:this.options.methodName,methodArgs:this.options.methodArgs});e.resolve(t)},this)),e.promise()},_getLogClass:function(){return"SendReaderEventOp"},_getLogPrefix:function(){return"FSS-originated event: "}}),t.Reader.SendEventOp}),define("fss/js/ops/esign/toggling-signature-menu-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa"],function(e,t,i){return t.TogglingSignatureMenuOp=e.Op.extend({run:function(){var e=this.options,n=e.fafEditorUiModel,s=e.fafUserDataModel,o=n.get("show_signature_menu"),a=$.Deferred();return s.getUserDataModelPromise().then(_.bind(function(){var r=s.getObject("signature"),l="Create:Sign:"+(r&&r.value.length>0?"RU":"NU")+":0-SignDropDownShown";if(o)n.set("show_signature_menu",!o),a.resolve();else{var d;d=e.separateSync?this._getResolvedPromise():t.opFactory.create("SignatureSyncOp",e).run(),d.always(function(){i.logEvent(l,l,l),n.set("show_signature_menu",!o),a.resolve()})}},this)).fail(function(){a.reject()}),a.promise()}}),t.TogglingSignatureMenuOp}),define("fss/js/ops/reader/toggling-reader-signature-menu-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-log-util","fss/js/data/reader/faf-reader-constants","fss/js/ops/esign/toggling-signature-menu-op","fss/js/ops/reader/op-factory"],function(e,t,i,n){return t.Reader.TogglingReaderSignatureMenuOp=t.TogglingSignatureMenuOp.extend({run:function(){return i.logInfo("TogglingReaderSignatureMenuOp","run called"),this._modalIsShowing()?$.Deferred().reject().promise():this._runWhenReady($.Deferred())},_modalIsShowing:function(){return $("#modal-mask").hasClass("shown")||"none"!==$("#sig_popup").css("display")},_startingNotDonePromise:function(e){return e.reject().promise()},_menuAboutToShow:function(){},_showIntermediateMenu:function(){console.log("Reader :_showIntermediateMenu Show Menu");var e=this.options,i=e.fafEditorUiModel,n=!1,s=i.get("show_signature_menu"),o=$(".faf-signature-menu-container"),a=$(".faf-signature-menu"),r=o.is(":visible"),l=i.get("signature_button_position"),d=l?(l.left+l.right)/2:0;this.$toolbar=$(".faf-form-tools");var f=this.$toolbar.offset().left,c=a.outerWidth(),u=d-f-c/2;o.css("margin-left",u+"px"),s||r?o.hide():(n=!0,o.show()),t.appApi.displayApi.showSpinner(n,{refElem:o})},_runWhenReady:function(e){i.logInfo("TogglingReaderSignatureMenuOp","_runWhenReady called");this.options.startingPluginOpPromise;return this._runNow(e)},_runNow:function(e){var i=this.options;t._fafFormView.blurFocusedElement();var n=t.Reader.fafReaderNativeSignatureUIModel,s=n.get("signUpdatePromise")||this._getResolvedPromise();return s.then(_.bind(function(){t.Reader.opFactory.create("SignatureSyncReaderOp",i).run().always(_.bind(function(){this._showWithoutSync(),e.resolve()},this))},this)),"resolved"!==e.promise().state()&&this._showIntermediateMenu(),e.promise()},_showWithoutSync:function(){this._selectPrevTool(),this._setMenuPosition(),this._menuAboutToShow(),t.TogglingSignatureMenuOp.prototype.run.call(this)},_selectPrevTool:function(){var e=this.options.fafEditorUiModel.get("tool");t.Reader.opFactory.create("SendEventOp",{eventName:"TogglingReaderSignatureMenuOp",methodName:"selectFSSTool",methodArgs:[n.fssToReaderToolName(e)]}).run()},_setMenuPosition:function(){try{var e=JSON.parse(this.options.eventParams.position);this.options.fafEditorUiModel.set("signature_button_position",e)}catch(t){}}}),t.Reader.TogglingReaderSignatureMenuOp}),define("fss/js/lib/reader/faf-reader-api-caller",["core/ac-core"],function(e){return{mixin:function(t){return _.extend(t.prototype,{_setContainerSize:function(t,i,n){return n&&n.scale&&e.Util.isWindows()&&(t*=window.devicePixelRatio,i*=window.devicePixelRatio),this._tellReader("setContainerSize",[t,i],!0)},_getDocWindowSize:function(){var t=$.Deferred();return this._tellReader("getDocWindowSize").then(function(i){var n=JSON.parse(i);e.Util.isWindows()&&(n.width/=window.devicePixelRatio,n.height/=window.devicePixelRatio),t.resolve(n)}),t.promise()},_tellReader:function(e,t,i){var n=$.Deferred();return t=t||[],this.options.appApi.rnaApi.done(function(s){var o;o=i?s.cefBrowserApi({methodName:e,parameters:t}):s.fssApi({methodName:e,methodArgs:t}),o.done(function(e){n.resolve(e)}).fail(function(e){n.reject(e)})}),n.promise()}}),t}}}),define("fss/js/lib/reader/window-event-listener",["fss/js/ac-faf","fss/js/lib/faf-log-util"],function(e,t){return{mixin:function(i){return i.prototype._windowShown&&i.prototype._windowHidden?_.extend(i.prototype,{_wEventPromise:$.Deferred().resolve().promise(),_listenForWindowEvents:function(){var t=e.Reader&&e.Reader.readerEventListenerOp;t?(t.listenForReaderEvent("custom:WindowShown",this._windowEventShown),t.listenForReaderEvent("custom:WindowHidden",this._windowEventHidden)):_.delay(this._listenForWindowEvents,100)},listenForWindowEvents:function(){_.bindAll(this,"_windowShown","_windowHidden","_listenForWindowEvents","_windowEventShown","_windowEventHidden"),this._listenForWindowEvents()
},_windowEventShown:function(){this._wEventPromise.always(_.bind(function(){this._wEventPromise=this._windowShown()},this))},_windowEventHidden:function(){this._wEventPromise.always(_.bind(function(){this._wEventPromise=this._windowHidden()},this))}}):t.logError("windowEventListener","mixin called with missing functions"),i}}}),define("fss/js/ops/reader/toggling-reader-native-signature-menu-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-log-util","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-api-caller","fss/js/lib/reader/window-event-listener","fss/js/ops/reader/toggling-reader-signature-menu-op"],function(e,t,i,n,s,o,a){return t.Reader.TogglingReaderNativeSignatureMenuOp=t.Reader.TogglingReaderSignatureMenuOp.extend({run:function(){var i,n=225;e.Util.isWindows()?i=112:(n+=18,i=112),this._setContainerSize(n,i,{scale:!0});var s={};s.refElem=$(".faf-form-list"),this.options.appApi.displayApi.showSpinner(!0,s),this.listenForWindowEvents(),this.options.separateSync=!0,_.bindAll(this,"_signinChange");var o=this.options.fafSigninStateModel;this.listenTo(o,"change:"+o.STATE,this._signinChange);var a=$(".faf-signature-menu"),r=$(".faf-view-container");a.remove(),r.prepend(a);var l=this.options.fafEditorUiModel;return this.listenTo(l,"change:show_signature_menu",_.bind(function(){l.get("show_signature_menu")&&(this.options.appApi.displayApi.showSpinner(!1),this.stopListening(l))},this)),this._setContainerSize(n,i,{scale:!0}),t.Reader.TogglingReaderSignatureMenuOp.prototype.run.call(this).fail(_.bind(function(){this.options.appApi.displayApi.showSpinner(!1)},this))},_showIntermediateMenu:function(){},_startingNotDonePromise:function(e){return n.logDebug("TogglingReaderNativeSignatureMenuOp","_startingNotDonePromise called"),_.delay(_.bind(function(){this._runWhenReady(e)},this),500),e.promise()},_runNow:function(e){return this._windowShown(),e},_windowShown:function(){return t.Reader.fafReaderNativeSignatureUIModel.set("sigClicked",!1),this._showMenu()},_windowHidden:function(){return this._getResolvedPromise()},_syncSignatures:function(e){return t.Reader.opFactory.create("SignatureSyncReaderOp",e).run()},_showMenu:function(){var e=t.Reader.fafReaderNativeSignatureUIModel,n=s.isSignedInAndConnected(),o=!1;if(this.options.eventParams&&this.options.eventParams.forceSync&&(o=this.options.eventParams.forceSync),e.set("forceSync",o),e.get("menuShown")&&!e.get("forceSync"))return this._getResolvedPromise();var a=e.get("signUpdatePromise")||this._getResolvedPromise();return a.then(_.bind(function(){var t;return t=!n||!e.get("forceSync")&&e.get("syncDone")?this._getResolvedPromise():this._syncSigs()},this)).then(_.bind(function(t){"needsSync"===t?(!e.get("syncRequested")||e.get("forceSync"))&&(e.set("syncRequested",!0),this._tellReader("signMenu",[{action:"sync"}])):(n&&e.set("menuShown",!0),this._showWithoutSync())},this)).fail(_.bind(function(e){i.logError("TogglingReaderNativeSignatureMenuOp","Failed to sync: "+e),this._showWithoutSync()},this)),this._getResolvedPromise()},_selectPrevTool:function(){},_setMenuPosition:function(){},_menuAboutToShow:function(){},_syncSigs:function(e){return this._syncSigPromise||(this.options.separateSync=!0,this._syncSigPromise=s.runSignatureSyncOp(this.options,e).then(function(e){var i=t.Reader.fafReaderNativeSignatureUIModel;return i.set("syncDone",!0),e})),this._syncSigPromise},_signinChange:function(e){if(e.get(e.STATE)===e.state.SIGNED_IN){var i=t.Reader.fafReaderNativeSignatureUIModel;i.set("syncDone",!1),i.set("menuShown",!1),this._syncSigPromise&&"pending"===this._syncSigPromise.state?_.delay(_.bind(function(){this._signinChange(e)},this),500):(delete this._syncSigPromise,this._syncSigs(!0).then(_.bind(function(e){"needsSync"===e&&(i.get("syncRequested")||(i.set("syncRequested",!0),this._tellReader("signMenu",[{action:"sync",showMenu:!1}])))},this)))}}}),a.mixin(o.mixin(t.Reader.TogglingReaderNativeSignatureMenuOp)),t.Reader.TogglingReaderNativeSignatureMenuOp}),define("fss/js/lib/faf-server-api-util",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-ajax-util","fss/js/lib/faf-common-util"],function(e,t,i,n){return{saveSignature:function(e){var t=$.Deferred(),s={formID:e.formID||"",addToGlobal:e.addToGlobal||!1};_.extend(s,{imgData:e.pngData});var o=i.getAjaxOptions("POST","/signature",{data:JSON.stringify(s)});return $.ajax(o).done(function(e){t.resolve(e)}).fail(i.handleDexiErrorResponse(function(e,s){n.desktopNativeSignCommand()||i.defaultErrorHandler(s),t.reject(s.toJSONString())})),t.promise()},getSignature:function(e){var t=$.Deferred(),n=i.getAjaxOptions("/signature/"+e);return $.ajax(n).done(function(e){t.resolve(e)}).fail(i.handleDexiErrorResponse(function(e,i){t.reject(i.toJSONString())})),t.promise()},deleteSignature:function(e){var t=$.Deferred(),n=i.getAjaxOptions("DELETE","/signature/"+e,{modal:!0});return delete n.contentType,$.ajax(n).done(function(e){t.resolve(e)}).fail(i.handleDexiErrorResponse(function(e,n){i.defaultErrorHandler(n),t.reject(n.toJSONString())})),t.promise()},cleanImage:function(e,t){var n=$.Deferred(),s={imgData:e,cleanupSessionID:t},o=i.getAjaxOptions("POST","/cleanImage",{timeout:12e4,data:JSON.stringify(s)});return $.ajax(o).done(function(e){n.resolve(e)}).fail(i.handleDexiErrorResponse(function(e,t){n.reject(t.toJSONString())})),n.promise()}}}),define("fss/js/lib/web/faf-web-api-util",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-server-api-util","fss/js/data/reader/faf-reader-constants"],function(e,t,i,n){function s(i){var n=$.Deferred();if(e.Util.isIE10()){var s=new XMLHttpRequest;s.onload=function(){var e=URL.createObjectURL(this.response);n.resolve(e)},s.open("GET",i,!0),s.responseType="blob",s.withCredentials=!0,s.setRequestHeader("Authorization","Bearer "+t.appApi.sessionApi.getPrimaryToken()),s.send()}else n.resolve(i);return n.promise()}return{loadRendition:function(t,i){function n(t){return e.Util.isIE10()?o.on("load",function(){URL.revokeObjectURL(t)}).attr("src",t):o.attr("src",t),!0}var o,a;return o=i.img,a=i.src,s(a).then(n)},loadRenditions:function(e,t){for(var i=[],n=0;n<t.length;n++){var s=this.loadRendition(n,t[n]);i.push(s)}return $.when.apply($,i)},getUISettings:function(){return $.Deferred().resolve().promise()},saveUISettings:function(){return $.Deferred().resolve().promise()},saveSignature:function(e){return i.saveSignature(e)},getSignature:function(e,t){return i.getSignature(e,t)},deleteSignature:function(e,t){return i.deleteSignature(e,t)},getGlobalSignatures:function(){return $.Deferred().resolve().promise()},deleteGlobalSignatures:function(){return $.Deferred().resolve().promise()},cleanImage:function(e,t){return i.cleanImage(e,t)},getToolbarButtonPosition:function(e){var t=n.readerToFssToolName(e),i=$("#faf-toolbar-button-container"),s=$('[data-buttontype="'+t+'"]',i),o=s.offset().left;return $.Deferred().resolve({left:o,right:o+s.outerWidth()}).promise()},checkClientVersion:function(){return $.Deferred().resolve().promise()},getSessionPrefs:function(){return $.Deferred().resolve().promise()},setSessionPrefs:function(){return $.Deferred().resolve().promise()},openDecoratedUrl:function(){return $.Deferred().resolve().promise()},signatureSynced:function(){return $.Deferred().resolve().promise()}}}),define("fss/js/lib/reader/faf-reader-api-util",["core/ac-core","fss/js/ac-faf","fss/js/lib/reader/faf-reader-js-wrapper","fss/js/lib/faf-profiler-util","fss/js/lib/faf-server-api-util","fss/js/lib/faf-common-util","core/utils/date-util"],function(e,t,i,n,s,o,a){function r(e,t){var s=t.img;return s[0].hasAttribute("data-loading")?$.Deferred().resolve().promise():(s.attr("data-loading",!0),n.startTimer("loadRendition"+e,"total time to load and show rendition for page "+e),n.onImageLoaded(s).then(function(){n.stopTimer("loadRendition"+e)}),i.doGetRendition(e).then(function(t){return n.startTimer("setSrc"+e,"time set img.src for page "+e),s.attr("src",t),s.attr("data-loading",!1),n.stopTimer("setSrc"+e),a.logElapsedTime("FSS: rendition ready"),$.Deferred().resolve().promise()}))}var l,d=function(e,t){_.isObject(e)&&(t=e,e=t.url);var n=t.type||"GET",s=i.getWrapper(e,n);if(s)return s(t);if(l)return l(e,t);throw new Error("should not happen")};return{loadRendition:r,loadRenditions:function(e,t){for(var i=[],n=0;n<e.length;n++){var s=e[n],o=r(s,t[s]);i.push(o)}return $.when.apply($,i)},getUISettings:function(){return i.getUISettings()},saveUISettings:function(e){return i.saveUISettings(e)},replaceAjaxFunc:function(){l=$.ajax,$.ajax=d},getBase64ImgDataFromURL:function(e){return i.getBase64ImgDataFromURL(e)},saveSignature:function(e){var t=$.Deferred(),i=e.addToGlobal||!1;e.formID&&delete e.formID;var n=o.isSignedInAndConnected();if(n&&i){var a={};s.saveSignature(e).then(_.bind(function(t){return t&&t.globalAssetID&&(a.globalAssetID=t.globalAssetID),this.saveSignatureInReader(_.extend({noSignUpdate:!0},e))},this)).then(function(e){e&&e.globalAssetID&&(a.desktopAssetID=e.globalAssetID),e&&e.assetID&&(a.assetID=e.assetID),t.resolve(a)}).fail(function(e){t.reject(e)})}else this.saveSignatureInReader(e).then(function(e){t.resolve(e)}).fail(function(e){t.reject(e)});return t.promise()},saveSignatureInReader:function(e){return i.saveSignature(e)},getSignature:function(e,t,n){void 0===n&&(n=!1);var a=o.isSignedInAndConnected();return a&&t&&!n?s.getSignature(e):i.getSignature(e)},deleteSignature:function(e,t){var n=$.Deferred(),a=o.isSignedInAndConnected();if(a&&t.isGlobal){var r=t?t.getSignatureHash(e):null,l=t?t.getSignature(e):null;s.deleteSignature(e).always(function(){r&&l&&l.hasOwnProperty("type")?i.deleteSignatureByHash(r,l.type).then(function(e){n.resolve(e)}).fail(function(){n.resolve({deleted:!1})}):n.resolve({deleted:!1})})}else this.deleteSignatureInReader(e).then(function(e){n.resolve(e)}).fail(function(){n.resolve({deleted:!1})});return n.promise()},deleteSignatureInReader:function(e,t){return i.deleteSignature(e,t)},getGlobalSignatures:function(){return i.getGlobalSignatures()},deleteGlobalSignatures:function(){return i.deleteGlobalSignatures()},cleanImage:function(e,t){return i.cleanImage(e,t)},getToolbarButtonPosition:function(e){return i.getToolbarButtonPosition(e)},checkClientVersion:function(e){return t.Reader.opFactory.create("CheckClientVersion",e).run()},getSessionPrefs:function(){return i.getSessionPrefs()},setSessionPrefs:function(e){return i.setSessionPrefs(e)},openDecoratedUrl:function(e){return i.openDecoratedUrl(e)},signatureSynced:function(e){return i.signatureSynced(e)}}}),define("fss/js/lib/faf-common-api-util",["fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/lib/web/faf-web-api-util","fss/js/lib/reader/faf-reader-api-util"],function(e,t,i,n){var s=t.isDesktop()?n:i;return{initApiUtil:function(){t.isDesktop()&&n.replaceAjaxFunc()},loadRendition:function(e,t){return s.loadRendition(e,t)},loadRenditions:function(e,t){return s.loadRenditions(e,t)},getUISettings:function(){return s.getUISettings()},saveUISettings:function(e){return s.saveUISettings(e)},saveSignature:function(e){return s.saveSignature(e)},getSignature:function(e,t,i){return void 0===i&&(i=!1),s.getSignature(e,t,i)},deleteSignature:function(e,t){return s.deleteSignature(e,t)},getGlobalSignatures:function(){return s.getGlobalSignatures()},deleteGlobalSignatures:function(){return s.deleteGlobalSignatures()},cleanImage:function(e,t){return s.cleanImage(e,t)},getToolbarButtonPosition:function(e){return s.getToolbarButtonPosition(e)},checkClientVersion:function(e){return s.checkClientVersion(e)},getSessionPrefs:function(){return s.getSessionPrefs()},setSessionPrefs:function(e){return s.setSessionPrefs(e)},openDecoratedUrl:function(e){return s.openDecoratedUrl(e)},signatureSynced:function(e){return s.signatureSynced(e)}}}),define("fss/js/ops/reader/flush-to-reader-app-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-common-api-util"],function(e,t){return t.FlushToReaderAppOp=e.Op.extend({run:function(){var e=this.options.saveSettings,i=this.options.fafEditorUiModel,n=$.Deferred();return t._flushAllDirty({closing:this.options.isClosing}).then(_.bind(function(){if(e){{({"current-page":i.get("current_page"),zoom:i.getReaderZoom(),"zoom-type":i.getReaderZoomType(),"dest-left":i.getReaderXOffset(),"dest-top":i.getReaderYOffset()})}return n.resolve({})}n.resolve({})},this)),n.promise()}}),t.FlushToReaderAppOp}),define("fss/js/ops/reader/switching-to-reader-tool-op",["core/ac-core","fss/js/ac-faf","fss/js/data/reader/faf-reader-constants"],function(e,t,i){return t.Reader.SwitchingToReaderToolOp=e.Op.extend({run:function(){var e=i.readerToFssToolName(this.options.eventName);return t.opFactory.create("SwitchingToToolOp",_.extend({toolName:e},this.options)).run()}}),t.Reader.SwitchingToReaderToolOp}),define("fss/js/ops/reader/switching-app-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.Reader.SwitchAppOp=e.Op.extend({run:function(){var e=this;e.defer=$.Deferred();var i=this.options.save||!0,n=this.options.ensureLogin||!1,s=n?t.appApi.sessionApi.ensureSignedIn():$.Deferred().resolve().promise(),o=_.extend({saveSettings:!0,isClosing:!0},this.options),a=i?t.opFactory.create("FlushToReaderAppOp",o).run():$.Deferred().resolve().promise();return $.when(s,a).then(function(){t.appApi.rnaApi.done(e._makeSwitch)}).fail(function(){e.defer.reject()}),e.defer.promise()},_makeSwitch:function(e){var t=this,i=t.options.appString;e.fssApi({methodName:"executeUICommand",methodArgs:[i]}).done(function(){t.defer.resolve()})}}),t.Reader.SwitchAppOp}),define("fss/js/ops/reader/faf-sign-in-op",["core/ac-core","fss/js/ac-faf","fss/js/data/reader/faf-reader-constants","i18n!fss/js/nls/ui-strings"],function(e,t,i,n){return t.Reader.FafSignInOp=e.Op.extend({run:function(){var e=this.options.fafSigninStateModel;return e.get(e.FORCED_OFFLINE)&&e.get(e.REASON)===e.reason.OLD_VERSION?(this.options.appApi.dialogApi.displayHtmlAlert(this.options.appApi.dialogApi.SEVERITY_WARNING,n.UpgradeDialogTitle,n.UpgradeDialogText,n.OK),this._getResolvedPromise()):t.appApi.rnaApi.then(_.bind(function(e){return e.fssApi({methodName:i.EXECUTE_UI_COMMAND,methodArgs:[i.UI_METHOD_ARGS_SIGN_IN]})},this))}}),t.Reader.FafSignInOp}),define("fss/js/ops/reader/check-client-version-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/data/reader/faf-reader-constants","fss/js/lib/faf-ajax-util","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o){return t.Reader.CheckClientVersion=e.Op.extend({run:function(){var e=$.Deferred();if(i.isSignedInAndConnected()){var t={client_version:n.CLIENT_VERSION,client_locale:navigator.language};$.ajax(s.getAjaxOptions("POST","/clientversion",{data:JSON.stringify(t)})).done(_.bind(function(t){var i=!1,n=o.UpgradeDialogTitle,s=o.UpgradeDialogText;if(t&&t.hasOwnProperty("supported")&&(i=!t.supported),t&&t.hasOwnProperty("title")&&(n=t.title),t&&t.hasOwnProperty("message")&&(s=t.message),i&&this.options.appApi.dialogApi.displayHtmlAlert(this.options.appApi.dialogApi.SEVERITY_WARNING,n,s,o.OK),i){var a=this.options.fafSigninStateModel;a.setOffline(a.reason.OLD_VERSION)}e.resolve(i)},this)).fail(_.bind(function(){e.resolve(!1)},this))}else e.resolve(!1);return e.promise()}}),t.Reader.CheckClientVersion}),define("fss/js/ops/signature-sync-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-server-api-util","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s){return t.SignatureSyncOp=e.Op.extend({run:function(){if(t._signatures.signatureSyncPromise)return t._signatures.signatureSyncPromise;var e=$.Deferred();return t._signatures.signatureSyncPromise=e.promise(),this._getCloudSignatures().then(_.bind(function(e){return this.options.cloudSignatures=e,this._syncSignatures()},this)).then(_.bind(function(t){i.logInfo("SignatureSyncOp","Successfully synced all signatures"),e.resolve(t)},this)).fail(_.bind(function(){i.logError("SignatureSyncOp","Error syncing signatures"),e.reject(),delete t._signatures.signatureSyncPromise},this)).always(_.bind(function(){delete this.options.desktopSignatures,delete this.options.cloudSignatures},this)),t._signatures.signatureSyncPromise},_getCloudSignatures:function(){var e=this.options,t=$.Deferred(),n=[],s=e.fafUserDataModel;return s.getUserDataModelPromise().then(_.bind(function(){var e=s.signatureData,o=s.getObject("signature");o?o.value.length>0?e.getAllDataFromServer(o.value).then(_.bind(function(){_.each(Object.keys(e.vals),_.bind(function(t){var i=e.getSignature(t);i.hash=e.getSignatureHash(t).toUpperCase(),n.push(_.extend({},i,{source:"cloud"}))},this)),i.logInfo("SignatureSyncOp","Successfully retrieved cloud signatures"),t.resolve(n)},this)).fail(function(){i.logError("SignatureSyncOp","Error retrieving cloud signatures"),t.reject()}):(i.logInfo("SignatureSyncOp","No cloud signatures to retrieve"),t.resolve(n)):(i.logError("SignatureSyncOp","Error retrieving cloud signatures"),t.reject())},this)).fail(function(){i.logError("SignatureSyncOp","Error retrieving user data"),t.reject()}),t.promise()},_getAllSignatures:function(){return this.options.cloudSignatures},_syncAll:function(e){return this._syncCloud(e)},_syncSignatures:function(){var e=this._getAllSignatures(),t=_.filter(e,function(e){return"initials"===e.type}),n=_.filter(e,function(e){return"signature"===e.type}),o=_.bind(function(){var e=$.Deferred(),o={};return this._maybeShowDialog(n,t.length>1?s.Continue:s.Done,"signature").always(_.bind(function(n){return"cancel"===n?void e.resolve("cancel"):(n&&(o.signature=n),void this._maybeShowDialog(t,s.Done,"initials").always(_.bind(function(t){return"cancel"===t?void e.resolve("cancel"):(t&&(o.initials=t),void this._syncAll(o).then(_.bind(function(){var t=this.options;t.separateSync?(i.logInfo("SignatureSyncOp","Successfully tested for sync"),e.resolve(t.signatureNeedsSync||t.initialsNeedsSync?"needsSync":"done")):(i.logInfo("SignatureSyncOp","Successfully synced all storage"),e.resolve("done"))},this)).fail(function(){i.logError("SignatureSyncOp","Error syncing all storage"),e.reject()}))},this)))},this)),e.promise()},this);return o()},_maybeShowDialog:function(e,t,n){var s=$.Deferred();return 0===e.length?(i.logInfo("SignatureSyncOp","Sync dialog not needed"),s.resolve()):1===e.length?(i.logInfo("SignatureSyncOp","Sync dialog not needed"),s.resolve(e[0])):s.resolve(this.options.cloudSignatures[0].type===n?this.options.cloudSignatures[0]:this.options.cloudSignatures[1]),s.promise()},_syncCloud:function(e){return this._sync(e,"cloud")},_getSyncParams:function(e){return"cloud"===e?{signatures:this.options.cloudSignatures,saveFunction:this._saveToCloud,deleteFunction:this._deleteFromCloud}:(i.logError("SignatureSyncOp","Error getting the sync parameters for "+e),null)},_sync:function(e,t){function n(e,t){var n=$.Deferred();if(a.separateSync&&a[t+"NeedsSync"])return n.resolve().promise();var s=[],o=!1;return s=e?_.filter(r,function(i){return o||i.type!==t||i.hash!==e.hash?i.type===t:(o=!0,!1)}):_.filter(r,function(e){return e.type===t}),d(s).then(function(){i.logInfo("SignatureSyncOp","Successfully deleted signatures"),o||!e?(i.logInfo("SignatureSyncOp","No need to save signature"),n.resolve()):l(e).then(function(){i.logInfo("SignatureSyncOp","Successfully saved signature"),n.resolve()}).fail(function(){i.logError("SignatureSyncOp","Error saving signature"),n.reject()})}).fail(function(){i.logError("SignatureSyncOp","Error deleting signatures"),n.reject()}),n.promise()}var s=this._getSyncParams(t);if(!s)return $.Deferred().reject().promise();var o=$.Deferred(),a=this.options,r=s.signatures,l=s.saveFunction,d=s.deleteFunction,f=n(e.initials,"initials");return f.always(function(){var s=n(e.signature,"signature");s.always(function(){var e=0;"resolved"!==f.state()&&(e++,i.logError("SignatureSyncOp","Error syncing 'initials' in "+t)),"resolved"!==s.state()&&(e++,i.logError("SignatureSyncOp","Error syncing 'signature' in "+t)),0===e?(i.logInfo("SignatureSyncOp","Successfully sync signature in "+t),o.resolve()):1===e?(i.logError("SignatureSyncOp","Error syncing some signature in "+t),o.resolve()):(i.logError("SignatureSyncOp","Error syncing all signature in "+t),o.reject())})}),o.promise()},_deleteFromCloud:function(e){return this._delete(e,"cloud")},_deleteSignature:function(e,t){var n=this.options,s=n.fafUserDataModel;return"cloud"===t&&s?s.removeSignature(e):(i.logError("SignatureSyncOp","Error deleting signature"),$.Deferred().reject().promise())},_delete:function(e,t,n){function s(){return e.length===a?void o.resolve():void r(e[a].assetID,t,n).then(function(){i.logInfo("SignatureSyncOp","Successfully delete signature"),a++,s()}).fail(function(){i.logError("SignatureSyncOp","Error deleting signature"),a++,s()})}var o=$.Deferred(),a=0,r=this._deleteSignature;return s(),o.promise()},_saveToCloud:function(e){return t.opFactory.create("SaveSignatureToCloud",_.extend({sigData:e},this.options)).run()}}),t.Reader.SignatureSyncOp}),define("fss/js/ops/reader/signature-sync-reader-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-util","fss/js/lib/reader/faf-reader-api-util","fss/js/ops/signature-sync-op"],function(e,t,i,n,s,o){return t.Reader.SignatureSyncReaderOp=t.SignatureSyncOp.extend({run:function(){var e=!1;return this.options.eventParams&&this.options.eventParams.forceSync&&(e=this.options.eventParams.forceSync),this.options.fafUserDataModel.getUserDataModelPromise(e).then(_.bind(function(){return this._runEx(e)},this))},_runEx:function(e){if(e&&delete t._signatures.signatureSyncPromise,t._signatures.signatureSyncPromise)return t._signatures.signatureSyncPromise;var o=$.Deferred();if(t._signatures.signatureSyncPromise=o.promise(),!s.isSignedInAndConnected())return i.logInfo("signatureSyncReaderOp","Nothing to sync - User is not logged in"),o.resolve(),t._signatures.signatureSyncPromise;if(!t.Reader.prefs.bSaveFSSignature)return i.logInfo("signatureSyncReaderOp","Nothing to sync - Registry key prevents saving signatures"),o.resolve(),t._signatures.signatureSyncPromise;this.options.desktopSignatures=[],this.options.cloudSignatures=[];var a=t.Reader.opFactory.create("GetDesktopSignaturesOp",this.options).run(),r=this._getCloudSignatures();return a.always(_.bind(function(e){"resolved"===a.state()&&(this.options.desktopSignatures=e),r.always(_.bind(function(e){"resolved"===r.state()&&(this.options.cloudSignatures=e);var l=0,d=this._syncSignatures();d.always(_.bind(function(e){"resolved"!==a.state()&&(l++,i.logError("SignatureSyncReaderOp","Error fetching desktop signatures")),"resolved"!==r.state()&&(l++,i.logError("SignatureSyncReaderOp","Error fetching cloud signatures")),"resolved"!==d.state()&&(l++,i.logError("SignatureSyncReaderOp","Error syncing signatures")),"resolved"===d.state()?(i.logInfo("signatureSyncReaderOp","Successfully synced all the signatures"),o.resolve(e)):(i.logError("SignatureSyncReaderOp","Error syncing signatures"),o.reject(),delete t._signatures.signatureSyncPromise),delete this.options.desktopSignatures,delete this.options.cloudSignatures;var f=n.desktopNativeSignCommand();"sign_menu"===f&&"done"!==e||!t._signatures.signatureSyncPromise||s.signatureSynced()},this))},this))},this)),t._signatures.signatureSyncPromise},_getAllSignatures:function(){return this._mergeSignatures()},_syncAll:function(e){var t=$.Deferred(),n=this._syncCloud(e),s=this._syncDesktop(e);return n.always(_.bind(function(){s.always(_.bind(function(){var e=0;"resolved"!==n.state()&&(e++,i.logError("SignatureSyncReaderOp","Error syncing cloud signature")),"resolved"!==s.state()&&(e++,i.logError("SignatureSyncReaderOp","Error syncing desktop signature")),0===e?(i.logInfo("SignatureSyncReaderOp","Successfully sync all signatures"),t.resolve()):1===e?(i.logError("SignatureSyncReaderOp","Error syncing some signatures"),t.resolve()):(i.logError("SignatureSyncReaderOp","Error syncing signatures"),t.reject())},this))},this)),t.promise()},_mergeSignatures:function(){var e,t,i=this.options,n=i.desktopSignatures,s=i.cloudSignatures,o=s.slice(0);for(e=0;e<n.length;e++){var a=n[e].hash,r=n[e].hash_canvas,l=n[e].type,d=!1;for(t=0;t<s.length;t++)s[t].hash!==a&&s[t].hash!==r||s[t].type!==l||(d=!0);d||o.push(n[e])}return o},_syncDesktop:function(e){return this._sync(e,"desktop")},_getSyncParams:function(e){return"cloud"===e?{signatures:this.options.cloudSignatures,saveFunction:this._saveToCloud,deleteFunction:this._deleteFromCloud}:"desktop"===e?{signatures:this.options.desktopSignatures,saveFunction:this._saveToDesktop,deleteFunction:this._deleteFromDesktop}:(i.logError("SignatureSyncReaderOp","Error getting sync params for "+e),null)},_deleteFromDesktop:function(e){return this._delete(e,"desktop",!0)},_deleteSignature:function(e,t,n){if("cloud"===t){var s=this.options,a=s.fafUserDataModel;return a.removeSignature(e)}return"desktop"===t?o.deleteSignatureInReader(e,n):(i.logError("SignatureSyncReaderOp","Error deleting signature for "+t),$.Deferred().reject().promise())},_saveToDesktop:function(e){var t=$.Deferred();return o.saveSignatureInReader(_.extend({noSignUpdate:!0},e,{addToForm:!1,addToGlobal:!0})).then(function(){i.logInfo("SignatureSyncReaderOp","Successfully saved signature to desktop"),t.resolve()}).fail(function(){i.logError("SignatureSyncReaderOp","Error saving signature to desktop"),t.reject()}),t.promise()}}),t.Reader.SignatureSyncReaderOp}),define("fss/js/ops/reader/get-desktop-signatures-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/reader/faf-reader-api-util","fss/js/ops/reader/op-factory"],function(e,t,i,n){return t.Reader.GetDesktopSignaturesOp=e.Op.extend({run:function(){var e=$.Deferred(),t=100;return setTimeout(_.bind(function(){this.options.fafUserDataModel.getUserDataModelPromise().then(_.bind(function(){this._getDesktopSignatures(e)},this))},this),t,e),e.promise()},_getDesktopSignatures:function(e){function t(){function e(){s.length===n?o>0||0===l?(i.logInfo("GetReaderSignaturesOp","Successfully retrieved desktop signatures"),t.resolve()):(i.logError("GetReaderSignaturesOp","Error retrieving desktop signatures"),t.reject()):r(s[n].url).then(function(e){return s[n].pngData=e.imgData,s[n].hash_canvas=a.getImgHash(e.imgData).toUpperCase(),a.loadImageForSize(e.imgData)}).then(function(t){o++,s[n].imageSize=t.imageSize,n++,e()}).fail(function(){l++,i.logError("GetReaderSignaturesOp","Error retrieving image data for desktop signatures"),s.splice(n,1),e()})}var t=$.Deferred(),n=0,o=0,l=0;return e(),t.promise()}var s=[],o=this.options.fafUserDataModel,a=o?o.signatureData:null;if(!a)return i.logError("GetReaderSignaturesOp","Error retrieving desktop signatures"),e.reject().promise();var r=n.getBase64ImgDataFromURL;n.getGlobalSignatures().then(_.bind(function(e){var i={kind:"image",source:"desktop"};return s=_.map(e,function(e){return _.extend(e,i)}),t()},this)).then(function(){i.logInfo("GetReaderSignaturesOp","Successfully retrieve desktop signatures"),e.resolve(s)}).fail(function(){i.logError("GetReaderSignaturesOp","Error retrieving desktop signatures"),e.reject()})},_syncDesktop:function(e){return this._sync(e,"desktop")},_getSyncParams:function(e){return"cloud"===e?{signatures:this.options.cloudSignatures,saveFunction:this._saveToCloud,deleteFunction:this._deleteFromCloud}:"desktop"===e?{signatures:this.options.desktopSignatures,saveFunction:this._saveToDesktop,deleteFunction:this._deleteFromDesktop}:(i.logError("GetReaderSignaturesOp","Error getting sync params for "+e),null)}}),t.Reader.GetDesktopSignaturesOp}),define("fss/js/lib/faf-signature-util",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-common-util"],function(e,t,i,n,s){return{addImageToCanvas:function(e,t,i,n,s,o,a){var r=new Image;$(r).width(t),$(r).height(i),r.onload=_.bind(function(){var e=o[0],l=e.getContext("2d");l.save(),l.clearRect(0,0,o.width(),o.height()),s="number"!=typeof s?Math.abs((o.width()-t)/2):s,n="number"!=typeof n?Math.abs((o.height()-i)/2):n,l.drawImage(r,s,n),l.restore(),a&&a(o)},this),r.onerror=function(){a&&a()},r.src=e},sigLogAction:function(e,n){var s,o="Create:Sign:"+n.userType+(e?":"+e:""),a=n&&n.cat?o:null;n&&n.addKind&&(o+=":"+i.gaNameFromSigKind(t._signatures.popupUiModel.get("active_kind"))),n&&n.error?(o+=":Error",s=o):s=o+":"+i.gaNameFromSigType(t._signatures.popupUiModel.get("sig_type")||"signature"),n&&n.labelSuffix&&(s+=":"+n.labelSuffix.replace(/ /g,"_")),i.logEvent(a,o,s)},logEvent:function(e,t){var n="Create:Sign:"+t.userType+(e?":"+e:""),s=t&&t.cat?n:null;t&&t.addKind&&(n+=":Imported");var o=n+":";t.error?(n+=":Error",o+="Error:Other"):o+=i.gaNameFromSigType("signature"),i.logEvent(s,n,o)},showSigProgress:function(e){e=e||$("#faf-sig-image-holder"),t.appApi.displayApi.showSpinner(!0,{refElem:e}),t._signatures.popupUiModel.set("progress",!0)},hideSigProgress:function(){var e=t._signatures.popupUiModel;e.get("progress")&&(t._signatures.popupUiModel.set("progress",!1),t.appApi.displayApi.showSpinner(!1))},isESCForWebApp:function(e){return 27===e.which&&!s.isDesktop()}}}),define("fss/js/ops/reader/showing-native-signature-popup-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-log-util","fss/js/lib/faf-signature-util","fss/js/lib/reader/faf-reader-api-caller","fss/js/lib/reader/faf-reader-js-wrapper"],function(e,t,i,n,s,o){return t.Reader.ShowingNativeSignaturePopupOp=e.Op.extend({run:function(){var e=/\/(signature|initials)/,t=e.exec(document.title),i=t&&t.length>1?t[1]:"signature";return this.options.sigType=i,this._deferred=$.Deferred(),this._run(),this._deferred},_run:function(){var e=this.options;_.bindAll(this,"_popupDone"),this._getDocWindowSize().then(_.bind(function(i){this.options.docWindowSize=i;var n={fieldID:null,sigType:e.sigType||"signature",doneFunc:this._popupDone,isReaderNative:!0};t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_SHOW_POPUP,_.extend(n,this.options))},this))},_popupDone:function(e){switch(e.why){case"OK":var t={pngData:e.signature.pngData,addToForm:!1,addToGlobal:e.signature.addToGlobal,native_sign:!0,type:e.signature.type};o.saveSignature(t).then(_.bind(function(){this._tellReader("signDlg",[{action:"OK",type:t.type}])},this)),this._deferred.resolve();break;default:this._tellReader("signDlg",[{action:"cancel"}]),this._deferred.reject()}}}),s.mixin(t.Reader.ShowingNativeSignaturePopupOp),t.Reader.ShowingNativeSignaturePopupOp}),define("fss/js/templates/esign/faf-signature-popup-template",[],function(){return'<div role="dialog" class="faf-sig-dialog sig-mouse-counter ui-theme theme-container"><div class="faf-sig-dialog-head"></div><div role="tabpanel" id="faf-sig-container" class="draw-empty image-empty type-empty sig-mouse-counter"></div><div class="faf-sig-type-style-container"></div><div class="faf-sig-checkbox-group"><div class="faf-sig-save-toggle core-checkbox-checked faf-sig-checkbox" role="checkbox" aria-checked="true" aria-labelledby="faf-sig-checkbox-label" tabindex="0" /><div class="faf-sig-checkbox-label ui-theme theme-text" id="faf-sig-checkbox-label"></div></div><div class="faf-sig-dialog-foot"><div class="faf-sig-dialog-btns"></div><div style="clear:both"></div></div></div>'}),define("fss/js/templates/esign/faf-signature-popup-header-template",[],function(){return['<div role="tablist" class="faf-sig-title-bar ui-theme theme-container"><div role="presentation" class="toolbar-selection-pointer"></div></div>','<button id="faf-sig-<%- cls %>-btn" class="faf-sig-kind-btn" role="tab" tabindex="-1" aria-selected="false" aria-controls="faf-sig-container"data-kind="<%- kind %>"><div class="faf-sig-btn-icon faf-sig-<%- cls %>-btn-icon"></div><span class="faf-sig-btn-label faf-sig-btn-<%- cls %>-label theme-text"><%- label %></span></button>']}),define("fss/js/views/esign/faf-signature-popup-header-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/esign/faf-signature-popup-header-template","fss/js/lib/util","core/utils/css-util","core/utils/view-util"],function(e,t,i,n,s,o){t.FafSignaturePopupHeaderView=e.View.extend({events:{"click   .faf-sig-kind-btn":"_kindBtnClick","keydown .faf-sig-kind-btn":"_kindBtnKeyDown"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i[0]),this._spModel=this.options.fafSignaturePopupUiModel,_.bindAll(this,"_kindBtnClick"),this._addUiModelEventListeners()
},_addUiModelEventListeners:function(){this.listenTo(this._spModel,"change:active_kind",this._positionBar),this.listenTo(this._spModel,"change:signature",this._checkSupport),this.listenTo(this._spModel,"change:cleaning_image change:progress",this._enableButtons),this.listenTo(this._spModel,"add:surface-kind",this._onNewSurfaceKind);var e=t.ViewEvents,i=this.options.dlgView;this.listenTo(i,e.FAF_SIGNATURE_DLG_RESIZED,this._positionBar)},render:function(){return e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({})),this._initWrappers()),this},_initWrappers:function(){this.$bar=this.$el.find(".faf-sig-title-bar"),this.$underline=this.$el.find(".toolbar-selection-pointer")},_onNewSurfaceKind:function(e,t){var n=_.template(i[1],t),s=$(n);this.$bar.append(s),this.$allBtns=this.$el.find(".faf-sig-kind-btn"),this._positionBar()},_kindBtnClick:function(e){if(!this._spModel.get("cleaning_image")){var t=$(e.target).closest(".faf-sig-kind-btn").attr("data-kind");t&&this._spModel.set("active_kind",t)}},_kindBtnKeyDown:function(e){var t,i=!1,n=e.which,s=this.$(":focusable"),a=this.$el;if(!o.descendantHasFocus(a))return i;switch(n){case 37:case 38:i=!0,t=o.getNextFocusableDescendant(a,!0,!0);break;case 39:case 40:i=!0,t=o.getNextFocusableDescendant(a,!1,!0);break;case 35:i=!0,t=s.last();break;case 36:i=!0,t=s.first()}i&&this._consumeEvent(e),t&&t.length>0&&_.defer(function(){t.focus().click()})},_enableButtons:function(e,t){t?this.$allBtns.addClass("disabled").prop("disabled",!0):this.$allBtns.removeClass("disabled").prop("disabled",!1)},_positionBar:function(){var e,t=this._spModel.get("active_kind"),i=this.$el.find("[data-kind="+t+"]"),n=i.length>0&&i[0];for(e=0;e<this.$allBtns.length;e++){var o=$(this.$allBtns[e]);if(o.is(n)){o.css("cursor","default"),o.addClass("faf-sig-active-kind").attr({tabindex:"0","aria-selected":"true"});var a=s.getFullWidth(o);this.$underline.width(o.find(".faf-sig-btn-label").width()),this.$underline.show().css("left",o.position().left+1+(a-this.$underline.width())/2+"px")}else o.css("cursor",""),o.removeClass("faf-sig-active-kind").attr({tabindex:"-1","aria-selected":"false"})}n||this.$underline.hide()}})}),define("fss/js/templates/esign/faf-signature-popup-surface-template",[],function(){return'<div class="faf-sig-area"><div class="faf-sig-draw-guide"><div class="faf-sig-solid-guide"></div><div class="faf-sig-dot-guide"></div><div class="faf-sig-line-guide"></div></div><div class="faf-sig-tag"></div><div id="faf-sig-draw-holder"></div><div id="faf-sig-type-holder"></div><div id="faf-sig-image-holder"></div></div>'}),define("fss/js/templates/esign/faf-signature-popup-surface-type-template",[],function(){return'<input id="faf-sig-type" class="type-canvas" spellcheck="false" autocomplete="off" aria-label="<%- typeYourNamePlaceholder %>"><div class="faf-sig-placeholder-type"><%- typeYourNamePlaceholder %></div><div class="faf-sig-type-width-capture"></div><div class="faf-sig-type-style-margin"></div><button id="faf-sig-type-style" class="faf-sig-type-style faf-sig-action-text" aria-haspopup="true"><%- changeSignatureStyle %></button>'}),define("fss/js/views/esign/faf-signature-popup-surface-child-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-signature-util"],function(e,t,i){t.FafSignaturePopupSurfaceChildView=e.View.extend({initialize:function(){e.View.prototype.initialize.call(this),this._super=t.FafSignaturePopupSurfaceChildView.prototype,this._kindSupported=this.kindSupported(),this._kindSupported&&(this._kindParams=this.kindParams(),this._template=_.template(this._kindParams.template),this._spModel=this.options.fafSignaturePopupUiModel,this._addUiModelEventListeners()),_.bindAll(this,"_keyDown")},_addUiModelEventListeners:function(){this.listenTo(this._spModel,"change:active_kind",this._changeActiveKind),this.listenTo(this._spModel,"change:isSigned",this._onDirectInkUpdate),this.listenTo(this._spModel,"change:activateApply",this._onDirectInkApplyActivate)},_addViewEventListeners:function(){var e=t.ViewEvents,i=this.options.dlgView;this.listenTo(i,e.FAF_SIGNATURE_DLG_WILL_OPEN,this._open),this.listenTo(i,e.FAF_SIGNATURE_DLG_RESIZED,this._resize),this.listenTo(i,e.FAF_SIGNATURE_DLG_WILL_CLOSE,this._close)},render:function(){return this._kindSupported?0===this.$el.children().length&&(this.$el.html(this._template(this._kindParams.templateArgs)),this._initWrappers(),this._renderChildViews(),this._addViewEventListeners(),this._spModel.trigger("add:surface-kind",this._spModel,{kind:this._kindParams.kind,cls:this._kindParams.dlgClass,label:this._kindParams.buttonTemplateArgs.label})):this.$el.remove(),this},_renderChildViews:function(){},_initWrappers:function(){this.$dlg=this.options.$dlg,this.$container=this.options.$container},_open:function(){this.isInitials="initials"===this._spModel.get("sig_type"),this.kindOpen()},_changeActiveKind:function(e,t){var n=this._kindParams.dlgClass;t===this._kindParams.kind?(this.$dlg.addClass(n),this._startListening(),this._spModel.attributes.isDirectInkActivated&&(this._onSilentClearDirectInk(),this.options.appApi.rnaApi.done(function(e){e.sendSignatureToDirectInk("Cancel","0")})),this.kindSet(),i.sigLogAction("Mode",{addKind:!0}),this.kindWantsBackspace()||$(document).on("keydown",this._keyDown)):(this._stopListening(),this.$dlg.removeClass(n),this.kindWantsBackspace()||$(document).off("keydown",this._keyDown))},_startListening:function(){var e=t.ViewEvents,i=this.options;this.listenTo(i.surfaceView,e.FAF_SIGNATURE_CLEAR,this.kindClear),this.listenTo(i.buttonView,e.FAF_SIGNATURE_OK,this._ok)},_stopListening:function(){var e=t.ViewEvents,i=this.options;this.stopListening(i.surfaceView,e.FAF_SIGNATURE_CLEAR),this.stopListening(i.buttonView,e.FAF_SIGNATURE_OK)},_keyDown:function(e){(8===e.which||46===e.which)&&e.preventDefault()},_resize:function(){var e=this.$container.width(),t=this.$container.height();this.kindResize(e,t)},_onDirectInkUpdate:function(){var e={lastMouseEvt:this._spModel.attributes.mouseEvent,tapped:void 0};_.extend(e,this.options),this._spModel.attributes.isBlank||0==this._spModel.attributes.signInfo.length?this._onSilentClearDirectInk():this._direcInkok(e)},_onDirectInkApplyActivate:function(){var e=this._spModel.attributes.activateApply;e?(this.$container.removeClass("draw-empty"),this._spModel.set("save_enabled",e)):this._onSilentClearDirectInk()},_onSilentClearDirectInk:function(){this.$container.addClass("draw-empty"),this._spModel.set("save_enabled",!1),i.sigLogAction("Cleared",{addKind:!0})},_ok:function(e){this._spModel.attributes.isDirectInkActivated?(this.options.appApi.rnaApi.done(function(e){e.sendSignatureToDirectInk("setsign","0")}),this._spModel.attributes.mouseEvent=e.lastMouseEvt,this._spModel.attributes.signatureSaved=!1):this._conventional_ok(e)},_direcInkok:function(e){var i=this._spModel.attributes.signInfo;if(!this._spModel.attributes.signatureSaved){this._spModel.attributes.signatureSaved=!0;var n=this.kind$canvas();if(n){var s={$canvas:n,spModel:this._spModel};this._scribble&&_.extend(s,{scribble:this._scribble(n)}),t.opFactory.create(this.kindTrimOP(),_.extend(s,this.options)).run().then(_.bind(function(t){var n=t.newArea.width,s=t.newArea.height;n=this.$container.width(),s=this.$container.height(),t.imgData=i;var o=this._saveMetadata(t);_.extend(o,{pngData:i,imageSize:{width:n,height:s}});var a={why:"OK",signature:o,lastEvt:e.lastMouseEvt,tapped:e.tapped};this._spModel.set("save_options",a)},this)).fail(_.bind(function(e){this._spModel.set("save_options",{why:e})},this)).always(_.bind(function(){this.kind$CanvasDone(n)},this))}}},_conventional_ok:function(e){var i=this.kind$canvas();if(i){var n={$canvas:i,spModel:this._spModel};this._scribble&&_.extend(n,{scribble:this._scribble(i)}),t.opFactory.create(this.kindTrimOP(),_.extend(n,e)).run().then(_.bind(function(t){var i=this._saveMetadata(t);_.extend(i,{pngData:t.imgData,imageSize:{width:t.newArea.width,height:t.newArea.height}});var n={why:"OK",signature:i,lastEvt:e.lastMouseEvt,tapped:e.tapped};this._spModel.set("save_options",n)},this)).fail(_.bind(function(e){this._spModel.set("save_options",{why:e})},this)).always(_.bind(function(){this.kind$CanvasDone(i)},this))}},_close:function(){this._stopListening(),this.kindWantsBackspace()||$(document).off("keydown",this._keyDown),this.kindClear(),this.kindClose(),this.options.appApi.rnaApi.done(function(e){e.sendSignatureToDirectInk("Cancel","0")})},_saveMetadata:function(e){return _.extend({type:this._spModel.get("sig_type"),kind:this._spModel.get("active_kind"),addToGlobal:this._spModel.get("add_to_global")},this.kindMetadata(e))},kindTemplateArgs:function(){},kindOpen:function(){},kindWantsBackspace:function(){return!1},kindTrimOP:function(){return"TrimmingSignatureCanvasOp"},kindCancel:function(){},kindOK:function(){},kindClose:function(){},kindDlgClss:function(){},kindSet:function(){},kindClear:function(){},kindResize:function(){},kind$Canvas:function(){},kind$CanvasDone:function(e){e.remove()},kindMetadata:function(){}})}),define("fss/js/templates/esign/faf-signature-popup-font-menu-template",[],function(){return'<div role="menu" class="faf-sig-type-style-dropdown core-menu-border"></div><div class="faf-sig-type-style-nub menu-nub-grey"></div>'}),define("fss/js/views/esign/faf-signature-popup-font-menu-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/esign/faf-signature-popup-font-menu-template","fss/js/lib/faf-signature-util","fss/js/lib/faf-common-util","i18n!fss/js/nls/ui-strings","core/utils/view-util"],function(e,t,i,n,s,o,a){t.FafSignaturePopupFontMenuView=e.View.extend({options:{triggerEl:null},events:{"click .faf-sig-font-style-items":"_onStyleSelect","mouseover .faf-sig-font-style-items":"_onMenuItemMouseOver"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i),this._spModel=this.options.fafSignaturePopupUiModel,_.bindAll(this,"_escToStyleMenu","_maybeHideFontStyler"),this._addUiModelEventListeners()},_addUiModelEventListeners:function(){},_addViewEventListeners:function(){var e=t.ViewEvents,i=this.options.dlgView,n=this.options.typeView;this.listenTo(i,e.FAF_SIGNATURE_DLG_WILL_CLOSE,this._close),this.listenTo(i,e.FAF_SIGNATURE_DLG_RESIZED,this._resize),this.listenTo(n,e.FAF_SIGNATURE_TOGGLE_FONT_MENU,this._toggleFontMenu),$(document).bind("keydown",this._onSigKeyDown),this._addKeyEventListener(),this._addFocusEventListener()},render:function(){return 0===this.$el.children().length&&(this.$el.html(this._template({})),this._initWrappers(),this._addViewEventListeners()),this},_initWrappers:function(){this.$nub=$(".faf-sig-type-style-nub"),this.$dropdown=$(".faf-sig-type-style-dropdown"),this.$button=$(".faf-sig-type-style");var e=this._spModel.get("available_fonts");_.each(e,_.bind(function(e){var t=$('<div role="menuitemradio" tabindex="-1" class="faf-sig-font-style-items theme-hoverable"></div>');this.$dropdown.append(t),t.css("font-family",e).attr({"data-font":e,title:e})},this)),this.$items=$(".faf-sig-font-style-items"),$(".sig-type-menuitem").click(_.bind(function(e){1===e.which&&this._spModel.set("font_family",$(e.target).text())},this))},_toggleFontMenu:function(){if(this._styleMenuShowing())this._hideStyleMenu();else{var e=$("#faf-sig-type").val(),t="div[data-font='"+this._spModel.get("font_family")+"']";e||(e="initials"===this._spModel.get("sig_type")?o.ToolBarAddInitials:o.ToolBarAddSign),this.$items.text(e).removeClass("disabled").attr({"aria-checked":"false",tabindex:"-1"}),$(t).addClass("disabled").attr({"aria-checked":"true",tabindex:"0"}),this._showStyleMenu(),this._adjustFontStyler()}},_onSigKeyDown:function(e){n.isESCForWebApp(e)&&this._styleMenuShowing()&&(this._escToStyleMenu(),this._consumeEvent(e))},_resize:function(){this._adjustFontStyler()},_close:function(){this._hideStyleMenu()},_adjustFontStyler:function(){if("none"!==this.$dropdown.css("display")){var e=this.$button.offset(),t=e.top,i=e.left;this.$nub.offset({top:t+10,left:i+this.$button.width()-1}),this.$dropdown.offset({top:t+32,left:i})}},_maybeHideFontStyler:function(e){this.$dropdown.is(e.target)||0!==this.$dropdown.has(e.target).length||this._hideStyleMenu()},_showStyleMenu:function(){var e=this.options;this._styleMenuShowing()||(!e.triggerEl&&$(document.activeElement).not("body").length&&(e.triggerEl=document.activeElement),this.$dropdown.show(),this.$nub.show(),$(document).bind("mouseup",this._maybeHideFontStyler),s.onExternalEsc(this._escToStyleMenu),_.defer(_.bind(function(){this.$el.find(":tabbable").first().focus()},this)))},_hideStyleMenu:function(){var e,t=this.options;this._styleMenuShowing()&&(t.triggerEl&&$(t.triggerEl).is(":focusable")&&(e=$(document.activeElement),(1===e.closest(this.$el).length||0===e.not("body").length)&&$(t.triggerEl).focus()),s.offExternalEsc(this._escToStyleMenu),$(document).unbind("mouseup",this._maybeHideFontStyler),this.$nub.hide(),this.$dropdown.hide())},_styleMenuShowing:function(){return"none"!==this.$dropdown.css("display")},_onStyleSelect:function(e){$(e.target).hasClass("disabled")||(this._spModel.set("font_family",$(e.target).attr("data-font")),this._hideStyleMenu())},_escToStyleMenu:function(){this._hideStyleMenu()},_onKeyDown:function(e){var t,i=!1,n=e.which,s=$(e.target),o=this.$(":focusable"),r=this.$el;if(!a.descendantHasFocus(this.$el))return i;switch(this._focusTimeout&&clearTimeout(this._focusTimeout),n){case 9:i=!0;break;case 13:case 32:i=!0,s.click();break;case 27:i=!0,this._close();break;case 37:case 38:i=!0,t=a.getNextFocusableDescendant(r,!0,!0),t&&0!==t.length||this._close();break;case 39:case 40:i=!0,t=a.getNextFocusableDescendant(r,!1,!0);break;case 35:i=!0,t=o.last();break;case 36:i=!0,t=o.first()}return i&&this._consumeEvent(e),t&&t.length>0&&_.defer(function(){t.focus()}),i},_onFocusIn:function(e){var t=$(e.target);return this._focusTimeout&&clearTimeout(this._focusTimeout),t.attr("tabindex","0"),!0},_onFocusOut:function(e){var t=$(e.target),i=this;return _.defer(function(){a.descendantHasFocus(i.$el)?t.attr("tabindex","-1"):t.attr("tabindex","0"),t.siblings(":tabbable").length||t.attr("tabindex","0")}),this._focusTimeout&&clearTimeout(this._focusTimeout),this._focusTimeout=_.delay(function(){a.descendantHasFocus(i.$el)||i._close()},300),!0},_onMenuItemMouseOver:function(e){0===$(document.activeElement).closest(e.currentTarget).length&&$(e.currentTarget).focus()}})}),define("fss/js/views/esign/faf-signature-popup-surface-type-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/esign/faf-signature-popup-surface-type-template","fss/js/lib/util","fss/js/lib/faf-signature-util","i18n!fss/js/nls/ui-strings","fss/js/views/esign/faf-signature-popup-surface-child-view","fss/js/views/esign/faf-signature-popup-font-menu-view"],function(e,t,i,n,s,o){var a=.36;t.FafSignaturePopupSurfaceTypeView=t.FafSignaturePopupSurfaceChildView.extend({events:{"click      .faf-sig-type-style":"_onStyleChangeClick","keydown    .faf-sig-type-style":"_onStyleChangeKeyDown"},initialize:function(){_.bindAll(this,"_onSigTextChange"),t.FafSignaturePopupSurfaceChildView.prototype.initialize.call(this)},_addUiModelEventListeners:function(){this._super._addUiModelEventListeners.call(this),this.listenTo(this._spModel,"change:signature",this._changeSig),this.listenTo(this._spModel,"change:font_family",this._setFont)},_renderChildViews:function(){var e=_.extend(this.options,{typeView:this});this.fontMenuView=this._renderChildView("_fafSigFontMenuView",this._fontMenuViewClass(),this.$dlg.find(".faf-sig-type-style-container"),e)},_fontMenuViewClass:function(){return t.FafSignaturePopupFontMenuView},_initWrappers:function(){this._super._initWrappers.call(this),this.$type=this.$el.find("#faf-sig-type"),this.$image=this.$el.find("#faf-sig-image"),this.$phType=this.$el.find(".faf-sig-placeholder-type"),this.$styleButton=this.$el.find(".faf-sig-type-style"),this.$fmMargin=this.$el.find(".faf-sig-type-style-margin"),this._spModel.set({$type:this.$type},{silent:!0}),this.$type.bind("textchange",this._onSigTextChange)},kindSupported:function(){return n.supportsWebFonts()},kindParams:function(){return{kind:"input",dlgClass:"type",template:i,templateArgs:{changeSignatureStyle:o.changeSignatureStyle,typeYourNamePlaceholder:o.typeYourNamePlaceholder},buttonTemplateArgs:{label:o.typeSignatureButtonLabel}}},kindWantsBackspace:function(){return!0},kindOpen:function(){this.$phType.text(this.isInitials?o.typeYourInitialsPlaceholder:o.typeYourNamePlaceholder),$(document).bind("keydown",this._onSigKeyDown),this.$type.css("font-family",this._spModel.get("font_family"))},kindClose:function(){this.kindClear(),$(document).unbind("keydown",this._onSigKeyDown)},kindSet:function(){this._checkTypeEmpty(!0),this._focus()},kindClear:function(){this.$type.val(""),this._focus(),this.$container.addClass("type-empty")},kindResize:function(e,t){var i=this.$type;if(i.width()!==e||i.height()!==t){var s=.12;if(i.width(e).height(t).css("text-indent",this.isInitials?40:100).css("font-size",t*a),this.$phType.css("font-size",Math.min(36,t*s)),n.isIE10()){var o=$("#faf-sig-type");o.val(o.val())}var r=this.$styleButton.position();this.$fmMargin.css("left",r.left-10+"px"),this.$fmMargin.css("top",r.top-5+"px"),this.$fmMargin.width(this.$styleButton.width()+26),this.$fmMargin.height(this.$styleButton.height()+4)}},kind$canvas:function(){var e=this.$type;if(!e.val()&&!t._signatures.popupUiModel.get("isDirectInkActivated"))return void n.logErrorAndToSplunk("FafSignaturePopupSurfaceTypeView","Asked for signature when blank!");var i=300,s=i*a,o=n.sizeOfTextArea(e,{maxWidth:3e3,comfortZone:45,force:!0,forceFontSize:s});o.width*=1.5,o.height=i;var r=this.options.FormCanvas.$baseCanvas(o.width,o.height);r.css({position:"absolute",left:"-9999px",top:"-9999px"}),e.after(r);var l=r[0].getContext("2d");l.font=s+"px "+e.css("font-family");var d=.64*o.height;return l.fillText(e.val(),s/2,d),r},kindMetadata:function(){var e=this.$type,t=e.css("font-family");return t.indexOf(",")>=0&&(t=t.substring(0,t.indexOf(","))),{font:t,text:e.val(),size:e.css("font-size")}},_changeSig:function(e,t){t&&"input"===t.kind&&(t.style&&this._spModel.set("font_family",t.style),this.$type.val(t.text),this._checkTypeEmpty())},_enableDisableSaveButton:function(e){var t=this._spModel,i=t.get("active_kind");"input"===i&&this._checkTypeEmpty(e)},_onSigKeyDown:function(){this._checkTypeEmpty()},_onSigTextChange:function(e,t){!t&&this.$type.val()&&s.sigLogAction("2-Signed",{addKind:!0,cat:!0}),this._checkTypeEmpty()},_checkTypeEmpty:function(e){"input"===this.options.fafSignaturePopupUiModel.get("active_kind")&&($("#faf-sig-type").val().trim()?this._enableTypeButtons():e?this._addValueIfTypeEmpty():this._disableTypeButtons())},_addValueIfTypeEmpty:function(){var e=this.options.fafUserDataModel;if("pending"===e.getUserDataModelPromise().state())this._spModel.set("name_timeout",_.delay(_.bind(function(){this._addValueIfTypeEmpty()},this),200));else{var t=$("#faf-sig-type");if(t.val().trim())return void this._enableTypeButtons();var i=e.getFieldText("name.first_name")||"",n=e.getFieldText("name.last_name")||"",s="";if(this.isInitials)s=this._useJapaneseMethod()?n:i.charAt(0)+" "+n.charAt(0);else{if(this._useJapaneseMethod()){var o=n;n=i,i=o}s=i+" "+n}s.trim()?(t.val(s),this._enableTypeButtons()):this._disableTypeButtons()}},_useJapaneseMethod:function(){return"ja-jp"===this.options.appApi.localeApi.getLocale()},_disableTypeButtons:function(){"input"===this._spModel.get("active_kind")&&(this._spModel.set("save_enabled",!1),this.$container.addClass("type-empty"))},_enableTypeButtons:function(){"input"===this._spModel.get("active_kind")&&(this._spModel.set("save_enabled",!0),this.$container.removeClass("type-empty"))},_onStyleChangeClick:function(e){1===e.which&&(this._consumeEvent(e),this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_TOGGLE_FONT_MENU))},_onStyleChangeKeyDown:function(e){var i=e.which;switch(i){case 40:this._consumeEvent(e),this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_TOGGLE_FONT_MENU);break;case 13:case 32:e.stopPropagation()}},_setFont:function(e,t){this.$type.css("font-family",t),this._focus()},_focus:function(){return _.defer(_.bind(function(){this.$type.focus()},this)),this}})}),define("fss/js/templates/esign/faf-signature-popup-surface-draw-template",[],function(){return'<div id="faf-sig-placeholder-draw"> <%- signHerePlaceholder %> </div><canvas id="faf-sig-draw" class="scribble-canvas"></canvas><button id="faf-sig-clear-draw" class="faf-sig-clear faf-sig-action-text theme-hyperlink"><%- clearDraw %></button>'}),define("fss/js/views/esign/faf-signature-popup-surface-draw-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/esign/faf-signature-popup-surface-draw-template","fss/js/lib/util","fss/js/lib/faf-signature-util","dc-scribble-capture","dc-scribble-utils","i18n!fss/js/nls/ui-strings","fss/js/views/esign/faf-signature-popup-surface-child-view"],function(e,t,i,n,s,o,a,r){var l="dcscribble";t.FafSignaturePopupSurfaceDrawView=t.FafSignaturePopupSurfaceChildView.extend({initialize:function(){t.FafSignaturePopupSurfaceChildView.prototype.initialize.call(this)},_initWrappers:function(){this._super._initWrappers.call(this),this.$draw=this.$el.find("#faf-sig-draw"),this.$phDraw=$("#faf-sig-placeholder-draw")},kindTrimOP:function(){return"GetScribbleImageDataOp"},kindSupported:function(){return n.supportsCanvas()},kindParams:function(){return{kind:"scribble",dlgClass:"draw",template:i,templateArgs:{clearDraw:r.Clear,signHerePlaceholder:r.signHerePlaceholder},buttonTemplateArgs:{label:r.drawSignatureButtonLabel}}},kindOpen:function(){this.$phDraw.text(this.isInitials?r.initialsHerePlaceholder:r.signHerePlaceholder),this._enableDisableSaveButton()},kindClose:function(){this.$draw.unbind({mousedown:this._checkNonEmptyCanvas,mousemove:this._checkNonEmptyCanvas})},kindSet:function(){this._spModel.get("scribble_initialized")||(this._spModel.set("scribble_initialized",!0),this._resetScribble(this.$draw),this.$draw.bind({mousedown:this._checkNonEmptyCanvas.bind(this),mousemove:this._checkNonEmptyCanvas.bind(this)})),this._createDirectInkingCanvas(),this._enableDisableSaveButton(!0)},kindClear:function(){var e=this._scribble(this.$draw);e&&(e.clear(),this.$container.addClass("draw-empty")),this._spModel.set("save_enabled",!1),s.sigLogAction("Cleared",{addKind:!0}),this.options.appApi.rnaApi.done(function(e){e.sendSignatureToDirectInk("Clear","0")})},kindResize:function(e,i){var s=this.$draw;if(s.width()!==e||s.height()!==i||!s.attr("width")){var o=.15,r=this.isInitials?"31%":"15%",l=1;"fi-fi"===t.appApi.localeApi.getLocale()&&(l=1.25),this.$phDraw.css({"font-size":e*(o/l),bottom:r});var d=this._scribble(s);d&&(d.intent=this.isInitials?a.INTENT_INITIALS:a.INTENT_SIGNATURE,i?(i%1!==0&&(n.logErrorAndToSplunk("AcFaf.FafSignaturePopupSurfaceDrawView: kindResize (height: "+i+")"),i=Math.ceil(i)),d.height=i):e?(n.logErrorAndToSplunk("AcFaf.FafSignaturePopupSurfaceDrawView: kindResize (width: "+e+")"),e%1!==0&&(e=Math.ceil(e)),d.width=e):n.logErrorAndToSplunk("AcFaf.FafSignaturePopupSurfaceDrawView: kindResize Error (width: "+e+", height: "+i+")"))}this._createDirectInkingCanvas()},kind$canvas:function(){return this._spModel.get("scribble_blank")?void n.logErrorAndToSplunk("FafSignaturePopupSurfaceDrawView","Asked for signature when blank!"):this.$draw},kind$CanvasDone:function(){},kindMetadata:function(){},_checkNonEmptyCanvas:function(e){if(!this._spModel.attributes.isDirectInkActivated&&this.$container.hasClass("draw-empty")){var t=e.type;"mousedown"===t||"touchstart"===t?1===e.which&&this._spModel.set("scribble_mouse_down",!0):this._spModel.get("scribble_mouse_down")&&("mousemove"!==t?n.logWarn("sign","Getting mouse event we didn't ask for"):(this.$container.removeClass("draw-empty"),this._spModel.set("save_enabled",!0),this._spModel.set("scribble_mouse_down",!1),s.sigLogAction("2-Signed",{addKind:!0,cat:!0})))}},_enableDisableSaveButton:function(){var e=this._spModel,t=e.get("active_kind");if("scribble"===t){var i=!this._scribbleBlank(this.$draw)||!this.$container.hasClass("draw-empty");e.set("save_enabled",i)}},_scribble:function(e){return e.data(l)},_scribbleBlank:function(e){var t=this._scribble(e);return t?t.isEmpty():!0},_resetScribble:function(e){var t=this._scribble(e);t||(e.data(l,new o(e[0])),t=this._scribble(e),t.penWidthRatio=.018),t.intent=this.isInitials?a.INTENT_INITIALS:a.INTENT_SIGNATURE;var i=this.$container.height(),s=this.$container.width();return i?(i%1!==0&&(n.logErrorAndToSplunk("AcFaf.FafSignaturePopupSurfaceDrawView: _resetScribble (height: "+i+")"),i=Math.ceil(i)),t.height=i):s?(n.logErrorAndToSplunk("AcFaf.FafSignaturePopupSurfaceDrawView: _resetScribble (width: "+s+")"),s%1!==0&&(s=Math.ceil(s)),t.width=s):n.logErrorAndToSplunk("AcFaf.FafSignaturePopupSurfaceDrawView: _resetScribble Error (width: "+s+", height: "+i+")"),t},_calculateCanvasDimensions:function(){var e=Math.floor(this.$draw.width()).toString();return e+="+",e+=Math.floor(.65*this.$draw.height()).toString(),e+="+",e+=Math.floor(this.$draw.offset().left).toString(),e+="+",e+=Math.floor(this.$draw.offset().top).toString(),e+="+",e+=window.devicePixelRatio.toString()},_resetDirectInkingVariables:function(){this._spModel.attributes.isDirectInkActivated=!1,this._spModel.attributes.isBlank=!1,this._spModel.attributes.isSigned=!0,this._spModel.attributes.signInfo="",this._spModel.attributes.activateApply=!1,this._spModel.attributes.signatureSaved=!0},_createDirectInkingCanvas:function(){var e;if(0!==this.$draw.width()&&0!==this.$draw.height()&&0!==this.$draw.offset().left&&0!==this.$draw.offset().top){e=this._calculateCanvasDimensions();this._resetDirectInkingVariables(),this._spModel.set("isDirectInkActivated",!1)}}})}),define("fss/js/templates/esign/faf-signature-popup-surface-image-template",[],function(){return'<button id="faf-sig-placeholder-image" class="theme-hyperlink"><%- importSignaturePlaceholder %> </button><input type="file" id="faf-sig-image-select" /><canvas id="faf-sig-image" class="image-canvas"></canvas><canvas id="faf-sig-image-downsample" class="image-canvas"></canvas><button id="faf-sig-clear-import" class="faf-sig-clear faf-sig-action-text theme-hyperlink"><%- clearImport %></button>'}),define("fss/js/views/esign/faf-signature-popup-surface-image-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/templates/esign/faf-signature-popup-surface-image-template","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/faf-common-util","fss/js/lib/faf-common-api-util","fss/js/lib/faf-signature-util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings","fss/js/views/esign/faf-signature-popup-surface-child-view"],function(e,t,i,n,s,o,a,r,l,d,f){t.FafSignaturePopupSurfaceImageView=t.FafSignaturePopupSurfaceChildView.extend({events:{"change     #faf-sig-image-select":"_onSigImageSelect","click      #faf-sig-placeholder-image":"_onImageImport"},initialize:function(){t.FafSignaturePopupSurfaceChildView.prototype.initialize.call(this)},_renderChildViews:function(){},_initWrappers:function(){if(this._super._initWrappers.call(this),this.$image=this.$el.find("#faf-sig-image"),this._spModel.get("cleaning_image")){var e=$("#faf-sig-image-holder");t.appApi.displayApi.showSpinner(!0,{refElem:e}),$("#faf-sig-save").addClass("disabled")}},kindSupported:function(){return s.supportsCanvas()&&s.supportsFileUpload()},kindParams:function(){return{kind:"image",dlgClass:"img",template:n,templateArgs:{clearImport:f.Clear,importSignaturePlaceholder:f.importSignaturePlaceholder},buttonTemplateArgs:{label:f.importSignatureButtonLabel}}},kindClose:function(){this._cancelImport()},kindSet:function(){this._enableDisableSaveButton(!0),this._spModel.set("popupLoading",!1),this.$dlg.addClass("img"),l.sigLogAction("Mode",{addKind:!0})},kindClear:function(){this.$image[0].getContext("2d").clearRect(0,0,this.$image.width(),this.$image.height()),this.$container.addClass("image-empty"),delete this._imageData,this._enableDisableSaveButton(!1)},kindResize:function(e,t){var i=this.$image;(i.width()!==e||i.height()!==t)&&i.width(e).height(t).attr("width",e).attr("height",t).prop("width",e).prop("height",t),this._imageData&&this._addImageAfterScaling(this._imageData)},kind$canvas:function(){return this.$image},kind$CanvasDone:function(){},kindMetadata:function(){},_enableDisableSaveButton:function(e){var t=this._spModel,i=t.get("active_kind");if("image"===i){var n=!1;this.$container.hasClass("image-empty")?e&&!t.get("popupLoading")&&$("#faf-sig-placeholder-image").click():n=!0,this._spModel.set("save_enabled",n)}},_onImageImport:function(){var e={fileInputElement:$("#faf-sig-image-select"),maxSize:i.MAX_FILE_SIZE_SIGNATURE};a.importImage(e).done(_.bind(function(e){if(e&&e.imgData){if("cancel"===e.imgData)return;if("sizeError"===e.imgData)return void this._showImageErrorGuide("UnsupportedFileSize");if("undefined"===e.imgData)return void this._showImageErrorGuide("UnsupportedFile");this._addImageAfterScaling(e.imgData).then(_.bind(function(){this._spModel.set("save_enabled",!0)},this)).fail(_.bind(function(){this._showImageErrorGuide("CorruptedFile")},this))}},this))},_cancelImport:function(){this._spModel.get("cleaning_image")&&(this._spModel.set("imageCleanSessionID","none"),this._spModel.set("cleaning_image",!1),l.hideSigProgress())},_onSigImageSelect:function(){if(this._spModel.set("active_kind","image"),!this._spModel.get("cleaning_image")){var e=$("#faf-sig-image-select")[0],t=e.files?_.clone(e.files):[];if(t.length&&window.FileReader){s.logToSplunk("FAS_import_imagetype="+t[0].type);var i=$("#faf-sig-image-select");i.wrap("<form>").parent("form")[0].reset(),i.unwrap();var n="MSIE"===s.browserAndVersion()[0]?5:10;if(t[0].size/1024/1024>n)return void this._showImageErrorGuide("UnsupportedFileSize");if(this._isImageTypeSupported(t[0].type)){var o=new FileReader;o.readAsDataURL(t[0]),o.onloadend=_.bind(function(){var e=$("#faf-sig-image-downsample");this.options.FormCanvas.addImageAfterScaling(o.result,e,{rescaleCanvas:!0,scaleToMax:!1,center:!1}).then(this._cleanImage).fail(_.bind(function(){this._showImageErrorGuide("CorruptedFile")},this))},this),o.onerror=_.bind(function(){this._showImageErrorGuide("CorruptedFile"),s.logWarn("sign","Failed to read in uploaded image")},this)}else this._showImageErrorGuide("UnsupportedFile")}}},_isImageTypeSupported:function(e){return/^image\/tiff/.test(e)||!/^image/.test(e)?!1:!0},_addImageAfterScaling:function(e){var t=$.Deferred();return this.$image.css("height","100%").css("width","100%"),e=s.normalizeImageSrc(e),this.options.FormCanvas.addImageAfterScaling(e,this.$image,{center:!0,maxDim:{width:this.$image.width(),height:this.$image.height()},rescaleCanvas:!0}).then(_.bind(function(){this._imageData=e,this.$container.removeClass("image-empty"),l.logEvent("2-Signed",{addKind:!0,cat:!0}),t.resolve()},this)).fail(function(){t.reject()}),t.promise()},_cleanImage:function(e){l.showSigProgress(this.$image);var t=String((new Date).getTime());this._spModel.set("cleaning_image",!0),this._spModel.set("imageCleanSessionID",t);var i=e.toDataURL().replace(/^data:image\/png;base64,/g,"");r.cleanImage(i,t).done(_.bind(function(e){var t=this._spModel.get("imageCleanSessionID");t===e.cleanupSessionID&&(this._addImageAfterScaling(e.imgData),this._spModel.set("save_enabled",!0))},this)).fail(_.bind(function(e){s.logError("CleanImageOp","Error cleaning signature: "+e),this.$dlg.addClass("take-behind-alert"),o.defaultErrorHandler(null,_.bind(function(){this.$dlg.removeClass("take-behind-alert")},this)),l.logEvent(null,{addKind:!0,error:!0,userType:this.options.userType})},this)).always(_.bind(function(){l.hideSigProgress(),this._spModel.set("cleaning_image",!1)},this))},_showImageErrorGuide:function(e){var t="MSIE"===s.browserAndVersion()[0]?5:10;a.isDesktop()&&(t=i.MAX_FILE_SIZE_SIGNATURE/1048576);var n="MSIE"===s.browserAndVersion()[0]?1e3:100,o={guideType:"faf-error",parent:$(".faf-sig-btn-img-label"),top:57,left:"auto",width:240,arrow:"up",arrowPosition:5,duration:5e3};
this._adjustErrorGuideOptions(o);var r={addKind:!0,error:!0,userType:this.options.userType};"UnsupportedFileSize"===e?(_.extend(o,{text:_.template(f.LargeSignatureImage,{sizeLimit:t})}),r.labelSuffix="UnsupportedFileSize",l.sigLogAction(null,r)):"CorruptedFile"===e?(_.extend(o,{text:f.CorruptedFile}),r.labelSuffix="CorruptedFile",l.sigLogAction(null,r)):(_.extend(o,{text:f.InvalidImage}),r.labelSuffix="UnsupportedFile",l.sigLogAction(null,r)),setTimeout(function(){d.showGuide(o)},n)},_adjustErrorGuideOptions:function(){}})}),define("fss/js/views/esign/faf-signature-popup-surface-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/esign/faf-signature-popup-surface-template","fss/js/views/esign/faf-signature-popup-surface-type-view","fss/js/views/esign/faf-signature-popup-surface-draw-view","fss/js/views/esign/faf-signature-popup-surface-image-view"],function(e,t,i){t.FafSignaturePopupSurfaceView=e.View.extend({events:{"click      .faf-sig-clear":"_onSigClear"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i),this._spModel=this.options.fafSignaturePopupUiModel,this._addUiModelEventListeners()},_addUiModelEventListeners:function(){},_addViewEventListeners:function(){var e=t.ViewEvents,i=this.options.dlgView;this.listenTo(i,e.FAF_SIGNATURE_DLG_WILL_OPEN,this._open),this.listenTo(i,e.FAF_SIGNATURE_DLG_WILL_CLOSE,this._close)},render:function(){return 0===this.$el.children().length&&(this.$el.html(this._template({})),this._initWrappers(),this._renderChildViews(),this._addViewEventListeners()),this},_renderChildViews:function(){var e=_.extend(this.options,{surfaceView:this}),t=this._surfaceViewClasses();this._renderChildView("_fafSigSurfaceTypeView",t.type,this.$el.find("#faf-sig-type-holder"),e),this._renderChildView("_fafSigSurfaceDrawView",t.draw,this.$el.find("#faf-sig-draw-holder"),e),this._renderChildView("_fafSigSurfaceImageView",t.image,this.$el.find("#faf-sig-image-holder"),e)},_surfaceViewClasses:function(){return{type:t.FafSignaturePopupSurfaceTypeView,draw:t.FafSignaturePopupSurfaceDrawView,image:t.FafSignaturePopupSurfaceImageView}},_initWrappers:function(){this.$dlg=this.options.$dlg,this.$container=this.options.$container},_open:function(){this.isInitials="initials"===this._spModel.get("sig_type")},_close:function(){},_onSigClear:function(e){if(e){if(1!==e.which)return;this._consumeEvent(e)}this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_CLEAR)}})}),define("fss/js/templates/esign/faf-signature-popup-button-template",[],function(){return'<div class="faf-sig-dialog-btns"><button id="faf-sig-cancel" class="control-button dialog-control-button button-grey ui-theme theme-text"><%- cancel %></button><button id="faf-sig-save" class="control-button dialog-control-button theme-button theme-button-label disabled"><%- apply %></button></div>'}),define("fss/js/views/esign/faf-signature-popup-button-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/esign/faf-signature-popup-button-template","fss/js/lib/faf-signature-util","i18n!fss/js/nls/ui-strings","fss/js/lib/util","fss/js/views/faf-view-events"],function(e,t,i,n,s,o){t.FafSignaturePopupButtonView=e.View.extend({events:{"click      #faf-sig-cancel":"_onSigCancel","click      #faf-sig-save":"_onSigSave","touchstart #faf-sig-save":"_onSigSaveTouchStart","pointerdown #faf-sig-save":"_onSigSaveTouchStart"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i),this._spModel=this.options.fafSignaturePopupUiModel,this._addUiModelEventListeners()},_addUiModelEventListeners:function(){this.listenTo(this._spModel,"change:cleaning_image change:progress change:save_enabled",this._enableButtons);var e=t.ViewEvents,i=this.options.dlgView;this.listenTo(i,e.FAF_SIGNATURE_DLG_WILL_OPEN,this._onOpen),this.listenTo(i,e.FAF_SIGNATURE_DLG_WILL_CLOSE,this._onClose)},render:function(){return e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({apply:s.Apply,cancel:s.Cancel})),this._initWrappers()),this},_initWrappers:function(){this.$saveBtn=this.$el.find("#faf-sig-save"),this.$cancelBtn=this.$el.find("#faf-sig-cancel"),this.$allBtns=this.$el.find(".dialog-control-button")},_enableButtons:function(){var e=this._spModel.get("cleaningImage"),t=this._spModel.get("progress"),i=this._spModel.get("save_enabled");e||t?this.$allBtns.addClass("disabled").prop("disabled","true"):(this.$cancelBtn.removeClass("disabled").removeProp("disabled"),i?this.$saveBtn.removeClass("disabled").removeProp("disabled"):this.$saveBtn.addClass("disabled").prop("disabled","true"))},_onOpen:function(){$(document).bind("keydown",this._onSigKeyDown),$(document).bind("mousemove",this._onMouseMove)},_onClose:function(){$(document).unbind("keydown",this._onSigKeyDown),$(document).unbind("mousemove",this._onMouseMove)},_onSigSaveTouchStart:function(){o.isIEPointerNotTouchEvent(event)||(this._touchStartTime=(new Date).getTime())},_onMouseMove:function(e){this.lastMouseEvt=e},_onSigKeyDown:function(e){n.isESCForWebApp(e)&&(this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_CANCEL),this._consumeEvent(e)),13===e.which&&(this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_OK),this._consumeEvent(e))},_onSigCancel:function(e){e&&1!==e.which||this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_CANCEL)},_onSigSave:function(e){if(this._spModel.get("save_enabled")){var i=this._touchStartTime&&(new Date).getTime()-this._touchStartTime<500,n=this.lastMouseEvt;if(n){var s=$(n.target).offset();n.offsetX+=s.left,n.offsetY+=s.top,n.offsetY&&n.offsetX||(n.offsetX=n.pageX,n.offsetY=n.pageY)}e&&1!==e.which||this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_OK,{lastMouseEvt:n,tapped:i})}}})}),define("fss/js/views/esign/faf-signature-popup-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/templates/esign/faf-signature-popup-template","fss/js/lib/util","core/utils/util","core/utils/css-util","core/utils/view-util","fss/js/lib/faf-common-util","fss/js/lib/faf-common-api-util","fss/js/lib/faf-ajax-util","fss/js/lib/faf-signature-util","fss/js/lib/utilUI","dc-scribble-capture","dc-scribble-utils","i18n!fss/js/nls/ui-strings","fss/js/views/esign/faf-signature-popup-header-view","fss/js/views/esign/faf-signature-popup-surface-view","fss/js/views/esign/faf-signature-popup-button-view"],function(e,t,i,n,s,o,a,r,l,d,f,c,u,h,p,g){return t.FafSignaturePopupView=e.View.extend({events:{"click      .faf-sig-checkbox-group":"_onAddToGlobalClicked","keydown    .faf-sig-checkbox-group":"_onAddToGlobalClicked",click:"_handleExistingGuide"},initialize:function(){e.View.prototype.initialize.call(this),this._spModel=this.options.fafSignaturePopupUiModel,this._template=_.template(n),this._wrappersDone=$.Deferred(),_.bindAll(this,"_escToPopup","_adjustSize"),this._addUiModelEventListeners(),l.isDesktop()&&(_.bindAll(this,"_onDismissSignDlg"),t.Reader.readerEventListenerOp.listenForReaderEvent("custom:DismissSignDlg",this._onDismissSignDlg))},_onDismissSignDlg:function(){this._sigClose({why:"cancel"})},showPopup:function(e){return $.when(this._wrappersDone.promise()).then(_.bind(function(){return this._showPopup(e)},this))},_showPopup:function(e){this._open(e),e?t._signatures.popupUiModel.set("field_id",e):t._signatures.popupUiModel.trigger("change:signature"),l.onExternalEsc(this._escToPopup),this.$popup.show(),$("#sig_popup_bkg").show();var i=this._spModel.get("sig_type");"initials"===i?($(".faf-sig-checkbox-label").text(g.saveInitials),this.$dlg.css("max-width","380px"),this.$dlg.css("min-width","380px"),this.$popup.removeClass("faf-signature").addClass("faf-initials")):($(".faf-sig-checkbox-label").text(g.saveSignature),this.$dlg.css("max-width",""),this.$dlg.css("min-width","790px"),this.$popup.removeClass("faf-initials").addClass("faf-signature"));var n=!l.isDesktop()||t.Reader.prefs.bSaveFSSignature;return n?this.$checkboxGroup.addClass("shown"):this.$checkboxGroup.removeClass("shown"),this._spModel.set("add_to_global",!!n),this._spModel.trigger("change:add_to_global",this._spModel,n),$(window).resize(this._adjustSize),this._adjustSize(),this.popUpDefer},_open:function(e){this._closePopupCalled=!1,this.popUpDefer||(this.popUpDefer=$.Deferred()),this._spModel.init({faf_user:this.options.faf_user,popupLoading:!0}),this._spModel.unset("save_options",{silent:!0}),t._signatures.popupUiModel.set("field_id",e||"none"),c.sigLogAction("1-Started",{cat:!0,userType:this.options.userType}),this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_DLG_WILL_OPEN);var i=this._spModel.get("active_kind");"none"!==i&&(this._spModel.set("active_kind","none",{silent:!0}),this._spModel.set("active_kind",i)),this._spModel.set("popupLoading",!1),this._addKeyEventListener(),this._addFocusEventListener(),this.$el.prev().attr("aria-hidden","true")},_handleExistingGuide:function(){u.hideGuide()},_initWrappers:function(){this.$popup=$("#sig_popup"),this.$addToGlobalCheckbox=this.$el.find(".faf-sig-save-toggle"),this.$checkboxGroup=this.$el.find(".faf-sig-checkbox-group"),s.handleTouchEventAsMouseEvent($("#faf-sig-draw")),this._wrappersDone.resolve()},_addUiModelEventListeners:function(){this._spModel.on("change:signature",_.bind(function(){var e=this._spModel.get("signature"),t=e&&e.kind||this._spModel.get("active_kind"),i=this.$el.find("[data-kind="+t+"]");if(0===i.length){if(i=this.$el.find(".faf-sig-kind-btn"),!(i.length>0))return;t=$(i[0]).attr("data-kind")}this._spModel.set("active_kind",t)},this)),this.listenTo(this._spModel,"change:add_to_global",this._onAddToGlobalChanged),this.listenTo(this._spModel,"change:save_options",this._onSigSave)},render:function(){if(e.View.prototype.render.call(this),0===this.$el.children().length){var t=this.options.fafUserDataModel,i=t.getObject("signature");this.options.userType=i&&i.value.length>0?"RU":"NU",this.$el.html(this._template({})),this.$dlg=this.$el.find(".faf-sig-dialog"),this.$container=this.$el.find("#faf-sig-container"),this._renderChildViews(),this._initWrappers(),this._initTabLimits()}return this},_renderChildViews:function(){var e=_.extend({dlgView:this,$dlg:this.$dlg,$container:this.$container},this.options),i=this._renderChildView("_fafSigButtonView",t.FafSignaturePopupButtonView,this.$el.find(".faf-sig-dialog-btns"),e);e.buttonView=i,this._renderChildView("_fafSigHeaderView",t.FafSignaturePopupHeaderView,this.$el.find(".faf-sig-dialog-head"),e),this._renderChildView("_fafSigSurfaceView",this._surfaceViewClass(),this.$el.find("#faf-sig-container"),e),this.listenTo(i,t.ViewEvents.FAF_SIGNATURE_CANCEL,this._onSigCancel)},_surfaceViewClass:function(){return t.FafSignaturePopupSurfaceView},_escToPopup:function(){this._sigClose({why:"cancel"})},_onSigCancel:function(){this._sigClose({why:"cancel"})},_onSigSave:function(e,i){if(i)if("OK"===i.why){if(i.signature&&i.signature.addToGlobal){var n=_.extend({},i.signature);delete i.signature.addToGlobal;var o;d.saveSignature(n).then(_.bind(function(e){var t=this.options.fafUserDataModel;return o=e.desktopAssetID,t.addSignature(e.globalAssetID,n),l.isDesktop()?t.save():s.getResolvedPromise()},this)).then(function(){d.signatureSynced(o)}).fail(function(e){s.logError("FafSignaturePopupView","Error saving global signature: "+e)})}this._sigClose(i)}else"Invalid"===i.why&&setTimeout(_.bind(function(){u.showGenericDialog({text:g.SignatureComplicatedText,okFunc:_.bind(function(){setTimeout(_.bind(function(){t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_SHOW_POPUP,this.options)},this),500)},this)})},this))},_onAddToGlobalClicked:function(e){("click"!==e.type||1===e.which)&&("keydown"!==e.type||13===e.which||32===e.which)&&(this._consumeEvent(e),this._spModel.set("add_to_global",!this._spModel.get("add_to_global")))},_onAddToGlobalChanged:function(e,t){var i=this.$addToGlobalCheckbox;t?i.removeClass("core-checkbox").addClass("core-checkbox-checked").attr("aria-checked","true"):i.removeClass("core-checkbox-checked").addClass("core-checkbox").attr("aria-checked","false")},_sigClose:function(e){this._closePopupCalled||(this._closePopupCalled=!0,l.offExternalEsc(this._escToPopup),$(window).off("resize",this._adjustSize),this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_DLG_WILL_CLOSE),this._closePopup(e))},_addToGlobal:function(){return this.$addToGlobalCheckbox.hasClass("core-checkbox-checked")},_sizeIsSet:function(){this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_DLG_RESIZED)},_adjustSize:function(e){var t,i=this.options,n=i.fafSignaturePopupUiModel;if(i.docWindowSize)t=380,"signature"===i.sigType&&(t=Math.floor(Math.max(790,.8*i.docWindowSize.width))),this.$dlg.width(t);else if(t=this.$dlg.width(),0===t)return;var o=s.cssNumTotal(this.$container,["margin-left","border"]);if(o%1!==0&&(s.logErrorAndToSplunk("AcFaf.FafSignaturePopupView: _adjustSize (leftMarginBorder: "+o+")"),o=Math.ceil(o)),t%1!==0&&(s.logErrorAndToSplunk("AcFaf.FafSignaturePopupView: _adjustSize (width: "+t+")"),t=Math.floor(t)),t-=2*o,this.$container.width(t),n.get("canvas_width")===t&&!e)return this._adjustPosition(),void this._sizeIsSet(this.$el);var a="initials"===n.get("sig_type")?1.1667:4.233;this.$container.height(Math.ceil(t/a)),this._adjustPosition(),this._spModel.set("canvas_width",t),this._sizeIsSet(this.$el)},_adjustPosition:function(){this.$dlg.css("top",Math.max(0,this.$popup.height()/2-this.$dlg.height()/2)),this.$dlg.css("left",Math.max(0,this.$popup.width()/2-this.$dlg.width()/2))},_resetButtons:function(){this._spModel.set("save_enabled",!0)},_closePopup:function(e){if(this._resetButtons(),"Invalid"!==e){this._removeKeyEventListener(),this._removeFocusEventListener(),this.$el.prev().removeAttr("aria-hidden"),this.$popup.hide(),$("#sig_popup_content").empty(),$("#sig_popup_bkg").hide();var t=this.popUpDefer;this.popUpDefer=void 0,t.resolve(e)}},_initTabLimits:function(){var e;e=this.$(":tabbable"),this.$firstTabbable=e.first(),this.$lastTabbable=e.last()},_onKeyDown:function(e){var t,i,n=e.which,s=$(e.target),o=e.shiftKey,a=!1;switch(n){case 13:case 32:r.descendantHasFocus(this.$el)&&(s.is("button")||s.is("input:file"))&&e.stopPropagation();break;case 9:this._initTabLimits(),t=this.$firstTabbable,i=this.$lastTabbable,t.is(i)?(a=!0,_.defer(function(){t.focus()})):t.is(s)?o&&(a=!0,_.defer(function(){i.focus()})):i.is(s)?o||(a=!0,_.defer(function(){t.focus()})):this._onFocusIn(e)}return a&&this._consumeEvent(e),a},_onFocusIn:function(e){var t,i;return this._initTabLimits(),t=this.$firstTabbable,i=this.$lastTabbable,t&&i&&!r.descendantHasFocus(this.$el)&&(_.defer(e.shiftKey?function(){i.focus()}:function(){t.focus()}),this._consumeEvent(e)),!0}}),t.FafSignaturePopupView}),define("fss/js/views/reader/faf-reader-settings-popup-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-api-caller","fss/js/lib/reader/window-event-listener","fss/js/views/esign/faf-signature-popup-view"],function(e,t,i,n,s,o){return t.Reader.FafReaderSettingsPopupView=e.View.extend({initialize:function(){e.View.prototype.initialize.call(this),_.bindAll(this,"_sizeIsSet"),this.listenForWindowEvents()},render:function(){return e.View.prototype.render.call(this),this},_windowShown:function(){return"undefined"==typeof this._windowShowing?(this._windowShowing=!0,i.getResolvedPromise()):(this._windowShowing=!0,this._sizeIsSet(),this.showPopup(),i.getResolvedPromise())},_windowHidden:function(){return this._windowShowing=!1,this._setContainerSize(1,1)},_sizeIsSet:function(){var e=$(".generic-dialog.settings-dlg");_.defer(_.bind(function(){var t=2*i.cssNumTotal(e,["border","padding"]);this._setContainerSize(e.width()+t,e.height()+t)},this))},showPopup:function(){this._showSettingsDialog();var e=$(".generic-dialog.settings-dlg");this.options.fafUserDataModel.getUserDataModelPromise().always(_.bind(function(){this._showPopup(),$(".dialog-container.dialog-container-common").css("overflow","hidden"),e.css("left","0%"),e.css("top","0px"),e.css("margin-left","0px"),e.css("margin-top","0px")},this))},_showSettingsDialog:function(){var e=t.appApi;n.onExternalEsc(this._escSettings);var i=e.settingsApi.showSettings();e.keyApi.pushKeyHandler(this),i.always(_.bind(function(){e.keyApi.popKeyHandler(this),n.offExternalEsc(this._escSettings)},this))},_escSettings:function(){t.appApi.dialogApi.closeAllDialogs()},_showPopup:function(){$(window).resize(this._sizeIsSet),this._sizeIsSet()}}),o.mixin(s.mixin(t.Reader.FafReaderSettingsPopupView)),t.Reader.FafReaderSettingsPopupView}),define("fss/js/ops/show-settings-popup-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/reader/faf-reader-api-caller","fss/js/views/reader/faf-reader-settings-popup-view"],function(e,t,i,n){return t.Reader.SettingPopupOp=e.Op.extend({run:function(){this._deferred=$.Deferred(),this._run();var e=this.options.appApi.options.settingsDlgUiModel;return e.on("change:faf-done-button-clicked",this._onDoneClick),this._deferred},_run:function(){t._signatures.popupView=new n(this.options),t._signatures.popupView.render(),t._signatures.popupView.showPopup()},_onDoneClick:function(){this._tellReader("signDlg",[{action:"cancel"}]),this._deferred.resolve()}}),i.mixin(t.Reader.SettingPopupOp),t.Reader.SettingPopupOp}),define("fss/js/ops/reader/signature-sync-reader-native-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-api-caller","fss/js/ops/reader/signature-sync-reader-op"],function(e,t,i,n){return t.Reader.SignatureSyncReaderNativeOp=t.Reader.SignatureSyncReaderOp.extend({_syncSignatures:function(){var e;return t.Reader.SignatureSyncReaderOp.prototype._syncSignatures.call(this).then(function(t){e="cancel"===t?"Cancel":"OK"}).fail(function(){e="Cancel"}).always(_.bind(function(){"sign_sync"===i.desktopNativeSignCommand()&&this._tellReader("signSync",[{action:e}]),this.options.appApi.displayApi.showSpinner(!1)},this))}}),n.mixin(t.Reader.SignatureSyncReaderNativeOp),t.Reader.SignatureSyncReaderNativeOp}),define("fss/js/ops/reader/post-save-op",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/faf-common-api-util"],function(e,t,i,n){return t.Reader.PostSaveOp=e.Op.extend({run:function(){var e=!!_.find(t._formManager.form.pages,function(e){return!!_.find(e.elements,function(e){return"signature"===e.type||"initials"===e.type})});if(e){t._fafFormView.blurFocusedElement();var i=this;this.options.saveResult.then(function(e){e._addEventListener("custom:onExecuteUICommandDone",_.bind(function(){$(".faf-form-page").each(function(e){var s=$(this),o=s.children(".faf-form-image");o.removeAttr("data-loading"),n.loadRendition(e,{img:o,src:t._formManager.form.getPageBackgroundImageURL(e)}).then(function(){i._removePageFields(s)})})},this))})}return $.Deferred().resolve().promise()},_removePageFields:function(e){var t=e.find(".faf-focusbox-outline");_.each(t,function(e){var t=$(e).data(i.FORM_FIELD_KEY);t.deleteField({skipDirty:!0})})}}),t.Reader.SendEventOp}),define("fss/js/ops/reader/getting-autocomplete-suggestions-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.Reader.GettingAutoCompleteSuggestionsOp=e.Op.extend({run:function(){return 1===this.options.fafAutocompleteStateModel.get("ac_s")&&(this.options.fafAutocompleteModel.searchForNewSuggestions=!0,this.options.fafAutocompleteModel.setAutoCompleteHelperViewInput(this.options.eventParams.inputString)),this._getResolvedPromise()}}),t.Reader.GettingAutoCompleteSuggestionsOp}),define("fss/js/ops/reader/add-autocomplete-suggestion-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.Reader.AddAutoCompleteSuggestionOp=e.Op.extend({run:function(){if(1===this.options.fafAutocompleteStateModel.get("ac_s")){var e=this.options.eventParams.inputString,t=this.options.fafAutocompleteModel;t.searchForNewSuggestions=!1,t.couldBeSensitive(e)===!1&&(t.allowString(e),t.readerACHelperValueSet.add(e))}return this._getResolvedPromise()}}),t.Reader.AddAutoCompleteSuggestionOp}),define("fss/js/ops/reader/removing-autocomplete-suggestion-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.Reader.RemovingAutoCompleteSuggestionOp=e.Op.extend({run:function(){if(1===this.options.fafAutocompleteStateModel.get("ac_s")){var e=this.options.eventParams.inputString,t=this.options.fafAutocompleteModel;t.searchForNewSuggestions=!0,t.excludeString(e),t.readerACHelperValueSet.delete(e)}return this._getResolvedPromise()}}),t.Reader.RemovingAutoCompleteSuggestionOp}),define("fss/js/ops/reader/update-server-autocomplete-suggestions-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/reader/faf-reader-js-wrapper","fss/js/lib/faf-ajax-util"],function(e,t,i,n){return t.Reader.UpdateServerAutoCompleteSuggestionsOp=e.Op.extend({run:function(){if(1!==this.options.fafAutocompleteStateModel.get("ac_s"))return this._getResolvedPromise();var e=this.options.fafAutocompleteModel;if(e){var i=e.get("source"),s={methodName:"saveAutoCValsInReg",methodArgs:[{fillSignAutoCSuggestion:JSON.stringify(i)}]};t.appApi.rnaApi.done(function(e){e.fssApi(s)})}$.ajax(n.getAjaxOptions("/formdata/reader",{success:function(t){var i,s=t.form,o=s.form.id;if(e.ACValuesSyncedFromServer)i=e.getAutoCompleteHelperNewValues();else{var a=e.get("source");i=new Set,_.each(a,_.bind(function(e){i.add(e.value)},this)),i=Array.from(i),i=i.slice(0,1e3)}var r=$.Deferred();if(!i.length)return r.resolve();e.searchForNewSuggestions=!0;var s={formID:o,add:i},l=n.addDexiAjaxOptions(n.getAjaxOptions("POST","/autoc",{modal:!1,error:function(){r.reject()},success:function(){r.resolve()},data:JSON.stringify(s)}),{version:2,useCharset:!0,setContentType:!0});return $.ajax(l).then(function(){e.readerACHelperValueSet.clear()}),r.promise()}}))}}),t.Reader.UpdateServerAutoCompleteSuggestionsOp}),define("fss/js/ops/reader/removing-autocomplete-suggestion-from-server-only-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.Reader.RemovingAutoCompleteSuggestionFromServerOnlyOp=e.Op.extend({run:function(){if(1===this.options.fafAutocompleteStateModel.get("ac_s")){var e=this.options.eventParams.inputString,t=this.options.fafAutocompleteModel;t.searchForNewSuggestions=!0,t.readerACHelperValueSet.delete(e)}return this._getResolvedPromise()}}),t.Reader.RemovingAutoCompleteSuggestionFromServerOnlyOp}),define("fss/js/ops/reader/remove-signatures-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.Reader.RemoveSignaturesOp=e.Op.extend({run:function(){var e=this.options.fafUserDataModel,t=this.options.eventParams.assetID,i=this.options.eventParams.type;e.findSignatureID(t,i).always(_.bind(function(t){t&&t.found&&t.signID&&e.removeSignature(t.signID)},this))}}),t.Reader.RemoveSignaturesOp}),define("fss/js/ops/reader/op-factory",["core/ac-core","fss/js/ac-faf","fss/js/ops/reader/getting-doc-cloud-services-status-op","fss/js/ops/reader/send-event-op","fss/js/ops/reader/listening-for-reader-events-op","fss/js/ops/reader/toggling-reader-signature-menu-op","fss/js/ops/reader/toggling-reader-native-signature-menu-op","fss/js/ops/reader/flush-to-reader-app-op","fss/js/ops/reader/switching-to-reader-tool-op","fss/js/ops/reader/switching-app-op","fss/js/ops/reader/faf-sign-in-op","fss/js/ops/reader/check-client-version-op","fss/js/ops/reader/signature-sync-reader-op","fss/js/ops/reader/get-desktop-signatures-op","fss/js/ops/reader/showing-native-signature-popup-op","fss/js/ops/show-settings-popup-op","fss/js/ops/reader/signature-sync-reader-native-op","fss/js/ops/reader/post-save-op","fss/js/ops/reader/getting-autocomplete-suggestions-op","fss/js/ops/reader/add-autocomplete-suggestion-op","fss/js/ops/reader/removing-autocomplete-suggestion-op","fss/js/ops/reader/update-server-autocomplete-suggestions-op","fss/js/ops/reader/removing-autocomplete-suggestion-from-server-only-op","fss/js/ops/reader/remove-signatures-op"],function(e,t){return t.Reader.OpFactory=e.Op.extend({create:function(e,i){var n=t.Reader[e];return n?new n(i):void LOG.error("AcFaf.Reader.OpFactory.create: Unrecognized class: "+e)}}),t.Reader.OpFactory}),define("fss/js/ops/reader/listening-for-reader-events-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/data/reader/faf-reader-constants","core/utils/date-util","fss/js/ops/reader/op-factory","fss/js/ops/reader/events-base-op","core/views/view-events","fss/js/views/faf-view-events"],function(e,t,i,n,s){return t.Reader.ListeningForReaderEventsOp=t.Reader.EventsBaseOp.extend({initialize:function(){t.Reader.EventsBaseOp.prototype.initialize.call(this),_.bindAll(this,"_handleEvent","listenForReaderEvent"),this._eventMap={},this._listenDefer=$.Deferred()},run:function(){return s.logElapsedTime("FSS: starting ListeningForReaderEventsOp"),this._runDefer=$.Deferred(),this._initDefer.then(_.bind(function(){this._initEventMap(),this._initEscListeners(),this._eventProxy.on("all",this._handleEvent),t.listenForReaderEvent=this.listenForReaderEvent,this._sessionAPIModel.on("custom:sessionChange",this._handleSessionEvent),s.logElapsedTime("FSS: starting ListeningForReaderEventsOp : done"),this._listenDefer.resolve()},this)),this._runDefer},_initEventMap:function(){this.listenForReaderEvent([n.TOOL_TEXT,n.TOOL_X,n.TOOL_CHECK,n.TOOL_CIRCLE,n.TOOL_LINE,n.TOOL_DOT],t.Reader.opFactory,"SwitchingToReaderToolOp",this.options),this.listenForReaderEvent(n.TOOL_SIGN,t.Reader.opFactory,"TogglingReaderSignatureMenuOp",this.options),this.listenForReaderEvent(n.TOOL_AC_SUGGEST,t.Reader.opFactory,"GettingAutoCompleteSuggestionsOp",this.options),this.listenForReaderEvent(n.TOOL_AC_REMOVE,t.Reader.opFactory,"RemovingAutoCompleteSuggestionOp",this.options),this.listenForReaderEvent(n.TOOL_AC_REMOVE_ONLY_SERVER,t.Reader.opFactory,"RemovingAutoCompleteSuggestionFromServerOnlyOp",this.options),this.listenForReaderEvent(n.TOOL_AC_ADD,t.Reader.opFactory,"AddAutoCompleteSuggestionOp",this.options),this.listenForReaderEvent(n.TOOL_AC_ADD_SERVER,t.Reader.opFactory,"UpdateServerAutoCompleteSuggestionsOp",this.options),this.listenForReaderEvent(n.TOOL_AC_ADD_SERVER_CLOSE_TAB,t.Reader.opFactory,"UpdateServerAutoCompleteSuggestionsOp",this.options),this.listenForReaderEvent(n.TOOL_AC_ADD_SERVER_CLOSE_APP_WINDOW,t.Reader.opFactory,"UpdateServerAutoCompleteSuggestionsOp",this.options),this.listenForReaderEvent(n.TOOL_REMOVE_SIGNATURE,t.Reader.opFactory,"RemoveSignaturesOp",this.options),this.listenForReaderEvent(n.SYNC_SIGNATURE,t.Reader.opFactory,"TogglingReaderNativeSignatureMenuOp",this.options)},_initEscListeners:function(){this._escListeners=[]},_doFlush:function(e){var i=_.extend(this.options,{saveSettings:e,isClosing:!0});return t.opFactory.create("FlushToReaderAppOp",i).run()},_doClose:function(){var e=this._doFlush(!0);return e},_getLogClass:function(){return"ListeningForReaderEventsOp"},_getLogPrefix:function(e){return"FSS event '"+e+"' "},_handleLikeEsc:function(e){switch(e){case n.KEY_ESC:case n.CMD_PRINT:case n.CMD_SAVE:case n.CMD_SAVEAS:case n.CMD_ATTACHTOEMAIL:return!0}return!1},_handleEvent:function(e,s,o){var a,r=o.params;if(!r.hasOwnProperty("num-clicks")||1===r["num-clicks"]){this._logEvent(e,"received...");var l=this._eventMap[e];if(l){var d=[];_.each(l,function(t){if("function"==typeof t.opFactory)d.push(t.opFactory(r));else{var n=t.opFactory.create(t.opName,_.extend({eventName:e,eventParams:r},t.options));n?d.push(n.run()):i.logDebug("ListeningForReaderEventsOp","Cannot create Op: "+t.opName)}}),a=$.when.apply($,d)}else if(this._handleLikeEsc(e)){var f=e===n.KEY_ESC;this._escListeners.length>0&&(a=this._escListeners[0](o,f),f&&(r=void 0))}else r||i.logDebug("ListeningForReaderEventsOp","Unrecognized event: "+e+", and no params, not doing anything");r&&!a&&(a=this._getResolvedPromise()),$.when(a).then(_.bind(function(){if(this._logEvent(e,"finished FSS operation"),r){switch(r["do"]){case n.DO_FLUSH:this._logEvent(e,"do: flush"),a=this._doFlush(!1);break;case n.DO_CLOSE:this._logEvent(e,"do: close"),a=this._doClose();break;default:a=this._getResolvedPromise()}r.call&&a.then(_.bind(function(){t.Reader.opFactory.create("SendEventOp",{eventName:e,methodName:"executeUICommand",methodArgs:r.call}).run().then(_.bind(function(e){(r.call[0]===n.CALL_SAVE||r.call[0]===n.CALL_SAVEAS)&&t.Reader.opFactory.create("PostSaveOp",{saveResult:e}).run()}))},this))}},this)).fail(_.bind(function(){this._logEvent(e,"failed!"),i.logDebug("ListeningForReaderEventsOp","Op failed: "+e)},this))}},listenForReaderEvent:function(e,t,i,n){n=_.extend({},this.options,n);var s={opFactory:t,opName:i,options:n};e instanceof Array?_.each(e,_.bind(function(e){this._addEventListener(e,s)},this)):this._addEventListener(e,s)},_addEventListener:function(e,t){var i=this._eventMap[e];i?i.push(t):this._eventMap[e]=[t]},onEsc:function(e){this._listenDefer.then(_.bind(function(){this._escListeners.unshift(e)},this))},offEsc:function(e){this._listenDefer.then(_.bind(function(){var t=this._escListeners.indexOf(e);0>t?i.logDebug("ListeningForReaderEventsOp","Stop listening to ESC, no maching listener found!"):this._escListeners.splice(t,1)},this))},_handleSessionEvent:function(e,i){var n,s,o=i.params.isSignedIn,a=_.extend({isSignedIn:o},this.options);return o?(n=t.opFactory,s="SigningInOp"):(n=t.Reader.opFactory,s="SigningOutOp"),n.create(s,a).run()}}),t.Reader.ListeningForReaderEventsOp}),define("fss/js/ops/open-form-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/utilUI","fss/js/lib/faf-common-api-util","fss/js/lib/faf-common-util","i18n!fss/js/nls/ui-strings","plugins-common/ac-plugins"],function(e,t,i,n,s,o,a,r,l,d){t.OpenFormOp=e.Op.extend({run:function(){var e=this.options,a=e.formID,r=e.showProgress,f=e.backToFiles,c=e.fafEditorUiModel;c.set("back_to_files",f);var u=$.Deferred();t._formManager.preload(),t.appApi.routerApi.navigate(t.PLUGIN_ID+"/"+a);var h=this;return $.ajax(s.getAjaxOptions("/formdata/"+a,{success:function(s,o,l){var d=l?l.getResponseHeader("ETag"):null,f=s.form;h.fetchEditorUiModel().then(function(){"reader"===a&&(a=f.form.id),t._fafMain.dtfSwitchView("FillForm"),t._formManager.load(f.form,s.values,{formID:a,formName:f.name,formSource:f.source,etag:d});var o="Form:Open",l=o+":"+e.formType,c=l+":"+e.formSource;c+=e.fafEditorUiModel.isFormSourceNative()&&e.formOrigin?":"+e.formOrigin:e.fafEditorUiModel.getFormSourceType()===e.fafEditorUiModel.SOURCE_TYPE_CCLOUD?":CCFile":":UnknownFile",i.logEvent(o,l,c,{documentID:a}),h._logNumFieldsEvent(f),u.resolve(),r&&n.hideProgress(),h._warnIfNonNativeForm(),t._fafAppLimitsModel.initialized().then(_.bind(function(){var e=t._fafAppLimitsModel.getFRFeatureLevel(),i=t._fafAppLimitsModel.getUserCohorts("FSS-FR-feat-test");n.logToSplunk("FR_USER_AVAIL loc=client recognition_level="+e+" user_fr_cohort="+i),e&&e>0&&(this._fetchFRC("Pages").then(function(){t._fafFieldCandidateMappingCollection.load(f)}),e>1&&this._fetchFRC("ValuePrediction"))},h))})},error:s.handleDexiErrorResponse(function(e,i){f?(n.logInfo("faf-toolbar-view","switching back to Files"),c.set("back_to_files",!1),t.appApi.pluginsApi.selectPlugin(d.HOME)):(n.logInfo("faf-toolbar-view","switching back to MyForms"),t._fafMain.dtfSwitchView("MyForms")),u.reject(),r&&n.hideProgress(),o.showGenericDialog(400===e.status&&"UnboundFormFound"===i.code?l.UnboundFormFound:l.ObjectNotFound)})})),u.promise()},fetchEditorUiModel:function(){var e=this.options.fafEditorUiModel;return a.getUISettings().then(_.bind(function(t){if(t){e.setFssZoomType(t["zoom-type"]);var i=t["current-page"];e.set("current_page",i),e.setPageScaleBasedOnReader(t);var n=t["pages-info"],s=0,o=t[""];if(n&&n.length){e.set("pages_info",n);var a=n[i];o=a.ct,s=a.cl}else o=t["crop-top"],s=t["crop-left"],e.set("crop_left",s),e.set("crop_top",o);var r=Math.abs(s-t["dest-left"]);e.set("page_offset_x",r);var l=Math.abs(o-t["dest-top"]);e.set("page_offset_y",l)}},this))},_fetchFRC:function(e){return e="_fafFieldCandidate"+e+"Collection",t[e].fetch({reset:!0,success:function(){n.logToSplunk(e+": fetch success")},error:s.handleDexiErrorResponse(function(){n.logToSplunk(e+": fetch failed")})})},_logNumFieldsEvent:function(e){try{var t=[{max_value:0,label:"0"},{max_value:10,label:"1-10"},{max_value:20,label:"11-20"},{max_value:30,label:"21-30"},{max_value:50,label:"31-50"},{max_value:100,label:"51-100"},{max_value:150,label:"101-150"},{max_value:200,label:"151-200"},{max_value:300,label:"201-300"},{max_value:400,label:"301-400"},{max_value:99999999,label:"401+"}],s=0,o=e.form.pages;
_.each(o,function(e){s+=e.elements.length});var a=_.find(t,function(e){return s<=e.max_value}),r="Form:Open:NumFields:"+a.label;i.logEvent(null,r,r)}catch(l){n.logError("open-form-op","unexpected error when calculating number of fields"+l)}},_warnIfNonNativeForm:function(){var e=this.options,t=e.appApi.dialogApi;return this.options.fafEditorUiModel.isFormSourceNative()||r.isDesktop()?this._getResolvedPromise():t.displayTextAlert(t.SEVERITY_INFORMATIONAL,l.ConnectorBasedFormOpenedTitle,l.ConnectorBasedFormOpenedMessage,l.Continue)}})}),define("fss/js/ops/listening-for-field-added-op",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util"],function(e,t,i,n){return t.ListeningForFieldAddedOp=e.Op.extend({initialize:function(){e.Op.prototype.initialize.call(this),_.bindAll(this,"_formFieldAdded","_textChanged","_formClosed")},run:function(){return this.app=t._app,this.app.addListener(i.FORM_CLOSED,this._formClosed),this.app.addListener(i.FORM_FIELD_ADDED,this._formFieldAdded),(this._deferred=$.Deferred()).promise()},_formFieldAdded:function(e){if("textfield"===e.formElement.type){var t=$("textarea.faf-user-value",e.$newField);if(t.bind("textchange",this._textChanged),t.data(i.FAF_INPUT_DATA_KEY)){var n=this.app.currentUser().getValue(t[0].name);n&&!t.val()&&(t.val(n.text),t.trigger(i.FIELD_VALUE_SET_FROM_USER,null))}}},_formClosed:function(){this.app.removeListener(i.FORM_CLOSED,this._formClosed),this.app.removeListener(i.FORM_FIELD_ADDED,this._formFieldAdded),this._deferred.resolve()},_textChanged:function(e){if(this._inTextChangeTrigger)return void n.logDebug("_textChangeTriggered recursing, so returning");var s=$(e.target),o=s.attr("name"),a=s.val(),r=s.data("faf-field-filter");if(!(r&&!r(s)||o===this._lastTextFieldName&&a===this._lastTextFieldVal)){this._inTextChangeTrigger=!0;try{this._lastTextFieldName=o,this._lastTextFieldVal=a;var l={id:o,newValue:a,target:e.target};t._fafFormValuesCollection.trigger(i.USER_VALUE_CHANGED_LOCALLY,l)}catch(d){n.logError("_textChangeTriggered caught error "+d)}this._inTextChangeTrigger=!1}}}),t.ListeningForFieldAddedOp}),define("fss/js/ops/listening-for-print-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.ListeningForPrintOp=e.Op.extend({initialize:function(){e.Op.prototype.initialize.call(this),_.bindAll(this,"_printBegin","_printEnd","_printMediaListenFunc","_onbeforeprint","_onafterprint"),window.matchMedia&&(this._inPrintMedia=!1,this._mediaQueryList=window.matchMedia("print"))},run:function(){return window.matchMedia&&this._mediaQueryList.addListener(this._printMediaListenFunc),this._savedOnBeforePrint=window.onbeforeprint,window.onbeforeprint=this._onbeforeprint,this._savedOnAfterPrint=window.onafterprint,window.onafterprint=this._onafterprint,(this._deferred=$.Deferred()).promise()},done:function(){window.onbeforeprint=this._savedOnBeforePrint,delete this._savedOnBeforePrint,window.onafterprint=this._savedOnAfterPrint,delete this._savedOnAfterPrint,window.matchMedia&&this._mediaQueryList.removeListener(this._printMediaListenFunc),this._deferred.resolve()},_printBegin:function(){this._justGotPrint||(this._justGotPrint=!0,setTimeout(function(){this._justGotPrint=!1},2e3)),this.options.rootView._triggerViewEvent(t.ViewEvents.FAF_PRINT_PDF,{browserPrint:!0})},_printEnd:function(){},_printMediaListenFunc:function(e){e.matches?this._inPrintMedia||(this._inPrintMedia=!0,this._printBegin()):this._inPrintMedia&&(this._inPrintMedia=!1,this._printEnd())},_onbeforeprint:function(){this._savedOnBeforePrint&&this._savedOnBeforePrint(),this._printBegin()},_onafterprint:function(){this._printEnd(),this._savedOnAfterPrint&&this._savedOnAfterPrint()}}),t.ListeningForPrintOp}),define("fss/js/ops/deleting-form-field-op",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/formcanvas"],function(e,t,i,n){return t.DeletingFormFieldOp=e.Op.extend({run:function(){var e=this.options.$fieldDiv,s=this.options.formManager,o=this.options.fafFormValuesCollection,a=e.data(i.FORM_ELEMENT_KEY),r=e.closest(".faf-form-page").data("formData");if(a&&r){var l=r.elements.indexOf(a);if(-1!==l){n.isSignatureType(a.type)?t.opFactory.create("SaveSignatureAssetOp").run().then(function(){o.deleteValue(a.id)}):o.deleteValue(a.id,!0);var d=this.options.fafRC.fafFieldCandidateMappingCollection;if(d){var f=d.removeMapping({fieldID:this.options.formField.fieldId()});f&&this.options.fromTrash&&_.defer(function(){var e=t._fafContentView._fafAppView._fafEditorView.$fcDelFocusEl;e.data("deletedFCModel",f),e.focus()})}r.elements.splice(r.elements.indexOf(a),1),this.options.skipDirty||s.setDirty()}}return s.$lastCustomFieldCreated&&s.$lastCustomFieldCreated.equals(e)&&(delete s.$lastCustomFieldCreated,delete s.lastCustomId),this._getResolvedPromise()}}),t.DeletingFormFieldOp}),define("fss/js/ops/running-plugin-op",["core/ac-core","fss/js/ac-faf","core/ops/op"],function(e,t){t.RunningPluginOp=e.Op.extend({run:function(){var e,i=this.options,n=t.opFactory;return e=n.create("ListeningForViewEventsOp",i),$.when(e.run())}})}),define("fss/js/ops/flushing-data-op",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/faf-profiler-util"],function(e,t,i,n,s){t.FlushingDataOp=e.Op.extend({run:function(){var e=this.options.fafFlushableDataModel,i=this.options.closing;return i&&t._fafFormView.blurFocusedElement(),e.get("flushDefer")?(i&&!e.get("closing")&&e.set("set_closing",!0),e.get("flushDefer").promise()):(e.set("flushDefer",this._defer=$.Deferred()),e.set("closing",i),e.set("shownSaveMsg",!1),n.logDebug("FafProfiler","Start Flush Run!"),s.startTimer("FlushingDataOp-Run","Flush Run"+(this.options.closing?" [closing]":"")),this._flushPass=1,this._startPassTimer(),this._flushAllDirty(),this._defer)},_startPassTimer:function(){s.startTimer("FlushingDataOp-Pass","Flush Pass "+this._flushPass)},_stopPassTimer:function(){s.stopTimer("FlushingDataOp-Pass")},_lapPassTimer:function(){this._flushPass++,this._startPassTimer()},_startFlushableTimer:function(e){s.startTimer("FlushingDataOpModel-"+e.flushName(),"Flushing "+e.flushName())},_stopFlushableTimer:function(e){s.stopTimer("FlushingDataOpModel-"+e.flushName())},_flushAllDirty:function(){var e=this.options.fafFlushableDataModel;e.set("numDirty",0),e.set("numFailed",0),this._flushOneDirty(0)},_flushOneDirty:function(e){var n=this.options.fafFlushableDataModel,o=n.get("flushables"),a=_.keys(o);if(e>=a.length){this._stopPassTimer();var r=n.get("numDirty"),l=n.get("numFailed");r===l?(0===l?n.get("shownSaveMsg")&&(t._app.notifyEvent(i.APP_SAVE_DATA,{done:!0,fail:!1}),n.set("shownSaveMsg",!1)):t._app.notifyEvent(i.APP_SAVE_DATA,{done:!0,fail:!0}),n.get("set_closing")?(n.unset("set_closing"),this.options.closing=!0,n.set("closing",!0),_.defer(_.bind(function(){this._lapPassTimer(),this._flushAllDirty()},this))):(s.stopTimer("FlushingDataOp-Run"),this._defer.resolve(l),n.unset("flushDefer"))):_.defer(_.bind(function(){this._lapPassTimer(),this._flushAllDirty()},this))}else{var d=o[a[e]];d.needsFlushing(this.options.closing)?(this._startFlushableTimer(d),n.get("shownSaveMsg")||(n.set("shownSaveMsg",!0),t._app.notifyEvent(i.APP_SAVE_DATA,{done:!1,fail:!1})),n.set("numDirty",n.get("numDirty")+1),d.flush(this.options.closing).fail(_.bind(function(){n.set("numFailed",n.get("numFailed")+1)},this)).always(_.bind(function(){this._stopFlushableTimer(d,!0),this._flushOneDirty(e+1)},this))):_.defer(_.bind(function(){this._flushOneDirty(e+1)},this))}}})}),define("fss/js/ops/getting-autocomplete-state-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util"],function(e,t){t.GettingAutocompleteStateOp=e.Op.extend({run:function(){var e=$.Deferred(),i=t._fafPreferencesModel,n=t._fafAppLimitsModel;return $.when(i.initialized(),n.initialized()).then(function(){var t={ac_c:i.getPreference("autoCPref.ac_c"),ac_s:i.getPreference("autoCPref.ac_s")};e.resolve(t)}).fail(function(){var t="ERROR: Cannot get autocomplate preferences";LOG.error(t),e.reject(t)}),e.promise()}})}),define("fss/js/ops/losing-textfield-focus-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util"],function(e,t,i){t.LosingTextfieldFocusOp=e.Op.extend({run:function(){var e=this.options,t=e.fafFormValuesCollection,n=e.fafAutocompleteModel;if(e.fieldId){if(e.newVal&&e.newVal!==e.origVal){if(i.isValidCCNumber(e.newVal))return t.setModelChanged(e.fieldId,!1),this._getResolvedPromise();t.getValue(e.fieldId)&&n.stringIsValid(e.newVal)&&(n.allowString(e.newVal),t.setModelChanged(e.fieldId,!0))}}else i.logError("LosingTextfieldFocusOp","fieldId is undefined!");var s=$(".faf-form-view")[0].getBoundingClientRect(),o=$(".faf-form"),a=o[0].getBoundingClientRect();return s.right<a.right&&s.left<0&&o.scrollLeft(o.scrollLeft()-(a.right-s.right)),s.bottom<a.bottom&&s.top<0&&o.scrollTop(o.scrollTop()-(a.bottom-s.bottom)),this._getResolvedPromise()}})}),define("fss/js/templates/faf-progress-status-template",[],function(){return'<div class="file-upload-progress-bar indeterminate"><div class="file-upload-progress-bar-loaded hidden" style="right: 0px;"></div></div><div class="file-upload-progress-file-name file-upload-progress-text faf-file-upload-progress-text"><%= message %></div>'}),define("fss/js/views/faf-progress-status-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/faf-progress-status-template"],function(e,t,i){return t.FafProgressStatusView=e.View.extend({initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i)},render:function(){return e.View.prototype.render.call(this),this.$el.html(this._template({message:this.options.message})),this}}),t.FafProgressStatusView}),define("fss/js/ops/showing-progress-status-op",["core/ac-core","fss/js/ac-faf","fss/js/views/faf-progress-status-view"],function(e,t){t.ShowingProgressStatusOp=e.Op.extend({run:function(){var e=this.options,i=t.appApi.statusMenuApi;return i.showStatusMenuItem(t.PLUGIN_ID).then(function(i){var n=new t.FafProgressStatusView(_.extend({},e,{el:i}));n.render()}),i.setStatus(t.PLUGIN_ID,i.STATUS_BUSY),this._getResolvedPromise()}})}),define("fss/js/models/ui/faf-editor-ui-model",["core/ac-core","fss/js/ac-faf","core/models/ui/ui-model"],function(e,t){var i=4,n=.25,s="text",o="x",a="check",r="roundrect",l="line",d="dot",f="signature",c="",u="fitWidth",h="fitPage",p="native",g="root",m="ccloud";return t.FafEditorUiModel=e.UiModel.extend({recognized:{print_listener:{type:"object",optional:!0},tool:{type:"string",optional:!1,choices:[s,o,a,r,l,d,f]},is_hud_dismissed:{type:"boolean",optional:!1},current_page:{type:"number",optional:!1},pages:{type:"object",optional:!1},page_scale:{type:"number",optional:!1},zoom_type:{type:"string",optional:!0,choices:[c,u,h]},page_scale_preserve_hotspot:{type:"boolean",optional:!1},is_page_image_loaded:{type:"boolean",optional:!1},is_faf_chrome_loaded:{type:"boolean",optional:!1},back_to_files:{type:"boolean",optional:!1},form_id:{type:"string",optional:!0},form_name:{type:"string",optional:!0},form_source:{type:"string",optional:!0},show_download_pdf_menu:{type:"boolean",optional:!1},show_print_fallback_dialog:{type:"boolean",optional:!1},show_signature_menu:{type:"boolean",optional:!1},show_switch_field_type_menu:{type:"boolean",optional:!1},signature_button_position:{type:"object",optional:!0},page_dimensions:{type:"object",optional:!1},field_candidates:{type:"object",optional:!1},field_candidates_processed:{type:"object",optional:!1},scroll_mode:{type:"boolean",optional:!1},page_offset_x:{type:"number",optional:!1},page_offset_y:{type:"number",optional:!1},ratio_scale_to_zoom:{type:"number",optional:!0},faf_hud_hide_override:{type:"boolean",optional:!1},last_hud_legal_page_num:{type:"string",optional:!0},show_zoom_selector_menu:{type:"boolean",optional:!1},user_panel_layout_done:{type:"boolean",optional:!1},pages_info:{type:"object",optional:!0},smart_tabbed_fields:{type:"number",optional:!0},smart_sig_placed:{type:"boolean",optional:!0},current_droppable_zone:{type:"object",optional:!0}},defaults:{tool:s,is_hud_dismissed:!1,current_page:0,page_scale:1,page_scale_preserve_hotspot:!1,pages:[],is_page_image_loaded:!1,is_faf_chrome_loaded:!1,back_to_files:!1,show_download_pdf_menu:!1,show_print_fallback_dialog:!1,show_signature_menu:!1,show_switch_field_type_menu:!1,page_dimensions:[],field_candidates:[],field_candidates_processed:[],scroll_mode:!1,page_offset_x:0,page_offset_y:0,ratio_scale_to_zoom:1,faf_hud_hide_override:!1,show_zoom_selector_menu:!1,pages_info:[],form_source:"",smart_tabbed_fields:0,smart_sig_placed:!1},initialize:function(t,i){this.options=i,e.UiModel.prototype.initialize.call(this,t),this.on("change:is_page_image_loaded",_.bind(function(){this.set("is_faf_chrome_loaded",this.get("is_page_image_loaded"))},this))},init:function(e){this.set(_.extend({},this.defaults,e))},close:function(){this.init()},canZoomIn:function(){var e=Math.round(100*this.convertPageScaleToZoom(this.get("page_scale")));return e<Math.round(100*i)},canZoomOut:function(){var e=Math.round(100*this.convertPageScaleToZoom(this.get("page_scale")));return e>Math.round(100*n)},fieldCount:function(){var e=0;return _.each(this.get("pages"),function(t){t.elements&&(e+=t.elements.length)}),e},setPageScaleBasedOnReader:function(e){var i,n=t._formManager,s=e["current-page"],o=e["pages-info"];i=o&&o.length?o[s].pw:e["page-width"];var a=i*e["page-scale-x"],r=a/n.defaultImageWidth;r/=e["ui-scale"];var l=r/e.zoom;this.set("ratio_scale_to_zoom",l);var d=this.convertZoomToPageScale(this.getMaxZoom()),f=this.convertZoomToPageScale(this.getMinZoom());return r=Math.max(f,Math.min(r,d)),this.set("page_scale",r),r},getReaderZoom:function(){return this.convertPageScaleToZoom(this.get("page_scale"))},convertPageScaleToZoom:function(e){return e/this.get("ratio_scale_to_zoom")*1.0001},convertZoomToPageScale:function(e){return e*this.get("ratio_scale_to_zoom")*1.0001},setFssZoomType:function(e){switch(e){case 2:this.set("zoom_type","fitWidth");break;case 1:case 3:this.set("zoom_type","fitPage");break;default:this.set("zoom_type","")}},getReaderLayoutMode:function(){return this.get("scroll_mode")?2:1},getReaderZoomType:function(){var e=0,t=this.get("zoom_type");switch(t){case"fitPage":e=1;break;case"fitWidth":e=2;break;default:e=0}return e},getReaderXOffset:function(){var e,t=this.get("pages_info");return e=t&&t.length?this.get("pages_info")[this.get("current_page")].cl:this.get("crop_left"),Math.round(e+this.get("page_offset_x"))},getReaderYOffset:function(){var e,t=this.get("pages_info");return e=t&&t.length?this.get("pages_info")[this.get("current_page")].ct:this.get("crop_top"),Math.round(e+this.get("page_offset_y"))},setScrollMode:function(e){0===e||1===e?this.set("scroll_mode",!1):this.set("scroll_mode",!0)},getMinZoom:function(){return n},getMaxZoom:function(){return i},getFormSourceType:function(){var e=this.get("form_source");return(""===e||e===p)&&(e=g),e},getFormSourceConnectorLabel:function(){var e=t.appApi.connectorsApi.getConnectorsUiHelpers(this.getFormSourceType());return e&&e.label?e.label:void 0},isFormSourceNative:function(){return this.getFormSourceType()===g},ZOOM_TYPE_NONE:c,ZOOM_TYPE_FIT_PAGE:h,ZOOM_TYPE_FIT_WIDTH:u,SOURCE_TYPE_NATIVE:p,SOURCE_TYPE_ROOT:g,SOURCE_TYPE_CCLOUD:m}),t.FafEditorUiModel}),define("fss/js/models/faf-signin-state-model",["core/ac-core","fss/js/ac-faf"],function(e,t){var i="state",n="unknown",s="signing_out",o="offline",a="signing_in",r="signed_in",l="retrying",d="reason",f="signed_out",c="disabled",u="bumpered",h="error",p="old_version",g="eol",m="disconnected",v="forced_offline";return t.FafSigninStateModel=Backbone.Model.extend({STATE:i,state:{UNKNOWN:n,SIGNING_OUT:s,OFFLINE:o,SIGNING_IN:a,SIGNED_IN:r,RETRYING:l},REASON:d,reason:{SIGNED_OUT:f,DISABLED:c,BUMPERED:u,ERROR:h,OLD_VERSION:p,EOL:g},DISCONNECTED:m,FORCED_OFFLINE:v,initialize:function(e,t){this.options=t,Backbone.Model.prototype.initialize.call(this,e),_.bindAll(this,"_stateChanged"),this.listenTo(this,"change:state",this._stateChanged)},defaults:{STATE:n},fetch:function(){},save:function(){},destroy:function(){return $.Deferred().resolve().promise()},setOffline:function(e,t){this.set(this.REASON,e,{silent:!0}),this.set(this.STATE,this.state.OFFLINE,{silent:t}),this._stateChanged(this,this.state.OFFLINE,!0)},_stateChanged:function(e,i){var n=!1,s=!1;if(i===this.state.OFFLINE&&this.options.appApi.sessionApi.isSignedIn()){var o=this.get(this.REASON);o===this.reason.ERROR?s=!0:o!==this.reason.SIGNED_OUT&&(n=!0)}this.set(this.FORCED_OFFLINE,n),this.set(this.DISCONNECTED,s),t._forceOfflineMode=n,t._disconnectedMode=s},stateIsEphemeral:function(){switch(this.get(this.STATE)){case this.state.SIGNED_IN:case this.state.OFFLINE:return!1}return!0}}),t.FafSigninStateModel}),define("fss/js/data/signaturesdata",["fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-api-util","core/utils/crypto-util"],function(e,t,i,n){function s(t){this.isGlobal=t,this.vals={},this.rejected={},t&&e._fafFlushableDataModel.addFlushable({form:this})}return s.prototype.getAllDataFromServer=function(e,t){function i(){for(var e=o.length-1;e>=0;e--)switch(o[e].state()){case"rejected":a=!0;case"resolved":o.splice(e,1)}o.length>0?setTimeout(i,10):(a,s.resolve())}void 0===t&&(t=!1);var n=this,s=$.Deferred(),o=[];_.isArray(e)&&(e=n.getFieldsObject(e));var a=!1;return _.each(e,function(e,i){["signature","initials"].indexOf(e.type)>-1&&o.push(n.getSingleSign(i,e,t).fail(function(e){n.rejected[e]=1}))}),i(),s.promise()},s.prototype.getFieldsObject=function(e){var t={};return _.each(e,function(e){this[e.assetID]=e},t),t},s.prototype.loadImageForSize=function(e){var i=$.Deferred(),n=new Image;return n.onload=function(){var t={pngData:e};t.imageSize={width:n.width,height:n.height},i.resolve(t)},n.onerror=function(){t.logError("sigdata","Unable to draw signature"),i.reject()},n.src=t.normalizeImageSrc(e),i.promise()},s.prototype.getSingleSign=function(e,n,s){var o=$.Deferred();return void 0===s&&(s=!1),n.assetID?i.getSignature(n.assetID,this.isGlobal,s).done(_.bind(function(i){t.logInfo("sigdata","getting signatures successful"),this.loadImageForSize(i.imgData).then(_.bind(function(t){s&&(n.kind="image"),this.setNewSignature(e,$.extend(t,n)),o.resolve()},this)).fail(function(){o.reject()})},this)).fail(function(i){t.logError("sigdata","Failed trying to get signature: "+i),o.reject(e)}):o.reject(e),o.promise()},s.prototype.clearAll=function(){this.vals={}},s.prototype.getAll=function(){return this.vals},s.prototype.getImgData=function(e){return this.vals&&e in this.vals?this.vals[e].pngData:null},s.prototype.getImgHash=function(e){return n.getSha256(e)},s.prototype.getSignatureIDFromHash=function(e){var i=$.Deferred(),s=!1;this.vals||i.resolve();for(var o in this.vals)this.vals[o].hash||(this.vals[o].hash=this.getImgHash(this.vals[o].pngData)),this.vals[o].hash==e.hash&&(s=!0,i.resolve({signID:o}));if(s)return i;var a;return this._getBase64ImgDataFromURL(e.url,e).then(_.bind(function(e){var i=[];if(e&&e.imgData){var s=n.getSha256(e.imgData);for(var o in this.vals)i.push(this._getBase64ImgDataFromURL(this.vals[o].pngData,s).then(_.bind(function(e){if(e&&e.imgData){var t=n.getSha256(e.imgData);t==s&&(a=o)}},this)));return t.whenDone(i)}},this)).then(function(){a?i.resolve({signID:a}):i.reject()}),i},s.prototype.getSignatureHash=function(e){return this.vals&&e in this.vals&&this.vals[e].pngData?(this.vals[e].hash||(this.vals[e].hash=this.getImgHash(this.vals[e].pngData)),this.vals[e].hash):null},s.prototype.getImgSize=function(e){return this.vals&&e in this.vals?$.extend({},this.vals[e].imageSize):null},s.prototype.setNewSignature=function(e,t){this.vals[e]=t},s.prototype.getSignature=function(e){return this.vals[e]},s.prototype.getFirstSignature=function(e){var t=null;return _.each(this.vals,function(i){i.type===e&&(t=i)}),t},s.prototype.delSignature=function(e){delete this.vals[e]},s.prototype.isEmpty=function(){return 0===Object.keys(this.vals).length},s.prototype.deleteSig=function(e){var n=$.Deferred();return i.deleteSignature(e,this).done(function(){n.resolve()}).fail(function(){t.logError("sigdata","ERROR: Failed to delete signature asset."),n.reject()}),n},s.prototype._getBase64ImgDataFromURL=function(e,i){var n=$.Deferred(),s=new Image;return s.onload=function(){var s=document.createElement("canvas");s.width=this.width,s.height=this.height;var o=s.getContext("2d");o.drawImage(this,0,0);var a=s.toDataURL("image/png").split(",")[1];s.remove(),t.logInfo("readerJSWrapper got imgData from "+e),n.resolve({imgData:a,inputData:i})},s.onerror=function(){t.logError("readerJSWrapper error loading imgData from "+e),n.reject()},s.src=e,n.promise()},s.prototype.findSignatureID=function(e,t){var n=$.Deferred();return i.getGlobalSignatures().then(_.bind(function(i){if(!i||0==i.length)return void n.reject();for(var s=0;s<i.length;s++){var o=i[s];if(o.type===t&&o.assetID==e){this.getSignatureIDFromHash(o).always(_.bind(function(e){e&&e.signID?n.resolve({signID:e.signID}):n.reject()},this));break}}},this)),n},s.prototype.needsFlushing=function(){return!_.isEmpty(e._signatures.signsToStore)},s.prototype.flush=function(){e.opFactory.create("SaveSignatureAssetOp").run()},s.prototype.flushName=function(){return"SignatureData"},s}),define("fss/js/models/faf-userdata-model",["fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/faf-common-util","fss/js/data/signaturesdata","fss/js/lib/reader/faf-reader-api-caller"],function(e,t,i,n,s,o){return e.FafUserDataModel=Backbone.Model.extend({_dirty:!1,_initializedDefer:$.Deferred(),recognized:{version:{type:"number",required:!0},profiles:{type:"object",required:!0}},defaults:{},initialize:function(i,n){this.options=n,Backbone.Model.prototype.initialize.call(this),this._triggerFlush=_.throttle(this._triggerFlush,1500,{leading:!1}),this.signatureData=new s(!0),this.set("profiles",[]),_.bindAll(this,"_signinChange");var o=this.options.fafSigninStateModel;this.listenTo(o,"change:"+o.STATE,this._signinChange),e._fafFlushableDataModel.addFlushable({userdata:this}),this.on("sync",_.bind(function(){delete this._flushPromiseInProgress,t.logInfo("faf-userdata-model","user data synced"),this._flushPromise.resolve()},this))},fetch:function(e){this._flushPromise=this._flushPromise||$.Deferred();var t=this.options.fafSigninStateModel;return t.stateIsEphemeral()||(this._flushPromiseInProgress=!0,this.signatureData.clearAll(),e=i.getAjaxOptions("GET","/profiles"),Backbone.Model.prototype.fetch.call(this,e).fail(_.bind(function(e){delete this._flushPromiseInProgress,this._flushPromise.reject(e)},this))),this._flushPromise},getUserDataModelPromise:function(e){return e&&this._flushPromise&&delete this._flushPromise,this._flushPromise?this._flushPromise:this.fetch()},save:function(e,t,n){return this._dirty=!1,n=i.getAjaxOptions("POST","/profiles"),n=_.extend(n,{error:_.bind(function(){this.setDirty()},this)}),!e||_.isObject(e)?Backbone.Model.prototype.save.call(this,e,n):Backbone.Model.prototype.save.call(this,e,t,n)},destroy:function(){return $.Deferred().resolve().promise()},isDirty:function(){return this._dirty},setDirty:function(){this._dirty=!0,this._triggerFlush()},_triggerFlush:function(){e._flushAllDirty&&e._flushAllDirty()},getProfile:function(e){var t=this.get("profiles");return _.isArray(t)?_.find(t.value,function(t){return e===t.key})||t[0]:t},getObject:function(e,i){function n(e){return o===e.key}var s,o;if(e){if(e=e.split("."),s=i||this.getProfile("default"),!s)return void t.logError("faf-userdata-model","getObject called before initialization finished!");for(;e.length>0&&s.value&&(o=e.shift(),s=this._find(s.value,n)););}return s},getFieldText:function(e){var t=this.getObject(e);return t?t.text:""},setFieldText:function(e,t){var i=this.getObject(e);i&&i.text!==t&&(void 0===t?delete i.text:i.text=t,this.setDirty(),this.trigger("change:field",e))},uniqueNumber:1,addGroup:function(e){var t=this.getObject(e);if(t){var i={key:"group_"+this.uniqueNumber++};if(t.value){_.isArray(t.value)?(i.value=[],_.each(t.value,function(e){i.value.push({key:e.key})})):i.value={key:t.value.key};var n=e.replace(/\.group_([^.]+)$/,""),s=this.getObject(n);s&&(_.isArray(s.value)||(s.value=[s.value]),s.value.push(i),this.setDirty(),this.trigger("change:add_group",n+"."+i.key))}}},removeGroup:function(e){var t=this.getObject(e.replace(/\.group_([^.]+)$/,""));if(t&&t.value&&t.value.length>1){var i=-1,n=/\.group_([^.]+)$/.exec(e);_.find(t.value,function(e){return i++,e.key===n}),i>=0&&i<t.value.length&&(t.value.splice(i,1),this.setDirty(),this.trigger("change:remove_group",e))}},replaceSignatures:function(e){console.log("printing stack for replaceSignatures"),console.log((new Error).stack);var s=$.Deferred(),o=n.isSignedInAndConnected(),a=this;return t.getResolvedPromise().then(function(){if(o){var e=i.getAjaxOptions("GET","/profiles");return $.ajax(e).then(function(e){var i=_.find(e.profiles[0].value,function(e){return"signature"===e.key});return i||t.logError("faf-userdata-model:replaceSignatures","No signatures in profile."),i}).fail(i.handleDexiErrorResponse(function(e,s){return t.logError("faf-userdata-model:replaceSignatures","Error getting profile: "+s.toJSONString()),n.desktopNativeSignCommand()||i.defaultErrorHandler(s),$.Deferred().reject(s.toJSONString()).promise()}))}}).then(function(t){var i=a.getObject("signature");if(t){var n=t.value;i&&(i.value=n),_.each(e,function(e){var t=_.find(n,function(t){return t.type===e.type});t&&(e.assetID=t.assetID)})}else{if(o||!i)return $.Deferred().reject("No signatures in profile.").promise();i.value=e}_.each(a.signatureData.getAll(),function(e){a.trigger("change:remove_signature",e.assetID)}),a.signatureData.clearAll(),_.each(e,function(e){a.signatureData.setNewSignature(e.assetID,e),a.trigger("change:add_signature",e.assetID)}),s.resolve()}).fail(function(e){t.logError("faf-userdata-model:replaceSignatures","Error happened: "+e),s.reject(e)}),s.promise()},addSignature:function(e,i){var n=this,s=n.getObject("signature");if(!s)return void t.logError("faf-userdata-model","No signatures in profile.");var o=s.value;delete i.addToGlobal;var a={type:i.type,kind:i.kind,assetID:e};"input"===i.kind&&_.extend(a,{text:i.text,style:i.style||i.font}),o.push(a),o&&(n=this),n.signatureData.setNewSignature(e,_.extend(i,{assetID:e})),n.setDirty(),n.trigger("change:add_signature",e)},removeSignature:function(e){var i=$.Deferred(),n=this.getObject("signature");if(!n)return t.logError("faf-userdata-model","No signatures in profile."),i.resolve({deleted:!1}).promise();var s=-1,o=n.value,a=this.signatureData.getSignature(e),r=a&&a.assetID||e;if(_.each(o,function(e,t){e.assetID===r&&(s=t)}),s>-1){var l=this.signatureData.deleteSig(r);l.always(_.bind(function(){var n="resolved"===l.state();t.logInfo("faf-userdata-model","Signature deleted."),this.signatureData.delSignature(e),o.splice(s,1),this.setDirty(),this.trigger("change:remove_signature",e),i.resolve({deleted:n})},this))}else i.resolve({deleted:!1});return i.promise()},findSignatureID:function(e,i){var n=$.Deferred(),s=this.getObject("signature");if(!s)return t.logError("faf-userdata-model","No signatures in profile."),n.resolve({found:!1}).promise();var o=this.signatureData.findSignatureID(e,i);return o.always(_.bind(function(e){var i="resolved"===o.state();t.logInfo("faf-userdata-model","Signature found."),n.resolve({found:i,signID:e&&e.signID?e.signID:null})},this)),n.promise()},_find:function(e,t){return _.isArray(e)?_.find(e,t):_.isObject(e)&&t(e)?e:void 0},needsFlushing:function(){return this.isDirty()},flush:function(){return this.save()},flushName:function(){return"FafUserDataModel"},_signinChange:function(e){e.stateIsEphemeral()?this._flushPromiseInProgress?(delete this._flushPromiseInProgress,this._flushPromise.reject()):this._flushPromise&&"pending"!==this._flushPromise.state()&&delete this._flushPromise:this.fetch()},onProfileUpdate:function(){var e=this.options.fafSigninStateModel;this._signinChange(e)}}),o.mixin(e.FafUserDataModel),e.FafUserDataModel}),define("fss/js/lib/faf-preferences-debug",["fss/js/ac-faf"],function(e){function t(t,i){e._fafPreferencesModel.setPreference("develop_options."+i,t),e._fafPreferencesModel.setPreference(i,void 0)}function i(t,i){var n=e._fafPreferencesModel.getPreference("develop_options");return n&&_.has(n,t)?n[t]:i}return{fill_and_sign:{label:"Fill And Sign",fields:{pdf_form_worker_development:{label:"PDF Form Worker Development",type:"checkbox",setPreference:null,reloadRequired:!1,defaultVal:function(){return i.call(this,"pdf_form_worker_development",!1)},submitAction:t,helptext:"Turn on to use the PDF Form Worker development server."},recognition_worker_development:{label:"Field Recognition Worker Development",type:"checkbox",setPreference:null,reloadRequired:!1,defaultVal:function(){return i.call(this,"recognition_worker_development",!1)},submitAction:t,helptext:"Turn on to use the Field Recognition Worker development server."},show_recognized_fields:{label:"Highlight recognized fields",type:"checkbox",reset:"delete",setPreference:null,reloadRequired:!1,defaultVal:function(){return i.call(this,"show_recognized_fields",!1)},submitAction:t,helptext:"Turn on to see the recognized fields."}}}}}),define("fss/js/models/faf-preferences-model",["core/utils/http-util","fss/js/ac-faf","fss/js/lib/faf-preferences-debug","fss/js/lib/faf-common-api-util","fss/js/lib/faf-common-util","fss/js/lib/util"],function(e,t,i,n,s,o){return t.FafPreferencesModel=Backbone.Model.extend({id:"fillsign",idAttribute:"id",_dirty:!1,_preferences:{user:{},session:{}},_initDefer:$.Deferred(),recognized:{user:{type:"object",optional:!0},session:{type:"object",optional:!0},doc_cloud_status_promise:{type:"object",optional:!0}},defaults:{},initialize:function(e,n){this.options=n,Backbone.Model.prototype.initialize.call(this),this._triggerFlush=_.throttle(this._triggerFlush,1500,{leading:!1}),this.set({user:{},session:{},id:"fillsign"}),t.appApi.pluginsApi.callPluginMethod("debug_config","registerExtension",i),_.bindAll(this,"_signinChange");var s=this.options.fafSigninStateModel;this.listenTo(s,"change:"+s.STATE,this._signinChange),this._addToFlushables()},initialized:function(){return this._initDefer.promise()},fetch:function(){var e;try{e=s.isSignedInAndConnected()?t.appApi.usersMeApi.getUserPrefs("fillsign"):$.Deferred().resolve({}).promise()}catch(i){var a={methodName:"getUserPrefs",methodArgs:[{AVGeneral:{UserdataSaveGuide:!1}}]};e=$.Deferred(),t.appApi.rnaApi.done(function(i){return i.fssApi(a).done(function(i){var n=JSON.parse(i),s=n.UserdataSaveGuide,o={id:"_",desktop:{userdataSaveGuide:s}};if(e.resolve(o),0==s){var a={methodName:"setUserPrefs",methodArgs:[{AVGeneral:{UserdataSaveGuide:!0}}]};t.appApi.rnaApi.done(function(e){e.fssApi(a)})}})})}e.done(_.bind(function(e){e&&(e.preferences&&e.preferences.user&&(e=$.extend(e,e.preferences.user)),this._preferences.user=_.omit(e,["id","preferences","session","doc"]),this._preferences.autoCPref=_.omit(e,["id","preferences","session","doc"]))},this));var r=n.getSessionPrefs();r.done(_.bind(function(e){this._preferences.session=e||{}},this)),$.when(e,r).done(_.bind(function(){"pending"===this._initDefer.state()&&(o.logInfo("faf-preferences-model","preferences loaded"),this._initDefer.resolve())},this)).fail(_.bind(function(){"pending"===this._initDefer.state()&&(LOG.error("ERROR: Cannot get faf preferences -- user: "+e.state()+" session: "+r.state()),this._initDefer.reject())},this))},save:function(){var e,i=this._preferences.session||{},o=this._preferences.user||{};try{e=s.isSignedInAndConnected()?t.appApi.usersMeApi.setUserPrefs("fillsign",o):!1}catch(a){e=$.Deferred().resolve({}).promise()}return $.when(e,n.setSessionPrefs(i)).done(_.bind(function(){this._dirty=!1},this))},destroy:function(){return $.Deferred().resolve().promise()},isDirty:function(){return this._dirty},setDirty:function(){this._addToFlushables(),this._dirty=!0,this._triggerFlush()},_triggerFlush:function(){t._flushAllDirty?t._flushAllDirty():this.save()},_parse:function(e){function i(e,t){return e.hasOwnProperty(t)||(e[t]={}),"user"===t&&s.isDesktop()?i(e[t],"desktop"):e[t]
}if(e&&(e=e.split("."),"user"!==e[0]&&"session"!==e[0]&&"doc"!==e[0]&&"autoCPref"!==e[0]&&e.unshift("user"),"doc"===e[0]&&e.unshift("session"),e.length>1&&e.length<10)){for(var n=this._preferences;e.length>1;){var o=e.shift();n="doc"===o?i(i(n,"doc"),t._formManager.formID):i(n,o)}return"doc"===e[0]?void 0:{obj:n,key:e[0]}}return void 0},getPreference:function(e){var t=this._parse(e);return t?t.obj[t.key]:void 0},setPreference:function(e,t){var i=this._parse(e);if(i){var n=i.obj[i.key];n!==t&&(void 0===t?delete i.obj[i.key]:i.obj[i.key]=t,(s.isDesktop()||!/^session\./.test(e))&&this.setDirty(),this.trigger("change:"+e,t,n))}},needsFlushing:function(){return this.isDirty()},flush:function(){return this.save()},flushName:function(){return"FafPreferencesModel"},_addToFlushables:function(){t._fafFlushableDataModel&&t._fafFlushableDataModel.addFlushable({preferences:this})},_signinChange:function(e){e.stateIsEphemeral()||this.fetch()}}),t.FafPreferencesModel}),define("fss/js/models/faf-autocomplete-model",["core/ac-core","core/models/model","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/formcanvas","i18n!fss/js/nls/ui-strings","fss/js/lib/faf-common-util"],function(e,t,i,n,s,o,a,r){return i.FafAutocompleteModel=e.UiModel.extend({recognized:{ok_to_post:{type:"boolean",optional:!1},values:{type:"object",optional:!1},source:{type:"object",optional:!1},_userdata_source:{type:"object",optional:!0},_faf_vals_source:{type:"object",optional:!0},userdata:{type:"object",optional:!0},source_defer:{type:"object",optional:!1},menu_open_cch:{type:"number",optional:!1},menu_state:{type:"string",optional:!0},menu_scroll:{type:"boolean",optional:!0},$menu_last_focus:{type:"object",optional:!0},$menu_items:{type:"object",optional:!0},$menu_widget:{type:"object",optional:!0},menu_id_array:{type:"object",optional:!0},menu_ac_ui_content:{type:"object",optional:!0},menu_form_padding:{type:"number",optional:!1},min_length:{type:"number",optional:!1},max_length:{type:"number",optional:!1}},defaults:{values:[],source:[],source_defer:$.Deferred(),menu_open_cch:-1,menu_state:"closed",min_length:3,max_length:100,menu_form_padding:-1},initialize:function(t,n){e.UiModel.prototype.initialize.call(this),this.options=n,this.acHelperViewInput="",this.readerACHelperValueSet=new Set,this.searchForNewSuggestions=!0,this.ACValuesSyncedFromServer=!1,_.bindAll(this,"_userDataChanged","_updateSource","_updateFafValSource","_clearValues"),this.on("change:strings",this._updateFafValSource),this.on("change:_faf_vals_source",this._updateSource),this.on("change:_userdata_source",this._updateSource);var s=this.options.fafUserDataModel;this.set("userdata",s),s.on("change:field",this._userDataChanged),s.on("sync",this._userDataChanged),_.bindAll(this,"_signinChange");var o=this.options.fafSigninStateModel;this.listenTo(o,"change:"+o.STATE,this._signinChange);var a={methodName:"getAutoCValsFromReg"},r=$.Deferred();i.appApi.rnaApi.done(function(e){e.fssApi(a).done(function(e){e&&r.resolve(JSON.parse(e))})}),r.then(_.bind(function(e){this.set("source",e),this.get("source_defer").resolve(this.get("source")),this.set("_faf_vals_source",e);var t=[];_.each(e,_.bind(function(e){t.push({v:e.value,f:1,t:1,n:e.count})},this)),this.set("values",t),this._updateUserdataSource()},this))},setAutoCompleteHelperViewInput:function(e){this.acHelperViewInput=e,this.trigger("getACSuggestionList")},getAutoCompleteHelperViewInput:function(){return this.acHelperViewInput},getAutoCompleteHelperNewValues:function(){return Array.from(this.readerACHelperValueSet)},fetch:function(){this._retrieveAcValues()},prepare:function(){this.unset("menu_state",{silent:!0}),this.unset("$menu_last_focus",{silent:!0}),this.unset("$menu_items",{silent:!0}),this.unset("$menu_widget",{silent:!0}),this.unset("menu_id_array",{silent:!0}),this.unset("menu_ac_ui_content",{silent:!0}),this.set("menu_open_cch",-1,{silent:!0}),this.set("menu_form_padding",-1)},sourcePromise:function(){return this.get("source_defer").promise()},_clearValues:function(){this.set("values",[]),this._updateFafValSource()},_retrieveAcValues:function(){this.set("ok_to_post",!1),this.set("source",[]);var e=this.options.fafAutocompleteStateModel;e.getState().then(_.bind(function(t){if(!e.featureIsEnabled(!0))return void this.get("source_defer").resolve(this.get("source"));this.listenTo(e,"clear_values",this._clearValues);var o=t.ac_c>0,a=o?"?ac_c="+t.ac_c:"",l=s.addDexiAjaxOptions(s.getAjaxOptions("/autoc"+a),{version:2,useCharset:!0,setContentType:!0,setAccepts:!0});$.ajax(l).done(_.bind(function(t){"{}"!==JSON.stringify(t)&&0!==t.values.length&&(this.ACValuesSyncedFromServer=!0,this.set({values:t.values},{silent:!0}));var i=r.isSignedInAndConnected();i&&this._updateFafValSource(),this.set("ok_to_post",!0),o&&e.setManually("ac_c",0)},this)).fail(_.bind(s.handleDexiErrorResponse(_.bind(function(e,t){n.logError("autocomplete","Error "+t.message+" getting autocomplete values"),this.set("ok_to_post",!1)},this)),this)).always(_.bind(function(){this.trigger("change:_faf_vals_source"),this.get("source_defer").resolve(this.get("source")),i.appApi.rnaApi.done(function(e){e.isFeatRunning()&&e.isASTestAllowInstantiation()&&e.invokeMethod({methodName:"logASTestReportAPI",methodArgs:["FSSAutocompleteDone","FSSAutoC","CallDone"]})})},this))},this))},stringIsValid:function(e){return"string"==typeof e&&e.length>=this.get("min_length")&&e.length<=this.get("max_length")},indexOfString:function(e,t){if(!e)return n.logError("autocomplete","null values for indexOfString"),-1;for(var i=0;i<e.length;i++)if(e[i].v===t)return i;return-1},valueOfString:function(e,t){var i=this.indexOfString(e,t);return i>=0?e[i]:null},callWithStrAndValues:function(e,t){if(this.stringIsValid(e)){var i=this.options.fafAutocompleteStateModel;i.initialized().then(_.bind(function(){i.featureIsEnabled()&&this.sourcePromise().then(_.bind(function(){t(this.get("values"),e)},this))},this))}},allowString:function(e){var t=e;this.callWithStrAndValues(e,_.bind(function(e,i){var n=this.valueOfString(e,i),s=!1;n?(n.c++,s=!0):(n={v:t,c:1,f:1,t:0},e.push(n)),s||this.trigger("change:strings")},this))},removeString:function(e,t){this.callWithStrAndValues(e,_.bind(function(e,i){var n=this.indexOfString(e,i);if(n>=0){var s=e[n];t&&t.exclude?s.c=0:s.c--,s.c<=0&&e.splice(n,1),this.trigger("change:strings")}},this))},excludeString:function(e){this.sourcePromise().then(_.bind(function(){this.removeString(e,{exclude:!0}),i.opFactory.create("ExcludeAutocompleteStringOp",{string:e}).run(),this.trigger("change:strings")},this))},_updateFafValSource:function(){var e=this.get("_userdata_source")||this._updateUserdataSource({silent:!0}),t=this.get("values"),i=[],n=e.length+1e4;_.each(t,_.bind(function(e,t){i.push({value:e.v,key:t,id:n,count:e.n}),n++},this)),this.set("_faf_vals_source",i)},_userDataChanged:function(){this._updateUserdataSource()},_updateUserdataSource:function(e){var t=this.get("userdata"),i=t&&t.getProfile("default");if(i){var n=this._createUserdataSource(i,[],"UserData");return this.set("_userdata_source",n,e),n}return[]},_createUserdataSource:function(e,t,i){if(_.isArray(e.value))"default"!==e.key&&(i+=e.key),i+=".",_.each(e.value,_.bind(function(e){this._createUserdataSource(e,t,i)},this));else if(this.stringIsValid(e.text)){var n,s=i;if(!e.key&&o.isSignatureType(e.type))return;s=i+e.key,s=s.replace(/group_[A-Za-z0-9]+\./g,""),n=a[s],t.push({value:e.text,key:s,id:t.length,udata:n})}return t},_updateSource:function(){var e=this.get("_userdata_source")||[],t=this.get("_faf_vals_source")||[],i=_.clone(e).concat(t);this.set("source",i)},_signinChange:function(e){e.stateIsEphemeral()||this.fetch()},REGEXP_PUNCT:" \\t\\n\\r -/:-@\\[-`\\{-\\~　-〿＀-＠［-｀｛-｠｡-･￠-￯׀׃׆׳״؉؊،؍؛؛؞؟٪-٭۔๏๚๛꫞꫟",luhnChk:function(e){for(var t=e.length,i=0,n=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],s=0;t--;)s+=n[i][parseInt(e.charAt(t),10)],i^=1;return s%10===0&&s>0},couldBeSSN:function(e){var t=new RegExp("["+this.REGEXP_PUNCT+"]","g"),i=e.replace(t,""),n=new RegExp("^[0-9]{9}$");return n.test(i)},isValidCCNumber:function(e){var t=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$","i"),i=e.replace(/[ -]/g,"");return t.test(i)&&this.luhnChk(i)},couldBeSensitive:function(e){var t=new RegExp("^[0-9]{1,6}$");return t.test(e)||this.couldBeSSN(e)||this.isValidCCNumber(e)}}),i.FafAutocompleteModel}),define("fss/js/models/faf-autocomplete-state-model",["core/ac-core","core/models/model","fss/js/ac-faf","fss/js/lib/faf-common-util"],function(e,t,i,n){return i.FafAutocompleteStateModel=e.Model.extend({_initDefer:$.Deferred(),_setResizeMenu:!1,defaults:{ac_c:0,ac_s:0},initialize:function(t,i){this.options=i,e.Model.prototype.initialize.call(this),this.set(this.defaults),_.bindAll(this,"_signinChange");var n=this.options.fafSigninStateModel;this.listenTo(n,"change:"+n.STATE,this._signinChange)},initialized:function(){return this._initDefer.promise()},getState:function(){var e=$.Deferred();return this.initialized().then(_.bind(function(){e.resolve({ac_c:this.get("ac_c"),ac_s:this.get("ac_s")})},this)).fail(_.bind(function(){e.resolve(this.defaults)},this)),e.promise()},setManually:function(t,n){var s=i._fafPreferencesModel;s.initialized().then(function(){s.setPreference("user."+t,n)}),e.UiModel.prototype.set.call(this,t,n)},fetch:function(){return this.options.fafAppLimitsModel.initialized().then(_.bind(function(){return i.opFactory.create("GettingAutocompleteStateOp",{appApi:i.appApi}).run()},this)).then(_.bind(function(e){this.featureIsEnabled(!0)?"number"!=typeof e.ac_s&&(e.ac_s=1):e.ac_s=0,"number"!=typeof e.ac_c&&(e.ac_c=0),this.set({ac_c:e.ac_c,ac_s:e.ac_s})},this)).fail(_.bind(function(){this.set(this.defaults,{silent:!0}),this._failed=!0,LOG.warning("Using default autocomplete state")},this)).always(_.bind(function(){this._setJQAResizeMenu(),this._initDefer.resolve()},this))},_setJQAResizeMenu:function(){i.FafAutocompleteStateModel.prototype._setResizeMenu||(i.FafAutocompleteStateModel.prototype._setResizeMenu=!0,$.ui.autocomplete.prototype._resizeMenu=function(){var e=this.menu.element;e.outerWidth(this.element.outerWidth())})},featureIsEnabled:function(e){var t=(n.isSignedInAndConnected(),n.isDesktop()),i=t&&!this._failed&&(e||this.get("ac_s"));return i},_signinChange:function(e){e.stateIsEphemeral()||this.fetch()}}),i.FafAutocompleteStateModel}),define("fss/js/models/faf-flushable-data-model",["fss/js/ac-faf","core/ac-core"],function(e,t){return e.FafFlushableDataModel=t.Model.extend({initialize:function(e,i){this.options=i,t.Model.prototype.initialize.call(this),this._initWrappers(),this.set("flushables",{})},_initWrappers:function(){},fetch:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()},addFlushable:function(e){if(e instanceof Array)return void _.each(e,_.bind(function(e){this.addFlushable(e)},this));var t=_.keys(e)[0],i=e[t];_.bindAll(i,"needsFlushing","flush"),_.extend(this.get("flushables"),e)}}),e.FafFlushableDataModel}),define("fss/js/models/ui/faf-signature-popup-ui-model",["core/ac-core","fss/js/ac-faf","core/models/ui/ui-model"],function(e,t){return t.FafSignaturePopupUiModel=e.UiModel.extend({recognized:{close_popup_called:{type:"boolean",optional:!1},field_id:{type:"string"},sig_type:{type:"string"},signature:{type:"object",optional:!0},add_to_global:{type:"boolean",optional:!1},font_family:{type:"string",optional:"adobe-hand-d"},faf_user:{type:"object",optional:{}},active_kind:{type:"string",optional:"input"},orig_active_kind:{type:"string"},scribble_initialized:{type:"boolean",optional:"false"},font_menu_initialized:{type:"boolean",optional:"false"},canvas_width:{type:"number",optional:0},scribble_mouse_down:{type:"boolean"},mouse_up_count:{type:"number"},mouse_down_count:{type:"number"},available_fonts:{type:"object",optional:!1},cleaning_image:{type:"boolean"},progress:{type:"boolean",optional:!0},save_enabled:{type:"boolean",optional:!0},save_options:{type:"object",optional:!0},$type:{type:"object",optional:!0},$draw:{type:"object",optional:!0},$image:{type:"object",optional:!0},popupLoading:{type:"boolean"},imageCleanSessionID:{type:"string"},isDirectInkActivated:{type:"boolean"},isBlank:{type:"boolean"},isSigned:{type:"boolean"},signInfo:{type:"string"},mouseEvent:{type:"object",optional:!0},activateApply:{type:"boolean"},signatureSaved:{type:"boolean"}},defaults:{add_to_global:!0,active_kind:"none",orig_active_kind:"none",field_id:"none",scribble_mouse_down:!1,mouse_up_count:0,mouse_down_count:0,font_family:"adobe-hand-d",available_fonts:["adobe-hand-a","adobe-hand-b","adobe-hand-c","adobe-hand-d"],cleaning_image:!1,popupLoading:!0,imageCleanSessionID:"none",isDirectInkActivated:!1,isBlank:!1,isSigned:!0,signInfo:"",activateApply:!1,signatureSaved:!0},initialize:function(){e.UiModel.prototype.initialize.call(this);var i=this;i.on("change:field_id",function(){var e=i.get("field_id"),n=t._signatures.formSignatures.getSignature(e);n&&"none"===i.get("orig_active_kind")&&i.set("orig_active_kind",n.kind),n&&n.type&&i.set("sig_type",n.type),i.set("signature",n)})},init:function(e){this.set(_.extend(this.attributes,e||{}))}}),t.FafSignaturePopupUiModel}),define("fss/js/models/faf-formvalue-model",["fss/js/ac-faf","core/ac-core"],function(e,t){return e.FafFormValueModel=t.UiModel.extend({recognized:{text:{type:"string",optional:!0},assetID:{type:"string",optional:!0},kind:{type:"string",optional:!0,choices:["scribble","input","image"]},type:{type:"string",optional:!1,choices:["textfield","annotationImage","signature","initials"]},style:{type:"string",optional:!0,choices:["adobe-hand-a","adobe-hand-b","adobe-hand-c","adobe-hand-d"]},ac_c:{type:"number",optional:!0},ac_s:{type:"number",optional:!0},fieldID:{type:"string",optional:!1},changed:{type:"boolean",optional:!0}},defaults:{},idAttribute:"fieldID",initialize:function(){t.UiModel.prototype.initialize.call(this),this.isValid(),this._initWrappers()},_initWrappers:function(){this.listenTo(this,"change:text",_.bind(function(){var t=e._fafFieldCandidateMappingCollection;t&&t.isInitialized().then(_.bind(function(){t.alterMappingForFieldID({fieldID:this.get("fieldID"),value:this.get("text"),type:"manual"})},this))},this))},fetch:function(){return $.Deferred().resolve().promise()},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()}}),e.FafFormValueModel}),define("fss/js/collections/faf-formvalues-collection",["fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/data/signaturesdata","fss/js/data/fafconstants","fss/js/models/faf-formvalue-model"],function(e,t,i,n,s){return e.FafFormValuesCollection=Backbone.Collection.extend({defaults:{},model:e.FafFormValueModel,initialize:function(e,t){Backbone.Model.prototype.initialize.call(this,e),this.options=t,this._initWrappers(),this._sigsWaiting=[],_.bindAll(this,"_saveAllSigs")},_initWrappers:function(){this.on(s.USER_VALUE_CHANGED_LOCALLY,function(e){var t=this;t.setValue(e.id,{text:e.newValue,type:"textfield"})}),this.on(s.NEW_SIGNATURE_ADDED,_.bind(function(e){this._handleSignatureAdded(e)},this)),this._triggerFlush=_.throttle(this._triggerFlush,1500,{leading:!1}),this._dirty=!1,this._version=void 0},parse:function(e){var t=[];return _.isObject(e.values)?(this._version=e.values.version,_.each(e.values.formValues,function(e,i){t.push(_.extend(e,{fieldID:i}))}),t):e},_saveIsAllowed:function(){return!!e._formManager.formID},save:function(){if(!this._saveIsAllowed())return t.logError("FafFormValuesCollection","save called with no form!"),t.logToSplunk("FafFormValuesCollection.save called with no form!"),e._formManager.isDirty=!1,this._dirty=!1,this._closeDirty=!1,$.Deferred().resolve().promise();var n=this,s={},o=e._formManager.isDirty,a=n._dirty,r=n._closeDirty;e._formManager.isDirty&&(e._formManager.cancelAutoSaveTimers(),s.form=e._formManager.form,e._formManager.isDirty=!1),n.needsFlushing(this.options.closing)&&(s.values=n.toJSON(),n._dirty=!1);var l=JSON.stringify(s),d=$.Deferred(),f=i.getAjaxOptions("PUT","/formdata/"+e._formManager.formID,{data:l});return!n._forceSave&&e._formManager.etag&&(f.headers["If-Match"]='"'+e._formManager.etag+'"'),$.ajax(f).done(function(t,i,s){n._forceSave=!1,e._formManager.etag=s?s.getResponseHeader("ETag"):null,d.resolve(),delete n.saveInProgress}).fail(i.handleDexiErrorResponse(function(s,l){t.logError("FafFormValuesCollection","Error saving: "+l.toJSONString()),n._lastFocusElement=e._fafFormView.blurFocusedElement();var f=null,c=null;412===l.status&&(n._conflictDialogShown=!0,f=function(e,t){n._resetAfter412(!0,t),n._triggerFlush()},c=function(t,i){n._resetAfter412(!1,i);var s=e._formManager.formID,o=e._formManager.fafEditorUiModel.get("form_name");e._formManager.closeForm();var a=_.extend({formID:s,showProgress:!1,logEvent:!1,formName:o,formSource:"FillSignTab",formType:"ExistingForm",formOrigin:"AcomFile"},n.options);_.defer(function(){e.opFactory.create("OpenFormOp",a).run()})}),i.defaultErrorHandler(l,f,c),$(".faf-error-ok, .faf-error-cancel").blur(),_.delay(function(){$(".faf-error-ok").focus()},2e3),412!==l.status&&(n._dirty=n._dirty||a,n._closeDirty=n._closeDirty||r,e._formManager.isDirty=e._formManager.isDirty||o,delete n.saveInProgress),d.reject()})),this.saveInProgress=d.promise(),this.saveInProgress},_resetAfter412:function(t,i){this._conflictDialogShown=!1,this._forceSave=t,this._dirty=this._closeDirty=t,e._formManager.isDirty=t,delete this.saveInProgress,t&&this._lastFocusElement&&this._lastFocusElement instanceof e.FafFieldTextView&&this._lastFocusElement.fieldFocusElement().focus(),i&&i()},toJSON:function(){var e={version:this._version||1,formValues:{}},t=this.models;return _.each(t,function(t){var i=_.extend({},t.attributes),n=i.fieldID;delete i.fieldID,delete i.changed,e.formValues[n]=i}),e},destroy:function(){},getValue:function(e){var i=this.where({fieldID:e}),n=null;return 1===i.length?(n=_.extend({},i[0].attributes),delete n.fieldID):i.length>1&&t.logError("FafFormValuesCollection","Multiple fields with same identifier exist"),n},setValue:function(e,i){var n=this.where({fieldID:e});return!_.isObject(i)||n.length>1?void t.logError("FafFormValuesCollection","Multiple or no fields with this identifier exist"):(this.setDirty(),void(n.length?n[0].set(i):(i.fieldID=e,this.create(i))))},deleteValue:function(t){var i=this.where({fieldID:t}),n=null;1===i.length&&(n=_.extend({},i[0].attributes),this.remove(i),this.setDirty(),_.indexOf(["signature","initials"],n.type)>=0&&e._signatures.formSignatures.deleteSig(n.assetID))},isDirty:function(){return this._dirty},setDirty:function(){if(!this._saveIsAllowed())return t.logError("FafFormValuesCollection","changes made with no form!"),void t.logToSplunk("FafFormValuesCollection.setDirty called with no form!");if(this.saveInProgress){var i="client_generate_pdf, formId="+e._formManager.getFormID();t.logToSplunk(i+" detected edit while saving")}this._dirty=!0,this._closeDirty=!0,this._triggerFlush()},_triggerFlush:function(){e._flushAllDirty&&e._flushAllDirty()},_handleSignatureAdded:function(e){this._sigsWaiting.push(e),$.when(this.saveInProgress).then(_.bind(function(){this._sigSavePromise||this._saveAllSigs()},this))},_saveAllSigs:function(){var t=this._sigSaveDefer;t||(t=this._sigSaveDefer=$.Deferred(),this._sigSavePromise=t.promise());var i=this._sigsWaiting.shift(),n=this,s=i.signature,o=s.type||i.el.type,a=s.kind,r={type:o,kind:a};n.setDirty(),"input"===s.kind&&_.extend(r,{text:s.text||"",style:s.style||s.font}),e._signatures.formSignatures.setNewSignature(i.el.id,s);var l={signature:_.extend({id:i.el.id},s)};e.opFactory.create("SaveSignatureAssetOp",l).run().then(function(t){r.assetID=t[i.el.id].assetID,i.oldAssetID&&e._signatures.formSignatures.deleteSig(i.oldAssetID),n.setValue(i.el.id,r),i.signature.addToGlobal&&e._fafContentView.options.fafUserDataModel.addSignature(t[i.el.id].globalAssetID,s)}).always(_.bind(function(){0===this._sigsWaiting.length?(delete this._sigSaveDefer,delete this._sigSavePromise,t.resolve()):_.defer(this._saveAllSigs)},this))},_saveAutoComplete:function(){return e.opFactory.create("SendAutocompleteNewvaluesOp",this.options).run().then(_.bind(function(){this._closeDirty=!1},this))},needsFlushing:function(t){return!this._conflictDialogShown&&(e._formManager.isDirty||this.isDirty()||t&&this._closeDirty)},flush:function(t){var i=t&&this._closeDirty&&this._saveAutoComplete(),n=e._formManager.needsFlushing(t)&&$.when(this._sigSavePromise).then(_.bind(function(){return this.save()},this));return $.when(i,n)},flushName:function(){return"FafFormValuesCollection"},setModelChanged:function(e,i){var n=this.options.fafAutocompleteStateModel;n.initialized().then(_.bind(function(){if(n.featureIsEnabled()){var s=this.where({fieldID:e});1!==s.length?t.logError("FafFormValuesCollection","Multiple or no fields with identifier exist"):i?s[0].set("changed",i,{silent:!0}):s[0].unset("changed",{silent:!0})}},this))}}),e.FafFormValuesCollection}),define("fss/js/models/field-recognition/faf-field-candidate-model",["fss/js/ac-faf","core/ac-core"],function(e,t){return e.FafFieldCandidateModel=t.UiModel.extend({recognized:{id:{type:"string",optional:!1},kind:{type:"string",optional:!0},label:{type:"string",optional:!0},confidence:{type:"number",optional:!0},existing:{type:"boolean",optional:!0},maxChars:{type:"number",optional:!0},valueChoices:{type:"object",optional:!0},choiceOverride:{type:"boolean",optional:!0},multiSelect:{type:"boolean",optional:!0},groupName:{type:"string",optional:!0},groupIndex:{type:"number",optional:!0},markShape:{type:"string",optional:!0},location:{type:"object",optional:!0},locations:{type:"object",optional:!0},alternates:{type:"object",optional:!0}},defaults:{},initialize:function(){t.UiModel.prototype.initialize.call(this),this.isValid(),this._initWrappers()},_initWrappers:function(){},fetch:function(){return $.Deferred().resolve().promise()},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()}}),e.FafFieldCandidateModel}),define("fss/js/collections/field-recognition/faf-field-candidates-collection",["fss/js/ac-faf","fss/js/models/field-recognition/faf-field-candidate-model"],function(e){return e.FafFieldCandidatesCollection=Backbone.Collection.extend({defaults:{},model:e.FafFieldCandidateModel,initialize:function(){Backbone.Model.prototype.initialize.call(this),this._initWrappers()},_initWrappers:function(){},save:function(){return $.Deferred().resolve().promise()},fetch:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()}}),e.FafFieldCandidatesCollection}),define("fss/js/models/field-recognition/faf-field-candidate-page-model",["fss/js/ac-faf","core/ac-core","fss/js/collections/field-recognition/faf-field-candidates-collection"],function(e,t){return e.FafFieldCandidatePageModel=t.UiModel.extend({recognized:{pageNumber:{type:"number",optional:!1},height:{type:"number",optional:!1},width:{type:"number",optional:!1},scale:{type:"number",optional:!1},processed:{type:"boolean",optional:!1}},defaults:{processed:!1,scale:1},initialize:function(){t.UiModel.prototype.initialize.call(this),this.listenTo(e._fafEditorUiModel,"change:page_scale",_.bind(function(){this.set("scale",e._fafEditorUiModel.get("page_scale"))},this)),this.isValid()},parse:function(t){return this.candidates=new e.FafFieldCandidatesCollection(t.fields),{pageNumber:parseInt(t.pageNumber,10),height:t.height,width:t.width,processed:t.processed}},fetch:function(){return $.Deferred().resolve().promise()},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()},getFieldsArray:function(){return this.candidates&&this.candidates.models.length?this.candidates.toJSON():[]},getModelForCandidateID:function(e){return this.candidates.findWhere({id:e})}}),e.FafFieldCandidatePageModel}),define("fss/js/collections/field-recognition/faf-field-candidate-pages-collection",["fss/js/ac-faf","fss/js/lib/faf-ajax-util","fss/js/lib/util","fss/js/models/field-recognition/faf-field-candidate-page-model"],function(e,t,i){return e.FafFieldCandidatePagesCollection=Backbone.Collection.extend({defaults:{},model:e.FafFieldCandidatePageModel,initialize:function(){Backbone.Model.prototype.initialize.call(this),this._initWrappers(),this._initDefer=void 0},_initWrappers:function(){},parse:function(e){var t=[];return _.isEmpty(e.pages)||_.each(e.pages,function(i,n){t.push(_.extend(i,{fields:e.fields[n],processed:!1,pageNumber:n}))}),t},fetch:function(n){if(!e._formManager.formID)return $.Deferred().resolve().promise().then(function(){n.success&&n.success()});this._initDefer||(this._initDefer=$.Deferred());var s=this,o={reset:!0,success:function(){i.logToSplunk("FafFieldCandidatePagesCollection Loaded candidates"),s._initDefer.resolve(),n.success&&n.success()},error:t.handleDexiErrorResponse(function(){i.logToSplunk("FafFieldCandidatePagesCollection Failed to load candidates"),s._initDefer.reject()})},a=t.getAjaxOptions("GET","/fieldcandidates/"+e._formManager.formID);return Backbone.Collection.prototype.fetch.call(this,_.extend({},n,o,a))},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()},isInitialized:function(){return this._initDefer||(this._initDefer=$.Deferred()),this._initDefer.promise()},getRecognizedPageSize:function(e){var t=null,i=this.findWhere({pageNumber:e});return i&&(t={height:i.get("height"),width:i.get("width")}),t},getCandidateModel:function(e){if(e){var t;return _.each(this.models,function(i){var n=i.getModelForCandidateID(e);n&&(t=n)}),t}},reinit:function(){this.reset(),this._initDefer=$.Deferred()}}),e.FafFieldCandidatePagesCollection}),define("fss/js/models/field-recognition/faf-field-candidate-value-prediction-model",["fss/js/ac-faf","core/ac-core"],function(e,t){return e.FafFieldCandidateValuePredictionModel=t.UiModel.extend({recognized:{field:{type:"string",optional:!0},values:{type:"object",optional:!0}},defaults:{},initialize:function(){t.UiModel.prototype.initialize.call(this),this.isValid(),this._initWrappers()},_initWrappers:function(){},fetch:function(){return $.Deferred().resolve().promise()},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()}}),e.FafFieldCandidateValuePredictionModel}),define("fss/js/collections/field-recognition/faf-field-candidate-value-prediction-collection",["fss/js/ac-faf","fss/js/lib/faf-ajax-util","fss/js/models/field-recognition/faf-field-candidate-value-prediction-model"],function(e,t){return e.FafFieldCandidateValuePredictionCollection=Backbone.Collection.extend({defaults:{},model:e.FafFieldCandidateValuePredictionModel,initialize:function(){Backbone.Model.prototype.initialize.call(this),this._initWrappers()},_initWrappers:function(){},fetch:function(i){if(!e._formManager.formID)return $.Deferred().resolve().promise();var n=t.getAjaxOptions("GET","/valuepredictions/"+e._formManager.formID);return Backbone.Collection.prototype.fetch.call(this,_.extend(n,i))},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()},parse:function(e){var t=[];return _.isObject(e.values)&&_.each(e.values,function(e){t.push(e)}),t},getPredictionsForCandidate:function(e){var t=this.findWhere({field:e}),i=null;return t&&(i=t.get("values")),i}}),e.FafFieldCandidateValuePredictionCollection}),define("fss/js/models/field-recognition/faf-field-candidate-mapping-model",["fss/js/ac-faf","core/ac-core"],function(e,t){return e.FafFieldCandidateMappingModel=t.UiModel.extend({recognized:{value:{type:"string",optional:!0},type:{type:"string",choices:["predict","auto","manual","reject","approve"],optional:!0},fieldID:{type:"string"},candidateID:{type:"string"}},defaults:{type:"manual"},initialize:function(){t.UiModel.prototype.initialize.call(this),this.isValid(),this._initWrappers()},_initWrappers:function(){this.listenTo(this,"change",_.bind(function(){this.collection.setDirty()},this))},fetch:function(){return $.Deferred().resolve().promise()},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()}}),e.FafFieldCandidateMappingModel}),define("fss/js/collections/field-recognition/faf-field-candidate-mapping-collection",["fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/models/field-recognition/faf-field-candidate-mapping-model"],function(e,t,i){return e.FafFieldCandidateMappingCollection=Backbone.Collection.extend({defaults:{},model:e.FafFieldCandidateMappingModel,initialize:function(){Backbone.Model.prototype.initialize.call(this),this._initWrappers()},_initDefer:$.Deferred(),isInitialized:function(){return this._initDefer.promise()},isInitializedSync:function(){return"pending"!==this._initDefer.state()},_initWrappers:function(){this._dirty=!1,this.listenTo(this,"sync",_.bind(function(){this._initDefer.resolve(),this._syncCalls.success&&this._syncCalls.success(),delete this._syncCalls},this)),this.listenTo(this,"error",_.bind(function(){this._initDefer.reject(),this._syncCalls.error&&this._syncCalls.error(),delete this._syncCalls},this))},fetch:function(){return $.Deferred().resolve().promise()},save:function(){if(!e._formManager.formID)return this._dirty=!1,$.Deferred().resolve().promise();var n=i.getAjaxOptions("POST","/actions/"+e._formManager.formID);return n.success=_.bind(function(){t.logInfo("FafFieldCandidateMappingCollection","Mappings saved"),this._dirty=!1},this),$.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()},parse:function(t){var i=[];return this._version=t.version,_.isObject(t.actions)&&_.each(t.actions,function(t){e._formManager.indexOfFieldId(t.fieldID)&&i.push(t)}),i},toJSON:function(){var e={version:this._version||1,actions:[]},t=this.models;return _.each(t,function(t){e.actions.push(t.toJSON())}),e},load:function(e){this.isInitializedSync()&&(this._initDefer=$.Deferred()),this.reset();var t=[];_.isEmpty(e.form.pages)||_.each(e.form.pages,function(i,n){var s=e.form.pages[n].elements;_.each(s,function(e){e.candidateId&&t.push({fieldID:e.fid||e.id,candidateID:e.candidateId})})}),this.add(t),this._initDefer.resolve()},_updateCandidateStyle:function(t,i){var n=e._fafFieldCandidatePagesCollection.getCandidateModel(t);n&&n.trigger("change:state",i)},removeMapping:function(e){var t,i=this.where({fieldID:e.fieldID}),n=this.where({candidateID:e.candidateID}),s=null;return n&&n.length>0&&(t=this.remove(n,{silent:!0})),i&&i.length>0&&(t=this.remove(i,{silent:!0})),t&&t.length>0&&t[0]&&(s=t[0].get("candidateID"),this._updateCandidateStyle(t[0].get("candidateID"),"remove")),this.setDirty(),s},addMapping:function(e){if(e.fieldID&&e.candidateID){this.removeMapping(e);var t={fieldID:e.fieldID,candidateID:e.candidateID};e.type&&_.extend(t,{type:e.type}),e.value&&_.extend(t,{value:e.value}),this.create(t),this._updateCandidateStyle(e.candidateID,"add")}},alterMappingForFieldID:function(e){if(e.fieldID){var t=this.findWhere({fieldID:e.fieldID});t&&(e.type&&t.set({type:e.type}),e.value&&t.set({value:e.value}))}},setDirty:function(){this._dirty=!0},isDirty:function(){return this._dirty},isSmartField:function(e){var t=this.findWhere({fieldID:e});return t?t:null},hasSmartField:function(e){var t=this.findWhere({candidateID:e});return t?t:null},smartFieldCount:function(){return this.length}}),e.FafFieldCandidateMappingCollection}),define("fss/js/models/model-factory",["core/ac-core","fss/js/ac-faf","fss/js/models/ui/faf-editor-ui-model","fss/js/models/faf-signin-state-model","fss/js/models/faf-userdata-model","fss/js/models/faf-preferences-model","fss/js/models/faf-autocomplete-model","fss/js/models/faf-autocomplete-state-model","fss/js/models/faf-flushable-data-model","fss/js/models/ui/faf-signature-popup-ui-model","fss/js/collections/faf-formvalues-collection","fss/js/collections/field-recognition/faf-field-candidate-pages-collection","fss/js/collections/field-recognition/faf-field-candidate-value-prediction-collection","fss/js/collections/field-recognition/faf-field-candidate-mapping-collection"],function(e,t){t.ModelFactory=e.Model.extend({create:function(e,i,n){var s=t[e];
return s?new s(i,n):void LOG.error("AcFaf.ModelFactory.create: Unrecognized class: "+e)}})}),define("fss/js/ops/faf-starting-op",["core/ac-core","core/models/model","fss/js/ac-faf","core/ops/op","fss/js/models/model-factory","fss/js/ops/faf-starting-op"],function(e,t,i){return i.FafStartingOp=e.Op.extend({_create1Model:function(e,t,n){var s="faf"+e,o=i.modelFactory.create("Faf"+e,{},this.options);if(i["_faf"+e]=o,t=t||this.options,t[s]=o,n){var a={};a[s]=o,n.trigger("add:model",a)}}}),i.FafStartingOp}),define("fss/js/ops/starting-plugin-op",["core/ac-core","core/utils/date-util","fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-util","fss/js/lib/faf-log-util","fss/js/ops/faf-starting-op"],function(e,t,i,n,s,o){i.StartingPluginOp=i.FafStartingOp.extend({run:function(){t.logElapsedTime("FSS: starting plugin op");var e=$.Deferred();return i.appApi.rnaApi.then(_.bind(function(e){e.isFeatRunning()&&e.isASTestAllowInstantiation()&&(o.minimalLogging=!1,o.logInfo("StartingPluginOp","Disabled minimal logging."))},this)),i.opFactory.create("StartingPluginCommonOp",_.extend(this.options,{noFetch:!0})).run().then(_.bind(function(){if(delete this.options.noFetch,this._createModels(),i.opFactory.create("RunningPluginOp",this.options).run(),i.Reader.prefs={},this._fssPrefsPromise=this._getResolvedPromise(),n.isDesktop()){var a=i.Reader.opFactory.create("ListeningForReaderEventsOp",this.options);i.Reader.readerEventListenerOp=this.options.readerEventListenerOp=a,this._fssPrefsPromise=s.getFssPrefs().then(function(e){i.Reader.prefs=e}).always(_.bind(function(){this.options.readerEventListenerOp.run()},this))}this._fssPrefsPromise.then(_.bind(function(){return this._getLoginPromise()},this)).then(function(){t.logElapsedTime("FSS: starting plugin op : loginPromise success")}).fail(function(){t.logElapsedTime("FSS: starting plugin op : loginPromise fail")}).always(function(){e.resolve()}),this.options.fafRC={};var r=this.options.fafAppLimitsModel;return r.initialized().then(_.bind(function(){var e=r.getFRFeatureLevel();if(o.logInfo("FafAppLimitsModel","Field Recognition UI enabled - "+!!e),e&&e>0)for(var t=["FieldCandidatePagesCollection","FieldCandidateValuePredictionCollection","FieldCandidateMappingCollection"],i=0;i<t.length;i++)this._create1Model(t[i],this.options.fafRC)},this)),this.options.startingPluginOpPromise=e.promise(),this.options.startingPluginOpPromise},this)),this._getResolvedPromise()},_createModels:function(){for(var e=["EditorUiModel","FormValuesCollection","AutocompleteModel"],t=0;t<e.length;t++)this._create1Model(e[t])},_getLoginPromise:function(){return n.isLoggedIn()?i.opFactory.create("SigningInOp",this.options).run():i.Reader.opFactory.create("GettingDocCloudServicesStatusOp",this.options).run().then(_.bind(function(e){var t=this.options.fafSigninStateModel,i="disabled"===e.docServices?t.reason.DISABLED:t.reason.SIGNED_OUT;t.setOffline(i)},this))}})}),define("fss/js/ops/starting-plugin-common-op",["core/ac-core","fss/js/ac-faf","core/ops/op","fss/js/ops/faf-starting-op"],function(e,t){t.StartingPluginCommonOp=t.FafStartingOp.extend({run:function(){var e=this.options.noFetch||!1,i=["SigninStateModel","AppLimitsModel","FlushableDataModel","PreferencesModel","UserDataModel","AutocompleteStateModel"];if(t._startCommonOpDone)for(var n=0;n<i.length;n++){var s="faf"+i[n];this.options[s]=t["_"+s]}else{t._startCommonOpDone=!0;for(var o=0;o<i.length;o++)this._create1Model(i[o]);t._signatures={},e||(this.options.fafPreferencesModel.fetch(),this.options.fafUserDataModel.fetch(),this.options.fafAppLimitsModel.initialized(),this.options.fafAutocompleteStateModel.fetch())}return this._getResolvedPromise()}})}),define("fss/js/ops/switching-to-tool-op",["core/ac-core","fss/js/ac-faf","i18n!fss/js/nls/ui-strings","fss/js/lib/util","fss/js/lib/utilUI","fss/js/lib/fafa"],function(e,t,i,n,s,o){return t.SwitchingToToolOp=e.Op.extend({run:function(){var e,t=this.options.toolName,a="Tools:Selected",r=a;return"text"!==t&&(r+=":Annot"),e=r+":"+o.gaNameFromToolType(t),"text"===t||n.supportsCanvas()?this.options.fafEditorUiModel.set("tool",t):(e=a+":UnsupportedBrowser",r=null,a=null,s.showUnsupportedFeatureDialog(i.ToolbarFeatureText)),o.logEvent(a,r,e),this._getResolvedPromise()}}),t.SwitchingToToolOp}),define("fss/js/ops/zooming-form-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa"],function(e,t,i){t.ZoomFormOp=e.Op.extend({run:function(){var e=this.options,n=e.fafEditorUiModel,s=e.zoom,o=t._fafFormView,a=o.fitWidthScale(o.$curPage),r=o.fitPageScale(o.$curPage),l=o.curPageScale,d="NavBar:Page:Zoom",f=d,c=s.indexOf("%")>=0?"%":s;switch(c){case"fitWidth":l=a,f+=":FitPageWidth";break;case"fitPage":l=r,f+=":FitPage";break;case"%":f+=":Clicked";var u=parseInt(s.replace("%"),10),h=n.get("ratio_scale_to_zoom");l=Math.min(h*(1*u/100),n.convertZoomToPageScale(n.getMaxZoom())),l=Math.max(l,n.convertZoomToPageScale(n.getMinZoom()));break;case"in":l=Math.min(1.25*o.curPageScale,n.convertZoomToPageScale(n.getMaxZoom())),f+=":In";break;case"out":f+=":Out",l=Math.max(.75*o.curPageScale,n.convertZoomToPageScale(n.getMinZoom()))}var p="in"===s||"out"===s||"%"===c,g=n.convertZoomToPageScale(1);return("in"===s||"out"===s)&&(o.curPageScale<a&&l>a||o.curPageScale>a&&a>l?(l=a,s=n.ZOOM_TYPE_FIT_WIDTH):(o.curPageScale<g&&l>g||o.curPageScale>g&&g>l)&&(l=g)),e.noLog||i.logEvent(null,d,f),n.set("page_scale_preserve_hotspot",p),n.set("page_scale",l),s===n.ZOOM_TYPE_FIT_WIDTH||s===n.ZOOM_TYPE_FIT_PAGE?n.set("zoom_type",s):n.set("zoom_type",""),this._getResolvedPromise()}})}),define("fss/js/ops/create-and-open-sample-form-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","i18n!fss/js/nls/ui-strings"],function(e,t,i,n){t.CreateAndOpenSampleFormOp=e.Op.extend({run:function(){var e=this.options;return i.showProgress(n.PrepareDocument),t.opFactory.create("CreateSampleFormOp",e).run().then(_.bind(function(i){return e=_.extend(e,{formID:i.formID,showProgress:!1,logEvent:!1,formSource:"FillSignTab",formType:"NewForm",formOrigin:"SampleFile"}),t.opFactory.create("OpenFormOp",e).run()},this)).always(_.bind(function(){i.hideProgress()},this))}})}),define("fss/js/ops/create-and-open-form-via-bh-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","i18n!fss/js/nls/ui-strings"],function(e,t,i,n){t.CreateAndOpenFormViaBhOp=e.Op.extend({run:function(){var e=this.options;return i.showProgress(n.PrepareDocument),e=_.extend(e,{localFile:!1}),t.opFactory.create("CreateFormOp",e).run().then(_.bind(function(i){return e=_.extend(e,{formID:i.formID,showProgress:!1,logEvent:!1,formSource:e.backToFiles?"FilesTab":"FillSignTab",formType:"NewForm",formOrigin:"AcomFile"}),t.opFactory.create("OpenFormOp",e).run()},this)).always(_.bind(function(){i.hideProgress()},this))}})}),define("fss/js/ops/create-and-open-form-via-upload-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","i18n!fss/js/nls/ui-strings"],function(e,t,i,n){t.CreateAndOpenFormViaUploadOp=e.Op.extend({run:function(){var e=this.options;return i.showProgress(n.PrepareDocument),t.opFactory.create("UploadFileOp",e).run().then(_.bind(function(n){return i.logInfo("CreateForm - UploadFileOp","file uploaded: "+n),e=_.extend(e,{assetID:n,localFile:!0}),t.opFactory.create("CreateFormOp",e).run()}),this).then(_.bind(function(i){return e=_.extend(e,{formID:i.formID,showProgress:!1,logEvent:!1,formSource:e.backToFiles?"FilesTab":"FillSignTab",formType:"NewForm",formOrigin:"LocalFile"}),t.opFactory.create("OpenFormOp",e).run()},this)).always(_.bind(function(){i.hideProgress()},this))}})}),define("fss/js/ops/create-form-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-ajax-util"],function(e,t,i,n,s){t.CreateFormOp=e.Op.extend({run:function(){var e=$.Deferred();return this.options.fafAppLimitsModel.initialized().then(_.bind(function(){return this.options.fafPreferencesModel.initialized()},this)).then(_.bind(function(){this._runEx(e)},this)),e},_runEx:function(e){var t=this.options,o=t.assetID,a=t.parentID,r=t.localFile,l=t.fafAppLimitsModel,d=t.fafPreferencesModel,f=d.getPreference("develop_options");return $.ajax(s.getAjaxOptions("POST","/createform",{data:JSON.stringify(_.extend({asset_id:o,parent_id:a},f?{options:f}:{})),success:_.bind(function(s,o,a){var d,f,c,u=a.getResponseHeader("ETag"),h=s.form_id,p=s.original_file,g=s.pdf_format;n.logInfo("CreateForm - CreateFormOp","form created: "+h),t.selectFilesFromDialog&&(d="FillSignTab:Upload:3-Success",f=d+(r?":LocalFile":":AcomFile"),i.logEvent(d,f,f,{fileType:p.mimetype,fileSize:p.size}));var _=p.extension;if("pdf"!==_){var m=l.analyticType(p.extension);d="Form:Open:NonPDF",f=d+":"+m,c=f+("other"!==m?":"+_:""),i.logEvent(d,f,c,{documentID:h})}i.reportPDFFormat(g),e.resolve({formID:h,etag:u})},this),error:s.handleDexiErrorResponse(function(s,o){n.logError("CreateForm - CreateFormOp",o.toJSONString()),o={code:o.code,fileSize:t.localFile?t.localFile.size:t.size,fileType:t.localFile?t.localFile.contentType:t.contentType},i.reportUploadError(s,o),e.reject()})})),e.promise()}})}),define("fss/js/ops/adding-form-field-op",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants"],function(e,t,i){return t.AddingFormFieldOp=e.Op.extend({run:function(){var e=$.Deferred(),n=this.options,s=n.$element,o=n.position,a=n.fieldType,r=n.addOptions,l=t._formManager,d=n.previousField,f=t._fafFormView.addFieldToPage(s,o,a,d);o.bottom?(o.top=parseFloat(f.css("top"))+l.blueInputboxAdjust.top,delete o.bottom):o.baseline&&(o.top=parseFloat(f.css("top"))+l.blueInputboxAdjust.top,delete o.baseline);var c=l.elementFromField(f,o,a,r);return["signature","initials"].indexOf(c.type)>-1&&t._fafFormValuesCollection.trigger(i.NEW_SIGNATURE_ADDED,{el:c,signature:r.signature}),l.addOrReplaceFormElement(c),l.fieldAdded(c,f),l.$lastFieldAdded=f,e.resolve(f).promise()}}),t.AddingFormFieldOp}),define("fss/js/ops/create-sample-form-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/utilUI","fss/js/data/fafconstants","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o,a,r){t.CreateSampleFormOp=e.Op.extend({run:function(){var e=$.Deferred(),i=this.options.fafPreferencesModel,l=i.getPreference("develop_options");return $.ajax(s.getAjaxOptions("POST","/createsampleform",{data:JSON.stringify(_.extend({filename:r.OrganizerSampleFileName,locale:t.appApi.localeApi.getLocale()},l?{options:l}:{})),success:_.bind(function(i){var s=i.form_id;n.logInfo("CreateSampleForm - CreateSampleFormOp","form created: "+s),t._app.notifyEvent(a.LOAD_MY_FORMS,{}),e.resolve({formID:s})},this),error:s.handleDexiErrorResponse(function(t,i){n.logError("CreateSampleForm - CreateSampleFormOp",i.toJSONString()),o.showGenericDialog(r.Unknown),e.reject()})})),e.promise()}})}),define("fss/js/app/UploaderManager",["fss/js/lib/util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings"],function(e,t,i){function n(){var n,s=[],o=function(n){try{var o,a,r=JSON.parse(n.data);"complete-file-upload"===r.name&&(o=JSON.parse(r.response),a={result:201===o.status?"success":"error",errorCode:201===o.status?o.status:o.body.error.code,errorMessage:201===o.status?"":o.body.error.message,sc_id:o.body.sc_id,id:o.id},$.each(s,function(n,s){"FAFID"===a.id&&("success"===a.result?s.deferred.resolve(a.sc_id):(t.showGenericDialog(i.UploadErrorText),e.logInfo("UploaderManager",status),s.deferred.reject()),s.unload())}))}catch(l){}},a=window.addEventListener?"addEventListener":"attachEvent",r=window.addEventListener?"message":"onmessage";n=_.bind(o,this),window[a](r,n,!1),this.addUploader=function(e){s.push(e)},this.removeUploader=function(e){s=_.without(s,e)}}var s=new n;return{instance:s}}),define("fss/js/ops/upload-file-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/utilUI","core/utils/util","fss/js/app/UploaderManager","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o,a,r,l){t.UploadFileOp=e.Op.extend({run:function(){this.deferred=$.Deferred();var e=this.options,t=e.localFile,d=e.fileuploader,f=null;_.has(e,"releaseFileInputCallback")&&(f=e.releaseFileInputCallback);var c=s.getBaseHeaders("POST",{isAicRequest:!1,excludeContentType:!0}),u={name:"metadata",value:JSON.stringify({name:t.name})};_.has(e,"collectionID")&&(u.value=JSON.stringify({name:t.name,parent_id:e.collectionID}));var h=[u],p="json",g=t,m=n.createUploadUrl();a.isIE9orBelow()&&(g=g.get(0).value,$.each(c,function(e,t){h.push({name:"CORS_"+e,value:t})}),h.push({CORS_Accept:"application/vnd.adobe.skybox+json;version=1"}),p="html",m+="?CORS_lite=true&",m+="redirect_uri="+window.location.protocol+"//"+window.location.host,m+="/complete_file_upload/1.0/FAFID");var v={modal:!0,paramName:"file",files:g,dataType:p,formData:h,type:"POST",url:m,multipart:!0,headers:c,xhrFields:{withCredentials:!0},sequentialUploads:a.isIE9orBelow()};return r.instance.addUploader(this),d.fileupload("send",v).success(_.bind(function(e,s){"success"===s?_.isObject(e)&&this.deferred.resolve(e.sc_id):(o.showGenericDialog(l.UploadErrorText),i.logEvent(null,"upload tier error"),n.logInfo("CreateForm - UploadFileOp",s),this.deferred.reject()),a.isIE9orBelow()&&f&&f(t.get(0).id)},this)).error(_.bind(function(){n.logError("CreateForm - UploadFileOp","fail");var t={code:"CannotUploadFile",fileSize:e.localFile?e.localFile.size:e.size,fileType:e.localFile?e.localFile.contentType:e.contentType};i.reportUploadError({},t),this.deferred.reject()},this)),this.deferred.promise()},unload:function(){_.defer(r.instance.removeUploader,this)}})}),define("fss/js/ops/toggling-download-pdf-menu-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.TogglingDownloadPDFMenuOp=e.Op.extend({run:function(){var e=this.options.fafEditorUiModel,t=e.get("show_download_pdf_menu"),i=this.options.fafPreferencesModel;return(t||!i.getPreference("session.is_generating_pdf"))&&e.set("show_download_pdf_menu",!t),this._getResolvedPromise()}}),t.TogglingDownloadPDFMenuOp}),define("fss/js/ops/downloading-as-print-fallback-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o){t.DownloadingAsPrintFallbackOp=e.Op.extend({run:function(){var e=this.options,n=e.fafPreferencesModel,s=e.fafEditorUiModel,a=n.getPreference("session.is_generating_pdf");t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_EMIT_OUTPUT_EVENT,{actionBody:"PtPDF:1-Started:FSTab",labelSuffix:this._getPurpose(),categoryOverride:"",fieldCount:s.fieldCount()}),s.set("show_print_fallback_dialog",!0);var r=a?o.OK:o.DownloadButton;return this._promptToDownloadPDF(r).then(_.bind(function(){return a?(i.logEvent(null,null,"Form:Output:WarnDlg:PtPDF:DwnldPDF:DnInProg"),this._getResolvedPromise()):this._doDownload()},this)).always(function(){s.set("show_print_fallback_dialog",!1)})},_promptToDownloadPDF:function(e){var t=this.options,n=t.appApi.dialogApi,s=!!t.browserPrint;return s?(i.logEvent(null,null,"Form:Output:WarnDlg:PtPDF:DwnldPDF:Shown"),n.displayTextAlert(n.SEVERITY_WARNING,o.PrintFormTitle,o.DownloadFormToPrint,e,o.Cancel)):this._getResolvedPromise()},_doDownload:function(){var e=this.options,i=e.fafEditorUiModel,n=t.opFactory.create("ShowingProgressStatusOp",_.extend({},e,{message:o.GeneratingPDF})),s=t.opFactory.create("HidingStatusOp",e),a=t.opFactory.create("DownloadingPDFOp",_.extend({},e,{formID:i.get("form_id"),fieldCount:i.fieldCount(),showStatusOp:n,hideStatusOp:s,ignoreEmptyForm:!1,omitStartEvent:!1,intent:"PtPDF",purpose:this._getPurpose()}));return a.run()},_getPurpose:function(){var e=!!this.options.browserPrint;return e?"BrBut":"FSBut"}})}),define("fss/js/ops/showing-filename-dlg-op",["core/ac-core","fss/js/ac-faf","fss/js/views/faf-filename-dlg-view"],function(e,t){return t.ShowingFilenameDlgOp=e.Op.extend({run:function(){var e,i=this.options,n=i.appApi.dialogApi,s=_.extend(i,{parentView:n.getDialogParentView(),dialogsUiModel:i.appApi.options.dialogsUiModel,keyUiModel:i.appApi.options.keyUiModel,selectionUiModel:{getNumSelectedItems:function(){return 0}}});return e=new t.FafFilenameDlgView(s),e.open(s.parentView)}}),t.ShowingFilenameDlgOp}),define("fss/js/xlib/jquery.textchange.min",["jquery"],function(){!function(e){e.event.special.textchange={setup:function(){e(this).data("lastValue","true"===this.contentEditable?e(this).html():e(this).val()),e(this).bind("keyup.textchange",e.event.special.textchange.handler),e(this).bind("cut.textchange paste.textchange input.textchange",e.event.special.textchange.delayedHandler)},teardown:function(){e(this).unbind(".textchange")},handler:function(){e.event.special.textchange.triggerIfChanged(e(this))},delayedHandler:function(){var t=e(this);setTimeout(function(){e.event.special.textchange.triggerIfChanged(t)},25)},triggerIfChanged:function(e){var t="true"===e[0].contentEditable?e.html():e.val();t!==e.data("lastValue")&&(e.trigger("textchange",[e.data("lastValue")]),e.data("lastValue",t))}},e.event.special.hastext={setup:function(){e(this).bind("textchange",e.event.special.hastext.handler)},teardown:function(){e(this).unbind("textchange",e.event.special.hastext.handler)},handler:function(t,i){""===i&&i!==e(this).val()&&e(this).trigger("hastext")}},e.event.special.notext={setup:function(){e(this).bind("textchange",e.event.special.notext.handler)},teardown:function(){e(this).unbind("textchange",e.event.special.notext.handler)},handler:function(t,i){""===e(this).val()&&e(this).val()!==i&&e(this).trigger("notext")}}}(jQuery)}),define("fss/js/views/form-field/faf-field-view",["core/ac-core","fss/js/ac-faf","fss/js/xlib/jquery.textchange.min","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/utilUI","fss/js/lib/fafa"],function(e,t,i,n,s,o,a,r){var l=1,d=3,f="scroll",c="zoom",u="delete",h="resize",p="move",g="show_guide";return t.FafFieldView=e.View.extend({initialize:function(t){e.View.prototype.initialize.call(this,t),_.bindAll(this,"_setFocus","_setBlur","_hoverIn","_hoverOut","_mouseDown","_touchStart"),this.$fieldDiv=t.$fieldDiv,this.$form=$(".faf-form");var i=$(this.fieldFocusElement());i.data(this.FOCUS_FIELD_KEY,this),i.focus(this._setFocus),i.blur(this._setBlur),this.hoverElements=[],this._addHover(i),this._addHover(this.$fieldDiv),this._hovering=!1,this._inMoveOrResize=!1,this.$fieldDiv.mousedown(this._mouseDown),this.$fieldDiv.on("touchstart",this._touchStart),this.$fieldDiv.on("pointerdown",this._touchStart),this.$fieldDiv.data(n.FORM_FIELD_KEY,this),_.bindAll(this,"_trackFieldKeyDown","_checkFocus","_escToMoveOrResize","_guideHidden","_onFormScroll","_onFormZoom")},FOCUS_FIELD_KEY:"faffield",FIELD_GAINED_FOCUS:"FafFieldView.focus",FIELD_LOST_FOCUS:"FafFieldView.blur",FIELD_DRAG_ABORTED:"FafFieldView.abortDrag",_addHover:function(e){e.hover(this._hoverIn,this._hoverOut),this.hoverElements.push(e[0])},_setFocus:function(){var e=t._fafFormView.$formUI.data("focusElement");t._fafFormView.$formUI.data("focusElement",this),e&&e!==this&&e._resumeInput&&e.blurNow(),this._focusSub&&this._focusSub(),this.fieldToolbarView().attach(this),$(this.fieldFocusElement()).unbind("keydown",this._trackFieldKeyDown),$(this.fieldFocusElement()).bind("keydown",this._trackFieldKeyDown)},_setBlur:function(){_.delay(this._checkFocus,300)},_checkFocus:function(){$(this.fieldFocusElement()).is(":focus")||(!this._shouldBlur||this._shouldBlur())&&this.blurNow(!0)},blurNow:function(e){this._blurSub&&this._blurSub(),this._removeFocusWidgets(),$(this.fieldFocusElement()).unbind("keydown",this._trackFieldKeyDown),!e&&this.fieldFocusElement()&&this.fieldFocusElement().blur()},_hoverIn:function(){this._hovering=!0},_hoverOut:function(e){var t=!0,i=e.toElement||e.relatedTarget;$.each(this.hoverElements,function(e,n){n===i&&(t=!1)}),t&&(this._hovering=!1)},_mouseDown:function(t){if(t.which===d||t.ctrlKey&&e.Util.isMac()&&t.which===l){var i="Tools:FSS:Field:KeyPressed:RightClick";r.logEvent(null,i)}t.stopPropagation()},_touchStart:function(e){s.isIEPointerNotTouchEvent(e)||(this._touchStartTime=(new Date).getTime())},hideFocusWidgets:function(){this.fieldToolbarView().hide(this)},_guideHidden:function(){a.findGuide(_.bind(function(e){return e.field===this},this))||(this.$form.unbind("scroll",this._onFormScroll),t._fafEditorUiModel.off("change:page_scale",this._onFormZoom))},_onFormScroll:function(){this._updateOrRemoveGuide(f)},_onFormZoom:function(){this._updateOrRemoveGuide(c)},_updateOrRemoveGuide:function(e){for(var t=!0,i=a.findGuide(_.bind(function(e){return e.field===this},this));i;){switch(e){case f:if(i.guide){var n={left:this.$form.scrollLeft(),top:this.$form.scrollTop()},o=s.posAminusB(n,i.initialScroll),r=s.posAminusB(i.initialPosition,o),l="right"===i.arrow?"right":"left";i.guide.css(l,r.left+"px"),i.guide.css("top",r.top+"px")}else this._setGuidePlacement(i);break;case u:a.hideGuide(i);break;case c:case h:case p:i.guide?a.hideGuide(i):this._setGuidePlacement(i);break;case g:t=!1}for(i=i.nextGuide;i&&i.field!==this;)i=i.nextGuide}return t},showFocusWidgets:function(){var e=this.fieldToolbarView();e.show(this),e.positionFocusDiv()},_removeFocusWidgets:function(e){this.trackedAutoComplete=!1,this.fieldToolbarView().detach(this,e),this._removeWidgetsSub&&this._removeWidgetsSub(),this===this.$form.data("focusElement")&&this.$form.removeData("focusElement")},deleteField:function(e){this._updateOrRemoveGuide(u);var i=this.$fieldDiv;this._insideDeleteField||(this._insideDeleteField=!0,t.opFactory.create("DeletingFormFieldOp",_.extend({formField:this,$fieldDiv:i,formManager:t._formManager,skipDirty:!!e&&!!e.skipDirty,fafFormView:t._fafFormView,fromTrash:!!e&&!!e.fromTrash},this.options)).run().then(_.bind(function(){this._removeFocusWidgets(!0),this._deleteFieldSub(),this.remove(),i.remove()},this)))},_deleteFieldSub:function(){},resizeStart:function(e){this._inMoveOrResize=!0,this._resizeStartSub(e),o.onExternalEsc(this._escToMoveOrResize)},resize:function(e){this._resizeSub(e)},resizeStop:function(e,t,i){this._inMoveOrResize=!1,o.offExternalEsc(this._escToMoveOrResize),this._resizeStopSub(e,t,i),this._updateOrRemoveGuide(h),this._positionFieldInDOM()},moveStart:function(){return this._inMoveOrResize=!0,this.hideFocusWidgets(),this._moveStartSub(),o.onExternalEsc(this._escToMoveOrResize),$.extend({},this.$fieldDiv.offset(),{width:this.$fieldDiv.width(),height:this.$fieldDiv.height()})},moveStop:function(e,i,s){if(this._inMoveOrResize=!1,o.offExternalEsc(this._escToMoveOrResize),this._moveStopSub(e,i,s),!s){var a=e.diff;if(this._checkValidPositionForMove(e.newArea)&&(0!==a.top||0!==a.left)){var r={top:parseFloat(this.$fieldDiv.css("top")),left:parseFloat(this.$fieldDiv.css("left"))};this.$fieldDiv.css("left",r.left+a.left+"px"),this.$fieldDiv.css("top",r.top+a.top+"px")}this._checkCandidateMappingIsValid(),this._positionFieldInDOM();var l={diff:a,field:this.$fieldDiv};t._app.notifyEvent(n.MOVE_RESIZE_FIELD,l)}this.showFocusWidgets(),this._updateOrRemoveGuide(p)},_checkCandidateMappingIsValid:function(){var e=this.$fieldDiv.data(n.FORM_ELEMENT_KEY);if(e.candidateId){var i=t._fafFormView.$curPage.children().filter("[data-candidate-id="+e.candidateId+"]"),o=$(this.fieldBaseElement()),a=s.hitTest(o,i);if(!a){delete e.candidateId,this.$fieldDiv.data(n.FORM_ELEMENT_KEY,e),t._app.notifyEvent(n.FORM_FIELD_CHANGED,{$field:this.$fieldDiv});var l,d="Field:Move",f=d+":RemoveSmartMapping";if("textfield"===e.type)l=f+(e.isComb?":Text:Comb":":Text");else{var c=e&&e.id;f+=r.gaMidfixFromImageType(c),l=f+r.gaPostfixFromFormElement(c,!1,this.getFormElement())}r.logEvent(d,f,l);var u=t._fafFieldCandidateMappingCollection;u&&u.removeMapping({fieldID:this.fieldId()})}}},_positionFieldInDOM:function(){var e=this.$fieldDiv.data(n.FORM_ELEMENT_KEY);e.candidateId||(t._fafFormView.appendToCurrentPageTBLR(this.$fieldDiv),this.fieldFocusElement().focus())},moveParam:function(e,t,i){return i||(i=t),{newArea:e,origArea:t,diff:{left:e.left-t.left,top:e.top-t.top,width:e.width-t.width,height:e.height-t.height},diffFromPrev:{left:e.left-i.left,top:e.top-i.top,width:e.width-i.width,height:e.height-i.height}}},_checkValidPositionForMove:function(e){this.$form=t._fafFormView.$curPage;var i=this.$form.offset(),n=this.$form.height(),s=this.$form.width(),o=i.top+n-e.top-e.height>=0&&i.top<=e.top,a=i.left+s-e.left-e.width>=0&&i.left<=e.left;return o&&a},_nudgeField:function(e){var t=this.moveStart(),i=$.extend({},t);e.left&&(i.left+=e.left),e.top&&(i.top+=e.top);var n=this.moveParam(i,t);this.moveStop(n,"ArrowKey",!1)},_shouldTrackArrowKeys:function(){return!1},_trackFieldKeyDown:function(e){function i(t){var i="Field:KeyPressed:"+t,a=i+n._trackKeyLabelSuffix(e);n._lastKeyEventNumber=r.logEvent(null,i,a,{$fieldDiv:o}),n._lastKeyEventType=t,s=!0}var n=this,s=!1,o=this.$fieldDiv,a=!1;if(e.which>=37&&e.which<=40){if(this._shouldTrackArrowKeys(e)){var l,d=e.shiftKey?5:1;switch(e.which){case 37:l={left:-d};break;case 38:l={top:-d};break;case 39:l={left:d};break;case 40:l={top:d}}l&&(this._nudgeField(l),a=!0)}}else if(8!==e.which&&46!==e.which||this._lastKeyEventNumber!==r.eventNumber()||"RET"!==this._lastKeyEventType){if(this._shouldTrackKeyDown(e))switch(e.which){case 27:i("ESC"),a=!0;break;case 13:i("RET"),a=this._shouldPreventDefaultOnKeyDown();break;case 8:case 46:i("DEL"),this._shouldDeleteOnDelDown()&&this.deleteField({fromTrash:!0}),a=this._shouldPreventDefaultOnKeyDown();break;case 32:this._handleAnnotConfirmation&&(this._handleAnnotConfirmation(),e.preventDefault(),e.stopPropagation())}}else{var f="Field:KeyPressed:DELAfterRET:Text";r.logEvent(null,f,f,{$idDiv:this.$fieldDiv})}a&&(e.stopPropagation(),e.preventDefault()),s||(delete this._lastKeyEventNumber,delete this._lastKeyEventType),27===e.which&&(this._inMoveOrResize?t._app.notifyEvent(this.FIELD_DRAG_ABORTED,{field:this.$fieldDiv}):this._blurOnESC(e)&&this.fieldFocusElement().blur())},_blurOnESC:function(){return!0},_escToMoveOrResize:function(){return void 0},_shouldTrackLoseFocus:function(){return!0},_trackLoseFocus:function(e){if(!this._shouldTrackLoseFocus(e.event)||!this.getFormElement())return-1;var t="Field:ClickLoseFocus",i=t+this._midfixSub(),n=i+this._postfixSub(),s={posAbs:e.posAbs,$idDiv:this.$fieldDiv};return r.logEvent(t,i,n,s)},getFormElement:function(){return this.$fieldDiv.data(n.FORM_ELEMENT_KEY)},_setGuidePlacement:function(e){var t=$(this.fieldFocusElement()),i=$(".faf-edit-form-form-container"),n=this.$fieldDiv,o=s.posAminusB(n.offset(),i.offset()),a=t.offset();e.left=t.position().left+o.left,e.left=Math.max(10,e.left);var r=a.top+t.height()-$(window).scrollTop(),l=t.position().top+o.top;r>$(window).height()-e.guideHeight?(e.bottom=l,e.arrow="down",e.bottom=Math.min(i.height()-10,e.bottom)):(e.top=l+(t.height()||n.height()),e.arrow="up",e.top=Math.max(10,e.top)),e.initialScroll={left:this.$form.scrollLeft(),top:this.$form.scrollTop()}},showFieldGuide:function(e){var i=a.findGuide(_.bind(function(t){return t.field===this&&t.text===e.text},this));if(!i||this._updateOrRemoveGuide(g)){var n=this,s=$.extend({field:n,parent:$(".faf-edit-form-form-container"),guideHeight:120,removeFunc:function(){n._guideHidden(this)}},e);this._setGuidePlacement(s),i=t._fafFormView.showFormGuide(s);var o=a.findGuide(_.bind(function(t){return t.field===this&&t.text===e.text},this));i===o&&(this.$form.bind("scroll",this._onFormScroll),this.listenTo(t._fafEditorUiModel,"change:page_scale",this._onFormZoom))}}}),t.FafFieldView}),define("fss/js/templates/form-field/toolbar/faf-field-toolbar-view-template",[],function(){return'<div id="faf-field-tool-bar" class="faf-field-tool-bar"><div class="faf-field-tool-bar-nub faf-field-tool-bar-nub-above"></div><div class="fullSize"><div class="faf-field-focus-tool-btn faf-field-btn-reduce-size"><span class="faf-field-focus-reduce-size"></span></div><div class="faf-field-focus-tool-btn faf-field-btn-increase-size"><span class="faf-field-focus-increase-size"></span></div><div class="faf-field-switch-type faf-field-focus-tool-btn"><span class="faf-field-focus-switch"></span>   <div class="faf-field-switch-type-menu"></div></div><div class="faf-field-focus-tool-btn faf-field-focus-text-only"><span class="faf-field-focus-comb"></span></div><div class="faf-field-focus-tool-btn faf-field-btn-trash"><span class="faf-field-focus-trash"></span></div></div><div class="faf-field-tool-bar-nub faf-field-tool-bar-nub-below"></div></div>'}),define("fss/js/templates/faf-field-switch-menu-template",[],function(){return'<div class="faf-switch-field-menu no-select">    <div data-button-type="text" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-text faf-field-type-text"></div>    <div data-button-type="comb" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-comb faf-field-type-text"></div>    <div data-button-type="sign" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-sign faf-field-type-text"></div>    <div data-button-type="x" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-x faf-field-type-annot"></div>    <div data-button-type="check" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-check faf-field-type-annot"></div>    <div data-button-type="roundrect" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-roundrect faf-field-type-annot"></div>    <div data-button-type="line" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-line faf-field-type-annot"></div>    <div data-button-type="dot" class="faf-switch-field-menu-item faf-switch-toolbar-btn faf-switch-toolbar-dot faf-field-type-annot"></div></div>'}),define("fss/js/views/faf-field-switch-menu-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/faf-field-switch-menu-template","core/views/menu-view"],function(e,t,i){return t.FafFieldSwitchMenuView=e.View.extend({events:{"click .faf-switch-field-menu-item":"_onMenuItemClick"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i)},render:function(){return e.View.prototype.render.call(this),this.$el.html(this._template()),this},_onMenuItemClick:function(e){var t=$(e.target);this.trigger("switch:fieldType",t.attr("data-button-type")),e.stopPropagation(),e.preventDefault()}}),t.FafFieldSwitchMenuView}),define("fss/js/views/form-field/toolbar/faf-field-toolbar-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-common-util","i18n!fss/js/nls/ui-strings","fss/js/templates/form-field/toolbar/faf-field-toolbar-view-template","fss/js/views/form-field/faf-field-view","fss/js/views/faf-field-switch-menu-view"],function(e,t,i,n,s,o,a,r){return t.FafFieldToolbarView=e.View.extend({FIELD_BEING_ATTACHED:"faf.FieldBeingAttached",events:{"click     .faf-field-focus-reduce-size":"_onReduceSize","click     .faf-field-focus-increase-size":"_onIncreaseSize","click     .faf-field-focus-trash":"_onTrash","mousedown .faf-field-focus-tool-btn":"_onAnyMouseDown","click     .faf-field-switch-type":"_onSwitchFieldType"},initialize:function(t){this._fafApp=t.fafApp,e.View.prototype.initialize.call(this),_.bindAll(this,"_escToFocus")},_initWrappers:function(){this.$focusDiv||(this.$focusDiv=this.$el.children().first(),this.$focusDiv.removeAttr("id"),this.$position=this.$focusDiv.children(".fullSize"),this.$nubs=this.$el.find(".faf-field-tool-bar-nub"),this.$el=this.$focusDiv,this.delegateEvents(),this.options.fafApp.addListener(this.FIELD_BEING_ATTACHED,_.bind(this._fieldBeingAttached,this)),this._addUiModelEventListeners())},_addUiModelEventListeners:function(){_.bind(this._onShowFieldSwitchMenuChange,this),t._fafEditorUiModel.on("change:show_switch_field_type_menu",this._onShowFieldSwitchMenuChange)},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.append(_.template(a,{})),this._renderFieldSwitchMenuView(),this._initWrappers(),t._fafAppLimitsModel.initialized().then(_.bind(function(){this._frMode=t._fafAppLimitsModel.getFRFeatureLevel(),this._frMode&&this._frMode>0&&this.$focusDiv.addClass("faf-fr-experiment")
},this)))},_renderFieldSwitchMenuView:function(){this._renderChildView("_fieldSwitchMenuView",t.FafFieldSwitchMenuView,this.$(".faf-field-switch-type-menu"),_.extend(this.options,{appApi:t.appApi}))},_onShowFieldSwitchMenuChange:function(e,i){var n,s=this._fieldSwitchMenuView;i?(n=t._fafEditorUiModel,s.open().always(function(){n.set("show_switch_field_type_menu",!1,{silent:!0})})):s.close()},_onSwitchFieldType:function(){this.$focusDiv.addClass("faf-show-switch-menu"),this.positionFocusDiv()},hide:function(e){this.formField&&this.formField===e&&this.$focusDiv.hide()},show:function(e){this.formField&&this.formField===e&&this.$focusDiv.show()},isPositionedBelow:function(e){return this.formField&&this.formField===e?e.$fieldDiv.position().top<this.$focusDiv.position().top:(n.logError("faf-field-toolbar-view","Form field not attached in isPositionedBelow call."),!1)},_onIncreaseSize:function(e){this._changeFont(e,!0)},_onReduceSize:function(e){this._changeFont(e,!1)},_onTrash:function(e){1===e.which&&this.formField&&(this.trackDeleteButtonClick("Field:Delete"),this.formField.deleteField({fromTrash:!0}))},_onAnyMouseDown:function(e){e.stopPropagation(),e.preventDefault()},_fieldBeingAttached:function(e){this.formField&&(e.fafFieldFocus!==this||e.formField!==this.formField)&&this.detach(this.formField)},_changeFont:function(e,t){1===e.which&&(this.formField?this.changeFontClicked(t):n.logError("faf-field-toolbar-view","No formField for font size change button!"))},blurNow:function(){this.fieldFocusElement.blur()},attach:function(e,t,i){if(this.formField!==e){this.clearPendingFadeIn(),this.options.fafApp.notifyEvent(this.FIELD_BEING_ATTACHED,{fafFieldFocus:this,formField:e}),this.formField=e,this.render(),t&&this.$focusDiv.hide(),this.$focusDiv.removeClass("faf-show-switch-menu"),i?this.pendingFadeIn=setTimeout(_.bind(function(){this.$focusDiv.fadeIn(t?200:0)},this),200):this.$focusDiv.fadeIn(t?400:0);var n=e.$fieldDiv;n.addClass("active"),n.parent().append(this.$focusDiv),this.positionFocusDiv(),this.offsetFullSize=this.$focusDiv.children(".fullSize").offset(),this.setResizable(),s.onExternalEsc(this._escToFocus),this.options.fafApp.notifyEvent(r.prototype.FIELD_GAINED_FOCUS,{field:n})}},detach:function(e){if(this.formField===e){this._boundListener&&this._dragAbortedListener(),s.offExternalEsc(this._escToFocus);var t=this.formField.$fieldDiv;delete this.formField,this.$focusDiv.detach(),this.clearPendingFadeIn(),t.removeClass("active"),t.data("resizableSet")&&t.resizable("disable"),this.options.fafApp.notifyEvent(r.prototype.FIELD_LOST_FOCUS,{field:t})}},_escToFocus:function(){},positionFocusDiv:function(){if(this.formField){var e=this.formField.$fieldDiv.position(),t=0;this.$focusDiv.css("left",e.left+"px");var i=e.top-32;if(0>i&&(t=1,i=e.top+this.formField.$fieldDiv.height()+15),this.$focusDiv.css("top",i+"px"),this._frMode&&this._frMode>0){this.$focusDiv.removeClass("faf-field-tool-bar-above faf-field-tool-bar-below"),0===t?(this.$focusDiv.addClass("faf-field-tool-bar-above"),this.$focusDiv.css("top","-=5px")):(this.$focusDiv.addClass("faf-field-tool-bar-below"),this.$focusDiv.css("top","+=5px"));var n=this.$focusDiv.width(),s=this.$focusDiv.position().left,o=s>0?Math.min(s,n/2-15):n/2-15;this.$focusDiv.css("left","-="+o+"px"),this.$nubs.css("left",Math.max(n/2-8,5))}}},clearPendingFadeIn:function(){this.pendingFadeIn&&(clearTimeout(this.pendingFadeIn),delete this.pendingFadeIn)},setResizable:function(){var e=this.formField,i=e.$fieldDiv;if(i.data("resizableSet")&&(i.resizable("destroy"),i.removeData("resizableSet")),i.resizable){var s=this.formField.resizeHandles&&this.formField.resizeHandles(),o=this.formField.aspectRatio&&this.formField.aspectRatio();if(s){i.resizable({containment:t._fafFormView.$curPage,handles:s,aspectRatio:o,start:_.bind(function(e,i){return t._fafFormView.overrideCursor($(e.srcElement).css("cursor")),this._resizeStart(i)},this),resize:_.bind(function(e,t){return this._resize(e,t)},this),stop:_.bind(function(e,i){return t._fafFormView.overrideCursor(""),this._resizeStop(e,i)},this)}),i.find(".ui-resizable-handle").html('<div class="resizable-handle-visual"></div>');var a=i.find(".ui-resizable-handle");a.css("z-index",""),n.handleTouchEventAsMouseEvent(a),i.data("resizableSet",!0)}}},_dragAbortedListener:function(){this.resizeAborted=!0;var e=this.formField.$fieldDiv;e.resizable("widget").mouseup()},_resizeStart:function(e){this.resizeAborted=!1;var i=this.formField;i.resizeStart(e.originalSize),t._fafEditorUiModel.set("faf_hud_hide_override",!0),this._boundListener=_.bind(this._dragAbortedListener,this),this.options.fafApp.addListener(r.prototype.FIELD_DRAG_ABORTED,this._boundListener)},_resize:function(e,t){if(this.resizeAborted)return!1;var i=this.formField;return i.resize(t.size),!0},_resizeStop:function(e,i){this.options.fafApp.removeListener(r.prototype.FIELD_DRAG_ABORTED,this._boundListener),delete this._boundListener,t._fafEditorUiModel.set("faf_hud_hide_override",!1);var n=this.formField;n.resizeStop(i.size,i.originalSize,this.resizeAborted)}}),t.FafFieldToolbarView}),define("fss/js/views/form-field/toolbar/faf-field-toolbar-annotation-view",["fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/lib/util","fss/js/lib/utilUI","fss/js/lib/formcanvas","fss/js/lib/formstyler","fss/js/lib/fafa","fss/js/views/form-field/toolbar/faf-field-toolbar-view","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o,a,r,l){return e.FafFieldToolbarAnnotationView=r.extend({initialize:function(e){r.prototype.initialize.call(this,e)},trackDeleteButtonClick:function(e){var t=this.formField.$canvas(),i=t.attr("name"),n=e+a.gaMidfixFromImageType(i),s=n+a.gaPostfixFromFormElement(i,!1,this.formField.getFormElement());a.logEvent(e,n,s,{$idDiv:this.formField.$fieldDiv})},attach:function(e){if(!$(e.fieldFocusElement()).data("moveCleanup")){var t=e.fieldName(),i="Field:Selected"+a.gaMidfixFromImageType(t),n=i+a.gaPostfixFromFormElement(t,!1,e.getFormElement());a.logEvent(null,i,n,{$idDiv:e.$fieldDiv})}var s=$(e.fieldFocusElement()),o=Boolean(s.data("formFocusFadeIn"));r.prototype.attach.call(this,e,o,o),this._setStyleForFieldSwitch(e.fieldName()),this._showGuide(e)},_initWrappers:function(){r.prototype._initWrappers.call(this),this.$focusDiv.addClass("faf-annots-tool-bar"),this._fieldSwitchMenuView.on("switch:fieldType",this._onSwitchField)},_onSwitchField:function(e,t){this.$focusDiv.removeClass("faf-show-switch-menu");var i=this.formField,n=i.$canvas(),o=i.$link(),a=i.fieldId();t||(i.$fieldDiv.attr("data-tool-type",e),i.$fieldDiv.attr("data-switch-to-type","empty"));var r={oldSize:{width:n.width(),height:n.height()}};["x","check","dot"].indexOf(e)>-1&&(r.oldSize.width>r.oldSize.height?(r.oldSize.width=r.oldSize.height,this.formField.$fieldDiv.width(this.formField.$fieldDiv.height())):(r.oldSize.height=r.oldSize.width,this.formField.$fieldDiv.height(this.formField.$fieldDiv.width())));var l=o.data("imageSize"),d={selected:!0,imageType:e,imageData:null,imageSize:l,canvasSize:r.oldSize,callback:_.bind(function(t){t.attr("name",e),t.attr("data-name",a),o.data("imageType",e),this.formField.$canvas(t),this.formField.$annotation().add(o)},this)};s.createCanvas(d),this.positionFocusDiv(),this.setResizable(),this._setStyleForFieldSwitch(e,!0)},_setStyleForFieldSwitch:function(e,t){this.$focusDiv.removeClass(function(e,t){return(t.match(/\bfaf-field-current-\S+/g)||[]).join(" ")}),this.$focusDiv.addClass("faf-field-current-"+e),t&&this.formField.fieldTypeChanged()},changeFontClicked:function(t){var i=this.formField,n=i.$fieldDiv,r=i.$canvas(),l=i.$link(),d=l.data("imageType"),f=i.fieldId(),c="Field:Change:Size",u=t?":Up":":Down",h=c+u+a.gaMidfixFromImageType(i.fieldName()),p=h+a.gaPostfixFromFormElement(i.fieldName(),!1,i.getFormElement());a.logEvent(c,h,p,{$idDiv:n});var g=e._formManager.getPageScale(),m=1*g,v=t?1.25:.8,S={oldSize:{width:r.width(),height:r.height()}};S.newSize={width:Math.max(S.oldSize.width*v,m),height:Math.max(S.oldSize.height*v,m)},o.defaultValues.tool.hasOwnProperty(d)||(d=r.attr("name"));var E=1e3*g;if(!(S.newSize.height>E||S.newSize.width>E)){var b=o.defaultValues.tool[d];b.maxSize&&(b.maxSize.width&&(S.newSize.width=Math.min(S.newSize.width,b.maxSize.width*g)),b.maxSize.height&&(S.newSize.height=Math.min(S.newSize.height,b.maxSize.height*g)));var w=l.data("imageSize");if(s.isSignatureType(d)){var F=e._signatures.formSignatures.getImgSize(f);w={width:786,height:300},F&&(w=F)}var T={selected:!0,imageType:d,pageScale:e._formManager.getPageScale(),imageData:e._signatures.formSignatures.getImgData(f),imageSize:w,canvasSize:S.newSize,callback:_.bind(function(e){e.attr("name",d),e.attr("data-name",f),this.formField.$canvas(e);var t=this.formField.$annotation().add(l);t.css({width:S.newSize.width,height:S.newSize.height})},this)};s.createCanvas(T),this.formField.fontSizeChanged(S),this.positionFocusDiv()}},_showGuide:function(e){var i=e.getFormElement().type;if(t.isDesktop()&&("signature"===i||"initials"===i)){var n={preference:"session.flattenOnSaveWarning",text:l.FormViewFlattenFormWarning,guideType:"",guideHeight:140,important:!0};return e.showFieldGuide(n)}return void 0}}),{get:function(t){return e._fafFieldToolbarAnnotationView||(e._fafFieldToolbarAnnotationView=new e.FafFieldToolbarAnnotationView(i.newViewOptions(t))),e._fafFieldToolbarAnnotationView}}}),define("fss/js/views/form-field/faf-field-annotation-view",["fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/fafa","fss/js/lib/formcanvas","fss/js/lib/formstyler","fss/js/views/form-field/faf-field-view","fss/js/views/form-field/toolbar/faf-field-toolbar-annotation-view","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o,a,r,l){return e.FafFieldAnnotationView=e.FafFieldView.extend({initialize:function(i){e.FafFieldView.prototype.initialize.call(this,i),_.bindAll(this,"_linkClick","_dblClickProc","_showErrorGuide","_sigDoneCB","_fieldAdded","_sigChanged","_setFontSizeForCanvasSize"),this.$link().click(this._linkClick),this.$annotation().click(this._linkClick),e._app.addListener(t.FORM_FIELD_ADDED,this._fieldAdded)},ANNOTATION_IMAGE_DATA_KEY:"annotationimagedata",_focusSub:function(){-1===["initials","signature"].indexOf(this.fieldName())&&this._makeNewCanvas(this.fieldName(),{size:{width:parseInt(this.$fieldDiv.width(),10),height:parseInt(this.$fieldDiv.height(),10)},fieldId:this.fieldId(),selected:!0})},_blurSub:function(){var e=this.$fieldDiv.attr("data-switch-to-type"),t=this.$fieldDiv.attr("data-tool-type");if(e&&t&&t===e){var i=this.getFormElement();if(i){var s=this.fieldName(),o="Field:Delete",a=o+n.gaMidfixFromImageType(s),r=a+n.gaPostfixFromFormElement(s,!1,i);n.logEvent(o,a,r)}return void this.deleteField()}-1===["initials","signature"].indexOf(this.fieldName())&&this._makeNewCanvas(this.fieldName(),{size:{width:parseInt(this.$fieldDiv.width(),10),height:parseInt(this.$fieldDiv.height(),10)},fieldId:this.fieldId(),selected:!1})},_handleAnnotConfirmation:function(){var e=this.$fieldDiv.attr("data-tool-type"),t=this.$fieldDiv.attr("data-switch-to-type");if(e&&t){var i=this.fieldToolbarView();i._onSwitchField(t,!0);var s=this.getFormElement();if(s){var o=this.fieldName(),a="Field:SmartCreate",r=a+":ToggleTo:"+n.gaNameFromToolType(t)+n.gaMidfixFromImageType(o),l=r+":"+n.gaNameFromToolType(e);n.logEvent(a,r,l)}t=t===e?"empty":e,this.$fieldDiv.attr("data-switch-to-type",t)}},_midfixSub:function(){return n.gaMidfixFromImageType(this.fieldName())},_postfixSub:function(){return n.gaPostfixFromFormElement(this.fieldName(),!0,this.getFormElement())},_trackKeyLabelSuffix:function(){return n.gaMidfixFromImageType(this.fieldName())},_shouldTrackArrowKeys:function(){return!0},_shouldTrackKeyDown:function(){return!0},_shouldPreventDefaultOnKeyDown:function(){return!0},_shouldDeleteOnDelDown:function(){return!0},fontSizeChanged:function(i){e._app.notifyEvent(t.FORM_FIELD_CHANGED,{$field:this.$fieldDiv}),this._setDefaultFieldSize(i,this.fieldId())},fieldTypeChanged:function(){e._app.notifyEvent(t.FORM_FIELD_CHANGED,{$field:this.$fieldDiv})},_moveStartSub:function(){},_moveStopSub:function(e,t,i){if(!i){var o=this.fieldId();s.isSignatureType(this.fieldName())&&this.imageChanged({imageType:this.fieldName(),fieldId:o,selected:!0});var a=this.fieldName(),r="Field:Move",l=r+n.gaMidfixFromImageType(a),d=l+":"+t+n.gaPostfixFromFormElement(a,!1,this.getFormElement()),f={$fieldDiv:this.$fieldDiv,posRel:{x:e.diff.left,y:e.diff.top}};n.logEvent(r,l,d,f)}},fieldToolbarView:function(){return r.get(this.options)},finalizeField:function(){return void 0},resizeHandles:function(){var e=null;switch(this.fieldName()){case"line":e="e";break;default:e="se"}return e},aspectRatio:function(){var e=1;switch(this.fieldName()){case"signature":e=!0;break;case"initials":e=!0;break;case"roundrect":e=!1;break;case"line":e=!1}return e},_resizeAnnotation:function(i,n){var s=i.width-this.resizeWidthDiff,o=i.height-this.resizeHeightDiff;this._makeNewCanvas(this.fieldName(),{size:{width:s,height:o},fieldId:this.fieldId(),selected:!0});var a=this.$annotation().add(this.$link());if(a.css({width:s,height:o}),["check","dot","roundrect","x"].indexOf(this.fieldName())>-1){var r={top:(this.previousSize.height-o)/2,left:(this.previousSize.width-s)/2};this._nudgeField(r)}this.previousSize={width:s,height:o},e._app.notifyEvent(t.FORM_FIELD_CHANGED,{$field:this.$fieldDiv,"transient":n})},_resizeStartSub:function(e){if(this.resizeWidthDiff=this.$fieldDiv.width()-this.$canvas().width(),this.resizeHeightDiff=this.$fieldDiv.height()-this.$canvas().height(),this.previousSize=e,"se"===this.resizeHandles()){var t=this.fieldToolbarView();t.isPositionedBelow(this)&&t.hide(this)}},_resizeSub:function(e){this._resizeAnnotation(e,!0)},_resizeStopSub:function(e,t,i){this._resizeAnnotation(i?t:e,!1);var s=this.fieldToolbarView();s.positionFocusDiv(),s.show(this);var o=this.$canvas(),a=o.width(),r=o.height();if(!i){var l=this.fieldId();this._setDefaultFieldSize({newSize:{width:a,height:r}},l);var d="Field:Resize",f=d+n.gaMidfixFromImageType(this.fieldName()),c=f+n.gaPostfixFromFormElement(this.fieldName(),!0,this.getFormElement());n.logEvent(d,f,c,{$idDiv:this.$fieldDiv})}this.$fieldDiv.css("width",""),this.$fieldDiv.css("height","")},_setDefaultFieldSize:function(t,i){var n=e._fafFormValuesCollection.getValue(i),s=n&&n.kind,a=s?o.defaultValues.tool[this.fieldName()][s]:o.defaultValues.tool[this.fieldName()];a||(a=o.defaultValues.tool[this.fieldName()]={}),a.size={width:t.newSize.width/e._formManager.getPageScale(),height:t.newSize.height/e._formManager.getPageScale()};var r=e._signatures.formSignatures.getImgSize(i);r&&"input"===s&&(a.ratio=r.height/r.width,this._setFontSizeForCanvasSize(a,n.text))},_setFontSizeForCanvasSize:function(t,i){if(this.$canvas().data("loaded")){$("#sig-capture").remove();var n='<div id="sig-capture" class="sig-font-capture"></div>';$("body").append(n);var o=$("#sig-capture"),a=e._fafFormValuesCollection.getValue(this.fieldId()).style||"adobe-hand-d";o.text(i),o.css("font_family",a);var r=s.trimCanvas(this.$canvas(),0),l=e._formManager.getPageScale(),d=1,f=9999,c=1;for(r.width/=l,r.height/=l;125>=d&&r.height>0&&r.width>0;){o.css("font-size",d+"px");var u=o.width()*r.height/r.width,h=Math.abs(o.width()-r.width)+Math.abs(u-r.height);f>h&&(f=h,c=d),d++}o.css("font-size",c),o.remove(),t.fontSize=c+"px"}else _.delay(this._setFontSizeForCanvasSize,100,t,i)},fieldName:function(e){return e?this.fieldId():this.$canvas().attr("name")},fieldId:function(){if(this.$canvas().attr("data-name"))return this.$canvas().attr("data-name");var t=e._formManager.form.getNewFieldID();return this.$canvas().attr("data-name",t),t},fieldBaseElement:function(){return this.$canvas()[0]},fieldFocusElement:function(){return this.$link()[0]},imageChanged:function(e){this.fieldName()===e.imageType&&this._makeNewCanvas(e.imageType,{imageData:e.imageData,fieldId:e.fieldId,selected:e.selected})},$annotation:function(){return this.$fieldDiv.find(".annotationImage")},$canvas:function(e,t){t||(t=this.$fieldDiv);var i=t.find(".formCanvas").first();return e?(e.addClass("fixedSize"),i.css("display","none"),i.before(e),void i.remove()):i},$link:function(){return this.$fieldDiv.find("button")},_linkClick:function(e){1===e.which&&(this._singleClickProc(e),e.stopPropagation(),e.preventDefault())},_singleClickProc:function(){$(this.fieldFocusElement()).is(":focus")||this.fieldFocusElement().focus()},_dblClickProc:function(){var t=this.fieldId(),i=this.fieldName(),n={fieldID:t,sigType:i,doneFunc:this._sigDoneCB};e._fafContentView._triggerViewEvent(e.ViewEvents.FAF_SIGNATURE_SHOW_POPUP,n)},_sigDoneCB:function(n){if(e._signatures.popupUiModel.set({field_id:"none"}),"OK"===n.why){var s=n.signature;if(!s||!s.pngData||!s.imageSize)return void i.logError("FafFieldAnnotView","sigDone called without required properties");var o=this.fieldId(),a=e._fafFormValuesCollection.getValue(o),r=a?a.assetID:void 0,l=this.fieldName();e._fafFormValuesCollection.trigger(t.NEW_SIGNATURE_ADDED,{el:this.getFormElement(),signature:s,oldAssetID:r});var d=s.imageSize.height/s.imageSize.width||1,f=$.extend({},i.getCanvasSize(s,d));f.width*=e._formManager.getPageScale(),f.height*=e._formManager.getPageScale();var c=this.$annotation();c.css({width:f.width,height:f.height}),this._makeNewCanvas(l,{size:f,fieldId:o}),e._app.notifyEvent(t.FORM_FIELD_CHANGED,{$field:this.$fieldDiv}),e.FafFieldAnnotationView.prototype._hasData(e._app,l)&&this.fieldFocusElement().focus()}},$fieldFromCanvas:function(e,t,i){var n=e.attr("name");i=i||{width:e.width(),height:e.height()};var s=$('<div class="annotationImage fixedSize" style="position:relative;"></div>');s.css("width",i.width),s.css("height",i.height);var o=$('<button class="annotationButton"/>');return o.css("width",i.width),o.css("height",i.height),e.css("width",i.width),e.css("height",i.height),e.css("position","absolute"),o.data("imageType",n),o.data("imageSize",i),s.append(e),s.append(o),s},_addEmptiness:function(t,n){var s=n.parent().children("a").first().data("faffield");if(!s)return i.logWarn("sign","No 'this' when adding emptiness"),t+":WasMaybeEmpty";var o=n.attr("name"),a=e.FafFieldAnnotationView.prototype._sigKind(s._fafApp,o);a&&(a=":"+("input"===a?"Text":"Scribble"));var r=e.FafFieldAnnotationView.prototype._hasData(s._fafApp,o)?":WasNonEmpty":":WasEmpty";return t+a+r},_fieldAdded:function(t){var i="annotationImage"===t.formElement.type?this.fieldName():t.formElement.type,n="annotationImage"===i?null:e._signatures.formSignatures.getImgData(t.formElement.id);t.$input.data("inLPCreate")||this.fieldBaseElement()!==t.$input[0]||this._makeNewCanvas(i,{imageData:n,size:{width:parseInt(t.formElement.width,10),height:parseInt(t.formElement.height,10)},fieldId:t.formElement.id})},_sigChanged:function(e){this.fieldId()===e.fieldId&&this._makeNewCanvas(e.fieldId)},addContentToDragHelper:function(e){this._makeNewCanvas(e,{fieldId:this.fieldId(),selected:!0})},_hasData:function(t,i){return!s.isSignatureType(i)||!Boolean(e._signatures.formSignatures.isEmpty())},_sigKind:function(t,i){if(!s.isSignatureType(i))return"";var n=e._signatures.formSignatures.getSignature(i);return n&&n.kind||""},_clickCreateProc:function(e){e.preventDefault()},_addNoDataBackground:function(e){if(e.css("background-color","yellow"),e.css("opacity",.4),i.supportsCanvas()){var t=e[0],n=t.getContext("2d");n.fillStyle="black",n.font="12pt Helvetica"}},createAnnotationImageFieldWithOptions:function(e){e=e||{};var t=e.imageType||null,i=e.position||null,n=e.size||null,s=e.addToGlobal||null,o=e.addProperty||null,a=e.candidateId||null,r=e.previousField||null;this.createAnnotationImageFieldAt(t,i,n,s,o,a,r)},createAnnotationImageFieldAt:function(t,i,n,o,a,r,l){function d(n){if(n){n.attr("name",t),n.addClass("fixedSize");var s=e.FafFieldAnnotationView.prototype.$fieldFromCanvas(n,i);n.data("inLPCreate",!0);var o={previousField:l,$element:s,position:i,fieldType:"annotationImage",addOptions:{signature:f,candidateId:r}};e.opFactory.create("AddingFormFieldOp",o).run().then(_.bind(function(e){this._addAnnotField(e,n,s,t,f),a&&a(e)},c))}}var f=null;"object"==typeof t&&(f=t,t=f&&f.type||"signature");var c=this,u={imageType:t,pageScale:e._formManager.getPageScale(),canvasSize:$.extend({},n),callback:_.bind(d,this)},h=e._formManager.getPageScale();u.canvasSize.width*=h,u.canvasSize.height*=h,s.isSignatureType(t)&&(u.imageSize=$.extend({},f.imageSize),u.imageData=f.pngData),s.createCanvas(u)},_addAnnotField:function(e,t,i,o,a){t.removeData("inLPCreate");var r=i.find("button");s.isSignatureType(o)||r.data("formFocusFadeIn",!0),r[0].focus(),r.removeData("formFocusFadeIn");var l,d="Field:Add",f=d;s.isSignatureType(o)?(f+=":Sign",l=f+":"+n.gaNameFromSigType(o),l+=":"+n.gaNameFromSigKind(a.kind)):(f+=":Annot",l=f+":"+n.gaNameFromToolType(o)),n.logEvent(d,f,l,{$fieldDiv:e})},_showErrorGuide:function(){e._fafContentView.options.fafEditorUiModel.get("is_page_image_loaded")?(this._showError&&1===this._showError&&(this.showFieldGuide({guideType:"faf-error",text:l.FailedToLoadSign}),this._showError++),this._showError=this._showError?2:1):_.delay(this._showErrorGuide,1e3)},_addNoImageDataMarkers:function(t){e.FafFieldAnnotationView.prototype._addNoDataBackground(t),_.defer(this._showErrorGuide)},_makeNewCanvas:function(t,n){n=n||{};var o,a=n.imageData,r=n.size&&n.size.width,l=n.size&&n.size.height,d=n.fieldId;"string"!=typeof t&&(o=t,t=this.fieldName()),r||(r=parseInt(this.$canvas().width(),10)),l||(l=parseInt(this.$canvas().height(),10));var f={selected:n.selected,imageType:t,canvasSize:{width:r,height:l},pageScale:e._formManager.getPageScale(),callback:_.bind(function(n){n&&(n.attr("name",t),n.attr("data-name",d),(!i.supportsCanvas()||s.isSignatureType(t)&&!e._signatures.formSignatures.getImgData(d))&&this._addNoImageDataMarkers(n),this.$canvas(n,o))},this)};if(s.isSignatureType(t)||s.isSignatureType(this.fieldName())){var c=e._signatures.formSignatures.getImgSize(d);f.imageSize={width:786,height:300},c&&(f.imageSize=c),a||(a=e._signatures.formSignatures.getImgData(d))}else f.imageSize={width:r,height:l};this.$link().data("imageSize",f.imageSize),f.imageData=a,s.createCanvas(f)}}),e.FafFieldAnnotationView}),define("fss/js/ops/start-drag-sig-saved-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/formcanvas","fss/js/views/form-field/faf-field-annotation-view"],function(e,t,i,n,s,o,a){t.StartDragAfterSigSavedOp=e.Op.extend({run:function(){var e=this.options||{},t=e.fafEditorUiModel.get("tool");return e.fafEditorUiModel.set("tool","signature"),this._startDragAfterSigSaved(e.fieldId,e.signature,e.lastEvt,e.existing,t),this._getResolvedPromise()},_startDragAfterSigSaved:function(e,r,l,d,f){function c(){F.remove(),h(),$(document).unbind("keyup",E),$(document).unbind("mousemove",g),$(document).unbind("mousedown",S),s.offExternalEsc(u),P.off("change:current_page",w),P.off("change:tool",b),P.set("tool",f)}function u(){c()}function h(){T.unbind("mousedown",m),$("textarea, canvas").css("pointer-events","auto"),P.set("faf_hud_hide_override",!1),T.find("*").css("cursor","")}function p(){T&&h(),T=t._fafFormView.$curPage,T.bind("mousedown",m),T.append(F),T.find("*").css("cursor","none"),$("textarea, canvas").css("pointer-events","none"),P.set("faf_hud_hide_override",!0)}function g(e){A&&(p(),A=!1);var i=n.offsetFromEvent(e,{},T),s=t._formManager.focusBoxPadding,o={left:Math.max(s.left,i.left-(25+s.left)),top:Math.max(s.top,i.top-(15+s.top))};y||(y={width:F.width(),height:F.height()});var a={right:o.left+y.width,bottom:o.top+y.height};D||(D={width:T.width(),height:T.height()}),a.right+s.right>D.width&&(o.left-=a.right+s.right-D.width),a.bottom+s.bottom>D.height&&(o.top-=a.bottom+s.bottom-D.height),F.css("left",o.left+"px"),F.css("top",o.top+"px"),e.stopPropagation(),e.preventDefault()}function m(e){e.stopPropagation(),e.preventDefault();var s={left:parseFloat(F.css("left")),top:parseFloat(F.css("top"))};if(s.left&&s.top){c();var o=i.gaNameFromSigType("signature")+":"+i.gaNameFromSigKind(r.kind);if(t._fafFormView.okToAddField("Sign",o,e)){var l=n.getCanvasSize(r,R.height/R.width);a.prototype.createAnnotationImageFieldAt(r,s,l),v()}}}function v(){var e,n,s,o=t._fafFormView.options.fafUserDataModel,a=o.getObject("signature"),l=a&&a.value.length>0?"RU":"NU";d?(e=n="Place:Sign:1-ExistSignPlace",s=n+":"+i.gaNameFromSigType(r.type)+":"+i.gaNameFromSigKind(r.kind)):(e="Create:Sign:"+l+":4-SignPlaced",n=e+":"+i.gaNameFromSigKind(r.kind),s=n+":"+i.gaNameFromSigType(r.type)),i.logEvent(e,n,s)}function S(){c()}function E(e){27===e.which&&c()}function b(e,t){"signature"===t||"initials"===t?n.logToSplunk("ERROR drag-sig getting bad form tool"):f=t,c()}function w(){A=!0}var F,T,D,y,A=!1,C=this.options,P=C.fafEditorUiModel;if(r){var R=r.imageSize,I={imageType:"signature",imageData:r.pngData,canvasSize:n.getCanvasSize(r,R.height/R.width),imageSize:$.extend({width:786,height:300},R),callback:_.bind(function(e){F=$('<div style="position:absolute"></div>'),F.append(e),p(),$(document).bind("mousedown",S),$(document).bind("mousemove",g),$(document).bind("keyup",E),s.onExternalEsc(u),P.on("change:tool",b),P.on("change:current_page",w),l&&g(l)},this)},O=t._formManager.getPageScale();I.canvasSize.width*=O,I.canvasSize.height*=O,o.createCanvas(I)}}})}),define("fss/js/ops/emit-output-event-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa"],function(e,t,i){t.EmitOutputEventOp=e.Op.extend({run:function(){var e=this,t=this.options||{};return e._emitOutputEvent(t.actionBody,t.labelSuffix,t.categoryOverride,t.fieldCount),this._getResolvedPromise()},_emitOutputEvent:function(e,t,n,s){var o="Form:Output:Completed";void 0!==n&&(o=n);var a="Form:Output:"+(s>0?"Filled":"NoFill");e&&(a+=":"+e);var r=a;t&&(r+=":"+t),i.logEvent(o,a,r,{fieldCount:s})}})}),define("fss/js/templates/faf-NPS-dlg-template",[],function(){return'<span class="faf-NPS-ask-head"> <%= AskForRecommend %> </span> <div class="faf-NPS-rating">    <div class="faf-NPS-leftEdgeHead"> <%= RecommendNotLikely %> </div>    <div class="faf-NPS-rating-overlay"> </div>    <div class="faf-NPS-rating-radio">        <ul>            <li> <label for="rating-1"> 1 </label> <input id="rating-1" type="radio" value="1" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-2"> 2 </label> <input id="rating-2" type="radio" value="2" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-3"> 3 </label> <input id="rating-3" type="radio" value="3" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-4"> 4 </label> <input id="rating-4" type="radio" value="4" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-5"> 5 </label> <input id="rating-5" type="radio" value="5" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-6"> 6 </label> <input id="rating-6" type="radio" value="6" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-7"> 7 </label> <input id="rating-7" type="radio" value="7" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-8"> 8 </label> <input id="rating-8" type="radio" value="8" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-9"> 9 </label> <input id="rating-9" type="radio" value="9" name="rating" /> <span><span></span></span> </li>            <li> <label for="rating-10"> 10 </label> <input id="rating-10" type="radio" value="10" name="rating" /> <span><span></span></span> </li>        <ul>    </div>    <div class="faf-NPS-rightEdgeHead"> <%= RecommendLikely %> </div></div> <div class="faf-NPS-feedback">    <div class="faf-NPS-feedback-head"> <%= NPSFeedback %> </div>    <textarea class="faf-NPS-feedback-text"></textarea></div> <div class="dialog-buttons">    <input class="faf-filename-dlg-cancel-btn control-button                  dialog-control-button button-grey ui-theme theme-text"           type="button" id="faf-filename-dlg-cancel-btn"           value="<%= cancel %>"/>    <input class="faf-filename-dlg-ok-btn control-button                  dialog-control-button"           type="button" id="faf-filename-dlg-ok-btn"           value="<%= ok %>"/></div>'}),define("fss/js/views/faf-NPS-dlg-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/faf-NPS-dlg-template","i18n!fss/js/nls/ui-strings","core/utils/truncate","core/utils/view-util","fss/js/lib/fafa","fss/js/lib/util","core/views/dialog-view"],function(e,t,i,n,s,o,a,r){t.FafNPSDlgView=e.DialogView.extend({events:function(){return _.extend({},e.DialogView.prototype.events,{"mouseover  .faf-NPS-rating-radio ul li":"_onRatingHover","mouseleave .faf-NPS-rating-radio ul li":"_onRatingHoverExit","focusin    .faf-NPS-rating-radio ul li":"_onRatingHover","focusout   .faf-NPS-rating-radio ul li":"_onRatingHoverExit","click      .faf-NPS-rating-radio input":"_onRatingSelected","click      .faf-NPS-rating-radio ul li":"_onRatingItemClick","click      .faf-filename-dlg-ok-btn":"_onOKClick","click      .faf-filename-dlg-cancel-btn":"_onCancelClick"})},initialize:function(){e.DialogView.prototype.initialize.call(this),this._template=_.template(i)},render:function(){return e.DialogView.prototype.render.call(this),this._appendToDialog(this._template({ok:n.Apply,cancel:n.Cancel,RecommendNotLikely:n.RecommendNotLikely,RecommendLikely:n.RecommendLikely,AskForRecommend:n.AskForRecommend,NPSFeedback:n.NPSFeedback})),this._initWrappers(),this._updateControls(),this._setTitle(n.NPSheader),o.setElementFontByLocale(this.$el,"input"),this._adjustWidth(),this._center(),this._initTabLimits(),this._truncateText(),this._logEvent("NPS:Shown","NPS:Shown","NPS:Shown"),this},_initWrappers:function(){e.DialogView.prototype._initWrappers.call(this),this.$feedback=this.$(".faf-NPS-feedback-text"),this.$okBtn=this.$(".faf-filename-dlg-ok-btn"),this.$cancelBtn=this.$(".faf-filename-dlg-cancel-btn"),this.$allSpans=$(".faf-NPS-rating-radio input[type=radio]:not(old) + span > span"),this._rating=0},_adjustWidth:function(){this.$dlg.addClass("faf-NPS-dialog"),r.isSafari()&&this.$dlg.width(500)},_getSuccessOptions:function(e){var i=this.$feedback.val(),n=t._fafAppLimitsModel.getFRFeatureLevel(),s={resolveArgs:{feedback:i,rating:this._rating}};return e&&_.extend(s.resolveArgs,{recognition:!!(n&&n>0)}),s},_truncateText:function(){s.truncateButtonLabel(this.$okBtn),s.truncateButtonLabel(this.$cancelBtn)},_updateControls:function(){o.enableInput(this.$okBtn,this._rating),this._initTabLimits(),this.$allSpans.css("display","none"),$(".faf-NPS-rating-radio input[type=radio]:not(old):checked + span > span").css("display","block")},_selectAllTill:function(e){var t,i="#rating-",n="";if(e!==this._rating){for(this._rating=e,_.map($(".faf-NPS-rating-radio input"),function(e){e.checked=!1}),t=1;e>t;t++)n+=i+t+", ";n+=i+t,_.map($(n),function(e){e.checked=!0}),this._updateControls()}},_onRatingItemClick:function(e){var t=parseInt($(e.currentTarget).find("input")[0].value);this._selectAllTill(t)},_onRatingHover:function(e){var t=$(e.currentTarget).find("input")[0].value,i=35*parseInt(t,10)+10,n=$(".faf-NPS-rating-radio").position().top-7;$(".faf-NPS-rating-overlay").css({top:n}),$(".faf-NPS-rating-overlay").width(i),this.$dlg.addClass("hovering")},_onRatingHoverExit:function(){this.$dlg.removeClass("hovering")},_onRatingSelected:function(e){var t=parseInt($(e.currentTarget)[0].value);this._selectAllTill(t)},_onOKClick:function(e){var t,i=$(e.currentTarget),n=this,s="NPS:Filled",a="NPS:Filled:Scale";o.isInputEnabled(i)&&(""!==this.$feedback.val().trim()&&this._logEvent("NPS:Filled","NPS:Filled:FeedbackSubmitted","NPS:Filled:FeedbackSubmitted"),t=this._rating<=6?":Detractor0-6":this._rating<=8?":Neutral7-8":":Promoter9-10",this._logEvent(s,a,a+t),this._logEvent("NPS:Completed","NPS:Completed","NPS:Completed",n._getSuccessOptions().resolveArgs),this.close(!0,this._getSuccessOptions(!0)))},_onCancelClick:function(){this._logEvent("NPS:Cancel","NPS:Cancel","NPS:Cancel"),this.close(!1)
},_logEvent:function(e,t,i,n){n?a.logEvent(e,t,i,n):a.logEvent(e,t,i)}})}),define("fss/js/ops/showing-NPS-dlg-op",["core/ac-core","fss/js/ac-faf","fss/js/views/faf-NPS-dlg-view"],function(e,t){return t.ShowingNPSDlgOp=e.Op.extend({run:function(){var e=this.options,i=e.fafPreferencesModel,n=i.getPreference("user.FafNPSDlgShown")||0;if(++n>2)return this._getResolvedPromise();i.setPreference("user.FafNPSDlgShown",n);var s=_.extend({parentView:e.appApi.dialogApi.getDialogParentView(),dialogsUiModel:t.appApi.options.dialogsUiModel,selectionUiModel:{getNumSelectedItems:function(){return 0}}},e),o=new t.FafNPSDlgView(s);return o.open(s.parentView)}}),t.ShowingNPSDlgOp}),define("fss/js/ops/saving-NPS-feedback-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-ajax-util"],function(e,t,i){return t.SavingNPSFeedbackOp=e.Op.extend({run:function(){var e=this.options;return e.resolveArgs&&$.ajax(i.getAjaxOptions("POST","/feedback",{data:JSON.stringify(e.resolveArgs),error:function(){},success:function(){t._fafFormView.options.fafPreferencesModel.setPreference("user.FafNPSDlgShown",3)}})),this._getResolvedPromise()}}),t.SavingNPSFeedbackOp}),define("fss/js/ops/esign/save-signature-asset-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-api-util","core/ops/op"],function(e,t,i,n){t.SaveSignatureAssetOp=e.Op.extend({_initialize:function(){this._sigNS=t._signatures,this._sigNS.signsToStore||(this._sigNS.signsToStore={}),this._sigNS.assets||(this._sigNS.assets={})},run:function(){var e=this.options;return this._initialize(),t._signatures.sigPromise?(this._setSignature(e.signature),t._signatures.sigPromise):(t._signatures.sigPromise=$.Deferred(),this._saveSignature(e.signature),t._signatures.sigPromise.always(function(){delete t._signatures.sigPromise}))},_setSignature:function(e){e&&!this._sigNS.signsToStore[e.id]&&(this._sigNS.signsToStore[e.id]=e)},_saveSignature:function(e){this._setSignature(e),this._flushSignatures()},_flushSignatures:function(){if(_.isEmpty(this._sigNS.signsToStore))return void(t._signatures.sigPromise&&t._signatures.sigPromise.resolve(this._sigNS.assets));var e=_.keys(this._sigNS.signsToStore)[0],i=this._sigNS.signsToStore[e];this._saveOnServer(i).done(_.bind(function(t){this._sigNS.assets[e]=t},this)).always(_.bind(function(){delete this._sigNS.signsToStore[e],this._flushSignatures()},this))},_saveOnServer:function(e){var s=$.Deferred();return i.logInfo("SaveSignatureAssetOp","Saving user signatures"),n.saveSignature(_.extend(e,{formID:t._formManager.formID})).done(function(e){s.resolve(e)}).fail(function(e){i.logError("SaveSignatureAssetOp","Error saving signatures: "+e),s.reject()}),s.promise()}})}),define("fss/js/ops/esign/save-signature-to-cloud-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/faf-server-api-util"],function(e,t,i,n,s){return t.SaveSignatureToCloud=e.Op.extend({run:function(){var e=$.Deferred(),t=this.options,o=t.fafUserDataModel,a=t.sigData;return o?(s.saveSignature(_.extend({},a,{addToGlobal:!0,kind:a.kind||"image"})).then(function(e){return o.addSignature(e.globalAssetID,a),n.isDesktop()?o.save():i.getResolvedPromise()}).then(function(){i.logInfo("SaveSignatureToCloud","Successfully saved signature to cloud"),e.resolve()}).fail(function(){i.logError("SaveSignatureToCloud","Error saving signature to cloud"),e.reject()}),e.promise()):(i.logError("SaveSignatureToCloud","No fafUserDataModel to save signatures from"),e.reject().promise())}}),t.SaveSignatureToCloud}),define("fss/js/views/reader/faf-reader-native-signature-popup-font-menu-view",["core/ac-core","fss/js/ac-faf","fss/js/views/esign/faf-signature-popup-font-menu-view"],function(e,t){t.Reader.FafReaderNativeSignaturePopupFontMenuView=t.FafSignaturePopupFontMenuView.extend({initialize:function(){t.FafSignaturePopupFontMenuView.prototype.initialize.call(this)},_adjustFontStyler:function(){if("none"!==this.$dropdown.css("display")){var e,t,i=$(".faf-sig-type-style"),n=$(".faf-sig-dialog"),s=n.height(),o=this.$dropdown.outerWidth(),a=this.$dropdown.outerHeight(),r=$("#faf-sig-save"),l=r.offset().left+r.outerWidth();this.$nub.offset({top:i.offset().top-2,left:i.offset().left-15}),e=this.$nub.offset().left-o,t=l>e?Math.max(10,r.offset().top-a-10):Math.min(s-a-10,i.offset().top-20),this.$dropdown.offset({top:t,left:e})}}})}),define("fss/js/views/reader/faf-reader-native-signature-popup-surface-type-view",["core/ac-core","fss/js/ac-faf","fss/js/views/esign/faf-signature-popup-surface-type-view","fss/js/views/reader/faf-reader-native-signature-popup-font-menu-view"],function(e,t){t.Reader.FafReaderNativeSignaturePopupSurfaceTypeView=t.FafSignaturePopupSurfaceTypeView.extend({_fontMenuViewClass:function(){return t.Reader.FafReaderNativeSignaturePopupFontMenuView},_onSigTextChange:function(e,i){this._removeSpinner(),t.FafSignaturePopupSurfaceTypeView.prototype._onSigTextChange.call(this,e,i)},_addValueIfTypeEmpty:function(){var e=this.options.fafUserDataModel;if("pending"===e.getUserDataModelPromise().state()){var i=$("#faf-sig-type");i.width()>0&&(this._showingSpinner||_.defer(_.bind(function(){$("#faf-sig-container").addClass("faf-sig-spinner-showing");var e={refElem:i};this._showingSpinner=!0,this.options.appApi.displayApi.showSpinner(!0,e)},this)))}else this._removeSpinner();t.FafSignaturePopupSurfaceTypeView.prototype._addValueIfTypeEmpty.call(this)},_removeSpinner:function(){this._showingSpinner&&($("#faf-sig-container").removeClass("faf-sig-spinner-showing"),this._showingSpinner=!1,this.options.appApi.displayApi.showSpinner(!1))}})}),define("fss/js/views/reader/faf-reader-native-signature-popup-surface-image-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/views/esign/faf-signature-popup-surface-image-view"],function(e,t,i){t.Reader.FafReaderNativeSignaturePopupSurfaceImageView=t.FafSignaturePopupSurfaceImageView.extend({_adjustErrorGuideOptions:function(e){var t=e.parent,n=t.offset().left+i.cssNumTotal(t,"margin"),s="auto"===e.left?n:e.left,o=s+e.width,a=$(window).width()-2,r=e.width+32;o>a&&(e.width>a&&(e.width=a),e.left=a-r,e.arrowPosition+=s-e.left)},kindClose:function(){this._cancelImport()}})}),define("fss/js/views/reader/faf-reader-native-signature-popup-surface-view",["core/ac-core","fss/js/ac-faf","fss/js/views/esign/faf-signature-popup-surface-view","fss/js/views/reader/faf-reader-native-signature-popup-surface-type-view","fss/js/views/esign/faf-signature-popup-surface-draw-view","fss/js/views/reader/faf-reader-native-signature-popup-surface-image-view"],function(e,t){t.Reader.FafReaderNativeSignaturePopupSurfaceView=t.FafSignaturePopupSurfaceView.extend({initialize:function(){t.FafSignaturePopupSurfaceView.prototype.initialize.call(this),this._showingSpinner=!1},_open:function(){t.FafSignaturePopupSurfaceView.prototype._open.call(this),this._onSigClear(void 0,{clearAll:!0})},_surfaceViewClasses:function(){return{type:t.Reader.FafReaderNativeSignaturePopupSurfaceTypeView,draw:t.FafSignaturePopupSurfaceDrawView,image:t.Reader.FafReaderNativeSignaturePopupSurfaceImageView}}})}),define("fss/js/views/reader/faf-reader-native-signature-popup-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/reader/faf-reader-api-caller","fss/js/lib/reader/window-event-listener","fss/js/views/esign/faf-signature-popup-view","fss/js/views/reader/faf-reader-native-signature-popup-surface-view"],function(e,t,i,n,s){return t.Reader.FafReaderNativeSignaturePopupView=t.FafSignaturePopupView.extend({initialize:function(){t.FafSignaturePopupView.prototype.initialize.call(this),this.listenForWindowEvents(),this._showingSpinner=!1},render:function(){t.FafSignaturePopupView.prototype.render.call(this)},_surfaceViewClass:function(){return t.Reader.FafReaderNativeSignaturePopupSurfaceView},_adjustPosition:function(){},_adjustSize:function(e){this._windowShowing!==!1&&t.FafSignaturePopupView.prototype._adjustSize.call(this,e)},_windowShown:function(){return"undefined"==typeof this._windowShowing?(this._windowShowing=!0,i.getResolvedPromise()):(this._windowShowing=!0,this._getDocWindowSize().then(_.bind(function(e){return this.options.docWindowSize=e,this._adjustSize(!0),this._open(),i.getResolvedPromise()},this)).fail(function(){return i.getResolvedPromise()}))},_windowHidden:function(){return this._windowShowing=!1,this._setContainerSize(1,1)},_sizeIsSet:function(e){_.defer(_.bind(function(){var n=e.find(".faf-sig-dialog"),s=$("#faf-sig-container"),o=s.outerWidth()+2*i.cssNumTotal(s,["margin","border"]),a=n.outerHeight(),r=$(window);if(r.width()!==o){var l=this.options.docWindowSize,d=a-l.height,f=o-l.width,c=$("#sig_popup");d>=20||f>=20?c.css("overflow","scroll"):c.css("overflow","hidden"),a=Math.min(a,l.height),o=Math.min(o,l.width),this._setContainerSize(o,a),t.FafSignaturePopupView.prototype._sizeIsSet.call(this,e)}},this))},_sigClose:function(e){this._resetButtons(),this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_DLG_WILL_CLOSE),this.options.doneFunc(e)}}),s.mixin(n.mixin(t.Reader.FafReaderNativeSignaturePopupView)),t.Reader.FafReaderNativeSignaturePopupView}),define("fss/js/ops/esign/show-signature-popup-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/formcanvas","fss/js/views/esign/faf-signature-popup-view","fss/js/views/reader/faf-reader-native-signature-popup-view"],function(e,t,i,n,s,o,a){t.ShowSignPopupOp=e.Op.extend({run:function(){var e=this,t=this.options;return e._showSignaturePopup(t.fieldID,t.sigType).done(function(e){t.doneFunc&&t.doneFunc(e)})},_showSignaturePopup:function(e,n){if(t._signatures.popupUiModel||(t._signatures.popupUiModel=t.modelFactory.create("FafSignaturePopupUiModel")),t._signatures.popupUiModel.set("sig_type",n),t._signatures.popupView)_.extend(t._signatures.popupView.options,_.pick(this.options,"doneFunc","sigType"));else{var r=_.extend({fafSignaturePopupUiModel:t._signatures.popupUiModel,FormCanvas:s,FafA:i,faf_user:t._fafFormValuesCollection,el:$("#sig_popup")[0]},this.options);t._signatures.popupView=this.options.isReaderNative?new a(r):new o(r),t._signatures.popupView.render()}return t._signatures.popupView.showPopup(e)}})}),define("fss/js/templates/esign/faf-signature-sync-template",[],function(){return['<div id="faf-sig-sync-dialog" class="faf-sig-sync-dialog generic-dialog"><div class="dialog-title-bar"><div class="dialog-title theme-text"></div></div><div class="faf-sign-sync-dlg-content dialog-content"><div class="faf-sign-sync-dlg-view"><div class="faf-sig-sync-desc theme-text"></div><div class="faf-sig-sync-list"></div><div class="faf-sig-dialog-foot"><div class="faf-sig-dialog-btns"><span id="faf-sig-save" class="control-button dialog-control-button theme-button theme-button-label"><%- done %></span></div></div></div></div></div>','<div class="faf-sig-sync-list-item"><div class="faf-sig-sync-radio core-radio-button"></div><div class="faf-sig-sync-radio-label theme-text"></div></div>']}),define("fss/js/views/esign/faf-signature-sync-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/fafa","fss/js/templates/esign/faf-signature-sync-template","i18n!fss/js/nls/ui-strings","fss/js/lib/formcanvas","fss/js/lib/faf-common-util","core/views/dialog-view"],function(e,t,i,n,s,o,a){return t.FafSignatureSyncView=e.DialogView.extend({events:function(){return _.extend({},e.DialogView.prototype.events,{"click      #faf-sig-save":"_onDoneClick","click      .faf-sig-sync-list-item":"_onRadioClick"})},initialize:function(){e.DialogView.prototype.initialize.call(this),this._template=_.template(n[0]),this._itemTemplate=_.template(n[1]),_.bindAll(this,"_onSignUpdate"),a.isDesktop()&&t.Reader.readerEventListenerOp.listenForReaderEvent("custom:SignUpdate",this._onSignUpdate)},_initWrappers:function(){e.DialogView.prototype._initWrappers.call(this),this.$fafSigDesc=this.$(".faf-sig-sync-desc"),this.$fafSigTitle=this.$(".dialog-title"),this.$fafSigSyncList=this.$(".faf-sig-sync-list")},render:function(){e.DialogView.prototype.render.call(this,!1),this.$el.empty().html(this._template({done:this.options.buttonLabel})),this._initWrappers(),this._sigType=this.options.sigData[0].type,"signature"===this._sigType?(this.$fafSigTitle.text(s.chooseSignatureTitle),this.$fafSigDesc.text(s.chooseSignatureMessage),this.$dlg.addClass("faf-signature")):(this.$fafSigTitle.text(s.chooseInitialsTitle),this.$fafSigDesc.text(s.chooseInitialsMessage),this.$dlg.addClass("faf-initials")),this._addSignatures(),$(".faf-sig-sync-radio").first().removeClass("core-radio-button").addClass("core-radio-button-selected"),$(window).resize(this._adjustPosition),this._adjustPosition(),this.$dlg.addClass("shown"),a.onExternalEsc(this._escToDialog),a.isDesktop()?t.appApi.keyApi.pushKeyHandler(this):$(document).bind("keydown",this._onSigKeyDown);var n="Sign:SyncDialog:Shown",o=n+":"+i.gaNameFromSigType(this._sigType);return i.logEvent(null,n,o),this},_onSignUpdate:function(){this.close(!1,{resolveArgs:"cancel"})},close:function(n,s){a.isDesktop()?t.appApi.keyApi.popKeyHandler(this):$(document).unbind("keydown",this._onSigKeyDown),$(window).off("resize",this._adjustPosition),a.offExternalEsc(this._escToDialog);var o="Sign:SyncDialog:Completed",r=o+":"+i.gaNameFromSigType(this._sigType);if(i.logEvent(null,o,r),this.$dlg.removeClass("shown"),!s||!s.hasOwnProperty("resolveArgs")){var l=this.$fafSigSyncList.find(".core-radio-button-selected").first();s={resolveArgs:l.data("sig-data")}}e.DialogView.prototype.close.call(this,!0,s)},_adjustPosition:function(){this.$dlg.css("left","50%"),this.$dlg.css("top","50%"),this._center();var e=$(".page-main-container")[0].getBoundingClientRect(),t=this.$dlg[0].getBoundingClientRect();t.left<e.left&&(this.$dlg.css("left",e.left),this.$dlg.css("margin-left",0)),t.top<e.top&&(this.$dlg.css("top",e.top),this.$dlg.css("margin-top",0))},_onDoneClick:function(){this.close()},_onRadioClick:function(e){var t=this.$fafSigSyncList.find(".core-radio-button-selected"),i=$(e.currentTarget).find(".faf-sig-sync-radio");_.each(t,function(e){$(e).data("sig-data")!==i.data("sig-data")&&$(e).removeClass("core-radio-button-selected").addClass("core-radio-button")}),i.removeClass("core-radio-button").addClass("core-radio-button-selected")},_addSignatures:function(){var e,t=this.options;for(e=0;e<t.sigData.length;e++)this._addSignature(t.sigData[e]);var i=$(this._itemTemplate()),n=i.find(".faf-sig-sync-radio");n.val("none");var o=i.find(".faf-sig-sync-radio-label");o.text("signature"===this._sigType?s.removeAllSignatures:s.removeAllInitials),this.$fafSigSyncList.append(i)},_addSignature:function(e){var t={width:190,height:72};"initials"===e.type&&(t.width=117);var i={imageType:e.type,imageData:e.pngData,canvasSize:t,imageSize:e.imageSize,centerImage:!0,callback:_.bind(function(t){t.addClass("faf-sig-sync-radio-img");var i=$(this._itemTemplate());i.append(t);var n=i.find(".faf-sig-sync-radio");n.val(e.assetID),n.data("sig-data",e);var s=i.find(".faf-sig-sync-radio-label");s.css("display","none"),this.$fafSigSyncList.append(i)},this)};o.createCanvas(i)},_escToDialog:function(){},_onKeyDown:function(e){return 27===e.which?!0:13===e.which?(this._onDoneClick(),!0):9===e.which?(this._performTab(!e.shiftKey),!0):!1},_onSigKeyDown:function(e){return 27===e.which?(e.stopPropagation(),void e.preventDefault()):13===e.which?(this._onDoneClick(),e.stopPropagation(),void e.preventDefault()):void(9===e.which&&(this._performTab(!e.shiftKey),e.stopPropagation(),e.preventDefault()))},_performTab:function(e){var t,i=this.$fafSigSyncList.find(".core-radio-button-selected");e?(t=i.parent().next().find(".core-radio-button"),0===t.length&&(t=this.$fafSigSyncList.find(".core-radio-button").first())):(t=i.parent().prev().find(".core-radio-button"),0===t.length&&(t=this.$fafSigSyncList.find(".core-radio-button").last())),i.removeClass("core-radio-button-selected").addClass("core-radio-button"),t.removeClass("core-radio-button").addClass("core-radio-button-selected")}}),t.FafSignatureSyncView}),define("fss/js/ops/esign/showing-signature-sync-dlg-op",["core/ac-core","fss/js/ac-faf","fss/js/views/esign/faf-signature-sync-view"],function(e,t){return t.ShowingSignatureSyncDlgOp=e.Op.extend({run:function(){var e=this.options,i=e.appApi.dialogApi,n=_.extend({},e,{parentView:i.getDialogParentView(),dialogsUiModel:e.appApi.options.dialogsUiModel,keyUiModel:e.appApi.options.keyUiModel,selectionUiModel:{getNumSelectedItems:function(){return 0}},buttonLabel:e.buttonLabel});delete n.el;var s=e.ViewCls||t.FafSignatureSyncView,o=new s(n);return o.open(n.parentView)}}),t.ShowingSignatureSyncDlgOp}),define("fss/js/ops/esign/trimming-signature-canvas-op",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-signature-util"],function(e,t,i,n,s,o){return t.TrimmingSignatureCanvasOp=e.Op.extend({run:function(){var e=$.Deferred(),t=this.options,n=t.$canvas,s={width:n.width(),height:n.height()},a=n[0].toDataURL(),r={left:10,right:10},l=this.options.FormCanvas.trimCanvas(n,r,!0),d=$('<canvas width="'+l.width+'" height="'+l.height+'">');return d.css({width:l.width+"px",height:l.height+"px",position:"absolute",top:"-9999px"}),n.after(d),o.addImageToCanvas(a,s.width,s.height,-l.top,-l.left,d,_.bind(function(){var t=d[0].toDataURL();t=t.replace(/^data:image\/png;base64,/g,""),t.length>i.MAX_FILE_SIZE_SIGNATURE?e.reject("Invalid"):e.resolve({$canvas:d,newArea:l,imgData:t})},this)),e.promise()}}),t.TrimmingSignatureCanvasOp}),define("fss/js/ops/esign/get-scribble-image-data-op",["core/ac-core","fss/js/ac-faf","dc-scribble-utils"],function(e,t,i){return t.GetScribbleImageDataOp=e.Op.extend({run:function(){var e=$.Deferred(),t=this.options.scribble,n=t.getImageData(i.TRIM_POLICY_WIDTH,10,0,500);return e.resolve({newArea:{height:n.height,width:n.width},imgData:n.data}),e.promise()}}),t.GetScribbleImageDataOp}),define("fss/js/ops/create-smart-field-op",["core/ac-core","fss/js/ac-faf","fss/js/views/form-field/faf-field-annotation-view","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/formstyler","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o,a,r){return t.CreateSmartFieldOp=e.Op.extend({run:function(){var e=this,a=this.options.pageModel.get("scale"),l="",d=this.options.candidate[0],f=this.options.candidate,c="";document.activeElement&&"body"!==document.activeElement.nodeName.toLowerCase()&&document.activeElement.blur(),this.options.isTab&&t._fafEditorUiModel.set("smart_tabbed_fields",t._fafEditorUiModel.get("smart_tabbed_fields")+1);var u,h,p,g={left:d.offsetLeft,top:d.offsetTop,baseline:d.offsetTop+parseInt(f.attr("data-orig-height"),10)},m=f.hasClass("button"),v=f.hasClass("text"),S=f.hasClass("signature"),E=t._fafFormView;(m||S)&&(f.hasClass("tool-check")&&(l="check"),f.hasClass("tool-dot")&&(l="dot"),f.hasClass("tool-x")&&(l="x"),f.hasClass("tool-signature")&&(l="signature"));var b={width:d.offsetWidth/a,height:parseInt(f.attr("data-orig-height"),10)/a};["x","check","dot"].indexOf(l)>-1&&(b.width=b.height=Math.min(b.width,b.height),g.top+=(g.baseline-g.top-b.height*a)/2,g.left+=(d.offsetWidth-b.width*a)/2);var w={cat:"Field:SmartCreate"};if(E.blurFocusedElement(),E.deleteEmptyJustCreatedField(),m&&t._fafFormView.okToAddField("Annot",n.gaNameFromToolType(l),{})){w.label="Annot:"+n.gaNameFromToolType(l),delete g.baseline;var F={position:g,size:b,addToGlobal:!1,candidateId:this.options.model.get("id"),previousField:f};e.options.isTab?_.extend(F,{imageType:"empty",addProperty:function(t){e.options.isTab&&t.attr("data-tool-type",l),t.attr("data-switch-to-type",l),t.attr("data-from-tab",!0)}}):_.extend(F,{imageType:l}),i.prototype.createAnnotationImageFieldWithOptions(F),u=t._fafEditorUiModel.get("pages"),h=t._fafEditorUiModel.get("current_page"),p=u[h].elements[t._fafEditorUiModel.get("pages")[h].elements.length-1],c=p.fid||p.id,t._fafFieldCandidateMappingCollection.addMapping({fieldID:c,candidateID:this.options.model.get("id"),type:"manual",value:"1"})}else if(v&&t._fafFormView.okToAddField("text","custom",{})||S&&t._fafFormView.okToAddField("Sign",n.gaNameFromSigType("signature"),{})){c=t._formManager.form.getNewFieldID();for(var T=this.options.model.get("maxChars"),D=$.extend({},T?o.defaultValues.combfield.styles:o.defaultValues.textfield.styles),y=f.attr("data-orig-height")/a,A=parseInt(D["font-size"].slice(0,-2),10),C=s.getCanvasSizeForText(r.FormViewTypeTextHere,A+"pt",D["font-family"]),P={candidateId:this.options.model.get("id")};C.height>y;)A--,C=s.getCanvasSizeForText(r.FormViewTypeTextHere,A+"pt",D["font-family"]);if(D["font-size"]=A+"pt",D["font-size"]=s.nearestLegalFontSize(D["font-size"]),T){var R=d.clientWidth/T-.6*A*a;_.extend(D,{"letter-spacing":R+"px"}),g.left+=R/2,w.label="Text:Comb",P.isComb=!0}else g.left+=15,w.label="Text";var I=C.width*a>f.width()-15||S?"####":this.options.placeholder?this.options.placeholder:null,O=E.$initialInput(c,I,D).val(this.options.value||"");S&&(O.addClass("faf-field-with-invisible-caret"),w.label=n.gaNameFromSigType("signature")),e.options.isTab&&O.attr("data-from-tab",!0),delete g.top;var M=s.baselineOfFontSize(s.nearestLegalFontSize(""+s.fontSizeOfElement(O)));g.baseline-=Math.max(3,.2*M)*a,t._fafFieldCandidateMappingCollection.addMapping({fieldID:c,candidateID:this.options.model.get("id")});var x={previousField:f,$element:O,position:g,fieldType:"textfield",isComb:T,addOptions:P};t.opFactory.create("AddingFormFieldOp",x).run().then(_.bind(function(e){E.$lastCustomFieldCreated=e,E.lastCustomId=c,t._fafFormValuesCollection.setValue(c,{text:this.options.value||"",type:"textfield"}),O.focus()},this))}return this._logEvent(w),this._getResolvedPromise()},_logEvent:function(e){var t=e&&e.cat?e.cat:null,i=t+(this.options.isTab?":Tab":":Click"),s=e&&e.label?i+":"+e.label:null;n.logEvent(t,i,s)}}),t.CreateSmartFieldOp}),define("fss/js/ops/toggling-field-switch-menu-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.TogglingFieldSwitchMenuOp=e.Op.extend({run:function(){var e=t._fafEditorUiModel,i=e.get("show_switch_field_type_menu");return e.set("show_switch_field_type_menu",!i),this._getResolvedPromise()}}),t.TogglingFieldSwitchMenuOp}),define("fss/js/ops/tab-to-smart-field-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.TabToSmartFieldOp=e.Op.extend({run:function(){var e=this.options.mapping,t=this.options.candidateID,i=this.options.fafRC.fafFieldCandidatePagesCollection.findWhere({pageNumber:this.options.fafEditorUiModel.get("current_page")}),n=-1;if(e||t){var s=this.options.fafRC.fafFieldCandidatePagesCollection.getCandidateModel(t||e.get("candidateID"));n=i.candidates.indexOf(s)}var o=i.candidates.models.length,a=this.options.shiftKey?(o+n-1)%o:(n+1)%o,r=i.candidates.at(a);return r&&r.trigger("change:createFieldOnTab",{isTab:!0}),this._getResolvedPromise()}}),t.TabToSmartFieldOp}),define("fss/js/ops/exclude-autocomplete-string-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-ajax-util"],function(e,t,i){return t.ExcludeAutocompleteStringOp=e.Op.extend({run:function(){if(!t._fafAutocompleteModel.get("ok_to_post"))return this._unmarkValuesAsChanged(),this._getResolvedPromise();var e=$.Deferred(),n=this.options.string,s=this,o=i.addDexiAjaxOptions(i.getAjaxOptions("POST","/autoc",{modal:!1,error:function(){e.reject()},success:function(){s._unmarkValuesAsChanged(),e.resolve()},data:JSON.stringify({remove:[n]})}),{setRequestID:!0,version:2,useCharset:!0,setContentType:!0});return $.ajax(o),e.promise()},_unmarkValuesAsChanged:function(){var e=t._fafFormValuesCollection.where({text:this.options.string});e.length&&_.each(e,function(e){e.unset("changed",{silent:!0})})}}),t.ExcludeAutocompleteStringOp}),define("fss/js/ops/send-autocomplete-newvalues-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-ajax-util"],function(e,t,i){return t.SendAutocompleteNewvaluesOp=e.Op.extend({run:function(){if(!this.options.fafAutocompleteModel.get("ok_to_post"))return this._getResolvedPromise();var e=this.options.fafFormValuesCollection.where({changed:!0});if(!e.length)return this._getResolvedPromise();var n=_.map(e,function(e){return e.get("text")}),s={formID:t._formManager.getFormID(),add:n},o=$.Deferred(),a=i.addDexiAjaxOptions(i.getAjaxOptions("POST","/autoc",{modal:!1,error:function(){o.reject()},success:function(){o.resolve()},data:JSON.stringify(s)}),{version:2,useCharset:!0,setContentType:!0});return $.ajax(a),o.promise()}}),t.SendAutocompleteNewvaluesOp}),define("fss/js/ops/scroll-mode-op",["core/ac-core","fss/js/ac-faf"],function(e,t){t.ScrollModeOp=e.Op.extend({run:function(){var e=this.options,t=e.fafEditorUiModel,i=e.scrollMode;return t.set("scroll_mode",i),this._getResolvedPromise()}})}),define("fss/js/ops/signing-in-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-common-api-util","fss/js/lib/faf-common-util","fss/js/lib/faf-ajax-util","fss/js/models/faf-signin-state-model"],function(e,t,i,n,s){return t.SigningInOp=e.Op.extend({run:function(){var e=this.options.appApi,s=this.options.fafSigninStateModel,o=this.options.isRetry?s.state.RETRYING:s.state.SIGNING_IN,a=!1;return s.unset(s.REASON),s.set(s.STATE,o),this._checkConnection().then(_.bind(function(){var t=e.sessionApi.ensureSignedIn(),i=$.Deferred();return t.then(function(){i.resolve()}).fail(function(e){e&&"DCAPIUnsupported-Error410"===e.errorString&&i.resolve(),e&&"NoAccessToPdfServices"===e.errorString&&("UserEncrypted"===e.errorCode?i.resolve():(a=!0,i.reject()))}),i.promise()},this)).then(_.bind(function(){if(n.isDesktop()){var e=_.extend({ignorePrevStatus:!0},this.options);return t.Reader.opFactory.create("GettingDocCloudServicesStatusOp",e).run().then(function(e){"enabled"!==e.docServices&&(a=!0)}).fail(function(){a=!0})}return $.Deferred().resolve().promise()},this)).then(_.bind(function(){return a?$.Deferred().reject().promise():void 0})).then(_.bind(function(){return t.opFactory.create("InitUserOp",this.options).run()},this)).then(_.bind(function(){return i.checkClientVersion(this.options)},this)).then(_.bind(function(){return s.set(s.STATE,s.state.SIGNED_IN),this._getResolvedPromise()},this)).fail(_.bind(function(){a?s.setOffline(s.reason.DISABLED):s.get(s.STATE)===o&&s.setOffline(s.reason.ERROR)},this))},_checkConnection:function(){return $.ajax(s.getAjaxOptions("/health"))}}),t.SigningInOp}),define("fss/js/ops/reader/signing-out-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.Reader.SigningOutOp=e.Op.extend({run:function(){var e=this.options.fafSigninStateModel;(e.get(e.STATE)!==e.state.OFFLINE||e.get(e.REASON)!==e.reason.SIGNED_OUT)&&(e.unset(e.REASON),e.set(e.STATE,e.state.SIGNING_OUT),e.setOffline(e.reason.SIGNED_OUT))}}),t.Reader.SigningOutOp}),define("fss/js/ops/toggling-zoom-selector-menu-op",["core/ac-core","fss/js/ac-faf"],function(e,t){return t.TogglingZoomSelectorMenuOp=e.Op.extend({run:function(){var e=this.options.fafEditorUiModel,t=e.get("show_zoom_selector_menu");return e.set("show_zoom_selector_menu",!t),this._getResolvedPromise()}}),t.TogglingZoomSelectorMenuOp}),define("fss/js/ops/op-factory",["core/ac-core","fss/js/ac-faf","fss/js/ops/downloading-pdf-op","fss/js/ops/saving-pdf-op","fss/js/ops/hiding-status-op","fss/js/ops/initializing-plugin-op","fss/js/ops/init-user-op","fss/js/ops/listening-for-view-events-op","fss/js/ops/reader/listening-for-reader-events-op","fss/js/ops/open-form-op","fss/js/ops/listening-for-field-added-op","fss/js/ops/listening-for-print-op","fss/js/ops/deleting-form-field-op","fss/js/ops/running-plugin-op","fss/js/ops/flushing-data-op","fss/js/ops/getting-autocomplete-state-op","fss/js/ops/losing-textfield-focus-op","fss/js/ops/showing-progress-status-op","fss/js/ops/starting-plugin-op","fss/js/ops/faf-starting-op","fss/js/ops/starting-plugin-common-op","fss/js/ops/switching-to-tool-op","fss/js/ops/zooming-form-op","fss/js/ops/create-and-open-sample-form-op","fss/js/ops/create-and-open-form-via-bh-op","fss/js/ops/create-and-open-form-via-upload-op","fss/js/ops/create-form-op","fss/js/ops/adding-form-field-op","fss/js/ops/create-sample-form-op","fss/js/ops/upload-file-op","fss/js/ops/toggling-download-pdf-menu-op","fss/js/ops/downloading-as-print-fallback-op","fss/js/ops/showing-filename-dlg-op","fss/js/ops/start-drag-sig-saved-op","fss/js/ops/emit-output-event-op","fss/js/ops/showing-NPS-dlg-op","fss/js/ops/saving-NPS-feedback-op","fss/js/ops/esign/toggling-signature-menu-op","fss/js/ops/esign/save-signature-asset-op","fss/js/ops/esign/save-signature-to-cloud-op","fss/js/ops/esign/show-signature-popup-op","fss/js/ops/esign/showing-signature-sync-dlg-op","fss/js/ops/esign/trimming-signature-canvas-op","fss/js/ops/esign/get-scribble-image-data-op","fss/js/ops/create-smart-field-op","fss/js/ops/toggling-field-switch-menu-op","fss/js/ops/tab-to-smart-field-op","fss/js/ops/exclude-autocomplete-string-op","fss/js/ops/send-autocomplete-newvalues-op","fss/js/ops/scroll-mode-op","fss/js/ops/signing-in-op","fss/js/ops/reader/signing-out-op","fss/js/ops/reader/flush-to-reader-app-op","fss/js/ops/toggling-zoom-selector-menu-op","fss/js/ops/send-autocomplete-newvalues-op","fss/js/ops/signature-sync-op"],function(e,t){t.OpFactory=e.Op.extend({create:function(e,i){var n=t[e];return n?new n(i):void LOG.error("AcFaf.OpFactory.create: Unrecognized class: "+e)}})}),define("fss/js/xlib/EventTarget",[],function(){function e(){this._listeners={}}return e.prototype={constructor:e,addListener:function(e,t){"undefined"==typeof this._listeners[e]&&(this._listeners[e]=[]),this._listeners[e].push(t)},fire:function(e){if("string"==typeof e&&(e={type:e}),e.target||(e.target=this),!e.type)throw new Error("Event object missing 'type' property.");if(this._listeners[e.type]instanceof Array)for(var t=_.clone(this._listeners[e.type]),i=0,n=t.length;n>i;i++)t[i].call(this,e)},removeListener:function(e,t){if(this._listeners[e]instanceof Array)for(var i=this._listeners[e],n=0,s=i.length;s>n;n++)if(i[n]===t){i.splice(n,1);break}}},e}),define("fss/js/ui/FafMain",["fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/formstyler","fss/js/lib/formcanvas","fss/js/lib/util","fss/js/lib/fafa","fss/js/models/ui/faf-signature-popup-ui-model"],function(e,t,i,n,s,o){function a(t){"console"in window&&"timeStamp"in window.console&&(s.logInfo("FafMain","FafMain begin"),console.timeStamp("FafMain begin")),this.options=t,e._flushAllDirty=_.bind(r,this),l(e._fafContentView.formId?"FillForm":"MyForms"),$(window).resize(),this.dtfSwitchView=l}function r(t){return e.opFactory.create("FlushingDataOp",_.extend({},this.options,t)).run()}function l(i){e._app.notifyEvent(t.APP_WILL_SWITCH_VIEW,{viewName:i});var n=$("#content");e._app&&e._app.currentView&&n.removeClass("faf-"+e._app.currentView),n.addClass("faf-"+i),$(".faf-view-container>div").hide(),"MyForms"===i&&(e._fafContentView.formId=void 0,e._formManager&&(e._formManager.fafEditorUiModel.set("form_id",""),e._formManager.fafEditorUiModel.set("form_name",""),e._formManager.fafEditorUiModel.close(),e._formManager.closeForm())),$('[data-viewname="'+i+'"]').show(),$(".faf-view-container").removeClass("faf-"+e._app.currentView).addClass("faf-"+i),e._app.currentView=i,o.setCurrentView(i)}return a}),define("fss/js/data/formdata",["jquery","fss/js/ac-faf","fss/js/lib/faf-common-util"],function(e,t,i){function n(i){if(e.extend(this,i),t._formManager.checkExistsForNewID={},this.hasOwnProperty("pages"))for(var s=function(e,i){var n=i.fid||i.id;n.indexOf("field")>-1&&(t._formManager.checkExistsForNewID[n.split("-")[1]]=!0)},o=0;o<this.pages.length;o++)this.pages[o]=new n.PageData(this.pages[o]),e.each(this.pages[o].elements,s);else this.pages=[]}return n.prototype.isSampleForm=function(){return this.hasOwnProperty("sample")?this.sample:!1},n.prototype.getNewFieldID=function(){for(var e=(new Date).getTime();t._formManager.checkExistsForNewID.hasOwnProperty(e);)e=(new Date).getTime();return"field-"+e},n.prototype.getPage=function(e){return this.pages&&e>=0&&e<this.pages.length?this.pages[e]:null},n.prototype.getPageBackgroundImageURL=function(e){return i.createRenditionUrl(this.assetID,e)},n.prototype.getPageSize=function(e){var t=this.getPage(e||0);
return t&&t.pageSize?t.pageSize:{h:1,w:1}},n.PageData=function(t){e.extend(this,t),this.hasOwnProperty("elements")||(this.elements=[])},n}),define("fss/js/ui/formmanager",["fss/js/ac-faf","fss/js/data/fafconstants","fss/js/data/formdata","fss/js/data/signaturesdata","fss/js/lib/formstyler","fss/js/lib/formcanvas","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/faf-ajax-util","fss/js/lib/fafa","fss/js/views/form-field/faf-field-view","i18n!fss/js/nls/ui-strings"],function(e,t,i,n,s,o,a,r,l,d,f,c){function u(i,n){var s=this;s.app=i,s.options=n,s.app.addListener(t.APP_WILL_SWITCH_VIEW,function(){e._fafFormView.blurFocusedElement()}),s.app.addListener(t.MOVE_RESIZE_FIELD,function(e){s.moveResizeField(e)}),s.app.addListener(t.FORM_FIELD_CHANGE_STYLE,function(e){s.fieldStyleChanged(e)}),s.app.addListener(t.FORM_FIELD_CHANGED,function(e){s.fieldChanged(e)}),s.app.addListener(t.FORM_FIELD_CHANGE_ID,function(e){s.fieldIdChanged(e)}),s.app.addListener(f.prototype.FIELD_GAINED_FOCUS,function(){e._fafFormView.fieldGainedFocus()}),s.app.addListener(f.prototype.FIELD_LOST_FOCUS,function(t){t.field&&s.$lastFieldAdded&&t.field[0]===s.$lastFieldAdded[0]&&delete s.$lastFieldAdded,e._fafFormView.deleteEmptyJustCreatedField(t.field),$(".faf-form-view .faf-form-image").removeClass("withFocus"),e._fafFormView.fieldHasFocus=!1}),s.app.addListener(t.WIDTH_AUTOCHANGE,function(e){s.textFieldWidthChanged(e.field)}),s.customFieldNumber=0,s.fontBaselineAdjustment={textfield:0,combfield:0},"Firefox"===a.browserAndVersion()[0]?s.fontBaselineAdjustment=navigator.platform.indexOf("Mac")>=0?{textfield:.03,combfield:.04}:{textfield:-.05,combfield:-.06}:"Chrome"===a.browserAndVersion()[0]||r.isDesktop()?navigator.platform.indexOf("Mac")>=0?s.fontBaselineAdjustment={textfield:-.15,combfield:-.1}:navigator.platform.indexOf("in32")>=0&&(s.fontBaselineAdjustment={textfield:-.06,combfield:-.06}):"Safari"===a.browserAndVersion()[0]&&navigator.platform.indexOf("Mac")>=0?s.fontBaselineAdjustment={textfield:-.06,combfield:-.12}:"MSIE"===a.browserAndVersion()[0]&&navigator.platform.indexOf("in32")>=0&&(s.fontBaselineAdjustment={textfield:-.04,combfield:-.08}),s.blueInputboxAdjust={left:19,top:6},s.focusBoxPadding={left:19,top:6,right:6,bottom:6},s.defaultImageWidth=700,e._fafFlushableDataModel.addFlushable({form:this}),s.preload()}return u.prototype={},u.prototype.constructor=u,u.prototype.getFormID=function(){return this.formID},u.prototype.getPageScale=function(){return e._fafFormView.curPageScale},u.prototype.preload=function(){$(".faf-form-view").empty()},u.prototype.load=function(t,s,o){var a=this;e.appApi.displayApi.showSpinner(!0),a.fafEditorUiModel.set("is_hud_dismissed",!1),a.form=new i(t),a.formID=o.formID,a.etag=o.etag,a.fafEditorUiModel.set("form_source",o.formSource),e.opFactory.create("ListeningForFieldAddedOp",{formID:a.formID}).run();var r=e.opFactory.create("ListeningForPrintOp",this.options);a.fafEditorUiModel.set("print_listener",r),r.run();var l=e._fafFormValuesCollection.parse(s);e._fafFormValuesCollection.reset(l),e._signatures.formSignatures=new n,e._signatures.formSignatures.getAllDataFromServer(s.values.formValues).then(function(){a.fafEditorUiModel.set("pages",t.pages),e._fafFormView.render(),a.fafEditorUiModel.set("form_id",o.formID),a.fafEditorUiModel.set("form_name",o.formName),e.appApi.displayApi.showSpinner(!1)})},u.prototype.setDirty=function(){var t=this;t.changeSubmitBackstop||(t.changeSubmitBackstop=_.delay(function(){e._flushAllDirty()},4e3)),t.changeSubmit&&(clearTimeout(t.changeSubmit),delete t.changeSubmit),t.changeSubmit=setTimeout(function(){e._flushAllDirty()},1500),t.isDirty=!0,e._app.cntFields++},u.prototype.needsFlushing=function(t){return e._fafFormValuesCollection.needsFlushing(t)},u.prototype.flush=function(t){return e._fafFormValuesCollection.flush(t)},u.prototype.flushName=function(){return"FormManager"},u.prototype.cancelAutoSaveTimers=function(){a.logInfo("formmgr","Pre-saving form"),this.changeSubmit&&(clearTimeout(this.changeSubmit),delete this.changeSubmit),this.changeSubmitBackstop&&(clearTimeout(this.changeSubmitBackstop),delete this.changeSubmitBackstop)},u.prototype.loadFieldCandidates=function(t){var i=this,n=t.pages,s=t.fields;i.fafEditorUiModel.set("page_dimensions",n),i.fafEditorUiModel.set("field_candidates",s);for(var o=[],a=0;a<s.length;++a)o[a]=!1;i.fafEditorUiModel.set("field_candidates_processed",o),e._fafFormView.renderFieldCandidates()},u.prototype.nextCustomFieldNumber=function(){var e=this;return e.customFieldNumber+=1,e.customFieldNumber},u.prototype.updateElementStyles=function(e,i){var n=this,s=i.data(t.FORM_FIELD_KEY),o=$(s.fieldBaseElement());e.style={"font-weight":400};var r=n.getPageScale(),l=a.roundThous(a.cssNumTotal(o,"letter-spacing")/r)+"px";e.style["letter-spacing"]=l;var d="0px"===l,f=a.legalFontFamily(o.css("font-family"),d);e.style["font-family"]=f;var c=a.fontSizeInPt(o[0].style.fontSize||o[0].style["font-size"]),u=a.nearestLegalFontSize(""+c/r)+"pt";e.style["font-size"]=u},u.prototype.updateElementWidth=function(e,i){var n=this,s=i.data(t.FORM_FIELD_KEY),o=$(s.fieldBaseElement());if(o.hasClass("fixedSize")){e.isFixedSize=!0;var a=n.getPageScale();e.width=parseFloat(o.css("width"))/a,e.height=parseFloat(o.css("height"))/a}else e.isFixedSize=!1,delete e.width,"textfield"===e.type&&n.textFieldWidthChanged(i)},u.prototype.elementFromField=function(i,n,s,o){var r=this,l=i.data(t.FORM_FIELD_KEY),d=l.fieldBaseElement(),f=$(d),c=l.fieldName(!0),u=r.getPageScale();n.top=n.top/u,n.left=n.left/u,"textfield"===s?n.top-=e._fafFormView.fieldBaselineAdjust(a.nearestLegalFontSize(""+parseFloat(f.css("font-size"))/u),f.css("font-family"),o&&o.isComb):"annotationImage"===s&&(["signature","initials"].indexOf(l.fieldName())>-1?s=l.fieldName():c=l.fieldName());var h={id:c,type:s,position:n};"annotationImage"===s&&(h.fid=l.fieldName(!0)),o&&(o.isComb&&(h.isComb=!0),o.candidateId&&(h.candidateId=o.candidateId));var p=a.placeholderText(f);return p&&(h.ui=p),"textfield"===s&&r.updateElementStyles(h,i),r.updateElementWidth(h,i),i.data(t.FORM_ELEMENT_KEY,h),h},u.prototype.indexOfFieldId=function(e){var t=e.split("-")[1];return this.checkExistsForNewID.hasOwnProperty(t)},u.prototype.indexOfFormElement=function(t){var i=e._fafFormView.$curPage.data("formData");if(i&&i.elements)for(var n=0;n<i.elements.length;n++)if(i.elements[n]===t)return n;return-1},u.prototype.addOrReplaceFormElement=function(t,i){var n=this,s=e._fafFormView.$curPage.data("formData");s.hasOwnProperty("elements")||(s.elements=[]);var o=-1;i&&(o=n.indexOfFormElement(i),-1===o&&a.logError("formmgr","replacing element that isn't in page?")),o>=0?s.elements[o]=t:s.elements.push(t),n.setDirty()},u.prototype.fieldAdded=function(e,i){var n=this,s=n.indexOfFormElement(e),o=i.data(t.FORM_FIELD_KEY),a=$(o.fieldBaseElement());a.data("gaqIndex",s);var r={formElement:e,$newField:i,$input:a};n.app.notifyEvent(t.FORM_FIELD_ADDED,r)},u.prototype.fieldStyleChanged=function(e){var i=this,n=e.$fieldDiv,s=n.data(t.FORM_ELEMENT_KEY);s&&(i.updateElementStyles(s,n),i.updateElementWidth(s,n),i.setDirty())},u.prototype.fieldIdChanged=function(i){var n=this,s=i.$field,o=s.data(t.FORM_ELEMENT_KEY),a=e._fafFormView.elementOfField(s);if(o){o.id=a.attr("name");var r=a.attr("placeholder");if(r){var l=/^Unlabeled field [\d]+$/;l.test(r)&&(r=c.FormViewTypeTextHere,a.attr("placeholder",r))}else r=c.FormViewTypeTextHere;r===c.FormViewTypeTextHere?delete o.ui:o.ui=r,n.setDirty()}},u.prototype.fieldChanged=function(e){var i=this,n=e.$field;if(!e.transient){var s=n.data(t.FORM_ELEMENT_KEY),o=n.data(t.FORM_FIELD_KEY),r=o.fieldBaseElement(),l=a.posAplusB(i.blueInputboxAdjust,n.position());l.left+=a.cssNumTotal($(r),"letter-spacing")/2;var d=i.elementFromField(n,l,s.type,{isComb:s.isComb,candidateId:s.candidateId});i.addOrReplaceFormElement(d,s)}},u.prototype.moveResizeField=function(e){var i=this,n=e.field,s=n.data(t.FORM_ELEMENT_KEY);if(s){if(0!==e.diff.top||0!==e.diff.left){var o=i.getPageScale();s.position.top+=e.diff.top/o,s.position.left+=e.diff.left/o,i.setDirty()}0!==e.diff.width&&(i.updateElementWidth(s,n),i.setDirty())}},u.prototype.textFieldWidthChanged=function(e){var i=e.data(t.FORM_ELEMENT_KEY);if(i){var n=$("textarea.faf-user-value",e);if(n.length){var s=e.data(t.TEXT_EXTRA_SPACE)||1,o=(n.width()-s+1)/(this.getPageScale()||1)+"px";o!==i.style.width&&(i.style.width=o,n.data("textValueChanged")&&this.setDirty())}n.data("textValueChanged",!1)}},u.prototype.autoDeleteLabel=function(t){return e._fafFormView.autoDeleteLabel(t)},u.prototype.createSynapses=function(){var t=e._fafFieldCandidateMappingCollection;t&&t.isInitialized().then(function(){t.save()})},u.prototype._logSmartFieldEvents=function(){if(this.formID){var t=this.fafEditorUiModel.fieldCount(),i=e._fafFieldCandidateMappingCollection.smartFieldCount(),n=t>0?1*i/t:0,s=e.appApi.usersMeApi.getUserCohorts()||{},o=s["FSS-FR-feat-test"]||"not_in_fr",r="numFields=<%= numFields %> numSmartFields=<%= numSmartFields %> percSmartFields=<%= percSmartFields %> percNormalFields=<%= percNormalFields %> usedTabFeature=<%= usedTabFeature %> placedSmartSignature=<%= placedSmartSignature %> frCohort=<%= frCohort %>",l={numFields:t,numSmartFields:i,percSmartFields:n,percNormalFields:t>0?1-n:0,usedTabFeature:this.fafEditorUiModel.get("smart_tabbed_fields")>=3,placedSmartSignature:this.fafEditorUiModel.get("smart_sig_placed"),frCohort:o};a.logToSplunk(_.template(r,l))}},u.prototype.closeForm=function(){e._fafFormView.blurFocusedElement();var i=this;i.createSynapses();var n=this.fafEditorUiModel.get("print_listener");n&&(this.fafEditorUiModel.unset("print_listener"),n.done());var s=e._fafAppLimitsModel.getFRFeatureLevel();s&&s>0&&e._fafFieldCandidatePagesCollection&&(this._logSmartFieldEvents(),e._fafFieldCandidatePagesCollection.reinit(),e._fafFieldCandidateMappingCollection.reset()),this.app.notifyEvent(t.FORM_CLOSED,{formID:this.formID,form:this.form}),this.formID=null,this.form=null},u.prototype.willFlushForm=function(){return e._fafFormView.blurFocusedElement(),a.getResolvedPromise()},u}),define("fss/js/templates/faf-app-view-template",[],function(){return'<div class="faf-xd"><div class="faf-view-container no-select"><div class="faf-form-list ui-theme theme-container" data-viewname="MyForms"></div><div class="faf-edit-form" data-viewname="FillForm"></div></div><div id="sig_popup" class="sig-mouse-counter"></div><div id="sig_popup_bkg" class="sig"></div><div class="loader"></div><iframe id="faf-download"></iframe></div>'}),define("fss/js/templates/faf-organizer-view-template",[],function(){return['<div class="faf-add-form-container"><div class="faf-service-title" role="heading" aria-level="1"><%= title %></div><div class="faf-service-subtitle"><%= subtitle %></div><input type="button" tabindex="0"       class="control-button upload-controller faf-select-file"       value="<%= selectform %>" /></div><div class="faf-recent-file-preview"><div class="faf-recent-files-subtitle" role="heading"      aria-level="2"></div><button role="link"        class="faf-recent-headers site-catalyst               faf-view-files-btn"><%= all_files %></button><div class="faf-recent-files collection-thumb-view"><div class="faf-recent-thumbnails-row"></div><div class="faf-recent-filenames-row"></div></div></div>','<figure aria-label="<%= file_name %>"        class="faf-recent-file-container site-catalyst"        style="position:relative" data-asset-id="<%= asset_id %>"><div class="faf-recent-file" role="presentation"><a href="/fillsign/<%= asset_id %>"   aria-label="<%= file_name %>"   class="faf-preview-image-container"><img class="faf-preview-image hide" draggable="false"     src="<%= image_icon %>" alt="<%= file_name %>"/><div class="faf-placeholder-image collection-item-thumb            <%= defaultIcon %>"></div></a><div class="faf-preview-actions" role="presentation"><button title="<%= download %>"        aria-label="<%= download %> "       class="faf-preview-download              core-download-light-icon"></button><button title="<%= send %>"        aria-label="<%= send %>"       class="faf-preview-send-link"></button></div></div></figure>','<a href="/fillsign/<%= asset_id %>"   class="faf-preview-name" data-form-name="<%= form_name %>"><%= file_name %></a>']}),define("fss/js/views/faf-organizer-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings","fss/js/templates/faf-organizer-view-template","core/utils/util"],function(e,t,i,n,s,o,a,r,l,d){return t.FafOrganizerView=e.View.extend({events:{"click    .faf-view-files-btn":"_onViewAllClick","click    .faf-preview-image-container":"_onFormThumbClick","click    .faf-preview-name":"_onFormNameClick","keydown  .faf-preview-image-container":"_onFormThumbClick","keydown  .faf-preview-name":"_onFormNameClick","click    .faf-preview-download":"_onDownloadClick","click    .faf-preview-send-link":"_onSendClick","focusin  .faf-preview-download":"_onFocusIn","focusin  .faf-preview-send-link":"_onFocusIn","focusout .faf-preview-download":"_onFocusOut","focusout .faf-preview-send-link":"_onFocusOut"},SAMPLE_ID:"sample",initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(l[0]),_.bindAll(this,"_makeDz")},_initWrappers:function(){this._makeElementIntoDropzoneJS(".faf-add-form-container"),this.app=t._app,this.app.addListener(i.LOAD_MY_FORMS,this._loadForms),this.app.addListener(i.APP_WILL_SWITCH_VIEW,_.bind(function(e){e&&"MyForms"===e.viewName&&this._loadForms()},this))},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({title:r.FAF,subtitle:r.OrganizerSubTitle,selectform:r.OrganizerSelectForm,selectformtitle:r.OrganizerSelectFormTitle,all_files:r.OrganizerViewAll})),this._initWrappers()),this._renderChildViews(),this._loadForms()},_renderChildViews:function(){},_loadForms:function(){this._loadingForms||(this._loadingForms=!0,s.logInfo("formslist","fetching form list"),this.$el.find(".faf-recent-file-container,.faf-preview-name").remove(),this.$el.find(".faf-recent-file-preview .faf-recent-files-subtitle").text(r.OrganizerRecentFiles),this.$el.find(".faf-recent-file-preview .faf-recent-headers").addClass("hide"),$.ajax(o.getAjaxOptions("/forms")).done(_.bind(function(e){this._addForms(e.forms)},this)).fail(o.handleDexiErrorResponse(_.bind(function(e,t){o.defaultErrorHandler(t),s.logError("formslist","Cannot get forms: "+t.toJSONString()),this._addForms()},this))).always(_.bind(function(){this._loadingForms=!1},this)))},_maxPreview:4,_addForms:function(e){e=e||[],e.length>0?(this.$el.find(".faf-recent-file-preview .faf-recent-headers").removeClass("hide"),_.each(e.slice(0,this._maxPreview),_.bind(function(e){this._addForm(e)},this))):(this.$el.find(".faf-recent-file-preview .faf-recent-files-subtitle").text(r.OrganizerSampleForm),this._addSample())},_addSample:function(){var e=r.OrganizerSampleFileName+".form",t=$(_.template(l[1],{image_icon:s.getSampleThumbnailUrl(),asset_id:this.SAMPLE_ID,defaultIcon:"file-icon-form",file_name:e,download:r.DownloadButton,send:r["RHP.Send.track"]})),i=$(_.template(l[2],{asset_id:this.SAMPLE_ID,file_name:e,form_name:e}));t.appendTo(this.$el.find(".faf-recent-thumbnails-row")),i.appendTo(this.$el.find(".faf-recent-filenames-row"));var n=t.find(".faf-preview-image"),o=t.find(".faf-placeholder-image");n.load(_.bind(function(e,t){t.removeClass("hide"),e.addClass("hide")},{},o,n)),t.find(".faf-preview-actions").addClass("hide"),a.hideGuide(),a.showGuide({parent:t,top:40,left:131,width:156,arrow:"left",arrowPosition:20,text:r.OrganizerSampleGuide})},_addForm:function(e){var t="undefined"!==e.title?e.title:e.id,i=$(_.template(l[1],{image_icon:s.createThumbnailUrl(e.assetID),asset_id:e.id,defaultIcon:"file-icon-form",file_name:t,download:r.DownloadButton,send:r["RHP.Send.track"]})),n=$(_.template(l[2],{asset_id:e.id,file_name:t,form_name:t}));i.appendTo(this.$el.find(".faf-recent-thumbnails-row")),n.appendTo(this.$el.find(".faf-recent-filenames-row"));var o=i.find(".faf-preview-image"),a=i.find(".faf-placeholder-image");o.load(_.bind(function(e,t){t.removeClass("hide"),e.addClass("hide")},{},a,o))},_onFormThumbClick:function(e){if("keydown"===e.type&&32!==e.which)return!0;var t=$(e.currentTarget).closest(".faf-recent-file-container"),i=t.index(),n=$($(e.currentTarget).closest(".faf-recent-files").find(".faf-preview-name").get(i)),s={id:t.attr("data-asset-id"),name:n.attr("data-form-name")};this._triggerOpenFormEvent(s),e.preventDefault()},_onFormNameClick:function(e){if("keydown"===e.type&&32!==e.which)return!0;var t=$(e.currentTarget).closest(".faf-preview-name"),i=t.index(),n=$($(e.currentTarget).closest(".faf-recent-files").find(".faf-recent-file-container").get(i)),s={id:n.attr("data-asset-id"),name:t.attr("data-form-name")};this._triggerOpenFormEvent(s),e.preventDefault()},_triggerOpenFormEvent:function(e){if(e.id===this.SAMPLE_ID)this._triggerViewEvent(t.ViewEvents.FAF_CREATE_SAMPLE_FORM,this.options);else{var i=_.extend(this.options,{formID:e.id,showProgress:!0,backToFiles:!1,formName:e.name,formSource:"FillSignTab",formType:"ExistingForm",formOrigin:"AcomFile"});this._triggerViewEvent(t.ViewEvents.FAF_OPEN_FORM,i)}},_onViewAllClick:function(){_.defer(t.appApi.routerApi.navigate,"recent/created_by_client=fillsign",{trigger:!0})},_onDownloadClick:function(e){var i,s=!1,a={run:function(){return s||(s=!0,t.appApi.displayApi.showSpinner(!0),i=t.appApi.displayApi.showFullOverlay(!0),i.addClass("faf-organizer-overlay")),$.Deferred().resolve().promise()}},r={run:function(){return s&&(s=!1,t.appApi.displayApi.showSpinner(!1),t.appApi.displayApi.showFullOverlay(!1),i.removeClass("faf-organizer-overlay")),$.Deferred().resolve().promise()}},l=$(e.currentTarget).closest(".faf-recent-file-container").attr("data-asset-id"),d="SavePDF:0-DownloadClick";n.logEvent(d,d+":LP","");var f;a.run().then(function(){return $.ajax(o.getAjaxOptions("/form/"+l))},function(){return r.run()}).then(function(e){return f=0,e&&e.form&&e.form.pages&&_.each(e.form.pages,function(e){e.elements&&(f+=e.elements.length)}),0===f?r.run():$.Deferred().resolve().promise()}).then(_.bind(function(){this._triggerViewEvent(t.ViewEvents.FAF_DOWNLOAD_PDF,{opSource:"LP",formID:l,fieldCount:f,showStatusOp:a,hideStatusOp:r})},this))},_onSendClick:function(e){var i=$(e.currentTarget).closest(".faf-recent-file-container").attr("data-asset-id"),s="SaveToPDF:0-SendClick";n.logEvent(s,s+":LP","");var o="/send/file/"+i;t.appApi.routerApi.navigate(o,{trigger:!0})},_makeElementIntoDropzoneJS:function(e){require(["jquery.fileupload"],this._makeDz(e))},_makeDz:function(e){var t=$(e).find(".upload-controller");t.data("fileuploader",t.fileupload({add:function(){},replaceFileInput:!1,dropZone:t})),t.on("click",_.bind(function(e){this._dzMouseDown(e,t)},this))},_dzMouseDown:function(e,t){1===e.which&&(e.stopPropagation(),e.preventDefault(),this.options.selectFilesFromDialog=!0,this.options.fafAppLimitsModel.initialized().then(_.bind(function(){this._uploadStart(t)},this)))},_uploadStart:function(e){var i="FillSignTab:Upload:1-Started";n.logEvent(i,i,i+":SelectFiles");var s=this.options.fafAppLimitsModel;t.appApi.selectionApi.selectFiles(t.PLUGIN_ID,{dialog:{addSelectedButtonLabel:r.AddSelectedBtnLabel,singleFileSelection:!0},plugin:{filter:{extensions:s.supportedExtensions(),mimeTypes:s.supportedMimetypes(),queryLabel:r.FileFilterLabel,rejectedFilesCallback:this._rejectedSelectedFiles}}}).then(_.bind(function(t){this._uploadSelectedFiles(e,t)},this))},_uploadSelectedFiles:function(e,t){this.options.fafAppLimitsModel.initialized().then(_.bind(function(){this._uploadSelectedFilesEx(e,t)},this))},_uploadSelectedFilesEx:function(e,i){var s="FillSignTab:Upload:2-SelectedFiles",o=s,a=this.options.fafAppLimitsModel;if(i.localFiles&&i.localFiles.length>0){if(i.localFiles[0].size>a.get("max_file_size")){var r={code:"UnsupportedFileSize",fileSize:i.localFiles[0].size,fileType:i.localFiles[0].contentType};return void n.reportUploadError({},r)}o+=":LocalFile",n.logEvent(s,o,o,{fileType:i.localFiles[0].type}),t.opFactory.create("CreateAndOpenFormViaUploadOp",_.extend(this.options,{localFile:i.localFiles[0],backToFiles:!1,fileuploader:e.data("fileuploader")})).run()}else d.isIE9orBelow()&&i.localFileInputs&&i.localFileInputs.length>0?(o+=":LocalFile",n.logEvent(s,o,o,{fileType:"ie9orBelow/unknown"}),t.opFactory.create("CreateAndOpenFormViaUploadOp",_.extend(this.options,{localFile:i.localFileInputs[0],backToFiles:!1,fileuploader:i.localFileInputs[0].fileupload(),releaseFileInputCallback:i.releaseFileInputCallback})).run()):i.uploadedFileAttrs&&_.some(i.uploadedFileAttrs,_.bind(function(e,i){if(e.size>a.get("max_file_size")){var r={code:"UnsupportedFileSize",fileSize:e.size,fileType:e.contentType};return n.reportUploadError({},r),!0}return o+=":AcomFile",n.logEvent(s,o,o,{fileType:e.content_type}),t.opFactory.create("CreateAndOpenFormViaBhOp",_.extend(this.options,{assetID:i,backToFiles:!1,contentType:e.content_type,filename:e.name,parentID:e.parent_id})).run(),!0},this))},_rejectedSelectedFiles:function(e,t){var i,o,l,d="Form:Upload:Error",f=d+":UnsupportedFile";e.length>0?(i=e[0].name,o=e[0].size,l=e[0].type):(i=s.basename(t[0].val()),l="ie9orBelow/unknown",o=0);var c=r.UnsupportedFileTypeMsg,u={fileType:l,fileSize:o,errorCode:"UnsupportedFile",errorMessage:c};n.logEvent(null,d,f,u),a.showGenericDialog(c)},_onFocusIn:function(e){$(e.target).closest(".faf-preview-actions").addClass("is-focused")},_onFocusOut:function(e){$(e.target).closest(".faf-preview-actions").removeClass("is-focused")}}),t.FafOrganizerView}),define("fss/js/templates/faf-editor-view-template",[],function(){return'<div class="faf-edit-form-toolbarview-container faf-shown-with-form"></div><div class="faf-edit-form-form-container"><div class="faf-show-with-form-container"><div class="faf-form faf-shown-with-form theme-document-background"></div><div class="faf-edit-form-hudview-container faf-reader-hud"></div></div><div class="faf-userdataview-group faf-edit-form-userdataview-container-loading"><div class="faf-loading-message theme-text"><%= loadingRHP %></div></div><div class="faf-userdataview-group faf-edit-form-userdataview-container-connection-disconnected"><div class="faf-rhp-disconnected-message-container"><div class="faf-rhp-disconnected-message theme-text"><%= disconnectedMessage %></div><div class="faf-rhp-faf-disconnected-retry-btn control-button dialog-control-button theme-button theme-button-label"><%= disconnectedBtn %></div></div></div><div class="faf-userdataview-group faf-edit-form-userdataview-container"></div><a id="faf-fc-after-del-focus" href="#" tabindex="-1" /><div class="null"></div></div>'}),define("fss/js/templates/faf-toolbar-view-template",[],function(){return'<div class="faf-edit-form-toolbarview-header"><div class="full-preview-home-btn-wrapper faf-browser-content"><button id="faf-editor-back-button" class="full-preview-home-btn" data-test-name="full-preview-header-home-btn" title="<%= back %>"><span class="hidden-accessible"><%= back %></span></button><div role="separator" class="full-preview-home-btn-separator"></div></div><div class="faf-edit-toolbar-left-text faf-browser-content"><div class="faf-edit-form-title" role="heading" aria-level="1" ><%= fillsign %></div><div class="faf-toolbar-status-message" role="status" ></div></div><div id="faf-toolbar-button-container" class="faf-form-tools" role="toolbar"><button id="faf-form-tool-text" class="faf-toolbar-btn faf-toolbar-text" title="<%= text_tooltip %>" data-buttontype="text" gaq="LeftPanel:Tool:Select:text" style="background-position: -6px 0;"></button><button id="faf-form-tool-x" class="faf-toolbar-btn faf-toolbar-x" title="<%= x_tooltip %>" data-buttontype="x" gaq="LeftPanel:Tool:Select:x"></button><button id="faf-form-tool-check" class="faf-toolbar-btn faf-toolbar-check" title="<%= check_tooltip %>" data-buttontype="check" gaq="LeftPanel:Tool:Select:check"></button><button id="faf-form-tool-roundrect" class="faf-toolbar-btn faf-toolbar-roundrect" title="<%= roundrect_tooltip %>" data-buttontype="roundrect" gaq="LeftPanel:Tool:Select:roundrect"></button><button id="faf-form-tool-line" class="faf-toolbar-btn faf-toolbar-line" title="<%= line_tooltip %>" data-buttontype="line" gaq="LeftPanel:Tool:Select:line"></button><button id="faf-form-tool-dot" class="faf-toolbar-btn faf-toolbar-dot" title="<%= dot_tooltip %>" data-buttontype="dot" gaq="LeftPanel:Tool:Select:dot"></button><div class="faf-toolbar-div"><div role="separator" class="full-preview-home-btn-separator"></div></div><button id="faf-form-tool-sign" class="faf-file-tool-btn faf-sign" title="<%= sign_tooltip %>" data-buttontype="signature" gaq="LeftPanel:Tool:Select:sign" aria-haspopup="true" aria-label="<%= sign_label %>"> <div id="faf-form-tool-sign-inner" class="faf-toolbar-sign"></div> <span class="full-preview-download-btn-label"><%= sign_label %></span></button><div role="menu" class="faf-signature-menu core-menu-border"></div></div><div class="faf-signature-menu-container ui-theme theme-container"></div><div class="faf-file-tools faf-browser-content"> <button class="faf-file-tool-btn faf-print" title="<%= print_tooltip %>" aria-label="<%= print_label %>"><div class="core-print-icon faf-toolbar-print"></div><span class="full-preview-download-btn-label"><%= print_label %></span></button><button class="faf-file-tool-btn faf-dwnld" aria-haspopup="true" aria-label="<%= download_label %>"><div class="core-download-icon faf-toolbar-dwnld"></div><span class="full-preview-download-btn-label"><%= download_label %></span></button> </div></div><div role="menu" class="faf-download-pdf-menu core-menu-border"></div>'}),define("fss/js/templates/faf-download-pdf-menu-template",[],function(){return'<div role="menuitem" tabindex="0" class="faf-download-pdf-menu-item no-select"     data-op="download"     data-site-catalyst="DownloadAsPDF">     <%= downloadAsPDF %></div><div role="menuitem" tabindex="0" class="faf-download-pdf-menu-item no-select"     data-op="save"    data-site-catalyst="SaveToFiles">    <%= saveToFiles %></div><div role="presentation" class="faf-download-pdf-menu-nub menu-nub-grey"></div>'}),define("fss/js/views/faf-download-pdf-menu-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/faf-download-pdf-menu-template","i18n!fss/js/nls/ui-strings","core/views/menu-view"],function(e,t,i,n){return t.FafDownloadPDFMenuView=e.MenuView.extend({events:{"click .faf-download-pdf-menu-item":"_onMenuItemClick"},initialize:function(){e.MenuView.prototype.initialize.call(this),this._template=_.template(i)},render:function(){e.MenuView.prototype.render.call(this);var t=n.ToolBarDownloadToFiles,i=this.options.fafEditorUiModel.getFormSourceType(),s=this.options.appApi.connectorsApi.getConnectorsUiHelpers(i);return s&&s.label&&(t=_.template(n.ToolBarDownloadToCloud,{cloudName:s.label})),this.$el.html(this._template({downloadAsPDF:n.ToolBarDownloadToComputer,saveToFiles:t})),this},_onMenuItemClick:function(e){var i=$(e.target);this.close(),this._triggerViewEvent(t.ViewEvents.SELECT_DOWNLOAD_PDF_MENU_ITEM,{downloadMenuItemOp:i.attr("data-op"),downloadMenuItemSiteCatalyst:i.attr("data-site-catalyst")})}}),t.FafDownloadPDFMenuView}),define("fss/js/templates/esign/faf-signature-menu-template",[],function(){return['<div role="menuitem" tabindex="-1" class="faf-signature-menu-list faf-signature-list"><div role="presentation" class="faf-signature-menu-item no-select faf-signature-menu-signature" data-type="signature" data-title-temp="">     <%= addSign %>     <div role="presentation" class="faf-signature-add-icon theme-hyperlink"></div></div></div><div role="menuitem" tabindex="-1" class="faf-signature-menu-list faf-initials-list"><div role="presentation" class="faf-signature-menu-item no-select faf-signature-menu-initials " data-type="initials" data-title-temp="">    <%= addInit %>    <div role="presentation" class="faf-signature-add-icon theme-hyperlink"></div></div></div><div role="presentation" class="faf-signature-menu-nub menu-nub-grey"></div>','<div role="presentation" class="faf-signature-list-item"><div class="faf-signature-grabber-block faf-custom-tool-tip" data-title-temp=""></div><button class="faf-signature-list-remove-icon faf-custom-tool-tip" data-title-temp="<%= delSign %>" aria-label="<%= delSign %>"></button></div>']}),define("fss/js/views/esign/faf-signature-menu-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-api-util","fss/js/templates/esign/faf-signature-menu-template","i18n!fss/js/nls/ui-strings","fss/js/lib/formcanvas","fss/js/lib/utilUI","fss/js/lib/fafa","fss/js/data/fafconstants","fss/js/views/form-field/faf-field-annotation-view","core/views/menu-view"],function(e,t,i,n,s,o,a,r,l,d,f,c){return t.FafSignatureMenuView=e.MenuView.extend({events:{"click .faf-signature-menu-item":"_onMenuItemClick","click .faf-signature-list-remove-icon":"_onRemoveIconClick","click .faf-signature-grabber-block":"_onSignatureClick","touchstart .faf-signature-grabber-block":"_onSignatureTouchStart","pointerdown .faf-signature-grabber-block":"_onSignatureTouchStart","mouseover .faf-signature-menu-list":"_onMenuItemMouseOver"},initialize:function(){e.MenuView.prototype.initialize.call(this),this._isRendered=!1,this._isPopulated=!1,this._menuTemplate=_.template(o[0]),this._itemTemplate=_.template(o[1]),this.options.fafUserDataModel.on("change:add_signature",_.bind(function(e){this._onAddSignature(e)},this)),this.options.fafUserDataModel.on("change:remove_signature",_.bind(function(e){this._onRemoveSignature(e)},this)),this.options.fafUserDataModel.on("change:profiles",_.bind(function(){this._onProfilesChanged()},this)),this.options.fafEditorUiModel.on("change:signature_button_position",_.bind(function(){this._onPositionChanged()},this)),_.bindAll(this,"_escToMenu"),n.isDesktop()&&(_.bindAll(this,"_onSignUpdate","_onDismissSignDlg"),t.Reader.readerEventListenerOp.listenForReaderEvent("custom:SignUpdate",this._onSignUpdate),t.Reader.readerEventListenerOp.listenForReaderEvent("custom:DismissSignDlg",this._onDismissSignDlg))},render:function(){return this._isRendered?void 0:(this._isRendered=!0,this.$el.html(this._menuTemplate({addSign:a.ToolBarAddSign,addInit:a.ToolBarAddInitials,toolBarAddSign:a.ToolBarAddSign,toolBarAddInitials:a.ToolBarAddInitials})),e.MenuView.prototype.render.call(this),this._isPopulated||this._addLocalSignatures(),this)},_initWrappers:function(){this.$signatureList=$(".faf-signature-list"),this.$initialsList=$(".faf-initials-list"),this.$addSignature=$(".faf-signature-menu-signature"),this.$addInitials=$(".faf-signature-menu-initials"),this.$toolbar=$(".faf-form-tools"),this.options.fafUserDataModel.getUserDataModelPromise().then(_.bind(this._addSignatures,this)),this.$titleDivs=this.$el.find(".faf-custom-tool-tip,.faf-signature-menu-item"),this.$titleDivs.hover(i.handleTitleDivHoverIn,i.handleTitleDivHoverOut),t.appApi.windowApi.addWindowResizeCallback(this._hideGuide)},open:function(){this._hideGuide(),this._adjustAddMenuItems(),this._setLeftMargin();var i=$(".faf-signature-menu-container"),s=i.is(":visible");return s&&(t.appApi.displayApi.showSpinner(!1),i.hide()),n.onExternalEsc(this._escToMenu),e.MenuView.prototype.open.call(this)},close:function(t,i){n.offExternalEsc(this._escToMenu),e.MenuView.prototype.close.call(this,t,_.extend({},i,{doNotEmpty:!0}))},_hideGuide:function(){this._guideShown&&l.hideGuide()},_escToMenu:function(){this.close()},_onProfilesChanged:function(){this.options.fafEditorUiModel.get("show_signature_menu")&&this.close(),this._isPopulated=!1,this._addSignatures()},_addSignatures:function(){var e=this.options.fafUserDataModel,t=e.getProfile("default"),n=0;if(!this._isPopulated){if(!_.isObject(t)){if(n++,!(3>n))return void i.logError("faf-signature-menu","Unable to populate global signatures");
_.defer(this._addSignatures)}this._isPopulated=!0;var s=e.signatureData,o=e.getObject("signature");o&&o.value.length>0?s.getAllDataFromServer(o.value).then(_.bind(function(){this.interimLocalSignatureDataCopy=void 0;var e=!1,t=!1;if(this.$signatureList.find(".faf-signature-list-item")||this.$initialsList.find(".faf-signature-list-item")){var i,n=this.$signatureList.find("canvas");for(i=0;i<n.length;i++){var o=$(n[i]);_.each(s.vals,_.bind(function(t,i){if("signature"===t.type){var n=this.options.fafUserDataModel,a=n.signatureData&&n.signatureData.getSignature(i),r=s.getImgHash(a.pngData).toUpperCase(),l=s.getImgHash(t.pngData).toUpperCase();r===l&&(e=!0,o.data("data-field-id",i))}},this))}for(n=this.$initialsList.find("canvas"),i=0;i<n.length;i++){var o=$(n[i]);_.each(s.vals,_.bind(function(e,i){if("initials"===e.type){var n=this.options.fafUserDataModel,a=n.signatureData&&n.signatureData.getSignature(i),r=s.getImgHash(a.pngData).toUpperCase(),l=s.getImgHash(e.pngData).toUpperCase();r===l&&(t=!0,o.data("data-field-id",i))}},this))}}_.each(s.vals,_.bind(function(i,n){"signature"===i.type&&e===!1&&(this.$signatureList.find(".faf-signature-list-item").remove(),this.$addSignature.show(),this._onAddSignature(n,!0)),"initials"===i.type&&t===!1&&(this.$initialsList.find(".faf-signature-list-item").remove(),this.$addInitials.show(),this._onAddSignature(n,!0))},this))},this)).fail(function(){i.logError("faf-signature-menu","Unable to retrieve global signatures")}).always(function(){_.each(s.rejected,function(t,i){e.removeSignature(i)})}):this._adjustAddMenuItems()}},_addLocalSignatures:function(){var e=this.options.fafUserDataModel,t=e.signatureData;s.getGlobalSignatures().then(_.bind(function(n){this.$signatureList.find(".faf-signature-list-item").remove(),this.$addSignature.show(),this.$initialsList.find(".faf-signature-list-item").remove(),this.$addInitials.show(),n&&n.length>0?t.getAllDataFromServer(n,!0).then(_.bind(function(){this.interimLocalSignatureDataCopy=_(t).clone(),this.$signatureList.find(".faf-signature-list-item").remove(),this.$addSignature.show(),this.$initialsList.find(".faf-signature-list-item").remove(),this.$addInitials.show(),_.each(Object.keys(t.vals),_.bind(function(e){this._onAddSignature(e,!0),this.options.fafEditorUiModel.set("show_signature_menu",!0)},this))},this)).fail(function(){i.logError("faf-signature-menu","Unable to retrieve global signatures")}).always(function(){_.each(t.rejected,function(t,i){e.removeSignature(i)})}):this._adjustAddMenuItems()},this))},_onAddSignature:function(e){var t=this.options.fafUserDataModel,i=t.signatureData&&t.signatureData.getSignature(e);if(i&&i.pngData&&i.type&&i.kind&&i.imageSize){var n=i.imageSize,s={width:174,height:50},o={imageType:i.type,imageData:i.pngData,canvasSize:s,imageSize:$.extend({width:786,height:300},n),ignoreDevicePixelRatio:!1,callback:_.bind(function(t){if(t){t.data("data-field-id",e),t.data("data-field-type",i.type);var n=$(this._itemTemplate({delSign:a.Delete}));n.find(".faf-signature-grabber-block").append(t),"signature"===i.type?(this.$signatureList.append(n),this.$addSignature.hide()):(this.$initialsList.append(n),this.$addInitials.hide()),this._enableDrag(n,i,o),this.$titleDivs=this.$el.find(".faf-custom-tool-tip,.faf-signature-menu-item"),this._adjustAddMenuItems()}},this)};o.canvasSize.width=Math.max(Math.min(450,o.canvasSize.width),150),o.canvasSize.height=Math.min(50,o.canvasSize.height),r.createCanvas(o)}},_sigButtonMiddleH:function(){var e=this.options.fafEditorUiModel.get("signature_button_position");return e?(e.left+e.right)/2:0},_onPositionChanged:function(){this.options.fafEditorUiModel.get("show_signature_menu")&&this._setLeftMargin()},_setLeftMargin:function(){var e=this._sigButtonMiddleH(),t=this.$toolbar.offset().left,i=this.$el,n=i.outerWidth(),s=e-t-n/2,o=$(".faf-signature-menu-nub",i),a=-(o.outerHeight()+1)+"px",r=n-e+s-o.outerWidth()/2+10+"px";o.css({right:r,top:a}),i.css("margin-left",s+"px")},_showGuideAfterSigAdded:function(e){if(!this.options.fafEditorUiModel.get("show_signature_menu")){var t=this._sigButtonMiddleH(),i=t-120,s=100,o=$(window).width()-(i+210);0>o&&(i-=o,s+=o),this._guideShown=!0,l.showGuide({preference:n.getFafPrefsInfo().ToolBarSignatureSaved,parent:$(".faf-edit-form-toolbarview-header"),top:n.isDesktop()?-4:44,left:i,width:200,arrow:"up",arrowPosition:s,text:"signature"===e?a.ToolBarSignatureSaved:a.ToolBarInitialsSaved,removeFunc:_.bind(function(){this._guideShown=!1},this)})}},_enableDrag:function(e,n,s){var o=e.find(".faf-signature-grabber-block");o.draggable({cursor:"pointer",appendTo:".faf-edit-form-form-container",containment:".faf-form-view",cursorAt:{top:5,left:5},helper:_.bind(function(){var e=$('<div style="position:absolute"></div>');e.data("data-signature",n);var o=n.imageSize,a=t._formManager.getPageScale();return s.callback=function(t){e.append(t)},s.canvasSize=i.getCanvasSize(n,o.height/o.width),s.canvasSize.width*=a,s.canvasSize.height*=a,r.createCanvas(s),e},this),start:_.bind(function(e,t){this.close(),this._isDragging=!0,this.options.fafEditorUiModel.set("faf_hud_hide_override",!0);var i=t.helper.data("data-signature"),n="Place:Sign:0-ExistSignSelect",s=n+":"+d.gaNameFromSigType(i.type)+":"+d.gaNameFromSigKind(i.kind);this._logEvent(n,n,s)},this),stop:_.bind(function(e,n){var s=n.helper.data("data-signature");if(this._isDragging=!1,this.options.fafEditorUiModel.set("faf_hud_hide_override",!1),i.isTapping(e.originalEvent))return void this._placeSignatureNow(s);var o=n.helper.find("canvas"),a=o.position(),r=$(".faf-form-page").eq(this.options.fafEditorUiModel.get("current_page")),l=r.position(),f=$(".faf-form-view").position();if(l){var u={top:n.position.top+a.top-l.top-f.top,left:n.position.left+a.left-l.left-f.left},h=s.imageSize,p=i.getCanvasSize(s,h.height/h.width),g="Place:Sign:1-ExistSignPlace",_=g+":"+d.gaNameFromSigKind(s.kind)+":"+d.gaNameFromSigType(s.type),m=d.gaNameFromSigType(s.type)+":"+d.gaNameFromSigKind(s.kind);t._fafFormView.okToAddField("SignMenu",m,e)&&(c.prototype.createAnnotationImageFieldAt(s,u,p),this._logEvent(g,g,_))}},this)}),i.handleTouchEventAsMouseEvent(o)},_placeSignatureNow:function(e,n){var s,o,a,r=$(".faf-form-page").eq(this.options.fafEditorUiModel.get("current_page")),l=r.find(".faf-form-image"),f=r.closest(".faf-form"),u=e.imageSize,h=i.getCanvasSize(e,u.height/u.width),p=Math.min(f.height(),l.height())/2,g=Math.min(f.width(),l.width())/2,_=t._formManager.getPageScale(),m={top:f.scrollTop()+p-h.height*_/2,left:f.scrollLeft()+g-h.width*_/2};if(n){var v=t._fafFormView.options.fafUserDataModel,S=v.getObject("signature"),E=S&&S.value.length>0?"RU":"NU";s="Create:Sign:"+E+":4-SignPlaced",o=s+":"+d.gaNameFromSigKind(e.kind),a=o+":"+d.gaNameFromSigType(e.type)}else s=o="Place:Sign:1-ExistSignPlace",a=o+":"+d.gaNameFromSigType(e.type)+":"+d.gaNameFromSigKind(e.kind);var b=d.gaNameFromSigType(e.type)+":"+d.gaNameFromSigKind(e.kind),w={pageX:m.left,pageY:m.top};t._fafFormView.okToAddField("Sign",b,w)&&(c.prototype.createAnnotationImageFieldAt(e,m,h),this._logEvent(s,o,a))},_onSignatureTouchStart:function(e){i.isIEPointerNotTouchEvent(e)||(this._touchStartTime=(new Date).getTime())},_sigObjOfEvent:function(e){var t=$(e.currentTarget),i=t.find("canvas").data("data-field-id"),n=this.options.fafUserDataModel.signatureData,s=n.getSignature(i);return!s&&this.interimLocalSignatureDataCopy&&(s=this.interimLocalSignatureDataCopy.getSignature(i)),s},_onSignatureClick:function(e){if(!this._isDragging){this.close();var i=this._sigObjOfEvent(e),n="Place:Sign:0-ExistSignSelect",s=n+":"+d.gaNameFromSigType(i.type)+":"+d.gaNameFromSigKind(i.kind);return this._logEvent(n,n,s),this._touchStartTime&&(new Date).getTime()-this._touchStartTime<500?void this._placeSignatureNow(i):void t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_START_DRAG,{fieldId:null,signature:i,lastEvt:e,existing:!0,addToGlobal:!1})}},_adjustAddMenuItems:function(){var e=this.$signatureList.find("canvas"),t=this.$initialsList.find("canvas");e.length>0?this.$addSignature.hide():this.$addSignature.show(),t.length>0?this.$addInitials.hide():this.$addInitials.show(),this._setLeftMargin()},_onRemoveSignature:function(e){function t(e,t){var i;for(i=0;i<t.length;i++){var n=$(t[i]);if(n.data("data-field-id")===e){var s=n.closest(".faf-signature-list-item");return s.remove(),!0}}return!1}t(e,this.$signatureList.find("canvas"))||t(e,this.$initialsList.find("canvas")),this._adjustAddMenuItems()},_onRemoveIconClick:function(e){if(!this.removeInProgress){this.removeInProgress=!0;var t=$(e.target),i=t.closest(".faf-signature-list-item"),n=i.find("canvas"),s=n.data("data-field-id");if(!s)return void(this.removeInProgress=!1);i.closest(":focusable").focus();var o=this.options.fafUserDataModel.signatureData,a=o.getSignature(s);if(void 0===a)return void(this.removeInProgress=!1);var r="Create:Sign:ExistingDelete",l=r+":"+d.gaNameFromSigType(a.type)+":"+d.gaNameFromSigKind(a.kind);this._logEvent(null,r,l);var f=this.options.fafUserDataModel;f.removeSignature(s).always(_.bind(function(){this.removeInProgress=!1},this))}},_onMenuItemClick:function(e){var i,n=$(e.currentTarget),s=n.attr("data-type");this.close(),i={fieldID:null,sigType:s,doneFunc:_.bind(function(e){"OK"===e.why&&(e.tapped?this._placeSignatureNow(e.signature,!0):t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_START_DRAG,{fieldId:s,signature:e.signature,lastEvt:e.lastEvt,existing:!1,addToGlobal:e.addToGlobal}))},this)},t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_SHOW_POPUP,i)},_onMenuItemMouseOver:function(e){0===$(document.activeElement).closest(e.currentTarget).length&&$(e.currentTarget).focus()},_onKeyDown:function(t){var i,s=t.which,o=$(t.target);return 27===s&&n.isDesktop()?!0:13!==s&&32!==s||!o.is(".faf-signature-menu-list")?e.MenuView.prototype._onKeyDown.call(this,t):(i=o.find(".faf-signature-menu-item").filter(":visible"),0===i.length&&(i=o.find(".faf-signature-grabber-block").filter(":visible")),i.click(),t.preventDefault(),t.stopImmediatePropagation(),!1)},_logEvent:function(e,t,i){d.logEvent(e,t,i)},_onDismissSignDlg:function(){this.close()},_onSignUpdate:function(e){var n=this.options,s=t.Reader.fafReaderNativeSignatureUIModel,o=$.Deferred();s.set("signUpdatePromise",o.promise());var a=!1,r="signature";e&&(0===e.IsSign&&(r="initials"),a=!!e.IsSync),t.Reader.opFactory.create("GetDesktopSignaturesOp",_.extend({sigType:r},n)).run().then(function(e){return n.fafUserDataModel.replaceSignatures(e)}).then(_.bind(function(){o.resolve(),a&&this._tellReader("signMenu",[{action:"show"}])},this)).fail(function(e){i.logError("FafReaderSignatureMenuView","signUpdate failed, err="+e),o.reject()}).always(function(){s.unset("signUpdatePromise")})}}),t.FafSignatureMenuView}),define("fss/js/views/reader/faf-reader-signature-menu-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-api-caller","fss/js/views/esign/faf-signature-menu-view"],function(e,t,i,n,s){return t.Reader.FafReaderSignatureMenuView=t.FafSignatureMenuView.extend({initialize:function(){t.FafSignatureMenuView.prototype.initialize.call(this),this.events=_.extend(this.events,{"mousedown .faf-signature-grabber-block":this._onSignatureClick,"touchstart .faf-signature-grabber-block":this._onSignatureClick}),_.bindAll(this,"_onWindowHidden"),t.Reader.readerEventListenerOp.listenForReaderEvent("custom:WindowHidden",this._onWindowHidden)},_isClickOutsideMenu:function(){},_setLeftMargin:function(){},_enableDrag:function(){},_placeSignatureNow:function(){this._onSignatureClick()},_onWindowHidden:function(){this.close()},_onSignatureClick:function(e){var i=t.Reader.fafReaderNativeSignatureUIModel;if(!i.get("sigClicked")){var n=this._sigObjOfEvent(e);n&&(this._tellReader("signMenu",[{action:"place",type:n.type}]),i.set("sigClicked",!0))}},_onMenuItemClick:function(e){var t=$(e.currentTarget),i=t.attr("data-type");this._tellReader("signMenu",[{action:"create",type:i}])},_adjustAddMenuItems:function(){t.FafSignatureMenuView.prototype._adjustAddMenuItems.call(this),_.defer(_.bind(function(){var t,i=225,n=this.$el.find("canvas").length;e.Util.isWindows()?t=114+24*n:(i+=16,t=126+20*n),this._setContainerSize(i,t,{scale:!0})},this))},close:function(){return this._isMenuOpen=!1,this._openDefer&&(this._openDefer.resolve(),delete this._openDefer),this},open:function(e){return this._didOpen?this._isMenuOpen=!0:(this._didOpen=!0,t.FafSignatureMenuView.prototype.open.call(this,e)),this._openDefer=$.Deferred(),this._openDefer.promise()}}),s.mixin(t.Reader.FafReaderSignatureMenuView),t.Reader.FafReaderSignatureMenuView}),define("fss/js/views/faf-toolbar-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/data/reader/faf-reader-constants","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/faf-common-api-util","fss/js/lib/utilUI","fss/js/lib/fafa","fss/js/templates/faf-toolbar-view-template","i18n!fss/js/nls/ui-strings","plugins-common/ac-plugins","fss/js/views/faf-download-pdf-menu-view","fss/js/views/esign/faf-signature-menu-view","fss/js/views/reader/faf-reader-signature-menu-view"],function(e,t,i,n,s,o,a,r,l,d,f,c){return t.FafToolbarView=e.View.extend({events:{"click   .faf-toolbar-btn":"_onButtonClick","click   #faf-editor-back-button":"_onBackButtonClick","click   .faf-dwnld":"_onDownloadClick","click   .faf-print":"_onPrintClick","click   #faf-form-tool-sign":"_onSignatureClick","keydown .faf-dwnld":"_onDownloadKeyDown","keydown #faf-form-tool-sign":"_onSignatureKeyDown"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(d)},_initWrappers:function(){this.$downloadPDFMenuButton=this.$(".faf-dwnld"),this.$downloadPDFMenu=this.$(".faf-download-pdf-menu"),this.$signatureMenuButton=this.$("#faf-form-tool-sign"),this.$signatureMenu=this.$(".faf-signature-menu"),this._addUiModelEventListeners()},_addUiModelEventListeners:function(){var e=this.options.fafEditorUiModel;e.on("change:tool",this._onToolChange),e.on("change:show_download_pdf_menu",this._onShowDownloadPDFMenuChange),e.on("change:show_signature_menu",this._onShowSignatureMenuChange),o.isDesktop()||_.defer(function(){t._app.addListener(i.APP_SAVE_DATA,_.bind(this._updateStatusMessage,this))}.bind(this)),$(window).resize(_.bind(function(){this._putSigButtonPosition()},this)),_.bindAll(this,"_signinChange");var n=this.options.fafSigninStateModel;this.listenTo(n,"change:"+n.STATE,this._signinChange)},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({text_tooltip:f.ToolBarTextTooltip,x_tooltip:f.ToolBarCrossTooltip,check_tooltip:f.ToolBarCheckTooltip,roundrect_tooltip:f.ToolBarRoundRectTooltip,line_tooltip:f.ToolBarLineTooltip,dot_tooltip:f.ToolBarDotTooltip,sign_tooltip:f.ToolBarSignTooltip,fillsign:f.ToolBarFillSign,sign_label:f.ToolBarSign,print_label:f.ToolBarPrint,print_tooltip:f.ToolBarPrintTooltip,download_label:f.ToolBarDownload,back:f.BACK})),this._initWrappers()),_.defer(_.bind(function(){this._renderChildViews(),this._putSigButtonPosition()},this)),this._renderToolSelection(this.options.fafEditorUiModel.get("tool"))},_putSigButtonPosition:function(){a.getToolbarButtonPosition(n.TOOL_SIGN).then(_.bind(function(e){if(0!==e.left){var t=this.options.fafEditorUiModel;t.set("signature_button_position",e),t.trigger("change:signature_button_position")}},this))},_renderChildViews:function(){this._renderDownloadPDFView(),this._renderSignatureMenuView()},_renderSignatureMenuView:function(){this._renderChildView("_signatureMenuView","sign_menu"===o.desktopNativeSignCommand()?t.Reader.FafReaderSignatureMenuView:t.FafSignatureMenuView,this.$signatureMenu,_.extend(this.options,{keyUiModel:this.options.appApi.options.keyUiModel,menusUiModel:this.options.appApi.options.menusUiModel}))},_renderDownloadPDFView:function(){this._renderChildView("_downloadPDFMenuView",t.FafDownloadPDFMenuView,this.$downloadPDFMenu,{keyUiModel:this.options.appApi.options.keyUiModel,menusUiModel:this.options.appApi.options.menusUiModel})},_onResize:function(){},_onButtonClick:function(e){var i=$(e.target),n=i.attr("data-buttontype");t.opFactory.create("SwitchingToToolOp",_.extend({toolName:n},this.options)).run()},_onBackButtonClick:function(){var e=this.options.fafEditorUiModel;t._formManager.willFlushForm().then(_.bind(function(){t._flushAllDirty({closing:!0}).done(function(){t._formManager.closeForm(),l.logEvent("Form:Closed","Form:Closed:BackButton:Clicked","Form:Closed:BackButton:Clicked"),t.appApi.routerApi.navigate(t.PLUGIN_ID),e.get("back_to_files")?(s.logInfo("faf-toolbar-view","switching back to Files"),e.set("back_to_files",!1),t.appApi.pluginsApi.selectPlugin(c.HOME)):(s.logInfo("faf-toolbar-view","switching back to MyForms"),t._fafMain.dtfSwitchView("MyForms"))})},this))},_onToolChange:function(e,t){this._renderToolSelection(t)},_onShowDownloadPDFMenuChange:function(e,t){var i,n=this._downloadPDFMenuView;t?(i=this.options.fafEditorUiModel,n.open().always(function(){i.set("show_download_pdf_menu",!1,{silent:!0}),i.set("show_download_pdf_menu",!1,{silent:!0})})):n.close()},_onShowSignatureMenuChange:function(e,t){var i,n=this._signatureMenuView;t?(this._putSigButtonPosition(),i=this.options.fafEditorUiModel,n.open().always(function(){i.set("show_signature_menu",!1,{silent:!0})})):n.close()},_onPrintClick:function(){this._triggerGeneratePDFViewEvent(t.ViewEvents.FAF_PRINT_PDF)},_onDownloadClick:function(){t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_EMIT_OUTPUT_EVENT,{actionBody:"SavePDF:0-DownloadClick:FSTab",labelSuffix:null,categoryOverride:"",fieldCount:this.options.fafEditorUiModel.fieldCount()}),this._triggerViewEvent(t.ViewEvents.FAF_DOWNLOAD_PDF_CLICK)},_onDownloadKeyDown:function(e){40===e.which&&(e.preventDefault(),this._onDownloadClick())},_onSignatureClick:function(){this._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_CLICK)},_onSignatureKeyDown:function(e){40===e.which&&(e.preventDefault(),this._onSignatureClick())},_onSelectDownloadPDFMenuItem:function(e){this._triggerGeneratePDFViewEvent("download"===e.op?t.ViewEvents.FAF_DOWNLOAD_PDF:t.ViewEvents.FAF_SAVE_PDF)},_onViewEvent:function(e,i){var n;e===t.ViewEvents.SELECT_DOWNLOAD_PDF_MENU_ITEM&&(n={op:i.downloadMenuItemOp,siteCatalyst:i.downloadMenuItemSiteCatalyst},this._onSelectDownloadPDFMenuItem(n))},_triggerGeneratePDFViewEvent:function(e){this._triggerViewEvent(e,{formID:this.options.fafEditorUiModel.get("form_id"),fieldCount:this.options.fafEditorUiModel.fieldCount(),showStatusOp:t.opFactory.create("ShowingProgressStatusOp",_.extend({},this.options,{message:f.GeneratingPDF})),hideStatusOp:t.opFactory.create("HidingStatusOp",this.options),formHasFields:this.options.fafEditorUiModel.fieldCount()>0})},_renderToolSelection:function(e){var t=this.$(".faf-form-tools").find('[data-buttontype="'+e+'"]');if("Firefox"===s.browserAndVersion()[0]){this.$(".faf-form-tools .faf-toolbar-btn").css({"background-position":"",opacity:""}).removeClass("selected");var i=t.css("background-position");i&&(t.addClass("selected"),t.css("background-position",i.split(" ")[0]+" -55px"),t.css("opacity","1"))}else this.$(".faf-form-tools .faf-toolbar-btn").not(".faf-toolbar-div").css("background-position-y","-5px").removeClass("selected"),t.addClass("selected"),t.css("background-position-y","-55px"),t.css("opacity","1")},_updateStatusMessage:function(e){function t(e){e.text(""),this.$el.removeClass(n),this.saveMessageState="none"}var i=this.$el.find(".faf-toolbar-status-message"),n="faf-showing-status";if(this.$el.removeClass(n),this.saveMessageTimeout&&(clearTimeout(this.saveMessageTimeout),this.saveMessageTimeout=null),e.done)e.fail||"save"!==this.saveMessageState?t.call(this,i):(i.text(f.ToolBarSavedDataMessage),this.$el.addClass(n),this.saveMessageTimeout=setTimeout(_.bind(function(){t.call(this,i),this.saveMessageTimeout=null},this),5e3),this.saveMessageState="done");else if("save"!==this.saveMessageState){i.text(f.ToolBarSavingDataMessage),this.$el.addClass(n),this.saveMessageState="save";var s=this.$el.find(".faf-toolbar-status-message"),o=s.position();r.showGuide({preference:"user.toolBarSavingGuide",parent:this.$el.find(".faf-edit-form-toolbarview-header"),top:o.top+s.outerHeight(),left:o.left,arrow:"up",arrowPosition:25,text:_.template(f.ToolBarSavingGuide,{fileName:this.options.fafEditorUiModel.get("form_name")}),duration:6e3})}},_signinChange:function(e,t){t===this.options.fafSigninStateModel.state.SIGNED_IN&&(o.desktopNativeSignCommand()||o.runSignatureSyncOp(this.options,!0))}}),t.FafToolbarView}),define("fss/js/templates/faf-form-view-template",[],function(){return'<div id="faf-field-tool-bar" class="faf-field-tool-bar"><div class="fullSize"><div class="faf-field-focus-tool-btn"><span class="faf-field-focus-reduce-size"></span></div><div class="faf-field-focus-tool-btn"><span class="faf-field-focus-increase-size"></span></div><div class="faf-field-focus-tool-btn faf-field-focus-text-only"><span class="faf-field-focus-comb"></span></div><div class="faf-field-focus-tool-btn"><span class="faf-field-focus-trash"></span></div></div></div><div id="faf-focusbox-template" class="faf-focusbox-outline"><div class="grabber full-grabber"><div class="faf-grabber-xd faf-grabber-xd-position"><div class="faf-grabber-block"></div></div></div><div class="faf-greeking"></div></div><div class="faf-form-view"></div>'}),define("fss/js/views/form-field/toolbar/faf-field-toolbar-text-view",["fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/utilUI","fss/js/lib/fafa","fss/js/views/form-field/toolbar/faf-field-toolbar-view"],function(e,t,i,n,s,o){return e.FafFieldToolbarTextView=o.extend({initialize:function(e){o.prototype.initialize.call(this,e),e.fafApp.addListener(t.WIDTH_AUTOCHANGE,_.bind(function(){this._addOrAdjustCombGrid()},this)),e.fafApp.addListener(t.MOVE_RESIZE_FIELD,_.bind(function(e){0!==e.diff.width&&this._addOrAdjustCombGrid()},this))},events:_.extend({"click   .faf-field-focus-comb":"_onClickComb"},o.prototype.events),_onClickComb:function(){this.formField.switchComb(),this.setResizable(),this._setCombStyle(),this.positionFocusDiv()},_initWrappers:function(){o.prototype._initWrappers.call(this),this.$combButton=this.$focusDiv.find(".faf-field-focus-comb"),this.$focusDiv.addClass("faf-textfield-tool-bar"),this._fieldSwitchMenuView.on("switch:fieldType",this._onSwitchField)},_onSwitchField:function(e){this.$focusDiv.removeClass("faf-show-switch-menu");var t=this.formField.getFormElement().isComb;"sign"===e?(t&&this._onClickComb(),this._setStyleForFieldSwitch(e),this.formField.convertToSignatureField()):(this.formField.removeSignatureFieldStyles(),("comb"===e&&!t||"text"===e&&t)&&this._onClickComb(),this._setStyleForFieldSwitch(e))},_setStyleForFieldSwitch:function(e){this.$focusDiv.removeClass(function(e,t){return(t.match(/\bfaf-field-current-\S+/g)||[]).join(" ")});var t=this.formField.getFormElement().isComb;this.$focusDiv.addClass("sign"===e?"faf-field-current-sign":t?"faf-field-current-comb":"faf-field-current-text")},trackDeleteButtonClick:function(e){var t=$(this.formField.input),i=e+":Text",n=s.addEmptiness(i,t);s.logEvent(e,i,n,{$idDiv:this.formField.$fieldDiv})},_setCombStyle:function(){this._addOrAdjustCombGrid()},_addOrAdjustCombGrid:function(){if(this.formField){var e=$(this.formField.input),t=e.parent();if(t.find(".faf-focusbox-comb-grid").remove(),this.formField.getFormElement().isComb){var n=e.val()||i.placeholderText(e),s=n.length;if(s>0){var o=n.split(/\r\n|\r|\n/),a=0;_.each(o,function(e){a=Math.max(e.length,a)});var r=i.cssNumTotal(e,"letterSpacing"),l=i.charWidth(e)+r,d=e.offset().left-t.offset().left+i.cssNumTotal(e,"padding-left"),f=d-r/2;a=Math.min(a,Math.floor(t.width()/l));for(var c=0;a>=c;c++){var u=$('<div class="faf-focusbox-comb-grid"></div>');u.css("left",""+(f+l*c)+"px"),t.prepend(u)}}}}},attach:function(e){var t=$(e.input);o.prototype.attach.call(this,e,Boolean(t.data("formFocusFadeIn")));var i=$(this.formField.input).hasClass("faf-field-with-invisible-caret")?"sign":"";this._setStyleForFieldSwitch(i),this._adjustFieldWidth(e),this._setCombStyle(),this.origValue=t.val(),this.origName=t.attr("name"),this.options.fafAutocompleteStateModel.getState().then(_.bind(function(i){e===this.formField&&0!==i.ac_s&&t.autocomplete("enable")},this))},changeFontClicked:function(t){var n=$(this.formField.input),o=e._formManager.getPageScale(),a=i.fontSizeOfElement(n),r=n.data("actualFontSize")||a/o,l=i.nearestLegalFontSize(r+"px",t?1:-1);l>=6&&200>=l&&(n.data("actualFontSize",l),this.formField.fontSizeChanged({oldSize:r,newSize:l})),this.positionFocusDiv();var d="Field:Change:Size",f=t?":Up":":Down",c=d+f+":Text",u=s.addEmptiness(c,n);s.logEvent(d,c,u,{$idDiv:this.formField.$fieldDiv})},detach:function(t,n){if(this&&this.formField===t){var a=$(t.input);if(a.autocomplete("disable"),t.finalizeField(),!n&&this.origValue&&a.val()!==this.origValue&&a.attr("name")===this.origName){var r="Field:Change:Text:WasNonEmpty";s.logEvent(null,r,r,{$idDiv:this.formField.$fieldDiv})}if(!n){var l=i.newViewOptions(this.options,{origVal:this.origValue,newVal:a.val(),fieldId:t.getFormElement().id});e.opFactory.create("LosingTextfieldFocusOp",l).run()}}o.prototype.detach.call(this,t),n||this._adjustFieldWidth(t)},_adjustFieldWidth:function(e){e.getFormElement()&&e.adjustWidthForTextIfNecessary({force:!0})}}),{get:function(t){return e._fafFieldToolbarTextView||(e._fafFieldToolbarTextView=new e.FafFieldToolbarTextView(i.newViewOptions(t))),e._fafFieldToolbarTextView}}}),define("fss/js/templates/faf-autocomplete-signature-item-template",[],function(){return'<div class="faf-autoc-sig-item-signature"></div><div class="faf-autoc-sig-item-action no-select"> <%= addSignatureMessage %>    <div class="faf-signature-add-icon"></div></div>'}),define("fss/js/views/faf-autocomplete-signature-item-view",["core/ac-core","fss/js/ac-faf","i18n!fss/js/nls/ui-strings","fss/js/lib/util","fss/js/views/form-field/faf-field-annotation-view","fss/js/lib/formcanvas","fss/js/templates/faf-autocomplete-signature-item-template"],function(e,t,i,n,s,o,a){return t.FafAutocompleteSignatureItemView=e.View.extend({events:{},initialize:function(){e.MenuView.prototype.initialize.call(this),this._template=_.template(a)},render:function(){e.View.prototype.render.call(this);var n="";switch(this._type="",this.options.type){case"faf_ac_sign_item":n=i.ToolBarAddSign,this._type="signature";break;case"faf_ac_init_item":n=i.ToolBarAddInitials,this._type="initials"}return this.$el.html(this._template({addSignatureMessage:n})),this._initWrappers(),this._sigObj=t._fafUserDataModel.signatureData.getFirstSignature(this._type),this._sigObj?(this.$autocSig.show(),this.$autocAction.hide(),this._showSigItem()):(this._sigObj=null,this.$autocSig.hide(),this.$autocAction.show()),this},_initWrappers:function(){this.$autocSig=this.$(".faf-autoc-sig-item-signature"),this.$autocAction=this.$(".faf-autoc-sig-item-action"),this.listenTo(this,"item:selected",this._onItemSelected),this.pageScale=t._formManager.getPageScale()},_showSigItem:function(){var e=this._sigObj.imageSize,t={imageType:this._type,imageData:this._sigObj.pngData,canvasSize:n.getCanvasSize(this._sigObj,e.height/e.width),imageSize:$.extend({width:786,height:300},e),callback:_.bind(function(e){this.$autocSig.append(e)},this)};t.canvasSize.width*=this.pageScale,t.canvasSize.height*=this.pageScale,o.createCanvas(t)},_onItemSelected:function(e){var i=e&&e.position||{};i.left+=15;var o={position:i,candidateId:e.candidateId};if(this._sigObj){var a=this._sigObj.imageSize,r=n.getCanvasSize(this._sigObj,a.height/a.width);o.position.top=o.position.top+e.fldHeight-r.height*this.pageScale,_.extend(o,{imageType:this._sigObj,size:r}),s.prototype.createAnnotationImageFieldWithOptions(o),this._createMapping(),this._notifySmartSigCreated(e)}else{var l={fieldID:null,sigType:this._type,doneFunc:_.bind(function(t){if("OK"===t.why){var i=t.signature,a=i.imageSize,r=n.getCanvasSize(i,a.height/a.width);o.position.top=o.position.top+e.fldHeight-r.height*this.pageScale,_.extend(o,{imageType:i,size:r}),s.prototype.createAnnotationImageFieldWithOptions(o),this._createMapping(),this._notifySmartSigCreated(e)}},this)};t._fafContentView._triggerViewEvent(t.ViewEvents.FAF_SIGNATURE_SHOW_POPUP,l)}},_notifySmartSigCreated:function(e){e.candidateId&&t._fafEditorUiModel.set("smart_sig_placed",!0)},_createMapping:function(){if(this.options.model){var e=t._fafEditorUiModel.get("pages"),i=t._fafEditorUiModel.get("current_page"),n=e[i].elements[t._fafEditorUiModel.get("pages")[i].elements.length-1],s=n.fid||n.id;t._fafFieldCandidateMappingCollection.addMapping({fieldID:s,candidateID:this.options.model.get("id"),type:"auto",value:"1"})}}}),t.FafAutocompleteSignatureItemView}),define("fss/js/views/faf-autocomplete-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/views/faf-autocomplete-signature-item-view"],function(e,t,i,n,s,o){var a=".faf-edit-form-form-container",r=2,l="faf_ac_sign_item",d="faf_ac_init_item",f=new RegExp("([\\^\\$\\*\\+\\\\?\\.(\\){}\\[\\]\\!\\=\\:\\|\\\\])","g"),c=" \\t\\n\\r -@\\[-`\\{-\\~　-〿＀-＠［-｀｛-｠｡-･￠-￯׀׃׆׳״؉؊،؍؛؛؞؟٪-٭۔๏๚๛꫞꫟";return t.FafAutocompleteView=e.View.extend({initialize:function(){e.View.prototype.initialize.call(this),this._acModel=this.options.fafAutocompleteModel,this._acStateModel=this.options.fafAutocompleteStateModel,this._textField=this.options.acViewOptions.textField,this._$input=this.options.acViewOptions.$input,this._$fldDiv=this.options.acViewOptions.$fldDiv,this._$formPage=this.options.acViewOptions.$formPage,_.bindAll(this,"_onFormScroll","_keyUp","_addAC","_updateSource"),this._$input.data("fafAutocomplete",this),this._$input.addClass("faf-autocomplete-input"),this._acStateModel.getState().then(this._addAC),this._addMappingCollection()},_addMappingCollection:function(){if(!this._addedMapping){var e=this.options.fafRC,t=e.fafFieldCandidateMappingCollection,i=e.fafFieldCandidateValuePredictionCollection;t&&i?(this._addedMapping=!0,this._listeningForModels&&(this.stopListening(this.options.fafPreferencesModel,"add:model"),delete this._listeningForModels),t.isInitialized().then(_.bind(function(){var e=t.isSmartField(this._textField.fieldId());if(e){var n=e.get("candidateID");this._fcPredictions=i.getPredictionsForCandidate(n),this._candidateModel=this.options.fafRC.fafFieldCandidatePagesCollection.getCandidateModel(n),this._isSignatureField="signature"===this._candidateModel.get("kind");var s=2e4;_.each(this._fcPredictions,function(e){e.id=s++}),this._updateSource()}},this))):this._listeningForModels||(this._listeningForModels=!0,this.listenTo(this.options.fafPreferencesModel,"add:model",_.bind(function(e){_.extend(this.options,e),this._addMappingCollection()},this)))}},_addAC:function(){this._$input.autocomplete({delay:200,minLength:this._fcPredictions||this._isSignatureField?0:r,source:[],messages:{noResults:"",results:function(){}},appendTo:$(a),position:{at:"left bottom",my:"left top"},open:_.bind(this._acOpen,this),close:_.bind(this._acClose,this),response:_.bind(this._acResponse,this),focus:_.bind(this._acFocus,this),select:_.bind(this._acSelect,this)}),this._updateSource(),this.listenTo(this._acModel,"change:source",_.bind(function(){this._updateSource()},this)),this.listenTo(this._acModel,"change:ac_s",_.bind(function(){var e=this._acStateModel.get("ac_s");e?this._$input.is(":focus")&&(this._$input.autocomplete("enable"),this._$input.autocomplete("search")):this._$input.autocomplete("disable")},this)),this._$input.autocomplete("disable")},render:function(){this._updateSource()},_updateSource:function(){this._acModel.sourcePromise().then(_.bind(function(){var e=this._acModel.get("source")||[];this._fcPredictions&&(e=_.clone(e).concat(this._fcPredictions)),this._isSignatureField&&(e=_.clone(e),e.unshift({id:30001,value:l})),this._isInitialsField&&(e=_.clone(e),e.unshift({id:30002,value:d})),this._$input.autocomplete({source:e}),this._$input.autocomplete("search")
},this))},updateSignatureProperties:function(e,t){this._isSignatureField=e,this._isInitialsField=t,this._updateSource()},close:function(){this._isOpen()&&this._$input.autocomplete("close")},refresh:function(){this._isOpen()||(this._acModel.prepare(),this._$input.autocomplete({minLength:this._fcPredictions||this._isSignatureField?0:r}),this._updateSource())},wantsArrowKeys:function(){return this._isOpen()},_removeSignatureOptions:function(){this[l]&&this[l].remove(),this[d]&&this[d].remove()},remove:function(){try{this._removeSignatureOptions(),this._$input.autocomplete("destroy")}catch(t){s.logError("autocomplete","Autocomplete destroy  threw")}e.View.prototype.remove.call(this)},_acResponse:function(e,t){var n=this._$input.val();if(this._$input.data(i.FAF_INPUT_UNCHANGED_KEY))return void t.content.splice(0,t.content.length);for(var s=n.replace(f,"\\$&"),o=new RegExp("^"+s+".*","i"),a=new RegExp(".*["+c+"]"+s+".*","mi"),l=0;l<t.content.length;){var d=t.content[l],u=d.value;[30001,30002].indexOf(d.id)>-1&&""===n?(d.sortVal=30001===d.id?"0000":"0001",l++):n.trim().length<r&&!d.score?t.content.splice(l,1):o.test(u)?(d.sortVal=(d.score?"000":d.udata?"001":"010")+u,l++):a.test(u)?(d.sortVal=(d.score?"011":d.udata?"110":"111")+u,l++):t.content.splice(l,1)}for(t.content.sort(function(e,t){if(!e.udata&&!t.udata&&e.sortVal.substring(0,3)===t.sortVal.substring(0,3)){var i=t.count-e.count;if(e.score&&t.score)return t.score-e.score;if(i)return i}return e.sortVal.localeCompare(t.sortVal)}),l=1;l<t.content.length;){var h=t.content[l];if(h.udata){if(l++,l>=5)break}else{for(var p=h.value,g=!1,_=0;l>_;_++)if(p===t.content[_].value){g=!0;break}if(g)t.content.splice(l,1);else if(l++,l>=5)break}}t.content.length>=5&&t.content.splice(5,t.content.length-5);var m=[];for(l=0;l<t.content.length;l++)m.push(t.content[l].id);this._acModel.set("menu_id_array",m),this._acModel.set("menu_ac_ui_content",t.content)},_fldDivBottom:function(){return this._$fldDiv.position().top+this._$fldDiv.outerHeight()},_parentPagePosDiff:function(){var e=this._$formPage.offset(),t=$(a).offset();return s.posAminusB(e,t)},_acOpen:function(){var e=this._$input.autocomplete("widget");this._acModel.set("$menu_widget",e),$(".faf-form").bind("scroll",this._onFormScroll),this._acModel.get("menu_open_cch")<0&&this._acModel.set("menu_open_cch",this._$input.val().length);var i=e.find(".ui-menu-item");this._acModel.set("$menu_items",i),i.data("fafAutocomplete",this),this._placeMenuBelowField();for(var a=this._acModel.get("menu_ac_ui_content"),r=e.find("li"),l=0;l<r.length;l++){var d,f=a[l].udata,c=a[l].id,u=a[l].value;30001===c||30002===c?($(r[l]).html(""),d=$('<div class="faf-autoc-sig-item"></div>'),this[u]=new t.FafAutocompleteSignatureItemView({el:d[0],model:this._candidateModel,type:u}).render()):f?(d=$('<span class="faf-ac-label" />'),d.text(f)):d=$('<div class="faf-ac-exclude" />'),$(r[l]).append(d)}r.data("fafAutocomplete",this);var h=r.find(".faf-ac-exclude");h.bind("mousedown",_.bind(this._excludeMouseDown,this)),h.click(_.bind(this._excludeClick,this)),e.css("width","auto");var p=$(window).height()-$(".faf-hud-controls").height()-10,g=e.offset().top+e.height(),m=g-p;if(m>0){var v=$(".faf-form"),S=v.scrollTop()+m;v.scrollTop(S);var E=v.scrollTop();if(S>E){this._acModel.set("menu_scroll",!0);var b=$(".faf-form-view"),w=s.cssNumTotal(b,"padding-bottom"),F=w+(S-E);b.css("padding-bottom",F+"px"),v.scrollTop(S),this._acModel.get("menu_form_padding")<0&&this._acModel.set("menu_form_padding",w)}this._placeMenuBelowField()}if(i.bind("mouseenter",this._mouseEnter),i.bind("mouseleave",this._mouseLeave),o.onExternalEsc(this._escHit),this._$input.bind("keyup",this._keyUp),!this._isOpen()){var T="Field:ACompl:1-Shown",D=n.addEmptiness(T,this._$input);n.logEvent(T,T,D),this._acModel.set("menu_state","open")}},_acClose:function(e){$(".faf-form").unbind("scroll",this._onFormScroll);var t=this._acModel.get("$menu_items");o.offExternalEsc(this._escHit),t.unbind("mouseenter",this._mouseEnter),t.unbind("mouseleave",this._mouseLeave),this._$input.unbind("keyup",this._keyUp),this._acModel.unset("menu_state");var i=this._acModel.get("menu_form_padding");i>0&&$(".faf-form-view").css("padding-bottom",i),this._removeSignatureOptions(),e.originalEvent&&(e.originalEvent.fafClosedAutocomplete=!0)},_triggerSignItemSelect:function(e){e.trigger("item:selected",{position:this._textField.$fieldDiv.position(),fldHeight:this._textField.$fieldDiv.height(),candidateId:this._textField.getFormElement().candidateId})},_acSelect:function(e,t){var i,s;if(30001===t.item.id&&this[l]&&(this._triggerSignItemSelect(this[l]),this._textField.deleteField()),30002===t.item.id&&this[d])this._triggerSignItemSelect(this[d]),this._textField.deleteField();else{this._acModel.set("menu_state","selecting");var o=this._$input.val();this._$input.val(t.item.value),this._$input.trigger("textchange",[o]);var a=this.options.fafRC.fafFieldCandidateMappingCollection;a&&a.isInitialized().then(_.bind(function(){a.alterMappingForFieldID({fieldID:this._textField.fieldId(),type:"auto"})},this));var r=this._acModel.get("menu_open_cch");if(r>0){var f=o.length-r;f>0&&(i="Field:ACompl:Typed",s=i+":"+(f>=5?"5+":f),n.logEvent(null,i,s))}i="Field:ACompl:2-Selected",s=i+(t.item.udata?":RHPData":":AcomplData"),n.logEvent(i,i,s)}e.originalEvent.stopPropagation(),e.originalEvent.preventDefault()},_acFocus:function(e,t){var i=this._acModel.get("menu_id_array"),n=this._acModel.get("$menu_items");return n&&i&&this._focusOn(n[i.indexOf(t.item.id)]),!1},_focusOff:function(e){$(e).removeClass("faf-ac-focused");var t=this._acModel.get("$menu_last_focus");t[0]===e&&this._acModel.unset("$menu_last_focus",{silent:!0})},_focusOn:function(e){var t=this._acModel.get("$menu_last_focus");t&&this._focusOff(t[0]),t=$(e),this._acModel.set("$menu_last_focus",t,{silent:!0}),t.addClass("faf-ac-focused")},_mouseEnter:function(e){var t=$(e.currentTarget).closest("li").data("fafAutocomplete");t._focusOn(e.currentTarget)},_mouseLeave:function(e){var t=$(e.currentTarget).closest("li").data("fafAutocomplete");t._focusOff(e.currentTarget)},_escHit:function(e,t){t||this._isOpen()&&this._$input.autocomplete("close")},_keyUp:function(e){var t=$(e.currentTarget).data("fafAutocomplete"),i=t._acModel.get("$menu_last_focus"),n=t._acModel.get("$menu_widget");i&&!n.find(".ui-state-focus").length&&this._focusOff(i[0])},_excludeClick:function(e){if(1===e.which){var t=$(e.currentTarget).closest("li");t.css("display","none");var i=t.text(),s=$(e.currentTarget).closest("li").data("fafAutocomplete");s._acModel.excludeString(i);var o="Field:ACompl:Exclude";n.logEvent(null,o,o),e.preventDefault(),e.stopPropagation()}},_excludeMouseDown:function(e){1===e.which&&(e.preventDefault(),e.stopPropagation())},_onFormScroll:function(){this._acModel.get("menu_scroll")?this._acModel.unset("menu_scroll"):this._$input.autocomplete("close")},_placeMenuBelowField:function(){var e=this._acModel.get("$menu_widget"),t=this._parentPagePosDiff(),i=this._fldDivBottom()+t.top-1;e.css({left:s.cssNumTotal(this._$fldDiv,"left")+t.left+"px",top:i+"px"})},_isOpen:function(){return"open"===this._acModel.get("menu_state")}}),t.FafAutocompleteView}),define("fss/js/views/form-field/faf-field-text-view",["fss/js/xlib/jquery.textchange.min","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings","fss/js/lib/formstyler","fss/js/lib/fafa","fss/js/views/form-field/faf-field-view","fss/js/views/form-field/toolbar/faf-field-toolbar-text-view","fss/js/lib/formcanvas","fss/js/views/faf-autocomplete-view"],function(e,t,i,n,s,o,a,r,l,d,f,c){return t.FafFieldTextView=t.FafFieldView.extend({initialize:function(e){var s=e.$fieldDiv,o=s.find("textarea"),a=o[0];if(this.input=a,t.FafFieldView.prototype.initialize.call(this,e),!("placeholder"in a)||0===a.placeholder.length){var r=$('.user-value-template[name="'+o.attr("name")+'"]');r.length&&(a.placeholder=r.attr("placeholder"))}o.data(i.FAF_INPUT_DATA_KEY,this),this.$testSubject=$('<pre style="text-align:left;margin:0;padding:0;"><span class="width-tester"/></pre>').css({position:"absolute",top:-9999,left:-9999,width:"auto"}),$("#testSubjects").append(this.$testSubject),_.bindAll(this,"_checkForTextChange","_onGrabberTap","_formClosed"),o.bind("textchange",this._checkForTextChange),o.data(i.FAF_FIELD_LAST_LEGAL_VALUE,o.val()),this.inputMode="editing",this.adjustWidthForTextIfNecessary(),o.bind(i.FIELD_VALUE_SET_FROM_USER,this._savedFormValueRetrieved),o.data("faf-field-filter",_.bind(function(e){return this._checkCharLimit(e)},this)),o.data(i.FAF_INPUT_UNCHANGED_KEY,o.val());var l=n.newViewOptions(this.options,{acViewOptions:{textField:this,$input:$(this.input),$fldDiv:this.$fieldDiv,$formPage:o.closest(".faf-form-page")}});this._acView=new c(l),this.options.fafApp.addListener(i.FORM_CLOSED,this._formClosed);var d=!1,f=this.options.fafRC.fafFieldCandidateMappingCollection;f&&f.isInitializedSync()&&(d=f.isSmartField(this.fieldId())),this._candidateModel=d&&this.options.fafRC.fafFieldCandidatePagesCollection.getCandidateModel(d.get("candidateID"))},_formClosed:function(){this.options.fafApp.removeListener(i.FORM_CLOSED,this._formClosed),this._removeAutocomplete()},_onGrabberTap:function(){this._resumeInput(),$(this.input).select()},_blockInput:function(){if("blocking"!==this.inputMode){this.inputMode="blocking";var e=$(this.input);e.removeClass("accepting-input"),e.attr("disabled","disabled"),_.delay(_.bind(function(){this.$fieldDiv.find(".grabber").on("tap",this._onGrabberTap),this.$fieldDiv.find(".grabber").on("click",this._onGrabberTap)},this),300)}},_resumeInput:function(){if("editing"===this.inputMode)return!1;this.inputMode="editing";var e=$(this.input);return e.addClass("accepting-input"),e.removeAttr("disabled"),this._touchStartTime=null,this.$fieldDiv.find(".grabber").off("tap",this._onGrabberTap),this.$fieldDiv.find(".grabber").off("click",this._onGrabberTap),!0},_savedFormValueRetrieved:function(){var e=$(this.fieldFocusElement());e.data(i.FAF_FIELD_LAST_LEGAL_VALUE,e.val()),e.data(i.FAF_INPUT_UNCHANGED_KEY,e.val())},_checkForTextChange:function(){var e=$(this.fieldFocusElement()),t=e.data(i.FAF_INPUT_UNCHANGED_KEY);t&&t!==e.val()&&e.removeData(i.FAF_INPUT_UNCHANGED_KEY),e.hasClass("faf-field-with-invisible-caret")&&""!==e.val()&&this.removeSignatureFieldStyles(),e.data("textValueChanged",!0),this.adjustWidthForTextIfNecessary()},removeSignatureFieldStyles:function(){var e=$(this.fieldFocusElement());e.attr("placeholder",o.FormViewTypeTextHere),e.removeClass("faf-field-with-invisible-caret"),$(this.input).autocomplete({minLength:0}),this._acView.updateSignatureProperties(!1,!1)},convertToSignatureField:function(){var e=$(this.fieldFocusElement());e.val(""),e.attr("placeholder",""),e.addClass("faf-field-with-invisible-caret"),this._acView.updateSignatureProperties(!0,!0),$(this.input).autocomplete({minLength:0}),$(this.input).autocomplete("enable"),$(this.input).autocomplete("search","")},MAX_CHARS_IN_FIELD:1e3,_checkCharLimit:function(e){var t=e.val();if(t.length<=this.MAX_CHARS_IN_FIELD)return e.data(i.FAF_FIELD_LAST_LEGAL_VALUE,t),!0;if(e.data("insideCCL"))return!0;e.data("insideCCL",!0);var n=e.data(i.FAF_FIELD_LAST_LEGAL_VALUE),s=e[0],a=s.selectionStart;if(e.val(n),"number"==typeof a){var l=Math.max(0,a-(t.length-n.length));s.selectionStart=s.selectionEnd=l}e.trigger("textchange",[t]),e.removeData("insideCCL"),this.showFieldGuide({guideType:"faf-error",text:_.template(o.FormViewTextTooLongText,{maxAllowedChars:this.MAX_CHARS_IN_FIELD})});var d="Field:Change:Text:Invalid:TooLong";return r.logEvent(null,d,d+":Custom"),!1},DEFAULT_AUTOGROW_PARAMS:{maxWidth:700,minWidth:0,comfortZone:12},_extraInputSpacing:function(e,t){var i=1;if(this._isFormFocus()){var s=n.cssNumTotal(t,"letterSpacing"),o=this.$testSubject.children("span");s?i=s/2+n.charWidth(o):i+=e.comfortZone+n.comfortWidth(o)}return i},adjustWidthForTextIfNecessary:function(e){t._app.notifyEvent("ShowSave",{evt:"FormChanged"}),e=$.extend({},this.DEFAULT_AUTOGROW_PARAMS,e);var s=e.$input?e.$input:$(this.input);if(e.force||!s.hasClass("fixedSize")){var o=s.data(i.FORM_FIELD_DIV_KEY),a=s.val()||n.placeholderText(s)||"È";if(e.force||this.adjustedVal!==a){this.adjustedVal=a;var r=this.$testSubject.children("span");r.css({fontSize:n.realFontSize(s)+"px",fontFamily:s.css("fontFamily"),fontWeight:s.css("fontWeight"),letterSpacing:s.css("letterSpacing")});var l=this._extraInputSpacing(e,s);a=a.replace(/\n$/,"\n.").replace(/\r\n$/,"\r\n.").replace(/\r$/,"\r."),r.text(a);var d=this.$testSubject.width()+l;if(""===s.val()&&this._candidateModel){var f;this._candidateModel.get("locations")?f=this._candidateModel.get("locations")[0]:this._candidateModel.get("location")&&(f=this._candidateModel.get("location"));var c=this.options.fafRC.fafFieldCandidatePagesCollection.getRecognizedPageSize(this.options.fafEditorUiModel.get("current_page"));d=f.width*t._formManager.getPageScale()*700/c.width-15}var u=s.width(),h=o.position();e.posDiff&&(h=n.posAplusB(h,e.posDiff));var p=e.minWidth*t._formManager.getPageScale();d=Math.max(p,d);var g=d!==u,m=this.$testSubject.find("span"),v=n.cssNumTotal(m,"fontSize"),S=m.height(),E=0,b=a.split(/\r\n|\r|\n/);if((e.force||b.length!==this.adjustedNumLines)&&(this.adjustedNumLines=b.length,_.each(b,_.bind(function(e){var t=this._getHeightForEachTextLine(s,d,e);E+=t},this)),E=E>S?E:S,v>13&&30>v&&(E+=Math.min(4,v/6)),g=!0),g){var w=this.fieldToolbarView();d=n.roundThous(d),s.css("width",""+d+"px"),o.data(i.TEXT_EXTRA_SPACE,l),0!==E&&(E=n.roundThous(E),s.css("height",""+E+"px"),this._isFormFocus()&&w.isPositionedBelow(this)&&w.positionFocusDiv()),s.scrollTop(0),this.adjustDivWidth(w.formField===this),t._app.notifyEvent(i.WIDTH_AUTOCHANGE,{field:o})}}}},_getHeightForEachTextLine:function(e,t,i){var n=$('<div style="text-align:left;margin:0;padding:0;"></div>').css({position:"absolute",height:"auto",top:"100px",left:"100px",width:t+"px","word-wrap":"break-word",fontSize:e.css("fontSize"),fontFamily:e.css("fontFamily"),fontWeight:e.css("fontWeight"),letterSpacing:e.css("letterSpacing")});$("#testSubjects").append(n),n.text(i);var s=n.height();return n.remove(),s},adjustDivWidth:function(e){var t=$(this.input),i=this.$fieldDiv;if(e||!t.css("letterSpacing"))i.css("width","");else{var s=n.cssNumTotal(t,"letterSpacing"),o=t.outerWidth(!0)-s+t.position().left;i.css("width",o+"px"),i.scrollLeft(0)}},_focusSub:function(){if("blocking"!==this.inputMode){var e=$(this.input);if(e.closest(".faf-form").data("lastFocusText",e),this._touchStartTime&&(new Date).getTime()-this._touchStartTime<500)return void this._blockInput();this._acView&&this._acView.refresh(),$(this.input).autocomplete({minLength:this._candidateModel?0:2}),this._candidateModel&&($(this.input).autocomplete("enable"),$(this.input).autocomplete("search",""))}},_shouldBlur:function(){return!0},_blurSub:function(){this._resumeInput();for(var e=$(this.input),t=e.val(),i=!1;t&&t.length>0&&10===t.charCodeAt(t.length-1);)i=!0,e.val(t.substring(0,t.length-1)),t=e.val();if(i){e.trigger("textchange",[t]);var n="Field:KeyPressed:Auto:TrailingRETRemoved",s=r.addEmptiness(n,e);r.logEvent(null,n,s)}},_midfixSub:function(){return":Text"},_postfixSub:function(){return r.addEmptiness("",$(this.input))},_trackKeyLabelSuffix:function(e){var n=":Text";switch(e.which){case 13:case 9:n=r.addEmptiness(n,$(this.input));break;case 8:case 46:var s=t._formManager.autoDeleteLabel($(this.input).data(i.FORM_FIELD_DIV_KEY));"AutoDeleted"===s?n+=":AutoDeleteCandidate":$(this.input).val()||(n+=":DeletedAllTextThenDEL")}return n},_shouldTrackArrowKeys:function(e){if(this._acView&&this._acView.wantsArrowKeys())return!1;var t=$(this.input).val().split(/\r\n|\r|\n/);if(t.length<=1)switch(e.which){case 38:case 40:return!0}return!1},_shouldTrackKeyDown:function(e){var t=!0;switch(e.which){case 13:$(e.currentTarget).hasClass("ui-autocomplete-input")&&(t=!1);break;case 8:case 46:var i=$(this.input);i.val()&&(t=!1);break;case 27:if($(e.currentTarget).hasClass("ui-autocomplete-input")){var n="Field:ACompl:ESC";r.logEvent(null,n,n)}}return t},_blurOnESC:function(e){return!e.fafClosedAutocomplete},_shouldPreventDefaultOnKeyDown:function(){return!1},_shouldTrackLoseFocus:function(e){return!$(e.originalEvent.target).hasClass("ui-state-focus")},_shouldDeleteOnDelDown:function(){return!1},_closeAutoComplete:function(){this._acView&&this._acView.close()},_deleteFieldSub:function(){this._removeAutocomplete()},_removeAutocomplete:function(){this._closeAutoComplete(),this._acView&&(this._acView.remove(),delete this._acView)},_removeWidgetsSub:function(){this._closeAutoComplete()},fontSizeChanged:function(e){var s,o=n.getBaselineForFont(e.oldSize,$(this.input)),r=n.getBaselineForFont(e.newSize,$(this.input)),l=r.baseline-o.baseline,d=t._formManager.getPageScale(),f=e.newSize*d,c=l*d,u=$(this.input);if(this._isComb()&&(s=n.charWidth(u)),u.css("fontSize",f+"px"),u.css("lineHeight","normal"),this._isComb()){var h,p=n.charWidth(u);h=n.cssNumTotal(u,"letter-spacing")+(s-p),u.css("letter-spacing",Math.max(0,h)+"px"),u.css("padding-left",Math.max(0,h)/2+"px");var g=n.roundThous((p-s)/2);this.$fieldDiv.css("left",n.cssNumTotal(this.$fieldDiv,"left")-g+"px")}if(!this.adjustedNumLines||this.adjustedNumLines<2){var _=n.roundThous(this.$fieldDiv.css("top")),m=n.roundThous(_-c);this.$fieldDiv.css("top",m+"px")}this.adjustWidthForTextIfNecessary({force:!0}),t._app.notifyEvent(i.FORM_FIELD_CHANGED,{$field:this.$fieldDiv}),a.setDefaults(this._isComb()?"combfield":"textfield",{"font-size":e.newSize+"px"})},_moveStartSub:function(){this._closeAutoComplete()},_moveStopSub:function(e,t,i){if(!i){var n="Field:Move",s=n+":Text",o=r.addEmptiness(s+":"+t,$(this.input)),a={$fieldDiv:this.$fieldDiv,posRel:{x:e.diff.left,y:e.diff.top}};r.logEvent(n,s,o,_.clone(a)),this.adjustWidthForTextIfNecessary({force:!0,posDiff:{left:a.posRel.x,top:a.posRel.y}})}},_updateLetterSpacing:function(e){var t=$(this.input);e+=this.resizeArea.divOrigPosition.left-this.$fieldDiv.position().left;var i=n.charWidth(t),s=this.resizeArea.longestLineChars,o=n.cssNumTotal(t,"letter-spacing"),a=(e-(s+1)*i)/(s+1);t.css("letter-spacing",a+"px"),t.css("padding-left",a/2+"px"),n.moveElementLeftBy(this.$fieldDiv,(o-a)/2),this.adjustWidthForTextIfNecessary({force:!0})},resizeHandles:function(){return this._isComb()?"e":null},_resizeStartSub:function(){this.resizeArea=n.sizeOfTextArea($(this.input),{force:!0}),this.resizeArea.charWidth=n.charWidth($(this.input)),this.resizeArea.divOrigPosition=this.$fieldDiv.position()},_resizeSub:function(e){this._updateLetterSpacing(e.width)},_resizeStopSub:function(e,n,s){if(this._updateLetterSpacing(s?n.width:e.width),t._app.notifyEvent(i.FORM_FIELD_CHANGE_STYLE,{$fieldDiv:this.$fieldDiv}),!s){var o="Field:Change:Text:Comb"+(e.width>n.width?":Wider":":Narrower");this._addUsualSuspectsToLabelAndLog(o),a.setDefaults("combfield",{letterSpacing:$(this.input).css("letter-spacing")});var r=this.fieldToolbarView();r.positionFocusDiv()}},_addUsualSuspectsToLabelAndLog:function(e){var t=r.addEmptiness(e,$(this.input));r.logEvent(null,e,t)},switchComb:function(){var e=this.getFormElement(),s=$(this.input),o="Field:Change:Text:Comb:";if(e.isComb){s.css("font-family",a.defaultValues.textfield.styles["font-family"]);var r=n.cssNumTotal(s,"letter-spacing");0===r?delete e.lastLetterSpacing:e.lastLetterSpacing=s.css("letter-spacing"),s.css("letter-spacing",""),s.css("padding-left",""),n.moveElementLeftBy(this.$fieldDiv,r/2),o+="Off"}else{s.css("font-family",a.defaultValues.combfield.styles["font-family"]),e.lastLetterSpacing||(e.lastLetterSpacing=n.cssNumTotal(s,"font-size")+"px"),s.css("letter-spacing",e.lastLetterSpacing);var l=parseInt(e.lastLetterSpacing,10)/2;s.css("padding-left",l+"px"),n.moveElementLeftBy(this.$fieldDiv,-l),o+="On"}e.isComb=!e.isComb,this.adjustWidthForTextIfNecessary({force:!0}),t._app.notifyEvent(i.FORM_FIELD_CHANGE_STYLE,{$fieldDiv:this.$fieldDiv}),this._addUsualSuspectsToLabelAndLog(o)},_isComb:function(){return this.getFormElement().isComb},_retagWithNewId:function(e,n){var s=$(this.input),o=s[0],a=t._formManager.autoDeleteLabel(this.$fieldDiv);o.name=e,s.addClass("faf-user-value custom");var l=s.val(),d=t._app.currentUser().getValue(e);d||(d=""),n&&0===d.length?("TextTyped"!==a&&"AutoDeleted"!==a?s.val(""):t._fafFormValuesCollection.setValue(e,l,!0),s.trigger("textchange",[l])):(s.val(d),s.trigger("textchange",[l]));var f="Tag:Set",c=r.addEmptiness(f+":FieldMenu",s),u=c+":Custom";r.logEvent(f,c,u,{$idDiv:this.$fieldDiv}),t._app.notifyEvent(i.FORM_FIELD_CHANGE_ID,{$field:this.$fieldDiv}),this.fieldFocusElement().focus()},fieldToolbarView:function(){return d.get(this.options)},_isFormFocus:function(){return this.fieldToolbarView().formField===this},finalizeField:function(e){var t=!0,i=$(this.input),n=this.getFormElement();n.isComb?this.adjustDivWidth(!1):this.adjustWidthForTextIfNecessary({force:!0});var s=i.val();if(s&&s!==e)for(var o=0,a=s.length;a>o;o++){var l=s.charCodeAt(o);if(!(l>=32&&127>=l||13===l||10===l||l>=160&&255>=l||l>=338&&339>=l||l>=8211&&8212>=l||l>=8216&&8218>=l||l>=8220&&8222>=l||l>=8224&&8226>=l||8230===l||8260===l||8482===l||8364===l)){n.hasNonRoman=!0;var d="Field:Change:Text:NonRoman";r.logEvent(null,d,d+":Custom");break}}return t},fieldName:function(){return this.input.name},fieldId:function(){return this.input.name},fieldBaseElement:function(){return this.input},fieldFocusElement:function(){return this.input},addContentToDragHelper:function(e){e.find("textarea").val(this.$fieldDiv.find("textarea").first().val())}}),t.FafFieldTextView}),define("fss/js/ui/faffieldgrabber",["fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/views/form-field/faf-field-view","fss/js/views/form-field/toolbar/faf-field-toolbar-view"],function(e,t,i,n,s){function o(e,t){var s=this;if(s.app=e,s.$field=t,s.$grabber=t.find(".grabber"),s.$grabber.data(o.GRABBER_KEY,s),s.containment=[0,0,0,0],s.$grabber.draggable({containment:s.containment,cursor:"move",zIndex:3e3,helper:function(){return s.dragHelper()},start:function(e){return s.dragStart(e)},drag:function(){return s.drag()},stop:function(e,t){return s.dragStop(e,t)}}),n.isDesktop()){var a=s.$grabber.draggable("instance");a._orgMouseMove=a._mouseMove,a._mouseMove=_.bind(function(e){return e.which?this._orgMouseMove(e):!1},a)}i.handleTouchEventAsMouseEvent(s.$grabber)}function a(e){var t=e.field,i=t.data(o.GRABBER_KEY);i&&(i.dragAborted=!0,i.$helper.css("opacity","0.01"),i.app.removeListener(s.prototype.FIELD_DRAG_ABORTED,a),i.app.removeListener(s.prototype.FIELD_LOST_FOCUS,a))}return o.GRABBER_KEY="faf.grabber",o.prototype.formField=function(){var e=this;if(!e.$grabber)return i.logError("grab","FafFieldGrabber dragging without $grabber"),null;if(!e.$field)return i.logError("grab","FafFieldGrabber dragging without $field"),null;var n=e.$field.data(t.FORM_FIELD_KEY);return n?n:(i.logError("grab","FafFieldGrabber dragging without formField"),null)},o.prototype.dragHelper=function(){var t=this,i=e._fafFormView.$curPage,n=i.offset();t.containment[0]=n.left+1,t.containment[1]=n.top+1,t.containment[2]=i.width()+n.left-t.$field.outerWidth()+1,t.containment[3]=i.height()+n.top-t.$field.outerHeight()+1;var s=t.formField();if(s){var o=t.$field.clone();t.$field.addClass("drag-source"),s.addContentToDragHelper(o),o.css({top:"-1px",left:"-1px"});var a=$('<div style="position:relative;border:0;margin:0;padding:0"></div>');return a.append(o),t.$helper=a,a}},o.prototype.dragStart=function(t){e._fafFormView.overrideCursor($(t.srcElement).css("cursor"));var i=this;i.dragAborted=!1;var n=i.formField();n&&(delete i.prevDiff,n.fieldToolbarView().clearPendingFadeIn(),i.origArea=n.moveStart(),e._fafEditorUiModel.set("faf_hud_hide_override",!0),i.app.addListener(s.prototype.FIELD_DRAG_ABORTED,a),i.app.addListener(s.prototype.FIELD_LOST_FOCUS,a))},o.prototype.drag=function(){var e=this;return!e.dragAborted},o.prototype.dragStop=function(t,n){e._fafFormView.overrideCursor("");var o=this;o.app.removeListener(s.prototype.FIELD_DRAG_ABORTED,a),o.app.removeListener(s.prototype.FIELD_LOST_FOCUS,a),o.$field.removeClass("drag-source"),delete o.$helper,e._fafEditorUiModel.set("faf_hud_hide_override",!1);var r=o.formField();if(r){var l=o.origArea;if(!o.dragAborted){var d=i.posAplusB(o.origArea,n.position);l=$.extend({},d,{width:o.$field.width(),height:o.$field.height()})}var f=r.moveParam(l,o.origArea);r.moveStop(f,"Mouse",o.dragAborted)}},o}),define("fss/js/templates/faf-field-candidate-template",[],function(){return'<div class="faf-candidate"><button class="faf-candidate-focus-element" style="outline:none;" /></div>'}),function(e){"function"==typeof define&&define.amd?define("fss/js/xlib/droppable",["jquery"],e):e(jQuery)}(function(e){return e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,n=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(n)?n:function(e){return e.is(n)},this.proportions=function(){return arguments.length?void(t=arguments[0]):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;t<e.length;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var n=e.ui.ddmanager.droppables[this.options.scope];this._splice(n),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var n=i||e.ui.ddmanager.current,s=!1;return n&&(n.currentItem||n.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===n.options.scope&&i.accept.call(i.element[0],n.currentItem||n.element)&&e.ui.intersect(n,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(s=!0,!1):void 0}),s?!1:this.accept.call(this.element[0],n.currentItem||n.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(n)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,n,s){if(!i.offset)return!1;var o=(t.positionAbs||t.position.absolute).left+t.margins.left,a=(t.positionAbs||t.position.absolute).top+t.margins.top,r=o+t.helperProportions.width,l=a+t.helperProportions.height,d=i.offset.left,f=i.offset.top,c=d+i.proportions().width,u=f+i.proportions().height;switch(n){case"fit":return o>=d&&c>=r&&a>=f&&u>=l;case"intersect":return d<o+t.helperProportions.width/2&&r-t.helperProportions.width/2<c&&f<a+t.helperProportions.height/2&&l-t.helperProportions.height/2<u;case"pointer":return e(s.pageY,f,i.proportions().height)&&e(s.pageX,d,i.proportions().width);case"touch":return(a>=f&&u>=a||l>=f&&u>=l||f>a&&l>u)&&(o>=d&&c>=o||r>=d&&c>=r||d>o&&r>c);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var n,s,o=e.ui.ddmanager.droppables[t.options.scope]||[],a=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(n=0;n<o.length;n++)if(!(o[n].options.disabled||t&&!o[n].accept.call(o[n].element[0],t.currentItem||t.element))){for(s=0;s<r.length;s++)if(r[s]===o[n].element[0]){o[n].proportions().height=0;continue e}o[n].visible="none"!==o[n].element.css("display"),o[n].visible&&("mousedown"===a&&o[n]._activate.call(o[n],i),o[n].offset=o[n].element.offset(),o[n].proportions({width:o[n].element[0].offsetWidth,height:o[n].element[0].offsetHeight}))}},drop:function(t,i){var n=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(n=this._drop.call(this,i)||n),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),n},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var n,s,o,a=e.ui.intersect(t,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(s=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===s}),o.length&&(n=e(o[0]).droppable("instance"),n.greedyChild="isover"===r)),n&&"isover"===r&&(n.isover=!1,n.isout=!0,n._out.call(n,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),n&&"isout"===r&&(n.isout=!1,n.isover=!0,n._over.call(n,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable}),define("fss/js/views/faf-field-candidate-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/utilUI","fss/js/templates/faf-field-candidate-template","fss/js/xlib/droppable"],function(e,t,i,n){var s="show_recognized_fields";return t.FafFieldCandidateView=e.View.extend({events:{},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(n),this.candidateModel=this.options.model,this.candidatePageModel=this.options.pageModel},_initWrappers:function(){this.$link=this.$candidate.find("button"),this.$candidate.click(this._onClickCandidate),this.listenTo(this.candidatePageModel,"change:scale",this._position),this.listenTo(this.candidateModel,"change:state",this._setEnable),this.listenTo(this.candidateModel,"change:createFieldOnTab",this.runSmartCreationOp),this.$link.focus(_.bind(function(){this.runSmartCreationOp({isTab:!0})},this));var e=t._fafPreferencesModel.getPreference("develop_options");this._candidateDebugMode=e&&_.has(e,s)?e[s]:!1},render:function(){return e.View.prototype.render.call(this),this.$candidate=$(this._template()),this._position(),t._fafFormView.appendToCurrentPageTBLR(this.$candidate),this._initWrappers(),this._styleField(),this._setEnable(),this},remove:function(){this.$candidate.remove()},positionExistingField:function(){var e=this.options.fafRC.fafFieldCandidateMappingCollection,t=e.hasSmartField(this.candidateModel.get("id"));
if(t){var i=t.get("fieldID"),n=$('[data-name="'+i+'"]'),s=$('[name="'+i+'"]'),o=n.length?n:s.length?s:null;if(o){var a=o.closest(".faf-focusbox-outline");return void this.$candidate.after(a)}}},_makeDroppable:function(){this.$candidate.droppable({accept:function(e){return e.parent().hasClass("faf-userdata-field")?!0:void 0},tolerance:"pointer",hoverClass:"faf-drag-hover",drop:_.bind(function(e,i){t._fafEditorUiModel.set("current_droppable_zone",this),this.runSmartCreationOp({value:i.draggable.parent().find("textarea").val(),placeholder:i.draggable.parent().find("textarea").attr("placeholder")})},this)})},_setEnable:function(e){var t=e?"add"===e?!0:!1:this.options.fafRC.fafFieldCandidateMappingCollection.hasSmartField(this.candidateModel.get("id"));t?(this._setDroppableDeactivate(!0),this.$candidate.addClass("disabled"),this.$link.attr("tabIndex","-1")):(this._setDroppableDeactivate(!1),this.$candidate.removeClass("disabled"),this.$link.removeAttr("tabIndex"))},_setDroppableDeactivate:function(e){this.$candidate.data("uiDroppable")&&this.$candidate.droppable("option","disabled",e)},_styleField:function(){var e=this.candidateModel.get("kind"),t=this.candidateModel.get("markShape"),i=this.candidateModel.get("label"),n=this.candidateModel.get("groupIndex"),s=this.candidateModel.get("id");this.$candidate.addClass(e),"text"===e?(this.$candidate.addClass("tool-text"),this._makeDroppable()):"signature"===e?this.$candidate.addClass("tool-signature"):"button"===e&&this.$candidate.addClass("square"===t?"tool-check":"circle"===t?"tool-dot":"tool-x"),i&&this.$candidate.attr("title",i),n&&this.$candidate.attr("data-grp-idx",n),s&&this.$candidate.attr("data-candidate-id",s),this._candidateDebugMode&&this.$candidate.addClass("fr-candidate-debug")},_position:function(){var e,t=this.candidatePageModel.get("width")||612,i=700/t*this.candidatePageModel.get("scale");this.candidateModel.get("locations")?e=this.candidateModel.get("locations")[0]:this.candidateModel.get("location")&&(e=this.candidateModel.get("location")),this.$candidate.css("top",e.yMin*i),this.$candidate.css("left",e.xMin*i),this.$candidate.css("width",e.width*i),this.$candidate.css("height",(e.height+3)*i),this.$candidate.attr("data-orig-height",e.height*i)},_onClickCandidate:function(e){$(e.target).hasClass("faf-candidate")&&(this.runSmartCreationOp(),e.stopPropagation(),e.preventDefault())},runSmartCreationOp:function(e){var t=this.options.fafRC.fafFieldCandidateMappingCollection;i.hideGuide(),t.isInitialized().then(_.bind(function(){this._runSmartCreationOpInt(e)},this))},_runSmartCreationOpInt:function(e){var i=this.options.fafRC.fafFieldCandidateMappingCollection,n=i.hasSmartField(this.candidateModel.get("id"));if(e=e||{},n){var s=n.get("fieldID"),o=$('[data-name="'+s+'"]').next().data("faffield"),a=$('[name="'+s+'"]').data("faffield");if(o||a){var r=(o||a).fieldFocusElement();return void $(r).focus()}}t.opFactory.create("CreateSmartFieldOp",_.extend({candidate:this.$candidate,isTab:e.isTab,value:e.value,placeholder:e.placeholder},this.options)).run()}}),t.FafFieldCandidateView}),define("fss/js/views/faf-form-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/faf-form-view-template","fss/js/lib/util","fss/js/lib/utilUI","fss/js/lib/formstyler","fss/js/data/fafconstants","fss/js/data/formdata","fss/js/views/form-field/faf-field-text-view","fss/js/views/form-field/faf-field-annotation-view","fss/js/ui/faffieldgrabber","fss/js/lib/formcanvas","fss/js/lib/fafa","fss/js/xlib/jquery.textchange.min","i18n!fss/js/nls/ui-strings","core/utils/image-loader","fss/js/lib/faf-common-util","fss/js/lib/faf-common-api-util","core/utils/date-util","fss/js/views/faf-field-candidate-view"],function(e,t,i,n,s,o,a,r,l,d,f,c,u,h,p,g,m,v,S){return t.FafFormView=e.View.extend({events:{"mouseenter .faf-form-view":"_formMouseEnter","mouseleave .faf-form-view":"_formMouseLeave","mousedown .faf-form-view":"_mouseDown","touchstart .faf-form-view":"_touchStart","touchend .faf-form-view":"_touchEnd","touchcancel .faf-form-view":"_touchEnd","MSPointerDown .faf-form-view":"_pointerDown","pointerdown .faf-form-view":"_pointerDown","MSGestureStart .faf-form-view":"_gestureStart","MSGestureChange .faf-form-view":"_gestureChange","MSGestureEnd .faf-form-view":"_gestureEnd"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i),this.uiModel=this.options.fafEditorUiModel,this.firstVisiblePageNo=this.uiModel.get("current_page"),this._addUiModelEventListeners(),this._addStyleOverrides(),this.debouncedRenditionLoad=_.debounce(_.bind(function(){this.uiModel.get("scroll_mode")&&this.loadRenditionForAllVisiblePages()},this),500),this.throttledHudCurrentPageUpdate=_.throttle(_.bind(function(){if(this.uiModel.get("scroll_mode")){var e=this.getCurrentFirstAndMostVisiblePages();this.firstVisiblePageNo=e[0];var t=e[1];this.ignoreCurrentPageUpdate=!0,this.uiModel.set("current_page",t),this.$curPage=this.pagesUI[t],this.ignoreCurrentPageUpdate=!1}var i=this.$form.scrollTop(),n=this.$form.scrollLeft(),s=this.$curPage.position(),o=n-s.left,a=s.top-i;this.uiModel.set("page_offset_x",o/this._getImageToPageRatio()),this.uiModel.set("page_offset_y",a/this._getImageToPageRatio())},this),500,{leading:!1}),_.bindAll(this,"_renderFieldCandidatesInt")},loadRenditionForAllVisiblePages:function(){var e=this.getVisiblePages();return v.loadRenditions(e,this.images)},_initWrappers:function(){_.bindAll(this,"_mouseDrag","_mouseUp","onScroll","_onWindowResize"),this.$form.bind("scroll",this.onScroll),$(window).on("resize",this._onWindowResize)},render:function(){if(e.View.prototype.render.call(this),0===this.$el.children().length){_.defer(_.bind(function(){this.app=t._app,this.app.addListener(a.APP_WILL_SWITCH_VIEW,_.bind(this._onSwitchView,this))},this)),this.$el.html(this._template({}));var i=this.$el.closest(".faf-edit-form");this.$pageHeader=$(".page-header"),this.$userdata=i.find(".faf-edit-form-userdataview-container"),this.$toolbar=i.find(".faf-edit-form-toolbarview-container"),this.$form=this.$el,this.$formUI=this.$el.find(".faf-form-view"),this.$curPage=$(),this.curPageScale=1,this._initWrappers()}return this.uiModel.get("pages").length?(this._addPages(),this):this},renderFieldCandidates:function(e){var t=this.options.fafRC.fafFieldCandidatePagesCollection;t&&t.isInitialized().then(_.bind(function(){this._renderFieldCandidatesInt(e)},this))},_renderFieldCandidatesInt:function(e){if(!e)return this.$formUI.hasClass("load-in-progress")?void _.defer(this._renderFieldCandidatesInt,500):void _.defer(_.bind(function(){this._renderFieldCandidatesInt(!0)},this),500);var i=this.options.fafRC.fafFieldCandidatePagesCollection,n=this,s=this.options.fafEditorUiModel,o=s.get("current_page"),a=i.findWhere({pageNumber:o});if(a){var r=a.get("processed");if(!r&&!_.isEmpty(a.candidates.models)){a.set("processed",!0),a.set("scale",n.curPageScale);var l=[],d=a.candidates.models;$.each(d,_.bind(function(e,i){if(i.get("kind")){var s=_.extend({model:i,pageModel:a},this.options,{el:n.$curPage});l.push(new t.FafFieldCandidateView(s).render())}},this)),_.each(l,function(e){e.positionExistingField()}),this._showRecognitionInfoGuide()}}},_showRecognitionInfoGuide:function(){var e=this.options.appApi.usersMeApi.getUserCohorts()||{},t=e["FSS-FR-feat-test"];if(!(t&&"c2"!==t||m.isDesktop())){var i={preference:"user.toolBarFRGuide",parent:$(".faf-form-view"),top:0,left:"auto",width:253,arrow:"up",arrowPosition:80,duration:15e3,text:p.FormViewFRInfo};setTimeout(function(){s.showGuide(i)})}},setToolCursor:function(){if(this.tool&&"signature"!==this.tool.name){var e="tool-"+this.tool.name;if(this.uiModel.get("scroll_mode"))for(var t=0;t<this.pagesUI.length;t++)this.pagesUI[t].find(".faf-form-image").addClass(e);else this.$curPage.find(".faf-form-image").addClass(e)}},clearToolCursor:function(){if(this.tool&&"signature"!==this.tool.name){var e="tool-"+this.tool.name;if(this.uiModel.get("scroll_mode"))for(var t=0;t<this.pagesUI.length;t++)this.pagesUI[t].find(".faf-form-image").removeClass(e);else this.$curPage.find(".faf-form-image").removeClass(e)}},overrideCursor:function(e){this.$curPage.find(".faf-form-image").css("cursor",e)},_formMouseEnter:function(){document.addEventListener("mousewheel",this._modifyScrollBehavior,!1)},_formMouseLeave:function(){document.removeEventListener("mousewheel",this._modifyScrollBehavior,!1)},_modifyScrollBehavior:function(e){e.shiftKey&&(e.preventDefault(),this.$el[0].scrollLeft+=e.wheelDelta)},_onWindowResize:function(){var e=this.$form.data("lastFocusText");if(e&&e.is(":focus")&&!n.elementInView(e,this.$form)){e[0].scrollIntoView();var t=e.offset().top-this.$form.offset().top,i=this.$form.innerHeight()/2-t;this.$form[0].scrollTop-=i}},_updateRenditionOnPageChange:function(i){var n=t._formManager;if(n.form){var s=this.uiModel.get("current_page");if(this.$curPage.length&&!i){var o=this.curPageScale;o&&1!==o&&(this.scalePage(1),this.curPageScale=o),this.clearToolCursor(),this.uiModel.get("scroll_mode")||this.$curPage.hide(),this.$curPage=$(),this._removeFormGuide()}if(this.$curPage=this.pagesUI[s],this.curPageScale)this.scalePage(this.curPageScale);else{this.curPageScale=1;var a=this.$curPage.find(".faf-form-image").width(),r=n.form.getPageSize(this._currentPageIndex());this.imageScale=r.w&&a?a/r.w:1}this.setToolCursor(),this.renderFieldCandidates(),this.$curPage.show();var l=this.$curPage.find("img");this._loadRendition(s,this.images[s]).then(_.bind(function(){var e=s+1;return e<this.images.length?this._loadRendition(e,this.images[e]):void 0},this)),e.Util.isIE9()&&(l[0].src=l[0].src),this._onResize()}},_addPages:function(){var e=t._formManager;if(e.form){var i;o.resetToInitialStyles(),this.pagesUI=[],this.images=[],this.loadedImages=[],this.$formUI.addClass("load-in-progress");var s=this.uiModel.get("current_page");this.imageScale=e.defaultImageWidth/e.form.getPageSize(s).w;var a;m.isDesktop()?a=this.uiModel.get("page_scale"):(this._onResize(),a=this.fitWidthScale()),this.curPageScale=a;var r=this.uiModel.get("pages");if($.each(r,_.bind(function(t,n){this.$curPage=$('<div class="faf-form-page"/>'),this.$curPage.data("formData",n);var o=e.form.getPageBackgroundImageURL(t);if(o){var l=$('<img class="faf-form-image" crossorigin="use-credentials">');this.$curPage.append(l),this.setImageSize(l,t,a),t===s&&(i=l),this.images.push({img:l,src:o})}this.$formUI.append(this.$curPage),this.uiModel.get("scroll_mode")&&t!==r.length-1&&this.$curPage.addClass("faf-form-page-scroll-mode"),S.logElapsedTime("FSS: start adding fields"),n.elements&&$.each(n.elements,_.bind(function(e,t){this.addFieldFromElement(t)},this)),S.logElapsedTime("FSS: end adding fields"),this.uiModel.get("scroll_mode")||(t>0||m.isDesktop())&&this.$curPage.css("display","none"),this.pagesUI.push(this.$curPage)},this)),this._loadRenditions(this.getVisiblePages(),this.images),this.$curPage=this.pagesUI[this.uiModel.get("current_page")],e.$formUI=this.$formUI,m.isDesktop()||t.opFactory.create("ZoomFormOp",_.extend({zoom:"fitWidth",noLog:!0},this.options)).run(),this.renderFieldCandidates(),this.uiModel.set("is_page_image_loaded",!1),n.loadImage(i).always(_.bind(function(){this.uiModel.set("is_page_image_loaded",!0),this._updateBasedOnUISettings(),$(".faf-shown-with-form").css("visibility",""),this.$formUI.removeClass("load-in-progress")},this)),"undefined"!=typeof MSGesture){var l=this.$form.find(".faf-form-image"),d={"touch-action":"none"};l.css(d),l.parents("*").css(d),this.gestureRecognizer=new MSGesture,this.gestureRecognizer.target=this.$formUI[0]}S.logElapsedTime("FSS: UI ready")}},setImageSize:function(e,i,n){var s=t._formManager;if(s.form){var o=s.form.getPageSize(i).w*n*this.imageScale,a=s.form.getPageSize(i).h*n*this.imageScale;return e.css("width",o),e.attr("src")?e.css("height",""):e.css("height",a),{w:o,h:a}}},_updateBasedOnUISettings:function(){var e=this.uiModel.get("page_offset_x")*this._getImageToPageRatio(),t=this.uiModel.get("page_offset_y")*this._getImageToPageRatio();this.uiModel.get("scroll_mode")?this.scrollToPage(this.uiModel.get("current_page"),e,t):(this._updateRenditionOnPageChange(!0),this._scrollLeft(e),this._scrollTop(t))},$initialInput:function(e,t,i){var s=$('<textarea class="faf-user-value accepting-input" rows="1" wrap="soft" spellcheck="false"></textarea>');e&&s.attr("name",e),"####"===t?t="":(!t||/^\s+$/.test(t)||/^Unlabeled field.+$/.test(t)||/^Type text here.+$/.test(t))&&(t=p.FormViewTypeTextHere),s.attr("placeholder",t),_.each(i,function(e,t){s.css(t,e)}),s.css("font-size",n.nearestLegalFontSize(s.css("font-size"))*this.curPageScale+"px"),s.css("width")&&s.css("width",n.cssNumTotal(s,"width")*this.curPageScale+"px");var o=n.cssNumTotal(s,"letter-spacing");return o&&s.css("padding-left",o/2+"px"),s},$initialAnnotation:function(e){var t=c.$baseCanvas(parseFloat(e.width),parseFloat(e.height));return t.attr("name",e.id),d.prototype.$fieldFromCanvas(t,e.position)},annotationFromAnnotationfieldElement:function(e){return this.$initialAnnotation(e)},addFieldFromElement:function(e){var i,s=t._formManager;if(null!==e){switch(e.type){case"textfield":var o=this.inputFromTextfieldElement(e),r=$.extend({},e.position);r.top+=this.fieldBaselineAdjust(parseFloat(o.css("font-size")),o.css("font-family"),e.isComb),i=this.addFieldToPage(o,r,e.type);break;case"signature":case"initials":case"annotationImage":var l=this.annotationFromAnnotationfieldElement(e);i=this.addFieldToPage(l,e.position,e.type);break;default:n.logError("formmgr","detected unknown field type: "+e.type)}i&&(i.data(a.FORM_ELEMENT_KEY,e),s.fieldAdded(e,i))}},inputFromTextfieldElement:function(e){var t=e.style||o.expandStyle(e.styles);delete e.styles;var i=this.$initialInput(e.id,e.ui,t);return i.css("height","auto"),i.css("line-height","normal"),i},fieldBaselineAdjust:function(e,i,s){var o=t._formManager,a=n.baselineAdjust(e,i);if(void 0!==a)return a;var r=0;return o&&o.fontBaselineAdjustment&&(r=s?o.fontBaselineAdjustment.combfield:o.fontBaselineAdjustment.textfield),r*e},appendToCurrentPageTBLR:function(e,t){var i=this.$curPage.children().filter("div:not(.faf-field-tool-bar)"),n=null,s=e.attr("data-grp-idx");if(s&&(n=i.filter("[data-grp-idx="+s+"]").last(),n.length||(n=null)),!n){t?t.top||_.extend(t,{top:parseInt(e.css("top"),10)}):t={top:parseInt(e.css("top"),10),left:parseInt(e.css("left"),10)},_.each(i,function(e){var i=$(e).position();i.top=parseInt(i.top),i.left=parseInt(i.left),i.top<t.top?n=e:i.top===t.top&&i.left<t.left&&(n=e)});var o=n&&$(n).attr("data-grp-idx");o&&(n=i.filter("[data-grp-idx="+o+"]").last())}n?$(n).after(e):i.length&&!n?this.$curPage.prepend(e):this.$curPage.append(e)},addFieldToPage:function(e,i,s,o){var a=this.newFieldAroundFieldElement(e,i);if(a){o?o.after(a):this.appendToCurrentPageTBLR(a,i);var r,l=n.newViewOptions(this.options,{$fieldDiv:a,el:a[0]});switch(s){case"textfield":this.addCustomPlaceholder(e),r=new t.FafFieldTextView(l);var d=n.cssNumTotal(e,"padding-left");d&&n.moveElementLeftBy(a,-d);break;case"signature":case"initials":case"annotationImage":r=new t.FafFieldAnnotationView(l)}r||n.logError("faf-form-view","No fafField created for "+s)}return a},addCustomPlaceholder:function(e){!e.attr("placeholder")||n.supportsPlaceholder()&&"MSIE"!==n.browserAndVersion()[0]||(e.bind("textchange",function(e){var t=$(e.currentTarget),i=t.prevAll(".faf-placeholder");i.click(function(){t.focus()}),i.length&&(t.val()?i.addClass("faf-hide"):(i.removeClass("faf-hide"),i.css({"font-size":t.css("font-size"),"font-family":t.css("font-family"),"letter-spacing":t.css("letter-spacing"),"line-height":t.css("line-height"),"text-indent":t.css("text-indent"),"text-align":t.css("text-align"),"padding-left":t.css("padding-left")})))}),e.before('<span class="faf-placeholder">'+e.attr("placeholder")+"</span>"),e.removeAttr("placeholder"),_.delay(function(){e.trigger("textchange")},100))},newFieldAroundFieldElement:function(e,i){var s=t._formManager,o=$("#faf-focusbox-template").clone();o.removeAttr("id"),o.detach();var r=new f(s.app,o);o.data(f.GRABBER_KEY,r),o.find(".faf-greeking").before(e),e.data(a.FORM_FIELD_DIV_KEY,o);var l;l="top"in i&&"number"==typeof i.top?i.top:"baseline"in i?i.baseline-this.calcBaseline(e):i.bottom-this.calcHeight(e),l=n.roundThous(l-s.blueInputboxAdjust.top),o.css("top",l+"px");var d=n.roundThous(i.left-s.blueInputboxAdjust.left);return o.css("left",d+"px"),o},calcHeight:function(e){var t=parseFloat(e.css("height"));return 0===t&&(t=24),t},okToAddField:function(e,t,i){var s=this.uiModel.get("pages");if(!s)return!1;var o=this.uiModel.get("current_page");if(0>o||o>s.length)return!1;var r=s[o];if(!r.elements)return!1;if(r.elements.length<a.MAX_NUM_OF_FIELDS)return!0;var l=$(".faf-edit-form-form-container"),d={parent:l,text:_.template(p.FormViewTooManyFieldsText,{maxAllowedFields:a.MAX_NUM_OF_FIELDS})},f=l.offset(),c=n.posAminusB({left:i.pageX,top:i.pageY},f);c.left-=10,c.left<300?(d.arrow="left",d.left=c.left+5):(d.arrow="right",d.right=l.innerWidth()-c.left),d.top=c.top<l.innerHeight()-120?Math.max(0,c.top-20):l.innerHeight()-60,d.arrowPosition=c.top-d.top-10,_.extend(d,{noQueueIfShowing:!0,guideID:"FormViewTooManyFieldsText"}),this.showFormGuide(d);var h="Field:Add:Invalid:TooMany:"+e;return u.logEvent(null,h,h+":"+t),!1},getVisiblePages:function(){var e=[];if(this.uiModel.get("scroll_mode"))for(var t=this.$form.scrollTop(),i=this.$form.scrollTop()+this.$form.height(),n=0;n<this.pagesUI.length;n++){var s=this.pagesUI[n],o=s.position().top,a=o+s.height();(o>=t&&i>=o||a>=t&&i>=a||t>=o&&a>=i)&&e.push(n)}else e.push(this.uiModel.get("current_page"));return e},getCurrentFirstAndMostVisiblePages:function(){for(var e=this.$form.scrollTop(),t=this.$form.scrollTop()+this.$form.height(),i=0,n=-1,s=-1,o=-1,a=0;a<this.pagesUI.length;a++){var r=this.pagesUI[a],l=r.position().top,d=l+r.height();if(l>=e&&t>=d)return-1===o&&(o=a),[o,a];if(e>=l&&d>=t)return-1===o&&(o=a),[o,a];if(l>=e&&t>=l)-1===o&&(o=a),n=t-l,n>s&&(i=a,s=n);else if(d>=e&&t>=d)-1===o&&(o=a),n=d-e,n>s&&(i=a,s=n);else if(i>0)return[o,i]}return[o,i]},onScroll:function(){this.throttledHudCurrentPageUpdate(),this.debouncedRenditionLoad()},_onMouseMove:function(e){function t(e,t,i){var n=e.offset().left-t,s=e.offset().top-t,o=n+e.width()+2*t,a=s+e.height()+2*t,r=i.pageX,l=i.pageY;return r>n&&o>r&&l>s&&a>l}return this.uiModel.get("faf_hud_hide_override")?void this.uiModel.set("is_hud_dismissed",!0):(this.$fafHud||(this.$fafHud=$(".faf-hud")),t(this.$fafHud,50,e)?this.uiModel.set("is_hud_dismissed",!1):this.uiModel.set("is_hud_dismissed",!0),e.stopPropagation(),void e.preventDefault())},_touchStart:function(e){var t=e.originalEvent.touches;2===t.length&&(this.zooming=!0,this.$formUI.on("touchmove",_.bind(this._touchMove,this)),this.baseTouchDist=this._touchDistance(t[0],t[1]),this.baseZoom=this.uiModel.getReaderZoom(),this.hotSpot=this._touchHotSpot(t[0],t[1]),this.lastPos=this._midPoint(t[0],t[1]),e.stopPropagation(),e.preventDefault())},_touchEnd:function(e){var t=e.originalEvent.touches;this.zooming&&2!==t.length&&(this._stopZooming(),e.stopPropagation(),e.preventDefault())},_stopZooming:function(){this.zooming=!1,this.hotSpot=null,this.lastPos=null,this.$formUI.off("touchmove")},_touchHotSpot:function(e,t){var i=this.$formUI.find(".faf-form-image")[0].getBoundingClientRect(),n=this.$form[0].getBoundingClientRect(),s=Math.max(i.left,n.left),o=Math.max(i.top,n.top);return t=t||e,{x:(e.clientX+t.clientX)/2-s,y:(e.clientY+t.clientY)/2-o}},_midPoint:function(e,t){return{x:(e.clientX+t.clientX)/2,y:(e.clientY+t.clientY)/2}},_touchDistance:function(e,t){return this._dist(e.screenX,e.screenY,t.screenX,t.screenY)},_touchMove:function(e){if(this.zooming){var i=e.originalEvent.touches;if(2===i.length){var n=this._touchDistance(i[0],i[1]),s=this._midPoint(i[0],i[1]);this.translation={x:s.x-this.lastPos.x,y:s.y-this.lastPos.y},this.lastPos=s;var o=this.baseZoom*n*100/this.baseTouchDist;this._triggerViewEvent(t.ViewEvents.FAF_ZOOM_CLICK,_.extend(this.options,{zoom:o+"%"})),this.hotSpot=this._touchHotSpot(i[0],i[1]),e.stopPropagation(),e.preventDefault()}else this._stopZooming()}},_pointerDown:function(e){if("touch"===e.originalEvent.pointerType){var t=$(e.target);t.hasClass("faf-grabber-block")||t.hasClass("faf-grabber-xd")||t.hasClass("resizable-handle-visual")||t.hasClass("ui-resizable-handle")||this.gestureRecognizer.addPointer(e.originalEvent.pointerId)}},_gestureStart:function(e){this.hotSpot=this._touchHotSpot(e.originalEvent),this.lastPos={x:e.originalEvent.clientX,y:e.originalEvent.clientY}},_gestureChange:function(e){this.translation={x:e.originalEvent.clientX-this.lastPos.x,y:e.originalEvent.clientY-this.lastPos.y},this.hotSpot=this._touchHotSpot(e.originalEvent),this.lastPos={x:e.originalEvent.clientX,y:e.originalEvent.clientY};var i=e.originalEvent.scale*this.uiModel.getReaderZoom()*100;1!==e.originalEvent.scale?this._triggerViewEvent(t.ViewEvents.FAF_ZOOM_CLICK,_.extend(this.options,{zoom:i+"%"})):this.scalePage(this.curPageScale,!0)},_gestureEnd:function(){this.hotSpot=null,this.lastPos=null},_mouseDown:function(e){if(1===e.which&&(!this.tool||"signature"!==this.tool.name)){e.stopPropagation(),e.preventDefault(),this.uiModel.get("scroll_mode")&&(this.$curPage=$(e.target).parent());var t=n.offsetFromEvent(e,{},this.$curPage);if(this.fieldHasFocus){var i=this.focusElement();if(this.blurFocusedElement(),i&&!this.tool)return this.loseFocusEventOffset=t,void(this.loseFocusEventNumber=i._trackLoseFocus({posAbs:{x:t.left,y:t.top},event:e}))}if(!$(e.target).hasClass("faf-candidate")){if(this.fieldHasFocus=!1,$(e.target).hasClass("faf-candidate")&&$(e.target).hasClass("button")){var s={left:e.target.offsetLeft,top:e.target.offsetTop},o={width:e.target.offsetWidth/this.curPageScale,height:e.target.offsetHeight/this.curPageScale};if($(e.target).hasClass("tool-check"))return void d.prototype.createAnnotationImageFieldAt("check",s,o);if($(e.target).hasClass("tool-dot"))return void d.prototype.createAnnotationImageFieldAt("dot",s,o);if($(e.target).hasClass("tool-x"))return void d.prototype.createAnnotationImageFieldAt("x",s,o)}if(this.okToAddField(this.tool?"Annot":"Text",this.tool?u.gaNameFromToolType(this.tool.name):"Custom",e)&&(this._startClickToCreate(t,e),!this.tool)){if(this.loseFocusEventNumber&&this.loseFocusEventNumber>=u.eventNumber()-1&&this._distFromOffset(e,this.loseFocusEventOffset)<8){var a="Field:ClickLoseFocus:ThenCreateTextField";u.logEvent(null,a,a)}delete this.loseFocusEventNumber,delete this.loseFocusEventOffset}}}},_mouseDrag:function(e){e.stopPropagation(),e.preventDefault()},_mouseUp:function(e){var i=this.c2cOffset,s=this.mouseDownEvent;if(this._doneWithClickToCreate(),e.stopPropagation(),e.preventDefault(),s&&!(this._dist(s.clientX,s.clientY,e.clientX,e.clientY)>2)){if(this.tool)return this.tool.createFunc(i);this.startOffsetX=i.left,this.startOffsetY=i.top+6;var r={baseline:this.startOffsetY,left:this.startOffsetX},l={left:this.startOffsetX},d=this.getAutoContext(r.baseline,r.left),f=$.extend({},d.isComb?o.defaultValues.combfield.styles:o.defaultValues.textfield.styles),c=parseFloat(n.fontSizeInPx(f["font-size"])),u=c;if(d.topLine&&d.ocrBaseline){var h=(d.ocrBaseline-d.topLine)/this.curPageScale,g=n.nearestLegalFontSize(.6*h+"px");u=Math.max(6,Math.min(g,c))}f["font-size"]=u+"px";var m=d.$matchingField;if(m){var v=m.data(a.FORM_ELEMENT_KEY);Boolean(d.isComb)===Boolean(v.isComb)&&(l.top=n.cssNumTotal(m,"top")+t._formManager.blueInputboxAdjust.top,u=n.fontSizeInPx(v.style["font-size"]),f["font-size"]=u+"px")}if(d.isComb){var S=_.template('<textarea style="font-family:<%= ff %>;font-size:<%= fs %>;"></textarea>',{ff:f["font-family"],fs:f["font-size"]}),E=n.charWidth($(S))*this.curPageScale;f["letter-spacing"]=d.combCharWidth-E+"px",this.startOffsetX=d.combLeft-1+(d.combCharWidth-d.combSpacing-E)/2,l.left=this.startOffsetX}else d.leftLine&&(this.startOffsetX=d.leftLine+u/4);var b=d.baseline;l.top||(d.ocrBaseline&&(b-=Math.max(3,.2*u)*this.curPageScale),l.baseline=b);var w=t._formManager.form.getNewFieldID(),F=this.$initialInput(w,d.isComb?"  ":p.FormViewTypeTextHere,f);F.addClass("custom");var T={$element:F,position:l,fieldType:"textfield",addOptions:{isComb:d.isComb}};t.opFactory.create("AddingFormFieldOp",T).run().then(_.bind(function(e){this._addClickToTypeField(e,F,b,d,r,c,u)},this))}},_distFromOffset:function(e,t){var i=n.offsetFromEvent(e,{},this.$curPage);return this._dist(i.left,i.top,t.left,t.top)},_dist:function(e,t,i,n){var s=Math.sqrt(Math.pow(e-i,2)+Math.pow(t-n,2));return s},_startClickToCreate:function(e,t){this.c2cOffset=e,this.mouseDownEvent=t,this.$formUI.bind("mousemove",this._mouseDrag),this.$formUI.bind("mouseup",this._mouseUp)},_doneWithClickToCreate:function(){this.$formUI.unbind("mousemove",this._mouseDrag),this.$formUI.unbind("mouseup",this._mouseUp),delete this.c2cOffset,delete this.mouseDownEvent},_addClickToTypeField:function(e,i,s,o,a,r,l){var d=i.attr("name");this.deleteEmptyJustCreatedField(),this.$lastCustomFieldCreated=e,delete this.$lastLPField,this.lastCustomId=d;var f={text:p.NullString,type:"textfield"};t._fafFormValuesCollection.setValue(d,f),i.data("formFocusFadeIn",!0),i.focus(),i.removeData("formFocusFadeIn");var c,h="Tools:Special:Text:ClickToTypeStarted:WasEmpty";if(u.logEvent(null,h,h,{$fieldDiv:e}),s=this.baselineOfField(e),(s!==a.baseline&&!o.usedOrigBaseline||this.startOffsetX!==a.left)&&(h="Field:MoveAuto:Text",c={posRel:{x:this.startOffsetX-a.left,y:s-a.baseline},$fieldDiv:e},u.logEvent(null,h,h+":WasEmpty:Custom",c)),r!==l){for(var g=l>r;r!==l;)r=n.nearestLegalFontSize(r+"px",g?.5:-.5);var _="Field:Change:SizeAuto";h=_+(g?":Up":":Down")+":Text",c={$idDiv:e},u.logEvent(_,h,h+":WasEmpty:Custom",c)}return o.isComb&&(h="Field:Change:WidthAuto:Wider:Text",u.logEvent(null,h,h+":WasEmpty:Custom",{$idDiv:e})),!0},calcBaseline:function(e){var t=n.fontSizeOfElement(e);return t=n.nearestLegalFontSize(""+t),n.baselineOfFontSize(t)},baselineOfField:function(e){return parseFloat(e.css("top"))+this.calcBaseline(this.elementOfField(e))},getAutoContext:function(i,s){function o(e,t,i){var n=i/100,s=Math.max(1,e*n);return Math.abs(e-t)<=s}var r=t._formManager;if(!r.form)return{};this.debugComb=!1;var l={baseline:i},d=-1,f=10.001*this.curPageScale;if(this.$curPage.find(".faf-focusbox-outline").each(_.bind(function(e,t){var n=$(t);if("textfield"===n.data(a.FORM_ELEMENT_KEY).type){var s=this.baselineOfField(n);Math.abs(s-i)<f&&(f=Math.abs(s-i),d=s,l.$matchingField=n)}},this)),l.$matchingField&&(l.fontSize=this.elementOfField(l.$matchingField).css("font-size")),!n.supportsCanvas())return l;if(e.Util.isIE9orBelow()||n.isSafari5orBelow())return l;var u,h,p,g={left:this.$form.scrollLeft(),top:this.$form.scrollTop()},m=r.form.getPageSize(this._currentPageIndex()).w*this.imageScale,v=this.$curPage.find(".faf-form-image");v.css("width",m),v.css("height",""),l.baseline/=this.curPageScale,i/=this.curPageScale,s/=this.curPageScale,d>0&&(d/=this.curPageScale);var S=Math.max(0,s-12),E=16,b=Math.max(0,i-7),w=10;p=c.normalizedImageDataFromArea(v,{x:S,y:b},{width:E,height:w});var F=c.findVertStripe(p,{left:!0});F&&(l.colLeft=S+F,this.debugComb&&n.logInfo("faf-form-view","colLeft: "+F+"; abs: "+l.colLeft));var T=-1,D=l.colLeft?l.colLeft:Math.max(0,s-5),y=Math.max(0,i-5),A=25,C=60;p=c.normalizedImageDataFromArea(v,{x:D,y:y},{width:C,height:A});var P=c.findHorizStripe(p);if(P>0){var R=y+P;l.ocrBaseline=T=R,d=R,this.debugComb&&n.logInfo("faf-form-view","closestBaseline: "+d)}else T=d>0?d+2:-1;if(T>0){var I=20,O=33,M=Math.max(0,T-O-1);p=c.normalizedImageDataFromArea(v,{x:D,y:M},{width:I,height:O});var x=c.findHorizStripe(p,{up:!0});if(x>=0){var N=M+x;T-9>=N&&(l.topLine=N,this.debugComb&&n.logInfo("faf-form-view","topLine: "+N),this.debugComb&&n.logInfo("faf-form-view","new closestBaseline: "+d))}}if(l.colLeft){var L=T>0?T:i,U=18,j=Math.floor(l.colLeft-5),k=Math.min(200,Math.max(200,m-j)),V=l.topLine?l.topLine+6:Math.floor(Math.max(0,L-U)),z=L-V+3;p=c.normalizedImageDataFromArea(v,{x:j,y:V},{width:k,height:z});var G=new Array(k),B=[];for(h=0;k>h;h++){var W,H,Y,K=0;for(u=0;z>u;u++)K+=p[u][h];var X=G[h]=Math.round(10*K/z)/10;if(0===h)W=X;else if(X-W>50){if(0===B.length){if(B.push(h),H=X,h>55)break;this.debugComb&&n.logInfo("faf-form-view","first stripe: "+h)}else if(Y===h-1)X>=H&&(B[B.length-1]=h,H=X,this.debugComb&&n.logInfo("faf-form-view","reset last stripe: "+h));else{if(h>B[B.length-1]+55)break;B.push(h),H=X,this.debugComb&&n.logInfo("faf-form-view","new stripe: "+h)}Y=h}}if(!l.isComb&&B.length>=3){var Z=B[1]-B[0],q=B[2]-B[1];if(Z>=10)if(o(Z,q,10))l.isComb=!0,this.debugComb&&n.logInfo("faf-form-view","isComb");else if(!l.isComb&&B.length>3){var J=B[3]-B[2];o(Z,J,10)&&Z>q&&(l.isComb=!0,l.isBoxes=!0,this.debugComb&&n.logInfo("faf-form-view","isBoxes"))}}if(l.isComb){var Q,et,tt,it;if(l.combLeft=j+B[0],this.debugComb&&n.logInfo("faf-form-view","combLeft: "+l.combLeft),l.isBoxes){et=B[2]-B[0],tt=et;var nt=1;for(Q=4;Q<B.length&&(it=B[Q]-B[Q-2],nt++,o(et,it,10));Q+=2)tt+=it,et=tt/nt;var st=B[2]-B[1];for(nt=1,tt=st,Q=4;Q<B.length;Q+=2){var ot=B[Q]-B[Q-1];if(nt++,!o(st,ot,10))break;tt+=ot,st=tt/nt}l.combSpacing=st}else{for(et=B[1]-B[0],tt=et,Q=2;Q<B.length&&(it=B[Q]-B[Q-1],o(et,it,10));Q++)tt+=it,et=tt/Q;l.combSpacing=0}l.combCharWidth=et}}return d>0?l.baseline=d:l.usedOrigBaseline=!0,v.css("width",r.form.getPageSize(this._currentPageIndex()).w*this.curPageScale*this.imageScale),this._scrollTop(g.top),this.$form.scrollLeft(g.left),l.ocrBaseline&&(l.ocrBaseline*=this.curPageScale),l.baseline&&(l.baseline*=this.curPageScale),l.topLine&&(l.topLine*=this.curPageScale),l.colLeft&&(l.colLeft*=this.curPageScale),l.combLeft&&(l.combLeft*=this.curPageScale),l.combCharWidth&&(l.combCharWidth*=this.curPageScale),l.combSpacing&&(l.combSpacing*=this.curPageScale),l},deleteEmptyJustCreatedField:function(e){var i,s,o=this.autoDeleteLabel(e);switch(o){case"AutoDeleted":var r=this.$lastCustomFieldCreated.data(a.FORM_FIELD_KEY);s=this.$lastCustomFieldCreated.data(a.FORM_ELEMENT_KEY),t._app.cntFields=t._app.cntFields-2,i=s.candidateId?"true"===r.$fieldDiv.find("textarea").attr("data-from-tab")?"Tools:Special:Text:SmartFieldTabThenAutoDelete":"Tools:Special:Text:SmartFieldClickThenAutoDelete":"Tools:Special:Text:ClickToTypeThenAutoDelete",r?r.deleteField():n.logError("formmgr","Undefined textfield for empty custom input"),u.logEvent(null,i,i,{id:s.id});break;case"TextTyped":i="Field:Add:Text:TextTool:TextTyped",u.logEvent("Field:Add",i,i,{$idDiv:this.$lastCustomFieldCreated})}o&&delete this.$lastCustomFieldCreated},autoDeleteLabel:function(e){if(this.$lastCustomFieldCreated&&(!e||e[0]===this.$lastCustomFieldCreated[0])){var t=this.elementOfField(this.$lastCustomFieldCreated);return t.attr("name")===this.lastCustomId?t.val()&&t.val()!==t.attr("placeholder")?"TextTyped":"AutoDeleted":"ChangedCategory"}return null},fitWidthScale:function(e){var i=t._formManager;if(!i.form)return 0;var n=parseFloat(e&&e.find(".faf-form-image").attr("width"),10)||i.form.getPageSize(0).w*this.imageScale;return this.desiredFitWidthImageWidth()/n},fitPageScale:function(e){var i=t._formManager;return i.form?this.desiredFitPageImageHeight()/i.form.getPageSize(e?e.index():0).h/this.imageScale:0},desiredFitWidthImageWidth:function(){return this.$form.width()-17},desiredFitPageImageHeight:function(){return this.$form.height()},scalePage:function(e,i){var s=t._formManager;if(s.form)if(this.uiModel.get("scroll_mode")){for(var o=this.$form.scrollTop(),a=this.pagesUI[this.firstVisiblePageNo].position(),r=a.top,l=(o-r)/this.curPageScale,d=this.$form.scrollLeft(),f=a.left,c=(d-f)/this.curPageScale,u=0;u<this.pagesUI.length;u++)this.doSinglePageScale(u,e);this.throttledHudCurrentPageUpdate(),this.scrollToPage(this.firstVisiblePageNo,c*e,l*e)}else{var h=this.uiModel.get("current_page"),p=this.pagesUI[h].find(".faf-form-image"),g=this.hotSpot?this.hotSpot:{y:Math.min(this.$form.height(),p.height())/2,x:Math.min(this.$form.width(),p.width())/2},_=this.translation||{y:0,x:0};this.translation=null;
var m={y:(g.y+this.$form.scrollTop())/this.curPageScale,x:(g.x+this.$form.scrollLeft())/this.curPageScale},v=this.doSinglePageScale(h,e),S=v.h-this.$form.height()+n.cssNumTotal(this.$formUI,["padding-bottom","padding-top"]);this._scrollTop(i?Math.min(S,Math.max(m.y*this.curPageScale-g.y-_.y,0)):0);var E=v.w-this.$form.width()+n.cssNumTotal(this.$formUI,["padding-left","padding-right"]);this.$form.scrollLeft(i?Math.min(E,Math.max(m.x*this.curPageScale-g.x-_.x,0)):0)}},doSinglePageScale:function(e,t){var i=this.pagesUI[e],n=i.find(".faf-form-image");if(t&&t!==i.data("pageScale")){this.hideFocusWidgets(),$(".faf-focusbox-outline",i).css("display","none"),this.curPageScale=t,i.data("pageScale",t);var s=this.setImageSize(n,e,t);return this.scaleFieldsOnPage(i),this.showFocusWidgets(),$(".faf-focusbox-outline",i).css("display","block"),s}return{w:n.width(),h:n.height()}},scaleFieldsOnPage:function(e){var i=t._formManager,s=this.curPageScale;$.each($(".faf-focusbox-outline",e),_.bind(function(e,o){o=$(o);var r=o.data(a.FORM_ELEMENT_KEY),l=o.data(a.FORM_FIELD_KEY);if(o.css("top",r.position.top*s-i.blueInputboxAdjust.top).css("left",r.position.left*s-i.blueInputboxAdjust.left),o.css("display",""),r.isFixedSize){$(".annotationImage",o).children().addBack().width(r.width*s).height(r.height*s);var d={imageType:l.fieldName()};["signature","initials"].indexOf(r.type)>-1?(d.imageData=t._signatures.formSignatures.getImgData(r.id),d.fieldId=r.id):d.fieldId=r.fid,l.imageChanged(d)}else{var f=$("textarea.faf-user-value",o),c=r.style,u=n.nearestLegalFontSize(c["font-size"]),h=this.fieldBaselineAdjust(n.nearestLegalFontSize(""+u*s),c["font-family"],r.isComb);o.css("top",r.position.top*s-i.blueInputboxAdjust.top+h);var p=f.val().split(/\r\n|\r|\n/).length*(1.13*u+1.5);if(f.css("font-size",u*s),r.isComb){var g=parseFloat(c["letter-spacing"]);f.css("letter-spacing",g*s);var _=g/2*s;f.css("padding-left",_+"px"),n.moveElementLeftBy(o,-_)}7>u*s?o.addClass("greek"):o.removeClass("greek"),f.next().addBack().width(parseFloat(c.width)*s).height(p*s),l.adjustWidthForTextIfNecessary({force:!0})}},this))},prepareForSave:function(){if(this.fieldHasFocus){var e=this.focusElement();e&&e.finalizeField("")}},focusElement:function(){return this.$formUI?this.$formUI.data("focusElement"):null},blurFocusedElement:function(){var e;return this.fieldHasFocus&&(e=this.focusElement(),e&&e.blurNow(),this.fieldHasFocus=!1),e},hideFocusWidgets:function(){var e=this.focusElement();e&&e.hideFocusWidgets()},showFocusWidgets:function(){var e=this.focusElement();e&&e.showFocusWidgets()},fieldGainedFocus:function(){this.$curPage.find(".faf-form-image").addClass("withFocus"),this.fieldHasFocus=!0},elementOfField:function(e){return e.find("textarea.faf-user-value").first()},_currentPageIndex:function(){var e=this.$curPage.index();return e>=0?e:0},_addStyleOverrides:function(){if("MSIE"===n.browserAndVersion()[0]){var e=n.pluginBaseURL(),t=".faf-candidate",i="img.faf-form-image",s=_.template("<%= style %> {cursor: url(<%= origin %>/static/img/tools/<%= cursor %>.cur), default !important}"),o=s({origin:e,style:i+"",cursor:"text"})+s({origin:e,style:i+".tool-check",cursor:"check"})+s({origin:e,style:i+".tool-dot",cursor:"dot"})+s({origin:e,style:i+".tool-line",cursor:"line"})+s({origin:e,style:i+".tool-roundrect",cursor:"circle"})+s({origin:e,style:i+".tool-x",cursor:"x"})+s({origin:e,style:t+".tool-text, "+t+".tool-signature",cursor:"text"})+s({origin:e,style:t+".tool-check",cursor:"check"})+s({origin:e,style:t+".tool-dot",cursor:"dot"})+s({origin:e,style:t+".tool-x",cursor:"x"});$(_.template('<style type="text/css"><%= styles %></style>',{styles:o})).appendTo("head")}},_addUiModelEventListeners:function(){this.uiModel.on("change:current_page",this._onCurrentPageChange),this.uiModel.on("change:page_scale",this._onScaleChange),this.uiModel.on("change:tool",this._onToolChange),this.uiModel.on("change:scroll_mode",this._onScrollModeChange)},_onScrollModeChange:function(){this.pagesUI&&this.pagesUI.length&&(this.uiModel.get("scroll_mode")?(this.showAllPages(!0),this.scrollToPage(this.uiModel.get("current_page"))):(this.showAllPages(!1),this.showCurrentPageOnly()))},scrollToPage:function(e,t,i){t=t||0,i=i||0;var n=this.pagesUI[e];this._scrollLeft(n.position().left+t),this._scrollTop(n.position().top+i)},showAllPages:function(e){for(var t=this.uiModel.get("page_scale"),i=0;i<this.pagesUI.length;i++){var n=this.pagesUI[i];if(e){var s=n.find(".faf-form-image");this.setImageSize(s,i,t),n.show(),n.addClass("faf-form-page-scroll-mode")}else n.hide(),n.removeClass("faf-form-page-scroll-mode")}},showCurrentPageOnly:function(){this._updateRenditionOnPageChange()},_onCurrentPageChange:function(e,t){this.pagesUI&&this.pagesUI.length&&(_.isUndefined(t)||this.ignoreCurrentPageUpdate||(this.uiModel.get("scroll_mode")?this.scrollToPage(this.uiModel.get("current_page")):this._updateRenditionOnPageChange()))},_onScaleChange:function(e,t){if(this.pagesUI&&this.pagesUI.length){if(!_.isUndefined(t)){var i=this.uiModel.get("page_scale_preserve_hotspot");this.scalePage(t,i)}this.debouncedRenditionLoad()}},_onToolChange:function(e,t){this._clearFormTool(),this.blurFocusedElement(),"text"!==t&&(this.tool={name:t,createFunc:_.bind(function(e){var i=o.defaultValues.tool[t];if(!i.size)return void n.logToSplunk("ERROR bad form tool: "+t);i.cursorOffset&&(e=n.posAplusB(e,i.cursorOffset));var s={width:i.size.width,height:i.size.height};e=n.posAminusB(e,{left:i.alignContentLeft?0:s.width*this.curPageScale/2,top:s.height*this.curPageScale/2}),d.prototype.createAnnotationImageFieldAt(t,e,s)},this)},this.setToolCursor())},_clearFormTool:function(){this.tool&&(this.clearToolCursor(),delete this.tool)},_onResize:function(){return this.options.fafEditorUiModel.get("user_panel_layout_done")?(this._onResizeWidth(),this._onResizeHeight(),void this._adjustScaleIfNeeded()):void _.delay(_.bind(function(){this._onResize()},this),100)},_adjustScaleIfNeeded:function(){if(this.pagesUI&&this.pagesUI.length){var e=this.uiModel.get("zoom_type");e&&t.opFactory.create("ZoomFormOp",_.extend({zoom:e,noLog:!0},this.options)).run()}},resizeContainer:".faf-edit-form-form-container",_onResizeWidth:function(){var e=Math.max($(this.resizeContainer).width(),$(window).width())-this.$userdata.outerWidth();this.$form.width(e),this.uiModel.trigger("change")},_onResizeHeight:function(){var e=$(window).height()-this.$toolbar.outerHeight();m.isDesktop()||(e-=this.$pageHeader.outerHeight()),this.$form.height(e),this.uiModel.trigger("change")},_onSwitchView:function(e){e&&"FillForm"===e.viewName&&this._onResize()},showFormGuide:function(e){return s.showGuide(_.extend({guideType:"faf-error"},e))},_removeFormGuide:function(){s.hideGuide()},_scrollTop:function(e){this.$form.scrollTop(e)},_scrollLeft:function(e){this.$form.scrollLeft(e)},_getImageToPageRatio:function(){var e=t._formManager;return e.form?this.$curPage.find(".faf-form-image").width()/e.form.getPageSize(this._currentPageIndex()).w:0},_loadRenditions:function(e,t){for(var i=0;i<e.length;i++){var n=e[i];this._loadRendition(e[i],t[n])}},_loadRendition:function(e,t){if(t.img[0].hasAttribute("src"))return $.Deferred().resolve().promise();if(this.loadedImages.push(t.img),this.loadedImages.length>a.MAX_NUMBER_OF_CACHED_RENDITIONS){var i=this.loadedImages.shift();i.removeAttr("data-loading"),i.removeAttr("src")}return v.loadRendition(e,t)}}),t.FafFormView}),define("fss/js/templates/faf-userdata-view-template",[],function(){return['<div class="faf-userdata-panel"><div class="faf-rhp-achelper"/><div class="faf-rhp-ipm-block"/><div class="faf-userdata-header"><div class="faf-userdata-title theme-text"><%= title %></div><div class="faf-userdata-manage theme-hyperlink"><%= manage %></div><div class="null"></div></div><ul class="faf-online-content"></ul></div><div class="faf-rhp-offline-send-block"/><div class="faf-rhp-online-send-block"/><div class="faf-send-us-feedback"><a><%= sendUsFeedback %></a></div>','<li class="faf-userdata-category ui-theme theme-container" data-key="<%= categoryKey %>"><div class="faf-userdata-open-pointer"></div><div class="faf-userdata-category-name  ui-theme theme-container theme-text"><div><%= categoryName %></div><div class="faf-userdata-open-icon"></div></div></li>','<div class="faf-userdata-group" data-key="<%= groupKey %>"><div class="faf-userdata-group-name"><div><textarea class="no-select" readonly></textarea></div><div class="faf-userdata-remove-icon"></div></div><ul></ul><div class="faf-userdata-group-add-value"><div class="faf-userdata-group-add-value-text"><%= addValueText %></div><div class="faf-userdata-add-icon"></div></div></div>','<li class="faf-userdata-field theme-hoverable" data-key="<%= fieldKey %>"><div class="faf-grabber-block"></div><div class="faf-userdata-text-container"><textarea class="accepting-input theme-text"></textarea></div><div class="textarea-size"></div><div class="faf-userdata-remove-icon"></div></li>']}),define("fss/js/templates/reader/faf-rhp-send-view-template",[],function(){return'<div class="faf-rhp-send-block faf-reader-content  ui-theme theme-container "><div class="faf-userdata-separator"></div><div class="faf-rhp-send-title theme-text "><%= sendTitle %></div><div class="button-light-blue-small faf-rhp-send-track-button theme-hyperlink  theme-hoverable"><%= sendTrack %></div><div class="button-light-blue-small faf-rhp-send-others-button theme-hyperlink theme-hoverable "><%= sendOthers %></div></div>'}),define("fss/js/views/reader/faf-rhp-send-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/formstyler","fss/js/lib/fafa","fss/js/lib/utilUI","fss/js/xlib/jquery.textchange.min","i18n!fss/js/nls/ui-strings","fss/js/templates/reader/faf-rhp-send-view-template","fss/js/lib/reader/faf-reader-util"],function(e,t,i,n,s,o,a,r,l,d,f){return t.FafRhpSendView=e.View.extend({events:{"click     .faf-rhp-send-track-button":"_onSendAndTrack","click     .faf-rhp-send-others-button":"_onSendOthers"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(d)},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({sendTitle:l["RHP.Send.title"],sendTrack:l["RHP.Send.track"],sendOthers:l["RHP.Send.others"]})),this._initWrappers())},_initWrappers:function(){this.$collectSign=this.$el.find(".faf-rhp-send-others-button"),this.$sendTrack=this.$el.find(".faf-rhp-send-track-button"),this._updatePanelState()},_updatePanelState:function(){f.getFssPrefs().then(_.bind(function(e){return e.bShowGetOthersSignApp||e.bShowSendTrackApp?(e.bShowGetOthersSignApp?e.bEnableGetOthersSignApp||this.$collectSign.addClass("disabled"):this.$collectSign.addClass("faf-hide"),void(e.bShowSendTrackApp?e.bEnableSendTrackApp||this.$sendTrack.addClass("disabled"):this.$sendTrack.addClass("faf-hide"))):(this.$el.empty(),void n.logInfo("FafRhpSendView","Removing send panel"))},this))},_onSendAndTrack:function(){var e=_.extend(this.options,{flush:!0,ensureLogin:!1,appString:"SendAppFull"});t.Reader.opFactory.create("UpdateServerAutoCompleteSuggestionsOp",e).run(),t.Reader.opFactory.create("SwitchAppOp",e).run()},_onSendOthers:function(){var e=_.extend(this.options,{flush:!0,ensureLogin:!1,appString:"CollectSignaturesApp"});t.Reader.opFactory.create("UpdateServerAutoCompleteSuggestionsOp",e).run(),t.Reader.opFactory.create("SwitchAppOp",e).run()}}),t.FafRhpSendView}),define("fss/js/views/faf-userdata-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/faf-env-util","fss/js/lib/util","fss/js/lib/reader/faf-reader-util","fss/js/lib/faf-common-util","fss/js/lib/formstyler","fss/js/lib/fafa","fss/js/lib/utilUI","fss/js/xlib/jquery.textchange.min","i18n!fss/js/nls/ui-strings","fss/js/lib/reader/faf-reader-api-caller","fss/js/templates/faf-userdata-view-template","fss/js/views/reader/faf-rhp-send-view"],function(t,i,n,s,o,a,r,l,d,f,c,u,h,p){return i.FafUserDataView=t.View.extend({enableUserData:!0,enablePremium:!1,events:{"click      .faf-send-us-feedback":"_onSendUsFeedback","click      .faf-userdata-category-name":"_onOpenClick","click      .faf-userdata-add-icon":"_onAddClick","click      .faf-userdata-remove-icon":"_onRemoveClick","click      .faf-userdata-manage":"_onManageClick","touchstart .faf-userdata-field textarea":"_onTextTouchStart","pointerdown .faf-userdata-field textarea":"_onTextTouchStart","keydown    .faf-userdata-field textarea":"_onTextKeyDown","blur       .faf-userdata-field textarea":"_onTextBlur","focus      .faf-userdata-field textarea":"_onTextFocus","click      .faf-userdata-field textarea":"_onTextClick"},initialize:function(){t.View.prototype.initialize.call(this),this.$requiresCacheUpdate=!1,this._template=_.template(p[0]),this._categoryTemplate=_.template(p[1]),this._groupTemplate=_.template(p[2]),this._fieldTemplate=_.template(p[3]),this._panel=$(),this._categories=$(),this._orderKeys={"ja-jp":{name:["last_name","first_name","display_name"],address:["zip","country","state","city","address_1","address_2"]}},i._app.addListener(n.APP_WILL_SWITCH_VIEW,_.bind(function(e){this._onSwitchView(e)},this)),this.options.fafUserDataModel.on("change:profiles",_.bind(function(){this._addCategories()},this)),this.options.fafUserDataModel.on("change:add_group",_.bind(function(e){this._onAddGroup(e)},this)),this.options.fafUserDataModel.on("change:remove_group",_.bind(function(e){this._onRemoveGroup(e)},this)),this.options.fafUserDataModel.on("change:field",_.bind(function(e){this._onChangeField(e)},this)),_.bindAll(this,"_escToDrag","_onGrabberTap","_onWindowResize"),$(window).on("resize",this._onWindowResize)},render:function(){t.View.prototype.render.call(this),0===this.$el.children().length&&(this.enableUserData||(this.$el.addClass("faf-hide"),this.$el.width(0)),this.$el.html(this._template({title:u.UserDataTitle,manage:u.UserDataManage,sendUsFeedback:u.UserDataSendUsFeedback})),this._initWrappers(),this._addCachedEntries())},_addCachedEntries:function(){try{this.$el.find(".faf-userdata-panel > ul").empty(),this._getCachedProfiles().then(_.bind(function(e){var t=JSON.parse(e),i={key:"name",value:[{key:"display_name",text:t.fullname},{key:"first_name",text:t.firstname},{key:"middle_name",text:t.middlename},{key:"last_name",text:t.lastname}]};this._addCategory(i);var n={key:"address",value:[{key:"group_home",value:[{key:"address_1",text:t.street1},{key:"address_2",text:t.street2},{key:"city",text:t.city},{key:"state",text:t.state},{key:"zip",text:t.zip},{key:"country",text:t.country}]}]};this._addCategory(n);var s={key:"email",value:[{key:"group_personal",value:[{key:"email",text:t.email}]}]};this._addCategory(s);var o={key:"phone",value:[{key:"group_personal",value:[{key:"phone",text:t.phone}]}]};this._addCategory(o),$(".faf-Reader").hasClass("faf-loading")&&($(".faf-Reader").removeClass("faf-loading").addClass("faf-cacheLoad"),$(".faf-rhp-ipm-block").hide(),$(".faf-userdata-header").show(),this._onChromeLoaded())},this))}catch(e){o.logError("faf-userdata-view","Unexpected error parsing categories: "+e)}},_getCachedProfiles:function(){try{var t=$.Deferred(),n={methodName:"getProfilesCache",methodArgs:[]};i.appApi.rnaApi.done(function(e){e.fssApi(n).done(function(e){t.resolve(e)}).fail(function(){t.reject("Failed to getcachedprofile")})})}catch(s){o.logError("faf-userdata-view","Error while getting cached profile data: "+e)}return t.promise()},_initWrappers:function(){this._addCategories(),this._panel=$(".faf-userdata-panel"),this._categories=this._panel.find("ul"),this.$RHPContainer=$(".faf-edit-form-userdataview-container"),this.$sendBlock=$(".faf-rhp-send-block"),this.$userdataPanel=$(".faf-userdata-panel"),this.$userdataHeader=$(".faf-userdata-header"),this.$sendContainer=$(".faf-rhp-offline-send-block"),this.$onlineContent=$(".faf-online-content"),this.$IPMBlock=$(".faf-rhp-ipm-block"),r.isDesktop()&&(this.$RdrACHelper=$(".faf-rhp-achelper")),this._updatePanelState()},_onWindowResize:function(e){if(this._$currentFocusText){var t=this._$currentFocusText;if(e=e||this.$userdataPanel,!o.elementInView(t,e)){var i=o.positionRelativeTo(t,e).top,n=i-e.innerHeight()/2+t.outerHeight()/2;e[0].scrollTop=Math.max(0,n)}}},_onTextTouchStart:function(e){if(!o.isIEPointerNotTouchEvent(e)){var t=$(e.target),i=t.closest(".faf-userdata-field");i.is(":hover")||(this._touchStartTime=(new Date).getTime())}},_blockInput:function(e,t){e.removeClass("accepting-input"),o.setReadOnly(e,!0);var i=t.find(".faf-grabber-block");i.data("touching",!1),i.on("tap",this._onGrabberTap),i.on("click",this._onGrabberTap)},_resumeInput:function(e,t){e.addClass("accepting-input"),o.setReadOnly(e,!1);var i=t.find(".faf-grabber-block");i.off("tap",this._onGrabberTap),i.off("click",this._onGrabberTap)},_simulateFieldHover:function(e,t){o.isIE()&&(t?e.addClass("faf-userdata-field-hover"):e.removeClass("faf-userdata-field-hover"))},_onTextClick:function(e){if(this._touchStartTime&&(new Date).getTime()-this._touchStartTime<500){var t=$(e.target),i=t.closest(".faf-userdata-field");if(this._simulateFieldHover(i,!0),!i.is(".empty")){this._blockInput(t,i);var n=i.find(".faf-grabber-block");o.forceCursor(n.css("cursor"))}}},_onGrabberTap:function(e){var t=$(e.target).closest(".faf-userdata-field"),i=t.find("textarea");this._resumeInput(i,t),_.delay(function(){i.focus(),i.select()},100),e.stopPropagation()},_updatePanelState:function(){this.options.fafEditorUiModel.set("user_panel_layout_done",!0)},_onResize:function(){},_onSwitchView:function(e){e&&"FillForm"===e.viewName&&this.$el.find(".open").removeClass("open")},_onChromeLoaded:function(){var e=this.$el.find(".faf-userdata-category ").eq(0);e.addClass("open"),r.isSignedInAndConnected()&&_.defer(_.bind(function(){this._showSaveGuide(e.find(".faf-userdata-field").eq(0))},this)),_.defer(this._onResize)},_onSendUsFeedback:function(){window.open("https://adobe.allegiancetech.com/cgi-bin/qwebcorporate.dll?GEGJ5Q","_blank"),d.logEvent("","SendUsFeedback","SendUsFeedback")},_onOpenClick:function(e){var t=$(e.target).closest(".faf-userdata-category");t.is(".open")?(t.removeClass("open"),d.logEvent(null,"RHP:Cat:Close","RHP:Cat:Close:"+this._getKey(t))):(t.addClass("open"),d.logEvent(null,"RHP:Cat:Open","RHP:Cat:Open:"+this._getKey(t)))},_onAddClick:function(e){if(this.enablePremium){var t=$(e.target).closest(".faf-userdata-group").parent().find(".faf-userdata-group").eq(0),i=this._getKey(t);this.options.fafUserDataModel.addGroup(i),d.logEvent(null,"RHP:Group:Add","RHP:Group:Add:"+i)}},_onAddGroup:function(e){var t=e.replace(/\.group_([^.]+)$/,""),i=this._findField(t);i.find(".faf-userdata-group-add-value:last").addClass("faf-hide");var n=this._addGroup(t,this.options.fafUserDataModel.getObject(e),i);this._enableDrag(n)},_onRemoveClick:function(e){var t=this.options.fafUserDataModel,i=$(e.target).closest("[data-key]"),n=this._getKey(i);if(i.is(".faf-userdata-field")){var s=i.find("textarea:first"),o=s.is(".changed");s.focus(),o||(s.addClass("changed"),d.logEvent(null,"RHP:Clear","RHP:Edit:"+n)),t.setFieldText(n,void 0)}else if(i.is(".faf-userdata-group")){var a=i.parent();this.enablePremium&&a.find(".faf-userdata-group").length>1&&i.index()>1?(t.removeGroup(n),d.logEvent(null,"RHP:Clear","RHP:Remove:"+n)):(i.find(".faf-userdata-field").each(_.bind(function(e,i){t.setFieldText(this._getKey($(i)),void 0)},this)),d.logEvent(null,"RHP:Clear","RHP:Edit:"+n))}},_onRemoveGroup:function(e){this._findField(e).remove();var t=this._findField(e.replace(/\.group_([^.]+)$/,""));t.find(".faf-userdata-group-add-value").addClass("faf-hide").last().removeClass("faf-hide")},_showSaveGuide:function(){this._dragging||f.showGuide({preference:"user.userdataSaveGuide",parent:this.$el,top:this.$RHPContainer.position().top+5,right:this.$el.find(".faf-userdata-panel").outerWidth()+5,width:200,arrow:"right",arrowPosition:10,text:u.UserDataSaveMessage})},_showDragGuide:function(e){!this._dragging&&e&&e.length&&f.showGuide({preference:"user.userdataDragGuide",parent:this.$el,top:e.position().top-5,right:this.$el.find(".faf-userdata-panel").outerWidth()+5,width:200,arrow:"right",arrowPosition:10,text:u.UserDataDragGuide,duration:6e3})},_onTextChange:function(e,t){var i=$(e.target),n=this._getKey(i.closest("[data-key]"));this.options.fafUserDataModel.setFieldText(n,i.val()||void 0);var s=i.closest(".faf-userdata-field");i.val().length?s.removeClass("empty"):s.addClass("empty");var a=s.find(".faf-grabber-block");a.draggable({disabled:s.is(".empty")}),o.handleTouchEventAsMouseEvent(a),s.find(".textarea-size").html(_.escape(i.val()||i.attr("placeholder")||s.find(".faf-userdata-placeholder").text()));var r="RHP:Edit",l=r+(t?":NE":":E"),f=l+":"+n,c=i.is(":focus");c&&!i.is(".changed")&&(i.addClass("changed"),d.logEvent(r,l,f))},_onTextKeyDown:function(e){return this.$requiresCacheUpdate=!0,13!==e.keyCode},_onTextBlur:function(e){this._$currentFocusText=null;var t=$(e.target);_.delay(function(){t.is(":focus")||t.removeClass("changed")},250);var i=t.closest(".faf-userdata-field"),n=i.find(".faf-grabber-block");n.data("touching")||(this._resumeInput(t,i),this._simulateFieldHover(i,!1)),this.$requiresCacheUpdate===!0&&(this._sendProfileCacheUpdate(),this.$requiresCacheUpdate=!1),r.offExternalEsc(this._loseFocusFromCategory)},_onTextFocus:function(e){r.onExternalEsc(this._loseFocusFromCategory),this._$currentFocusText=$(e.target)},_loseFocusFromCategory:function(){$(document.activeElement).blur()},_onChangeField:function(e){var t=this._findField(e).find("textarea:first"),i=t.val(),n=this.options.fafUserDataModel.getFieldText(e)||"";i!==n&&(t.val(n),t.trigger("input"))},_onManageClick:function(){_.defer(_.bind(function(){if("sign_menu"!==r.desktopNativeSignCommand()&&"sign_sync"!==r.desktopNativeSignCommand()&&"sign_dlg"!==r.desktopNativeSignCommand())try{this._tellReader("openSettingsDialogCommand")}catch(e){o.logError("faf-rhp-reader-view","Unexpected error while opening settimngs dialog: "+e)}},this))},_onKeyDown:function(e){return 27===e.which?!0:void 0},_escSettings:function(){i.appApi.dialogApi.closeAllDialogs()},_sendProfileCacheUpdate:function(){try{"sign_menu"!==r.desktopNativeSignCommand()&&"sign_sync"!==r.desktopNativeSignCommand()&&"sign_dlg"!==r.desktopNativeSignCommand()&&this._tellReader("setProfilesCache",[{fullname:$(".textarea-size")[0].innerHTML,firstname:$(".textarea-size")[1].innerHTML,middlename:$(".textarea-size")[2].innerHTML,lastname:$(".textarea-size")[3].innerHTML,street1:$(".textarea-size")[4].innerHTML,street2:$(".textarea-size")[5].innerHTML,city:$(".textarea-size")[6].innerHTML,state:$(".textarea-size")[7].innerHTML,zip:$(".textarea-size")[8].innerHTML,country:$(".textarea-size")[9].innerHTML,email:$(".textarea-size")[10].innerHTML,phone:$(".textarea-size")[11].innerHTML}])}catch(e){o.logError("faf-userdata-view","Unexpected error parsing categories: "+e)}},_addCategories:function(){try{var e=this.options.fafUserDataModel.getProfile("default");_.isObject(e)&&($(".faf-Reader").removeClass("faf-cacheLoad"),this.$el.find(".faf-userdata-panel > ul").empty(),this._each(e.value,_.bind(function(e){this._addCategory(e)},this)),e.value&&e.value.length>0&&this._onChromeLoaded(),this._sendProfileCacheUpdate())}catch(t){o.logError("faf-userdata-view","Unexpected error parsing categories: "+t)}},_addCategory:function(e){if(e&&"signature"!==e.key){var t=$(this._categoryTemplate({categoryKey:this._buildKey(e),categoryName:this._uiName(e)})),i=this._buildKey(e),n=this._handleLocale(e.value,i);return this._each(n,_.bind(function(e){/group_([^.])+/.test(e.key)?this._addGroup(i,e,t):this._addField(i,e,t)},this)),this.$el.find(".faf-userdata-panel > ul").append(t),t}},_addGroup:function(e,t,i){var n=$(this._groupTemplate({groupKey:this._buildKey(e,t),addValueText:this._uiName(this._buildKey(e,"add"),t)})),s=n.find("textarea");s.attr("placeholder",this._uiName(this._buildKey(e,"new"),t)),this._placeholder(s);var a=this._uiName(e,t);a&&1===i.children().length&&s.val(a),s.bind("textchange",_.bind(this._onTextChange,this));var r=n.find("ul"),l=this._buildKey(e,t),d=this._handleLocale(t.value,l);return this._each(d,_.bind(function(e){/group_([^.])+/.test(e.key)?o.logError("faf-userdata-view","Unexpected group: "+e.key):this._addField(l,e,r)},this)),this.enablePremium||n.find(".faf-userdata-group-add-value").addClass("faf-hide"),i.append(n),n},_addField:function(e,t,i){if(t){var n=this._uiName(e,t),s=$(this._fieldTemplate({fieldKey:this._buildKey(e,t)})),o=s.find("textarea");return o.attr("placeholder",n),this._placeholder(o),t.text?o.val(t.text):s.addClass("empty"),o.bind("textchange",_.bind(this._onTextChange,this)),s.find(".textarea-size").html(_.escape(o.val()||n)),this._enableDrag(s),i.append(s),s}},_placeholder:function(e){if(e.attr("placeholder")&&(!o.supportsPlaceholder()||"MSIE"===o.browserAndVersion()[0]||"Firefox"===o.browserAndVersion()[0])){var t=$('<span class="faf-userdata-placeholder">'+e.attr("placeholder")+"</span>");e.removeAttr("placeholder"),e.before(t),t.click(function(){e.focus()}),e.bind("textchange",function(e){var t=$(e.currentTarget),i=t.prevAll(".faf-userdata-placeholder");i.length&&(t.val()?i.addClass("faf-hide"):i.removeClass("faf-hide"))}),_.delay(function(){e.trigger("textchange")},100)}},_uiName:function(e,t){var i;return _.isObject(e)?(i=this._buildKey(e),t=e):i=this._buildKey(e,t),i="UserData."+i.replace(/\.group_.+\./g,".").replace(/\.(add|new)\.group_[^.]+$/g,".$1"),t&&t.label?t.label:u[i]?u[i]:""},_handleLocale:function(e,t){var n=[],s=this.options.fafUserDataModel,o=(this._orderKeys[i.appApi.localeApi.getLocale()]||{})[t.split(".")[0]];return _.each(o,function(e){var i=t+"."+e,o=s.getObject(i);o&&n.push(o)}),_.isEmpty(n)?e:n},_buildKey:function(e,t){return _.isObject(e)?e.key:e+"."+(_.isObject(t)?t.key:t)},_getKey:function(e){return e.attr("data-key")},_findField:function(e){return this.$el.find('[data-key="'+e+'"]')},_escToDrag:function(){this._dragAborted=!0},_enableDrag:function(e){var t=e.find(".faf-grabber-block");t.draggable({cursor:"pointer",appendTo:".faf-edit-form-form-container",disabled:e.is(".empty"),start:_.bind(function(e){i._fafFormView.overrideCursor($(e.srcElement).css("cursor")),r.onExternalEsc(this._escToDrag)},this),drag:_.bind(function(){return!this._dragAborted},this),helper:_.bind(function(e){return},this),stop:_.bind(function(){},this)}),o.handleTouchEventAsMouseEvent(t)},_each:function(e,t){_.isArray(e)?_.each(e,t):_.isObject(e)&&t(e)}}),h.mixin(i.FafUserDataView),i.FafUserDataView}),define("fss/js/views/reader/faf-reader-autocomplete-helper-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/reader/faf-reader-js-wrapper","fss/js/views/faf-autocomplete-signature-item-view"],function(e,t,i,n,s,o,a){var r=".faf-rhp-achelper",l=2,d="faf_ac_sign_item",f="faf_ac_init_item",c=new RegExp("([\\^\\$\\*\\+\\\\?\\.(\\){}\\[\\]\\!\\=\\:\\|\\\\])","g"),u=" \\t\\n\\r -@\\[-`\\{-\\~　-〿＀-＠［-｀｛-｠｡-･￠-￯׀׃׆׳״؉؊،؍؛؛؞؟٪-٭۔๏๚๛꫞꫟";return t.FafRdrAutocompleteHelperView=e.View.extend({initialize:function(){var t=0===this.$el.children().length;t&&(e.View.prototype.initialize.call(this),this._acDone=!1,this._acModel=this.options.fafAutocompleteModel,this._acStateModel=this.options.fafAutocompleteStateModel,this._$input=$("<input>").attr({type:"hidden",id:"ac-helper-input",name:"bar"}).appendTo(r),_.bindAll(this,"_addAC","_updateSource","setInput"),this._$input.data("fafAutocomplete",this),this._$input.addClass("faf-autocomplete-input"),this._acStateModel.getState().then(this._addAC),this.listenTo(this._acModel,"getACSuggestionList",this.setInput),$(".faf-rhp-achelper").hide())},setInput:function(){this._acDone?(this._$input.val(this._acModel.acHelperViewInput),this._updateSource()):(console.log("error ac not added in helper view"),a.sendAutoCompleteSuggestions([]))},_addAC:function(){this._$input.autocomplete({delay:1,minLength:this._fcPredictions||this._isSignatureField?0:l,source:[],messages:{noResults:"",results:function(){}},appendTo:$(r),position:{at:"left bottom",my:"left top"},response:_.bind(this._acResponse,this)}),this._updateSource(),this.listenTo(this._acModel,"change:source",_.bind(function(){this._updateSource()},this)),this.listenTo(this._acModel,"change:ac_s",_.bind(function(){var e=this._acStateModel.get("ac_s");e?(this._$input.autocomplete("enable"),this._$input.autocomplete("search")):this._$input.autocomplete("disable")},this)),this._$input.autocomplete("enable"),this._$input.autocomplete("search"),this._acDone=!0},render:function(){this._updateSource()},_updateSource:function(){this._acModel.sourcePromise().then(_.bind(function(){var e=this._acModel.get("source")||[];this._fcPredictions&&(e=_.clone(e).concat(this._fcPredictions)),this._isSignatureField&&(e=_.clone(e),e.unshift({id:30001,value:d})),this._isInitialsField&&(e=_.clone(e),e.unshift({id:30002,value:f})),this._$input.autocomplete({source:e}),this._acModel.searchForNewSuggestions===!0&&this._$input.autocomplete("search")},this))},remove:function(){try{this._removeSignatureOptions(),this._$input.autocomplete("destroy")}catch(t){s.logError("autocomplete","Autocomplete destroy  threw")}e.View.prototype.remove.call(this)},_acResponse:function(e,t){var n=this._$input.val();if(this._$input.data(i.FAF_INPUT_UNCHANGED_KEY))return void t.content.splice(0,t.content.length);for(var s=n.replace(c,"\\$&"),o=new RegExp("^"+s+".*","i"),r=new RegExp(".*["+u+"]"+s+".*","mi"),d=0;d<t.content.length;){var f=t.content[d],h=f.value;[30001,30002].indexOf(f.id)>-1&&""===n?(f.sortVal=30001===f.id?"0000":"0001",d++):n.trim().length<l&&!f.score?t.content.splice(d,1):o.test(h)?(f.sortVal=(f.score?"000":f.udata?"001":"010")+h,d++):r.test(h)?(f.sortVal=(f.score?"011":f.udata?"110":"111")+h,d++):t.content.splice(d,1)}for(t.content.sort(function(e,t){if(!e.udata&&!t.udata&&e.sortVal.substring(0,3)===t.sortVal.substring(0,3)){var i=t.count-e.count;if(e.score&&t.score)return t.score-e.score;if(i)return i}return e.sortVal.localeCompare(t.sortVal)}),d=1;d<t.content.length;){var p=t.content[d];if(p.udata){if(d++,d>=5)break}else{for(var g=p.value,_=!1,m=0;d>m;m++)if(g===t.content[m].value){_=!0;break}if(_)t.content.splice(d,1);else if(d++,d>=5)break}}t.content.length>=5&&t.content.splice(5,t.content.length-5);var v=[];for(d=0;d<t.content.length;d++)v.push(t.content[d].id);a.sendAutoCompleteSuggestions(t.content)},_excludeClick:function(e){if(1===e.which){var t=$(e.currentTarget).closest("li");t.css("display","none");var i=t.text(),s=$(e.currentTarget).closest("li").data("fafAutocomplete");s._acModel.excludeString(i);var o="Field:ACompl:Exclude";n.logEvent(null,o,o),e.preventDefault(),e.stopPropagation()}}}),t.FafRdrAutocompleteHelperView}),define("aictools/nls/ui-strings",{root:!0,"xx-xx":!0,"de-de":!0,"en-gb":!0,"es-es":!0,"fr-fr":!0,"it-it":!0,"ja-jp":!0,"da-dk":!0,"fi-fi":!0,"nb-no":!0,"nl-nl":!0,"pt-br":!0,"sv-se":!0,"bg-bg":!0}),define("aictools/nls/root/ui-strings",{CONVERT_TO_PDF:"Convert to PDF",CREATE_PDF:"Create PDF",EXPORT_PDF:"Export PDF",COMBINECONVERT_PDF:"Convert PDF",CREATE_A_PDF:"Create a PDF",CREATE_A_PDF_AV2:" ",CONVERT_TOOL_VIEW_TITLE:"Convert images and files to PDF",CONVERT_TOOL_VIEW_TITLE_AV2:"Create PDFs from images, Microsoft Office files, and more",CPDF_IPP_LINK2:"Download CreatePDF Desktop Tool",CPDF_SELECT_FILE:"Select Files to Convert to PDF",CPDF_SELECT_FILE_AV2:"Select Files",CREATEPDF_SELECT_FILES_FILTERING_TEXT:"File Type is not: Adobe PDF",EXPORT_STATUS_TITLE:"Exported Files",CONVERT_STATUS_TITLE:"Converted Files",CREATE_FROM_AX_TEMPLATE_TITLE:"Start from an Adobe Express template",CREATE_FROM_AX_TEMPLATE_DESC:"Create content from thousands of professionally designed templates for free.",CREATE_FROM_AX_TEMPLATE_FLYERS:"Flyers",CREATE_FROM_AX_TEMPLATE_LOGOS:"Logos",CREATE_FROM_AX_TEMPLATE_CALENDARS:"Calendars",CREATE_FROM_AX_TEMPLATE_INVOICES:"Invoices",GET_AX_BUTTON_TEXT:"All templates",AX_LOGO_TEXT:"Powered by Adobe Express",GET_AX_BUTTON_ARIA_LABEL:"Explore all templates online",CREATE_FROM_AX_TEMPLATE_ARIA_LABEL:"Explore <%= template_cat %> templates in Adobe Express online",CREATE_FROM_AX_TEMPLATE_FLYER_AL:"flyer",CREATE_FROM_AX_TEMPLATE_LOGO_AL:"logo",CREATE_FROM_AX_TEMPLATE_CALENDAR_AL:"calendar",CREATE_FROM_AX_TEMPLATE_INVOICE_AL:"invoice",EXPORT_FROM_PDF:"Export From PDF",EXPORT_TOOL_VIEW_TITLE:"Convert PDF files to Word, Excel and other formats",EXPORT_TOOL_VIEW_EXPERIMENT_TITLE:"Convert PDF files to Powerpoint or other formats",EXPORT_SELECT_FILE:"Select PDF Files to Export",EXPORTPDF_SELECT_FILES_FILTERING_TEXT:"File Type: PDF",EXPORT_TOOL_VIEW_EXPERIMENT_GOURL:"https://www.adobe.com/go/rdr_dynamictool_epdf",CONVERT_FROM_PDF:"Convert From PDF",CONVERT_SELECT_FILE:"Select PDF Files to Convert",OK:"OK",CANCEL:"Cancel",CLOSE:"Close",CONTINUE:"Continue",PROCEED:"Proceed",SUCCESS:"Success",BTN_COMBINE:"Combine",CPDF_ADD_FILES:"Add Files To Convert",BTN_EXPORT:"Export to PDF",BTN_DOWNLOAD:"Download",CONVERTING:"Converting  <%= filename %>...",NOT_ON_MAC:"Not Available on Mac",GENERIC_READER_ERR_TITLE_FAILED:'Unsupported file type: "<%= names %>"',GENERIC_READER_ERR_BODY_FAILED:"Select another file and try again",CPDF_ERR_TITLE_FAILED_TO_CONVERT:'"<%= name %>" failed to convert to PDF.',CPDF_ERR_TITLE_FAILED_TO_UPLOAD:'"<%= name %>" failed to be uploaded.',CPDF_ERR_TITLE_UPLOAD_TOO_LARGE:'"<%= name %>" exceeds the limit of 100 MB.',CPDF_ERR_TITLE_UPLOAD_IS_EMPTY:'"<%= name %>" is an empty file.',CPDF_ERR_TITLE_UNSUPPORTED_TYPE:'"<%= name %>" is in a format not supported for conversion to PDF.',CPDF_ERR_TITLE_UNKNOWN_TYPE:'The file type of "<%= name %>" is not known, and therefore cannot be converted to PDF.',CPDF_ERR_TITLE_UNSUPPORTED_TYPES:"Some of the files you have selected cannot be converted to PDF and have been excluded.",CPDF_ERR_TITLE_UNKNOWN_TYPES:'The file types of "<%= names %>" are not known, and therefore cannot be converted to PDF.',CPDF_ERR_TITLE_STORAGE_LIMIT_EXCEEDED:'"<%= name %>" failed to convert to PDF because storage limit was exceeded.',CPDF_ERR_BODY_UPLOAD_FAILED:"Something went wrong while uploading the file.",CPDF_ERR_BODY_UPLOAD_TOO_LARGE_IPP:"Select a smaller file or use the PDF printer for Windows to convert the file.",CPDF_ERR_BODY_UPLOAD_TOO_LARGE:"Select a smaller file.",CPDF_ERR_BODY_UPLOAD_IS_EMPTY:"Select a file larger than 0 bytes.",CPDF_ERR_BODY_VIRUS_DETECTED:"The file contains a virus.",CPDF_ERR_BODY_TIMEOUT:"The file is either too large or too complex to convert.",CPDF_ERR_BODY_DOCUMENT_CORRUPTED:"The file appears to be corrupted.",CPDF_ERR_BODY_SOURCE_IS_ENCRYPTED:"The document is password protected.",CPDF_ERR_BODY_STORAGE_LIMIT_EXCEEDED:"Please back up and delete some of your online files and try again.",CPDF_ERR_BODY_OTHER_ERRORS_WIN:"You can try the file again or use the PDF printer for Windows to convert the file.",CPDF_ERR_BODY_OTHER_ERRORS_OTHER:"There was an unexpected problem. Please try again later.",CPDF_ERR_BODY_UNSUPPORTED_EXT:"The file is in a format not supported for conversion to PDF.",CPDF_ERR_BODY_UNSUPPORTED_EXTS:"The files are in formats not supported for conversion to PDF.",CPDF_ERR_BODY_UNSUPPORTED_TYPE:"You can save the file to one of the supported formats or use the PDF printer for Windows to convert the file. For a list of supported file formats <a href='<%= linkRef %>' target='_blank'>click here</a>.",CPDF_ERR_BODY_UNSUPPORTED_TYPES:"For a list of supported file types, <a href='<%= linkRef %>' target='_blank'>click here</a>.",CPDF_ERR_BODY_UNKNOWN_TYPE:"The uploaded file is missing an extension. Please ensure that the uploaded file has the correct extension.",CPDF_ERR_BODY_UNKNOWN_TYPES:"The uploaded files are missing extensions. Please ensure that the uploaded files have the correct extension.",CPDF_ERR_BODY_ALREADYPDF_FILE:"The file selected is already in PDF format. Input file types to Create PDF cannot be PDF. For a list of supported file types, <a href='<%= linkRef %>' target='_blank'>click here</a>.",CPDF_ERR_BODY_ALREADYPDF_FILES:"The files selected are already in PDF format. Input file types to Create PDF cannot be PDF. For a list of supported file types, <a href='<%= linkRef %>' target='_blank'>click here</a>.",EPDF_DLG_RECOGNIZE_TEXT_IN:"Document Language (for Text Recognition)",EDPF_DLG_OCR_TOOLTIP:"Use Optical Character Recognition (OCR) to convert any scanned text to editable text. Click to learn more.",EPDF_EXPORT_FORMAT:"Convert To",EPDF_EXPORT_FORMAT_TIP:"All Files will be converted to the selected format.  To use different formats, export each file individually.",EPDF_ADD_FILES:"Add Files To Export",SELECTED_FILES:"Selected Files",EPDF_DLG_IMAGE_CHOICE:"Image (*.jpg, *.tiff, *.png)",EPDF_DLG_IMAGE_FORMAT:"Image Format",EPDF_DLG_IMAGE_QUALITY:"Image Quality",EPDF_DLG_IMAGE_TOOLTOP:"Each page will be converted to an image - all of which will be saved to a single .zip file for a single easy download.",EPDF_DLG_IMAGE_SMALLTIP:"Smaller File Size",EPDF_DLG_IMAGE_LARGETIP:"Larger File Size",EPDF_DLG_QUALITY_LOW:"Low",EPDF_DLG_QUALITY_MED:"Med",EPDF_DLG_QUALITY_MEDIUM:"Medium",EPDF_DLG_QUALITY_HIGH:"High",EPDF_DLG_QUALITY_MIN:"Min",EPDF_DLG_QUALITY_MAX:"Max",EPDF_FORMAT_MICROSOFT_EXCEL:"Microsoft Excel",EPDF_FORMAT_MICROSOFT_POWERPOINT:"Microsoft PowerPoint",EPDF_FORMAT_MICROSOFT_WORD:"Microsoft Word",EPDF_FORMAT_RICH_TEXT_FORMAT:"Rich Text Format",EPDF_BUTTON_TITLE_PDF:"Export from PDF",EPDF_BUTTON_TITLE_WORD:"Export to Word",EPDF_BUTTON_TITLE_EXCEL:"Export to Excel",EPDF_BUTTON_TITLE_POWERPOINT:"Export to PowerPoint",EPDF_BUTTON_TITLE_RTF:"Export to RTF",EPDF_BUTTON_TITLE_IMAGE:"Export to Image",EPDF_BUTTON_TITLE_JPG:"Export to JPEG",EPDF_BUTTON_TITLE_TIFF:"Export to TIFF",EPDF_BUTTON_TITLE_PNG:"Export to PNG",CCPDF_ADD_FILES:"Add Files To Convert",CCPDF_BUTTON_TITLE_PDF:"Convert from PDF",CCPDF_BUTTON_TITLE_WORD:"Convert to Word",CCPDF_BUTTON_TITLE_EXCEL:"Convert to Excel",CCPDF_BUTTON_TITLE_POWERPOINT:"Convert to PowerPoint",CCPDF_BUTTON_TITLE_RTF:"Convert to RTF",CCPDF_BUTTON_TITLE_IMAGE:"Convert to Image",CCPDF_BUTTON_TITLE_JPG:"Convert to JPEG",CCPDF_BUTTON_TITLE_TIFF:"Convert to TIFF",CCPDF_BUTTON_TITLE_PNG:"Convert to PNG",EPDF_ERR_TITLE_FAILED_TO_EXPORT:'"<%= name %>" failed to export to <%= format %>.',EPDF_ERR_TITLE_FAILED_TO_EXPORT_NO_FORMAT:'"<%= name %>" failed to export.',EPDF_ERR_TITLE_FAILED_TO_EXPORT_NO_FORMAT_N:'"<%= names %>" failed to export.',EPDF_ERR_TITLE_PDF_IS_PORTFOLIO:'"<%= name %>" is a PDF Portfolio and cannot be exported.',EPDF_ERR_TITLE_SOURCE_IS_ENCRYPTED:'"<%= name %>" is password protected and cannot be exported.',EPDF_ERR_TITLE_STORAGE_LIMIT_EXCEEDED:'"<%= name %>" failed to export to <%= format %> because storage limit was exceeded.',EPDF_ERR_BODY_UPLOAD_TOO_LARGE:"Select a smaller file for export.",EPDF_ERR_BODY_UNSUPPORTED_TYPE:"The file is not a PDF file.",EPDF_ERR_BODY_UNSUPPORTED_TYPE_N:"The files are not PDF files.",EPDF_ERR_BODY_TIMEOUT:"The file is either too large or too complex to export.",EPDF_ERR_BODY_DOCUMENT_CORRUPTED:"The file appears to be corrupted.",EPDF_ERR_BODY_CONVERSION_FAILED:"The file is either corrupt or protected and cannot be opened for export.",EPDF_ERR_BODY_SOURCE_IS_ENCRYPTED:"To export this document, remove the protection and try again.",EPDF_ERR_BODY_STORAGE_LIMIT_EXCEEDED:"Please back up and delete some of your online files and try again.",EPDF_ERR_BODY_PDF_IS_PORTFOLIO:"To convert an individual file from the portfolio, extract it and export that file.",EPDF_ERR_BODY_PDF_POLICY_PROTECTED:"The file's security settings do not allow export.",EPDF_ERR_BODY_PDF_NO_TABLES:"This PDF file does not contain recognizable data to be exported to Excel. If the PDF file is a scanned document, enabling text recognition (OCR) may help make data recognizable.",EPDF_ERR_XFA_PDF:"PDF files containing XFA forms cannot be saved to the specified format.",EPDF_ERR_BODY_OTHER_ERRORS:"There was an unexpected problem.",EPDF_ERR_CONVERSION_FAIL_PPTX:"*Conversion to PPTX is not supported in your current subscription plan. You can upgrade to get this",EPDF_ERR_CONVERSION_FAIL_IMAGE:"*Conversion to Image is not supported in your current subscription plan. You can upgrade to get this",UNKNOWN_ERROR_TITLE:"The file has not been processed.",UNKNOWN_ERROR_BODY:"An error has occurred which stopped the processing of the PDF.",BLANK_ERROR:"",ENTERPRISE_USERS_ACCESS_ERROR:"You do not have access to this service. Please contact your IT Administrator to gain access, or try to sign in with an Adobe ID.",ENCRYPTION_KEY_DISABLED_ERROR:"The encryption key has been revoked and this content is no longer available. Please contact your administrator to re-enable the encryption key and check back again.",CHANGE:"Change",RHP_CPDF_ADD_FILES:"Select File to Convert to PDF",RHP_SELECT_FILE:"Select File",RHP_BUTTON_CONVERT:"Convert",RHP_EPDF_DLG_RECOGNIZE_TEXT_IN:"Document Language:",RHP_EPDF_ADD_FILES:"Select PDF File",RHP_EPDF_EXPORT_FORMAT:"Convert to",RHP_EPDF_EXPORT_IMAGE_QUALITY:"Image Quality",READER_PDF_FILTER_DESC:"Adobe PDF files",READER_CPDF_FILTER_DESC:"All supported files",READER_CHOOSE_FILES:"Select Files",READER_CHOOSE_FILE:"Select File",READER_OPEN:"Continue",RHP_DOC_CLOUD:"Adobe's cloud storage",RHP_VIEW_CONVERTED_FILES:"View <%= name %> Files",RHP_EPDF_SERVICE_TITLE:"Adobe Export PDF",RHP_CPDF_SERVICE_TITLE:"Adobe PDF Pack",RHP_EPDF_EXPERIMENT_SERVICE_TITLE:"Adobe Convert PDF",RHP_EPDF_SERVICE_DESCRIPTION:"Convert PDF Files to Word or Excel Online",RHP_CPDF_SERVICE_DESCRIPTION:"Convert files to PDF and easily combine them with other file types with a paid subscription",RHP_EPDF_SERVICE_TOOLTIP:"Go to Adobe ExportPDF",RHP_EPDF_EXPERIMENT_SERVICE_TOOLTIP:"Go to Adobe Convert PDF",RHP_CPDF_SERVICE_TOOLTIP:"Go to Adobe PDF Pack",RHP_CPDF_SERVICE_DESCRIPTION_URL:"http://www.adobe.com/go/cpdfrhprdr5_12_0_0",RHP_EPDF_SERVICE_DESCRIPTION_URL:"http://www.adobe.com/go/epdfrhprdr7_12_0_0",RHP_EPDF_EXPERIMENT_SERVICE_DESCRIPTION_URL:"http://www.adobe.com/go/epdfrhprdricn_20_0",READER_EPDF_DOCX_SIGNUP_URL:"http://www.adobe.com/go/epdfrdr1_12_0_0",READER_EPDF_XLSX_SIGNUP_URL:"http://www.adobe.com/go/epdfrdr2_12_0_0",READER_EPDF_PPTX_SIGNUP_URL:"http://www.adobe.com/go/epdfrdr3_12_0_0",READER_EPDF_IMAGE_SIGNUP_URL:"http://www.adobe.com/go/epdfrdr_img_19_0_0",READER_EPDF_OTHER_SIGNUP_URL:"http://www.adobe.com/go/epdfrdr5_12_0_0",READER_EPDF_FILE_MENU_SIGNUP_URL:"http://www.adobe.com/go/epdffmrdr_19_0_0",READER_EPDF_FIRST_MILE_SIGNUP_URL:"http://www.adobe.com/go/epdf_hv_rdr_19_0_0",READER_EPDF_NEW_RCM_SIGNUP_URL:"https://www.adobe.com/go/epdfrcmrdr_21",READER_EPDF_TOPTOOLBAR_SIGNUP_URL:"https://www.adobe.com/go/epdf_tb_rdr_22",READER_CPDF_SIGNUP_URL:"http://www.adobe.com/go/cpdfrdr_12_0_0",READER_CPDF_FIRST_MILE_SIGNUP_URL:"http://www.adobe.com/go/cpdf_hv_rdr_19_0_0",READER_PPTX_EXPORT_UPSELL_URL:"http://www.adobe.com/go/epdfrdr2_PPTX_12_0_0",READER_PPTX_EXPORT_UPSELL_URL_RHP:"http://www.adobe.com/go/epdfrhprdr5_PPTX_12_0_0",READER_CCPDF_DOCX_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr1_12_0_0",READER_CCPDF_XLSX_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr2_12_0_0",READER_CCPDF_PPTX_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr3_12_0_0",READER_CCPDF_OTHER_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr5_12_0_0",READER_CCPDF_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr4_12_0_0",READER_PPTX_CONVERT_UPSELL_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr5_PPTX_12_0_0",READER_CCPDF_DOCX_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr1_12_0_0",READER_CCPDF_XLSX_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr2_12_0_0",READER_CCPDF_PPTX_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr3_12_0_0",READER_CCPDF_IMAGE_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr_img_19_0_0",READER_CCPDF_OTHER_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr5_12_0_0",READER_CCPDF_FIRST_MILE_SIGNUP_URL_EXPORT:"http://www.adobe.com/go/cnvrtpdf_hv_rdr_19_0_0",READER_CCPDF_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr_12_0_0",READER_CCPDF_FIRST_MILE_SIGNUP_URL_CREATE:"http://www.adobe.com/go/cnvrtpdf2_hv_rdr_19_0_0",READER_PPTX_CONVERT_UPSELL_URL:"http://www.adobe.com/go/cnvrtpdfrdr2_PPTX_12_0_0",READER_RENAME_EPDF_OTHER_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr5_20_0_0",READER_RENAME_EPDF_DOCX_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr1_20_0_0",READER_RENAME_EPDF_XLSX_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr2_20_0_0",READER_RENAME_EPDF_PPTX_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr3_20_0_0",READER_RENAME_EPDF_IMAGE_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdfrdr_img_20_0_0",READER_RENAME_EPDF_FIRST_MILE_SIGNUP_URL:"http://www.adobe.com/go/cnvrtpdf_hv_rdr_20_0_0",READER_PPTX_RENAME_EPDF_UPSELL_URL:"http://www.adobe.com/go/cnvrtpdfrdr2_PPTX_20_0_0",READER_RENAME_EPDF_PPTX_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr3_20_0_0",READER_RENAME_EPDF_XLSX_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr2_20_0_0",READER_RENAME_EPDF_DOCX_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr1_20_0_0",READER_RENAME_EPDF_OTHER_SIGNUP_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr5_20_0_0",READER_PPTX_RENAME_EPDF_UPSELL_URL_RHP:"http://www.adobe.com/go/cnvrtpdfrhprdr5_PPTX_20_0_0",GET_AX_GOURL:"https://www.adobe.com/go/ax_cta_rdr_22",CREATE_FROM_AX_TEMPLATE_FLYERS_URL:"https://www.adobe.com/go/ax_fly_rdr_22",CREATE_FROM_AX_TEMPLATE_LOGOS_URL:"https://www.adobe.com/go/ax_log_rdr_22",CREATE_FROM_AX_TEMPLATE_CALENDARS_URL:"https://www.adobe.com/go/ax_cal_rdr_22",CREATE_FROM_AX_TEMPLATE_INVOICES_URL:"https://www.adobe.com/go/ax_inv_rdr_22",COMBINE_INTO_PDF:"Combine into PDF",COMBINE_FILES_TITLE:"Merge images and files into a single PDF.",COMBINE_SELECT_FILE:"Select Files to Combine",COMBINE_STATUS_TITLE:"Combined Files",ORGANIZE_STATUS_TITLE:"Edited Files",DOWNLOAD_ALL:"Download All",COMBINE_SELECT_FILES_FILTERING_TEXT:"File Type: can be combined",ADD_FILES:"Add Files...",INSERT_FILE:"Insert File...",COMBINE_PDF:"Combine Files",EAMES:"Acrobat",APP_FC_FOR_EAMES:"Create a Form",ORGANIZE_PAGES:"Organize Pages",ORGANIZE_PDF_PAGES:"Organize Pages",ORGANIZE_FILES_TITLE:"Rotate, Delete & Insert Pages",ORGANIZE_SELECT_FILE:"Select File to Organize",ORGANIZE_SELECT_FILE_FILTERING_TEXT:"File Type: can organize pages",SELECT_PAGES:"Select Pages",EVEN_PAGES:"Even Pages",ODD_PAGES:"Odd Pages",LANDSCAPE_PAGES:"Landscape Pages",PORTRAIT_PAGES:"Portrait Pages",ALL_PAGES:"Select All",ROTATE_LEFT:"Rotate Left",ROTATE_RIGHT:"Rotate Right",SAVE:"Save",BEFORE_FIRST_PAGE:"Insert Before First Page",BEFORE_SELECTION:"Insert Before Selection",AFTER_SELECTION:"Insert After Selection",AFTER_LAST_PAGE:"Insert After Last Page",SAVE_AS_NEW_FILE:"(Save as new file)",SAVE_EXISTING:"(Save as existing file)",SAVE_AS:"Save As",SAVE_AS_OTHER:"Other",ORGANIZE_TOO_MANY_PAGES:"Too many pages",ORGANIZE_PAGE_LIMIT:"This file has too many pages (<%= n_pages %>) to be processed (maximum <%= max_pages %> pages). <%= use_acrobat %>",ORGANIZE_FILE_LIMIT:"You may insert a maximum of 11 files. <%= use_acrobat %>",ORG_WITH_ACROBAT_FOR_PAGE_LIMIT:"Use the desktop version of Acrobat to work with documents greater than <%= max_pages %> pages",ORG_WITH_ACROBAT_FOR_FILE_LIMIT:"Use the desktop version of Acrobat to insert more than 12 files",ORGANIZE_ERR_TITLE_TOO_MANY_FILES:"Too many files to organize",EAMES_ADOBE_ACROBAT_SUBSCRIPTION_PLUS:"Adobe Acrobat Pro",EAMES_ADOBE_ACROBAT_SUBSCRIPTION_STANDARD:"Adobe Acrobat Standard",EAMES_DO_MORE_WITH_YOUR_PDF_DOCUMENTS:"Do more with your PDF documents and forms.",EAMES_GET_ACROBAT_XI_PRO_SOFTWARE:"Get Acrobat XI Pro software, ExportPDF, PDF Pack, and FormsCentral – all in one monthly subscription.",EAMES_SUBSCRIPTION_LENGTH_ONE_TEXT:"Annual",EAMES_SUBSCRIPTION_RATE_PER_TIME_UNIT_ONE_TEXT:"/mo.",EAMES_SUBSCRIPTION_FOOTNOTE_ONE_MARKER:"",EAMES_SUBSCRIPTION_FOOTNOTE_ONE_TEXT:"Annual commitment required",EAMES_SIGN_UP_BUTTON_ONE_TEXT:"Upgrade Now",EAMES_SUBSCRIPTION_LENGTH_TWO_TEXT:"Monthly",EAMES_SUBSCRIPTION_RATE_PER_TIME_UNIT_TWO_TEXT:"/mo.",EAMES_SUBSCRIPTION_FOOTNOTE_TWO_MARKER:"",EAMES_SUBSCRIPTION_FOOTNOTE_TWO_TEXT:"",EAMES_SIGN_UP_BUTTON_TWO_TEXT:"Upgrade Now",EAMES_SIGN_UP_SYSTEM_REQUIREMENTS_TEXT:"System Requirements >",EAMES_HEADER_ROW_COL_TWO_TABLE_TEXT_CPDF:"Adobe PDF Pack",EAMES_HEADER_ROW_COL_TWO_TABLE_TEXT_EPDF:"Adobe ExportPDF",EAMES_HEADER_ROW_COL_TWO_TABLE_TEXT_SPDF:"Adobe CreatePDF",EAMES_HEADER_ROW_COL_TWO_TABLE_TEXT_FREE:"Acrobat.com Files",EAMES_HEADER_ROW_COL_TWO_TABLE_TEXT_FCENTTRAL:"FormsCentral",EAMES_HEADER_ROW_COL_THREE_TABLE_TEXT:"Adobe Acrobat Pro",EAMES_CONVERT_OFFICE_AND_IMAGE_FILES:"Convert Office and image files to PDF",EAMES_CHECK_MARK:"✓",EAMES_EXPORT_PDFS_TO_WORD:"Export PDFs to Word and Excel",EAMES_COMBINE_MULTIPLE_FILES:"Combine multiple files into a single PDF",EAMES_EDIT_TEXT_AND_IMAGES:"Edit text and images in PDF files",EAMES_ADD_COMMENTS_AND_MARK_UPS:"Add comments and mark-ups to PDF files",EAMES_CREATE_PDF_AND_WEB_FORMS:"Create PDF and web forms and see results in real-time",EAMES_SIGN_PDF_FILES_YOURSELF:"Sign PDF files yourself and send files for signature",EAMES_SOFTWARE_DOWNLOAD_AND_INSTALL:"Software download and install",EAMES_FILE_STORAGE:"File storage",EAMES_5_GB:"5 GB",EAMES_10_GB:"10 GB",EAMES_50_GB:"50 GB",EAMES_100_GB:"100 GB",EAMES_GET_STARTED_BY_DOWNLOADING:"Download your software to get started.",EAMES_SUBSCRIPTION_ENTITLEMENT:"You may install Acrobat Pro software on two computers. Download your software to install.",EAMES_SUBSCRIPTION_ENTITLEMENT_STANDARD:"You may install Acrobat Standard software on two computers. Download your software to install.",EAMES_DOWNLOAD_ACROBAT_PRO:"Download Now",EAMES_DOWNLOAD_BUTTON_TEXT:"Download Now",EAMES_GO_MOBILE:"Go mobile",EAMES_MOBILE_DOWNLOADS:"Mobile downloads",EAMES_READER_MOBILE_LINK_TEXT:"Adobe Reader >",EAMES_GET_READER_FOR_IOS:"Get the Adobe Reader mobile app to access the tools you need to work on the go.",EAMES_GET_IT_NOW:"Get it now >",EAMES_SUPPORT:"Support",EAMES_ACCESS_OUR_DISCUSSION_FORUM:"Access our discussion forum to get answers to your most frequently asked questions.",EAMES_CREATE_FORM_TITLE:"Create a Form",EAMES_CREATE_FORM_SUBTITLE:"Build a PDF or Web Form",EAMES_OPEN_FORMS_CENTRAL:"Open FormsCentral >",EAMES_GET_HELP:"Get help >",EAMES_FIRST_TIME_TIP_ONE_TITLE_TEXT:"Edit Text and Images",EAMES_FIRST_TIME_TIP_ONE_TITLE_TEXT_STANDARD:"Create PDF files",EAMES_FIRST_TIME_TIP_ONE_SUBTITLE_TEXT:"See how easy it is to edit PDF files. (1:06)",EAMES_FIRST_TIME_TIP_ONE_SUBTITLE_TEXT_STANDARD:"Find out how you can turn any document or image into a PDF.",EAMES_FIRST_TIME_TIP_ONE_SUBTITLE_LINK_TEXT:"PDF, 215KB",EAMES_FIRST_TIME_TIP_TWO_TITLE_TEXT:"Create PDF and web forms",EAMES_FIRST_TIME_TIP_TWO_TITLE_TEXT_STANDARD:"Convert PDFs to Office",EAMES_FIRST_TIME_TIP_TWO_SUBTITLE_TEXT:"Get started in minutes, view results in real time. (1:28)",EAMES_FIRST_TIME_TIP_TWO_SUBTITLE_TEXT_STANDARD:"Learn how to save PDFs as editable Word or Excel files.",EAMES_FIRST_TIME_TIP_TWO_SUBTITLE_LINK_TEXT:"PDF, 131KB",EAMES_FIRST_TIME_TIP_THREE_TITLE_TEXT:"Add security to PDFs",EAMES_FIRST_TIME_TIP_THREE_TITLE_TEXT_STANDARD:"Edit PDFs",EAMES_FIRST_TIME_TIP_THREE_SUBTITLE_TEXT:"Protect PDF files with passwords and permissions. (1:14)",EAMES_FIRST_TIME_TIP_THREE_SUBTITLE_TEXT_STANDARD:"See how easy it is to edit text and images right in your PDF.",EAMES_FIRST_TIME_TIP_THREE_SUBTITLE_LINK_TEXT:"PDF, 232KB",EAMES_RETURNING_USE_MARKETING_TITLE_TEXT:"Do even more with PDF",EAMES_RETURNING_USE_MARKETING_SUBTITLE_TEXT:"Get Acrobat Pro software, online services, and Adobe FormsCentral. All for one monthly fee.",EAMES_RETURNING_USE_UPGRADE_NOW_LINK_TEXT:"Upgrade now >",EAMES_RETURNING_USE_TIP_ONE_TITLE_TEXT:"Gather form responses",EAMES_RETURNING_USE_TIP_ONE_TITLE_TEXT_STANDARD:"Combine files",EAMES_RETURNING_USE_TIP_ONE_SUBTITLE_TEXT:"Easily collect and analyze data from PDF or web forms with FormsCentral. (1:15)",EAMES_RETURNING_USE_TIP_ONE_SUBTITLE_TEXT_STANDARD:"Learn how to merge documents, emails, spreadsheets, and more in a single PDF.",EAMES_RETURNING_USE_TIP_ONE_DOWNLOAD_LINK_TEXT:"PDF, 327KB",EAMES_RETURNING_USE_TIP_TWO_TITLE_TEXT:"Sign PDF files electronically",EAMES_RETURNING_USE_TIP_TWO_TITLE_TEXT_STANDARD:"Sign PDFs",EAMES_RETURNING_USE_TIP_TWO_SUBTITLE_TEXT:"Add your electronic signature in seconds using Adobe Echosign. (1:21)",EAMES_RETURNING_USE_TIP_TWO_SUBTITLE_TEXT_STANDARD:"See how easy it is to add your electronic signature to any PDF.",EAMES_RETURNING_USE_TIP_TWO_DOWNLOAD_LINK_TEXT:"PDF, 162KB",EAMES_RETURNING_USE_TIP_THREE_TITLE_TEXT:"Streamline document reviews",EAMES_RETURNING_USE_TIP_THREE_TITLE_TEXT_STANDARD:"Scan paper to PDF",EAMES_RETURNING_USE_TIP_THREE_SUBTITLE_TEXT:"Share documents for review and collect comments in a single place. (1:13)",EAMES_RETURNING_USE_TIP_THREE_SUBTITLE_TEXT_STANDARD:"Find out how you can turn scans into PDFs you can edit and search.",EAMES_RETURNING_USE_TIP_THREE_DOWNLOAD_LINK_TEXT:"PDF, 130KB",EAMES_ERR_TITLE_NOT_AN_EAMES_USER:"Unauthorized user.",EAMES_ERR_BODY_NOT_AN_EAMES_USER:"The current Adobe ID is not authorized to download Acrobat.",EAMES_ERR_TITLE_FAILED_SERVER_RESPONSE:"A internal server failure has occurred.",EAMES_ERR_BODY_FAILED_SERVER_RESPONSE:"Please try again at a later time.",EAMES_ERR_TITLE_UNSUPPORTED_LANGUAGE_OR_PLATFORM:"Unsupported language/platform.",EAMES_ERR_BODY_UNSUPPORTED_LANGUAGE_OR_PLATFORM_AND_LINK:"Adobe Acrobat is not currently available for your language or platform.  For a list of supported platforms and languages, <a href='<%= linkURL %>' target='_blank'>click here</a>.",EAMES_ADOBE_VIP_DOWNLOAD_TITLE:"Download Acrobat...",EAMES_ADOBE_VIP_DOWNLOAD_TEXT:"Adobe employees can currently download and install Acrobat using various methods. Click <a href='<%= linkURL %>' target='_blank'>here</a> to learn more.",EAMES_DOWNLOAD_LANGUAGE_TEXT:"Acrobat will install in <%= installLanguage %>",CHANGE_TEXT:"Change",NO_MAC_STANDARD_DLM:"The Acrobat Standard application is not currently available for the Mac. Please download it on a Windows computer.",EAMES_UPGRADE_PROCESS_TITLE:"Processing Order...",EAMES_UPGRADE_PROCESS_MESSAGE:"We are currently processing your order. This may take up to 1 minute. Please do not click the Back button or close the browser window during this time.",SUB_MANAGER_GREETING_TITLE:"Hello, <%= firstName %>! Your current plan is <%= subscriptionName %>.",SUB_MANAGER_ACCT_STATUS:"Account status:",SUB_MANAGER_ACCT_ACTIVE_STATE:"ACTIVE",SUB_MANAGER_ACCT_STOPPED_STATE:"EXPIRED",SUB_MANAGER_ACCT_PAY_FREQUENCY:"(plus applicable taxes) per month.",SUB_MANAGER_ACCT_PAY_FREQUENCYAYEAR:"(plus applicable taxes) per year",SUB_MANAGER_ACCT_NEXTPAYMENT:"Next payment of ",SUB_MANAGER_ACCT_NEXTPAYMENT2:" will be charged to your card on ",SUB_MANAGER_ACCT_STOPPED_MSG1_PRE:"Your subscription will expire on",SUB_MANAGER_ACCT_STOPPED_MSG1_MID:" <%= terminationDate %>",SUB_MANAGER_ACCT_STOPPED_MSG1_POST:".",SUB_MANAGER_ACCT_STOPPED_MSG2_PRE:"Turn ON Auto Renewal to have continued access to ",SUB_MANAGER_ACCT_STOPPED_MSG2_MID:"<%= productName %>",SUB_MANAGER_ACCT_STOPPED_MSG2_POST:".",SUB_MANAGER_MOBILE_SUB_IOS:" purchased through iTunes",SUB_MANAGER_MOBILE_SUB_PLAY:" purchased through Google Play",SUB_MANAGER_MOBILE_ACCT_IOS:"You will need to sign-in to your iTunes Store account on your computer or iOS device to modify or cancel your subscription.",SUB_MANAGER_MOBILE_ACCT_PLAY:"You will need to sign-in to your Google Play account on your computer or Android device to modify or cancel your subscription.",SUB_MANAGER_FREE_ACCT_GREETING:"Hello, <%= firstName %>! You currently have a free Acrobat.com account.",SUB_MANAGER_FREE_ONLINE_TITLE:"Online Services Subscriptions",SUB_MANAGER_FREE_DESKTOP_TITLE:"Desktop Software + Online Services Subscriptions",SUB_MANAGER_FREE_CURR_TITLE:"Acrobat.com FREE",SUB_MANAGER_FREE_CURR_DESC:"Store and share files",SUB_MANAGER_FREE_CURR_PRICE:"5 GB FREE Storage",SUB_MANAGER_FREE_EXPORT_TITLE:"Adobe ExportPDF",SUB_MANAGER_FREE_EXPORT_DESC:"Export PDFs to Word or Excel",SUB_MANAGER_FREE_SEND_TITLE:"Adobe Send",SUB_MANAGER_FREE_SEND_DESC:"Send and track large files",SUB_MANAGER_FREE_PACK_TITLE:"Adobe PDF Pack",SUB_MANAGER_FREE_PACK_DESC:"A collection of online tools to convert and export PDFs, send and track large files, and store files in the cloud.",SUB_MANAGER_FREE_ASTD_TITLE:"Adobe Acrobat Standard",SUB_MANAGER_FREE_ASTD_DESC:"Includes Acrobat XI Standard software (Windows Only) Adobe PDF Pack, mobile access, and cloud storage.",SUB_MANAGER_FREE_APRO_TITLE:"Adobe Acrobat Pro",SUB_MANAGER_FREE_APRO_DESC:"Includes Acrobat XI Pro software, Adobe PDF Pack, Adobe FormsCentral, mobile access and cloud storage.",SUB_MANAGER_FREE_PRICE_PER_MONTH:"<%= pricePerMonth %> / month",SUB_MANAGER_FREE_BILL_ANNUAL:"(billed annually at <%= pricePerYear %>/yr)",SUB_MANAGER_FREE_BILL_ANNUAL_PLACEHOLDER:"(billed annually)",SUB_MANAGER_FREE_BILL_MONTH:"(billed monthly)",SUB_MANAGER_FREE_BILL_ANNUAL_COMMITMENT:"(billed monthly with annual commitment)",SUB_MANAGER_FREE_CURR_PLAN:"(Your Current Plan)",SUB_MANAGER_VIP_ACCT_GREETING:"Hello, <%= firstName %>! You currently have a complimentary subscription to Adobe <%= subscriptionName %>.",SUB_MANAGER_VIP_SUB_APRO:"Acrobat Pro",SUB_MANAGER_VIP_SUB_ASTD:"Acrobat Standard",SUB_MANAGER_VIP_SUB_CPDF:"PDF Pack",SUB_MANAGER_VIP_SUB_SPDF:"Create PDF",SUB_MANAGER_VIP_SUB_EPDF:"Export PDF",SUB_MANAGER_VIP_SUB_DEFAULT:"Acrobat.com",SUB_MANAGER_VIP_ACCT_STATUS:'For any questions regarding your account please send an email to <a href="mailto:ACOM_VIP@adobe.com">ACOM_VIP@adobe.com</a>.',SUB_MANAGER_TEAM_TITLE:"Team:",SUB_MANAGER_TEAM_STATUS:"To change your membership, please contact your Team Administrator.",SUB_MANAGER_TEAM_STD_SUBSCRIPTION:"Adobe Acrobat Standard for Teams",SUB_MANAGER_TEAM_PRO_SUBSCRIPTION:"Adobe Acrobat Pro for Teams",SUB_MANAGER_RENEWAL_TITLE:"Renewal date:",SUB_MANAGER_RENEWAL_TERM:"Your contract will renew on ",SUB_MANAGER_RENEWAL_FUTURE:"(<%= numOfMonth %> months until renewal)",SUB_MANAGER_PAYMENTINFO:"Payment info:",SUB_MANAGER_PAYMENT_CARD:"Payment card:",SUB_MANAGER_PAYMENT_CARD_EXPIRE:"Expires on ",SUB_MANAGER_PAYMENT_CARD_EXPIRED:"Expired on ",SUB_MANAGER_BILLING_ADDR_TITLE:"Billing address:",SUB_MANAGER_BILLING_EDIT_PAYMENT:"Edit Payment Info",SUB_MANAGER_CC_EXPIRED:"Your credit card is expired. Please update it using Edit Payment Info button above.",SUB_MANAGER_BILLING_LOADING:"Loading payment info...",SUB_MANAGER_UPGRADE:"Upgrade",SUB_MANAGER_DONTUPGRADE:"Cancel",SUB_MANAGER_DOWNGRADE:"Downgrade",SUB_MANAGER_AUTORENEWAL:"Auto Renewal: ",SUB_MANAGER_AUTORENEWAL_ON:"ON",SUB_MANAGER_AUTORENEWAL_OFF:"OFF",SUB_MANAGER_CANCELPLAN:"Turn OFF",SUB_MANAGER_RESTARTPLAN:"Turn ON",SUB_MANAGER_BANNER_UPGRADE:"Upgrade Now",SUB_MANAGER_SUPPORT_MSG_FOR_CANCEL:"We are unable to complete your request. Please go to Adobe.com to turn off Auto Renewal.",SUB_MANAGER_SUPPORT_MSG_FOR_RESTART:"We are unable to complete your request. Please go to Adobe.com to turn on Auto Renewal.",SUB_MANAGER_SUPPORT_MSG_FOR_SUB:"We are unable to show your plan information. Please go to Adobe.com to view your plan information.",SUB_MANAGER_SUPPORT_MSG_FOR_SAP:"Adobe is currently processing your recent order. Please try your upgrade request again in a few hours or contact customer support.",SUB_MANAGER_SUPPORT_MSG:"To complete your upgrade, please contact customer support.",SUB_MANAGER_UPGRADE_MSG_FOR_INACTIVE:"To upgrade your plan, please go to my plan and turn on Auto Renewal.",SUB_MANAGER_CUS_SUPPORT_ACTION:"Contact Customer Support",SUB_MANAGER_SUPPORT_ACTION:"Go to Adobe.com",SUB_MANAGER_CC_EXP_MSG:"Your credit card has expired. Please update your credit card information.",SUB_MANAGER_CC_EXP_ACTION:"Update credit card",SUB_MANAGER_CC_EXP_MSG_NEW:"Your credit card has expired. Please click on Edit Billing to update your card details.",SUB_MANAGER_CC_REJECTED:"We’ve encountered an error with your credit card. Please click on Edit Billing to update your card details.",SUB_MANAGER_INVALID_VAT_ERR:"We’ve encountered an error with your credit card’s VAT. Please click on Edit Billing to update this information.",SUB_MANAGER_INVALID_ADDR_ERR:"We’ve encountered an error with your billing address. Please click on Edit Billing to update this information.",SUB_MANAGER_INVALID_BILLING_ACTION:"Edit Billing",SUB_MANAGER_UPGRADE_NOT_NEEDED:"Our records show that you are already subscribed. Please click ok to refresh your browser window and see the upgraded service.",SUB_MANAGER_EPDF_TO_CPDF_ANNUAL:"Need to convert files to PDF? Get Adobe PDF Pack!",SUB_MANAGER_SPDF_TO_CPDF_ANNUAL:"Need to export PDF files to Word? Get Adobe PDF Pack!",SUB_MANAGER_EPDF_TO_CPDF_ANNUAL_DETAILS:"Add the ability to convert images and documents to PDF and merge multiple files into a single PDF for only <%= ratePerMon %>/mo.*",SUB_MANAGER_SPDF_TO_CPDF_ANNUAL_DETAILS:"Add the ability to convert PDFs to Word or Excel and merge multiple files into a single PDF for only <%= ratePerMon %>/mo.*",SUB_MANAGER_EPDF_TO_CPDF_ANNUAL_FOOT:"*Billed annually at <%= ratePerYear %>/year",SUB_MANAGER_CPDF_TO_ASUB_MONTHLY:"Need to do more with your PDF files? Get Adobe Acrobat Pro!",SUB_MANAGER_CPDF_TO_ASUB_MONTHLY_DETAILS:"Add access to Acrobat XI Pro software to edit and secure PDF files, create PDF and web forms, and more. Only <%= ratePerMon %>/mo.*",SUB_MANAGER_CPDF_TO_ASUB_MONTHLY_FOOT:"*Annual commitment required.",SUB_MANAGER_ASUB_MONTHLY_TO_ANNUAL:"Get Adobe Acrobat Pro for less",SUB_MANAGER_ASUB_MONTHLY_TO_ANNUAL_DETAILS:"Lower your monthly payments by signing up for a year! Only <%= ratePerMon %>/mo with annual commitment.",SUB_MANAGER_PREVIEW_NEWPLAN_CHARGE:"Charge for new plan:",SUB_MANAGER_PREVIEW_SUBTOTAL:"Subtotal",SUB_MANAGER_PREVIEW_TAX:"Tax",SUB_MANAGER_PREVIEW_EACHMONTH:"per month",SUB_MANAGER_PREVIEW_EACHYEAR:"per year",SUB_MANAGER_PREVIEW_NEWPLAN_MESSAGE1:"Your current plan <%= currentSubscriptionName %> will be stopped,",SUB_MANAGER_PREVIEW_NEWPLAN_MESSAGE2:"and you will receive a separate credit of ",SUB_MANAGER_PREVIEW_TERMTITLE:"Terms and Conditions:",SUB_MANAGER_PREVIEW_PASSWDMSG:"For your security, please enter your account password",SUB_MANAGER_PREVIEW_WRONGPASSWORD:"Password is incorrect. Please try again.",SUB_MANAGER_PREVIEW_CHECKBOX_REMINDER:"To continue, you must check the box acknowledging you have read and agree to the Terms and Conditions.",FORGOT_PWD_TITLE:"Forgot Your Password?",SUB_MANAGER_UPGRADE_DONE:"<div class='site-catalyst aic-upgrade-confirm' data-source='<%= source %>'>Your plan has been upgraded.</div><br><div>An email confirmation has been sent to <%= userEmailAddr %>.</div>",SUB_MANAGER_UPGRADE_DONE_PART2:"An email confirmation has been sent to <%= userEmailAddr %>.",SUB_MANAGER_UPGRADE_DONE_ACTION:"Get Started with <%= toolName %>",SUB_MANAGER_CANCEL_CONFIRMED:"Auto Renewal has been turned off successfully.",SUB_MANAGER_RESTART_CONFIRMED:"Auto Renewal has been turned on successfully.",SUB_MANAGER_EDITBILLING_ERROR:"We're sorry, we have encountered an error processing this information. Please try using a different web browser.",SUB_MANAGER_CALL_SUPPORT_MSG_BILLING:"If the problem persists, please contact Customer Support.",ANYWARE_CART_ERROR:"Your purchase request failed.",ANYWARE_CART_ADOBE_STORE:"Please go to Adobe store to complete your purchase.",ANYWARE_CART_PURCHASE_SUCCESS:"Your order has been placed.",ANYWARE_CART_PURCHASE_OPEN:"Thank you very much for placing an order with Adobe!<br/><br/>We are currently experiencing issues with our order processing system. Your order will be reviewed and processed shortly. Within 24 hours you will receive an email with the status of your order.<br/><br/>Your credit card will not be charged until your order is processed!",ANYWARE_CART_CC_EXPIRED_ERROR:"Your order Failed. Credit card is expired.",ANYWARE_CART_CC_ADDRESS_ERROR:"Your order Failed. Credit Card address is invalid.",ANYWARE_CART_CC_BILLING_ADDRESS_ERROR:"Your order Failed. Billing address is invalid.",SUB_MANAGER_UNAVAILABLE_COUNTRY:"Unsupported Country",SUB_MANAGER_PURCHASE_UNAVAILABLE_COUNTRY_BODY:"Sorry, this Adobe product is currently not available for sale in your country.",SUB_MANAGER_UPGRADE_UNAVAILABLE_COUNTRY_BODY:"Sorry, this Adobe product is currently not available for upgrade in your country.",CANCELLATION_DIALOG_TITLE_NAME:"Turn OFF Auto Renewal",CANCELLATION_DIALOG_TITLE:"If you turn off Auto Renewal now, you will not have access to the <%= productName %> tools after <%= titleDate %>.",CANCELLATION_RADIO_BUTTON_SECTION_TITLE:"Please take a moment to tell us why you are turning off Auto Renewal.",CANCELLATION_WRONG_PRODUCT:"I accidentally purchased the wrong product.",CANCELLATION_NOT_NEEDED:"I no longer need this product.",CANCELLATION_TOO_COMPLICATED:"Product is too complicated.",CANCELLATION_PERFORMS_POORLY:"Product performs poorly.",CANCELLATION_MISSING_FUNCTIONALITY:"Product does not have the functionality that I need.",CANCELLATION_TOO_EXPENSIVE:"Product is too expensive.",CANCELLATION_OTHER_COMPANY_PRODUCT:"I prefer to use another company's product.",CANCELLATION_ADOBE_PRODUCT:"I prefer to use a different Adobe product.",CANCELLATION_OTHER:"Other.",SUB_AUTO_RENEWAL_ON:"Turn ON Auto Renewal",SUB_MANAGER_EXP_CC_AlERT:"Alert",SUB_MANAGER_EXP_CC_AlERT_MSG1:"Your credit card ending in <%= ccEndDigit %> will be expiring in <%= days %> days!",SUB_MANAGER_EXP_CC_AlERT_MSG2:"Click 'Update Card' to edit your billing information and ensure continued access to <%= productName %>.",SUB_MANAGER_EXP_CC_ACTION:"Update Card",SUB_MANAGER_EXP_CC_ACTION2:"Remind Me later",SUB_MANAGER_CC_EXP:"Credit Card Expired",SUB_MANAGER_CC_EXP_MSG1:"Your credit card ending in <%= ccEndDigit %> has expired!",SUB_MANAGER_CC_EXP_MSG2:"Your credit card has expired. Please update your card to ensure continued access to <%= productName %>.",SUB_MANAGER_CC_EXP_SUSP_MSG1:"<%= name %>, we tried charging <%= amountWithCurrenySymbol %> to your credit card on <%= fullDate %> but it appears that your credit card has expired.",SUB_MANAGER_CC_EXP_SUSP_MSG2_PRE:"As a courtesy, ",SUB_MANAGER_CC_EXP_SUSP_MSG2_MID:"you have until <%= fullDateAMonthLater %> to update your card ",SUB_MANAGER_CC_EXP_SUSP_MSG2_END:"to ensure continued access to <%= productName %>.",SUB_MANAGER_CC_EXP_SUSP30_MSG1:"<%= name %>, your credit card expired on <%= shortDate %> and you are now past the grace period of 30-days.",SUB_MANAGER_CC_EXP_SUSP30_MSG2_PRE:"Please contact Adobe",SUB_MANAGER_CC_EXP_SUSP30_MSG2_MID:" customer support ",SUB_MANAGER_CC_EXP_SUSP30_MSG2_END:"to reactivate your account.",SUB_MANAGER_ERROR_DLG_TITLE:"Unable to complete request",SUB_MANAGER_SUSI_EDITBILLING_MSG:"To continue editing your billing information, please click OK button",SUB_MANAGER_SUSI_PURCHASE_MSG:"To continue purchasing your product, <span class='aic-susi-continue'>click here.</span>",TEAM_INVITE_NOT_FOUND_TITLE:"Invitation Not Found",TEAM_INVITE_ALREADY_ACCEPTED_TITLE:"Invitation Already Accepted",TEAM_INVITE_EXPIRED_TITLE:"Invitation Expired",TEAM_INVITE_REVOKED_TITLE:"Invitation Revoked",TEAM_INVITE_UNKNOWN_TITLE:"Unknown Error",TEAM_INVITE_NOT_FOUND_DESCRIPTION:"The invitation you are trying to access is not available.",TEAM_INVITE_ALREADY_ACCEPTED_DESCRIPTION:"The invitation you are trying to access has already been accepted.  Please <a href='<%= acrobatDotComLink %>'>click here</a> to sign in.",TEAM_INVITE_EXPIRED_DESCRIPTION:"The invitation was not claimed in time and has expired.",TEAM_INVITE_REVOKED_DESCRIPTION:"The invitation has been revoked and cannot be claimed.",TEAM_INVITE_UNKNOWN_DESCRIPTION:"An error has occurred with the team invitation.",TEAM_INVITE_NOT_FOUND_DETAILS:"If you feel like you've reached this message in error, please talk with your team administrator and ask them to re-invite you.",TEAM_INVITE_ALREADY_ACCEPTED_DETAILS:"If you feel like you've reached this message in error, please talk with your team administrator and ask them to re-invite you.",TEAM_INVITE_EXPIRED_DETAILS:"Please talk with your team administrator and ask them to re-invite you.",TEAM_INVITE_REVOKED_DETAILS:"If you feel like you've reached this message in error, please contact your team administrator.",TEAM_INVITE_UNKNOWN_DETAILS:"Please talk with your team administrator.",INVITE_TITLE:"You are one step away!",INVITE_PRO_DESCRIPTION:"You are one step away from accessing Adobe Acrobat Pro.",INVITE_STANDARD_DESCRIPTION:"You are one step away from accessing Adobe Acrobat Standard.",ACTIVATE_SUBSCRIPTION:"Activate Subscription",SIGNED_IN:"Signed in as",ACCESS_TO_PRO:'Access to Acrobat Pro is activated by clicking on "Activate Subscription" above. Access includes Acrobat Pro Desktop, online services and online file storage.',ACCESS_TO_STANDARD:'Access to Acrobat Standard is activated by clicking on "Activate Subscription" above. Access includes Acrobat Standard Desktop, online services and online file storage.',INVITE_GET_STARTED:"Get Started",AFTER_INVITE_ACCEPT_PRO:"After you accept the invitation, you will be shown the Acrobat tab. Click on the Download Now button to download Acrobat Pro.",AFTER_INVITE_ACCEPT_STANDARD:"After you accept the invitation, you will be shown the Acrobat tab. Click on the Download Now button to download Acrobat Standard.",DATE_TODAY_HH_MM_AMPM:"Today <%= hour %>:<%= minute %> <%= amPm %>",DATE_YESTERDAY_HH_MM_AMPM:"Yesterday <%= hour %>:<%= minute %> <%= amPm %>",DATE_MONTH_DD_YYYY_HH_MM_AMPM:"<%= month %> <%= day %>, <%= year %> <%= hour %>:<%= minute %> <%= amPm %>",DATE_MONTH_DD_YYYY:"<%= month %> <%= day %>, <%= year %>",AM:"AM",PM:"PM",USER_ACCOUNT:"My Information ...",STATUS_DETAILS_COMBINING:"Combining",STATUS_DETAILS_UPLOAD_START:"Uploading...",STATUS_DETAILS_UPLOAD_CANCELLED:"Upload Cancelled",STATUS_DETAILS_UPLOAD_ERROR:"Upload Error",STATUS_DETAILS_CONVERTING:"Converting...",STATUS_DETAILS_OPERATION_FAILED:"Conversion Failure",STATUS_DETAILS_COMPLETE:"Ready",STATUS_DETAILS_WAITING:"Pending...",STATUS_COULD_NOT_COMBINE:"Could not Combine",STATUS_COULD_NOT_EXPORT:"Could not Export",STATUS_COULD_NOT_CONVERT:"Could not Convert",STATUS_COULD_NOT_ORGANIZE:"Could not Organize Pages",STATUS_DETAILS_THUMBNAILS:"Generating Thumbnails",STATUS_DETAILS_THUMBNAIL_FAILURE:"Thumbnail generation failed.",STATUS_DETAILS_THUMBNAIL_COMPLETE:"Thumbnail generation completed.",DELETE:"Delete",RECENT_EXPORT_FILES:"Exported Files",RECENT_CONVERT_FILES:"Converted Files",RECENT_COMBINE_FILES:"Combined Files",VIEW_ALL_FILES:"View All",NO_RECENT_EXPORT:"No files have been exported from PDF",NO_RECENT_CONVERT:"No files have been converted to PDF",NO_RECENT_COMBINE:"No files have been combined to PDF",FINISHED:"finished",WAITING:"waiting",IPP_TITLE:"Print to PDF Setup",IPP_DETAIL:"Print to PDF from within almost any application. Simply open a document, choose Print and select Adobe CreatePDF Desktop Printer. The PDF file will automatically be saved to your CreatePDF account.",IPP_PLATFORM:"Available for Windows XP, Vista and 7 only.",IPP_DOWNLOAD:"Download Installer",KB:"<%= num %> KB",MB:"<%= num %> MB",GB:"<%= num %> GB",DECIMAL_SEPARATOR:".",MY_SUBSCRIPTIONS:"My Subscriptions",MY_PLAN:"My Plan",MY_PLAN_UC:"My Plan...",MY_INFORMATION_TITLE:"My Information",INVALID_NAME:'Sorry! Your first and last names each must be from 1 to 255 characters long, and cannot contain any of these characters: )<\\@;/>("',FIRST_NAME:"First Name",LAST_NAME:"Last Name",ADOBE_ID:"Adobe ID",PASSWORD:"Password",LANGUAGE:"Language",OPT_IN:"Yes! I would like to receive email communications relating to Adobe, its products and services including product releases, product upgrades, seminars, events, surveys, training, and special offers, and Adobe and its agents may use data I have provided in accordance with the <a class='aic-privacy-policy site-catalyst' target='_blank' href='<%=aicHostURL%>/redir/privacy'><b>Adobe Online Privacy Policy</b></a>.",CPDF_ERR_BODY_UNSUPPORTED_TYPE_LINK_REF:"/redir/cpdf_cpdf_supported",GET_STARTED:"Subscribe Now",LEARN_MORE:"Learn more",EPDF_UPSELL_TITLE:"Adobe ExportPDF",EPDF_UPSELL_SUBTITLE:"Easily convert PDF files to Word or Excel.",EPDF_UPSELL_SUBTITLE1:"Subscribe and add the ability to export an unlimited number of PDF files via your browser or mobile device.",EPDF_UPSELL_TO_WORD_TITLE:"Convert PDF to Word",EPDF_UPSELL_TO_WORD_MSG:"Export your PDF files to editable DOC, DOCX, or RTF files.",EPDF_UPSELL_TO_EXCEL_TITLE:"Convert PDF to Excel",EPDF_UPSELL_TO_EXCEL_MSG:"Turn PDF files into editable XLSX files with table formatting preserved.",EPDF_UPSELL_TO_OCR_TITLE:"Edit scanned text",EPDF_UPSELL_TO_OCR_MSG:"With optical character recognition (OCR), even scanned text becomes editable.",CPDF_UPSELL_TITLE:"Adobe PDF Pack",CPDF_UPSELL_SUBTITLE:"Easily convert business documents or image files into PDF.",CPDF_UPSELL_SUBTITLE1:"Subscribe and add the ability to create an unlimited number of PDF files, combine multiple files into a single PDF, and export PDF files to Office formats.",CPDF_UPSELL_OFFICE_TO_PDF_TITLE:"Convert Office files to PDF",CPDF_UPSELL_OFFICE_TO_PDF_MSG:"Turn Microsoft Word, Excel, and PowerPoint files into PDF documents.",CPDF_UPSELL_IMG_TO_PDF_TITLE:"Convert image files to PDF",CPDF_UPSELL_IMG_TO_PDF_MSG:"Easily convert scanned documents or image formats to PDF, including JPEG, GIF, PNG, BMP, and TIF files.",CPDF_UPSELL_PRINT_TO_PDF_TITLE:"Print to PDF",CPDF_UPSELL_PRINT_TO_PDF_MSG:"Just click Print from virtually any Windows desktop application to create high-quality PDF files.",CMBPDF_UPSELL_TITLE:"Adobe PDF Pack",CMBPDF_UPSELL_SUBTITLE:"Merge multiple documents or images into PDF.",CMBPDF_UPSELL_MERGE_TITLE:"Merge files to PDF",CMBPDF_UPSELL_MERGE_MSG:"Quickly convert and combine a wide range of document and image formats into a single PDF file.",CMBPDF_UPSELL_REORDER_TITLE:"Easily reorder files",CMBPDF_UPSELL_REORDER_MSG:"Rearrange files to ensure your information is presented in the right order.",CMBPDF_UPSELL_SHARE_TITLE:"Preview and download",CMBPDF_UPSELL_SHARE_MSG:"Preview your combined file online, then download the PDF to your desktop.",CMBN_DLG_TITLE:"Combine Files",CMBN_DLG_COMBINED_PDF_FILENAME_HINT:"Enter combined PDF file name",CMBM_DLG_NOT_ENOUGH_FILES:"Not enough files",CMBN_DLG_COMBINED_PDF_FILES_WARNING:"Add more than 1 file to combine.",CMBN_DLG_CONVERSION_FAILURE:"Conversion failure",CMBN_MULTI_FILE_SEPARATOR:", ",CMBN_ERR_TITLE_FAILED_TO_COMBINE:"Your PDF conversion request failed.",CMBN_ERR_TITLE_UPLOAD_TOO_LARGE_1:'"<%= name %>" is too large for combining to a PDF.',CMBN_ERR_TITLE_UPLOAD_TOO_LARGE_N:'The files "<%= names %>" are too large for combining to a PDF.',CMBN_ERR_TITLE_UPLOAD_TOO_SMALL_1:'"<%= name %>" is too small for combining to a PDF.',CMBN_ERR_TITLE_UPLOAD_TOO_SMALL_N:'The files "<%= names %>" are too small for combining to a PDF.',CMBN_ERR_TITLE_UNSUPPORTED_TYPE_1:'"<%= name %>" is in a format not supported for combining to PDF.',CMBN_ERR_TITLE_UNSUPPORTED_TYPE_N:'The files "<%= names %>" are in a format not supported for combining to PDF.',CMBN_ERR_TITLE_SOURCE_IS_ENCRYPTED:'"<%= name %>" failed to convert to PDF.',CMBN_ERR_TITLE_STORAGE_LIMIT_EXCEEDED:"The files failed to combine because storage limit was exceeded.",CMBN_ERR_TITLE_TOO_MANY_FILES:"Too many files to combine",CMBN_ERR_TITLE_FILE_COUNT_LIMIT_EXCEEDED:"You may only combine 12 or fewer files. Please remove some files",CMBN_ERR_TITLE_DND_FOLDER_NOTSUPPORTED_1:"A folder cannot be dropped here.",CMBN_ERR_TITLE_DND_FOLDER_NOTSUPPORTED_N:'The folders "<%= names %>" cannot be dropped here.',CMBN_ERR_TITLE_INVALID_PAGE_RANGE:"Page Range Error",CMBN_ERR_BODY_UPLOAD_TOO_LARGE:"Please select files smaller than 100 MB.",CMBN_ERR_BODY_SOURCE_IS_ENCRYPTED:"The document is password protected.",CMBN_ERR_BODY_DOCUMENT_CORRUPTED:"One of the files is either corrupt or in invalid format and cannot be used to generate the combined PDF file.",CMBN_ERR_BODY_CONVERSION_FAILED:"One of the files is either corrupt or protected and cannot be used to generate the combined PDF file.",CMBN_ERR_BODY_STORAGE_LIMIT_EXCEEDED:"Please back up and delete some of your online files and try again.",CMBN_ERR_BODY_PDF_IS_ENCRYPTED_OR_FORM:"The file is either password protected, encrypted or is a PDF form that could not be combined to generate the PDF file.",CMBN_ERR_BODY_PDF_IS_CERTIFIED:"The file is a certified PDF and could not be combined to generate the PDF file.",CMBN_ERR_BODY_DND_FOLDER_NOTSUPPORTED:"Drag and Drop is not supported for folders",CMBN_ERR_CONVERSION_FAILURE:"You must delete the files that failed to convert before attempting to combine.",CMBN_TOO_MANY_PAGES:"Too many pages (<%= pageCount %>) to expand",CMBN_TOO_MANY_PAGES_2:"This document has too many pages (<%= pageCount %>) to expand page thumbnails. All pages will be combined.",CMBN_TOO_MANY_PAGES_TITLE:"Too Many Pages",CMBN_ERR_INVALID_PAGE_RANGE:"Invalid page range specified. This may be caused by invalid syntax or too many output pages.",CMBN_ERR_BODY_UNSUPPORTED_TYPE:"Please choose different files and try again. For a list of supported file formats <a href='<%= linkRef %>' target='_blank'>click here</a>.",CMBN_ERR_BODY_UNSUPPORTED_TYPE_LINK_REF:"/redir/cpdf_combine_supported",ORG_ERR_TITLE_FAILED_TO_ORGANIZE:"Your request to organize pages request failed",ORG_ERR_TITLE_UNSUPPORTED_TYPE_1:'"<%= name %>" is in a format not supported for organizing pages.',ORG_ERR_BODY_UNSUPPORTED_TYPE_LINK_REF:"/redir/cpdf_combine_supported",ORG_ERR_BODY_CONVERSION_FAILED:"One of the inserted files is either corrupt or protected and cannot be used for organizing pages.",ORG_ERR_TITLE_DND_FOLDER_NOTSUPPORTED_1:"A folder cannot be dropped here.",ORG_ERR_BODY_DOCUMENT_CORRUPTED:"The file appears to be corrupted.",ORG_ERR_TITLE_SOURCE_IS_ENCRYPTED:'"<%= name %>" is password protected and pages cannot be modified.',ORG_ERR_BODY_SOURCE_IS_ENCRYPTED:"The document is password protected.",ORG_ERR_TITLE_STORAGE_LIMIT_EXCEEDED:'"<%= name %>" cannot be modified because storage limit was exceeded.',ORG_ERR_BODY_STORAGE_LIMIT_EXCEEDED:"Please back up and delete some of your online files and try again.",ORG_ERR_BODY_TIMEOUT:"The file is either too large or too complex to modify pages.",ORG_ERR_BODY_UNSUPPORTED_TYPE:"Please choose different files and try again. For a list of supported file formats <a href='<%= linkRef %>' target='_blank'>click here</a>.",ORG_ERR_TITLE_UPLOAD_TOO_SMALL_1:'"<%= name %>" is too small to modify pages.',ORG_ERR_TITLE_UPLOAD_TOO_LARGE_1:'"<%= name %>" is too large to modify pages.',ORG_ERR_BODY_UPLOAD_TOO_LARGE:"Please select a smaller file.",DATE_JANUARY:"January",DATE_FEBRUARY:"February",DATE_MARCH:"March",DATE_APRIL:"April",DATE_MAY:"May",DATE_JUNE:"June",DATE_JULY:"July",DATE_AUGUST:"August",DATE_SEPTEMBER:"September",DATE_OCTOBER:"October",DATE_NOVEMBER:"November",DATE_DECEMBER:"December",SA_CONVERT_TO_PDF:"Create PDF",SA_CONVERT_TO_PDF_TOOLTIP:"Create PDF",SA_EXPORT_PDF:"Export PDF",SA_EXPORT_PDF_TOOLTIP:"Export PDF",GENERIC_ARIA_LABEL_STRING:"<%= prefix %>. <%= suffix %>",ECPDF_REMOVE:"Remove",TITLE_CREATE_RHP:"Other formats to PDF",CONTENT_CREATE_RHP:"Convert files to PDF and easily combine them with other file types",TITLE_EXPORT_RHP:"Adobe Convert PDF",CONTENT_EXPORT_RHP:"Convert PDF files to Word or Excel Online"}),define("fss/js/templates/reader/faf-rhp-ipm-view-template",[],function(){return'<div class="faf-rhp-ipm faf-offline-content faf-reader-content faf-pdf-enabled-content"><div class="faf-rhp-ipm-title theme-text"><%= ipmTitle %></div><div class="faf-rhp-ipm-text theme-text"><%= ipmText %></div><div class="faf-rhp-ipm-help"><%= ipmHelp %></div><div class="faf-rhp-ipm-signin control-button dialog-control-button theme-button theme-button-label"><%= ipmSignIn %></div></div><div class="faf-rhp-ipm faf-reader-content faf-pdf-disabled-content"><div class="faf-rhp-ipm-title"><%= ipmDisabledTitle %></div><div class="faf-rhp-ipm-text"><%= ipmDisabledText %></div></div>'
}),define("fss/js/views/reader/faf-rhp-ipm-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","fss/js/lib/util","fss/js/lib/formstyler","fss/js/lib/fafa","fss/js/lib/faf-common-api-util","fss/js/lib/utilUI","fss/js/xlib/jquery.textchange.min","i18n!fss/js/nls/ui-strings","i18n!aictools/nls/ui-strings","fss/js/templates/reader/faf-rhp-ipm-view-template"],function(e,t,i,n,s,o,a,r,l,d,f,c){return t.FafRhpIpmView=e.View.extend({events:{"click     .faf-rhp-ipm-signin":"_onClickSignIn","click     .faf-rhp-ipm-help>a":"_onClickHelp"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(c)},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({ipmTitle:d["RHP.IPM.offline.title"],ipmText:d["RHP.IPM.offline.text"],ipmHelp:d["RHP.IPM.offline.help"],ipmSignIn:d["RHP.IPM.offline.signin"],ipmDisabledTitle:d.FAF.toUpperCase(),ipmDisabledText:f.ENTERPRISE_USERS_ACCESS_ERROR})),this._initWrappers())},_initWrappers:function(){},_onClickSignIn:function(){this._triggerViewEvent(t.ViewEvents.FAF_SIGN_IN_CLICK,this.options)},_onClickHelp:function(e){return a.openDecoratedUrl(e.target.href),!1}}),t.FafRhpIpmView}),define("fss/js/views/reader/faf-rhp-reader-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-common-util","fss/js/lib/utilUI","fss/js/data/fafconstants","fss/js/views/reader/faf-reader-autocomplete-helper-view","fss/js/views/faf-userdata-view","fss/js/views/reader/faf-rhp-send-view","fss/js/views/reader/faf-rhp-ipm-view"],function(e,t,i,n,s,o){return t.FafRhpReaderView=t.FafUserDataView.extend({render:function(){var e=0===this.$el.children().length;if(t.FafUserDataView.prototype.render.call(this),e){var i=this.options.fafSigninStateModel,s=i.get(i.STATE)===i.state.SIGNED_IN?"online":"offline",o=".faf-rhp-"+s+"-send-block",a=this.$(o);this._renderChildView("_fafRhpSendView",t.FafRhpSendView,a,this.options),this._renderChildView("_fafRhpIpmView",t.FafRhpIpmView,$(".faf-rhp-ipm-block"),this.options),this._renderChildView("_fafRhpACHelperView",t.FafRdrAutocompleteHelperView,$(".faf-rhp-achelper"),this.options),"sign_menu"===n.desktopNativeSignCommand()&&(_.bindAll(this,"_onSettingDialogClick"),_.defer(_.bind(function(){t.Reader.readerEventListenerOp.listenForReaderEvent("custom:openSettingsDialogCommand",this._onSettingDialogClick)},this)))}},_onWindowResize:function(){var e=this.$onlineContent;t.FafUserDataView.prototype._onWindowResize.call(this,e)},_updatePanelState:function(){t.Reader.opFactory.create("GettingDocCloudServicesStatusOp",this.options).run().then(_.bind(function(e){if(this._updatePanelDomItems(e),"enabled"===e.docServices){var t=this.options.fafSigninStateModel;t.get(t.STATE)!==t.state.SIGNED_IN&&(_.bindAll(this,"_offlineChange"),this.listenTo(t,"change",this._offlineChange))}},this)).always(_.bind(function(){this.options.fafEditorUiModel.set("user_panel_layout_done",!0)},this))},_updatePanelDomItems:function(e){"enabled"!==e.docServices&&("enabled"!==e.othersSignServices?($(".faf-userdataview-group").remove(),$(".faf-edit-form-form-container").addClass("faf-doc-svs-disabled"),i.logInfo("FafUserDataView","Removing RHP")):($(".faf-rhp-ipm-help").remove(),$(".faf-rhp-ipm-signin").remove(),$(".faf-rhp-ipm").css("margin-bottom","20px"),$(".faf-userdata-separator").css("border-bottom","#ddd 1px solid")))},_onResize:function(){$(".faf-userdataview-group").width($(".page-main-container").width()),this.$onlineContent.css("max-height",this.$RHPContainer.height()-this.$sendContainer.height()-this.$userdataHeader.height())},_onSettingDialogClick:function(){this._tellReader("showSettingsDialog")},_onChromeLoaded:function(){if(t.FafUserDataView.prototype._onChromeLoaded.call(this),n.isDesktop()&&!n.isDesktopAndLoggedIn()){var e=$(".faf-userdata-send-block");this._panel.css("bottom",e.outerHeight()+"px")}n.isDesktop()&&_.defer(function(){t._app.addListener(o.APP_SAVE_DATA,_.bind(this._updateStatusMessage,this))}.bind(this))},_offlineChange:function(e){e.get(e.STATE)===e.state.OFFLINE&&e.get(e.FORCED_OFFLINE||e.get(e.DISCONNECTED))&&t.Reader.opFactory.create("GettingDocCloudServicesStatusOp",this.options).run().then(_.bind(function(e){this._updatePanelDomItems(e)},this))},_updateStatusMessage:function(e){if(e.fail){var t=this.options.fafSigninStateModel;t.setOffline(t.reason.ERROR)}}}),t.FafRhpReaderView}),define("fss/js/templates/faf-hud-view-template",[],function(){return'<div class="faf-hud ui-theme theme-container-prominent" style="position:absolute;bottom:0;left:0;opacity:0;">   <div role="toolbar" class="faf-hud-controls">       <button class="faf-hud-prev faf-hud-page-nav full-preview-hud-btn" data-test-name="faf-faf-hud-prev-page" title="<%= previousPage %>"><div class="hidden-accessible"><%= previousPage %></div></button>       <button class="faf-hud-next faf-hud-page-nav full-preview-hud-btn" data-test-name="faf-faf-hud-next-page" title="<%= nextPage %>"><div class="hidden-accessible"><%= nextPage %></div></button>       <input type="tel" class="faf-hud-page-num full-preview-hud-page-num faf-hud-num faf-hud-stop-click" value="<%= pageNumber %>" title="<%= pageNumber %>"/>       <div class="faf-hud-num separator">/</div>       <div class="faf-hud-num full-preview-hud-num" title="<%= numberOfPages %>" role="presentation">         <div class="hidden-accessible"><%= numberOfPages %></div>         <div class="faf-hud-page-count" id="faf-hud-page-count">1</div>       </div>       <div class="full-preview-hud-divider" role="separator"></div>       <button class="faf-hud-zoom-out faf-hud-zoom full-preview-hud-btn faf-hud-stop-click" data-test-name="faf-hud-zoom-out" title="<%= zoomOut %>"><div class="hidden-accessible"><%= zoomOut %></div></button>       <button class="faf-hud-zoom-in faf-hud-zoom full-preview-hud-btn faf-hud-stop-click" data-test-name="faf-hud-zoom-ing" title="<%= zoomIn %>"><div class="hidden-accessible"><%= zoomIn %></div></button>       <button class="faf-hud-fit-page-width full-preview-hud-btn faf-hud-stop-click" data-test-name="faf-hud-fit-page-width" title="<%= fitPageWidth %>"><div class="hidden-accessible"><%= fitPageWidth %></div></button>       <button class="faf-hud-fit-full-page full-preview-hud-btn faf-hud-stop-click" data-test-name="faf-hud-fit-full-page" title="<%= fitFullPage %>"><div class="hidden-accessible"><%= fitFullPage %></div></button>       <button class="faf-hud-close full-preview-hud-btn" data-test-name="faf-hud-close" title="<%= close %>" style="display: inline-block;"><div class="hidden-accessible"><%= close %></div></button>   </div></div>'}),define("fss/js/views/faf-hud-view",["core/ac-core","core/utils/view-util","fss/js/lib/fafa","fss/js/lib/util","i18n!fss/js/nls/ui-strings","fss/js/ac-faf","fss/js/templates/faf-hud-view-template"],function(e,t,i,n,s,o,a){return o.FafHudView=e.View.extend({events:{mouseenter:"_onMouseEnter",mousemove:"_onMouseMove",mouseleave:"_onMouseLeave","mousedown   .faf-hud":"_onHudClick","click       .faf-hud-zoom-in":"_onZoomInClick","click       .faf-hud-zoom-out":"_onZoomOutClick","click       .faf-hud-fit-page-width":"_onFitWidthClick","click       .faf-hud-fit-full-page":"_onFitPageClick","click       .faf-hud-prev":"_onPagePrevClick","click       .faf-hud-next":"_onPageNextClick","click       .faf-hud-close":"_onCloseClick","keydown     .faf-hud-page-num":"_gotoPage",focusin:"_onFocusIn",focusout:"_onFocusOut"},initialize:function(){if(n.supportsTouch())for(var t in this.events)/^mousedown/.exec(t)&&(this.events[t.replace(/^mousedown/,"touchstart")]=this.events[t]);e.View.prototype.initialize.call(this),this._template=_.template(a),this._addUiModelEventListeners(),this.options.appApi.keyApi.pushKeyHandler(this)},_initWrappers:function(){this.$fafHud=$(".faf-hud"),this.$pageNum=$(".faf-hud-page-num"),this.$pageCount=$(".faf-hud-page-count"),this.$zooms=$(".faf-hud-zoom"),this.$zoomOut=$(".faf-hud-zoom-out"),this.$zoomIn=$(".faf-hud-zoom-in"),this.$pageButtons=$(".faf-hud-page-nav"),this.$prevPage=$(".faf-hud-prev"),this.$nextPage=$(".faf-hud-next"),this.$close=$(".faf-hud-close"),this.$form=$(".faf-form"),this.$formView=$(".faf-form-view"),this.$pageNum.attr("value","1"),this.options.fafEditorUiModel.set("last_hud_legal_page_num","1"),this.$pageCount.text(this.options.fafEditorUiModel.get("pages").length),this._onModelChange(),this.$pageNum.bind("textchange",this._checkPageNum),this._show(!0)},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({previousPage:s.HUDPreviousPage,nextPage:s.HUDNextPage,pageNumber:s.HUDPageNumber,numberOfPages:s.HUDNumberOfPages,fitPageWidth:s.HUDFitPageWidth,fitFullPage:s.HUDFitFullPage,zoomIn:s.HUDZoomIn,zoomOut:s.HUDZoomOut,close:s.Close})),this._initWrappers()),this.options.fafEditorUiModel.get("is_hud_dismissed")||this._show(!0)},_onResize:function(){this._onModelChange()},centerHUD:function(){},_onHudClick:function(e){return document.activeElement&&"body"!==document.activeElement.nodeName.toLowerCase()&&document.activeElement.blur(),$(e.target).hasClass("faf-hud-stop-click")},_onZoomInClick:function(){this._onAnyZoomClick("in")},_onZoomOutClick:function(){this._onAnyZoomClick("out")},_onFitWidthClick:function(){this._onAnyZoomClick("fitWidth")},_onFitPageClick:function(){this._onAnyZoomClick("fitPage")},_onAnyZoomClick:function(e){this._triggerViewEvent(o.ViewEvents.FAF_ZOOM_CLICK,_.extend({zoom:e},this.options))},_onPageNextClick:function(){this._updateCurrentPage(1)},_onPagePrevClick:function(){this._updateCurrentPage(-1)},_updateCurrentPage:function(e){var t=this.options.fafEditorUiModel,n=t.get("current_page")+e,s=t.get("pages").length-1;if(n>=0&&s>=n){t.set("current_page",n),this.$pageNum.attr("value",n+1),this.options.fafEditorUiModel.set("last_hud_legal_page_num",""+n+1);var o="NavBar:Page:Change";i.logEvent(null,o,o+":Clicked"+(1===e?":Next":":Prev"))}},_gotoPage:function(e){var t=this.options.fafEditorUiModel,n=this.$el.find(".faf-hud-page-num").val()-1,s=t.get("pages").length-1;if(n>=0&&s>=n&&13===e.which){t.set("current_page",n),this.$pageNum.attr("value",n+1),this.options.fafEditorUiModel.set("last_hud_legal_page_num",""+n+1);var o="NavBar:Page:Change";i.logEvent(null,o,o+":TextField")}else 13===e.which&&this.$el.find(".faf-hud-page-num").val(parseInt(t.get("current_page"),10)+1)},_checkPageNum:function(){if(!this._inCheckPageNum){this._inCheckPageNum=!0;var e=this._checkPageNumEx();void 0!==e&&this.options.fafEditorUiModel.set("last_hud_legal_page_num",e,{silent:!0}),this._inCheckPageNum=!1}},_checkPageNumEx:function(){var e=this.$el.find(".faf-hud-page-num"),t=e.val();if(0===t.length||t.match(/^[0]+$/))return t;if(t.match(/^\d*$/)){var i=parseInt(t,10)-1,n=this.options.fafEditorUiModel,s=n.get("pages").length-1;if(i>=0&&s>=i)return t}e.val(this.options.fafEditorUiModel.get("last_hud_legal_page_num"))},_onCloseClick:function(){this._show(!1),this.$formView.removeClass("faf-hud-enabled"),this.options.fafEditorUiModel.set("is_hud_dismissed",!0),this.forceHiddenModeUntilNextMouseOver=!0,i.logEvent(null,"NavBar:Close","NavBar:Close")},_show:function(e){this.options.fafEditorUiModel.get("is_faf_chrome_loaded")&&e!==this._isShown&&(this.$el.find(".faf-hud").stop(!0,!1),this.$el.find(".faf-hud").animate({opacity:e?1:0},_.bind(function(){e?this.$formView.addClass("faf-hud-enabled"):this.$formView.removeClass("faf-hud-enabled")},this)),this._isShown=e,e&&this._onModelChange())},_addUiModelEventListeners:function(){var e=this;e.options.fafEditorUiModel.once("change:is_faf_chrome_loaded",function(){e.options.fafEditorUiModel.get("is_hud_dismissed")||e._show(!0)}),e.options.fafEditorUiModel.on("change",this._onModelChange)},_onModelChange:function(){var e=this.options.fafEditorUiModel;this.$zooms.removeClass("disabled").prop("disabled",!1),e.canZoomOut()||this.$zoomOut.addClass("disabled").prop("disabled",!0),e.canZoomIn()||this.$zoomIn.addClass("disabled").prop("disabled",!0),this.$pageButtons.removeClass("disabled").prop("disabled",!1);var i=e.get("current_page")||0;0===i&&this.$prevPage.addClass("disabled").prop("disabled",!0);var n=e.get("pages").length||1;if(i===n-1&&this.$nextPage.addClass("disabled").prop("disabled",!0),this.$pageNum.val(i+1),this.$pageCount.text(n),this.overflowX=this.$form.width()<this.$formView.width(),this.overflowY=this.$form.height()<this.$formView.height(),this.options.fafEditorUiModel.get("is_hud_dismissed")?this.$close.css("display","none"):(this.$close.css("display","inline-block"),this._wasOverScrollBar&&(this.$fafHud.css("width","100%"),this._wasOverScrollBar=!1),this._show(!0)),this.overflowX){var s=t.getScrollBarWidth();this.$fafHud.css("bottom",parseInt(s,10))}else this.$fafHud.css("bottom",0)},_onMouseEnter:function(e){$(e.currentTarget).is(this.$el)&&(this._isMouseEntered=!0,this._show(!0)),this.forceHiddenModeUntilNextMouseOver=!1},_onMouseMove:function(e){var i=this.$fafHud;if(!this.forceHiddenModeUntilNextMouseOver){var s,o,a,r,l,d,f,c,u,h,p=e.pageX,g=e.pageY;if(!this.overflowY&&!this.overflowX)return i.css("width","100%"),void i.css("bottom","0");s=i.offset(),r=s.left+i.width(),l=s.top+i.height();var _=16;d=t.getScrollBarWidth()||_,o=r-d,a=s.top,f=p>=o&&r>p&&g>=a&&l>g&&this.overflowY,c=s.left,u=l-d,h=p>=c&&r>p&&g>=u&&l>g&&this.overflowX,f&&!this._wasOverScrollBar?(n.logInfo("faf-hud-view","setting width to "+(i.width()-d)),i.width(i.width()-d)):h&&!this._wasOverScrollBar?(n.logInfo("faf-hud-view","setting bottom to "+d),i.css("bottom",d)):(this._wasOverScrollBar||f&&h)&&(n.logInfo("faf-hud-view","setting width back to 100%, bottom to 0"),i.css("width","100%"),i.css("bottom","0")),this._wasOverScrollBar=f||h,this._show(!f||!h)}},_onMouseLeave:function(e){$(e.currentTarget).is(this.$el)&&(this._isMouseEntered=!1,this.options.fafEditorUiModel.get("is_hud_dismissed")&&this._show(!1))},_onFocusIn:function(e){return $(e.currentTarget).is(this.$el)?(this._show(!0),!0):!1},_onFocusOut:function(e){return $(e.currentTarget).is(this.$el)?(this.options.fafEditorUiModel.get("is_hud_dismissed")&&this._show(!1),!0):!1},_onKeyDown:function(e){var t,i,n=e.which,s=!1,o=this.options.fafEditorUiModel,a=this.$el,r=$(e.target),l=0!==r.closest(a).length,d=this.$(":focusable"),f=d.index(r);if(r.is("[aria-haspopup=true],[role=option],[role^='menuitem'],[role=toolbar] :focusable")&&!l)return!1;switch(n){case 35:i=o.get("pages").length-1-o.get("current_page"),this._updateCurrentPage(i),s=!0;break;case 36:i=0-o.get("current_page"),this._updateCurrentPage(i),s=!0;break;case 33:this._onPagePrevClick(),s=!0;break;case 34:this._onPageNextClick(),s=!0;break;case 37:l&&(t=d.filter(":lt("+f+"):last"));break;case 39:l&&(t=d.filter(":gt("+f+"):first"))}return t&&t.length&&(s=!0,t.focus()),s&&this._consumeEvent(e),s}}),o.FafHudView}),define("fss/js/templates/reader/faf-reader-hud-view-template",[],function(){return'<div class="faf-hud" style="position:absolute;bottom:0;left:0;opacity:0;">   <div class="faf-hud-controls">       <div class="faf-hud-hide-grp-6 full-preview-hud-prev faf-custom-hud-tool-tip faf-hud-page-nav full-preview-hud-btn" data-test-name="full-preview-hud-prev" data-title-temp="<%= previousPage %>"></div>       <div class="faf-hud-hide-grp-6 full-preview-hud-next faf-custom-hud-tool-tip faf-hud-page-nav full-preview-hud-btn" data-test-name="full-preview-hud-next" data-title-temp="<%= nextPage %>"></div>       <input type="text" class="faf-hud-hide-grp-5 faf-hud-page-num full-preview-hud-page-num faf-hud-num" value="<%= pageNumber %>"></input>       <div class="faf-hud-hide-grp-5 faf-hud-num separator">/</div>       <div class="faf-hud-hide-grp-5 faf-hud-page-count faf-custom-hud-tool-tip faf-hud-num" data-title-temp="<%= numberOfPages %>">1</div>       <div class="faf-hud-hide-grp-4 full-preview-hud-divider"></div>       <div class="faf-hud-hide-grp-4 faf-hud-zoom-out faf-custom-hud-tool-tip faf-hud-zoom full-preview-hud-btn" data-test-name="faf-hud-zoom-out" data-title-temp="<%= zoomOut %>"></div>       <div class="faf-hud-hide-grp-4 faf-hud-zoom-in faf-custom-hud-tool-tip faf-hud-zoom full-preview-hud-btn" data-test-name="faf-hud-zoom-ing" data-title-temp="<%= zoomIn %>"></div>       <div class="faf-hud-hide-grp-3 faf-hud-zoom-level faf-custom-hud-tool-tip" data-test-name="faf-hud-zoom-level" data-title-temp="<%= zoomLevel %>">           <div class="faf-hud-zoom-level-menu core-menu-border"></div>           <input type="text" class="faf-hud-zoom-level-input full-preview-hud-page-num"></input>           <div class="faf-hud-zoom-level-icon full-preview-hud-btn"></div>       </div>       <div class="faf-hud-hide-grp-2 faf-hud-fit-page-width faf-custom-hud-tool-tip faf-hud-fit-zoom full-preview-hud-btn" data-test-name="full-preview-hud-scroll-pages" data-title-temp="<%= fitPageWidth %>"></div>       <div class="faf-hud-hide-grp-2 faf-hud-fit-full-page faf-custom-hud-tool-tip faf-hud-fit-zoom full-preview-hud-btn" data-test-name="full-preview-hud-fit-full-page" data-title-temp="<%= fitFullPage %>"></div>       <div class="faf-hud-hide-grp-1 faf-custom-hud-tool-tip faf-hud-close-container" data-title-temp="<%= close %>">           <div class="full-preview-hud-btn faf-hud-close" data-test-name="faf-hud-close" style="display: inline-block;"></div>       </div>   </div>   <div class="faf-custom-hud-tool-tip-div"></div></div>'}),define("fss/js/templates/faf-zoom-level-selector-template",[],function(){return'<div class="faf-zoom-level-menu-items no-select">    <div class="faf-zoom-level-menu-item" data-zoom-level="25%">25%</div>    <div class="faf-zoom-level-menu-item" data-zoom-level="50%">50%</div>    <div class="faf-zoom-level-menu-item" data-zoom-level="75%">75%</div>    <div class="faf-zoom-level-menu-item" data-zoom-level="100%">100%</div>    <div class="faf-zoom-level-menu-item" data-zoom-level="125%">125%</div>    <div class="faf-zoom-level-menu-item" data-zoom-level="150%">150%</div>    <div class="faf-zoom-level-menu-item" data-zoom-level="200%">200%</div>    <div class="faf-zoom-level-menu-item" data-zoom-level="400%">400%</div></div>'}),define("fss/js/views/faf-zoom-level-selector-view",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/templates/faf-zoom-level-selector-template"],function(e,t,i,n){return t.FafZoomLevelSelectorView=e.MenuView.extend({events:{"click .faf-zoom-level-menu-item":"_onZoomLevelChange","mouseover .faf-zoom-level-menu-item":"_hideHudToolTip"},initialize:function(){e.MenuView.prototype.initialize.call(this),this._template=_.template(n)},render:function(){return e.MenuView.prototype.render.call(this),this.$el.html(this._template()),this._initWrappers(),this},_initWrappers:function(){this.$levelContainer=$(".faf-hud-zoom-level-menu"),this.$fafHud=$(".faf-hud"),this.$formView=$(".faf-form")},open:function(){return i.onExternalEsc(this._escToMenu),this._position(),e.MenuView.prototype.open.call(this)},close:function(t,n){i.offExternalEsc(this._escToMenu),e.MenuView.prototype.close.call(this,t,_.extend({},n,{doNotEmpty:!0}))},_position:function(){var e=this.$formView.height()-this.$fafHud.offset().top-160;0>e?this.$levelContainer.css("top",e):this.$levelContainer.css("top","0px")},_escToMenu:function(){this.close()},_onZoomLevelChange:function(e){var i=$(e.target);t.opFactory.create("ZoomFormOp",_.extend(this.options,{zoom:i.attr("data-zoom-level"),noLog:!0})).run(),this.close()},_hideHudToolTip:function(){this.options.hudView._handleTitleDivHoverOut()}}),t.FafZoomLevelSelectorView}),define("fss/js/views/reader/faf-reader-hud-view",["core/ac-core","core/utils/view-util","fss/js/lib/fafa","fss/js/lib/util","fss/js/lib/reader/faf-reader-util","fss/js/lib/faf-common-util","i18n!fss/js/nls/ui-strings","fss/js/ac-faf","fss/js/templates/reader/faf-reader-hud-view-template","fss/js/views/faf-zoom-level-selector-view"],function(e,t,i,n,s,o,a,r,l){return r.FafReaderHudView=e.View.extend({events:{mouseenter:"_onMouseEnter",mouseleave:"_onMouseLeave","mousedown   .faf-hud":"_onHudClick","click       .faf-hud-scroll-pages":"_onScrollModeClick","click       .faf-hud-zoom-in":"_onZoomInClick","click       .faf-hud-zoom-out":"_onZoomOutClick","click       .faf-hud-fit-page-width":"_onFitWidthClick","click       .faf-hud-fit-full-page":"_onFitPageClick","click       .full-preview-hud-prev":"_onPagePrevClick","click       .full-preview-hud-next":"_onPageNextClick","keyup       .faf-hud-page-num":"_gotoPage","keypress    .faf-hud-page-num":"_gotoPageKeyPress","keydown     .faf-hud-zoom-level-input":"_onZoomLevelInput","keypress    .faf-hud-zoom-level-input":"_onZoomLevelInputKeyPress","click       .faf-hud-zoom-level-icon":"_onZoomLevelClick","click       .faf-hud-close":"_onCloseClick","focus       .faf-hud-page-num":"_onTextFocus","focus       .faf-hud-zoom-level-input":"_onTextFocus","blur        .faf-hud-page-num":"_onTextBlur","blur        .faf-hud-zoom-level-input":"_onTextBlur"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(l),this._addUiModelEventListeners()},_initWrappers:function(){this.$fafHudContainer=$(".faf-edit-form-hudview-container"),this.$fafHud=$(".faf-hud"),this.$fafReaderHud=$(".faf-reader-hud"),this.$zoomLevelSelect=$(".faf-hud-zoom-level-menu"),this.$zoomLevelInput=$(".faf-hud-zoom-level-input"),this.$pageNum=$(".faf-hud-page-num"),this.$pageCount=$(".faf-hud-page-count"),this.$zooms=$(".faf-hud-zoom"),this.$zoomOut=$(".faf-hud-zoom-out"),this.$zoomIn=$(".faf-hud-zoom-in"),this.$pageButtons=$(".faf-hud-page-nav"),this.$prevPage=$(".full-preview-hud-prev"),this.$nextPage=$(".full-preview-hud-next"),this.$fitZooms=$(".faf-hud-fit-zoom"),this.$fitWidthBtn=$(".full-preview-hud-scroll-pages"),this.$fitPageBtn=$(".full-preview-hud-fit-full-page"),this.$close=$(".faf-hud-close"),this.$scrollMode=$(".faf-hud-scroll-pages"),this.$form=$(".faf-form"),this.$formView=$(".faf-form-view"),this.$RHP=$(".faf-edit-form-userdataview-container"),this.$titleDivs=this.$el.find(".faf-custom-hud-tool-tip"),this.$toolTipDiv=this.$el.find(".faf-custom-hud-tool-tip-div"),this.$pageNum.attr("value","1"),this.$pageCount.text(this.options.fafEditorUiModel.get("pages").length),this._onModelChange(),this.$titleDivs.hover(this._handleTitleDivHoverIn,this._handleTitleDivHoverOut),this.options.fafEditorUiModel.on("change:show_zoom_selector_menu",this._onShowZoomLevelChange),this._show(!0)},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({previousPage:a.HUDPreviousPage,nextPage:a.HUDNextPage,pageNumber:a.HUDPageNumber,numberOfPages:a.HUDNumberOfPages,fitPageWidth:a.HUDFitPageWidth,fitFullPage:a.HUDFitFullPage,zoomIn:a.HUDZoomIn,zoomOut:a.HUDZoomOut,zoomLevel:a.HUDZoomLevel,scrollMode:"Scroll Mode",close:a.Close})),this._initWrappers()),this.options.fafEditorUiModel.get("is_hud_dismissed")||this._show(!0),this._renderZoomSelectorView()},_handleTitleDivHoverIn:function(e){this.$tooltipOverEl=$(e.currentTarget),this.toolTiptitle=this.$tooltipOverEl.attr("data-title-temp"),_.delay(_.bind(function(){!this.$tooltipOverEl||this.$tooltipOverEl.is(".faf-hud-close-container")&&this.options.fafEditorUiModel.get("is_hud_dismissed")||(this.$toolTipDiv.show(),this.$toolTipDiv.css("left",this.$tooltipOverEl.position().left),this.$toolTipDiv.html(this.toolTiptitle))},this),1e3)},_handleTitleDivHoverOut:function(){this.$toolTipDiv.hide(),this.$tooltipOverEl=null},_renderZoomSelectorView:function(){this._renderChildView("_zoomSelectorView",r.FafZoomLevelSelectorView,this.$zoomLevelSelect,_.extend(this.options,{keyUiModel:this.options.appApi.options.keyUiModel,menusUiModel:this.options.appApi.options.menusUiModel,hudView:this}))},_onZoomLevelClick:function(){return this._handleTitleDivHoverOut(),r.opFactory.create("TogglingZoomSelectorMenuOp",this.options).run()},_onShowZoomLevelChange:function(e,t){var i,n=this._zoomSelectorView;t?(i=this.options.fafEditorUiModel,n.open().always(function(){i.set("show_zoom_selector_menu",!1,{silent:!0})})):n.close()},centerHUD:function(e){if(e||!this._moved){var t=$(".faf-form").width(),i=$(".faf-hud").width();this.$fafHud.css("left",(t-i)/2)}},_onWindowResize:function(){var e=this.$fafHud.width(),t=this.$RHP.offset(),i=this.$fafHud.offset(),n=i.left+e-t.left+10;if(n>0){var s=i.left-n-10;0>s?(this._hudOfScreen=!0,this._show(!1)):this.$fafHud.css("left",s)}else this._hudOfScreen&&(this._hudOfScreen=!1,this._show(!0),this._moved=!1),this.centerHUD()},_enableDrag:function(){var e=this;this.$fafHud.draggable({cursor:"-webkit-grabbing",appendTo:"parent",containment:".faf-form",helper:"original",cancel:".full-preview-hud-btn, .faf-hud-num, .full-preview-hud-divider, .faf-hud-zoom-level, input, select",stop:function(){e._moved=!0}})},_onResize:function(){this._onModelChange()},_onHudClick:function(){return document.activeElement&&"body"!==document.activeElement.nodeName.toLowerCase()&&document.activeElement.blur(),!0},_onScrollModeClick:function(){var e=this.options.fafEditorUiModel,t=e.get("scroll_mode");this._triggerViewEvent(r.ViewEvents.FAF_SCROLL_MODE_CLICK,_.extend(this.options,{scrollMode:!t}))},_onZoomInClick:function(){this._triggerViewEvent(r.ViewEvents.FAF_ZOOM_CLICK,_.extend(this.options,{zoom:"in"}))},_onZoomOutClick:function(){this._triggerViewEvent(r.ViewEvents.FAF_ZOOM_CLICK,_.extend(this.options,{zoom:"out"}))},_onFitWidthClick:function(e){this._triggerViewEvent(r.ViewEvents.FAF_ZOOM_CLICK,_.extend(this.options,{zoom:"fitWidth"})),e.altKey&&this._triggerViewEvent(r.ViewEvents.FAF_SCROLL_MODE_CLICK,_.extend(this.options,{scrollMode:!0}))},_onFitPageClick:function(){this._triggerViewEvent(r.ViewEvents.FAF_ZOOM_CLICK,_.extend(this.options,{zoom:"fitPage"})),event.altKey&&this._triggerViewEvent(r.ViewEvents.FAF_SCROLL_MODE_CLICK,_.extend(this.options,{scrollMode:!1}))},_onPageNextClick:function(){this._updateCurrentPage(1)},_onPagePrevClick:function(){this._updateCurrentPage(-1)},_updateCurrentPage:function(e){var t=this.options.fafEditorUiModel,n=t.get("current_page")+e,s=t.get("pages").length-1;if(n>=0&&s>=n){t.set("current_page",n),this.$pageNum.attr("value",n+1);var o="NavBar:Page:Change";i.logEvent(null,o,o+":Clicked"+(1===e?":Next":":Prev"))}},_gotoPage:function(e){var t=this.options.fafEditorUiModel,n=this.$el.find(".faf-hud-page-num").val()-1,s=t.get("pages").length-1;if(n>=0&&s>=n&&13===e.which){t.set("current_page",n),this.$pageNum.attr("value",n+1);var l="NavBar:Page:Change";i.logEvent(null,l,l+":TextField")}else if(13===e.which){var d=this.$el.find(".faf-hud-page-num").val();this.$el.find(".faf-hud-page-num").blur(),this.$el.find(".faf-hud-page-num").val(parseInt(t.get("current_page"),10)+1);var f=this.options.appApi.dialogApi;o.isDesktop()&&r.appApi.keyApi.pushKeyHandler(this),o.onExternalEsc(this._closeAllDialogs),f.displayTextAlert(f.SEVERITY_ERROR,a.GenericDialogTitle,_.template(a.HUDInvalidPage,{invalidPageNum:d}),a.OK).always(_.bind(function(){o.offExternalEsc(this._closeAllDialogs),o.isDesktop()&&r.appApi.keyApi.popKeyHandler(this)},this))}e.preventDefault()},_onKeyDown:function(e){return 27===e.which?!0:!1},_gotoPageKeyPress:function(){var e=new RegExp("^[0-9]$"),t=String.fromCharCode(event.which);return e.test(t)?void 0:(event.preventDefault(),!1)},_closeAllDialogs:function(){this.options.appApi.dialogApi.closeAllDialogs()},_onTextBlur:function(){o.offExternalEsc(this._loseFocusFromCategory)},_onTextFocus:function(){o.onExternalEsc(this._loseFocusFromCategory)},_loseFocusFromCategory:function(){$(document.activeElement).blur()},_onZoomLevelInput:function(e){if(13===e.which){var t=this.$zoomLevelInput.val(),i=parseFloat(t.replace("%"));!isNaN(i)&&i>=25&&400>=i?r.opFactory.create("ZoomFormOp",_.extend(this.options,{zoom:i+"%",noLog:!0})).run():this._onModelChange()}},_onZoomLevelInputKeyPress:function(e){var t=new RegExp("^[0-9%]$"),i=String.fromCharCode(e.which);return t.test(i)?void 0:(e.preventDefault(),!1)},_show:function(e){this.options.fafEditorUiModel.get("is_faf_chrome_loaded")&&e!==this._isShown&&(this.$el.find(".faf-hud").stop(!0,!1),this.$el.find(".faf-hud").animate({opacity:e?1:0},_.bind(function(){e?this.$formView.addClass("faf-hud-enabled"):this.$formView.removeClass("faf-hud-enabled")},this)),this._isShown=e,e&&this._onModelChange())},_onCloseClick:function(){this._show(!1),this.$formView.removeClass("faf-hud-enabled"),this.options.fafEditorUiModel.set("is_hud_dismissed",!0),this.forceHiddenModeUntilNextMouseOver=!0,i.logEvent(null,"NavBar:Close","NavBar:Close")},_addUiModelEventListeners:function(){var e=this;e.options.fafEditorUiModel.once("change:is_faf_chrome_loaded",function(){e.options.fafEditorUiModel.get("is_hud_dismissed")||e._show(!0)}),e.options.fafEditorUiModel.on("change:is_hud_dismissed",function(){e._show(e.options.fafEditorUiModel.get("is_hud_dismissed")?!1:!0)}),e.options.fafEditorUiModel.on("change",this._onModelChange)},_onModelChange:function(){var t=this.options.fafEditorUiModel;this.$zooms.removeClass("disabled"),t.canZoomOut()||this.$zoomOut.addClass("disabled"),t.canZoomIn()||this.$zoomIn.addClass("disabled"),this.$fitZooms.removeClass("disabled"),"fitWidth"===t.get("zoom_type")?this.$fitWidthBtn.addClass("disabled"):"fitPage"===t.get("zoom_type")&&this.$fitPageBtn.addClass("disabled"),this.$pageButtons.removeClass("disabled");var i=t.get("current_page")||0;0===i&&this.$prevPage.addClass("disabled");var n=t.get("pages").length||1;i===n-1&&this.$nextPage.addClass("disabled"),this.$pageNum.val(i+1),this.$pageCount.text(n),t.get("scroll_mode")?this.$scrollMode.removeClass("disabled"):this.$scrollMode.addClass("disabled"),this.$zoomLevelInput.val((100*t.getReaderZoom()).toFixed(0)+"%"),this.overflowX=this.$form.width()<this.$formView.width(),this.overflowY=this.$form.height()<this.$formView.height()+60,this.options.fafEditorUiModel.get("is_hud_dismissed")?this.$close.css("display","none"):(this.$close.css("display","inline-block"),this._wasOverScrollBar&&(this.$fafHud.css("width","100%"),this._wasOverScrollBar=!1),this._show(!0));var o=s.scrollbarWidth();e.Util.isMac()&&(o=11),this.overflowX?this.$fafHud.css("bottom",parseInt(o)):this.$fafHud.css("bottom",0),this.overflowY?this.$fafHud.width(this.$form.width()-o):this.$fafHud.css("width","100%")},_onMouseEnter:function(e){$(e.currentTarget).is(this.$el)&&(this._isMouseEntered=!0,this._show(!0)),this.forceHiddenModeUntilNextMouseOver=!1},_onMouseLeave:function(e){$(e.currentTarget).is(this.$el)&&(this._isMouseEntered=!1,this.options.fafEditorUiModel.get("is_hud_dismissed")&&this._show(!1))}}),r.FafReaderHudView}),define("fss/js/views/faf-editor-view",["core/ac-core","fss/js/ac-faf","fss/js/data/fafconstants","i18n!fss/js/nls/ui-strings","fss/js/templates/faf-editor-view-template","fss/js/lib/faf-common-util","fss/js/views/faf-toolbar-view","fss/js/views/faf-form-view","fss/js/views/faf-userdata-view","fss/js/views/reader/faf-rhp-reader-view","fss/js/views/faf-hud-view","fss/js/views/reader/faf-reader-hud-view"],function(e,t,i,n,s,o){return t.FafEditorView=e.View.extend({events:{"click   .faf-rhp-faf-disconnected-retry-btn":"_onRetryClick","keydown    #faf-fc-after-del-focus":"_onBlurFCFocusEl"},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(s)},_initWrappers:function(){this.$toolbarParent=this.$el.find(".faf-edit-form-toolbarview-container"),this.$formViewParent=this.$el.find(".faf-form"),this.$hudParent=this.$el.find(".faf-edit-form-hudview-container"),this.$userDataParent=this.$el.find(".faf-edit-form-userdataview-container"),this.$formView=$(),this.$fcDelFocusEl=this.$el.find("#faf-fc-after-del-focus"),this.options.startingPluginOpPromise.then(_.bind(function(){this.options.fafEditorUiModel.once("change:is_faf_chrome_loaded",this._onResize)},this)),$(window).on("resize",this._onResize)},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({loadingRHP:n.LoadingRHP,disconnectedMessage:n.DisconnectedMessageRHP,disconnectedBtn:n.DisconnectedBtnRHP})),this.$(".faf-edit-form-userdataview-container-loading").css("height",$(".faf-edit-form-userdataview-container").height()),this._initWrappers()),this._renderChildViews(),this.$formView=this.$formViewParent.find(".faf-form-view")
},_renderChildViews:function(){"sign_dlg"!==o.desktopNativeSignCommand()&&(this._renderChildView("_fafUserDataView",t[o.getFafViewInfo().userDataViewClass],this.$userDataParent,this.options),this._renderChildView("_fafToolbarView",t.FafToolbarView,this.$toolbarParent,this.options)),this._renderChildView("_fafFormView",t.FafFormView,this.$formViewParent,this.options)},_onResize:function(){"sign_dlg"!==o.desktopNativeSignCommand()&&this._childViewsByAttr._fafToolbarView._onResize(),this._childViewsByAttr._fafFormView._onResize(),"sign_dlg"!==o.desktopNativeSignCommand()&&this._childViewsByAttr._fafUserDataView._onResize()},_onRetryClick:function(){return t.opFactory.create("SigningInOp",_.extend({isRetry:!0},this.options)).run()},_onBlurFCFocusEl:function(e){9===e.which&&(this.$fcDelFocusEl.blur(),t.opFactory.create("TabToSmartFieldOp",_.extend(this.options,{candidateID:this.$fcDelFocusEl.data("deletedFCModel")||null,shiftKey:e.shiftKey})).run(),e.stopPropagation(),e.preventDefault())}}),t.FafEditorView}),define("fss/js/views/faf-app-view",["core/ac-core","fss/js/ac-faf","fss/js/templates/faf-app-view-template","fss/js/lib/faf-common-util","fss/js/views/faf-organizer-view","fss/js/views/faf-editor-view"],function(e,t,i,n){return t.FafAppView=e.View.extend({events:{},initialize:function(){e.View.prototype.initialize.call(this),this._template=_.template(i)},_initWrappers:function(){this.$organizerView=$(".faf-form-list"),this.$editorView=$(".faf-edit-form")},render:function(){e.View.prototype.render.call(this),0===this.$el.children().length&&(this.$el.html(this._template({})),this._initWrappers()),this._renderChildViews()},_renderChildViews:function(){var e=n.getFafViewInfo().appViewChildren;_.each(e,function(e){this._renderChildView(e.attr,t[e.cls],this[e.prop],this.options)},this)}}),t.FafAppView}),define("fss/js/models/faf-app-limits-model",["fss/js/ac-faf","fss/js/lib/util","fss/js/lib/faf-ajax-util"],function(e,t,i){return e.FafAppLimitsModel=Backbone.Model.extend({recognized:{file_formats:{type:"object",required:!0}},defaults:{},initialize:function(e,t){this.options=t,Backbone.Model.prototype.initialize.call(this),this.set("file_formats",[]),_.bindAll(this,"_signinChange");var i=this.options.fafSigninStateModel;this.listenTo(i,"change:"+i.STATE,this._signinChange)},fetch:function(e){return e=i.getAjaxOptions("GET","/users/me/limits"),Backbone.Model.prototype.fetch.call(this,e).fail(_.bind(function(){t.logError("FafAppLimitsModel","Cannot fetch app settings")},this))},save:function(){return $.Deferred().resolve().promise()},destroy:function(){return $.Deferred().resolve().promise()},supportedMimetypes:function(){var e=[];return _.each(this.get("file_formats"),function(t){e.push(_.values(t)[0].mimetype)}),e},supportedExtensions:function(){var e=[];return _.each(this.get("file_formats"),function(t){e.push("."+_.keys(t)[0])}),e},analyticType:function(e){e=e.toLowerCase();var t=_.find(this.get("file_formats"),function(t){return _.keys(t)[0]===e});return void 0!==t?_.values(t)[0].analyticType:"other"},isFeatureEnabled:function(e){var t=this.get("features");return t&&t[e]},initialized:function(){return this._initPromise||(this._initPromise=this.fetch()),this._initPromise},getFRFeatureLevel:function(){var e=0,t=this.getUserCohorts("FSS-FR-feat-test"),i={c2:1,c3:1};return t&&i[t]&&(e=i[t]),e},getUserCohorts:function(e){var t=this.options.appApi.usersMeApi.getUserCohorts();return t[e]},_signinChange:function(e){this._initPromise||e.stateIsEphemeral()||this.initialized()}}),e.FafAppLimitsModel}),define("fss/js/views/reader/faf-signature-reader-native-sync-view",["core/ac-core","fss/js/ac-faf","i18n!fss/js/nls/ui-strings","fss/js/lib/reader/faf-reader-api-caller","fss/js/views/esign/faf-signature-sync-view"],function(e,t,i,n){return t.Reader.FafSignatureReaderNativeSyncView=t.FafSignatureSyncView.extend({render:function(){var e;return this._getDocWindowSize().then(_.bind(function(t){e=t;var i=Math.max(313,Math.min(800,.75*t.width));return this._setContainerSize(i,1)},this)).then(_.bind(function(){t.FafSignatureSyncView.prototype.render.call(this,!1),_.defer(_.bind(function(){var t=$(".faf-sig-sync-dialog"),i=t.outerWidth(),n=Math.min(e.height,t.outerHeight());this._setContainerSize(i,n)},this))},this)),this},_center:function(){},_adjustPosition:function(){},close:function(e,n){this.options.buttonLabel===i.Done&&this.options.appApi.displayApi.showSpinner(!0,{refElem:$("body")}),t.FafSignatureSyncView.prototype.close.call(this,e,n)}}),n.mixin(t.Reader.FafSignatureReaderNativeSyncView),t.Reader.FafSignatureReaderNativeSyncView}),define("fss/js/models/reader/faf-reader-native-signature-ui-model",["core/ac-core","core/models/model","fss/js/ac-faf"],function(e,t,i){return i.Reader.FafReaderNativeSignatureUIModel=e.UiModel.extend({recognized:{signUpdatePromise:{type:"object",optional:!0},syncRequested:{type:"boolean",optional:!1},syncDone:{type:"boolean",optional:!1},menuShown:{type:"boolean",optional:!1},sigClicked:{type:"boolean",optional:!0}},defaults:{syncDone:!1,menuShown:!1},initialize:function(t,i){this.options=i,e.UiModel.prototype.initialize.call(this),this.set(this.defaults)}}),i.Reader.FafReaderNativeSignatureUIModel}),define("fss/js/models/reader/model-factory",["core/ac-core","fss/js/ac-faf","fss/js/models/reader/faf-reader-native-signature-ui-model"],function(e,t){t.Reader.ModelFactory=e.Model.extend({create:function(e,i,n){var s=t.Reader[e];return s?new s(i,n):void LOG.error("AcFaf.Reader.ModelFactory.create: Unrecognized class: "+e)}})}),define("fss/js/views/faf-content-view",["core/ac-core","files/ac-files","fss/js/ac-faf","fss/js/xlib/EventTarget","fss/js/ui/FafMain","fss/js/data/fafconstants","fss/js/ui/formmanager","fss/js/lib/util","fss/js/lib/faf-ajax-util","fss/js/lib/utilUI","i18n!fss/js/nls/ui-strings","fss/js/lib/fafa","fss/js/lib/faf-common-util","fss/js/lib/faf-common-api-util","core/utils/date-util","fss/js/views/faf-app-view","fss/js/models/faf-app-limits-model","core/views/plugin-content-view","core/views/collection-items-view","fss/js/views/reader/faf-signature-reader-native-sync-view","fss/js/models/reader/model-factory","fss/js/models/reader/faf-reader-native-signature-ui-model"],function(e,t,i,n,s,o,a,r,l,d,f,c,u,h,p){return i.ContentView=e.PluginContentView.extend({initialize:function(){p.logElapsedTime("FSS: initialize"),e.PluginContentView.prototype.initialize.call(this),_.extend(this.options,{rootView:this}),this._openForm=_.throttle(this._openForm,1500,{leading:!0,trailing:!1}),this._renderChildViews=_.throttle(this._renderChildViews,1500,{trailing:!1})},render:function(){i.init().then(_.bind(function(){e.PluginContentView.prototype.render.call(this),this._renderChildViews()},this))},initPlugin:function(){p.logElapsedTime("FSS: initPlugin");var e=i.PLUGIN_ID;i._fafContentView=this;var t=i._app=new n;return t.currentUser=function(){return i._fafFormValuesCollection},t.notifyEvent=function(e,i){t.fire($.extend({type:e},i))},this._initPlugin().then(_.bind(function(){var t=i.PLUGIN_ID+"(/:formId)";i.appApi.routerApi.route(t,function(t){i.appApi.pluginsApi.selectPlugin(e,{formId:t})})},this))},setAppApi:function(t){e.PluginContentView.prototype.setAppApi.call(this,t),i.init(t)},getAppApiVersion:function(){return u.getAppApiVersion()},getPluginVersionList:function(){return i.versDefer||(i.versDefer=$.Deferred(),i.version=[],$.ajax(l.getAjaxOptions("/version",{error:function(){i.version.push("not available")},success:function(e){i.version.push(e.version)},complete:function(){i.versDefer.resolve()}}))),i.versDefer.promise(i.version)},deselectPlugin:function(){try{this.pluginSelected=!1;var e=$("#content");e.removeClass(this.$el.closest(".tool-content").attr("id")),i._app&&i._app.currentView&&e.removeClass("faf-"+i._app.currentView),i._app&&i._app.currentView&&"FillForm"===i._app.currentView&&(i._fafMain&&i._fafMain.dtfSwitchView("MyForms"),i._flushAllDirty&&i._flushAllDirty({closing:!0}).always(_.bind(function(){this.options.fafEditorUiModel.set("form_id",""),this.options.fafEditorUiModel.set("form_name","")},this)))}catch(t){}},selectPlugin:function(e){if(p.logElapsedTime("FSS: selectPlugin"),!this._checkedBrowserSupport){this._checkedBrowserSupport=!0;var t=r.browserAndVersion()[0],n=parseInt(r.browserAndVersion()[1],10),s=!1;switch(t){case"MSIE":s=n>=9;break;case"Firefox":s=n>=18;break;case"Chrome":s=n>=10;break;case"Safari":s=n>=5;break;case"Reader":case"Acrobat":s=!0}this._browserIsSupported=s}return this._browserIsSupported?i.init().then(_.bind(function(){i.appApi.displayApi.applyUIThemeStyles(this.$el).then(_.bind(function(){this.render(),i.appApi.displayApi.showSpinner(!1)},this)),h.initApiUtil();var t=$("#content");return t.addClass(this.$el.closest(".tool-content").attr("id")),i._app&&i._app.currentView&&t.addClass("faf-"+i._app.currentView),e&&e.formId?(this.formId=e.formId,this.formName=e.formName):i.appApi.routerApi.navigate(i.PLUGIN_ID),this._startPlugin().then(_.bind(function(){this.options.startingPluginOpPromise.then(_.bind(function(){this.options.fafEditorUiModel.on("change:form_name",_.bind(function(){var e=this.options.fafEditorUiModel.get("form_name");if(e){var t=e.split(".");if(t.length>1){var n=t[t.length-1];switch(n){case"form":case"pdf":e=e.substring(0,e.length-n.length-1)}}document.title=e+" - "+i.origDocTitle}else document.title=i.origDocTitle},this))},this)),this.pluginSelected||(this.pluginSelected=!0,c.logEvent("FillSignTab:Shown","FillSignTab:Shown","FillSignTab:Shown"),i.origDocTitle=document.title,this._startZoomPolling()),this.render()},this))},this)):(d.showUnsupportedFeatureDialog("",!0),i.appApi.pluginsApi.selectPlugin("home"),$.Deferred().resolve().promise())},getSiteCatalystName:function(){return"FSS"},_signinStateChange:function(t,i){var n=this.options.fafSigninStateModel,s=i===n.state.RETRYING||i===n.state.SIGNING_IN,o=r.browserAndVersion(!0);this.$divFafApp.addClass("faf-"+o[0]).removeClass("faf-online faf-offline").removeClass("faf-connection-disconnected"),u.isDesktop()?(this.$divFafApp.addClass("faf-desktop"),s&&this.$divFafApp.addClass("faf-loading")):this.$divFafApp.addClass("faf-browser"),e.Util.isWindows()?this.$divFafApp.addClass("faf-windows"):e.Util.isMac()&&this.$divFafApp.addClass("faf-osx"),this.options.fafAppLimitsModel.getFRFeatureLevel()>0&&this.$divFafApp.addClass("faf-fr-experiment"),this.options.startingPluginOpPromise.always(_.bind(function(){var e=n.get(n.STATE)===n.state.SIGNED_IN,t="faf-"+(e?"online":"offline"),i=n.get(n.REASON);n.get(n.STATE)===n.state.OFFLINE&&(i===n.reason.OLD_VERSION?t="faf-offline":i===n.reason.ERROR&&(t="faf-connection-disconnected")),this.$divFafApp.removeClass("faf-pdf-disabled faf-pdf-enabled"),t+=i===n.reason.DISABLED?" faf-pdf-disabled":" faf-pdf-enabled",s||this.$divFafApp.removeClass("faf-loading").addClass(t)},this))},_renderChildViews:function(){if(this.$divFafApp)i._formManager.fafEditorUiModel.get("form_id")?this.formId||i._fafMain.dtfSwitchView("MyForms"):(this._renderChildView("_fafAppView",i.FafAppView,this.$divFafApp,this.options),this._maybeLoadForm());else{this.$divFafApp=$("<div></div>"),window._gaq=void 0;var e=this.options.fafSigninStateModel;this._signinStateChange(e,e.get(e.STATE)),this.$el.append(this.$divFafApp),this._renderChildView("_fafAppView",i.FafAppView,this.$divFafApp,this.options),this.$divFafApp.append('<div id="testSubjects"></div>'),i._fafMain=new s(this.options),i._formManager=new a(i._app,this.options),i._fafFormView=this._fafAppView._fafEditorView._fafFormView,i._formManager.fafEditorUiModel=i._fafEditorUiModel=this.options.fafEditorUiModel,e.on("change:"+e.STATE,this._signinStateChange),e.on("change:"+e.DISCONNECTED,this._signinStateChange),this._signinStateChange(e,e.get(e.STATE)),this._maybeLoadForm()}},_initPlugin:function(){return this._initingPluginPromise||(this._initingPluginPromise=i.opFactory.create("InitializingPluginOp",this.options).run()),this._initingPluginPromise},_maybeLoadForm:function(){if(u.isDesktop()){i.Reader.modelFactory=new i.Reader.ModelFactory,i.Reader.fafReaderNativeSignatureUIModel=i.Reader.modelFactory.create("FafReaderNativeSignatureUIModel");var e=u.desktopNativeSignCommand();if(e){switch($("body").addClass("faf-native-sign"),e){case"sign_menu":$("body").css("overflow","hidden"),i.Reader.opFactory.create("TogglingReaderNativeSignatureMenuOp",this.options).run();break;case"sign_sync":i.Reader.opFactory.create("SignatureSyncReaderNativeOp",_.extend({ViewCls:i.Reader.FafSignatureReaderNativeSyncView},this.options)).run();break;case"sign_dlg":i.Reader.opFactory.create("ShowingNativeSignaturePopupOp",this.options).run();break;case"setting_dlg":i.Reader.opFactory.create("SettingPopupOp",this.options).run()}return}}this.options.fafAppLimitsModel.initialized().then(_.bind(function(){this._maybeLoadFormEx()},this))},_maybeLoadFormEx:function(){try{if(u.isDesktop())this._openForm({id:"reader",formName:"reader"},!0);else if(this.formId)this._openForm({id:this.formId,formName:this.formName},!0);else{var e=this._checkPreselectedFiles();if(e){var t=".pdf"===e.formName.slice(-4).toLowerCase(),n=this.options.fafAppLimitsModel;_.contains(n.supportedMimetypes(),e.contentType)||t?i.opFactory.create("CreateAndOpenFormViaBhOp",_.extend({assetID:e.id,backToFiles:!0,contentType:e.contentType,size:e.size,filename:e.formName,parentID:e.parent_id},this.options)).run():e.contentType===o.FORM_CONTENT_TYPE&&this._openForm(e,!0)}}}catch(s){r.logError("faf-content-view",s)}},_openForm:function(e,t){var n=_.extend({formID:e.id,showProgress:t,backToFiles:!0,formName:e.formName,formSource:"FilesTab",formType:"ExistingForm",formOrigin:"AcomFile"},this.options);return i.opFactory.create("OpenFormOp",n).run()},_checkPreselectedFiles:function(){var e=i.appApi.selectionApi.getSelectedItemModels(),t=null,n=null,s=this.options.fafAppLimitsModel,a=null;if(_.some(e,function(e,i){var r=e.get("content_type"),l=".pdf"===e.get("name").slice(-4).toLowerCase();return _.contains(s.supportedMimetypes(),r)||l||r===o.FORM_CONTENT_TYPE?(t={id:i,contentType:r,formName:e.get("name"),size:e.get("size"),parent_id:e.get("parent_id")},!0):(a={fileType:r,fileSize:e.get("size")},n||(n=e.get("name")),!1)}),!t&&n){var r="Form:Upload:Error",l=r+":UnsupportedFile",u=_.template(f.UnsupportedFileTypeMsg,{file:n});a.errorCode="UnsupportedFile",a.errorMessage=u,c.logEvent(null,r,l,a),d.showGenericDialog(u)}return t&&t.contentType!==o.FORM_CONTENT_TYPE&&t.size>s.get("max_file_size")&&(a={code:"UnsupportedFileSize",fileType:t.contentType,fileSize:t.size},c.reportUploadError({},a),t=null),i.appApi.selectionApi.setSelectedItemModels({}),t},_startPlugin:function(){var e=this._startingPluginPromise;return e||(e=this._startingPluginPromise=i.opFactory.create("StartingPluginOp",this.options).run()),e},directInkSignature:function(e){if(0==e.fillSignApplyStatus||1==e.fillSignApplyStatus){i._signatures.popupUiModel.attributes.activateApply=!e.fillSignApplyStatus;var t=!i._signatures.popupUiModel.attributes.activateApply;return void i._signatures.popupUiModel.set("activateApply",t)}if(i._signatures.popupUiModel.attributes.isDirectInkActivated&&-1==e.fillSignApplyStatus){e.val?(i._signatures.popupUiModel.attributes.isBlank=1,i._signatures.popupUiModel.attributes.signInfo=""):(i._signatures.popupUiModel.attributes.isBlank=0,i._signatures.popupUiModel.attributes.signInfo=e.signInfo);var t=!i._signatures.popupUiModel.attributes.isSigned;i._signatures.popupUiModel.set("isSigned",t)}},_startZoomPolling:function(){function e(){if(t.pluginSelected){var o=i._formManager&&i._formManager.fafEditorUiModel;if(!o||!o.get("form_id"))return n=0,void setTimeout(e,500);var a;switch(s){case"Chrome":case"Reader":case"Acrobat":a=window.outerWidth/$(window).width();break;case"Safari":a=document.width/$(document).width();break;case"Firefox":a=window.devicePixelRatio;break;case"MSIE":a=screen.deviceXDPI}a=Math.round(100*a)/100,n&&n!==a&&c.logEvent(null,"BrowserZoomed",a>n?"Browser:Zoomed:Up":"Browser:Zoomed:Down"),n=a,setTimeout(e,500)}}var t=this,n=0,s=r.browserAndVersion()[0],o=parseInt(r.browserAndVersion()[1],10),a=!1;switch(s){case"MSIE":a=o>=9;break;case"Firefox":a=o>=18;break;case"Chrome":a=o>=10;break;case"Safari":a=o>=5;break;case"Reader":case"Acrobat":a=!0}a&&setTimeout(e,500)}}),i.ContentView}),define("fss/js/faf",["fss/js/ac-faf","fss/js/ops/op-factory","fss/js/views/faf-content-view","fss/js/models/model-factory","fss/js/ops/reader/op-factory"],function(e){_.extend(e,{init:function(t){return this.initializedPromise||(this.initializedPromise=$.Deferred()),this.appApi||!t?this.initializedPromise.promise():(e.opFactory=new e.OpFactory,e.modelFactory=new e.ModelFactory,e.Reader.opFactory=new e.Reader.OpFactory,e.appApi=t,e.appApi.done(_.bind(function(){this.initializedPromise.resolve()},this)),this.initializedPromise.promise())}})}),define("fss/js/views/faf-selector-view",["core/ac-core","plugins-common/ac-plugins","fss/js/ac-faf","core/utils/util","i18n!fss/js/nls/ui-strings","core/views/plugin-selector-view"],function(e,t,i,n,s){return i.SelectorView=e.PluginSelectorView.extend({setAppApi:function(t){e.PluginSelectorView.prototype.setAppApi.call(this,t),i.init(t)},getAppApiVersion:function(){return n.isCEF()?"dev":t.groups.forms.FRAMEWORK_VERSION||"1.0.12"},getSelectorLabel:function(){return s.FAF},getSiteCatalystName:function(){return"FSS"},render:function(){return e.PluginSelectorView.prototype.render.call(this),this},getSelectorIconClass:function(){return"faf-toolbar-icon"}}),i.SelectorView}),define("fss/js/selector",["fss/js/faf","fss/js/ac-faf","fss/js/views/faf-selector-view"],function(){}),define("dc-scribble-utils",[],function(){function e(e,i,n){if(e&&e.render&&e.render.vector&&e.render.vector.sequences&&e.render.vector.sequences.length&&e.render.dimension&&e.render.dimension.width&&e.render.dimension.height){var d=0,f=0;if(n=isNaN(n)?10:n,i=i||a,i!==a){var c=t(e);if((i===r||i===o)&&(e.render.dimension.width=c.x2-c.x1+2*n,d=c.x1-n),i===l||i===o){var u=e.render.dimension.height,h=u-(c.y2+n),p=c.y1-n,g=h*s;if(p>=g)e.render.dimension.height=u-h-g,f=g;else{var _=p/s;e.render.dimension.height=u-p-_,f=p}var m=e.render.vector.penWidthRatio,v=e.render.dimension.height;if(m&&u!==v){var S=m*u;e.render.vector.penWidthRatio=S/v}}}for(var E=e.render.vector.sequences,b=E.length,w=0;b>w;w++)if(E[w].points)for(var F=E[w].points.length,T=0;F>T;T++){var D=E[w].points[T];D.x-=d,D.y-=f}}return e}function t(e){var t=e&&e.render.dimension&&e.render.dimension?e.render.dimension.width:0,i=e&&e.render.dimension&&e.render.dimension?e.render.dimension.height:0,n=-1,s=-1,o=t,a=i;if(e&&e.render&&e.render.vector&&e.render.vector.sequences&&e.render.vector.sequences.length)for(var r=e.render.vector.sequences,l=r.length,d=0;l>d;d++)if(r[d].points)for(var f=r[d].points.length,c=0;f>c;c++){var u=r[d].points[c];n=Math.max(n,u.x),s=Math.max(s,u.y),o=Math.min(o,u.x),a=Math.min(a,u.y)}return{x1:o,y1:a,x2:n,y2:s}}var i=.018,n=.64,s=n/(1-n),o="trim_policy_all",a="trim_policy_none",r="trim_policy_width",l="trim_policy_height";return{DEFAULT_PEN_WIDTH_RATIO:i,INTENT_SIGNATURE:"signature",INTENT_INITIALS:"initials",TRIM_POLICY_ALL:o,TRIM_POLICY_NONE:a,TRIM_POLICY_WIDTH:r,TRIM_POLICY_HEIGHT:l,TYPE_POLYLINE:"polyline",TYPE_SMOOTHED:"smoothed",BASELINE:n,trimVectorData:e}}),define("dc-scribble-capture",["dc-scribble-utils"],function(e){function t(t,o){this._canvas=t,this._context=t.getContext("2d"),this._type=e.TYPE_SMOOTHED,o=o||{},(!o.hasOwnProperty("intent")||o.intent!==e.INTENT_SIGNATURE&&o.intent!==e.INTENT_INITIALS)&&(o.intent=e.INTENT_SIGNATURE),n.call(this,o),s.call(this),this._canvas.addEventListener("mousedown",i(w,this),!1),this._canvas.addEventListener("mousemove",i(F,this),!1),this._canvas.addEventListener("mouseup",i(T,this),!1),this._canvas.addEventListener("mouseenter",i(E,this),!1),this._canvas.addEventListener("mouseleave",i(b,this),!1),this._canvas.addEventListener("touchstart",i(w,this),!1),this._canvas.addEventListener("touchmove",i(F,this),!1),this._canvas.addEventListener("touchend",i(T,this),!1)}function i(e,t){return function(i){e.call(t,i)}}function n(t){t=t||{},t.hasOwnProperty("intent")&&(t.intent!==e.INTENT_INITIALS&&t.intent!==e.INTENT_SIGNATURE&&(t.intent=e.INTENT_SIGNATURE),this._intent=t.intent),t.hasOwnProperty("penWidthRatio")&&(this._penWidthRatio=t.penWidthRatio),t.hasOwnProperty("customAspectRatio")&&(this._customAspectRatio=t.customAspectRatio),t.hasOwnProperty("penColor")&&(this._context.fillStyle=t.penColor,this._context.strokeStyle=t.penColor),l.call(this,t.width,t.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 e={penWidthRatio:void 0,penColor:"#000000",customAspectRatio:void 0};n.call(this,e),s.call(this)}function a(){return!this._pointData||!this._pointData.length}function r(e){e=e||{};var t=u.call(this);e.hasOwnProperty("intent")&&(t.intent=e.intent,this._intent=e.intent),e.hasOwnProperty("penWidthRatio")&&(t.render.vector.penWidthRatio=e.penWidthRatio,this._penWidthRatio=e.penWidthRatio),e.hasOwnProperty("penColor")&&(t.penColor=e.penColor,this._context.fillStyle=e.penColor,this._context.strokeStyle=e.penColor),e.hasOwnProperty("customAspectRatio")&&(this._customAspectRatio=e.customAspectRatio),(e.hasOwnProperty("width")||e.hasOwnProperty("height")||e.hasOwnProperty("customAspectRatio")||e.hasOwnProperty("intent"))&&(l.call(this,e.width,e.height),this._intent||S(t,this.width,this.height)),_.call(this,t)}function l(e,t){this._devicePixelRatio=window.devicePixelRatio||1;var i=this._context.fillStyle,n=this._context.strokeStyle,s=this.aspectRatio;s?t?e=t*s:e?t=e/s:(t=this.height,e=t*s):(t=t||this.height,e=e||this.width),this._canvas.width=e*this._devicePixelRatio,this._canvas.height=t*this._devicePixelRatio,this._canvas.style.width=e+"px",this._canvas.style.height=t+"px",this._context.scale(this._devicePixelRatio,this._devicePixelRatio),this._context.fillStyle=i,this._context.strokeStyle=n}function d(){return Math.max(1,(this._penWidthRatio||e.DEFAULT_PEN_WIDTH_RATIO)*this.height)}function f(e,i,n,s){var o=document.createElement("canvas"),a=u.call(this,e,i),r=a.render.dimension.width/a.render.dimension.height,l=new t(o,{customAspectRatio:r});l.intent=void 0,l.render(a),!n&&s?l.height=s:n&&!s?l.width=n:n&&s&&(l.height=l.width/n<=l.height/s?s:n/r);var d=l._canvas.toDataURL("image/png").split(",")[1],f={width:l.width,height:l.height,data:d};return o.remove(),f}function c(e){return e&&e.render&&e.render.vector&&e.render.vector.sequences&&e.render.vector.sequences.length}function u(t,i){var n={intent:this._intent,penColor:this.penColor,render:{dimension:{width:this.width,height:this.height,baseline:e.BASELINE},vector:{type:this._type,sequences:[]}}};return n.render.vector.penWidthRatio=this._penWidthRatio||e.DEFAULT_PEN_WIDTH_RATIO,this._pointData&&0!==this._pointData.length?(n.render.vector.sequences=h(this._pointData),t&&t!==e.TRIM_POLICY_NONE?e.trimVectorData(n,t,i):n):n}function h(e){for(var t=[],i=e?e.length:0,n=0;i>n;n++){t.push({points:[]});for(var s=e[n].length,o=0;s>o;o++){var a=e[n][o],r={x:a.x,y:a.y,t:a.t};t[n].points.push(r)}}return t}function p(e){var t=[];if(c(e))for(var i=e.render.vector.sequences,n=i.length,s=0;n>s;s++)if(t.push([]),i[s].points)for(var o=i[s].points.length,a=0;o>a;a++){var r=i[s].points[a],l={x:r.x,y:r.y,t:r.t};t[s].push(l)}return t}function g(){var t=N[this._intent].aspectRatio,i=u.call(this);if(c(i)&&i.render.dimension&&i.render.dimension.width&&i.render.dimension.height){var n=i.render.dimension.width/i.render.dimension.height;if(n===t);else if(t>n)i.render.dimension.width=i.render.dimension.height*t;else{for(var s=i.render.dimension.width/t,o=i.render.dimension.height,a=s-o,r=a*e.BASELINE,l=i.render.vector.sequences,d=l.length,f=0;d>f;f++)if(l[f].points)for(var h=l[f].points.length,p=0;h>p;p++)l[f].points[p].y+=r;var g=i.render.vector.penWidthRatio;if(g&&o!==s){var _=g*o;i.render.vector.penWidthRatio=_/s}i.render.dimension.height=s}}if(i.render)return{render:i.render};throw new Error("DCScribble getVectorDataForSync: error getting vector data")}function _(e){if(s.call(this),c(e)&&e.render.dimension&&e.render.dimension.width&&e.render.dimension.height){var t=e.render.dimension.width,i=e.render.dimension.height,n=t/i;if(this._intent&&this.height){var o=this.height,a=o*n;S(e,a,o)}else l.call(this,t,i);this._pointData=p(e),this._type=e.render.vector.type,this._penWidthRatio=e.render.vector.penWidthRatio,e.penColor&&(this._context.fillStyle=e.penColor,this._context.strokeStyle=e.penColor),$[e.render.vector.type].call(this,e),this._canvas.dispatchEvent(new CustomEvent("onScribbleChanged",{detail:this}))}}function m(e){if(c(e))for(var t=e.render.vector.sequences,i=t.length,n=0;i>n;n++){var s=t[n];if(s.points){var o=s.points.length;if(1===o)I.call(this,s.points[0],!0);else if(o>1)for(var a=0;o>a;a++){var r=s.points[a];0===a?C.call(this,r):P.call(this,r)}}}}function v(e){if(c(e))for(var t=e.render.vector.sequences,i=t.length,n=0;i>n;n++){var s=t[n];if(s.points){var o=s.points.length;if(1===o)I.call(this,s.points[0]);else if(o>1){for(var a=0;o>a;a++){var r=s.points[a];0===a?C.call(this,r):R.call(this,r)}R.call(this,s.points[o-1],!0)}}}}function S(e,t,i){if(c(e)&&e.render.dimension&&e.render.dimension.width&&e.render.dimension.height){for(var n=e.render.vector.sequences,s=t/e.render.dimension.width,o=i/e.render.dimension.height,a=n.length,r=0;a>r;r++)if(n[r].points)for(var l=n[r].points.length,d=0;l>d;d++){var f=n[r].points[d];f.x=f.x*s,f.y=f.y*o}e.render.dimension.width=t,e.render.dimension.height=i}}function E(e){this._mouseLeftActive&&(1===e.buttons&&w.call(this,e),delete this._mouseLeftActive)}function b(e){this._trackingActive&&(this._mouseLeftActive=!0,T.call(this,e))}function w(e){if(e.preventDefault(),!this._trackingActive){this._trackingActive=!0,this._pointData.length&&this._pointData.push([]);var t=y.call(this,e);A.call(this,t.x,t.y),C.call(this,t),this._didDrawStroke=!1}}function F(e){if(e.preventDefault(),this._trackingActive){var t=y.call(this,e);A.call(this,t.x,t.y),R.call(this,t),this._didDrawStroke=!0,this._intervalID&&clearInterval(this._intervalID),this._intervalID=setInterval(i(function(){var e=D.call(this);e&&(A.call(this,e.x,e.y),R.call(this,e))},this),50)}}function T(e){if(e.preventDefault(),this._intervalID&&clearInterval(this._intervalID),this._intervalID=0,this._trackingActive){var t=D.call(this);t&&(this._didDrawStroke?R.call(this,t,!0):I.call(this,t)),this._trackingActive=!1}}function D(){var e=this._pointData.length;if(e>0){var t=this._pointData[e-1];if(t.length>0)return t[t.length-1]}return void 0}function y(e){var t=e;e.targetTouches&&e.targetTouches.length?t=e.targetTouches[0]:e.changedTouches&&e.changedTouches.length&&(t=e.changedTouches[0]);var i=this._canvas.getBoundingClientRect();return{x:t.clientX-i.left,y:t.clientY-i.top}}function A(e,t){this._pointData.length||(this._pointData.push([]),window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.firstTouch.postMessage("touched"));var i=(new Date).getTime();this._startTime<0&&(this._startTime=i);var n={x:e,y:t,t:i-this._startTime};this._pointData[this._pointData.length-1].push(n),this._canvas.dispatchEvent(new CustomEvent("onScribbleChanged",{detail:this}))}function C(e){this._dynaDrawVelocity={x:0,y:0},this._previousPoint={x:0,y:0},this._touchHistory[0]=this._touchHistory[1]=this._touchHistory[2]=this._previousPathEnd=e}function P(e){this._touchHistory[0]=this._touchHistory[1],this._touchHistory[1]=e;var t=this._touchHistory[0],i=this._touchHistory[1];this._context.beginPath(),this._context.moveTo(t.x,t.y),this._context.lineTo(i.x,i.y),this._context.lineWidth=d.call(this),this._context.lineCap="round",this._context.stroke()}function R(e,t){var i;i=e.x===this._previousPoint.x&&e.y===this._previousPoint.y?e:O.call(this,e,this._touchHistory[2]),this._previousPoint=e,this._touchHistory[0]=this._touchHistory[1],this._touchHistory[1]=this._touchHistory[2],this._touchHistory[2]=i;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=t?e:{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=d.call(this),this._context.lineCap="round",this._context.stroke(),this._previousPathEnd=a}function I(e){var t=.65*d.call(this);this._context.beginPath(),this._context.arc(e.x,e.y,t,0,2*Math.PI),this._context.fill()}function O(e,t){var i={x:(e.x-t.x)*M,y:(e.y-t.y)*M},n=this._dynaDrawVelocity;n={x:(n.x+i.x)*(1-x),y:(n.y+i.y)*(1-x)};var s={x:t.x+n.x,y:t.y+n.y};return this._dynaDrawVelocity={x:n.x*(1-x),y:n.y*(1-x)},s}!function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}e.prototype=window.Event.prototype,window.CustomEvent=e}();var M=.6,x=.4,N={signature:{aspectRatio:4.233},initials:{aspectRatio:1.1667}},$={polyline:m,smoothed:v};return t.prototype={constructor:t,get type(){return this._type},set type(e){throw new Error("DCScribble type: readonly property")},get intent(){return this._intent},set intent(t){if(t&&t!==e.INTENT_SIGNATURE&&t!==e.INTENT_INITIALS)throw new Error("DCScribble intent: must be a 'signature' or 'initials'");r.call(this,{intent:t})},get height(){return this._canvas.height/this._devicePixelRatio},set height(e){if(isNaN(e)||0>=e)throw new Error("DCScribble height: must be a number greater than 0");r.call(this,{height:e})},get width(){return this._canvas.width/this._devicePixelRatio},set width(e){if(isNaN(e)||0>=e)throw new Error("DCScribble width: must be a number greater than 0");r.call(this,{width:e})},get penWidthRatio(){return this._penWidthRatio},set penWidthRatio(e){if(isNaN(e)||0>=e)throw new Error("DCScribble penWidthRatio: must be a number greater than 0");r.call(this,{penWidthRatio:e})},get penColor(){return this._context.fillStyle},set penColor(e){r.call(this,{penColor:e})},get aspectRatio(){return void 0===this._customAspectRatio?this._intent&&N.hasOwnProperty(this._intent)?N[this._intent].aspectRatio:void 0:this._customAspectRatio},get customAspectRatio(){return this._customAspectRatio},set customAspectRatio(e){if(void 0===e)r.call(this,{customAspectRatio:void 0});else if(isNaN(e)||0>=e)throw new Error("DCScribble customAspectRatio: must be a number greater than 0");r.call(this,{customAspectRatio:e})},clear:s,reset:o,isEmpty:a,render:_,getImageData:f,getVectorData:u,getVectorDataForSync:g},t}),define("dc-scribble-render",["dc-scribble-capture"],function(e){function t(e){this._canvas=e,this._context=e.getContext("2d")}return t.prototype.constructor=t,t.prototype=Object.create(e.prototype,{intent:{set:function(){}},aspectRatio:{get:function(){if(this.isEmpty())return void 0;var e=this.getVectorData();return e&&e.render&&e.render.dimension&&e.render.dimension.height?e.render.dimension.width/e.render.dimension.height:void 0}},customAspectRatio:{get:function(){return this.aspectRatio},set:function(){}},getVectorDataForSync:{value:function(){return void 0}}}),t}),define("dc-scribble",["dc-scribble-capture","dc-scribble-render","dc-scribble-utils"],function(e,t,i){return{utils:i,createCapture:function(t,i){return new e(t,i)
},createRender:function(e){return new t(e)}}}),define("fss/js/xlib/dc-scribble-all",function(){}),define("fss/js/plugin",["core/ac-core-init","fss/js/ac-faf","fss/js/faf","fss/js/xlib/dc-scribble-all"],function(e,t){t.init()}),define("fss/js/plugins/js/faf-settings",["plugins-common/ac-plugins","fss/js/ac-faf","fss/js/faf"],function(e,t){var i=t.Settings;return i||(i=t.Settings={}),i.Reader||(i.Reader={}),i.PLUGIN_ID||(i.PLUGIN_ID="fillsign_settings"),i}),define("fss/js/plugins/js/ops/starting-plugin-op",["core/ac-core","fss/js/ac-faf","fss/js/plugins/js/faf-settings","core/ops/op"],function(e,t,i){i.StartingPluginOp=e.Op.extend({run:function(){var e=t.opFactory.create("StartingPluginCommonOp",this.options);return e.run()}})}),define("fss/js/plugins/js/ops/clearing-userdata-op",["core/ac-core","core/utils/util","fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/plugins/js/faf-settings"],function(e,t,i,n,s){s.ClearingUserDataOp=e.Op.extend({run:function(){var e=$.Deferred(),t=this.options,s=n.getBaseFSSUrl(),o=t.appApi.sessionApi.getPrimaryToken(),a={global:!1,modal:!1,url:s+"/api/profiles/clear",xhrFields:{withCredentials:!0},headers:{AUTHORIZATION:"Bearer "+o,"x-api-client-id":"api_browser"},contentType:"application/json",dataType:"json",type:"POST",data:JSON.stringify({}),success:_.bind(function(t){i._fafUserDataModel.set("profiles",t.profiles),e.resolve()},this),error:_.bind(function(t){LOG.error("ERROR: cannot tell server user data cleared"),e.reject(t)},this)};return $.ajax(a),e.promise()}})}),define("fss/js/plugins/js/ops/clearing-recognitiondata-op",["core/ac-core","core/utils/util","fss/js/ac-faf","fss/js/lib/faf-common-util","fss/js/plugins/js/faf-settings"],function(e,t,i,n,s){s.ClearingRecognitionDataOp=e.Op.extend({run:function(){var e=$.Deferred(),t=this.options,i=n.getBaseFSSUrl(),s=t.appApi.sessionApi.getPrimaryToken(),o={global:!1,modal:!1,url:i+"/api/recognition/clear",xhrFields:{withCredentials:!0},headers:{AUTHORIZATION:"Bearer "+s,"x-api-client-id":"api_browser"},contentType:"application/json",dataType:"json",type:"POST",data:JSON.stringify({}),success:_.bind(function(){e.resolve()},this),error:_.bind(function(t){LOG.error("ERROR: cannot tell server recognition data cleared"),e.reject(t)},this)};return $.ajax(o),e.promise()}})}),define("fss/js/plugins/js/ops/confirming-clear-all-op",["core/ac-core","fss/js/ac-faf","fss/js/lib/faf-common-util","i18n!fss/js/nls/ui-strings","fss/js/plugins/js/faf-settings"],function(e,t,i,n,s){return s.ConfirmingClearAllOp=e.Op.extend({run:function(){var e=this.options;return e.appApi.dialogApi.displayHtmlAlert(e.appApi.dialogApi.SEVERITY_WARNING,"",e.htmlMessage,e.OK,n.Cancel,_.extend({dlgClass:"faf-settings-confirm-dlg"+(i.isDesktop()?" faf-desktop":"")},e.appApi.options,e))}}),s.ConfirmingClearAllOp}),define("fss/js/plugins/js/ops/clearing-autocomplete-data-op",["core/ac-core","fss/js/ac-faf","fss/js/plugins/js/faf-settings","fss/js/lib/util","fss/js/lib/faf-ajax-util"],function(e,t,i,n,s){i.ClearingAutocompleteDataOp=e.Op.extend({run:function(){var e=$.Deferred(),t=this.options,i=t.fafAutocompleteStateModel;return i.getState().then(function(t){var o=t.ac_c+1;i.setManually("ac_c",o);var a=s.getAjaxOptions("DELETE","/autoc",{error:function(){n.logError("autocomplete-clear","Error sending ac-clear request to server "),e.reject()},success:function(){i.setManually("ac_c",0),i.trigger("clear_values"),e.resolve()}}),r=s.addDexiAjaxOptions(a,{version:2,useCharset:!0,setContentType:!0,setAccepts:!0});$.ajax(r)}).fail(function(){n.logError("autocomplete-clear","Error getting ac state "),e.reject()}),e.promise()}})}),define("fss/js/plugins/js/ops/toggling-autocomplete-op",["core/ac-core","fss/js/ac-faf","fss/js/plugins/js/faf-settings"],function(e,t,i){i.TogglingAutocompleteOp=e.Op.extend({run:function(){var e=$.Deferred(),t=this.options,i=t.fafPreferencesModel,n=t.fafAutocompleteStateModel;return n.getState().then(function(e){var t=1-e.ac_s;i.setPreference("user.ac_s",t),n.set("ac_s",t)}).always(function(){e.resolve()}),e.promise()}})}),define("fss/js/plugins/js/ops/op-factory",["core/ac-core","fss/js/plugins/js/faf-settings","fss/js/plugins/js/ops/starting-plugin-op","fss/js/ops/faf-starting-op","fss/js/ops/starting-plugin-common-op","fss/js/ops/getting-autocomplete-state-op","fss/js/plugins/js/ops/clearing-userdata-op","fss/js/plugins/js/ops/clearing-recognitiondata-op","fss/js/plugins/js/ops/confirming-clear-all-op","fss/js/plugins/js/ops/clearing-autocomplete-data-op","fss/js/plugins/js/ops/toggling-autocomplete-op"],function(e,t){t.OpFactory=e.Op.extend({create:function(e,i){var n=t[e];return n?new n(i):void LOG.error("AcFafSettings.OpFactory.create: Unrecognized class: "+e)}})}),define("fss/js/plugins/js/ops/reader/clearing-reader-userdata-op",["core/ac-core","fss/js/plugins/js/faf-settings","fss/js/lib/reader/faf-reader-api-util","fss/js/plugins/js/ops/clearing-userdata-op","fss/js/plugins/js/ops/reader/op-factory"],function(e,t,i){return t.Reader.ClearingReaderUserDataOp=t.ClearingUserDataOp.extend({run:function(){var e=$.Deferred(),n=!1,s=i.deleteGlobalSignatures(),o=t.ClearingUserDataOp.prototype;return s.always(_.bind(function(){n="rejected"===s.state(),o.run.call(this).then(function(){n?e.reject():e.resolve()}).fail(function(){e.reject()})},this)),e.promise()}}),t.Reader.ClearingReaderUserDataOp}),define("fss/js/plugins/js/ops/reader/op-factory",["core/ac-core","fss/js/plugins/js/faf-settings","fss/js/plugins/js/ops/reader/clearing-reader-userdata-op"],function(e,t){return t.Reader.OpFactory=e.Op.extend({create:function(e,i){var n=t.Reader[e];return n?new n(i):void LOG.error("AcFafSettings.Reader.OpFactory.create: Unrecognized class: "+e)}}),t.Reader.OpFactory}),define("fss/js/plugins/js/templates/faf-settings-plugin-view-template",[],function(){return'<div class="faf-settings"><div class="faf-section faf-autocomplete-section"><div class="faf-header theme-text" role="heading" aria-level="2"><%- autocompleteHead %></div><div class="faf-checkbox-group"><div class="faf-autocomplete-toggle core-checkbox faf-checkbox <%= autocompleteToggleState %>" id="faf-autocomplete-toggle" role="checkbox" aria-labelledby="faf-toggle-desc theme-text" aria-checked="<%= autocompleteToggled %>" tabindex="0"></div><div class="faf-toggle-desc faf-checkbox-label  theme-text"role="presentation"><label id="faf-toggle-desc" for="faf-autocomplete-toggle"><%- autocompleteToggleDesc %></label></div></div><div class="faf-button-container faf-button-container-autocomplete"><input class="control-button button-light-blue-small faf-autocomplete-clear-btn theme-hyperlink theme-hoverable" type="button" value="<%- autocompleteClear %>" /></div></div><div class="faf-section"><div class="faf-header theme-text" role="heading" aria-level="2"><%- userDataHead %></div><div class="faf-button-container faf-button-container-userdata"><input class="control-button button-light-blue-small faf-user-data-clear-btn theme-hyperlink theme-hoverable"" type="button" value="<%- userDataClear %>" /></div></div></div>'}),define("fss/js/plugins/js/views/faf-settings-plugin-view",["core/ac-core","fss/js/plugins/js/faf-settings","i18n!fss/js/nls/ui-strings","fss/js/plugins/js/templates/faf-settings-plugin-view-template","fss/js/ac-faf","fss/js/lib/fafa","fss/js/lib/utilUI","fss/js/lib/faf-common-util","core/views/plugin-content-view","core/views/collection-items-view"],function(e,t,i,n,s,o,a,r){return t.PluginView=e.PluginContentView.extend({initialize:function(){e.PluginContentView.prototype.initialize.call(this)},events:{"click .faf-user-data-clear-btn":"_onClearUserData","click .faf-autocomplete-clear-btn":"_onClearAutocomplete","click .faf-autocomplete-toggle":"_onToggleAutocomplete","keydown .faf-autocomplete-toggle":"_onToggleAutocomplete","click .faf-toggle-desc":"_onToggleAutocomplete","mouseenter .faf-autocomplete-clear-btn":"_onHoverAutocomplete","mouseenter .faf-user-data-clear-btn":"_onHoverUserData","mouseleave .faf-autocomplete-clear-btn":"_onHoverAutocomplete","mouseleave .faf-user-data-clear-btn":"_onHoverUserData","focusin .faf-autocomplete-clear-btn":"_onHoverAutocomplete","focusin .faf-user-data-clear-btn":"_onHoverUserData","focusout .faf-autocomplete-clear-btn":"_onHoverAutocomplete","focusout .faf-user-data-clear-btn":"_onHoverUserData"},render:function(){e.PluginContentView.prototype.render.call(this),this._renderChildViews()},initPlugin:function(){var e=this.options.appApi;return e.pluginsApi.selectPlugin(t.PLUGIN_ID,void 0,!0),this._getResolvedPromise()},setAppApi:function(i){e.PluginContentView.prototype.setAppApi.call(this,i),t.init(i)},getAppApiVersion:function(){return r.getAppApiVersion()},selectPlugin:function(){return this._startPlugin().then(_.bind(function(){this.render()},this))},getSiteCatalystName:function(){return"FafSettings"},_renderChildViews:function(){if(this.$el.length>0){var e=this.options.fafAutocompleteStateModel;e.getState().then(_.bind(function(e){this._acState=e},this)).fail(_.bind(function(){this._acState={ac_s:0,ac_c:0},LOG.error("Using default autcomplete state")},this)).always(_.bind(function(){this._addUiModelEventListeners();var t="SettingsDlg:Shown";o.logEvent(null,t,t);var s=r.isDesktop()?"SettingsAutocompleteToggleDescRdr":"SettingsAutocompleteToggleDesc",a=this._acState.ac_s;0===this.$el.children().length&&(this.$el.append(_.template(n,{userDataHead:i.SettingsUserDataHead,userDataClear:i.SettingsUserDataClear,autocompleteHead:i.SettingsAutocompleteHead,autocompleteClear:i.SettingsAutocompleteClear,autocompleteToggleDesc:i[s],autocompleteToggleState:a?"on":"off",autocompleteToggled:a?"true":"false"})),e.featureIsEnabled(!0)||$(".faf-autocomplete-section").css("display","none"))},this))}},_startPlugin:function(){var e=this._startingPluginPromise;return e||(e=this._startingPluginPromise=t.opFactory.create("StartingPluginOp",this.options).run()),e},_addUiModelEventListeners:function(){var e=this.options.fafAutocompleteStateModel;e.on("change:ac_s",_.bind(function(){var t=e.get("ac_s"),i=this.$el.find(".faf-autocomplete-toggle");this._acState.ac_s=t,i.toggleClass("off",!t),i.toggleClass("on",t),i.attr("aria-checked",t?"true":"false")},this))},_onClearUserData:function(){this._clearAll({action:"SettingsDlg:ClearUserData",htmlMessage:i.SettingsUserDataConfirmHtml,OK:i.SettingsUserDataClearConfirm,clearOp:r.isDesktop()?"ClearingReaderUserDataOp":"ClearingUserDataOp",clearOpFactory:r.isDesktop()?t.Reader.opFactory:t.opFactory,buttonContainer:".faf-button-container-userdata",buttonClass:".faf-user-data-clear-btn",clearingKey:"SettingsUserDataClearing",guideCompleteKey:"SettingsUserDataGuideCleared",guideErrorKey:"SettingsGuideClearErr"})},_onHoverUserData:function(e){this._onHover(e,".faf-button-container-userdata",".faf-user-data-clear-btn","SettingsUserDataGuideClear")},_onClearAutocomplete:function(){this._clearAll({action:"SettingsDlg:ClearAutocompleteData",htmlMessage:i.SettingsAutocompleteConfirmHtml,OK:i.SettingsAutocompleteClearConfirm,clearOp:["ClearingAutocompleteDataOp","ClearingRecognitionDataOp"],buttonContainer:".faf-button-container-autocomplete",buttonClass:".faf-autocomplete-clear-btn",clearingKey:"SettingsAutocompleteClearing",guideCompleteKey:"SettingsAutocompleteGuideCleared",guideErrorKey:"SettingsGuideClearErr"})},_clearAll:function(e){var t=e.action;o.logEvent(null,t,t),this._onOp("ConfirmingClearAllOp",_.extend({parentView:this},this.options,e)).then(_.bind(function(){var t=this.$el.find(e.buttonClass),n=t.attr("value");t.addClass("disabled"),t.attr("value",i[e.clearingKey]);var s=e.clearOpFactory;this._onOp(e.clearOp,_.extend({},this.options,e),s).then(_.bind(function(){t.attr("value",n),this._showButtonGuide(e.buttonContainer,e.buttonClass,e.guideCompleteKey,150,"faf-success")},this)).fail(_.bind(function(){t.attr("value",n),this._showButtonGuide(e.buttonContainer,e.buttonClass,e.guideErrorKey,void 0,"faf-error")},this)).always(_.bind(function(){t.removeClass("disabled")},this))},this))},_onHoverAutocomplete:function(e){var t=r.isDesktop()?"SettingsAutocompleteGuideClearRdr":"SettingsAutocompleteGuideClear";this._onHover(e,".faf-button-container-autocomplete",".faf-autocomplete-clear-btn",t)},_onToggleAutocomplete:function(e){var t="SettingsDlg:ToggleAutocomplete:"+(this._acState.ac_s?"Off":"On"),i=e.which,n=this.$el.find(".faf-autocomplete-toggle");return"keydown"===e.type&&13!==i&&32!==i?!0:(n.not(document.activeElement).focus(),o.logEvent(null,t,t),void this._onOp("TogglingAutocompleteOp"))},_onHover:function(e,t,i,n){switch(e.type){case"focusin":case"mouseenter":this._showButtonGuide(t,i,n);break;case"focusout":case"mouseleave":a.hideGuide()}},_showButtonGuide:function(e,t,n,s,o){a.hideGuide();var r=$(t),l=r.position(),d=l.left+r.outerWidth();s=s||230;var f=$(e),c=f.position().left+f.width();s=Math.min(s,c-d-34),a.showGuide({guideType:o,parent:f,top:l.top-8,left:d,width:s,arrow:"left",arrowPosition:20,text:i[n]})},_onOp:function(e,i,n){var s;a.hideGuide();try{if(n=n||t.opFactory,_.isArray(e)){var o=[];_.each(e,_.bind(function(e){o.push(n.create(e,_.extend({},i,this.options)).run())},this)),s=$.when.apply($,o)}else s=n.create(e,_.extend({},i,this.options)).run()}catch(r){var l=$.Deferred();l.reject(),s=l.promise()}return s}}),t.PluginView}),define("fss/js/plugins/js/faf-settings-init",["fss/js/faf","fss/js/ac-faf","fss/js/plugins/js/faf-settings","fss/js/plugins/js/ops/op-factory","fss/js/plugins/js/ops/reader/op-factory","fss/js/plugins/js/views/faf-settings-plugin-view"],function(e,t,i){_.extend(i,{init:function(e){return i.opFactory=new i.OpFactory,i.Reader.opFactory=new i.Reader.OpFactory,t.init(e)}})}),define("fss/js/plugins/js/views/faf-settings-selector-view",["core/ac-core","plugins-common/ac-plugins","fss/js/plugins/js/faf-settings","i18n!fss/js/nls/ui-strings","core/views/plugin-selector-view"],function(e,t,i,n){return i.SelectorView=e.PluginSelectorView.extend({setAppApi:function(t){e.PluginSelectorView.prototype.setAppApi.call(this,t),i.init(t)},getSelectorLabel:function(){return n.FAF}}),i.SelectorView}),define("fss/js/plugins/js/faf-settings-selector",["fss/js/plugins/js/faf-settings-init","fss/js/plugins/js/views/faf-settings-selector-view"],function(){return void 0}),define("fss/js/plugins/js/faf-settings-plugin",["fss/js/plugins/js/faf-settings","fss/js/plugins/js/faf-settings-init"],function(e){e.init()}),require.config({}),require.config({config:{i18n:{locale:window.Ac.Locale.getLocale()}}}),define("fss/js/faf-main",["fss/js/selector","fss/js/plugin","fss/js/plugins/js/faf-settings-selector","fss/js/plugins/js/faf-settings-plugin"],function(){});