From 4d95b1ed5d8603e1fb81c6e99c3815e6e461820d Mon Sep 17 00:00:00 2001 From: Ronald Quenta Date: Thu, 30 Apr 2015 22:43:17 -0400 Subject: [PATCH] new file dynaform mobile --- workflow/public_html/mobile/build-prod/js/pmDynaform.min.js | 2 +- workflow/public_html/mobile/index.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/public_html/mobile/build-prod/js/pmDynaform.min.js b/workflow/public_html/mobile/build-prod/js/pmDynaform.min.js index 5da586239..3cc27a254 100644 --- a/workflow/public_html/mobile/build-prod/js/pmDynaform.min.js +++ b/workflow/public_html/mobile/build-prod/js/pmDynaform.min.js @@ -8,7 +8,7 @@ return this.asSeconds()?(0>this.asSeconds()?"-":"")+"P"+(e?e+"Y":"")+(t?t+"M":"" },RestClient.prototype.setOAuth2NeedsAuthorization=function(e){return _.isBoolean(e)&&(this.oauth2NeedsAuthorization=e),this},RestClient.prototype.setDataType=function(e){var t={json:"application/json",plain:"text/plain",form:"application/x-www-form-urlencoded",html:"text/html"};return t[e]&&(this.dataType=e,this.contentType=t[e]),this},RestClient.prototype.setAccessTokenExpiredMessage=function(e){return this.expiredAccessTokenMessage=e,this},RestClient.prototype.getVersion=function(){return this.VERSION},RestClient.prototype.setClient=function(e,t,n){return this.authorization.client_id=e,this.authorization.client_secret=t,this.authorization.client_url="undefined"!==n?n:null,this},RestClient.prototype.setGrantType=function(e,t){return this.authorization.grant_type="undefined"!==this.OAUTH2GrantTypes[e]?this.OAUTH2GrantTypes[e]:null,this.authorization=_.extend(this.authorization,t),this},RestClient.prototype.setAuthorizationServer=function(e){var t,n=!0;return e===void 0||null===e?n=!1:(t=/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,e.match(t)?this.server.rest_auth_uri=e:n=!1),n},RestClient.prototype.setHeader=function(e,t){var n,i=!0;return e&&t?(n=JSON.parse('{"'+e+'" : "'+t+'"}'),this.headers=_.extend(this.headers,n)):i=!1,i},RestClient.prototype.JSONParse=function(e){var t;try{t=e?""===e?"":JSON.parse(e):""}catch(n){t="ERROR_PARSE"}return t},RestClient.prototype.setBasicCredentials=function(e,t){return this.authorization.basic_user=e,this.authorization.basic_password=t,this},RestClient.prototype.setAccessToken=function(e){return"object"==typeof e&&(this.accessToken=e),this},RestClient.prototype.setRestfulBehavior=function(e){return _.isBoolean(e)&&(this.restfulBehavior=e),this},RestClient.prototype.setBackupAjaxUrl=function(e){return this.backupAJAXURL=e,this},RestClient.prototype.toParams=function(e){var t=_.keys(e),n=[];return _.each(t,function(t){n.push(t+"="+e[t])}),n.join("&")},RestClient.prototype.prepareBody=function(e){var t="";return"json"===this.dataType||"jsonp"===this.dataType?"object"==typeof e&&(t=JSON.stringify(e)):t=this.toParams(e),t},RestClient.prototype.createXHR=function(){var e;if(window.XMLHttpRequest)e=new XMLHttpRequest;else try{e=new ActiveXObject("MSXML2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){}}return e?e:!1},RestClient.prototype.authorize=function(e){var t,n,i,a,o=this,r=!1,s="create",l=this.RESTMethods[s];t=RCBase64.encode(this.authorization.client_id+":"+this.authorization.client_secret),n=this.createXHR();try{n.open(l,this.server.rest_auth_uri,!1)}catch(u){return e.xhrfailure?e.xhrfailure(u,{}):this.XHRFailure(u,{}),r}if(n.onreadystatechange=function(){if(e.ready?e.ready(n):o.AuthorizeReady(n),4===n.readyState){if(a=o.JSONParse(n.responseText),-1!=o.HTTP_SUCCESS.indexOf(n.status+"")&&"ERROR_PARSE"!==a)if(o.autoStoreAccessToken&&(o.accessToken=a.token||{}),r=!0,e.success)try{e.success(n,a)}catch(t){throw Error(t.message)}else o.AuthorizeSuccess(n,a);else if("ERROR_PARSE"===a&&(a={success:!1,error:{error:o.HTTP_BAD_REQUEST,error_description:"Response is not a valid JSON"}}),e.failure)try{e.failure(n,a)}catch(t){throw Error(t.message)}else o.AuthorizeFailure(n,a);"function"==typeof e.complete&&e.complete(n,a)}},i={},this.authorization.grant_type)switch(i.grant_type=this.authorization.grant_type,this.authorization.grant_type){case"authorization_code":i.code=this.authorization.code;break;case"token":i.token=this.authorization.token;break;case"password":i.username=this.authorization.username,i.password=this.authorization.password;break;case"client_credentials":i.client_id=this.authorization.client_id,i.client_id=this.authorization.client_secret;break;case"refresh_token":i.refresh_token=this.authorization.refresh_token}return this.oauth2NeedsAuthorization&&n.setRequestHeader("Authorization","Basic "+t),n.setRequestHeader("Accept",this.acceptType),n.setRequestHeader("Content-Type",this.contentType),_.each(this.headers,function(e,t){n.setRequestHeader(t,e)}),n.send(this.prepareBody(i)),r},RestClient.prototype.prepareReqFields=function(e){var t;return t={success:!1,error:{error:this.HTTP_BAD_REQUEST,error_description:"Required fields not found"},fields:e}},RestClient.prototype.prepareConsumeUrl=function(e,t,n,i){var a,o,r=this.acceptType,s=this.contentType,l=!1;if(this.restfulBehavior)switch(e){case"read":a=t,n&&(a+=n),"oauth2"!==this.authorizationType||this.sendOAuthBearerAuthorization||(l=!0,a+="?access_token="+this.accessToken.access_token),i&&i!=={}&&(a+=l?"&":"?",a+=this.toParams(i)),o=null,null===s&&(s="application/json");break;case"create":a=t,o=i||{},"oauth2"!==this.authorizationType||this.sendOAuthBearerAuthorization||(o.access_token=this.accessToken.access_token),o=this.prepareBody(o);break;case"update":a=t,n&&(a+=n),o=i||{},"oauth2"!==this.authorizationType||this.sendOAuthBearerAuthorization||(o.access_token=this.accessToken.access_token),o=this.prepareBody(o);break;case"delete":a=t,n&&(a+=n),o=i||{},"oauth2"!==this.authorizationType||this.sendOAuthBearerAuthorization||(o.access_token=this.accessToken.access_token),o=this.prepareBody(o)}else a=this.backupAJAXURL,o={operation:e,url:t,id:n,data:i},o="data='"+encodeURIComponent(JSON.stringify(o))+"'",null===s&&(s="application/json");return r||(r="*/*"),{url:a,body:o,content_type:s,acceptType:r}},RestClient.prototype.getCall=function(e){return e.operation="read",this.consume(e)},RestClient.prototype.postCall=function(e){return e.operation="create",this.consume(e)},RestClient.prototype.putCall=function(e){return e.operation="update",this.consume(e)},RestClient.prototype.deleteCall=function(e){return e.operation="delete",this.consume(e)},RestClient.prototype.consume=function(e){var t,n,i,a,o,r,s,l,u,d,c,h,f,p,m,g={},v=!0,y=[],b=!1;if(e.operation?i=e.operation:(v=!1,y.push("operation")),e.url?u=e.url:(v=!1,y.push("url")),d=e.data||null,c=e.id||null,!v)return e.failure?e.failure(null,this.prepareReqFields(y)):this.ConsumeFailure(null,this.prepareReqFields(y)),v;h=this.prepareConsumeUrl(i,u,c,d),r=h.url,o=h.body,p=h.content_type,m=h.acceptType,n=this.createXHR(),a=this.restfulBehavior?this.RESTMethods[i]:this.RESTMethods.create;try{switch(n.open(a,r,!1),this.authorizationType){case"none":break;case"basic":t=RCBase64.encode(this.authorization.basic_user+":"+this.authorization.basic_password),n.setRequestHeader("Authorization","Basic "+t);break;case"oauth2":if(!this.accessToken.access_token)return v=!1,y.push("access_token"),l={success:!1,error:{error:this.HTTP_BAD_REQUEST,error_description:"Access Token not defined"}},e.failure?e.failure(null,this.prepareReqFields(y)):this.ConsumeFailure(null,this.prepareReqFields(y)),v;this.sendOAuthBearerAuthorization&&(f="Bearer "+this.accessToken.access_token,n.setRequestHeader("Authorization",f))}}catch(w){return e.xhrfailure?e.xhrfailure(w,d):this.XHRFailure(w,d),!1}s=this,n.onreadystatechange=function(){if(e.ready?e.ready(n):s.ConsumeReady(n),4===n.readyState){if(g=s.JSONParse(n.responseText),-1!=s.HTTP_SUCCESS.indexOf(n.status+"")&&"ERROR_PARSE"!==g)if(s.autoStoreAccessToken&&(s.accessToken=g.token||{}),v=!0,e.success)try{e.success(n,g)}catch(t){throw Error(t.message)}else s.AuthorizeSuccess(n,g);else if(v=!1,"ERROR_PARSE"===g?g={success:!1,error:{error:s.HTTP_BAD_REQUEST,error_description:"Response is not a valid JSON"}}:(g.error===s.OAUTH2_INVALID_GRANT&&g.error_description===s.expiredAccessTokenMessage&&(b=!0),n.status===s.HTTP_UNAUTHORIZED&&s.autoUseRefreshToken&&b&&(s.accessToken.refresh_token?(s.setGrantType("refresh",{refresh_token:s.accessToken.refresh_token}),s.authorize({success:function(){v=s.consume(e),v&&(e.autorefresh?e.autorefresh(s.accessToken):s.AuthorizeAutoRefresh(s.accessToken))},failure:function(t,n){v=!1,e.failure?e.failure(null,n):s.ConsumeFailure(null,n)}})):(v=!1,g={success:!1,error:{error:s.HTTP_UNAUTHORIZED,error_description:"Refresh token is not defined"}}))),e.failure)try{e.failure(n,g)}catch(t){throw Error(t.message)}else s.AuthorizeFailure(n,g);"function"==typeof e.complete&&e.complete(n,g)}},n.setRequestHeader("Accept",m),n.setRequestHeader("Content-Type",p),_.each(this.headers,function(e,t){n.setRequestHeader(t,e)});try{n.send(o)}catch(k){try{e.failure(n,g)}catch(D){throw Error(D.message)}}return v},RestClient.prototype.XHRFailure=function(){},RestClient.prototype.AuthorizeSuccess=function(){},RestClient.prototype.AuthorizeFailure=function(){},RestClient.prototype.AuthorizeReady=function(){},RestClient.prototype.AuthorizeAutoRefresh=function(){},RestClient.prototype.ConsumeSuccess=function(){},RestClient.prototype.ConsumeFailure=function(){},RestClient.prototype.ConsumeReady=function(){},"undefined"!=typeof exports){module.exports={RestClient:RestClient,RCBase64:RCBase64};var _=require("underscore")}var language={en:{ERROR_NETWORK_FORM_DATA:"Network Error - Error getting form data",ERROR_NETWORK_SUBMIT_NEW:"Network Error - Error submitting a new case",ERROR_NETWORK_SUBMIT_CASE:"Network Error - Error submitting a case",ERROR_NETWORK_ROUTE:"Network Error - Error deriving a case",ERROR_NETWORK_JSON_FORM:"Network Error - Error in the form definition",ERROR_NETWORK_TRIGGER:"Network Error - Error in trigger execute",INFO_PMDYNAFORM_JSON:"There isn't a JSON definition",INFO_PMDYNAFORM_DERIVATED:"Routed successfully",INFO_PMDYNAFORM_SUBMIT:"Submited successfully",INFO_CASE_FINISHED:"Case finished"}};Array.prototype.filter||(Array.prototype.filter=function(e){"use strict";if(void 0===this||null===this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var i=[],a=arguments.length>=2?arguments[1]:void 0,o=0;n>o;o++)if(o in t){var r=t[o];e.call(a,r,o,t)&&i.push(r)}return i}),String.prototype.trim||function(){var e=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(e,"")}}(),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var t=this.length>>>0,n=Number(arguments[1])||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=t);t>n;n++)if(n in this&&this[n]===e)return n;return-1});var PMDynaform={VERSION:"0.1.0",view:{},model:{},collection:{},Extension:{},restData:{}};PMDynaform.extendNamespace=function(e,t){var n,i,a,o;if(2!==arguments.length)throw Error("Dynaform.extendNamespace(): method needs 2 arguments");for(i=e.split("."),"PMDynaform"===i[0]&&(i=i.slice(1)),n=PMDynaform,o=0;i.length-1>o;o+=1)a=i[o],n[a]===void 0&&(n[a]={}),n=n[a];return a=i[i.length-1],n[a],n[a]=t,t},PMDynaform.inheritFrom=function(e,t){function n(e){var t=function(){};return t.prototype=e,new t}var i,a,o,r,s;if(2!==arguments.length)throw Error("PMDynaform.inheritFrom(): method needs 2 arguments");for(o=e.split("."),"PMDynaform"===o[0]&&(o=o.slice(1)),i=PMDynaform,r=0;o.length>r;r+=1){if(a=o[r],i[a]===void 0)throw Error("PMDynaform.inheritFrom(): object "+a+" not found, full path was "+e);i=i[a]}s=n(i.prototype),s.constructor=t,t.prototype=s,t.superclass=i},String.prototype.capitalize=function(){return this.toLowerCase().replace(/(^|\s)([a-z])/g,function(e,t,n){return t+n.toUpperCase()})},jQuery.fn.extend({setLabel:function(e){var t=getFieldById(this.attr("id"))||null;return"string"==typeof e&&t&&t.setLabel(e),this},getLabel:function(){var e=getFieldById(this.attr("id"))||null;return e?e.getLabel():null},setValue:function(e){var t=getFieldById(this.attr("id"))||null;if(!t)throw Error("The field not exist!");return t.setValue(e),this},getValue:function(e){var e=getFieldById(this.attr("id"))||null;return e?e.getValue():null},setOnchange:function(e){var t;if(getFieldById(this.attr("id"))?t=getFieldById(this.attr("id")):getFormById(this.attr("id"))&&(t=getFormById(this.attr("id"))),"function"!=typeof e||!t)throw Error("The id is no Valid or handler is not a function");return t.setOnChange(e),this},getInfo:function(){var e=getFieldById(this.attr("id"))||null;return e?e.getInfo():null},setHref:function(e){var t=getFieldById(this.attr("id"))||null;return"link"===t.model.get("type")&&t.setHref(e),this},setRequired:function(){},required:function(){}}),function(){var e=function(t){this.onSupportSelectorFields=null,this.fieldType=null,this.fields=[],this.queries=[],this.forms=[],e.prototype.init.call(this,t)};e.prototype.init=function(e){var t={fields:[],queries:[],forms:[],onSupportSelectorFields:{text:"onTextField",textarea:"onTextAreaField"}};$.extend(!0,t,e),this.setOnSupportSelectorFields(t.onSupportSelectorFields).setFields(t.fields).setForms(t.forms).applyGlobalSelectors()},e.prototype.addQuery=function(e){if("string"!=typeof e)throw Error("The query selector must be a string");return this.queries.push(e),this},e.prototype.setOnSupportSelectorFields=function(e){if("object"!=typeof e)throw Error("The parameter for the support fields is wrong");return this.onSupportSelectorFields=e,this},e.prototype.setFields=function(e){return"object"==typeof e&&(this.fields=e),this},e.prototype.setForms=function(e){return jQuery.isArray(e)&&(this.forms=e),this},e.prototype.onTextField=function(){return this},e.prototype.onTextAreaField=function(){return this},e.prototype.findFieldById=function(e){var t,n=null;e:for(t=0;this.fields.length>t;t+=1)if(this.fields[t].model.id===e){n=this.fields[t];break e}return n},e.prototype.findFormById=function(e){var t;for(t=0;this.forms.length>t;t+=1)if(this.forms[t].model.id===e)return this.forms[t];return null},e.prototype.findFieldByName=function(e){var t,n=[];for(t=0;this.fields.length>t;t+=1)this.fields[t].model.get("name")===e&&n.push(this.fields[t]);return n},e.prototype.findFieldByAttribute=function(e,t){var n,i=[];for(n=0;this.fields.length>n;n+=1)this.fields[n].model.attributes[e]&&this.fields[n].model.get(e)===t&&i.push(this.fields[n]);return i},e.prototype.applyGlobalSelectors=function(){var e=this;return window.getFieldByAttribute=function(t,n){return e.addQuery(t+": "+n),e.findFieldByAttribute(t,n)},window.getFieldById=function(t){return e.addQuery("id: "+t),e.findFieldById(t)},window.getFieldByName=function(t){return e.addQuery("name: "+t),e.findFieldByName(t)},window.getFormById=function(t){return e.addQuery("id: "+t),e.findFormById(t)},this},PMDynaform.extendNamespace("PMDynaform.core.Selector",e)}(),function(){var e={generateID:function(){var e,t=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=999999999),Math.floor(Math.random()*(t-e+1))+e},n=function(e,t){var n,i,a={};return e===void 0&&(e=""),i=function(e,t){var n,i="";if(e=parseInt(e,10).toString(16),e.length>t)return e.slice(e.length-t);if(t>e.length){for(i="",n=0;1+(t-e.length)>n;n+=1)i+="0";return i+e}return e},a||(a={}),a.uniqidSeed||(a.uniqidSeed=Math.floor(123456789*Math.random())),a.uniqidSeed+=1,n=e,n+=i(parseInt((new Date).getTime()/1e3,10),8),n+=i(a.uniqidSeed,5),t&&(n+=""+(10*Math.random()).toFixed(8)),n};do e=n(t(0,999999999),!0),e=e.replace(".","0");while(32!==e.length);return"pmd"+e},generateName:function(e){return e+"["+PMDynaform.core.Utils.generateID()+"]"}};PMDynaform.extendNamespace("PMDynaform.core.Utils",e)}(),function(){var e=function(e,t,n){var i,a,o=this;e=$(e),t="function"==typeof t?t(e.val(),void 0,e,n):t;var r={getCaret:function(){try{var t,n=0,i=e.get(0),a=document.selection,o=i.selectionStart;return a&&!~navigator.appVersion.indexOf("MSIE 10")?(t=a.createRange(),t.moveStart("character",e.is("input")?-e.val().length:-e.text().length),n=t.text.length):(o||"0"===o)&&(n=o),n}catch(r){}},setCaret:function(t){try{if(e.is(":focus")){var n,i=e.get(0);i.setSelectionRange?i.setSelectionRange(t,t):i.createTextRange&&(n=i.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",t),n.select())}}catch(a){}},events:function(){e.on("keydown.mask",function(){}).on("keyup.mask",r.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){e.keydown().keyup()},100)}).on("change.mask",function(){e.data("changed",!0)}).on("blur.mask",function(){i===e.val()||e.data("changed")||e.trigger("change"),e.data("changed",!1)}).on("focusout.mask",function(){n.clearIfNotMatch&&!a.test(r.val())&&r.val("")})},getRegexMask:function(){for(var e,n,i,a,r,s,l=[],u=0;t.length>u;u++)e=o.translation[t[u]],e?(n=(""+e.pattern).replace(/.{1}$|^.{1}/g,""),i=e.optional,a=e.recursive,a?(l.push(t[u]),r={digit:t[u],pattern:n}):l.push(i||a?n+"?":n)):l.push("\\"+t[u]);return s=l.join(""),r&&(s=s.replace(RegExp("("+r.digit+"(.*"+r.digit+")?)"),"($1)?").replace(RegExp(r.digit,"g"),r.pattern)),RegExp(s)},destroyEvents:function(){e.off(["keydown","keyup","paste","drop","change","blur","focusout","DOMNodeInserted",""].join(".mask ")).removeData("changeCalled")},val:function(t){var n=e.is("input");return e&&e[0].getAttribute("mask")&&e[0].getAttribute("mask").length?arguments.length>0?n?e.val(t):e.text(t):n?e.val():e.text():void 0},getMCharsBeforeCount:function(e,n){for(var i=0,a=0,r=t.length;r>a&&e>a;a++)o.translation[t.charAt(a)]||(e=n?e+1:e,i++);return i},caretPos:function(e,n,i,a){var s=o.translation[t.charAt(Math.min(e-1,t.length-1))];return s?Math.min(e+i-n-a,i):r.caretPos(e+1,n,i,a)},behaviour:function(e){e=e||window.event;var t=e.keyCode||e.which;if(-1===$.inArray(t,o.byPassKeys)){var n=r.getCaret(),i=r.val(),a=i?i.length?i.length:0:"",s=a>n,l=r.getMasked(),u=l.length,d=r.getMCharsBeforeCount(u-1)-r.getMCharsBeforeCount(a-1);return l!==i&&r.val(l),!s||65===t&&e.ctrlKey||(8!==t&&46!==t&&(n=r.caretPos(n,a,u,d)),r.setCaret(n)),r.callbacks(e)}},getMasked:function(e){var i,a,s=[],l=r.val(),u=0,d=t.length,c=0,h=l?l.length?l.length:0:"",f=1,p="push",m=-1;for(n.reverse?(p="unshift",f=-1,i=0,u=d-1,c=h-1,a=function(){return u>-1&&c>-1}):(i=d-1,a=function(){return d>u&&h>c});a();){var g=t.charAt(u),v=l.charAt(c),y=o.translation[g];y?(v.match(y.pattern)?(s[p](v),y.recursive&&(-1===m?m=u:u===i&&(u=m-f),i===m&&(u-=f)),u+=f):y.optional&&(u+=f,c-=f),c+=f):(e||s[p](g),v===g&&(c+=f),u+=f)}var b=t.charAt(i);return d!==h+1||o.translation[b]||s.push(b),s.join("")},callbacks:function(a){var o=r.val(),s=o!==i;s===!0&&"function"==typeof n.onChange&&n.onChange(o,a,e,n),s===!0&&"function"==typeof n.onKeyPress&&n.onKeyPress(o,a,e,n),"function"==typeof n.onComplete&&o.length===t.length&&n.onComplete(o,a,e,n)}};o.remove=function(){var e;r.destroyEvents(),r.val(o.getCleanVal()).removeAttr("maxlength"),e=r.getCaret(),r.setCaret(e-r.getMCharsBeforeCount(e))},o.getCleanVal=function(){return r.getMasked(!0)},o.init=function(){n=n||{},o.byPassKeys=[9,16,17,18,36,37,38,39,40,91],o.translation={"#":{pattern:/\d/,recursive:!0},A:{pattern:/[a-zA-Z0-9]/},S:{pattern:/[a-zA-Z]/}},o.translation=$.extend({},o.translation,n.translation),o=$.extend(!0,{},o,n),a=r.getRegexMask(),n.maxlength!==!1&&e.attr("maxlength",t.length),n.placeholder&&e.attr("placeholder",n.placeholder),e.attr("autocomplete","off"),r.destroyEvents(),r.events();var i=r.getCaret();r.val(r.getMasked()),r.setCaret(i+r.getMCharsBeforeCount(i,!0))}()},t={},n="DOMNodeInserted.mask",i=function(){var e=$(this),t={},n="data-mask-";e.attr(n+"reverse")&&(t.reverse=!0),"false"===e.attr(n+"maxlength")&&(t.maxlength=!1),e.attr(n+"clearifnotmatch")&&(t.clearIfNotMatch=!0),e.mask(e.attr("data-mask"),t)};$.fn.mask=function(i,a){var o=this.selector,r=function(t){return t.originalEvent&&$(t.originalEvent.relatedNode)[0]===$(this)[0]?void 0:$(this).data("mask",new e(this,i,a))};this.each(r),o&&!t[o]&&(t[o]=!0,setTimeout(function(){$(document).on(n,o,r)},500))},$.fn.unmask=function(){try{return this.each(function(){$(this).data("mask").remove()})}catch(e){}},$.fn.cleanVal=function(){return this.data("mask").getCleanVal()},$("*[data-mask]").each(i),$(document).on(n,"*[data-mask]",i)}(),function(){var e={requiredText:{message:"This field is required",fn:function(e){return e=e.trim(),null===e||0===e.length||/^\s+$/.test(e)?!1:!0}},requiredDropDown:{message:"This field is required",fn:function(e){return e=e.trim(),null===e||0===e.length||/^\s+$/.test(e)?!1:!0}},requiredCheckBox:{message:"This field is required",fn:function(e){if("number"==typeof e)var t=e>0?!0:!1;else t=!1;return t}},requiredFile:{message:"This field File is required",fn:function(e){return e=e.trim(),null===e||0===e.length||/^\s+$/.test(e)?!1:!0}},requiredRadioGroup:{message:"This field is required",fn:function(e){if("number"==typeof e)var t=e>0?!0:!1;else t=!1;return t}},integer:{message:"Invalid value for the integer field",mask:/[\d\.]/i,fn:function(e){return""!=e&&!isNaN(e)&&Math.round(e)==e}},"float":{message:"Invalid value for the float field",fn:function(e){return/^-?\d+\.?\d*$/.test(e)}},string:{fn:function(){return!0}},"boolean":{fn:function(){return!0}},maxLength:{message:"The maximum length are ",fn:function(e,t){var n;if("number"!=typeof t)throw Error("The parameter maxlength is not a number");return n=t>=(""+e).length?!0:!1}}};PMDynaform.extendNamespace("PMDynaform.core.Validators",e)}(),function(){var e=function(t){this.model=null,this.view=null,this.data=null,this.fields=null,this.keys=null,this.token=null,this.renderTo=null,this.urlFormat=null,this.endPointsPath=null,this.forms=null,this.externalLibs=null,this.dependentLibraries=null,this.submitRest=null,this.onSubmitForm=Function(),e.prototype.init.call(this,t)};e.prototype.init=function(e){var t={submitRest:!1,data:{},urlFormat:"{server}/{apiName}/{apiVersion}/{workspace}/{keyProject}/{projectId}/{endPointPath}",keys:{server:"",projectId:"",workspace:"",keyProject:"project",apiName:"api",apiVersion:"1.0"},token:{accessToken:"",clientId:"x-pm-local-client",clientSecret:"",expiresIn:"",refreshToken:"",scope:"",tokenType:"bearer"},endPointsPath:{project:"",createVariable:"process-variable",variableList:"process-variable",variableInfo:"process-variable/{var_uid}",executeQuery:"process-variable/{var_name}/execute-query",uploadFile:"uploadfile/{field_name}",executeQuerySuggest:"process-variable/{var_name}/execute-query-suggest"},externalLibs:"",renderTo:document.body};!_.isEmpty(e.data)&&e.data.items[0]&&e.data.items[0].externalLibs&&(this.externalLibs=e.data.items[0].externalLibs.split(","));var n=this;this.setExternalLibreries(this.externalLibs,0,function(){jQuery.extend(!0,t,e),n.setData(t.data).setUrlFormat(t.urlFormat).setKeys(t.keys).setToken(t.token).setRenderTo(t.renderTo).setEndPointsPath(t.endPointsPath).checkDependenciesLibraries(),n.submitRest=t.submitRest})},e.prototype.setExternalLibreries=function(e,t,n){var i,a,o=this;if(jQuery.isArray(e)&&e.length>t)switch(i=e[t],a=i.substring(i.lastIndexOf(".")+1)){case"js":var r=document.createElement("script");r.onload=function(){o.setExternalLibreries(e,t+1,n)},r.type="text/javascript",r.src=i,document.head.appendChild(r);break;case"css":var s=document.createElement("link");s.onload=function(){o.setExternalLibreries(e,t+1,n)},s.rel="stylesheet",s.href=i,document.head.appendChild(s)}else n()},e.prototype.setData=function(e){return"object"==typeof e&&(this.data=e),this.view&&(this.destroy(),this.loadProject()),this},e.prototype.setData2=function(e){return this.view.setData2(e),this},e.prototype.setUrlFormat=function(e){return"string"==typeof e&&(this.urlFormat=e),this},e.prototype.setKeys=function(e){var t,n,i={};if("object"==typeof e){for(t in e)n="/"===e[t][0]?e[t].substring(1):e[t],i[t]="/"===n[n.length-1]?n.substring(0,n.length-1):n;i.server=i.server.replace(/\https:\/\//,"").replace(/\http:\/\//,""),this.keys=i}return this},e.prototype.setToken=function(e){return"object"==typeof e&&(this.token=e),this},e.prototype.setRenderTo=function(e){return this.renderTo=e,this},e.prototype.setEndPointsPath=function(e){var t,n,i={};for(n in e){if("string"!=typeof e[n])throw Error("The endpoint path is not correct, "+e[n]);t="/"===e[n][0]?e[n].substring(1):e[n],i[n]="/"===e[n][e[n].length-1]?e[n].substring(0,e[n].length-1):e[n]}return this.endPointsPath=i,this},e.prototype.checkDependenciesLibraries=function(){var e,t,n=!1,i=this.data.items;for(t=function(e){var i,a,o=["geomap","other"];e:for(i=0;e.length>i;i+=1)for(a=0;e[i].length>a;a+=1){if($.inArray(e[i][a].type,o)>=0){n=!0;break e}"form"===e[i][a].type&&t(e[i][a].items)}},e=0;i.length>e;e+=1)t(i[e].items);return n?this.loadGeoMapDependencies():this.loadProject(),this},e.prototype.checkScript=function(){var e,t;for(e=0;this.forms.length>e;e+=1)_.isEmpty(this.forms[e].model.get("script"))||(t=new PMDynaform.core.Script({script:this.forms[e].model.get("script").code}),t.render())},e.prototype.setAllFields=function(e){return"object"==typeof e&&(this.fields=e,this.selector.setFields(e)),this},e.prototype.loadProject=function(){var e=this;return this.model=new PMDynaform.model.Panel(this.data),this.view=new PMDynaform.view.Panel({tagName:"div",renderTo:this.renderTo,model:this.model,project:this}),this.forms=this.view.getPanels(),this.createGlobalPmdynaformClass(this.view),this.createSelectors(),this.checkScript(),this.createMessageLoading(),e.view.afterRender(),e.view.$el.find(".pmdynaform-form-message-loading").remove(),$("#shadow-form").remove(),this},e.prototype.createMessageLoading=function(){var e=_.template($("#tpl-loading").html());this.view.$el.prepend(e({title:"Loading",msg:"Please wait while the data is loading..."})),this.view.$el.find("#shadow-form").css("height",this.view.$el.height()+"px")},e.prototype.createSelectors=function(){var e,t,n=[];for(t=function(e){var i;for(i=0;e.length>i;i+=1)"form"===e[i].model.get("type")?t(e[i].formView.getFields()):n.push(e[i])},e=0;this.forms.length>e;e+=1)t(this.forms[e].getFields());return this.fields=n,this.selector=new PMDynaform.core.Selector({fields:n,forms:this.forms}),this},e.prototype.createGlobalPmdynaformClass=function(){},e.prototype.loadGeoMapDependencies=function(){var e,t,n=!0,i="";i=document.body.getElementsByTagName("script");e:for(e=0;i.length>e;e+=1)if($(i[e]).data&&"google"===$(i[e]).data("script")){n=!1;break e}if(n){t=function(e){this.project=e.project},t.prototype.load=function(){this.project.loadProject()},window.pmd=new t({project:this});var a=document.createElement("script");a.type="text/javascript",$(a).data("script","google"),a.src="https://maps.googleapis.com/maps/api/js?v=3.exp&callback=pmd.load",document.body.appendChild(a)}else this.loadProject();return this},e.prototype.registerKey=function(e,t){if("string"!=typeof e||"string"!=typeof t)throw Error("The parameters must be strings.");if(this.keys[e])throw Error("The key already exists.");return this.keys[e]=t,this},e.prototype.getEndPoint=function(e){return this.endPointsPath[e]},e.prototype.setModel=function(e){return e instanceof Backbone.Model&&(this.model=e),this},e.prototype.setView=function(e){return e instanceof Backbone.View&&(this.view=e),this},e.prototype.getFullURL=function(e){var t,n=this.keys,i=this.urlFormat;for(t in n)n.hasOwnProperty(t)&&(i=i.replace(RegExp("{"+t+"}","g"),n[t]));return i=window.location.protocol+"//"+i.replace(/{endPointPath}/,e)},e.prototype.getForms=function(){var e;return this.view instanceof PMDynaform.view.Panel&&(e=this.view.getPanels()),e},e.prototype.getData=function(){var e=this.view.getData();return e},e.prototype.destroy=function(){return this.view.$el.remove(),this},PMDynaform.extendNamespace("PMDynaform.core.Project",e)}(),function(){var e=function(e){this.cursor=0,this.tokens=e};e.prototype.next=function(){return this.tokens[this.cursor++]},e.prototype.peek=function(e){return void 0===e&&(e=0),this.tokens[this.cursor+e]},PMDynaform.extendNamespace("PMDynaform.core.TokenStream",e);var t=function(){this.tokens={},this.regex=null,this.fields=[],this.tokenNames=[],this.tokenFields={}};t.prototype.addToken=function(e,t){this.tokens[e]=t},t.prototype.addField=function(e,t){var n;-1===$.inArray(t,this.fields)&&this.fields.push(t),n=(""+this.fields).replace(/,/g,"|"),n=n.replace(RegExp("\\[","g"),"\\["),n=n.replace(RegExp("\\]","g"),"\\]"),this.tokens[e]=n},t.prototype.addTokenValue=function(e,t){this.tokenFields[e]=parseFloat(t)?parseFloat(t):0},t.prototype.tokenize=function(t){var n;return this.buildExpression(t),n=this.findTokens(t),new e(n)},t.prototype.buildExpression=function(){var e,t=[];for(e in this.tokens)this.tokenNames.push(e),t.push("("+this.tokens[e]+")");this.regex=RegExp(t.join("|"),"g")},t.prototype.findTokens=function(e){for(var t,n,i=[];null!==(t=this.regex.exec(e));)if(void 0!==t)for(n=1;t.length>n;n+=1)t[n]&&i.push({name:this.tokenNames[n-1],data:t[n],value:null});return i},PMDynaform.extendNamespace("PMDynaform.core.Tokenizer",t);var n=function(e){this.data=""+e,this.tokenizer=new t};n.prototype.initializeTokens=function(){return this.tokenizer.addToken("whitespace","\\s+"),this.tokenizer.addToken("l_paren","\\("),this.tokenizer.addToken("r_paren","\\)"),this.tokenizer.addToken("float","[0-9]+\\.[0-9]+"),this.tokenizer.addToken("int","[0-9]+"),this.tokenizer.addToken("div","\\/"),this.tokenizer.addToken("mul","\\*"),this.tokenizer.addToken("add","\\+"),this.tokenizer.addToken("sub","\\-"),this.tokenizer.addToken("constant","pi|PI"),this.tokenizer.addToken("function","[a-zA-Z_][a-zA-Z0-9_]*"),this},n.prototype.addToken=function(e,t){return this.tokenizer.addToken(e,t),this},n.prototype.addField=function(e,t){return this.tokenizer.addField(e,t),this},n.prototype.addTokenValue=function(e,t){return this.tokenizer.addTokenValue(e,t),this},n.prototype.consumeConstant=function(e){return"Math."+e.data.toUpperCase()},n.prototype.consumeField=function(e){return void 0===this.tokenizer.tokenFields[e.data]?0:this.tokenizer.tokenFields[e.data]},n.prototype.consumeFunction=function(e,t){for(var n,i=[t.data];(n=e.next())&&(i.push(n.data),"r_paren"!==n.name););return"Math."+i.join("")},n.prototype.evaluate=function(){var e,t,n,i,a=[];for(this.initializeTokens(),e=this.tokenizer.tokenize(this.data);i=e.next();)switch(i.name){case"int":case"float":case"mul":case"div":case"sub":case"add":a.push(i.data);break;case"field":a.push(this.consumeField(i));break;case"constant":a.push(this.consumeConstant(i));break;case"l_paren":a.push("(");break;case"r_paren":a.push(")");break;case"function":var o=e.peek();if(o&&"l_paren"===o.name){a.push(this.consumeFunction(e,i));continue}default:}n=a.join("");try{t=Function("return "+n)()}catch(n){throw Error("Error in the formula property")}return t},PMDynaform.extendNamespace("PMDynaform.core.Formula",n)}(),function(){var e=function(t){this.method=null,this.data=null,this.successCallback=null,this.failureCallback=null,this.completeCallback=null,this.restProxy=null,this.keys=null,this.url=null,this.multipart=null,this.dataType="json",this.authorizationType="none",this.authorizationOAuth=!1,e.prototype.init.call(this,t)};e.prototype.type="proxy",e.prototype.init=function(e){var t={url:"",method:"GET",data:{},keys:{accessToken:"",clientId:"x-pm-local-client",clientSecret:"",expiresIn:"",refreshToken:"",scope:"",tokenType:"bearer"},multipart:!1,successCallback:function(){},failureCallback:function(){},completeCallback:function(){}};jQuery.extend(!0,t,e),this.setUrl(t.url).setMethod(t.method).setData(t.data).setKeys(t.keys).setMultipart(t.multipart).setSuccessCallback(t.successCallback).setFailureCallback(t.failureCallback).setCompleteCallback(t.completeCallback).setRestProxy(),this.executeRestProxy()},e.prototype.setUrl=function(e){return this.url=e,this},e.prototype.setEndpoint=function(e){var t;return"string"==typeof e&&(t="/"===e[0]?e.substring(1):e,this.endpoint="/"===e[e.length-1]?e.substring(0,e.length-1):e),this},e.prototype.setMethod=function(e){return this.method=e,this},e.prototype.setServer=function(e){var t;return"string"==typeof e&&(t="/"===e[0]?e.substring(1):e,this.server="/"===e[e.length-1]?e.substring(0,e.length-1):e),this},e.prototype.setData=function(e){return this.data=e,this},e.prototype.setKeys=function(e){return this.keys=e,this.keys.token={access_token:e.token},this},e.prototype.setMultipart=function(e){return this.multipart=e,this},e.prototype.setSuccessCallback=function(e){return"function"==typeof e&&(this.successCallback=e),this},e.prototype.setFailureCallback=function(e){return"function"==typeof e&&(this.failureCallback=e),this},e.prototype.setCompleteCallback=function(e){return"function"==typeof e&&(this.completeCallback=e),this},e.prototype.getFullProxyPath=function(){return this.server+"/"+this.keys.apiName+"/"+this.keys.apiVersion+"/"+this.keys.workspace+"/"+"project"+"/"+this.keys.processId+"/"+this.endpoint },e.prototype.setRestProxy=function(){var e=this;return this.restProxy=new PMDynaform.proxy.RestProxy({url:this.url,method:e.method,data:e.data,authorizationOAuth:!0,dataType:this.dataType,success:e.successCallback,failure:e.failureCallback,complete:e.completeCallback}),this.restProxy.setAuthorizationType("oauth2",{access_token:this.keys.accessToken}),this},e.prototype.executeRestProxy=function(){var e={POST:"post",UPDATE:"update",GET:"get",DELETE:"remove"};return this.restProxy[e[this.method]](),this},PMDynaform.extendNamespace("PMDynaform.core.Proxy",e)}(),function(){var e=function(t){this.parentMode=null,this.field=null,this.json=null,this.jsonBuilt=null,e.prototype.init.call(this,t)};e.prototype.init=function(t){var n={parentMode:"edit",field:{},json:{text:e.prototype.text,textarea:e.prototype.textArea,checkbox:e.prototype.checkbox,radio:e.prototype.radio,dropdown:e.prototype.dropdown,button:e.prototype.button,submit:e.prototype.submit,datetime:e.prototype.datetime,suggest:e.prototype.suggest,link:e.prototype.link,file:e.prototype.file,grid:e.prototype.grid}};return jQuery.extend(!0,n,t),this.jsonBuilt=n.field,this.setParentMode(n.parentMode).setField(n.field).setJSONFactory(n.json).buildJSON(),this},e.prototype.setParentMode=function(e){return this.parentMode=e,this},e.prototype.text=function(e){return{type:"label",colSpan:e.colSpan,label:e.label,fullOptions:[e.defaultValue||e.value],data:e.data}},e.prototype.textArea=function(e){return{type:"label",colSpan:e.colSpan,label:e.label,fullOptions:[e.defaultValue||e.value],data:e.data}},e.prototype.checkbox=function(e){var t,n=[];for(t=0;e.options.length>t;t+=1)e.options[t].selected&&e.options[t].selected===!0&&n.push(e.options[t].label);return{type:"label",colSpan:e.colSpan,label:e.label,fullOptions:n,data:e.data}},e.prototype.radio=function(e){var t,n=[];for(t=0;e.options.length>t;t+=1)e.defaultValue&&""+e.options[t].value==""+e.defaultValue&&n.push(e.options[t].label);return{type:"label",colSpan:e.colSpan,label:e.label,fullOptions:n,data:e.data}},e.prototype.dropdown=function(e){var t,n=[];for(t=0;e.options.length>t;t+=1)e.defaultValue&&""+e.options[t].value==""+e.defaultValue&&n.push(e.options[t].label);return{type:"label",colSpan:e.colSpan,label:e.label,fullOptions:n,data:e.data}},e.prototype.button=function(e){var t=e;return t},e.prototype.submit=function(e){var t=e;return t},e.prototype.datetime=function(e){return{type:"label",colSpan:e.colSpan,label:e.label,fullOptions:[e.defaultValue||e.value],data:e.data}},e.prototype.suggest=function(e){var t,n=[];for(t=0;e.options.length>t;t+=1)e.defaultValue&&""+e.options[t].value==""+e.defaultValue&&n.push(e.options[t].label);return{type:"label",colSpan:e.colSpan,label:e.label,fullOptions:n,data:e.data}},e.prototype.link=function(e){return{type:"label",colSpan:e.colSpan,label:e.label,options:[e.value]}},e.prototype.file=function(e){var t=e;return t},e.prototype.grid=function(e){var t=e;return t},e.prototype.setField=function(e){return this.field=e,this},e.prototype.setJSONFactory=function(e){return this.json=e,this},e.prototype.discardViewField=function(e){var t=["button","submit","image","label","title","subtitle"];return 0>$.inArray(e,t)?!0:!1},e.prototype.reviewField=function(e){var t,n,i=e,a=["text","suggest","textarea","datetime"];if(this.json[e.type]&&this.discardViewField(e.type))switch(e.mode){case"disabled":i=e,i.disabled=!0;break;case"parent":e.mode=this.parentMode,i=this.reviewField(e);break;case"view":i=this.json[e.type](e);break;default:i=e}if(i.originalType=e.originalType||e.type,i.var_name=e.var_name||"",i.var_uid=e.var_uid||"",i.options||e.var_accepted_values,e.data)if(i.fullOptions=[],-1!==a.indexOf(i.originalType))i.fullOptions="suggest"===i.originalType?[e.data.label||e.defaultValue]:[e.data.value||e.defaultValue];else if("checkbox"===i.originalType){for(t=[],n=0;e.options.length>n;n+=1)-1!==e.data.value.indexOf(e.options[n].value)&&t.push(e.options[n].label);i.fullOptions=t||[e.defaultValue]}else i.fullOptions=[e.data.label||e.defaultValue];return i},e.prototype.buildJSON=function(){return this.jsonBuilt=this.reviewField(this.field),this},e.prototype.getJSON=function(){return this.jsonBuilt},PMDynaform.extendNamespace("PMDynaform.core.TransformJSON",e)}(),function(){function e(e,t){function n(e){for(var t=[],n=e.clipboardData||{},a=n.items||[],r=0;a.length>r;r++){var s=a[r].getAsFile();if(s){var l=RegExp("/(.*)").exec(s.type);if(!s.name&&l){var u=l[1];s.name="clipboard"+r+"."+u}t.push(s)}}t.length&&(o(e,t,i),e.preventDefault(),e.stopPropagation())}var i={};d.enabled&&($.extend(!0,i,d.opts),$.extend(!0,i,t),e.addEventListener("paste",n,!1))}function t(e,t){function n(t){o(t,e.files,a)}function i(e){e.stopPropagation(),e.preventDefault(),o(e,e.dataTransfer.files,a)}var a={};d.enabled&&($.extend(!0,a,d.opts),$.extend(!0,a,t),e.addEventListener("change",n,!1),e.addEventListener("drop",i,!1))}function n(e,t){function n(){m=!1}function i(){m=!0}function a(e){e.dataTransfer.files&&e.dataTransfer.files.length&&(e.stopPropagation(),e.preventDefault())}function r(e){return function(){m||e.apply(this,arguments)}}function u(t){t.stopPropagation(),t.preventDefault(),p&&l(e,p),o(t,t.dataTransfer.files,g)}function c(t){t.stopPropagation(),t.preventDefault(),p&&s(e,p)}function h(){p&&l(e,p)}function f(t){t.stopPropagation(),t.preventDefault(),p&&s(e,p)}var p,m,g={};d.enabled&&($.extend(!0,g,d.opts),$.extend(!0,g,t),g.dnd&&(p=g.dragClass,m=!1,e.addEventListener("dragenter",r(c),!1),e.addEventListener("dragleave",r(h),!1),e.addEventListener("dragover",r(f),!1),e.addEventListener("drop",r(u),!1),document.body.addEventListener("dragstart",i,!0),document.body.addEventListener("dragend",n,!0),document.body.addEventListener("drop",a,!1)))}function i(e,t){for(var n=0;e.length>n;n++){var i=e[n];i.extra={nameNoExtension:i.name.substring(0,i.name.lastIndexOf(".")),extension:i.name.substring(i.name.lastIndexOf(".")+1),fileID:n,uniqueID:v(),groupID:t,prettySize:u(i.size)}}}function a(e,t,n){for(var i in t)if(e.match(RegExp(i)))return"readAs"+t[i];return"readAs"+n}function o(e,t,n){function o(){l.ended=new Date,n.on.groupend(l)}function r(){0===--s&&o()}var s=t.length,l={groupID:g(),files:t,started:new Date};if(d.output.push(l),i(t,l.groupID),n.on.groupstart(l),!t.length)return o(),void 0;var u,v=d.sync&&h;v&&(u=m.getWorker(f,function(e){var t=e.data.file,i=e.data.result;t.extra||(t.extra=e.data.extra),t.extra.ended=new Date,n.on["error"===i?"error":"load"]({target:{result:i}},t),r()})),Array.prototype.forEach.call(t,function(t){if(t.extra.started=new Date,n.accept&&!t.type.match(RegExp(n.accept)))return n.on.skip(t),r(),void 0;if(n.on.beforestart(t)===!1)return n.on.skip(t),r(),void 0;var i=a(t.type,n.readAsMap,n.readAsDefault);if(v&&u)u.postMessage({file:t,extra:t.extra,readAs:i});else{var o=new c;o.originalEvent=e,p.forEach(function(e){o["on"+e]=function(i){("load"==e||"error"==e)&&(t.extra.ended=new Date),n.on[e](i,t),"loadend"==e&&r()}}),o[i](t)}})}function r(e,t){return RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)}function s(e,t){r(e,t)||(e.className=e.className?[e.className,t].join(" "):t)}function l(e,t){if(r(e,t)){var n=e.className;e.className=n.replace(RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)","g")," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}function u(e){var t=["bytes","kb","MB","GB","TB","PB"],n=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,Math.floor(n))).toFixed(2)+" "+t[n]}var d,c=window.FileReader,h=!1,f="self.addEventListener('message', function(e) { var data=e.data; try { var reader = new FileReaderSync; postMessage({ result: reader[data.readAs](data.file), extra: data.extra, file: data.file})} catch(e){ postMessage({ result:'error', extra:data.extra, file:data.file}); } }, false);",p=["loadstart","progress","load","abort","error","loadend"],d={enabled:!1,setupInput:t,setupDrop:n,setupClipboard:e,sync:!1,output:[],opts:{dragClass:"drag",accept:!1,readAsDefault:"BinaryString",readAsMap:{"image/*":"DataURL","text/*":"Text"},on:{loadstart:function(){},progress:function(){},load:function(){},abort:function(){},error:function(){},loadend:function(){},skip:function(){},groupstart:function(){},groupend:function(){},beforestart:function(){}}}};if(c){var m=function(){function e(e){if(window.Worker&&i&&n){var t=new i;return t.append(e),n.createObjectURL(t.getBlob())}return null}function t(t,n){var i,a=e(t);return a?(i=new Worker(a),i.onmessage=n,i):null}var n=window.URL||window.webkitURL,i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;return{getURL:e,getWorker:t}}(),g=function(e){return function(){return e++}}(0),v=function(e){return function(){return e++}}(0);d.enabled=!0,PMDynaform.extendNamespace("PMDynaform.core.FileStream",d)}}(),function(){var e=function(t){this.element=null,this.onReadyScreen=null,this.onCancelScreen=null,this.isInFullScreen=null,this.supported=null,e.prototype.init.call(this,t)};e.prototype.init=function(e){var t={element:document.documentElement,onReadyScreen:function(){},onCancelScreen:function(){}};jQuery.extend(!0,t,e),this.element=t.element,this.onReadyScreen=t.onReadyScreen,this.onCancelScreen=t.onCancelScreen,this.checkFullScreen()},e.prototype.checkFullScreen=function(){var e=this.element,t=e.requestFullScreen||e.webkitRequestFullScreen||e.mozRequestFullScreen||e.msRequestFullScreen;return this.supported=t?!0:null,this},e.prototype.cancel=function(){var e,t,n,i;if(i=parent.document.documentElement===document.documentElement?document:parent.document,e=i.cancelFullScreen||i.webkitCancelFullScreen||i.mozCancelFullScreen||i.exitFullscreen){e.call(i);try{t=this.onCancelScreen,t(i)}catch(a){throw Error(a)}}else window.ActiveXObject!==void 0&&(n=new ActiveXObject("WScript.Shell"),null!==n&&n.SendKeys("{F11}"))},e.prototype.applyZoom=function(){var e,t,n,i=this.element;if(e=i.requestFullScreen||i.webkitRequestFullScreen||i.mozRequestFullScreen||i.msRequestFullScreen){e.call(i);try{n=this.onReadyScreen,n(i)}catch(a){throw Error(a)}}else window.ActiveXObject!==void 0&&(t=new ActiveXObject("WScript.Shell"),null!==t&&t.SendKeys("{F11}"));return!1},e.prototype.toggle=function(){var e;return e=parent.document.documentElement===document.documentElement?document:parent.document,this.isInFullScreen=e.fullScreenElement&&null!==e.fullScreenElement||e.mozFullScreen||e.webkitIsFullScreen,this.isInFullScreen?this.cancel():this.applyZoom(),!1},PMDynaform.extendNamespace("PMDynaform.core.FullScreen",e)}(),function(){var e=function(t){this.name=null,this.type=null,this.html=null,this.script="",this.renderTo=document.body,e.prototype.init.call(this,t)};e.prototype.init=function(e){var t={type:"text/javascript",script:""};$.extend(!0,t,e),this.setType(t.type).setScript(t.script)},e.prototype.setType=function(e){return this.type=e,this},e.prototype.setScript=function(e){return this.script=e,this},e.prototype.createHTML=function(){var e=document.createElement("script");return e.type=this.type,$(e).text(this.script),this.html=e,e},e.prototype.getHTML=function(){return this.html||this.createHTML(),this.html},e.prototype.render=function(){var e=this.getHTML();return $(this.renderTo).append(e),this},PMDynaform.extendNamespace("PMDynaform.core.Script",e)}(),function(){var e=function(){var e,t,n=[],i=0;return{id:Math.random(),get:function(e){return n[e]},insert:function(e){return n[i]=e,i+=1,this},insertAt:function(e,t){return n.splice(t,0,e),i=n.length,this},remove:function(t){return e=this.indexOf(t),-1===e?!1:(i-=1,n.splice(e,1),!0)},getSize:function(){return i},isEmpty:function(){return 0===i},indexOf:function(e){for(t=0;i>t;t+=1)if(e===n[t])return t;return-1},find:function(e){function t(n,a){if(n>a)return void 0;if(i[n]===e)return n;if(i[a]===e)return a;var o=Math.floor((n+a)/2),r=i[o];return e>r?t(o,a-1):r>e?t(n+1,o):o}var i=n.sort();return t(0,i.length-1)},contains:function(e){return-1!==this.indexOf(e)?!0:!1},sort:function(e){var e=e||function(e,t){return t>e?1:e>t?-1:0},t=function(e,t,n){var i=e[t];e[t]=e[n],e[n]=i},a=function(n,i,a){for(var o=n[Math.floor((a+i)/2)],r=i,s=a;s>=r;){for(;e(n[r],o)>0;)r++;for(;0>e(n[s],o);)s--;s>=r&&(t(n,r,s),r++,s--)}return r},o=function(e,t,n){var i;return e.length>1&&(i=a(e,t,n),i-1>t&&o(e,t,i-1),n>i&&o(e,i,n)),e};return o(n,0,i-1)},asArray:function(){return n.slice(0)},swap:function(e,t){var a;return i>e&&e>=0&&i>t&&t>=0&&(a=n[e],n[e]=n[t],n[t]=a),this},getFirst:function(){return n[0]},getLast:function(){return n[i-1]},popLast:function(){var e;return i-=1,e=n[i],n.splice(i,1),e},getDimensionLimit:function(){var e=[1e5,-1,-1,1e5],a=[void 0,void 0,void 0,void 0];for(t=0;i>t;t+=1)e[0]>n[t].y&&(e[0]=n[t].y,a[0]=n[t]),e[1]n[t].x&&(e[3]=n[t].x,a[3]=n[t]);return e},clear:function(){return 0!==i&&(n=[],i=0),this},set:function(e){if(null!==e&&!jQuery.isArray(e))throw Error("set(): The parameter must be an array or null.");return n=e&&e.slice(0)||[],i=n.length,this}}};PMDynaform.extendNamespace("PMDynaform.util.ArrayList",e)}(),function(){var e=function(t){this.projectFlow=null,this.dataManager=new PMDynaform.core.DataLocalManager,this.formsHandler=null,this.id=null,this.buttonNext=null,this.buttonPrev=null,this.navBar=null,this.model=null,this.view=null,this.data=null,this.dataForm=null,this.formID=null,this.taskID=null,this.caseID=null,this.caseFakeID=null,this.workspace=null,this.tokens=null,this.restClient=null,this.server=null,this.submitRest=!1,this.typeList=null,this.onLine=!1,this.caseTitle=null,this.caseNumber=null,this.proxy=null,this.keys=null,this.message=null,this.userAgent=null,this.currentFormID=null,this.dynaforms=[],this.container=null,this.viewfields=[],this.memoryStack=[],this.isCase=!1,this.delayDataView=null,this.blockButtonSubmit=!0,t.keys={server:t.server,processID:t.processID,taskID:t.taskID,caseID:t.caseID,workspace:t.workspace,formID:t.formID,keyProject:"project",typeList:t.typeList,stepID:""},t.urlFormat="{server}/api/1.0/{workspace}/{endPointPath}",this.urlFormatStreaming="{server}/sys{workspace}/{endPointPath}",t.endPointsPath={dynaformDefinition:"light/project/dynaform/{formID}",jsonDynaforms:"light/project/dynaforms",startCase:"light/process/{processID}/task/{taskID}/start-case",newTokens:"oauth/token",caseTypeList:"case/{caseID}/dynaform/{typeList}",loadDynaform:"case/{caseID}/dynaform/{formID}/data",getFormData:"case/{caseID}/dynaform/{formID}/data",getAllDataCase:"case/{caseID}/variables",submitFormCase:"cases/{caseID}/variable",routeCase:"light/cases/{caseID}/route-case",createVariable:"process-variable",imageInfo:"light/case/{caseID}/download64",fileDownload:"case/{caseID}/file/{fileID}",variableList:"process-variable",getImageGeo:"light/case/{caseID}/download64",imageDownload:"light/case/{caseID}/download64",generateImageGeo:"/light/case/{caseID}/input-document/location",variableInfo:"process-variable/{var_uid}",executeQuery:"process/{processID}/process-variable/{var_name}/execute-query",uploadFile:"",refreshToken:"oauth/token",fileStreaming:"en/neoclassic/cases/casesStreamingFile?actionAjax=streaming&a={caseID}&d={fileId}",executeTrigger:"light/process/{processID}/task/{taskID}/case/{caseID}/step/{stepID}/execute-trigger/{triggerOption}"},e.superclass.call(this,t),e.prototype.init.call(this,t)};PMDynaform.inheritFrom("PMDynaform.core.Project",e),e.prototype.init=function(e){var t=this;defaults={name:"",data:[],onSubmitForm:function(){t.executeSubmit(t.view.getData2())}},this.viewfields=[],$.extend(!0,defaults,e),this.setServer(defaults.server),this.setProcessID(defaults.processID),this.setWorkspace(defaults.workspace),this.setTaskID(defaults.taskID),this.setCaseFakeID(defaults.caseFakeID),this.setCaseID(defaults.caseID),this.setFormID(defaults.formID),this.setData(defaults.data),this.setDataForm(defaults.dataForm),this.setTypeList(defaults.typeList),this.setSubmitRest(defaults.submitRest),this.setOnLine(defaults.onLine),this.setDynaforms(defaults.dynaforms),this.setContainer(defaults.container),this.setLanguage(),this.setOnSubmitForm(defaults.onSubmitForm)},e.prototype.setTokens=function(e){return this.tokens=e,this},e.prototype.setOnSubmitForm=function(e){return this.onSubmitForm=e,this},e.prototype.setIsCase=function(e){return"boolean"==typeof e&&(this.isCase=e),this},e.prototype.setCaseFakeID=function(e){return"string"==typeof e&&(this.caseFakeID=e),this},e.prototype.setKeys=function(e){var t,n,i={};if("object"==typeof e){for(t in e)n="/"===e[t][0]?e[t].substring(1):e[t],i[t]="/"===n[n.length-1]?n.substring(0,n.length-1):n;this.keys=i}return this},e.prototype.setContainer=function(e){return this.container=e,this},e.prototype.setDynaforms=function(e){return this.dynaforms=e,this},e.prototype.checkDependenciesLibraries=function(){return null!=this.data?this.data.items:null,this},e.prototype.setUserAgent=function(){"formslider-android"===navigator.userAgent&&(this.userAgent="android"),"formslider-ios"===navigator.userAgent&&(this.userAgent="ios")},e.prototype.setData=function(e){return"object"==typeof e&&(this.data=e),this},e.prototype.setDataForm=function(e){return"object"==typeof e&&(this.dataForm=e),this},e.prototype.setProcessID=function(e){return this.processID=e,this},e.prototype.setOnLine=function(e){return this.onLine=e,this},e.prototype.setWorkspace=function(e){return this.workspace=e,this},e.prototype.setTaskID=function(e){return this.taskID=e,this},e.prototype.setCaseID=function(e){return e&&(this.caseID=e),this},e.prototype.setTypeList=function(e){return this.typeList=e,this},e.prototype.setServer=function(e){return e&&(this.server=e),this},e.prototype.setSubmitRest=function(e){return e&&"boolean"==typeof e&&(this.submitRest=e),this},e.prototype.setLanguage=function(e){return this.language=e?language[e]:language.en,this},e.prototype.setModel=function(e){return e instanceof Backbone.Model&&(this.model=e),this},e.prototype.setFormID=function(e){return this.formID=e,this.keys.formID=e,this},e.prototype.setKey=function(e,t){return this.keys[e]=t,this},e.prototype.setCaseID=function(e){return this.caseID=e,this.keys.caseID=e,this},e.prototype.setView=function(e){return e instanceof Backbone.View&&(this.view=e),this},e.prototype.setDataViewDelay=function(e){var t=this;fomrData=this.unEscapeData(e),this.delayDataView=setTimeout(function(){t.view.setData2(fomrData)},2e3)},e.prototype.setOptionsToField=function(e,t){var n,i;for(options=e.attributes.options,splitData=t.value.split(","),i=0;options.length>i;i++)options[i].selected=!1;for(n=0;splitData.length>n;n++)for(i=0;options.length>i;i++)options[i].value==splitData[n]&&(options[i].selected=!0)},e.prototype.setProxy=function(e){this.keys=e,this.restClient=new PMDynaform.core.Proxy({method:"POST",keys:{processId:this.processID,workspace:this.workspace,token:this.tokens},server:this.server})},e.prototype.loadNewCase=function(){this.setUserAgent(),this.setIsCase(!1),this.formsHandler=new PMDynaform.core.FormsHandler,this.projectFlow="ios"==this.userAgent?new PMDynaform.core.ProjectFlowIOS:new PMDynaform.core.ProjectFlow,this.formsHandler.init(this,this.dynaforms,null,this.formID),this.projectFlow.setIsCase(!1),this.data&&this.formsHandler.setJsonFormIndexCurrent(this.data),this.dataForm&&(this.dataManager.addData(this.dataForm),this.dataManager.addDataLocal(this.dataForm)),this.projectFlow.setForms(this.dynaforms),this.projectFlow.initFlow(this,!0),this.projectFlow.initLoad({jsonForm:this.data}),adjustHeight(),this.initNavBar(),this.showNavBar()},e.prototype.loadCase=function(){this.setUserAgent(),this.setIsCase(!0),this.formsHandler=new PMDynaform.core.FormsHandler,this.projectFlow="ios"==this.userAgent?new PMDynaform.core.ProjectFlowIOS:new PMDynaform.core.ProjectFlow,this.formsHandler.init(this,this.dynaforms,null,this.formID),this.dataForm&&(this.dataManager.addData(this.dataForm),this.dataManager.addDataLocal(this.dataForm)),this.projectFlow.setIsCase(!0),this.formsHandler.setJsonFormIndexCurrent(this.data),this.projectFlow.setForms(this.dynaforms),this.projectFlow.initFlow(this,!0),this.projectFlow.initLoad({jsonForm:this.data}),this.initNavBar(),this.showNavBar()},e.prototype.getFormDefinition=function(){var e,t,n,i,a=this;return t=this.getFullEndPoint(this.endPointsPath.dynaformDefinition),n=this.getFullURL(t),e=new PMDynaform.core.Proxy({url:n,method:"GET",keys:this.token,successCallback:function(e,t){i={data:t.data.formContent,state:"success"}},failureCallback:function(e,t){a.failureResponse(t)}}),i},e.prototype.getJsonForm=function(e){var t,n,i,a,o=[];return this.setFormID(e),n=this.getFullEndPoint(this.endPointsPath.jsonDynaforms),o.push(e),i=this.getFullURL(n),t=new PMDynaform.core.Proxy({url:i,method:"POST",keys:this.token,data:{formId:o},successCallback:function(e,t){var n=null;0!=t.length&&(n=t[0].formContent),a={data:n,state:"success"}},failureCallback:function(){a={state:"internetFail"}}}),a},e.prototype.executeTrigger=function(e,t){var n,i,a,o;return this.setKey("stepID",e),this.setKey("triggerOption",t),i=this.getFullEndPoint(this.endPointsPath.executeTrigger),a=this.getFullURL(i),n=new PMDynaform.core.Proxy({url:a,method:"POST",keys:this.token,data:null,successCallback:function(){o={state:"success"}},failureCallback:function(){o={state:"internetFail"}}}),o},e.prototype.getFullEndPoint=function(e){var t,n=this.keys,i=e;for(t in n)n.hasOwnProperty(t)&&(i=i.replace(RegExp("{"+t+"}","g"),n[t]));return i},e.prototype.sendSubmitInformationDevice=function(){var e,t,n;t=this.model.attributes,e=this.getEscapeData(),n={json:t,data:e,accessToken:this.token.accessToken,refreshToken:this.token.refreshToken,formID:this.keys.formID},"formslider-android"===navigator.userAgent&&JsInterface.receiveFormData(JSON.stringify(n)),"formslider-ios"===navigator.userAgent&&this.executeFakeIOS("submit-nextform")},e.prototype.getCaseDataIOS=function(){var e,t,n;return t=this.model.attributes,e=this.getEscapeData(),n={json:t,data:e,accessToken:this.token.accessToken,refreshToken:this.token.refreshToken,formID:this.keys.formID},JSON.stringify(n)},e.prototype.sendDataForm=function(e){var t,n,i;n=this.model.attributes,t=e,i={json:n,data:t.fields,accessToken:this.token.accessToken,refreshToken:this.token.refreshToken,formID:this.keys.formID},"formslider-android"===navigator.userAgent&&JsInterface.receiveFormData(JSON.stringify(i))},e.prototype.getCaseInformation=function(){var e={};return e.caseID=this.caseID,e.caseTitle=this.caseTitle,e.ticketNumber=this.caseNumber,JSON.stringify(e)},e.prototype.getCaseData=function(){var e,t,n;t=this.model.attributes,e=this.getEscapeData(),n={json:t,data:e,accessToken:this.token.accessToken,refreshToken:this.token.refreshToken,formID:this.keys.formID},JsInterface.receiveFormData(JSON.stringify(n))},e.prototype.getFormDefinitionTypeList=function(){var e,t,n,i=this;t=this.getFullEndPoint(this.endPointsPath.caseTypeList),n=this.getFullURL(t),e=new PMDynaform.core.Proxy({url:n,method:"GET",keys:this.token,successCallback:function(e,t){return i.formID=t.data[0]._id,{data:t.data.formContent,state:"success"}},failureCallback:function(){}})},e.prototype.loadFormData=function(){var e,t,n,i;return t=this.getFullEndPoint(this.endPointsPath.getFormData),n=this.getFullURL(t),e=new PMDynaform.core.Proxy({url:n,method:"GET",keys:this.token,successCallback:function(e,t){i={state:"success",data:t.data}},failureCallback:function(){i={state:"internetFail"}}}),i},e.prototype.loadAllDataCase=function(){var e,t,n,i;return t=this.getFullEndPoint(this.endPointsPath.getAllDataCase),n=this.getFullURL(t),e=new PMDynaform.core.Proxy({url:n,method:"GET",keys:this.token,successCallback:function(e,t){i={state:"success",data:t}},failureCallback:function(){i={state:"internetFail"}}}),i},e.prototype.loadProject=function(e){var t,n=this;return t=null!=this.container?$("#"+this.container):$("#container"),this.model=new PMDynaform.model.Panel(e),this.view=new PMDynaform.view.Panel({tagName:"div",renderTo:t,model:this.model,project:this}),this.forms=this.view.getPanels(),this.createGlobalPmdynaformClass(this.view),this.createSelectors(),this.checkScript(),n.view.afterRender(),this.hideMaskLoading(),this},e.prototype.getRestClient=function(){return this.restClient},e.prototype.hideMaskLoading=function(){return $(".pmdynaform-mobile-loading").hide(),this},e.prototype.executeSubmit=function(e){this.blockButtonSubmit&&(this.projectFlow.submitStep({dataSubmit:e}),adjustHeight())},e.prototype.startCase=function(){var e,t,n,i,a=this;return t=a.getFullEndPoint(a.endPointsPath.startCase),n=a.getFullURL(t),e=new PMDynaform.core.Proxy({url:n,method:"POST",keys:a.token,data:{},successCallback:function(e,t){i={state:"success",caseID:t.caseId,caseTitle:t.caseNumber,caseNumber:t.caseNumber}},failureCallback:function(){i={state:"internetFail"}}}),this.caseFakeID=void 0,i},e.prototype.submitFormCase=function(e){var t,n,i,a,o=this;return n=o.getFullEndPoint(o.endPointsPath.submitFormCase),i=o.getFullURL(n),t=new PMDynaform.core.Proxy({url:i,method:"UPDATE",keys:o.token,data:e,successCallback:function(){a={state:"success"}},failureCallback:function(){a={state:"internetFail"}}}),a},e.prototype.routeCase=function(){var e,t,n,i,a=this;return t=a.getFullEndPoint(a.endPointsPath.routeCase),n=a.getFullURL(t),e=new PMDynaform.core.Proxy({url:n,method:"UPDATE",keys:a.token,data:{},successCallback:function(e,t){i={state:"success",data:t}},failureCallback:function(){i={state:"internetFail"}}}),i},e.prototype.refreshToken=function(){var e,t={},n=this;return t={grant_type:"refresh_token",refresh_token:this.token.refreshToken,access_token:this.token.accessToken},url=this.getFullURL(this.endPointsPath.refreshToken),e=new PMDynaform.core.Proxy({url:url,method:"POST",keys:this.token,data:t,successCallback:function(e,t){n.token.refreshToken=t.access_token},failureCallback:function(){console.log("Failure response resfres Token")}}),this},e.prototype.failureResponse=function(e){var t=this;return 401==e.error.code&&t.refreshToken(),this},e.prototype.emptyView=function(){return this.view.$el.remove(),this.viewfields=[],this.memoryStack=[],this},e.prototype.getFullURL=function(e){var t,n=this.keys,i=this.urlFormat;i=i.replace(/{endPointPath}/,e);for(t in n)n.hasOwnProperty(t)&&(i=i.replace(RegExp("{"+t+"}","g"),n[t]));return i},e.prototype.getFullURLStreaming=function(e){var t,n=this.keys,i=this.urlFormatStreaming;i=i.replace(/{endPointPath}/,e);for(t in n)n.hasOwnProperty(t)&&(i=i.replace(RegExp("{"+t+"}","g"),n[t]));return i},e.prototype.getToastMessageIOS=function(){return this.projectFlow.message},e.prototype.showNavBar=function(){var e,t,n=!1,i=!1;e=this.formsHandler.indexForms,t=this.dynaforms.length,e>0?(this.buttonPrev.show(),n=!0):(this.buttonPrev.hide(),n=!1),t-1>e?(this.buttonNext.show(),i=!0):(this.buttonNext.hide(),i=!1),i||n?$(this.navBar).show():$(this.navBar).hide()},e.prototype.initNavBar=function(){var e,t,n;return n=document.createElement("div"),n.style.cssText="float:right; margin:1%;",this.navBar=n,e=$("