veezard
Version:
TECHB fork from veeva. Veeva CLM Generator & Workflow for building iRep Presentations.
2 lines • 200 kB
JavaScript
var com;null==com&&(com={}),void 0==com.veeva&&(com.veeva={}),com.veeva.clm={getAddresses_Account:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("account",e),0==ret.success?void com.veeva.clm.wrapResult("getAddresses_Account",t,ret):(window.com_veeva_clm_accountAddresses=function(e){com.veeva.clm.wrapResult("getAddresses_Account",t,e)},query='veeva:queryObject(Address_vod__c),fields(ID),where(WHERE Account_vod__c="'+e+'"),com_veeva_clm_accountAddresses(result)',void(com.veeva.clm.testMode?com_veeva_clm_accountAddresses(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getAddressFields:function(e,t,n){return ret=this.checkCallbackFunction(n),0==ret.success?ret:(ret=this.checkArgument("record",e),0==ret.success?void com.veeva.clm.wrapResult("getAddressFields",n,ret):(void 0!=t&&null!=t||(t=["ID"]),window.com_veeva_clm_addressValues=function(e){com.veeva.clm.wrapResult("getAddressFields",n,e)},query="veeva:queryObject(Address_vod__c),fields("+this.joinFieldArray(t)+'),where(WHERE IdNumber="'+e+'"),com_veeva_clm_addressValues(result)',void(com.veeva.clm.testMode?com_veeva_clm_addressValues(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getProduct_MySetup:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("type",e),0==ret.success?void com.veeva.clm.wrapResult("getProduct_MySetup",t,ret):(window.com_veeva_clm_productMysetup=function(e){com.veeva.clm.wrapResult("getProduct_MySetup",t,e)},query='veeva:queryObject(Product_vod__c),fields(ID),where(WHERE Product_Type_vod__c="'+e+'"),com_veeva_clm_productMysetup(result)',void(com.veeva.clm.testMode?com_veeva_clm_productMysetup(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getRecordType_Object:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("object",e),0==ret.success?void com.veeva.clm.wrapResult("getRecordType_Object",t,ret):(window.com_veeva_clm_objectRecordTypes=function(e){com.veeva.clm.wrapResult("getRecordType_Object",t,e)},query='veeva:queryObject(RecordType),fields(ID),where(WHERE SobjectType="'+e+'" and IsActive == YES),com_veeva_clm_objectRecordTypes(result)',void(com.veeva.clm.testMode?com_veeva_clm_objectRecordTypes(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getSurveyQuestions_Survey:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("survey",e),0==ret.success?void com.veeva.clm.wrapResult("getSurveyQuestions_Survey",t,ret):(window.com_veeva_clm_surveyQuestions=function(e){com.veeva.clm.wrapResult("getSurveyQuestions_Survey",t,e)},query='veeva:queryObject(Survey_Question_vod__c),fields(ID),where(WHERE Survey_vod__c="'+e+'"),sort(Order_vod__c,asc),com_veeva_clm_surveyQuestions(result)',void(com.veeva.clm.testMode?com_veeva_clm_surveyQuestions(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getQuestionResponse_SurveyTarget:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("surveytarget",e),0==ret.success?void com.veeva.clm.wrapResult("getQuestionResponse_SurveyTarget",t,ret):(window.com_veeva_clm_targetResponses=function(e){com.veeva.clm.wrapResult("getQuestionResponse_SurveyTarget",t,e)},query='veeva:queryObject(Question_Response_vod__c),fields(ID),where(WHERE Survey_Target_vod__c="'+e+'"),sort(Order_vod__c,asc),com_veeva_clm_targetResponses(result)',void(com.veeva.clm.testMode?com_veeva_clm_targetResponses(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getSurveyTarget_Account:function(e,t,n){return ret=this.checkCallbackFunction(n),0==ret.success?ret:(ret=this.checkArgument("account",e),0==ret.success?void com.veeva.clm.wrapResult("getSurveyTarget_Account",n,ret):(window.com_veeva_clm_accountSurveyTargets=function(e){com.veeva.clm.wrapResult("getSurveyTarget_Account",n,e)},query=null,null==t||""==t?query='veeva:queryObject(Survey_Target_vod__c),fields(ID),where(WHERE Account_vod__c="'+e+'"),com_veeva_clm_accountSurveyTargets(result)':query='veeva:queryObject(Survey_Target_vod__c),fields(ID),where(WHERE Account_vod__c="'+e+'" AND Survey_vod__c="'+t+'"),com_veeva_clm_accountSurveyTargets(result)',void(com.veeva.clm.testMode?com_veeva_clm_accountSurveyTargets(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getProduct_OrderActive_Account:function(e,t){var n,r=this.checkCallbackFunction(t);return 0==r.success?r:(window.com_veeva_clm_ordersWithListPrice=function(e){if(e=com.veeva.clm.formatResult(e),e.success){if(orderIds=[],e.Pricing_Rule_vod__c&&e.Pricing_Rule_vod__c.length>0)for(i=0;i<e.Pricing_Rule_vod__c.length;i++)orderIds.push(e.Pricing_Rule_vod__c[i].Product_vod__c);r.success=!0,r.Product_vod__c=orderIds,com.veeva.clm.wrapResult("getProduct_OrderActive_Account",t,r)}else com.veeva.clm.wrapResult("getProduct_OrderActive_Account",t,e)},window.com_veeva_clm_listPriceTypeId=function(r){if(r=com.veeva.clm.formatResult(r),r.success&&r.RecordType&&r.RecordType.length>0){listPriceRecordTypeId=r.RecordType[0].ID;var o=[];for(i=0;i<n.length;i++)o.push(n[i].ID);dateString=com.veeva.clm.getCurrentDate(),query=null,null==e||""==e?query='veeva:queryObject(Pricing_Rule_vod__c),fields(ID,Product_vod__c),where(WHERE RecordTypeId="'+listPriceRecordTypeId+'" AND Start_Date_vod__c <= "'+dateString+'" AND End_Date_vod__c >= "'+dateString+'" AND Product_vod__c IN '+com.veeva.clm.joinStringArrayForIn(o)+"), com_veeva_clm_ordersWithListPrice(result)":query='veeva:queryObject(Pricing_Rule_vod__c),fields(ID,Product_vod__c),where(WHERE RecordTypeId="'+listPriceRecordTypeId+'" AND (Account_vod__c="'+e+'" OR Account_Group_vod__c = "'+e+'") AND Start_Date_vod__c <="'+dateString+'" AND End_Date_vod__c >= "'+dateString+'" AND Product_vod__c IN '+com.veeva.clm.joinStringArrayForIn(o)+"), com_veeva_clm_ordersWithListPrice(result)",com.veeva.clm.testMode?com_veeva_clm_ordersWithListPrice(testResult.listPrices):com.veeva.clm.runAPIRequest(query)}else com.veeva.clm.wrapResult("getProduct_OrderActive_Account",t,r)},void this.getProduct_MySetup("Order",function(e){if(e.success){if(n=e.Product_vod__c,!(n&&n.length>0))return r.success=!0,r.Product_vod__c=[],void com.veeva.clm.wrapResult("getProduct_OrderActive_Account",t,r);recordTypeQuery='veeva:queryObject(RecordType),fields(ID),where(WHERE SobjectType="Pricing_Rule_vod__c" AND Name_vod__c="List_Price_Rule_vod"),com_veeva_clm_listPriceTypeId(result)',com.veeva.clm.testMode?com_veeva_clm_listPriceTypeId(testResult.listPriceRecordType):com.veeva.clm.runAPIRequest(recordTypeQuery)}else com.veeva.clm.wrapResult("getProduct_OrderActive_Account",t,e)}))},getProduct_KitComponents:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("product",e),0==ret.success?void com.veeva.clm.wrapResult("getProduct_KitComponents",t,ret):(window.com_veeva_clm_childKitItems=function(e){com.veeva.clm.wrapResult("getProduct_KitComponents",t,e)},query='veeva:queryObject(Product_vod__c),fields(ID),where(WHERE Product_Type_vod__c="Kit Item" AND Parent_Product_vod__c="'+e+'"),com_veeva_clm_childKitItems(result)',void(com.veeva.clm.testMode?com_veeva_clm_childKitItems(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getProductGroup_Product:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("product",e),0==ret.success?void com.veeva.clm.wrapResult("getProductGroup_Product",t,ret):(window.com_veeva_clm_productProductGroups=function(e){e=com.veeva.clm.formatResult(e);var n={};if(null!=e&&e.success){var r=e.Product_Group_vod__c,o=[];if(r&&r.length>0)for(i=0;i<r.length;i++)o.push(r[i].Product_Catalog_vod__c);n.success=!0,n.Product_vod__c=o,com.veeva.clm.wrapResult("getProductGroup_Product",t,n)}else null!=e&&com.veeva.clm.wrapResult("getProductGroup_Product",t,e)},query='veeva:queryObject(Product_Group_vod__c),fields(ID,Product_Catalog_vod__c),where(WHERE Product_vod__c="'+e+'"),com_veeva_clm_productProductGroups(result)',void(com.veeva.clm.testMode?com_veeva_clm_productProductGroups(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getLastTenOrders_Account:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("account",e),0==ret.success?void com.veeva.clm.wrapResult("getLastTenOrders_Account",t,ret):(window.com_veeva_clm_accountLastTenOrders=function(e){com.veeva.clm.wrapResult("getLastTenOrders_Account",t,e)},query='veeva:queryObject(Order_vod__c),fields(ID),where(WHERE Account_vod__c="'+e+'"),sort(Order_Date_vod__c,desc),limit(10),com_veeva_clm_accountLastTenOrders(result)',void(com.veeva.clm.testMode?com_veeva_clm_accountLastTenOrders(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getOrderLines_Order:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("order",e),0==ret.success?void com.veeva.clm.wrapResult("getOrderLines_Order",t,ret):(window.com_veeva_clm_orderLines=function(e){com.veeva.clm.wrapResult("getOrderLines_Order",t,e)},query='veeva:queryObject(Order_Line_vod__c),fields(ID),where(WHERE Order_vod__c="'+e+'"),com_veeva_clm_orderLines(result)',void(com.veeva.clm.testMode?com_veeva_clm_orderLines(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(query))))},getListPrice_Product:function(e,t){return ret=this.checkCallbackFunction(t),0==ret.success?ret:(ret=this.checkArgument("product",e),0==ret.success?void com.veeva.clm.wrapResult("getListPrice_Product",t,ret):(window.com_veeva_clm_productPricingRules=function(e){com.veeva.clm.wrapResult("getListPrice_Product",t,e)},window.com_veeva_clm_listPriceTypeId_getListPrice_Product=function(n){n=com.veeva.clm.formatResult(n),n.success&&n.RecordType&&n.RecordType.length>0?(listPriceRecordTypeId=n.RecordType[0].ID,dateString=com.veeva.clm.getCurrentDate(),query='veeva:queryObject(Pricing_Rule_vod__c),fields(ID),where(WHERE RecordTypeId="'+listPriceRecordTypeId+'" AND Product_vod__c = "'+e+'" AND Start_Date_vod__c <= "'+dateString+'" AND End_Date_vod__c >= "'+dateString+'"), com_veeva_clm_productPricingRules(result)',com.veeva.clm.testMode?com_veeva_clm_productPricingRules(com.veeva.clm.testResult.listPrices):com.veeva.clm.runAPIRequest(query)):com.veeva.clm.wrapResult("getListPrice_Product",t,n)},recordTypeQuery='veeva:queryObject(RecordType),fields(ID),where(WHERE SobjectType="Pricing_Rule_vod__c" AND Name_vod__c="List_Price_Rule_vod"),com_veeva_clm_listPriceTypeId_getListPrice_Product(result)',void(com.veeva.clm.testMode?com_veeva_clm_listPriceTypeId_getListPrice_Product(testResult.listPriceRecordType):com.veeva.clm.runAPIRequest(recordTypeQuery))))},getListPrice_Product_Account:function(e,t,n){return ret=this.checkCallbackFunction(n),0==ret.success?ret:(ret=this.checkArgument("product",e),0==ret.success?void com.veeva.clm.wrapResult("getListPrice_Product_Account",n,ret):(ret=this.checkArgument("account",t),0==ret.success?void com.veeva.clm.wrapResult("getListPrice_Product_Account",n,ret):(window.com_veeva_clm_productDefaultPricingRules=function(e){com.veeva.clm.wrapResult("getListPrice_Product_Account",n,e)},window.com_veeva_clm_get_productDefaultPricingRules=function(){dateString=com.veeva.clm.getCurrentDate(),groupQuery='veeva:queryObject(Pricing_Rule_vod__c),fields(ID),where(WHERE RecordTypeId="'+listPriceRecordTypeId+'" AND Product_vod__c = "'+e+'" AND Account_Group_vod__c="" AND Account_vod__c="" AND Start_Date_vod__c <= "'+dateString+'" AND End_Date_vod__c >= "'+dateString+'"), com_veeva_clm_productDefaultPricingRules(result)',com.veeva.clm.testMode?com_veeva_clm_productDefaultPricingRules(com.veeva.clm.testResult.listPrices):com.veeva.clm.runAPIRequest(groupQuery)},window.com_veeva_clm_productAccountGroupPricingRules=function(e){e=com.veeva.clm.formatResult(e),e.success&&0==e.Pricing_Rule_vod__c.length?com_veeva_clm_get_productDefaultPricingRules():com.veeva.clm.wrapResult("getListPrice_Product_Account",n,e)},window.com_veeva_clm_accountGroup=function(t){t=com.veeva.clm.formatResult(t),t.success?(accountGroup=t.Account.Account_Group_vod__c,void 0!=accountGroup&&""!=accountGroup?(dateString=com.veeva.clm.getCurrentDate(),groupQuery='veeva:queryObject(Pricing_Rule_vod__c),fields(ID),where(WHERE RecordTypeId="'+listPriceRecordTypeId+'" AND Product_vod__c = "'+e+'" AND Account_Group_vod__c="'+accountGroup+'" AND Start_Date_vod__c <= "'+dateString+'" AND End_Date_vod__c >= "'+dateString+'"), com_veeva_clm_productAccountGroupPricingRules(result)',com.veeva.clm.testMode?com_veeva_clm_productAccountGroupPricingRules(com.veeva.clm.testResult.listPrices):com.veeva.clm.runAPIRequest(groupQuery)):com_veeva_clm_get_productDefaultPricingRules()):com.veeva.clm.wrapResult("getListPrice_Product_Account",n,t)},window.com_veeva_clm_productAccountPricingRules=function(e){e=com.veeva.clm.formatResult(e),e.success&&0==e.Pricing_Rule_vod__c.length?com.veeva.clm.getDataForObject("Account",t,"Account_Group_vod__c",com_veeva_clm_accountGroup):com.veeva.clm.wrapResult("getListPrice_Product_Account",n,e)},window.com_veeva_clm_listPriceTypeId_getListPrice_Product_Account=function(i){i=com.veeva.clm.formatResult(i),i.success&&i.RecordType&&i.RecordType.length>0?(listPriceRecordTypeId=i.RecordType[0].ID,dateString=com.veeva.clm.getCurrentDate(),query='veeva:queryObject(Pricing_Rule_vod__c),fields(ID),where(WHERE RecordTypeId="'+listPriceRecordTypeId+'" AND Product_vod__c = "'+e+'" AND Account_vod__c="'+t+'" AND Start_Date_vod__c <= "'+dateString+'" AND End_Date_vod__c >= "'+dateString+'"), com_veeva_clm_productAccountPricingRules(result)',com.veeva.clm.testMode?com_veeva_clm_productAccountPricingRules(com.veeva.clm.testResult.listPrices):com.veeva.clm.runAPIRequest(query)):com.veeva.clm.wrapResult("getListPrice_Product_Account",n,i)},recordTypeQuery='veeva:queryObject(RecordType),fields(ID),where(WHERE SobjectType="Pricing_Rule_vod__c" AND Name_vod__c="List_Price_Rule_vod"),com_veeva_clm_listPriceTypeId_getListPrice_Product_Account(result)',void(com.veeva.clm.testMode?com_veeva_clm_listPriceTypeId_getListPrice_Product_Account(testResult.listPriceRecordType):com.veeva.clm.runAPIRequest(recordTypeQuery)))))},getDataForCurrentObject:function(e,t,n){return ret=this.checkCallbackFunction(n),0==ret.success?ret:(ret=this.checkArgument("object",e),0==ret.success?void com.veeva.clm.wrapResult("getDataForCurrentObject",n,ret):(ret=this.checkArgument("field",t),0==ret.success?void com.veeva.clm.wrapResult("getDataForCurrentObject",n,ret):(window.com_veeva_clm_getCurrentObjectField=function(e){com.veeva.clm.wrapResult("getDataForCurrentObject",n,e)},lowerName=e.toLowerCase(),request="veeva:getDataForObjectV2("+e+"),fieldName("+t+"),com_veeva_clm_getCurrentObjectField(result)",void(com.veeva.clm.testMode?com_veeva_clm_getCurrentObjectField(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(request)))))},getDataForObject:function(e,t,n,i){return ret=this.checkCallbackFunction(i),0==ret.success?ret:(ret=this.checkArgument("object",e),0==ret.success?void com.veeva.clm.wrapResult("getDataForObject",i,ret):(ret=this.checkArgument("record",t),0==ret.success?void com.veeva.clm.wrapResult("getDataForObject",i,ret):(ret=this.checkArgument("field",n),0==ret.success?void com.veeva.clm.wrapResult("getDataForObject",i,ret):(window.com_veeva_clm_getObjectField=function(e){com.veeva.clm.wrapResult("getDataForObject",i,e)},request="veeva:getDataForObjectV2("+e+"),objId("+t+"),fieldName("+n+"),com_veeva_clm_getObjectField(result)",void(com.veeva.clm.testMode?com_veeva_clm_getObjectField(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(request))))))},createRecord:function(e,t,n){return ret=this.checkCallbackFunction(n),0==ret.success?ret:(ret=this.checkArgument("object",e),0==ret.success?void com.veeva.clm.wrapResult("createRecord",n,ret):(ret=this.checkArgument("values",t),0==ret.success?void com.veeva.clm.wrapResult("createRecord",n,ret):(request="veeva:saveObjectV2("+e+"),value("+JSON.stringify(t)+"),callback(com_veeva_clm_createRecord)",window.com_veeva_clm_createRecord=function(t){t=com.veeva.clm.formatResult(t),t.success?(ret={},ret.success=!0,ret[e]={},ret[e].ID=t.objectId,void 0!=t.code&&(ret.code=t.code,ret.message=t.message),com.veeva.clm.wrapResult("createRecord",n,ret)):(ret={},ret.success=!1,ret.code=2100,ret.message="Request: "+request+" failed: "+t.message,com.veeva.clm.wrapResult("createRecord",n,ret))},void(com.veeva.clm.testMode?com_veeva_clm_createRecord(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(request)))))},updateRecord:function(e,t,n,i){return ret=this.checkCallbackFunction(i),0==ret.success?ret:(ret=this.checkArgument("object",e),0==ret.success?void com.veeva.clm.wrapResult("updateRecord",i,ret):(ret=this.checkArgument("record",t),0==ret.success?void com.veeva.clm.wrapResult("updateRecord",i,ret):(ret=this.checkArgument("values",n),0==ret.success?void com.veeva.clm.wrapResult("updateRecord",i,ret):(n.IdNumber=t,request="veeva:saveObjectV2("+e+"),value("+JSON.stringify(n)+"),callback(com_veeva_clm_updateRecord)",window.com_veeva_clm_updateRecord=function(t){t=com.veeva.clm.formatResult(t),t.success?(ret={},ret.success=!0,ret[e]={},ret[e].ID=t.objectId,void 0!=t.code&&(ret.code=t.code,ret.message=t.message),com.veeva.clm.wrapResult("updateRecord",i,ret)):(ret={},ret.success=!1,ret.code=2100,ret.message="Request: "+request+" failed: "+t.message,com.veeva.clm.wrapResult("updateRecord",i,ret))},void(com.veeva.clm.testMode?com_veeva_clm_updateRecord(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(request))))))},gotoSlide:function(e,t){return ret=this.checkArgument("keyMessage",e),0==ret.success?ret:(request=null,void 0==t||null==t||""==t?request="veeva:gotoSlide("+e+")":request="veeva:gotoSlide("+e+","+t+")",void(com.veeva.clm.testMode||com.veeva.clm.runAPIRequest(request)))},nextSlide:function(){request="veeva:nextSlide()",com.veeva.clm.runAPIRequest(request)},prevSlide:function(){request="veeva:prevSlide()",com.veeva.clm.runAPIRequest(request)},getUTCdatetime:function(e,t,n,i){return ret=this.checkCallbackFunction(i),0==ret.success?ret:(ret=this.checkArgument("object",e),0==ret.success?void com.veeva.clm.wrapResult("getUTCdatetime",i,ret):(ret=this.checkArgument("record",t),0==ret.success?void com.veeva.clm.wrapResult("getUTCdatetime",i,ret):(ret=this.checkArgument("field",n),0==ret.success?void com.veeva.clm.wrapResult("getUTCdatetime",i,ret):(window.com_veeva_clm_getUTCdatetime=function(e){com.veeva.clm.wrapResult("getUTCdatetime",i,e)},request="veeva:getDataForObjectV3("+e+"),objId("+t+"),fieldName("+n+"),getUTCdatetime(true),callback(com_veeva_clm_getUTCdatetime)",void(com.veeva.clm.testMode?com_veeva_clm_getUTCdatetime(com.veeva.clm.testResult.common):com.veeva.clm.runAPIRequest(request))))))},joinStringArrayForIn:function(e){var t="";if(e.length>0){for(i=0;i<e.length;i++)t+=0==i?'{"'+e[i]+'"':',"'+e[i]+'"';t+="}"}return t},joinFieldArray:function(e){var t="";if(e.length>0)for(i=0;i<e.length;i++)t+=0==i?e[i]:","+e[i];return t},isFunction:function(e){var t={};return e&&"[object Function]"===t.toString.call(e)},checkCallbackFunction:function(e){return ret={},void 0==e?(ret.success=!1,ret.code=2e3,ret.message="callback is missing",ret):(0==this.isFunction(e)?(ret.success=!1,ret.code=2001,ret.message="callback is not a JavaScript function"):ret.success=!0,ret)},checkArgument:function(e,t){return ret={},ret.success=!0,void 0!=t&&null!=t&&""!=t||(ret.success=!1,ret.code=2002,ret.message=e+" is empty"),ret},getCurrentDate:function(){var e=new Date;return dateString=e.getFullYear().toString(),month=e.getMonth()+1,month<10?dateString+="-0"+month:dateString+="-"+month,date=e.getDate(),date<10?dateString+="-0"+date:dateString+="-"+date,dateString},formatResult:function(result){return com.veeva.clm.isWin8()&&"string"==typeof result&&(result=eval("("+result+")")),result},wrapResult:function(e,t,n){n=com.veeva.clm.formatResult(n),n.success?t(n):(n.message=e+": "+n.message,t(n))},runAPIRequest:function(e){com.veeva.clm.isWin8()?window.external.notify(e):document.location=e},isWin8:function(){return navigator.platform.toLowerCase().indexOf("win")>=0},listPriceRecordTypeId:null,accountId:null,addressId:null,callId:null,tsfId:null,userId:null,presentationId:null,keyMessageId:null,testMode:!1,testResult:null},function(e,t,n){function i(e,n){this.wrapper="string"==typeof e?t.querySelector(e):e,this.scroller=this.wrapper.children[0],this.scrollerStyle=this.scroller.style,this.options={resizeScrollbars:!0,mouseWheelSpeed:20,snapThreshold:.334,startX:0,startY:0,scrollY:!0,directionLockThreshold:5,momentum:!0,bounce:!0,bounceTime:600,bounceEasing:"",preventDefault:!0,preventDefaultException:{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/},HWCompositing:!0,useTransition:!0,useTransform:!0};for(var i in n)this.options[i]=n[i];this.translateZ=this.options.HWCompositing&&a.hasPerspective?" translateZ(0)":"",this.options.useTransition=a.hasTransition&&this.options.useTransition,this.options.useTransform=a.hasTransform&&this.options.useTransform,this.options.eventPassthrough=this.options.eventPassthrough===!0?"vertical":this.options.eventPassthrough,this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault,this.options.scrollY="vertical"==this.options.eventPassthrough?!1:this.options.scrollY,this.options.scrollX="horizontal"==this.options.eventPassthrough?!1:this.options.scrollX,this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough,this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold,this.options.bounceEasing="string"==typeof this.options.bounceEasing?a.ease[this.options.bounceEasing]||a.ease.circular:this.options.bounceEasing,this.options.resizePolling=void 0===this.options.resizePolling?60:this.options.resizePolling,this.options.tap===!0&&(this.options.tap="tap"),"scale"==this.options.shrinkScrollbars&&(this.options.useTransition=!1),this.options.invertWheelDirection=this.options.invertWheelDirection?-1:1,this.x=0,this.y=0,this.directionX=0,this.directionY=0,this._events={},this._init(),this.refresh(),this.scrollTo(this.options.startX,this.options.startY),this.enable()}function r(e,n,i){var r=t.createElement("div"),o=t.createElement("div");return i===!0&&(r.style.cssText="position:absolute;z-index:9999",o.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px"),o.className="iScrollIndicator","h"==e?(i===!0&&(r.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",o.style.height="100%"),r.className="iScrollHorizontalScrollbar"):(i===!0&&(r.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",o.style.width="100%"),r.className="iScrollVerticalScrollbar"),r.style.cssText+=";overflow:hidden",n||(r.style.pointerEvents="none"),r.appendChild(o),r}function o(n,i){this.wrapper="string"==typeof i.el?t.querySelector(i.el):i.el,this.wrapperStyle=this.wrapper.style,this.indicator=this.wrapper.children[0],this.indicatorStyle=this.indicator.style,this.scroller=n,this.options={listenX:!0,listenY:!0,interactive:!1,resize:!0,defaultScrollbars:!1,shrink:!1,fade:!1,speedRatioX:0,speedRatioY:0};for(var r in i)this.options[r]=i[r];this.sizeRatioX=1,this.sizeRatioY=1,this.maxPosX=0,this.maxPosY=0,this.options.interactive&&(this.options.disableTouch||(a.addEvent(this.indicator,"touchstart",this),a.addEvent(e,"touchend",this)),this.options.disablePointer||(a.addEvent(this.indicator,a.prefixPointerEvent("pointerdown"),this),a.addEvent(e,a.prefixPointerEvent("pointerup"),this)),this.options.disableMouse||(a.addEvent(this.indicator,"mousedown",this),a.addEvent(e,"mouseup",this))),this.options.fade&&(this.wrapperStyle[a.style.transform]=this.scroller.translateZ,this.wrapperStyle[a.style.transitionDuration]=a.isBadAndroid?"0.001s":"0ms",this.wrapperStyle.opacity="0")}var s=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){e.setTimeout(t,1e3/60)},a=function(){function i(e){return s===!1?!1:""===s?e:s+e.charAt(0).toUpperCase()+e.substr(1)}var r={},o=t.createElement("div").style,s=function(){for(var e,t=["t","webkitT","MozT","msT","OT"],n=0,i=t.length;i>n;n++)if(e=t[n]+"ransform",e in o)return t[n].substr(0,t[n].length-1);return!1}();r.getTime=Date.now||function(){return(new Date).getTime()},r.extend=function(e,t){for(var n in t)e[n]=t[n]},r.addEvent=function(e,t,n,i){e.addEventListener(t,n,!!i)},r.removeEvent=function(e,t,n,i){e.removeEventListener(t,n,!!i)},r.prefixPointerEvent=function(t){return e.MSPointerEvent?"MSPointer"+t.charAt(9).toUpperCase()+t.substr(10):t},r.momentum=function(e,t,i,r,o,s){var a,c,l=e-t,u=n.abs(l)/i;return s=void 0===s?6e-4:s,a=e+u*u/(2*s)*(0>l?-1:1),c=u/s,r>a?(a=o?r-o/2.5*(u/8):r,l=n.abs(a-e),c=l/u):a>0&&(a=o?o/2.5*(u/8):0,l=n.abs(e)+a,c=l/u),{destination:n.round(a),duration:c}};var a=i("transform");return r.extend(r,{hasTransform:a!==!1,hasPerspective:i("perspective")in o,hasTouch:"ontouchstart"in e,hasPointer:e.PointerEvent||e.MSPointerEvent,hasTransition:i("transition")in o}),r.isBadAndroid=/Android /.test(e.navigator.appVersion)&&!/Chrome\/\d/.test(e.navigator.appVersion),r.extend(r.style={},{transform:a,transitionTimingFunction:i("transitionTimingFunction"),transitionDuration:i("transitionDuration"),transitionDelay:i("transitionDelay"),transformOrigin:i("transformOrigin")}),r.hasClass=function(e,t){var n=new RegExp("(^|\\s)"+t+"(\\s|$)");return n.test(e.className)},r.addClass=function(e,t){if(!r.hasClass(e,t)){var n=e.className.split(" ");n.push(t),e.className=n.join(" ")}},r.removeClass=function(e,t){if(r.hasClass(e,t)){var n=new RegExp("(^|\\s)"+t+"(\\s|$)","g");e.className=e.className.replace(n," ")}},r.offset=function(e){for(var t=-e.offsetLeft,n=-e.offsetTop;e=e.offsetParent;)t-=e.offsetLeft,n-=e.offsetTop;return{left:t,top:n}},r.preventDefaultException=function(e,t){for(var n in t)if(t[n].test(e[n]))return!0;return!1},r.extend(r.eventType={},{touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2,pointerdown:3,pointermove:3,pointerup:3,MSPointerDown:3,MSPointerMove:3,MSPointerUp:3}),r.extend(r.ease={},{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(e){return e*(2-e)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(e){return n.sqrt(1- --e*e)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fn:function(e){var t=4;return(e-=1)*e*((t+1)*e+t)+1}},bounce:{style:"",fn:function(e){return(e/=1)<1/2.75?7.5625*e*e:2/2.75>e?7.5625*(e-=1.5/2.75)*e+.75:2.5/2.75>e?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}},elastic:{style:"",fn:function(e){var t=.22,i=.4;return 0===e?0:1==e?1:i*n.pow(2,-10*e)*n.sin((e-t/4)*(2*n.PI)/t)+1}}}),r.tap=function(e,n){var i=t.createEvent("Event");i.initEvent(n,!0,!0),i.pageX=e.pageX,i.pageY=e.pageY,e.target.dispatchEvent(i)},r.click=function(e){var n,i=e.target;/(SELECT|INPUT|TEXTAREA)/i.test(i.tagName)||(n=t.createEvent("MouseEvents"),n.initMouseEvent("click",!0,!0,e.view,1,i.screenX,i.screenY,i.clientX,i.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),n._constructed=!0,i.dispatchEvent(n))},r}();i.prototype={version:"5.1.2",_init:function(){this._initEvents(),(this.options.scrollbars||this.options.indicators)&&this._initIndicators(),this.options.mouseWheel&&this._initWheel(),this.options.snap&&this._initSnap(),this.options.keyBindings&&this._initKeys()},destroy:function(){this._initEvents(!0),this._execEvent("destroy")},_transitionEnd:function(e){e.target==this.scroller&&this.isInTransition&&(this._transitionTime(),this.resetPosition(this.options.bounceTime)||(this.isInTransition=!1,this._execEvent("scrollEnd")))},_start:function(e){if((1==a.eventType[e.type]||0===e.button)&&this.enabled&&(!this.initiated||a.eventType[e.type]===this.initiated)){!this.options.preventDefault||a.isBadAndroid||a.preventDefaultException(e.target,this.options.preventDefaultException)||e.preventDefault();var t,i=e.touches?e.touches[0]:e;this.initiated=a.eventType[e.type],this.moved=!1,this.distX=0,this.distY=0,this.directionX=0,this.directionY=0,this.directionLocked=0,this._transitionTime(),this.startTime=a.getTime(),this.options.useTransition&&this.isInTransition?(this.isInTransition=!1,t=this.getComputedPosition(),this._translate(n.round(t.x),n.round(t.y)),this._execEvent("scrollEnd")):!this.options.useTransition&&this.isAnimating&&(this.isAnimating=!1,this._execEvent("scrollEnd")),this.startX=this.x,this.startY=this.y,this.absStartX=this.x,this.absStartY=this.y,this.pointX=i.pageX,this.pointY=i.pageY,this._execEvent("beforeScrollStart")}},_move:function(e){if(this.enabled&&a.eventType[e.type]===this.initiated){this.options.preventDefault&&e.preventDefault();var t,i,r,o,s=e.touches?e.touches[0]:e,c=s.pageX-this.pointX,l=s.pageY-this.pointY,u=a.getTime();if(this.pointX=s.pageX,this.pointY=s.pageY,this.distX+=c,this.distY+=l,r=n.abs(this.distX),o=n.abs(this.distY),!(u-this.endTime>300&&10>r&&10>o)){if(this.directionLocked||this.options.freeScroll||(r>o+this.options.directionLockThreshold?this.directionLocked="h":o>=r+this.options.directionLockThreshold?this.directionLocked="v":this.directionLocked="n"),"h"==this.directionLocked){if("vertical"==this.options.eventPassthrough)e.preventDefault();else if("horizontal"==this.options.eventPassthrough)return void(this.initiated=!1);l=0}else if("v"==this.directionLocked){if("horizontal"==this.options.eventPassthrough)e.preventDefault();else if("vertical"==this.options.eventPassthrough)return void(this.initiated=!1);c=0}c=this.hasHorizontalScroll?c:0,l=this.hasVerticalScroll?l:0,t=this.x+c,i=this.y+l,(t>0||t<this.maxScrollX)&&(t=this.options.bounce?this.x+c/3:t>0?0:this.maxScrollX),(i>0||i<this.maxScrollY)&&(i=this.options.bounce?this.y+l/3:i>0?0:this.maxScrollY),this.directionX=c>0?-1:0>c?1:0,this.directionY=l>0?-1:0>l?1:0,this.moved||this._execEvent("scrollStart"),this.moved=!0,this._translate(t,i),u-this.startTime>300&&(this.startTime=u,this.startX=this.x,this.startY=this.y)}}},_end:function(e){if(this.enabled&&a.eventType[e.type]===this.initiated){this.options.preventDefault&&!a.preventDefaultException(e.target,this.options.preventDefaultException)&&e.preventDefault();var t,i,r=(e.changedTouches?e.changedTouches[0]:e,a.getTime()-this.startTime),o=n.round(this.x),s=n.round(this.y),c=n.abs(o-this.startX),l=n.abs(s-this.startY),u=0,h="";if(this.isInTransition=0,this.initiated=0,this.endTime=a.getTime(),!this.resetPosition(this.options.bounceTime)){if(this.scrollTo(o,s),!this.moved)return this.options.tap&&a.tap(e,this.options.tap),this.options.click&&a.click(e),void this._execEvent("scrollCancel");if(this._events.flick&&200>r&&100>c&&100>l)return void this._execEvent("flick");if(this.options.momentum&&300>r&&(t=this.hasHorizontalScroll?a.momentum(this.x,this.startX,r,this.maxScrollX,this.options.bounce?this.wrapperWidth:0,this.options.deceleration):{destination:o,duration:0},i=this.hasVerticalScroll?a.momentum(this.y,this.startY,r,this.maxScrollY,this.options.bounce?this.wrapperHeight:0,this.options.deceleration):{destination:s,duration:0},o=t.destination,s=i.destination,u=n.max(t.duration,i.duration),this.isInTransition=1),this.options.snap){var d=this._nearestSnap(o,s);this.currentPage=d,u=this.options.snapSpeed||n.max(n.max(n.min(n.abs(o-d.x),1e3),n.min(n.abs(s-d.y),1e3)),300),o=d.x,s=d.y,this.directionX=0,this.directionY=0,h=this.options.bounceEasing}return o!=this.x||s!=this.y?((o>0||o<this.maxScrollX||s>0||s<this.maxScrollY)&&(h=a.ease.quadratic),void this.scrollTo(o,s,u,h)):void this._execEvent("scrollEnd")}}},_resize:function(){var e=this;clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){e.refresh()},this.options.resizePolling)},resetPosition:function(e){
var t=this.x,n=this.y;return e=e||0,!this.hasHorizontalScroll||this.x>0?t=0:this.x<this.maxScrollX&&(t=this.maxScrollX),!this.hasVerticalScroll||this.y>0?n=0:this.y<this.maxScrollY&&(n=this.maxScrollY),t==this.x&&n==this.y?!1:(this.scrollTo(t,n,e,this.options.bounceEasing),!0)},disable:function(){this.enabled=!1},enable:function(){this.enabled=!0},refresh:function(){this.wrapper.offsetHeight;this.wrapperWidth=this.wrapper.clientWidth,this.wrapperHeight=this.wrapper.clientHeight,this.scrollerWidth=this.scroller.offsetWidth,this.scrollerHeight=this.scroller.offsetHeight,this.maxScrollX=this.wrapperWidth-this.scrollerWidth,this.maxScrollY=this.wrapperHeight-this.scrollerHeight,this.hasHorizontalScroll=this.options.scrollX&&this.maxScrollX<0,this.hasVerticalScroll=this.options.scrollY&&this.maxScrollY<0,this.hasHorizontalScroll||(this.maxScrollX=0,this.scrollerWidth=this.wrapperWidth),this.hasVerticalScroll||(this.maxScrollY=0,this.scrollerHeight=this.wrapperHeight),this.endTime=0,this.directionX=0,this.directionY=0,this.wrapperOffset=a.offset(this.wrapper),this._execEvent("refresh"),this.resetPosition()},on:function(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)},off:function(e,t){if(this._events[e]){var n=this._events[e].indexOf(t);n>-1&&this._events[e].splice(n,1)}},_execEvent:function(e){if(this._events[e]){var t=0,n=this._events[e].length;if(n)for(;n>t;t++)this._events[e][t].apply(this,[].slice.call(arguments,1))}},scrollBy:function(e,t,n,i){e=this.x+e,t=this.y+t,n=n||0,this.scrollTo(e,t,n,i)},scrollTo:function(e,t,n,i){i=i||a.ease.circular,this.isInTransition=this.options.useTransition&&n>0,!n||this.options.useTransition&&i.style?(this._transitionTimingFunction(i.style),this._transitionTime(n),this._translate(e,t)):this._animate(e,t,n,i.fn)},scrollToElement:function(e,t,i,r,o){if(e=e.nodeType?e:this.scroller.querySelector(e)){var s=a.offset(e);s.left-=this.wrapperOffset.left,s.top-=this.wrapperOffset.top,i===!0&&(i=n.round(e.offsetWidth/2-this.wrapper.offsetWidth/2)),r===!0&&(r=n.round(e.offsetHeight/2-this.wrapper.offsetHeight/2)),s.left-=i||0,s.top-=r||0,s.left=s.left>0?0:s.left<this.maxScrollX?this.maxScrollX:s.left,s.top=s.top>0?0:s.top<this.maxScrollY?this.maxScrollY:s.top,t=void 0===t||null===t||"auto"===t?n.max(n.abs(this.x-s.left),n.abs(this.y-s.top)):t,this.scrollTo(s.left,s.top,t,o)}},_transitionTime:function(e){if(e=e||0,this.scrollerStyle[a.style.transitionDuration]=e+"ms",!e&&a.isBadAndroid&&(this.scrollerStyle[a.style.transitionDuration]="0.001s"),this.indicators)for(var t=this.indicators.length;t--;)this.indicators[t].transitionTime(e)},_transitionTimingFunction:function(e){if(this.scrollerStyle[a.style.transitionTimingFunction]=e,this.indicators)for(var t=this.indicators.length;t--;)this.indicators[t].transitionTimingFunction(e)},_translate:function(e,t){if(this.options.useTransform?this.scrollerStyle[a.style.transform]="translate("+e+"px,"+t+"px)"+this.translateZ:(e=n.round(e),t=n.round(t),this.scrollerStyle.left=e+"px",this.scrollerStyle.top=t+"px"),this.x=e,this.y=t,this.indicators)for(var i=this.indicators.length;i--;)this.indicators[i].updatePosition()},_initEvents:function(t){var n=t?a.removeEvent:a.addEvent,i=this.options.bindToWrapper?this.wrapper:e;n(e,"orientationchange",this),n(e,"resize",this),this.options.click&&n(this.wrapper,"click",this,!0),this.options.disableMouse||(n(this.wrapper,"mousedown",this),n(i,"mousemove",this),n(i,"mousecancel",this),n(i,"mouseup",this)),a.hasPointer&&!this.options.disablePointer&&(n(this.wrapper,a.prefixPointerEvent("pointerdown"),this),n(i,a.prefixPointerEvent("pointermove"),this),n(i,a.prefixPointerEvent("pointercancel"),this),n(i,a.prefixPointerEvent("pointerup"),this)),a.hasTouch&&!this.options.disableTouch&&(n(this.wrapper,"touchstart",this),n(i,"touchmove",this),n(i,"touchcancel",this),n(i,"touchend",this)),n(this.scroller,"transitionend",this),n(this.scroller,"webkitTransitionEnd",this),n(this.scroller,"oTransitionEnd",this),n(this.scroller,"MSTransitionEnd",this)},getComputedPosition:function(){var t,n,i=e.getComputedStyle(this.scroller,null);return this.options.useTransform?(i=i[a.style.transform].split(")")[0].split(", "),t=+(i[12]||i[4]),n=+(i[13]||i[5])):(t=+i.left.replace(/[^-\d.]/g,""),n=+i.top.replace(/[^-\d.]/g,"")),{x:t,y:n}},_initIndicators:function(){function e(e){for(var t=a.indicators.length;t--;)e.call(a.indicators[t])}var t,n=this.options.interactiveScrollbars,i="string"!=typeof this.options.scrollbars,s=[],a=this;this.indicators=[],this.options.scrollbars&&(this.options.scrollY&&(t={el:r("v",n,this.options.scrollbars),interactive:n,defaultScrollbars:!0,customStyle:i,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenX:!1},this.wrapper.appendChild(t.el),s.push(t)),this.options.scrollX&&(t={el:r("h",n,this.options.scrollbars),interactive:n,defaultScrollbars:!0,customStyle:i,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenY:!1},this.wrapper.appendChild(t.el),s.push(t))),this.options.indicators&&(s=s.concat(this.options.indicators));for(var c=s.length;c--;)this.indicators.push(new o(this,s[c]));this.options.fadeScrollbars&&(this.on("scrollEnd",function(){e(function(){this.fade()})}),this.on("scrollCancel",function(){e(function(){this.fade()})}),this.on("scrollStart",function(){e(function(){this.fade(1)})}),this.on("beforeScrollStart",function(){e(function(){this.fade(1,!0)})})),this.on("refresh",function(){e(function(){this.refresh()})}),this.on("destroy",function(){e(function(){this.destroy()}),delete this.indicators})},_initWheel:function(){a.addEvent(this.wrapper,"wheel",this),a.addEvent(this.wrapper,"mousewheel",this),a.addEvent(this.wrapper,"DOMMouseScroll",this),this.on("destroy",function(){a.removeEvent(this.wrapper,"wheel",this),a.removeEvent(this.wrapper,"mousewheel",this),a.removeEvent(this.wrapper,"DOMMouseScroll",this)})},_wheel:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t,i,r,o,s=this;if(void 0===this.wheelTimeout&&s._execEvent("scrollStart"),clearTimeout(this.wheelTimeout),this.wheelTimeout=setTimeout(function(){s._execEvent("scrollEnd"),s.wheelTimeout=void 0},400),"deltaX"in e)t=-e.deltaX,i=-e.deltaY;else if("wheelDeltaX"in e)t=e.wheelDeltaX/120*this.options.mouseWheelSpeed,i=e.wheelDeltaY/120*this.options.mouseWheelSpeed;else if("wheelDelta"in e)t=i=e.wheelDelta/120*this.options.mouseWheelSpeed;else{if(!("detail"in e))return;t=i=-e.detail/3*this.options.mouseWheelSpeed}if(t*=this.options.invertWheelDirection,i*=this.options.invertWheelDirection,this.hasVerticalScroll||(t=i,i=0),this.options.snap)return r=this.currentPage.pageX,o=this.currentPage.pageY,t>0?r--:0>t&&r++,i>0?o--:0>i&&o++,void this.goToPage(r,o);r=this.x+n.round(this.hasHorizontalScroll?t:0),o=this.y+n.round(this.hasVerticalScroll?i:0),r>0?r=0:r<this.maxScrollX&&(r=this.maxScrollX),o>0?o=0:o<this.maxScrollY&&(o=this.maxScrollY),this.scrollTo(r,o,0)}},_initSnap:function(){this.currentPage={},"string"==typeof this.options.snap&&(this.options.snap=this.scroller.querySelectorAll(this.options.snap)),this.on("refresh",function(){var e,t,i,r,o,s,a=0,c=0,l=0,u=this.options.snapStepX||this.wrapperWidth,h=this.options.snapStepY||this.wrapperHeight;if(this.pages=[],this.wrapperWidth&&this.wrapperHeight&&this.scrollerWidth&&this.scrollerHeight){if(this.options.snap===!0)for(i=n.round(u/2),r=n.round(h/2);l>-this.scrollerWidth;){for(this.pages[a]=[],e=0,o=0;o>-this.scrollerHeight;)this.pages[a][e]={x:n.max(l,this.maxScrollX),y:n.max(o,this.maxScrollY),width:u,height:h,cx:l-i,cy:o-r},o-=h,e++;l-=u,a++}else for(s=this.options.snap,e=s.length,t=-1;e>a;a++)(0===a||s[a].offsetLeft<=s[a-1].offsetLeft)&&(c=0,t++),this.pages[c]||(this.pages[c]=[]),l=n.max(-s[a].offsetLeft,this.maxScrollX),o=n.max(-s[a].offsetTop,this.maxScrollY),i=l-n.round(s[a].offsetWidth/2),r=o-n.round(s[a].offsetHeight/2),this.pages[c][t]={x:l,y:o,width:s[a].offsetWidth,height:s[a].offsetHeight,cx:i,cy:r},l>this.maxScrollX&&c++;this.goToPage(this.currentPage.pageX||0,this.currentPage.pageY||0,0),this.options.snapThreshold%1===0?(this.snapThresholdX=this.options.snapThreshold,this.snapThresholdY=this.options.snapThreshold):(this.snapThresholdX=n.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width*this.options.snapThreshold),this.snapThresholdY=n.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height*this.options.snapThreshold))}}),this.on("flick",function(){var e=this.options.snapSpeed||n.max(n.max(n.min(n.abs(this.x-this.startX),1e3),n.min(n.abs(this.y-this.startY),1e3)),300);this.goToPage(this.currentPage.pageX+this.directionX,this.currentPage.pageY+this.directionY,e)})},_nearestSnap:function(e,t){if(!this.pages.length)return{x:0,y:0,pageX:0,pageY:0};var i=0,r=this.pages.length,o=0;if(n.abs(e-this.absStartX)<this.snapThresholdX&&n.abs(t-this.absStartY)<this.snapThresholdY)return this.currentPage;for(e>0?e=0:e<this.maxScrollX&&(e=this.maxScrollX),t>0?t=0:t<this.maxScrollY&&(t=this.maxScrollY);r>i;i++)if(e>=this.pages[i][0].cx){e=this.pages[i][0].x;break}for(r=this.pages[i].length;r>o;o++)if(t>=this.pages[0][o].cy){t=this.pages[0][o].y;break}return i==this.currentPage.pageX&&(i+=this.directionX,0>i?i=0:i>=this.pages.length&&(i=this.pages.length-1),e=this.pages[i][0].x),o==this.currentPage.pageY&&(o+=this.directionY,0>o?o=0:o>=this.pages[0].length&&(o=this.pages[0].length-1),t=this.pages[0][o].y),{x:e,y:t,pageX:i,pageY:o}},goToPage:function(e,t,i,r){r=r||this.options.bounceEasing,e>=this.pages.length?e=this.pages.length-1:0>e&&(e=0),t>=this.pages[e].length?t=this.pages[e].length-1:0>t&&(t=0);var o=this.pages[e][t].x,s=this.pages[e][t].y;i=void 0===i?this.options.snapSpeed||n.max(n.max(n.min(n.abs(o-this.x),1e3),n.min(n.abs(s-this.y),1e3)),300):i,this.currentPage={x:o,y:s,pageX:e,pageY:t},this.scrollTo(o,s,i,r)},next:function(e,t){var n=this.currentPage.pageX,i=this.currentPage.pageY;n++,n>=this.pages.length&&this.hasVerticalScroll&&(n=0,i++),this.goToPage(n,i,e,t)},prev:function(e,t){var n=this.currentPage.pageX,i=this.currentPage.pageY;n--,0>n&&this.hasVerticalScroll&&(n=0,i--),this.goToPage(n,i,e,t)},_initKeys:function(t){var n,i={pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40};if("object"==typeof this.options.keyBindings)for(n in this.options.keyBindings)"string"==typeof this.options.keyBindings[n]&&(this.options.keyBindings[n]=this.options.keyBindings[n].toUpperCase().charCodeAt(0));else this.options.keyBindings={};for(n in i)this.options.keyBindings[n]=this.options.keyBindings[n]||i[n];a.addEvent(e,"keydown",this),this.on("destroy",function(){a.removeEvent(e,"keydown",this)})},_key:function(e){if(this.enabled){var t,i=this.options.snap,r=i?this.currentPage.pageX:this.x,o=i?this.currentPage.pageY:this.y,s=a.getTime(),c=this.keyTime||0,l=.25;switch(this.options.useTransition&&this.isInTransition&&(t=this.getComputedPosition(),this._translate(n.round(t.x),n.round(t.y)),this.isInTransition=!1),this.keyAcceleration=200>s-c?n.min(this.keyAcceleration+l,50):0,e.keyCode){case this.options.keyBindings.pageUp:this.hasHorizontalScroll&&!this.hasVerticalScroll?r+=i?1:this.wrapperWidth:o+=i?1:this.wrapperHeight;break;case this.options.keyBindings.pageDown:this.hasHorizontalScroll&&!this.hasVerticalScroll?r-=i?1:this.wrapperWidth:o-=i?1:this.wrapperHeight;break;case this.options.keyBindings.end:r=i?this.pages.length-1:this.maxScrollX,o=i?this.pages[0].length-1:this.maxScrollY;break;case this.options.keyBindings.home:r=0,o=0;break;case this.options.keyBindings.left:r+=i?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.up:o+=i?1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.right:r-=i?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.down:o-=i?1:5+this.keyAcceleration>>0;break;default:return}if(i)return void this.goToPage(r,o);r>0?(r=0,this.keyAcceleration=0):r<this.maxScrollX&&(r=this.maxScrollX,this.keyAcceleration=0),o>0?(o=0,this.keyAcceleration=0):o<this.maxScrollY&&(o=this.maxScrollY,this.keyAcceleration=0),this.scrollTo(r,o,0),this.keyTime=s}},_animate:function(e,t,n,i){function r(){var d,f,p,m=a.getTime();return m>=h?(o.isAnimating=!1,o._translate(e,t),void(o.resetPosition(o.options.bounceTime)||o._execEvent("scrollEnd"))):(m=(m-u)/n,p=i(m),d=(e-c)*p+c,f=(t-l)*p+l,o._translate(d,f),void(o.isAnimating&&s(r)))}var o=this,c=this.x,l=this.y,u=a.getTime(),h=u+n;this.isAnimating=!0,r()},handleEvent:function(e){switch(e.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(e);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":this._move(e);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":this._end(e);break;case"orientationchange":case"resize":this._resize();break;case"transitionend":case"webkitTransitionEnd":case"oTransitionEnd":case"MSTransitionEnd":this._transitionEnd(e);break;case"wheel":case"DOMMouseScroll":case"mousewheel":this._wheel(e);break;case"keydown":this._key(e);break;case"click":e._constructed||(e.preventDefault(),e.stopPropagation())}}},o.prototype={handleEvent:function(e){switch(e.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(e);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":this._move(e);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":this._end(e)}},destroy:function(){this.options.interactive&&(a.removeEvent(this.indicator,"touchstart",this),a.removeEvent(this.indicator,a.prefixPointerEvent("pointerdown"),this),a.removeEvent(this.indicator,"mousedown",this),a.removeEvent(e,"touchmove",this),a.removeEvent(e,a.prefixPointerEvent("pointermove"),this),a.removeEvent(e,"mousemove",this),a.removeEvent(e,"touchend",this),a.removeEvent(e,a.prefixPointerEvent("pointerup"),this),a.removeEvent(e,"mouseup",this)),this.options.defaultScrollbars&&this.wrapper.parentNode.removeChild(this.wrapper)},_start:function(t){var n=t.touches?t.touches[0]:t;t.preventDefault(),t.stopPropagation(),this.transitionTime(),this.initiated=!0,this.moved=!1,this.lastPointX=n.pageX,this.lastPointY=n.pageY,this.startTime=a.getTime(),this.options.disableTouch||a.addEvent(e,"touchmove",this),this.options.disablePointer||a.addEvent(e,a.prefixPointerEvent("pointermove"),this),this.options.disableMouse||a.addEvent(e,"mousemove",this),this.scroller._execEvent("beforeScrollStart")},_move:function(e){var t,n,i,r,o=e.touches?e.touches[0]:e;a.getTime();this.moved||this.scroller._execEvent("scrollStart"),this.moved=!0,t=o.pageX-this.lastPointX,this.lastPointX=o.pageX,n=o.pageY-this.lastPointY,this.lastPointY=o.pageY,i=this.x+t,r=this.y+n,this._pos(i,r),e.preventDefault(),e.stopPropagation()},_end:function(t){if(this.initiated){if(this.initiated=!1,t.preventDefault(),t.stopPropagation(),a.removeEvent(e,"touchmove",this),a.removeEvent(e,a.prefixPointerEvent("pointermove"),this),a.removeEvent(e,"mousemove",this),this.scroller.options.snap){var i=this.scroller._nearestSnap(this.scroller.x,this.scroller.y),r=this.options.snapSpeed||n.max(n.max(n.min(n.abs(this.scroller.x-i.x),1e3),n.min(n.abs(this.scroller.y-i.y),1e3)),300);this.scroller.x==i.x&&this.scroller.y==i.y||(this.scroller.directionX=0,this.scroller.directionY=0,this.scroller.currentPage=i,this.scroller.scrollTo(i.x,i.y,r,this.scroller.options.bounceEasing))}this.moved&&this.scroller._execEvent("scrollEnd")}},transitionTime:function(e){e=e||0,this.indicatorStyle[a.style.transitionDuration]=e+"ms",!e&&a.isBadAndroid&&(this.indicatorStyle[a.style.transitionDuration]="0.001s")},transitionTimingFunction:function(e){this.indicatorStyle[a.style.transitionTimingFunction]=e},refresh:function(){this.transitionTime(),this.options.listenX&&!this.options.listenY?this.indicatorStyle.display=this.scroller.hasHorizontalScroll?"block":"none":this.options.listenY&&!this.options.listenX?this.indicatorStyle.display=this.scroller.hasVerticalScroll?"block":"none":this.indicatorStyle.display=this.scroller.hasHorizontalScroll||this.scroller.hasVerticalScroll?"block":"none",this.scroller.hasHorizontalScroll&&this.scroller.hasVerticalScroll?(a.addClass(this.wrapper,"iScrollBothScrollbars"),a.removeClass(this.wrapper,"iScrollLoneScrollbar"),this.options.defaultScrollbars&&this.options.customStyle&&(this.options.listenX?this.wrapper.style.right="8px":this.wrapper.style.bottom="8px")):(a.removeClass(this.wrapper,"iScrollBothScrollbars"),a.addClass(this.wrapper,"iScrollLoneScrollbar"),this.options.defaultScrollbars&&this.options.customStyle&&(this.options.listenX?this.wrapper.style.right="2px":this.wrapper.style.bottom="2px"));this.wrapper.offsetHeight;this.options.listenX&&(this.wrapperWidth=this.wrapper.clientWidth,this.options.resize?(this.indicatorWidth=n.max(n.round(this.wrapperWidth*this.wrapperWidth/(this.scroller.scrollerWidth||this.wrapperWidth||1)),8),this.indicatorStyle.width=this.indicatorWidth+"px"):this.indicatorWidth=this.indicator.clientWidth,this.maxPosX=this.wrapperWidth-this.indicatorWidth,"clip"==this.options.shrink?(this.minBoundaryX=-this.indicatorWidth+8,this.maxBoundaryX=this.wrapperWidth-8):(this.minBoundaryX=0,this.maxBoundaryX=this.maxPosX),this.sizeRatioX=this.options.speedRatioX||this.scroller.maxScrollX&&this.maxPosX/this.scroller.maxScrollX),this.options.listenY&&(this.wrapperHeight=this.wrapper.clientHeight,this.options.resize?(this.indicatorHeight=n.max(n.round(this.wrapperHeight*this.wrapperHeight/(this.scroller.scrollerHeight||this.wrapperHeight||1)),8),this.indicatorStyle.height=this.indicatorHeight+"px"):this.indicatorHeight=this.indicator.clientHeight,this.maxPosY=this.wrapperHeight-this.indicatorHeight,"clip"==this.options.shrink?(this.minBoundaryY=-this.indicatorHeight+8,this.maxBoundaryY=this.wrapperHeight-8