PageSourceSearch

https://www.unionmart.ru/bitrix/js/location/core/dist/core.bundle.min.js?178829193529102

js unionmart.ru collected 2026-10-01 12:34:20 UTC 29,102 bytes, 2 lines download raw bytes

1this.BX=this.BX||{};this.BX.Location=this.BX.Location||{};(function(e,t,s,r,i){"use strict";class n{#e;constructor(e){if(typeof e.type==="undefined"){throw new Error("Field type must be defined")}this.#e=parseInt(e.type)}get type(){return this.#e}}class o{#t={};constructor(e={}){this.fields=e.fields?e.fields:[]}set fields(e){if(!Array.isArray(e)){throw new Error("Items must be array!")}for(const t of e){this.setField(t)}return this}get fields(){return this.#t}isFieldExists(e){return typeof this.#t[e]!=="undefined"}getField(e){return this.isFieldExists(e)?this.#t[e]:null}setField(e){if(!(e instanceof n)){throw new Error("Argument field must be instance of Field!")}this.#t[e.type]=e;return this}deleteField(e){if(this.isFieldExists(e)){delete this.#t[e]}}getMaxFieldType(){const e=Object.keys(this.#t).sort(((e,t)=>parseInt(e)-parseInt(t)));let t=0;if(e.length>0){t=e[e.length-1]}return t}isEqual(e,t){return o.areEqual(this,e,t)&&o.areEqual(e,this,t)}static areEqual(e,t,s){for(let r in e.fields){if(r>s){continue}let i=t.getField(r);if(!i){return false}if(e.fields[r].value!==i.value){return false}}return true}}class l extends n{#s;constructor(e){super(e);this.#s=e.value||""}get value(){return this.#s}set value(e){this.#s=e;return this}}class a extends o{getFieldValue(e){let t=null;if(this.isFieldExists(e)){const s=this.getField(e);if(s){t=s.value}}return t}setFieldValue(e,t){this.setField(new l({type:e,value:t}));return this}}class d{#r;#i;constructor(e){this.#r=e.entityId;this.#i=e.entityType}get entityId(){return this.#r}get entityType(){return this.#i}}class c{#n=[];constructor(e={}){this.links=!!e.links?e.links:[]}set links(e){if(!Array.isArray(e)){throw new Error("links must be array!")}for(let t of e){this.addLink(t)}}get links(){return this.#n}addLink(e){if(!(e instanceof d)){throw new Error("Argument link must be instance of Field!")}this.#n.push(e)}clearLinks(){this.#n=[]}}class u extends n{#o;#l;#a;constructor(e){super(e);this.#o=parseInt(e.sort);this.#l=e.name||"";this.#a=e.description||""}get sort(){return this.#o}set sort(e){this.#o=e}get name(){return this.#l}set name(e){this.#l=e}get description(){return this.#a}set description(e){this.#a=e}}class h extends o{initFields(e){if(Array.isArray(e)){e.forEach((e=>{const t=new u(e);if(t){this.setField(t)}}))}}}class p{static UNKNOWN=0;static COUNTRY=100;static ADM_LEVEL_1=200;static ADM_LEVEL_2=210;static ADM_LEVEL_3=220;static ADM_LEVEL_4=230;static LOCALITY=300;static SUB_LOCALITY=310;static SUB_LOCALITY_LEVEL_1=320;static SUB_LOCALITY_LEVEL_2=330;static STREET=340;static BUILDING=400;static ADDRESS_LINE_1=410;static FLOOR=420;static ROOM=430;static TMP_TYPE_HINT=5010;static TMP_TYPE_CLARIFICATION=5020}class f extends p{static POSTAL_CODE=50;static ADDRESS_LINE_2=600;static RECIPIENT_COMPANY=700;static RECIPIENT=710;static PO_BOX=800}class E{constructor(e,t){this.type=e;this.template=t}}class g{#d={};constructor(e){for(const t in e){if(e.hasOwnProperty(t)){this.setTemplate(new E(t,e[t]))}}}isTemplateExists(e){return typeof this.#d[e]!=="undefined"}getTemplate(e){return this.isTemplateExists(e)?this.#d[e]:null}setTemplate(e){if(!(e instanceof E)){throw new Error("Argument template must be instance of FormatTemplate!")}this.#d[e.type]=e}}class m{static DEFAULT="DEFAULT";static AUTOCOMPLETE="AUTOCOMPLETE";static ADDRESS_LINE_1="ADDRESS_LINE_1"}class T{constructor(e){if(t.Type.isUndefined(e.languageId)){throw new TypeError("LanguageId must be defined")}this.languageId=e.languageId;this.code=e.code||"";this.name=e.name||"";this.templateAutocomplete=e.templateAutocomplete||"";this.templateAddressLine1=e.templateAddressLine1||"";this.description=e.description||"";this.delimiter=e.delimiter||", ";this.fieldForUnRecognized=e.fieldForUnRecognized||f.UNKNOWN;this.fieldCollection=new h;if(t.Type.isObject(e.fieldCollection)){this.fieldCollection.initFields(e.fieldCollection)}let s={};if(t.Type.isObject(e.templateCollection)){s=e.templateCollection}this.templateCollection=new g(s)}getField(e){return this.fieldCollection.getField(e)}isFieldExists(e){return this.fieldCollection.isFieldExists(e)}getTemplate(e=m.DEFAULT){return this.templateCollection.getTemplate(e)}isTemplateExists(e){return this.templateCollection.isTemplateExists(e)}get template(){return this.templateCollection.getTemplate()}}const y="#S#";const _="\\s*,\\s*";const A='(\\"([^"\\\\]*|\\\\"|\\\\\\\\|\\\\)*")';const L=A;const w="([a-zA-Z][a-zA-Z_0-9]*(:(NU|UN|N|U))?)";const C="\\s*\\]";const I=C;const R="\\s*,\\s*\\[\\s*";
1const S='(([^\\[\\\\]|\\\\\\[|\\\\\\\\)*)(\\[\\s*)("([^"\\\\]*|\\\\"|\\\\\\\\|\\\\)*")\\s*,\\s*\\[\\s*';const x=1100;const b=1110;const F=1120;const M=1130;const P=1140;const O=1150;const v=1160;const N=1170;const B=1180;const D=1190;const k=1200;const Y=1210;class G{#c="";#u="";#h=false;#p=null;constructor(e,t,s,r=null){this.#c=e;this.#u=t;this.#h=s;this.#p=r}getErrorCodes(){let e={};e[x]="ERR_PARSE_GROUP_START_POSITION";e[b]="ERR_PARSE_GROUP_START";e[F]="ERR_PARSE_GROUP_DELIMITER";e[M]="ERR_PARSE_PART_FROM_DELIMITER_TO_FIELD_LIST";e[P]="ERR_PARSE_GROUP_FIELD_TEXT";e[O]="ERR_PARSE_GROUP_FIELD_NAME";e[v]="ERR_PARSE_GROUP_FIELD";e[N]="ERR_PARSE_GROUP_FIELD_LIST";e[B]="ERR_PARSE_GROUP_FIELD_LIST_DELIMITER";e[D]="ERR_PARSE_GROUP_FIELD_LIST_END";e[k]="ERR_PARSE_GROUP_END";e[Y]="ERR_PARSE_GROUP";return e}getErrorsText(e){let s="";const r=this.getErrorCodes();const i=e["error"]["errors"];for(let e=0;e<i.length;e++){s+=`Error: ${i[e]["position"]}, ${r[i[e]["code"]]}\n`;if(i[e].hasOwnProperty("info")&&t.Type.isPlainObject(i[e]["info"])){const r=i[e]["info"];let n=true;for(let e in r){if(r.hasOwnProperty(e)){let i=r[e];let o=false;if(t.Type.isString(i)){i=`"${i}"`;o=true}else if(t.Type.isNumber(i)||t.Type.isFloat(i)){o=true}else if(t.Type.isBoolean(i)){i=i?"true":"false";o=true}else if(t.Type.isArray(i)){i="[...]";o=true}else if(t.Type.isObject(i)){i="{...}";o=true}if(o){if(n){s+="  Error info:\n";n=false}s+=`    ${e}: ${i}\n`}}}}}let n=e["template"].replace("\n","\\n");n=n.replace('"','\\"');s+=`Template: "${n}"\n\n`;return s}createContext(){return{level:0,position:0,template:"",address:null,info:{},hasError:false,error:{code:0,position:0,errors:[],info:{}}}}clearContextInfo(e){e["info"]={};return e}clearContextError(e){e["hasError"]=false;e["error"]={code:0,position:0,errors:[],info:{}};return e}clearContextInfoAndError(e){return this.clearContextError(this.clearContextInfo(e))}unescapeText(e){let t="";let s;for(s=0;s<e.length;s++){if(e[s]==="\\"){if(e.length-s>1){t+=e[++s]}}else{t+=e[s]}}return t}parseGroupDelimiter(e){const t=e["position"];const s=new RegExp(A,"mg");s.lastIndex=t;const r=s.exec(e["template"]);if(r&&r.index===t){e["info"]={position:t,end:t+r[0].length,value:this.unescapeText(e["template"].substr(t+1,r[0].length-2))};e["position"]=e["info"]["end"]}else{this.addContextError(e,F,t)}return e}parseFieldText(e){const t=e["position"];const s=new RegExp(L,"mg");s.lastIndex=t;const r=s.exec(e["template"]);if(r&&r.index===t){e["info"]={type:"text",position:t,end:t+r[0].length,value:this.unescapeText(e["template"].substr(t+1,r[0].length-2))};e["position"]=e["info"]["end"]}else{this.addContextError(e,P,t)}return e}splitFieldName(e){const t=e.split(":");const s=t[0];const r=t.length>1?t[1]:"";return[s,r]}#f(e){return this.#p&&this.#p.getTemplate(e)!==null}#E(e,t){if(!this.#f(e)){return null}const s=this.#p.getTemplate(e).template;const r=new G(s,this.#u,this.#h,this.#p);return r.convert(t)}#g(e,s){let r=e.getFieldValue(f.LOCALITY);r=t.Type.isString(r)?r:"";let i=e.getFieldValue(s);if(!t.Type.isString(i)){i=""}if(i!==""&&r!==""){const e=r.toUpperCase();const t=i.toUpperCase();if(t.length>=e.length){const s=t.substr(t.length-e.length);if(e===s){i=""}}}return i}getAddressFieldValue(e,s,r){let i="";if(!t.Type.isUndefined(f[s])){if(s==="ADM_LEVEL_1"||s==="ADM_LEVEL_2"){i=this.#g(e,f[s])}else{i=e.getFieldValue(f[s])}if(i===null){i=this.#E(s,e)}}if(!t.Type.isString(i)){i=""}if(i!==""){if(r.indexOf("N")>=0){i=i.replace(/(\r\n|\n|\r)/g,"#S#")}if(r.indexOf("U")>=0){i=i.toUpperCase()}}return i}parseFieldName(e){const t=e["position"];const s=new RegExp(w,"mg");s.lastIndex=t;const r=s.exec(e["template"]);if(r&&r.index===t){e["position"]=t+r[0].length;const s=this.splitFieldName(r[0]);const i=s[0];const n=s[1];const o=this.getAddressFieldValue(e["address"],i,n);e["info"]={type:"field",position:t,end:e["position"],modifiers:n,name:i,value:o}}else{this.addContextError(e,O,t)}return e}parseFieldListDelimiter(e){const t=e["position"];const s=new RegExp(_,"mg");s.lastIndex=t;const r=s.exec(e["template"]);if(r&&r.index===t){e["position"]=t+r[0].length}else{this.addContextError(e,B,t)}return e}parseFieldListEnd(e){const t=e["position"];const s=new RegExp(C,"mg");s.lastIndex=t;const r=s.exec(e["template"]);if(r&&r.index===t){e["position"]=t+r[0].length}else{this.addContextError(e,D,t)}return e}parseField(e){let t=[];const s=e["position"];const r=[];e=this.parseFieldText(e);if(e["hasError"]){this.unshiftError(r,e["error"]["code"],e["error"]["position"]);e=this.clearContextInfoAndError(e);e=this.parseFieldName(e)}if(e["hasError"]){this.unshiftError(r,e["error"]["code"],e["error"]["position"]);e=this.clearContextInfoAndError(e);e=this.parseGroup(e);if(e["hasError"]){this.unshiftError(r,e["error"]["code"],e["error"]["position"])}else if(e["info"]["position"]>s){this.addContextError(e,x,s);this.unshiftError(r,e["error"]["code"],e["error"]["position"])}}if(!e["hasError"]){t=e["info"];t["isFieldListEnd"]=false;e=this.clearContextInfo(e);e=this.parseFieldListDelimiter(e);if(e["hasError"]){this.unshiftError(r,e["error"]["code"],e["error"]["position"]);e=this.clearContextInfoAndError(e);e=this.parseFieldListEnd(e);if(e["hasError"]){this.unshiftError(r,e["error"]["code"],e["error"]["position"])}else{t["isFieldListEnd"]=true}}}if(e["hasError"]){this.unshiftError(r,v,s);this.addContextErrors(e,r)}else{e["info"]=t}return e}parseGroupFieldList(e){const t=e["position"];const s=[];const r=new RegExp(R,"mg");r.lastIndex=t;const i=r.exec(e["template"]);if(i&&i.index===t){e["position"]=t+i[0].length;let r=false;while(!(e["hasError"]||r)){e=this.parseField(e);if(!e["hasError"]){r=e["info"].hasOwnProperty("isFieldListEnd")&&e["info"]["isFieldListEnd"];if(e["info"]["value"]!==""){s.push(e["info"]["value"])}e=this.clearContextInfo(e)}}if(!e["hasError"]){e["info"]={fieldValues:s}}}else{this.addContextError(e,M,t)}if(e["hasError"]){this.addContextError(e,N,t)}return e}parseGroupStart(e){const t=new RegExp(S,"mg");t.lastIndex=e["position"];const s=t.exec(e["template"]);
1if(s){e["info"]["groupStartPosition"]=s.index+s[1].length;e["info"]["groupDelimiterStartPosition"]=s.index+s[1].length+s[3].length}else{this.addContextError(e,b,e["position"])}return e}parseGroupEnd(e){const t=e["position"];const s=new RegExp(I,"mg");s.lastIndex=t;const r=s.exec(e["template"]);if(r&&r.index===t){e["position"]=t+r[0].length}else{this.addContextError(e,k,t)}return e}parseGroup(e){const t=e["position"];let s=0;let r="";let i=[];e["level"]++;e=this.parseGroupStart(e);if(!e["hasError"]){s=e["info"]["groupStartPosition"];e["position"]=e["info"]["groupDelimiterStartPosition"];e=this.clearContextInfo(e);e=this.parseGroupDelimiter(e)}if(!e["hasError"]){r=e["info"]["value"];e=this.clearContextInfo(e);e=this.parseGroupFieldList(e)}if(!e["hasError"]){i=e["info"]["fieldValues"];e=this.clearContextInfo(e);e=this.parseGroupEnd(e)}if(!e["hasError"]){i=[...new Set(i)];let t=i.join(r);const n=new RegExp(`(${r}){2,}`,"gim");t=t.replace(new RegExp(n),r);e["info"]={type:"group",position:s,end:e["position"],value:t}}e["level"]--;if(e["hasError"]){this.addContextError(e,Y,t,{groupStartPosition:s})}return e}appendTextBlock(e,t,s){let r=e.length-1;let i=r>=0?e[r]:null;if(i&&i.hasOwnProperty("type")&&i["type"]==="text"){e[r]["value"]+=s;e[r]["length"]+=s.length}else{e[++r]={type:"text",position:t,length:s.length,value:s}}}appendGroupBlock(e,t,s){e.push({type:"group",position:t,length:s.length,value:s})}unshiftError(e,s,r,i=null){e.unshift({code:s,position:r,info:t.Type.isPlainObject(i)?i:{}})}addContextError(e,s,r,i=null){e["hasError"]=true;e["error"]["code"]=s;e["error"]["position"]=r;e["error"]["info"]=t.Type.isPlainObject(i)?i:{};this.unshiftError(e["error"]["errors"],s,r,i)}addContextErrors(e,s,r=null){e["hasError"]=true;e["error"]["code"]=s[0]["code"];e["error"]["position"]=s[0]["position"];e["error"]["info"]=t.Type.isPlainObject(r)?r:{};e["error"]["errors"].splice(0,0,s)}parseBlocks(e){const s=[];const r=e["template"].length;while(e["position"]<r){const r=e["position"];e=this.parseGroup(e);if(e["hasError"]){const i=e["error"]["info"];let n;if(!t.Type.isPlainObject(i)&&i.hasOwnProperty("groupStartPosition")&&i["groupStartPosition"]>r){n=i["groupStartPosition"]-r+1}else{n=1}this.appendTextBlock(s,e["error"]["position"],e["template"].substr(r,n));e=this.clearContextInfoAndError(e);e["position"]=r+n}else{const t=e["info"]["position"];if(t>r){this.appendTextBlock(s,r,e["template"].substr(r,t-r))}if(e["info"]["value"]!==""){this.appendGroupBlock(s,t,e["info"]["value"])}e=this.clearContextInfo(e)}}if(!e["hasError"]){e["info"]={blocks:s}}return e}convert(e){let s="";let r=this.createContext();r["template"]=this.#c;r["address"]=e;r=this.parseBlocks(r);if(!r["hasError"]){const e=r["info"]["blocks"];for(let t=0;t<e.length;t++){if(e[t]["type"]==="text"){s+=this.unescapeText(e[t]["value"])}else{s+=e[t]["value"]}}}if(s!==""){const e=s.split(y);let r=[];for(let t=0;t<e.length;t++){if(e[t]!==""){r.push(e[t])}}if(this.#h&&r.length>0){for(let e=0;e<r.length;e++){r[e]=t.Text.encode(r[e])}}s=r.join(this.#u)}return s}}class U{static STRATEGY_TYPE_TEMPLATE="template";static STRATEGY_TYPE_TEMPLATE_COMMA="template_comma";static STRATEGY_TYPE_TEMPLATE_NL="template_nl";static STRATEGY_TYPE_TEMPLATE_BR="template_br";static STRATEGY_TYPE_FIELD_SORT="field_sort";static STRATEGY_TYPE_FIELD_TYPE="field_type";static CONTENT_TYPE_HTML="html";static CONTENT_TYPE_TEXT="text";static convertAddressToString(e,t,s,r){let i;if(s===U.STRATEGY_TYPE_TEMPLATE||s===U.STRATEGY_TYPE_TEMPLATE_COMMA||s===U.STRATEGY_TYPE_TEMPLATE_NL||s===U.STRATEGY_TYPE_TEMPLATE_BR){let n=null;switch(s){case U.STRATEGY_TYPE_TEMPLATE_COMMA:n=", ";break;case U.STRATEGY_TYPE_TEMPLATE_NL:n="\n";break;case U.STRATEGY_TYPE_TEMPLATE_BR:n="<br />";break}i=U.convertAddressToStringTemplate(e,t.getTemplate(),r,n,t)}else if(s===U.STRATEGY_TYPE_FIELD_SORT){const s=(e,t)=>e.sort-t.sort;i=U.convertAddressToStringByField(e,t,s,r)}else if(s===U.STRATEGY_TYPE_FIELD_TYPE){const s=(e,t)=>{let s;if(e.type===0){s=1}else if(t.type===0){s=-1}else{s=e.type-t.type}return s};i=U.convertAddressToStringByField(e,t,s,r)}else{throw TypeError("Wrong strategyType")}return i}static convertAddressToStringTemplate(e,t,s,r=null,i=null){const n=s===U.CONTENT_TYPE_HTML;if(r===null){r=n?"<br />":"\n"}const o=new G(t.template,r,n,i);return o.convert(e)}static convertAddressToStringByField(e,s,r,i){if(!(s instanceof T)){BX.debug("format must be instance of Format")}if(!(e instanceof j)){BX.debug("address must be instance of Address")}const n=s.fieldCollection;if(!n){return""}const o=Object.values(n.fields);o.sort(r);let l="";for(const r of o){let n=e.getFieldValue(r.type);if(n===null){continue}if(i===U.CONTENT_TYPE_HTML){n=t.Text.encode(n)}if(l!==""){l+=s.delimiter}l+=n}return l}}class V{static convertJsonToAddress(e){return new j(e)}static convertAddressToJson(e){const t={id:e.id,languageId:e.languageId,latitude:e.latitude,longitude:e.longitude,fieldCollection:V.#m(e.fieldCollection),links:V.#T(e.links),location:null};if(e.location){t.location=JSON.parse(e.location.toJson())}return JSON.stringify(t)}static#m(e){const t={};
1Object.values(e.fields).forEach((e=>{t[e.type]=e.value}));return t}static#T(e){return e.map((e=>({entityId:e.entityId,entityType:e.entityType})))}}class j{#y;#_;#A;#L;#w;#n;#C;constructor(e){if(t.Type.isUndefined(e.languageId)){throw new TypeError("languageId must be defined")}this.#_=e.languageId;this.#y=e.id||0;this.#A=e.latitude||"";this.#L=e.longitude||"";this.#w=new a;if(t.Type.isObject(e.fieldCollection)){for(const[t,s]of Object.entries(e.fieldCollection)){this.setFieldValue(t,s)}}this.#n=new c;if(t.Type.isArray(e.links)){for(const t of e.links){this.addLink(t.entityId,t.entityType)}}this.#C=null;if(e.location){if(e.location instanceof $){this.#C=e.location}else if(t.Type.isObject(e.location)){this.#C=new $(e.location)}else{BX.debug("Wrong typeof props.location")}}}get id(){return this.#y}get location(){return this.#C}get languageId(){return this.#_}get fieldCollection(){return this.#w}set id(e){this.#y=e}set location(e){this.#C=e}get latitude(){return this.#A}set latitude(e){this.#A=e}get longitude(){return this.#L}set longitude(e){this.#L=e}get links(){return this.#n.links}setFieldValue(e,t){this.#w.setFieldValue(e,t)}getFieldValue(e){return this.#w.getFieldValue(e)}isFieldExists(e){return this.#w.isFieldExists(e)}toJson(){return V.convertAddressToJson(this)}toString(e,t,s){if(!(e instanceof T)){console.error("format must be instance of Format");return""}const r=t||U.STRATEGY_TYPE_TEMPLATE;const i=s||U.CONTENT_TYPE_HTML;return U.convertAddressToString(this,e,r,i)}toLocation(){let e=null;if(this.location){const t=JSON.parse(this.location.toJson());t.address=JSON.parse(this.toJson());e=new $(t)}return e}getType(){return this.#w.getMaxFieldType()}addLink(e,t){this.#n.addLink(new d({entityId:e,entityType:t}))}clearLinks(){this.#n.clearLinks()}}class J extends n{#s;constructor(e){super(e);this.#s=e.value||""}get value(){return this.#s}set value(e){this.#s=e}}class X extends o{getFieldValue(e){let t=null;if(this.isFieldExists(e)){const s=this.getField(e);if(s){t=s.value}}return t}setFieldValue(e,t){this.setField(new J({type:e,value:t}));return this}}class K{static convertLocationToObject(e){if(!(e instanceof $)){throw new TypeError("location must be type of location")}const t={id:e.id,code:e.code,externalId:e.externalId,sourceCode:e.sourceCode,type:e.type,name:e.name,languageId:e.languageId,latitude:e.latitude,longitude:e.longitude,fieldCollection:K.#m(e.fieldCollection),address:null};if(e.address){t.address=JSON.parse(e.address.toJson())}return t}static#m(e){let t={};Object.values(e.fields).forEach((e=>{t[e.type]=e.value}));return t}}class z{static convertJsonToLocation(e){const t={...e};if(e.address){t.address=new j(e.address)}return new $(t)}static convertLocationToJson(e){if(!(e instanceof $)){throw new TypeError("location must be type of location")}const t=K.convertLocationToObject(e);return t?JSON.stringify(t):""}}class ${#y;#I;#R;#S;#e;#l;#_;#A;#L;#x;#w;constructor(e={}){this.#y=parseInt(e.id)||0;this.#I=e.code||"";this.#R=e.externalId||"";this.#S=e.sourceCode||"";this.#e=parseInt(e.type)||0;this.#l=e.name||"";this.#_=e.languageId||"";this.#A=e.latitude||"";this.#L=e.longitude||"";this.#w=new X;if(t.Type.isObject(e.fieldCollection)){for(const[t,s]of Object.entries(e.fieldCollection)){this.setFieldValue(t,s)}}this.#x=null;if(e.address){if(e.address instanceof j){this.#x=e.address}else if(typeof e.address==="object"){this.#x=new j(e.address)}else{BX.debug("Wrong typeof props.address")}}}get id(){return this.#y}get code(){return this.#I}get externalId(){return this.#R}get sourceCode(){return this.#S}get type(){return this.#e}get name(){return this.#l}get languageId(){return this.#_}set id(e){this.#y=e}set code(e){this.#I=e}set externalId(e){this.#R=e}set sourceCode(e){this.#S=e}set type(e){this.#e=e}set name(e){this.#l=e}set languageId(e){this.#_=e}get latitude(){return this.#A}set latitude(e){this.#A=e}get longitude(){return this.#L}set longitude(e){this.#L=e}set address(e){this.#x=e}get address(){return this.#x}toJson(){return z.convertLocationToJson(this)}toAddress(){let e=null;if(this.address){const t=JSON.parse(this.address.toJson());t.location=JSON.parse(this.toJson());e=new j(t)}return e}get fieldCollection(){return this.#w}setFieldValue(e,t){this.#w.setFieldValue(e,t)}getFieldValue(e){return this.#w.getFieldValue(e)}isFieldExists(e){return this.#w.isFieldExists(e)}hasExternalRelation(){return this.#R&&this.#S}}class H{#b="";constructor(e){if(!e.path){throw new Error("props.path must not be empty!")}this.#b=e.path}run(e,t){if(!e){throw new Error("action can not be empty!")}
1return BX.ajax.runAction(`${this.#b}.${e}`,{data:t})}}class q{#F=null;constructor(e={}){this._path=e.path;if(e.actionRunner&&e.actionRunner instanceof H){this.#F=e.actionRunner}else{this.#F=new H({path:this._path})}}get path(){return this._path}get actionRunner(){return this.#F}processResponse(e){if(e.status!=="success"){BX.debug("Request was not successful");let t="";if(Array.isArray(e.errors)&&e.errors.length>0){for(const s of e.errors){if(typeof s.message==="string"&&s.message!==""){t+=`${s}\n`}}}throw new Error(t)}return e.data?e.data:null}}class Z extends q{constructor(e={}){e.path=e.path||"location.api.location";super(e)}findByExternalId(e,t,s){if(!e||!t||!s){throw new Error("externalId and sourceCode and languageId must be defined")}return this.actionRunner.run("findByExternalId",{externalId:e,sourceCode:t,languageId:s}).then(this.processResponse.bind(this)).then(this.#M.bind(this))}findById(e,t){if(!e||!t){throw new Error("locationId and languageId must be defined")}return this.actionRunner.run("findById",{id:e,languageId:t}).then(this.processResponse.bind(this)).then(this.#M.bind(this))}#M(e){if(!e){return null}if(typeof e!=="object"){throw new Error("Can't convert location data")}return z.convertJsonToLocation(e)}}class W extends q{constructor(e={}){e.path="location.api.address";super(e)}findById(e){if(e<=0){throw new Error("addressId must be more than zero")}return this.actionRunner.run("findById",{addressId:e}).then(this.processResponse).then((e=>{let t=null;if(e){t=this.convertJsonToAddress(e)}return t}))}save(e){if(!e){throw new Error("address must be defined")}return this.actionRunner.run("save",{address:e}).then(this.processResponse).then((e=>{let t=null;if(typeof e==="object"){t=this.convertJsonToAddress(e)}return t}))}convertJsonToAddress(e){return new s.Address(e)}}class Q extends q{constructor(e={}){e.path="location.api.format";super(e)}findAll(e){if(!t.Type.isString(e)){throw new TypeError("languageId must be type of string")}return this.actionRunner.run("findAll",{languageId:e}).then(this.processResponse).then((e=>this.convertFormatCollection(e)))}findByCode(e,s){if(!t.Type.isString(e)){throw new TypeError("formatCode must be type of string")}if(!t.Type.isString(s)){throw new TypeError("languageId must be type of string")}return this.actionRunner.run("findByCode",{formatCode:e,languageId:s}).then(this.processResponse).then(this.convertFormatData)}findDefault(e){if(!t.Type.isString(e)){throw new TypeError("languageId must be type of string")}return this.actionRunner.run("findDefault",{languageId:e}).then(this.processResponse).then(this.convertFormatData)}convertFormatCollection(e){if(!t.Type.isArray(e)){throw new TypeError("Can't convert format collection data")}let s=[];e.forEach((e=>{s.push(this.convertFormatData(e))}));return s}convertFormatData(e){if(!t.Type.isObject(e)){throw new TypeError("Can't convert format data")}return new T(e)}}class ee extends q{constructor(e={}){e.path="location.api.source";super(e)}getProps(){return this.actionRunner.run("getProps",{}).then(this.processResponse)}}class te{autocomplete(e,t){throw new Error("Method autocomplete() Must be implemented")}}const se=100;const re=5*1024*1024;const ie=3600;class ne{static set(e,t,s){const r=ne.#P(e);r.push({hash:ne.#O(t),data:s});BX.localStorage.set(ne.#v(e),ne.#N(r),ie)}static get(e,t){const s=ne.#O(t);const r=ne.#P(e);for(const e of r){if(e&&e.hash===s){return e}}return null}static#N(e){if(new Blob([JSON.stringify(e)]).size>re){return[]}if(e.length>se){return e.slice(e.length-se)}return e}static#P(e){const t=BX.localStorage.get(ne.#v(e));return Array.isArray(t)?t:[]}static#O(e){return r.md5(JSON.stringify(e))}static#v(e){return`location${e}AutocompleteCache`}}
1class oe{requestPhotos(e){throw new Error("Must be implemented")}}class le extends i.EventEmitter{constructor(){super();this.setEventNamespace("BX.Location.Core.MapBase")}render(e){throw new Error("Must be implemented")}set location(e){throw new Error("Must be implemented")}panTo(e,t){throw new Error("Must be implemented")}set mode(e){throw new Error("Must be implemented")}set zoom(e){throw new Error("Must be implemented")}static getZoomByLocation(e){const t=18;if(!e){return t}const r=e.type;if(r<=0){return t}if(r<s.LocationType.COUNTRY){return 1}else if(r===s.LocationType.COUNTRY){return 4}else if(r<=s.LocationType.ADM_LEVEL_1){return 6}else if(r<=s.LocationType.LOCALITY){return 11}else if(r<=s.LocationType.STREET){return 16}return t}onLocationChangedEventSubscribe(e){throw new Error("Must be implemented")}onMapShow(){}destroy(){}}class ae{get sourceCode(){throw new Error("Must be implemented")}get map(){throw new Error("Must be implemented")}get autocompleteService(){throw new Error("Must be implemented")}get photoService(){throw new Error("Mu
1st be implemented")}get geocodingService(){throw new Error("Must be implemented")}}class de{geocode(e){if(!e){return Promise.resolve([])}return this.geocodeConcrete(e)}geocodeConcrete(e){throw new Error("Method geocodeConcrete() must be implemented")}}class ce{static get edit(){return"edit"}static get view(){return"view"}static isValid(e){return e===ce.edit||e===ce.view}}class ue{static POSTAL_CODE=50;static ISO_3166_1_ALPHA_2=1e3}class he extends Error{}class pe extends Error{}class fe extends i.EventEmitter{static#B=null;static#D="onError";static getInstance(){if(fe.#B===null){fe.#B=new fe}return fe.#B}constructor(){super();this.setEventNamespace("BX.Location.Core.ErrorPublisher")}notify(e){this.emit(fe.#D,{errors:e})}subscribe(e){super.subscribe(fe.#D,e)}}class Ee{#k=`bitrixLocationLastAddress`;static#B=null;static getInstance(){if(Ee.#B===null){Ee.#B=new Ee}return Ee.#B}set lastAddress(e){if(e){BX.localStorage.set(this.#k,{json:e.toJson()},86400*30)}}get lastAddress(){const e=BX.localStorage.get(this.#k);if(e&&e["json"]){try{return V.convertJsonToAddress(JSON.parse(e["json"]))}catch(e){}}return null}}class ge{#A;#L;constructor(e,t){this.#A=e;this.#L=t}get latitude(){return this.#A}get longitude(){return this.#L}toArray(){return[this.latitude,this.longitude]}static fromJson(e){return new ge(e.latitude,e.longitude)}}class me{static getDistanceFromLatLonInKm(e,t,s,r){const i=6371;const n=me.deg2rad(s-e);const o=me.deg2rad(r-t);const l=Math.sin(n/2)*Math.sin(n/2)+Math.cos(me.deg2rad(e))*Math.cos(me.deg2rad(s))*Math.sin(o/2)*Math.sin(o/2);const a=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l));return i*a}static deg2rad(e){return e*(Math.PI/180)}}const Te={MAP_LOADED:"mapLoaded",PAGE_WITH_MAP_LOADED:"pageWithMapLoaded",MARKER_CLICKED:"markerClicked",CLUSTER_CLICKED:"clusterClicked"};const ye={INIT_MAP:"initMap",ADD_MARKERS:"addMarkers",REMOVE_MARKERS:"removeMarkers",CLEAR_MARKERS:"clearMarkers",ADD_LAYERS:"addLayers",REMOVE_LAYERS:"removeLayers",CLEAR_LAYERS:"clearLayers",FIT_BOUNDS:"fitBounds",SET_ZOOM:"setZoom",ZOOM_IN:"zoomIn",ZOOM_OUT:"zoomOut",FIT_TO_LAYERS:"fitToLayers",ENABLE_CLUSTERING:"enableClustering",DISABLE_CLUSTERING:"disableClustering",UPDATE_CLUSTER_ICON:"updateClusterIcon",UPDATE_SETTINGS:"updateSettings",SET_GRAYSCALE:"setGrayscale"};
1class _e{init(e){throw new Error("Must be implemented")}destroy(){throw new Error("Must be implemented")}addMarkers(e){throw new Error("Must be implemented")}removeMarkers(e){throw new Error("Must be implemented")}clearMarkers(){throw new Error("Must be implemented")}addLayers(e){throw new Error("Must be implemented")}removeLayers(e){throw new Error("Must be implemented")}clearLayers(){throw new Error("Must be implemented")}fitBounds(e,t={}){throw new Error("Must be implemented")}setZoom(e){throw new Error("Must be implemented")}zoomIn(){throw new Error("Must be implemented")}zoomOut(){throw new Error("Must be implemented")}fitToLayers(e=null){throw new Error("Must be implemented")}enableClustering(e={}){throw new Error("Must be implemented")}disableClustering(){throw new Error("Must be implemented")}getMarkerConfig(e){throw new Error("Must be implemented")}setClusterIcon(e,t){throw new Error("Must be implemented")}updateSettings(e){throw new Error("Must be implemented")}setGrayscale(e){throw new Error("Must be implemented")}}e.Address=j;e.AddressRepository=W;e.AddressStringConverter=U;e.AddressType=f;e.AutocompleteCache=ne;e.AutocompleteServiceBase=te;e.BaseSource=ae;e.CheckInMapEventType=Te;e.CheckInMapServiceBase=_e;e.CheckinMapCommandType=ye;e.ControlMode=ce;e.DistanceCalculator=me;e.ErrorPublisher=fe;e.Format=T;e.FormatRepository=Q;e.FormatTemplate=E;e.FormatTemplateCollection=g;e.FormatTemplateType=m;e.GeocodingServiceBase=de;e.Location=$;e.LocationFieldType=ue;e.LocationJsonConverter=z;e.LocationRepository=Z;e.LocationType=p;e.MapBase=le;e.MethodNotImplemented=pe;e.PhotoServiceBase=oe;e.Point=ge;e.SourceCreationError=he;e.SourceRepository=ee;e.Storage=Ee})(this.BX.Location.Core=this.BX.Location.Core||{},BX,BX.Location.Core,BX,BX.Event);
2//# sourceMappingURL=core.bundle.map.js

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.