UNPKG

azure-maps-control

Version:

Map SDK for Azure Maps

3 lines (1 loc) 3.47 kB
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((t="undefined"!=typeof globalThis?globalThis:t||self).atlas=t.atlas||{})}(this,function(t){"use strict";n.prototype.getLuminosity=function(){for(var t=[this.r,this.g,this.b],o=[],n=0;n<t.length;n++){var e=t[n]/255;o[n]=e<=.03928?e/12.92:Math.pow((.055+e)/1.055,2.4)}return.2126*o[0]+.7152*o[1]+.0722*o[2]},n.prototype.getRBGA=function(t){var o=document.createElement("canvas").getContext("2d"),t=(o.globalAlpha=1,o.fillStyle=t,o.fillRect(0,0,1,1),o.getImageData(0,0,1,1).data);return[t[0],t[1],t[2],t[3]]};var o=n;function n(t){var o;t&&(o=void 0,3<=(o="string"==typeof t?this.getRBGA(t):t).length)&&(this.r=o[0],this.g=o[1],this.b=o[2],3<o.length)&&(this.a=o[3])}var u=window&&window.__values||function(t){var o="function"==typeof Symbol&&Symbol.iterator,n=o&&t[o],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return{value:(t=t&&e>=t.length?void 0:t)&&t[e++],done:!t}}};throw new TypeError(o?"Object is not iterable.":"Symbol.iterator is not defined.")};function p(){}p.prototype.merge=function(){for(var o,t,n,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{for(var i=u(e),a=i.next();!a.done;a=i.next()){var s=a.value;if(s)for(var c in s)s.hasOwnProperty(c)&&this.hasOwnProperty(c)&&(void 0!==s[c]&&null!=s[c]?this[c]instanceof p?this[c].merge(s[c]):this[c]=s[c]:(n=n||new(Object.getPrototypeOf(this).constructor),this[c]=n[c]))}}catch(t){o={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return this};var e,r,i=window&&window.__extends||(e=function(t,o){return(e=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,o){t.__proto__=o}:function(t,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])}))(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}),a=window&&window.__read||function(t,o){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var e,r,i=n.call(t),a=[];try{for(;(void 0===o||0<o--)&&!(e=i.next()).done;)a.push(e.value)}catch(t){r={error:t}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a},s=(i(c,r=p),c);function c(){var t=null!==r&&r.apply(this,arguments)||this;return t.domain=void 0,t.headers={},t.path="",t.protocol="https",t.queryParams={},t.subdomain="",t}l.prototype.get=function(){return fetch(this.toString(),{method:"GET",mode:"cors",headers:new Headers(this.options.headers)}).then(function(t){if(t.ok)return t.json();throw new Error("HTTP ".concat(t.status,": ").concat(t.statusText))})},l.prototype.toString=function(){var t=this,o=Object.entries(t.options.queryParams).map(function(t){var t=a(t,2),o=t[0],t=t[1];return"".concat(o,"=").concat(t)}).join("&"),n=[],e=t.options.path||"";return l.protoRegEx.test(e)?n.push(e):(t.options.domain&&(l.protoRegEx.test(t.options.domain)||(n.push("".concat(t.options.protocol,"://")),n.push(t.options.subdomain?"".concat(t.options.subdomain,"."):"")),n.push(t.options.domain)),n.push(t.options.path?"/".concat(e):"")),n.push(o?"?".concat(o):""),n.join("")},l.protoRegEx=new RegExp(/^(((file|http|https):\/\/)|blob:)/i);i=l;function l(t){this.options=(new s).merge(t)}t.Color=o,t.Url=i});