UNPKG

cl-react-graph

Version:
2 lines 6.66 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{442:function(e,n,t){"use strict";t.r(n);t(3),t(4),t(2),t(64),t(21);function r(){}function o(e,n){var t=new r;if(e instanceof r)e.each((function(e,n){t.set(n,e)}));else if(Array.isArray(e)){var o,u=-1,i=e.length;if(null==n)for(;++u<i;)t.set(u,e[u]);else for(;++u<i;)t.set(n(o=e[u],u,e),o)}else if(e)for(var a in e)t.set(a,e[a]);return t}r.prototype=o.prototype={constructor:r,has:function(e){return"$"+e in this},get:function(e){return this["$"+e]},set:function(e,n){return this["$"+e]=n,this},remove:function(e){var n="$"+e;return n in this&&delete this[n]},clear:function(){for(var e in this)"$"===e[0]&&delete this[e]},keys:function(){var e=[];for(var n in this)"$"===n[0]&&e.push(n.slice(1));return e},values:function(){var e=[];for(var n in this)"$"===n[0]&&e.push(this[n]);return e},entries:function(){var e=[];for(var n in this)"$"===n[0]&&e.push({key:n.slice(1),value:this[n]});return e},size:function(){var e=0;for(var n in this)"$"===n[0]&&++e;return e},empty:function(){for(var e in this)if("$"===e[0])return!1;return!0},each:function(e){for(var n in this)"$"===n[0]&&e(this[n],n.slice(1),this)}};var u=o;function i(){}var a=u.prototype;function c(e,n){var t=new i;if(e instanceof i)e.each((function(e){t.add(e)}));else if(e){var r=-1,o=e.length;if(null==n)for(;++r<o;)t.add(e[r]);else for(;++r<o;)t.add(n(e[r],r,e))}return t}i.prototype=c.prototype={constructor:i,has:a.has,add:function(e){return this["$"+(e+="")]=e,this},remove:a.remove,clear:a.clear,values:a.keys,size:a.size,empty:a.empty,each:a.each};var s=t(252),l=function(e,n){var t,r,o,i,a=Object(s.a)("beforesend","progress","load","error"),c=u(),l=new XMLHttpRequest,f=null,p=null,h=0;function d(e){var n,r=l.status;if(!r&&function(e){var n=e.responseType;return n&&"text"!==n?e.response:e.responseText}(l)||r>=200&&r<300||304===r){if(o)try{n=o.call(t,l)}catch(u){return void a.call("error",t,u)}else n=l;a.call("load",t,n)}else a.call("error",t,e)}if("undefined"==typeof XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(e)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=d:l.onreadystatechange=function(e){l.readyState>3&&d(e)},l.onprogress=function(e){a.call("progress",t,e)},t={header:function(e,n){return e=(e+"").toLowerCase(),arguments.length<2?c.get(e):(null==n?c.remove(e):c.set(e,n+""),t)},mimeType:function(e){return arguments.length?(r=null==e?null:e+"",t):r},responseType:function(e){return arguments.length?(i=e,t):i},timeout:function(e){return arguments.length?(h=+e,t):h},user:function(e){return arguments.length<1?f:(f=null==e?null:e+"",t)},password:function(e){return arguments.length<1?p:(p=null==e?null:e+"",t)},response:function(e){return o=e,t},get:function(e,n){return t.send("GET",e,n)},post:function(e,n){return t.send("POST",e,n)},send:function(n,o,u){return l.open(n,e,!0,f,p),null==r||c.has("accept")||c.set("accept",r+",*/*"),l.setRequestHeader&&c.each((function(e,n){l.setRequestHeader(n,e)})),null!=r&&l.overrideMimeType&&l.overrideMimeType(r),null!=i&&(l.responseType=i),h>0&&(l.timeout=h),null==u&&"function"==typeof o&&(u=o,o=null),null!=u&&1===u.length&&(u=function(e){return function(n,t){e(null==n?t:null)}}(u)),null!=u&&t.on("error",u).on("load",(function(e){u(null,e)})),a.call("beforesend",t,l),l.send(null==o?null:o),t},abort:function(){return l.abort(),t},on:function(){var e=a.on.apply(a,arguments);return e===a?t:e}},null!=n){if("function"!=typeof n)throw new Error("invalid callback: "+n);return t.get(n)}return t};var f=function(e,n){return function(t,r){var o=l(t).mimeType(e).response(n);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return o.get(r)}return o}},p=(f("text/html",(function(e){return document.createRange().createContextualFragment(e.responseText)})),f("application/json",(function(e){return JSON.parse(e.responseText)}))),h=(f("text/plain",(function(e){return e.responseText})),f("application/xml",(function(e){var n=e.responseXML;if(!n)throw new Error("parse error");return n})),t(18),t(70),t(33),t(67),t(11),{}),d={},v=34,m=10,g=13;function w(e){return new Function("d","return {"+e.map((function(e,n){return JSON.stringify(e)+": d["+n+"]"})).join(",")+"}")}var y=function(e){var n=new RegExp('["'+e+"\n\r]"),t=e.charCodeAt(0);function r(e,n){var r,o=[],u=e.length,i=0,a=0,c=u<=0,s=!1;function l(){if(c)return d;if(s)return s=!1,h;var n,r,o=i;if(e.charCodeAt(o)===v){for(;i++<u&&e.charCodeAt(i)!==v||e.charCodeAt(++i)===v;);return(n=i)>=u?c=!0:(r=e.charCodeAt(i++))===m?s=!0:r===g&&(s=!0,e.charCodeAt(i)===m&&++i),e.slice(o+1,n-1).replace(/""/g,'"')}for(;i<u;){if((r=e.charCodeAt(n=i++))===m)s=!0;else if(r===g)s=!0,e.charCodeAt(i)===m&&++i;else if(r!==t)continue;return e.slice(o,n)}return c=!0,e.slice(o,u)}for(e.charCodeAt(u-1)===m&&--u,e.charCodeAt(u-1)===g&&--u;(r=l())!==d;){for(var f=[];r!==h&&r!==d;)f.push(r),r=l();n&&null==(f=n(f,a++))||o.push(f)}return o}function o(n){return n.map(u).join(e)}function u(e){return null==e?"":n.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,n){var t,o,u=r(e,(function(e,r){if(t)return t(e,r-1);o=e,t=n?function(e,n){var t=w(e);return function(r,o){return n(t(r),o,e)}}(e,n):w(e)}));return u.columns=o||[],u},parseRows:r,format:function(n,t){return null==t&&(t=function(e){var n=Object.create(null),t=[];return e.forEach((function(e){for(var r in e)r in n||t.push(n[r]=r)})),t}(n)),[t.map(u).join(e)].concat(n.map((function(n){return t.map((function(e){return u(n[e])})).join(e)}))).join("\n")},formatRows:function(e){return e.map(o).join("\n")}}},b=y(","),T=b.parse,j=(b.parseRows,b.format,b.formatRows,y("\t")),x=j.parse,C=(j.parseRows,j.format,j.formatRows,function(e,n){return function(t,r,o){arguments.length<3&&(o=r,r=null);var u=l(t).mimeType(e);return u.row=function(e){return arguments.length?u.response(E(n,r=e)):r},u.row(r),o?u.get(o):u}});function E(e,n){return function(t){return e(t.responseText,n)}}C("text/csv",T),C("text/tab-separated-values",x);var R=t(0),A=t.n(R),$=t(434),O=t(431),k=t(430),M=t(432);n.default=function(){var e=Object(R.useState)(!0),n=e[0],t=e[1],r=Object(R.useState)(null),o=r[0],u=r[1];return Object(R.useEffect)((function(){p("https://opendata.arcgis.com/datasets/8d3a9e6e7bd445e2bdcc26cdf007eac7_3.geojson",(function(e,n){if(e)throw e;u(n),t(!1)}))}),[]),n?A.a.createElement("div",null,"loading"):A.a.createElement(O.a,null,A.a.createElement(k.a,{title:"Histogram",description:""}),A.a.createElement("h1",null,"Map"),A.a.createElement("div",null,A.a.createElement($.Map,{data:M.c,geojson:o,height:400,width:400})))}}}]); //# sourceMappingURL=component---src-pages-map-tsx-45bcfefdb631bf8c16ec.js.map