//>>built
require({cache:{"url:mill/jssupport/form/phoneWidget.html":'\x3cdiv\x3e\x3cinput type\x3d"hidden" data-dojo-attach-point\x3d"focusNode"/\x3e\x3cdiv style\x3d"display:inline-flex;width:100%"\x3e\x3cdiv data-dojo-type\x3d"dijit.form.FilteringSelect" data-dojo-props\x3d"intermediateChanges: true, required: false" data-dojo-attach-point\x3d"countryCodeWidget" style\x3d"width:7em"\x3e\x3c/div\x3e\x3cdiv data-dojo-type\x3d"dijit.form.ValidationTextBox" data-dojo-props\x3d"intermediateChanges: true, required: false" data-dojo-attach-point\x3d"phoneNumberWidget" style\x3d"width:100%;margin-left:.5em"\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e'}});
define("mill/jssupport/form/PhoneWidget","dojo/_base/declare dojo/_base/array dojo/store/Memory dojo/dom-construct dojo/dom-style dojo/on dijit/form/_FormWidget dijit/_WidgetsInTemplateMixin mill/jssupport/_TranslationMixin dojo/text!mill/jssupport/form/phoneWidget.html mill/jssupport/base".split(" "),function(f,g,h,d,e,k,l,m,n,p,c){return mill.registerAlias("office.form.PhoneWidget",f("mill.jssupport.form.PhoneWidget",[l,m,n],{templateString:p,store:null,_savedValue:null,_savedValueNode:null,countryCodeWidget:null,
phoneNumberWidget:null,_setStoreAttr:function(){return function(a){this.store=a;this.countryCodeWidget.set("store",this.store)}}(),_getValueAttr:function(){var a=[];this.countryCodeWidget.validate()&&a.push(this.countryCodeWidget.get("displayedValue"));this.phoneNumberWidget.get("value")&&a.push(this.phoneNumberWidget.get("value"));return a.join(" ")},_setValueAttr:function(a){a=(a||"").split(";");this.value=a[a.length-1].replace(/^\s/,"");this.countryCodeWidget.set("value",this.value.split(/\s/)[0]);
this.phoneNumberWidget.set("value",this.value)},_setDisabledAttr:function(a){this.disabled=a;this.countryCodeWidget&&this.countryCodeWidget.set("disabled",a);this.phoneNumberWidget&&this.phoneNumberWidget.set("disabled",a)},_setRequiredAttr:function(a){this.required=a;this.countryCodeWidget.set("required",this.required);this.phoneNumberWidget.set("required",this.required)},_getLabelIdent:function(){return"RU"===c.locale.toUpperCase()?"PhoneCodeDesc":"PhoneCodeEngDesc"},_setFetchProperties:function(){this.countryCodeWidget.set("fetchProperties",
{sort:[{attribute:"RU"===c.locale.toUpperCase()?"Name":"EngDescription",descending:!1}]})},_onChangeHandler:function(){var a=this.countryCodeWidget.get("item")?this.countryCodeWidget.get("displayedValue"):"",b=this.phoneNumberWidget.get("value");if(a)this.phoneNumberWidget.set("value",b.replace(a,""));else if(a=b.match(/\+\d+\s/))a=a[0].replace(/\s/,""),(a=this.countryCodeWidget.store.query({PhoneCode:a})[0])&&this.countryCodeWidget.set("item",a);this.phoneNumberWidget.set("required",this.required||
this.countryCodeWidget.get("value"));this.countryCodeWidget.set("required",this.required||this.phoneNumberWidget.get("value"))},_connectOnChangeHandler:function(){g.forEach([this.countryCodeWidget,this.phoneNumberWidget],function(a){a.watch("value",function(b,r,q){this._onChangeHandler(q)}.bind(this))},this)},startup:function(){this.inherited(arguments);c.countryPhoneCodeData&&this.countryCodeWidget.set("store",new h({data:c.countryPhoneCodeData}));this._setFetchProperties();this._connectOnChangeHandler();
this.countryCodeWidget.set("labelAttr",this._getLabelIdent());this.countryCodeWidget.set("searchAttr","PhoneCode");k(this.phoneNumberWidget.textbox,"input",function(){var a=this.phoneNumberWidget.get("value"),b=a.replace(/[^0-9]/g,"");b!==a&&this.phoneNumberWidget.set("value",b)}.bind(this))},translate:function(){this.inherited(arguments);this.countryCodeWidget.set("labelAttr",this._getLabelIdent());this._setFetchProperties()},validate:function(){var a=!0;dojo.forEach([this.countryCodeWidget,this.phoneNumberWidget],
function(b){b._hasBeenBlurred=!0;b.disabled||!b.validate||b.validate()||(a=!1)});return this.countryCodeWidget.get("value")&&!this.phoneNumberWidget.get("value")?(this.phoneNumberWidget.focus(),!1):!this.countryCodeWidget.get("value")&&this.phoneNumberWidget.get("value")?(this.countryCodeWidget.focus(),!1):a},hideForValue:function(a){e.set(this.domNode,{display:"none"});"string"===typeof a&&(this._savedValue=a);d.destroy(this._savedValueNode);this._savedValueNode=d.create("span",{innerHTML:a||this._savedValue||
"",className:"dim bold"},this.domNode.parentNode,"first")},unhideForValue:function(){this.phoneNumberWidget.set("value",this._savedValue||"");d.destroy(this._savedValueNode);this._savedValueNode=null;e.set(this.domNode,{display:"block"})}}))});