text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Helpers=t():(e.RingCentral=e.RingCentral||{},e.RingCentral.Helpers=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){function r(){return A.country}function o(){return j.deviceModel}function i(){return _.language}function u(){return q.location}function a(){return V.shippingMethod}function s(){return D.state}function c(){return L.timezone}function p(){return I.account}function l(){return P.blockedNumber}function f(){return E.call}function d(){return C.conferencing}function h(){return O.contact}function y(){return N.contactGroup}function m(){return M.device}function g(){return T.extension}function v(){return U.forwardingNumber}function b(){return R.message}function x(){return z.phoneNumber}function F(){return H.presence}function S(){return B.ringout}function w(){return k.service}var I=n(2),P=n(5),E=n(7),O=n(11),N=n(12),C=n(13),A=n(14),M=n(15),j=n(16),T=n(10),U=n(17),_=n(18),q=n(19),R=n(21),z=n(22),H=n(9),B=n(23),k=n(24),V=n(25),D=n(20),L=n(26);t.version="0.1.0",t.country=r,t.deviceModel=o,t.language=i,t.location=u,t.shippingMethod=a,t.state=s,t.timezone=c,t.account=p,t.blockedNumber=l,t.call=f,t.conferencing=d,t.contact=h,t.contactGroup=y,t.device=m,t.extension=g,t.forwardingNumber=v,t.message=b,t.phoneNumber=x,t.presence=F,t.ringout=S,t.service=w},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(){return"/account/~"},t}(o.Helper);t.Account=i,t.account=new i},function(e,t,n){var r=n(4),o=function(){function e(){this.defaultProperty="id",this.getId=this.getId.bind(this)}return e.prototype.createUrl=function(e,t){return""},e.prototype.getId=function(e){return e&&e[this.defaultProperty]},e.prototype.isNew=function(e){return!this.getId(e)||!this.getUri(e)},e.prototype.resetAsNew=function(e){return e&&(delete e.id,delete e.uri),e},e.prototype.getUri=function(e){return e&&e.uri},e.prototype.parseMultipartResponse=function(e){return e.isMultipart()?e.data.filter(function(e){return!e.error}).map(function(e){return e.data}):[e.data]},e.prototype.loadRequest=function(e,t){return r.extend(t||{},{url:t&&t.url||e&&this.getUri(e)||this.createUrl(),method:t&&t.method||"GET"})},e.prototype.saveRequest=function(e,t){if(!(e||t&&(t.post||t.body)))throw new Error("No Object");return r.extend(t||{},{method:t&&t.method||(this.isNew(e)?"POST":"PUT"),url:t&&t.url||this.getUri(e)||this.createUrl(),body:t&&(t.body||t.post)||e})},e.prototype.deleteRequest=function(e,t){if(t=t||{},!(this.getUri(e)||t&&t.url))throw new Error("Object has to be not new or URL must be provided");return r.extend(t||{},{method:t&&t.method||"DELETE",url:t&&t.url||this.getUri(e)})},e.prototype.syncRequest=function(e){return e=e||{},e.url=e.url||this.createUrl({sync:!0}),e.query=e.query||e.get||{},e.query.syncToken?e.query={syncType:"ISync",syncToken:e.get.syncToken}:e.query.syncType="FSync",e},e.prototype.nextPageExists=function(e){return e&&e.navigation&&"nextPage"in e.navigation},e.prototype.index=function(e,t,n){return t=t||this.getId,e=e||[],e.reduce(function(e,r){var o=t(r);return!o||e[o]&&!n?e:(n?(e[o]||(e[o]=[]),e[o].push(r)):e[o]=r,e)},{})},e.prototype.merge=function(e,t,n,o){n=n||this.getId,e=e||[],t=t||[];var i=this.index(t,n),u=[],a=e.map(function(e){var t=n(e),a=i[t];return a&&u.push(t),a?o?r.extend(e,a):a:e});return t.forEach(function(e){-1==u.indexOf(n(e))&&a.push(e)}),a},e}();t.Helper=o},function(e,t){function n(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var i,u,a,s,c,f,d=arguments[0]||{},h=1,m=arguments.length,g=!1;for("boolean"==typeof d&&(g=d,d=arguments[h]||{},h++),"object"==typeof d||p(d)||(d={});m>h;h++)if(null!==(i=arguments[h]))for(u in i)a=d[u],s=i[u],d!==s&&(g&&s&&(y(s)||(c=l(s)))?(c?(c=!1,f=a&&l(a)?a:[]):f=a&&y(a)?a:{},d[u]=n(g,f,s)):void 0!==s&&(d[u]=s));return d}function r(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=t(e[n],n);if(r===!1)break}}function o(e){var t=[];return r(e,function(e,n){l(e)?e.forEach(function(e){t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}),t.join("&")}function i(e){var t={};return e.split("&").forEach(function(e){if(e=decodeURIComponent(e),-1==e.indexOf("="))t[e.trim()]=!0;else{var n=e.split("="),r=n[0].trim(),o=n[1].trim();r in t?(r in t&&!l(t[r])&&(t[r]=[t[r]]),t[r].push(o)):t[r]=o}}),t}function u(e,t){return t?/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?[ ,;]*)+$/i.test(e):/^[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(e)}function a(e){return/\+?1[0-9]{3}[0-9a-z]{7}/im.test(e.toString().split(/[^0-9a-z\+]/im).join(""))}function s(e){return Array.prototype.slice.call(e||[],0)}function c(e){return"date"===h(e)}function p(e){return"function"===h(e)}function l(e){return Array.isArray?Array.isArray(e):"array"===h(e)}function f(e){return e&&"object"==typeof e&&"setInterval"in e}function d(e){return null===e||!w.test(e)||isNaN(e)}function h(e){return null===e?String(e):I[S.call(e)]||"object"}function y(e){if(!e||"object"!==h(e)||e.nodeType||f(e))return!1;if(e.constructor&&!F.call(e,"constructor")&&!F.call(e.constructor.prototype,"isPrototypeOf"))return!1;var t;for(t in e);return void 0===t||F.call(e,t)}function m(e,t){return t.split(/[.[\]]/).reduce(function(e,t){return e?t?e[t]:e:void 0},e)}function g(e,t,n){v(n),t=t||1e3;var r=function(n){return n=n||t,t=n,setTimeout(function(){e(r,n)},n)};return r()}function v(e){e&&clearTimeout(e)}function b(e){return e?e.toString():""}function x(e){return e?(e=parseFloat(e),d(e)?0:e):0}var F=Object.prototype.hasOwnProperty,S=Object.prototype.toString,w=/\d/,I={};"Boolean Number String Function Array Date RegExp Object".split(" ").forEach(function(e){I["[object "+e+"]"]=e.toLowerCase()}),t.extend=n,t.forEach=r,t.queryStringify=o,t.parseQueryString=i,t.isEmail=u,t.isPhoneNumber=a,t.argumentsToArray=s,t.isDate=c,t.isFunction=p,t.isArray=l,t.isWindow=f,t.isNan=d,t.type=h,t.isPlainObject=y,t.getProperty=m,t.poll=g,t.stopPolling=v,t.parseString=b,t.parseNumber=x},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(6),u=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},"/account/~/extension/"+(e.extensionId?e.extensionId:"~")+"/blocked-number"+(t?"/"+t:"")},t.prototype.validate=function(e){return i.validate([{field:"phoneNumber",validator:i.phone(e.phoneNumber)},{field:"phoneNumber",validator:i.required(e.phoneNumber)},{field:"name",validator:i.required(e.name)}])},t}(o.Helper);t.BlockedNumber=u,t.blockedNumber=new u},function(e,t,n){function r(e){var t={errors:{},isValid:!0};return t.errors=e.reduce(function(e,n){var r=n.validator();return r.length>0&&(t.isValid=!1,e[n.field]=e[n.field]||[],e[n.field]=e[n.field].concat(r)),e},{}),t}function o(e,t){return function(){return e?s.isEmail(e,t)?[]:[new Error("Value has to be a valid email")]:[]}}function i(e){return function(){return e?s.isPhoneNumber(e)?[]:[new Error("Value has to be a valid US phone number")]:[]}}function u(e){return function(){return e?[]:[new Error("Field is required")]}}function a(e,t,n){return function(){var r=[];return e?(e=e.toString(),n&&e.length<n&&r.push(new Error("Minimum length of "+n+" characters is required")),t&&e.length>t&&r.push(new Error("Maximum length of "+t+" characters is required")),r):r}}var s=n(4);t.validate=r,t.email=o,t.phone=i,t.required=u,t.length=a},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(8),u=n(4),a=n(9),s=n(11),c=function(e){function t(){e.call(this),this.getSessionId=this.getSessionId.bind(this)}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},"personal"in e||"extensionId"in e||(e.personal=!0),"/account/~/"+(e.personal||e.extensionId?"extension/"+(e.extensionId||"~")+"/":"")+(e.active?"active-calls":"call-log")+(t?"/"+t:"")},t.prototype.getSessionId=function(e){return e&&e.sessionId},t.prototype.isInProgress=function(e){return e&&"In Progress"==e.result},t.prototype.isAlive=function(e){return e&&"Alive"==e.availability},t.prototype.isInbound=function(e){return e&&"Inbound"==e.direction},t.prototype.isOutbound=function(e){return!this.isInbound(e)},t.prototype.isMissed=function(e){return e&&"Missed"==e.result},t.prototype.isFindMe=function(e){return e&&"FindMe"==e.action},t.prototype.getCallerInfo=function(e){return this.isInbound(e)?e.from:e.to},t.prototype.getAllCallerInfos=function(e){return[this.getCallerInfo(e)].concat(this.isInbound(e)?e.to:e.from)},t.prototype.formatDuration=function(e){function t(e){return 10>e?"0"+e:e}var n=parseInt(e.duration),r=Math.floor(n/3600),o=Math.floor(n%3600/60),i=Math.floor(n%60);return(r?r+":":"")+t(o)+":"+t(i)},t.prototype.filter=function(e){return e=u.extend({alive:!0,direction:"",type:""},e),i.filter([{filterBy:"direction",condition:e.direction},{filterBy:"type",condition:e.type}])},t.prototype.comparator=function(e){return i.comparator(u.extend({sortBy:"startTime"},e))},t.prototype.attachContacts=function(e,t,n){var r=this,o=t.reduce(function(e,t){return e.concat(r.getAllCallerInfos(t))},[]);s.contact.attachToCallerInfos(o,e,n)},t.prototype.checkMergeability=function(e,t,n){var r=function(e){return new Date(e).getTime()};return(!n.strict||e.action&&-1!=e.action.toLowerCase().indexOf("ringout"))&&"Outbound"==e.direction&&"Inbound"==t.direction&&(!t.startTime&&!e.startTime||Math.abs(r(t.startTime)-r(e.startTime))<(n.maxStartTimeDiscrepancy||5e3))&&t.from.phoneNumber==e.to.phoneNumber&&(t.to.phoneNumber==e.from.phoneNumber||t.to.name==e.from.name)},t.prototype.combineCalls=function(e,t,n){n=n||{};var r=[];return e.hasSubsequent=!0,n.merge?(e.duration=e.duration>t.duration?e.duration:t.duration,e.from=t.to,e.to=t.from,r.push(e)):(t.subsequent=!0,t.startTime=e.startTime,r.push(e),r.push(t)),r},t.prototype.processCalls=function(e,t){var n=[],r=[],o=this;return e.forEach(function(i){var u=!1;i.subsequent=!1,i.hasSubsequent=!1,e.some(function(e){return i===e?!1:(o.checkMergeability(i,e,t)&&(n=n.concat(o.combineCalls(i,e,t)),r.push(i),r.push(e),u=!0),u)})}),e.forEach(function(e){-1==r.indexOf(e)&&n.push(e)}),n},t.prototype.parsePresenceCalls=function(e){return e.map(function(e){return{id:e.id,uri:"",sessionId:e.sessionId,from:{phoneNumber:e.from},to:{phoneNumber:e.to},direction:e.direction,startTime:"",duration:0,type:"",action:"",result:a.presence.isCallInProgress(e)?"In Progress":e.telephonyStatus,telephonyStatus:e.telephonyStatus}})},t.prototype.getSignature=function(e){var t=function(e){return(e||"").toString().replace(/[^0-9]/gi,"")};return e.direction+"|"+(e.from&&t(e.from.phoneNumber))+"|"+(e.to&&t(e.to.phoneNumber))},t.prototype.mergePresenceCalls=function(e,t){var n=new Date,r=this.parsePresenceCalls(t&&t.activeCalls||[]).map(function(e){return delete e.startTime,e});return e=this.merge(e||[],r,this.getSessionId,!0),e.forEach(function(e){e.startTime||(e.startTime=n.toISOString())}),e},t.prototype.mergeAll=function(e,t,n){var r=this.merge(e||[],t||[],this.getSessionId,!0);return this.merge(r,n||[],this.getSessionId,!0)},t}(o.Helper);t.Call=c,t.call=new c},function(e,t,n){function r(e){return function(t,n){return e?t&&t[e]||null:t}}function o(e,t,n){return l.parseString(e).localeCompare(l.parseString(t))}function i(e,t,n){return l.parseNumber(e)-l.parseNumber(t)}function u(e){return e=l.extend({extractFn:r(e&&e.sortBy||null).bind(this),compareFn:o.bind(this)},e),function(t,n){return e.compareFn(e.extractFn(t,e),e.extractFn(n,e),e)}}function a(e,t){return t.condition===e}function s(e,t){return e&&e.toString().indexOf(t.condition)>-1}function c(e,t){if(!(t.condition instanceof RegExp))throw new Error("Condition must be an instance of RegExp");return t.condition.test(e)}function p(e){var t=this,n=this;return e=(e||[]).map(function(e){return l.extend({condition:"",extractFn:n.propertyExtractor(e&&e.filterBy||null).bind(t),filterFn:n.equalsFilter.bind(t)},e)}),function(t){return e.reduce(function(e,n){return e&&n.condition?n.filterFn(n.extractFn(t,n),n):e},!0)}}var l=n(4);t.propertyExtractor=r,t.stringComparator=o,t.numberComparator=i,t.comparator=u,t.equalsFilter=a,t.containsFilter=s,t.regexpFilter=c,t.filter=p},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(4),i=n(3),u=n(10),a=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},"/account/~/extension/"+(t||"~")+"/presence"+(e.detailed?"?detailedTelephonyState=true":"")},t.prototype.getId=function(e){return e&&(u.extension.getId(e.extension)||e.extensionId)},t.prototype.isAvailable=function(e){return e&&"Available"==e.presenceStatus},t.prototype.addEventToSubscription=function(e,t,n){return e.setEventFilters([this.createUrl(t,n)])},t.prototype.updateSubscription=function(e,t,n){var r=this,o=t.map(this.getId,this).map(function(e){return r.createUrl(n,e)},this);return e.addEventFilters(o),e},t.prototype.attachToExtensions=function(e,t,n){var r=this.index(t);return e.forEach(function(e){var t=r[u.extension.getId(e)];t&&("presence"in e&&n?o.extend(e.presence,t):e.presence=t)},this),this},t.prototype.isCallInProgress=function(e){return e&&"NoCall"!=e.telephonyStatus},t}(i.Helper);t.Presence=a,t.presence=new a},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(8),u=n(4),a=function(e){function t(){e.apply(this,arguments),this.type={department:"Department",user:"User",announcement:"Announcement",voicemail:"Voicemail"}}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},"/account/~"+(e.departmentId?"/department/"+e.departmentId+"/members":"/extension")+(t?"/"+t:"")},t.prototype.isUser=function(e){return e&&e.type==this.type.user},t.prototype.isDepartment=function(e){return e&&e.type==this.type.department},t.prototype.isAnnouncement=function(e){return e&&e.type==this.type.announcement},t.prototype.isVoicemail=function(e){return e&&e.type==this.type.voicemail},t.prototype.comparator=function(e){return i.comparator(u.extend({sortBy:"extensionNumber",compareFn:i.numberComparator},e))},t.prototype.filter=function(e){return e=u.extend({search:"",type:""},e),i.filter([{filterBy:"type",condition:e.type},{condition:e.search.toLocaleLowerCase(),filterFn:i.containsFilter,extractFn:function(e){return(e.name&&e.name.toLocaleLowerCase()+" ")+(e.extensionNumber&&e.extensionNumber.toString().toLocaleLowerCase())}}])},t}(o.Helper);t.Extension=a,t.extension=new a},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(8),u=n(4),a=n(6),s=function(e){function t(){e.apply(this,arguments),this.phoneFields=["homePhone","homePhone2","businessPhone","businessPhone2","mobilePhone","companyPhone","assistantPhone","carPhone","otherPhone","callbackPhone"],this.faxFields=["businessFax","otherFax"],this.addressFields=["homeAddress","businessAddress","otherAddress"],this.addressSubFields=["street","city","state","zip"],this.nameFields=["firstName","middleName","lastName","nickName"],this.otherFields=["company","jobTitle","webPage","notes"],this.emailFields=["email","email2","email3"]}return r(t,e),t.prototype.createUrl=function(e,t){e=e||{};var n="/account/~/extension/"+(e.extensionId?e.extensionId:"~")+"/address-book";return e.sync?n+"-sync":n+(e.groupId?"/group/"+e.groupId+"/contact":"/contact")+(t?"/"+t:"")},t.prototype.getFieldValues=function(e,t,n){return t.reduce(function(t,r){return e&&e[r]&&(n?t[r]=e[r]:t.push(e[r])),t},n?{}:[])},t.prototype.getFullName=function(e){return this.getFieldValues(e,this.nameFields).join(" ")},t.prototype.getEmails=function(e,t){return this.getFieldValues(e,this.emailFields,t)},t.prototype.getPhones=function(e,t){return this.getFieldValues(e,this.phoneFields,t)},t.prototype.getFaxes=function(e,t){return this.getFieldValues(e,this.faxFields,t)},t.prototype.getAddresses=function(e,t){return this.getFieldValues(e,this.addressFields,t)},t.prototype.isAlive=function(e){return"Alive"==e.availability},t.prototype.match=function(e,t,n){var r=this;n=u.extend({fields:[].concat(this.nameFields,this.emailFields,this.phoneFields,this.faxFields,this.otherFields),inAddresses:!0,transformFn:function(e,t){return e?e.toString().toLocaleLowerCase():""},strict:!1},n),t=n.transformFn(t,n);var o=null;if(!t)return o;var i=function(e){if(!o){var r=n.transformFn(e,n);if(r){var i=n.strict?r==t:r.indexOf(t)>-1;i&&(o=e)}}};return n.fields.forEach(function(t){i(e[t])}),n.inAddresses&&!o&&this.addressFields.forEach(function(t){e[t]&&!o&&r.addressSubFields.forEach(function(n){i(e[t][n])})}),o},t.prototype.matchAsPhone=function(e,t,n){return this.match(e,t,u.extend({fields:[].concat(this.phoneFields,this.faxFields),inAddresses:!1,transformFn:function(e,t){return e?e.toString().replace(/[^\d\w]/gi,""):""},strict:!1},n))},t.prototype.attachToCallerInfos=function(e,t,n){var r=this,o=this.index(e,function(e){return e.phoneNumber},!0);u.forEach(o,function(e,o){var i=null,u=null;t.some(function(e){return u=r.matchAsPhone(e,o,n),u&&(i=e),u}),i&&e.forEach(function(e){e.contact=i,e.contactPhone=u})})},t.prototype.comparator=function(e){var t=this;return i.comparator(u.extend({extractFn:function(e,n){return t.getFullName(e)}},e))},t.prototype.filter=function(e){var t=this;return e=u.extend({alive:!0,startsWith:"",phonesOnly:!1,faxesOnly:!1},e),i.filter([{condition:e.alive,filterFn:this.isAlive},{condition:e.startsWith,filterFn:function(e,n){return t.match(e,n.condition)}},{condition:e.phonesOnly,filterFn:function(e,n){return t.getPhones(e).length>0}},{condition:e.faxesOnly,filterFn:function(e,n){return t.getFaxes(e).length>0}}])},t.prototype.validate=function(e){return a.validate([{field:"firstName",validator:a.required(e.firstName)},{field:"lastName",validator:a.required(e.lastName)},{field:"email",validator:a.email(e.email)},{field:"email2",validator:a.email(e.email2)},{field:"email3",validator:a.email(e.email3)}])},t}(o.Helper);t.Contact=s,t.contact=new s},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(6),u=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return"/account/~/extension/~/address-book/group"+(t?"/"+t:"")},t.prototype.validate=function(e){return i.validate([{field:"groupName",validator:i.required(e&&e.groupName)}])},t}(o.Helper);t.ContactGroup=u,t.contactGroup=new u},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(){return"/account/~/extension/~/conferencing"},t}(o.Helper);t.Conferencing=i,t.conferencing=new i},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return"/dictionary/country"},t}(o.Helper);t.Country=i,t.country=new i},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(6),u=n(10),a=n(16),s=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},e.order?"/account/~/order":"/account/~"+(e.extensionId?"/extension/"+e.extensionId:"")+"/device"+(t?"/"+t:"")},t.prototype.validate=function(e){return i.validate([{field:"emergencyServiceAddress-street",validator:i.required(e&&e.emergencyServiceAddress&&e.emergencyServiceAddress.street)},{field:"emergencyServiceAddress-city",validator:i.required(e&&e.emergencyServiceAddress&&e.emergencyServiceAddress.city)},{field:"emergencyServiceAddress-state",validator:i.required(e&&e.emergencyServiceAddress&&e.emergencyServiceAddress.state)},{field:"emergencyServiceAddress-country",validator:i.required(e&&e.emergencyServiceAddress&&e.emergencyServiceAddress.country)},{field:"emergencyServiceAddress-zip",validator:i.required(e&&e.emergencyServiceAddress&&e.emergencyServiceAddress.zip)},{field:"emergencyServiceAddress-customerName",validator:i.required(e&&e.emergencyServiceAddress&&e.emergencyServiceAddress.customerName)},{field:"extension",validator:i.required(u.extension.getId(e&&e.extension))},{field:"model",validator:i.required(a.deviceModel.getId(e&&e.model))}])},t}(o.Helper);t.Device=s,t.device=new s},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.getId=function(e){return e?e.sku:null},t.prototype.createUrl=function(e,t){return"/dictionary/device"},t}(o.Helper);t.DeviceModel=i,t.deviceModel=new i},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(8),u=n(4),a=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},"/account/~/extension/"+(e.extensionId||"~")+"/forwarding-number"+(t?"/"+t:"")},t.prototype.getId=function(e){return e&&(e.id||e.phoneNumber)},t.prototype.hasFeature=function(e,t){return!!e&&!!e.features&&-1!=e.features.indexOf(t)},t.prototype.comparator=function(e){return i.comparator(u.extend({sortBy:"label"},e))},t.prototype.filter=function(e){var t=this;return e=u.extend({features:[]},e),i.filter([{condition:e.features.length,filterFn:function(n){return e.features.some(function(e){return t.hasFeature(n,e)})}}])},t}(o.Helper);t.ForwardingNumber=a,t.forwardingNumber=new a},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return"/dictionary/language"},t}(o.Helper);t.Language=i,t.language=new i},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(8),u=n(4),a=n(20),s=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(){return"/dictionary/location"},t.prototype.filter=function(e){var t=[];return e=u.extend({stateId:"",onlyUniqueNPA:!1},e),i.filter([{condition:e.stateId,filterFn:function(e,t){return a.state.getId(e.state)==t.condition}},{condition:e.onlyUniqueNPA,filterFn:function(e,n){return-1==t.indexOf(e.npa)?(t.push(e.npa),!0):!1}}])},t.prototype.comparator=function(e){return e=u.extend({sortBy:"npa"},e),"nxx"==e.sortBy&&(e.extractFn=function(e){return 1e6*parseInt(e.npa)+parseInt(e.nxx)},e.compareFn=i.numberComparator),i.comparator(e)},t}(o.Helper);t.Location=s,t.location=new s},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(4),u=n(8),a=n(14),s=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(){return"/dictionary/state"},t.prototype.filter=function(e){return e=i.extend({countryId:""},e),u.filter([{condition:e.countryId,filterFn:function(e,t){return a.country.getId(e.country)==t.condition}}])},t}(o.Helper);t.State=s,t.state=new s},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(8),u=n(4),a=n(6),s=n(11),c=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){e=e||{};var n="/account/~/extension/"+(e.extensionId||"~");return e.fax?n+"/fax":e.sms?n+"/sms":e.pager?n+"/company-pager":e.sync?n+"/message-sync":n+"/message-store"+(t?"/"+t:"")},t.prototype.isInbound=function(e){return e&&"Inbound"==e.direction},t.prototype.isOutbound=function(e){return!this.isInbound(e)},t.prototype.isSMS=function(e){return e&&"SMS"==e.type},t.prototype.isPager=function(e){return e&&"Pager"==e.type},t.prototype.isVoiceMail=function(e){return e&&"VoiceMail"==e.type},t.prototype.isFax=function(e){return e&&"Fax"==e.type},t.prototype.isAlive=function(e){return e&&"Alive"==e.availability},t.prototype.isRead=function(e){return"Read"==e.readStatus},t.prototype.setIsRead=function(e,t){return e.readStatus=t?"Read":"Unread",e},t.prototype.getAttachmentContentType=function(e,t){return e.attachments[t]?e.attachments[t].contentType:""},t.prototype.addEventToSubscription=function(e,t){return e.setEventFilters([this.createUrl(t)])},t.prototype.getCallerInfos=function(e){return this.isInbound(e)?[e.from]:e.to},t.prototype.getAllCallerInfos=function(e){return this.getCallerInfos(e).concat(this.isInbound(e)?e.to:[e.from])},t.prototype.comparator=function(e){return i.comparator(u.extend({sortBy:"creationTime"},e))},t.prototype.filter=function(e){return e=u.extend({search:"",alive:!0,direction:"",conversationId:"",readStatus:""},e),i.filter([{condition:e.alive,filterFn:this.isAlive},{filterBy:"type",condition:e.type},{filterBy:"direction",condition:e.direction},{filterBy:"conversationId",condition:e.conversationId},{filterBy:"readStatus",condition:e.readStatus},{filterBy:"subject",condition:e.search,filterFn:i.containsFilter}])},t.prototype.attachContacts=function(e,t,n){var r=this,o=t.reduce(function(e,t){return e.concat(r.getAllCallerInfos(t))},[]);s.contact.attachToCallerInfos(o,e,n)},t.prototype.shorten=function(e){return{from:e.from,to:e.to,text:e.subject}},t.prototype.validateSMS=function(e){return a.validate([{field:"to",validator:a.required(u.getProperty(e,"to[0].phoneNumber"))},{field:"from",validator:a.required(u.getProperty(e,"from.phoneNumber"))},{field:"subject",validator:a.required(u.getProperty(e,"subject"))},{field:"subject",validator:a.length(u.getProperty(e,"subject"),160)}])},t.prototype.validatePager=function(e){return a.validate([{field:"to",validator:a.required(u.getProperty(e,"to.extensionNumber"))},{field:"from",validator:a.required(u.getProperty(e,"from.extensionNumber"))},{field:"subject",validator:a.required(u.getProperty(e,"subject"))},{field:"subject",validator:a.length(u.getProperty(e,"subject"),160)}])},t}(o.Helper);t.Message=c,t.message=new c},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(8),u=n(4),a=function(e){function t(){e.apply(this,arguments),this.tollFreeAreaCodes=["800","844","855","866","877","888"]}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},e.lookup?"/number-pool/lookup":"/account/~"+(e.extensionId?"/extension/"+e.extensionId:"")+"/phone-number"+(t?"/"+t:"")},t.prototype.isSMS=function(e){return this.hasFeature(e,"SmsSender")},t.prototype.hasFeature=function(e,t){return!!e.features&&-1!=e.features.indexOf(t)},t.prototype.reserve=function(e,t){e.reservedTill=new Date(t).toISOString()},t.prototype.unreserve=function(e){e.reservedTill=null},t.prototype.comparator=function(e){return i.comparator(u.extend({extractFn:function(e){return e.usageType+"-"+e.paymentType+"-"+e.type}},e))},t.prototype.filter=function(e){var t=this;return e=u.extend({usageType:"",paymentType:"",type:"",features:[]},e),i.filter([{filterBy:"usageType",condition:e.usageType},{filterBy:"paymentType",condition:e.paymentType},{filterBy:"type",condition:e.type},{condition:e.features.length,filterFn:function(n){return e.features.some(function(e){return t.hasFeature(n,e)})}}])},t}(o.Helper);t.PhoneNumber=a,t.phoneNumber=new a},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=n(6),u=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(e,t){return e=e||{},"/account/~/extension/"+(e.extensionId||"~")+"/ringout"+(t?"/"+t:"")},t.prototype.resetAsNew=function(t){return t=e.prototype.resetAsNew.call(this,t),t&&delete t.status,t},t.prototype.isInProgress=function(e){return e&&!this.isNew(e)&&e.status&&"InProgress"==e.status.callStatus},t.prototype.isSuccess=function(e){return e&&!this.isNew(e)&&e.status&&"Success"==e.status.callStatus},t.prototype.isError=function(e){return!this.isNew(e)&&!this.isInProgress(e)&&!this.isSuccess(e)},t.prototype.validate=function(e){return i.validate([{field:"to",validator:i.required(e&&e.to&&e.to.phoneNumber)},{field:"from",validator:i.required(e&&e.from&&e.from.phoneNumber)}])},t}(o.Helper);t.Ringout=u,t.ringout=new u},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments),this.isSmsEnabled=this.isServiceFeatureEnabledMethod("SMS"),this.isSmsReceivingEnabled=this.isServiceFeatureEnabledMethod("SMSReceiving"),this.isPresenceEnabled=this.isServiceFeatureEnabledMethod("Presence"),this.isRingOutEnabled=this.isServiceFeatureEnabledMethod("RingOut"),this.isInternationalCallingEnabled=this.isServiceFeatureEnabledMethod("InternationalCalling"),this.isDndEnabled=this.isServiceFeatureEnabledMethod("DND"),this.isFaxEnabled=this.isServiceFeatureEnabledMethod("Fax"),this.isFaxReceivingEnabled=this.isServiceFeatureEnabledMethod("FaxReceiving"),this.isVoicemailEnabled=this.isServiceFeatureEnabledMethod("Voicemail"),this.isPagerEnabled=this.isServiceFeatureEnabledMethod("Pager"),this.isPagerReceivingEnabled=this.isServiceFeatureEnabledMethod("PagerReceiving"),this.isVoipCallingEnabled=this.isServiceFeatureEnabledMethod("VoipCalling"),this.isVideoConferencingEnabled=this.isServiceFeatureEnabledMethod("VideoConferencing"),this.isSalesForceEnabled=this.isServiceFeatureEnabledMethod("SalesForce"),
  this.isIntercomEnabled=this.isServiceFeatureEnabledMethod("Intercom"),this.isPagingEnabled=this.isServiceFeatureEnabledMethod("Paging"),this.isConferencingEnabled=this.isServiceFeatureEnabledMethod("Conferencing"),this.isFreeSoftPhoneLinesEnabled=this.isServiceFeatureEnabledMethod("FreeSoftPhoneLines"),this.isHipaaComplianceEnabled=this.isServiceFeatureEnabledMethod("HipaaCompliance"),this.isCallParkEnabled=this.isServiceFeatureEnabledMethod("CallPark"),this.isOnDemandCallRecordingEnabled=this.isServiceFeatureEnabledMethod("OnDemandCallRecording")}return r(t,e),t.prototype.createUrl=function(){return"/account/~/service-info"},t.prototype.isEnabled=function(e,t){return t.reduce(function(t,n){return n.featureName==e&&(t=n.enabled),t},!1)},t.prototype.isServiceFeatureEnabledMethod=function(e){var t=this;return function(n){return t.isEnabled(e,n)}},t}(o.Helper);t.Service=i,t.service=new i},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(){return"/dictionary/shipping-options"},t}(o.Helper);t.ShippingMethod=i,t.shippingMethod=new i},function(e,t,n){var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=n(3),i=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.createUrl=function(){return"/dictionary/timezone"},t}(o.Helper);t.Timezone=i,t.timezone=new i}])});
  //# sourceMappingURL=ringcentral-helpers.min.js.map
  