1Object.create||(Object.create=function(){function t(){}return function(e){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return t.prototype=e,new t}}()),Object.keys||(Object.keys=function(e,t,n){for(t in n=[],e)n.hasOwnProperty.call(e,t)&&n.push(t);return n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(e){if(null==this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var o=2<=arguments.length?arguments[1]:void 0,i=0;i<n;i++)i in t&&e.call(o,t[i],i,t);return this}),Array.prototype.filter||(Array.prototype.filter=function(o,i){var a=[];return this.forEach(function(e,t,n){o.call(i||void 0,e,t,n)&&a.push(e)}),a}),Array.prototype.map||(Array.prototype.map=function(o,i){var a=[];return this.forEach(function(e,t,n){a.push(o.call(i||void 0,e,t,n))}),a}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),"object"!=typeof window||"object"!=typeof window.location||window.location.assign||(window.location.assign=function(e){window.location=e}),Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");function t(){}function n(){return a.apply(this instanceof t?this:e||window,i.concat(o.call(arguments)))}var o=[].slice,i=o.call(arguments,1),a=this;return t.prototype=this.prototype,n.prototype=new t,n});var hello=function(e){return hello.use(e)};hello.utils={extend:function(n){return Array.prototype.slice.call(arguments,1).forEach(function(e){if(Array.isArray(n)&&Array.isArray(e))Array.prototype.push.apply(n,e);else if(n&&(n instanceof Object||"object"==typeof n)&&e&&(e instanceof Object||"object"==typeof e)&&n!==e)for(var t in e)n[t]=hello.utils.extend(n[t],e[t]);else Array.isArray(e)&&(e=e.slice(0)),n=e}),n}},hello.utils.extend(hello,{settings:{redirect_uri:window.location.href.split("#")[0],response_type:"token",display:"popup",state:"",oauth_proxy:"https://auth-server.herokuapp.com/proxy",timeout:2e4,popup:{resizable:1,scrollbars:1,width:500,height:550},scope:["basic"],scope_map:{basic:""},default_service:null,force:null,page_uri:window.location.href},services:{},use:function(e){var t=Object.create(this);return t.settings=Object.create(this.settings),e&&(t.settings.default_service=e),t.utils.Event.call(t),t},init:function(e,t){var n=this.utils;if(!e)return this.services;for(var o in e)e.hasOwnProperty(o)&&"object"!=typeof e[o]&&(e[o]={id:e[o]});return n.extend(this.services,e),t&&(n.extend(this.settings,t),"redirect_uri"in t&&(this.settings.redirect_uri=n.url(t.redirect_uri).href)),this},login:function(){var e,t=this,n=t.utils,o=n.error,i=n.Promise(),a=n.args({network:"s",options:"o",callback:"f"},arguments),r=n.diffKey(a.options,t.settings),s=a.options=n.merge(t.settings,a.options||{});function l(e,t){hello.emit(e,t)}if(s.popup=n.merge(t.settings.popup,a.options.popup||{}),a.network=a.network||t.settings.default_service,i.proxy.then(a.callback,a.callback),i.proxy.then(l.bind(this,"auth.login auth"),l.bind(this,"auth.failed auth")),"string"!=typeof a.network||!(a.network in t.services))return i.reject(o("invalid_network","The provided network was not recognized"));var u=t.services[a.network],c=n.globalEvent(function(e){var t=e?JSON.parse(e):o("cancelled","The authentication was not completed");t.error?i.reject(t):(n.store(t.network,t),i.fulfill({network:t.network,authResponse:t}))}),d=n.url(s.redirect_uri).href,p=u.oauth.response_type||s.response_type;/\bcode\b/.test(p)&&!u.oauth.grant&&(p=p.replace(/\bcode\b/,"token")),a.qs=n.merge(r,{client_id:encodeURIComponent(u.id),response_type:encodeURIComponent(p),redirect_uri:encodeURIComponent(d),state:{client_id:u.id,network:a.network,display:s.display,callback:c,state:s.state,redirect_uri:d}});var f,m,h=n.store(a.network),g=/[,\s]+/,v=t.settings.scope?[t.settings.scope.toString()]:[],y=n.merge
1(t.settings.scope_map,u.scope||{});if((s.scope&&v.push(s.scope.toString()),h&&"scope"in h&&h.scope instanceof String&&v.push(h.scope),v=v.join(",").split(g),v=n.unique(v).filter(_),a.qs.state.scope=v.join(","),v=(v=v.map(function(e){return e in y?y[e]:e})).join(",").split(g),v=n.unique(v).filter(_),a.qs.scope=v.join(u.scope_delim||","),!1===s.force)&&(h&&"access_token"in h&&h.access_token&&"expires"in h&&h.expires>(new Date).getTime()/1e3&&0===n.diff((h.scope||"").split(g),(a.qs.state.scope||"").split(g)).length))return i.fulfill({unchanged:!0,network:a.network,authResponse:h}),i;return"page"===s.display&&s.page_uri&&(a.qs.state.page_uri=n.url(s.page_uri).href),"login"in u&&"function"==typeof u.login&&u.login(a),(!/\btoken\b/.test(p)||parseInt(u.oauth.version,10)<2||"none"===s.display&&u.oauth.grant&&h&&h.refresh_token)&&(a.qs.state.oauth=u.oauth,a.qs.state.oauth_proxy=s.oauth_proxy),a.qs.state=encodeURIComponent(JSON.stringify(a.qs.state)),e=1===parseInt(u.oauth.version,10)?n.qs(s.oauth_proxy,a.qs,w):"none"===s.display&&u.oauth.grant&&h&&h.refresh_token?(a.qs.refresh_token=h.refresh_token,n.qs(s.oauth_proxy,a.qs,w)):n.qs(u.oauth.auth,a.qs,w),l("auth.init",a),"none"===s.display?n.iframe(e,d):"popup"===s.display?(f=n.popup(e,d,s.popup),m=setInterval(function(){var e;f&&!f.closed||(clearInterval(m),i.state||(e=o("cancelled","Login has been cancelled"),f||(e=o("blocked","Popup was blocked")),e.network=a.network,i.reject(e)))},100)):window.location=e,i.proxy;function w(e){return e}function _(e){return!!e}},logout:function(){var t=this.utils,e=t.error,n=t.Promise(),o=t.args({name:"s",options:"o",callback:"f"},arguments);function i(e,t){hello.emit(e,t)}if(o.options=o.options||{},n.proxy.then(o.callback,o.callback),n.proxy.then(i.bind(this,"auth.logout auth"),i.bind(this,"error")),o.name=o.name||this.settings.default_service,o.authResponse=t.store(o.name),!o.name||o.name in this.services)if(o.name&&o.authResponse){function a(e){t.store(o.name,null),n.fulfill(hello.utils.merge({network:o.name},e||{}))}var r={};if(o.options.force){var s=this.services[o.name].logout;if(s)if("function"==typeof s&&(s=s(a,o)),"string"==typeof s)t.iframe(s),r.force=null,r.message="Logout success on providers site was indeterminate";else if(void 0===s)return n.proxy}a(r)}else n.reject(e("invalid_session","There was no session to remove"));else n.reject(e("invalid_network","The network was unrecognized"));return n.proxy},getAuthResponse:function(e){return(e=e||this.settings.default_service)&&e in this.services&&this.utils.store(e)||null},events:{}}),hello.utils.extend(hello.utils,{error:function(e,t){return{error:{code:e,message:t}}},qs:function(e,t,n){if(t)for(var o in n=n||encodeURIComponent,t){var i=new RegExp("([\\?\\&])"+o+"=[^\\&]*");e.match(i)&&(e=e.replace(i,"$1"+o+"="+n(t[o])),delete t[o])}return this.isEmpty(t)?e:e+(-1<e.indexOf("?")?"&":"?")+this.param(t,n)},param:function(e,t){var n,o,i={};if("string"==typeof e){if(t=t||decodeURIComponent,o=e.replace(/^[\#\?]/,"").match(/([^=\/\&]+)=([^\&]+)/g))for(var a=0;a<o.length;a++)i[(n=o[a].match(/([^=]+)=(.*)/))[1]]=t(n[2]);return i}t=t||encodeURIComponent;var r=e,i=[];for(var s in r)r.hasOwnProperty(s)&&r.hasOwnProperty(s)&&i.push([s,"?"===r[s]?"?":t(r[s])].join("="));return i.join("&")},store:function(){for(var a,i,e=["localStorage","sessionStorage"],t=-1;e[++t];)try{(a=window[e[t]]).setItem("test"+t,t),a.removeItem("test"+t);break}catch(e){a=null}return a||(i=null,i=(a={getItem:function(e){e+="=";for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var o=t[n].replace(/(^\s+|\s+$)/,"");if(o&&0===o.indexOf(e))return o.substr(e.length)}return i},setItem:function(e,t){i=t,document.cookie=e+"="+t}}).getItem("hello")),function(t,e,n){var o,i=function(){var e={};try{e=JSON.parse(a.getItem("hello"))||{}}catch(e){}return e}();if(t&&void 0===e)return i[t]||null;if(t&&null===e)try{delete i[t]}catch(e){i[t]=null}else{if(!t)return i;i[t]=e}return o=i,a.setItem("hello",JSON.stringify(o)),i||null}}(),append:function(e,t,n){var o="string"==typeof e?document.createElement(e):e;if("object"==typeof t)if("tagName"in t)n=t;else for(var i in t)if(t.hasOwnProperty(i))if("object"==typeof t[i])for(var a in t[i])t[i].hasOwnProperty(a)&&(o[i][a]=t[i][a]);else"html"===i?o.innerHTML=t[i]:/^on/.test(i)?o[i]=t[i]:o.setAttribute(i,t[i]);return"body"===n?function e(){document.body?document.body.appendChild(o):setTimeout(e,16)}():"object"==typeof n?n.appendChild(o):"string"==typeof n&&document.getElementsByTagName(n)[0].appendChild(o),o},iframe:function(e){this.append("iframe",{src:e,style:{position:"absolute",left:"-1000px",bottom:0,height:"1px",width:"1px"}},"body")},merge:function(){var e=Array.prototype.slice.call(arguments);return e.unshift({}),this.extend.apply(null,e)},args:function(e,t){var n={},o=0,i=null,a=null;for(a in e)if(e.hasOwnProperty(a))break;if(1===t.length&&"object"==typeof t[0]&&"o!"!=e[a])for(a in t[0])if(e.hasOwnProperty(a)&&a in e)return t[0];for(a in e)if(e.hasOwnProperty(a))if(i=typeof t[o],"function"==typeof e[a]&&e[a].test(t[o])||"string"==typeof e[a]&&(-1<e[a].indexOf("s")&&"string"===i||-1<e[a].indexOf("o")&&"object"===i||-1<e[a].indexOf("i")&&"number"===i||-1<e[a].indexOf("a")&&"object"===i||-1<e[a].indexOf("f")&&"function"===i))n[a]=t[o++];else if("string"==typeof e[a]&&-1<e[a].indexOf("!"))return!1;return n},url:function(e){if(e){if(window.URL&&URL instanceof Function&&0!==URL.length)return new URL(e,window.location);var t=document.createElement("a");return t.href=e,t.cloneNode(!1)}return window.location},diff:function(t,e){return e.filter(function(e){return-1===t.indexOf(e)})},diffKey:function(e,t){if(!e&&t)return e;var n={};for(var o in e)o in t||(n[o]=e[o]);return n},unique:function(n){return Array.isArray(n)?n.filter(function(e,t){return n.indexOf(e)===t}):[]},isEmpty:function(e){if(!e)return!0;
1if(Array.isArray(e))return!e.length;if("object"==typeof e)for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},Promise:function(){var o=function(e){if(!(this instanceof o))return new o(e);this.id="Thenable/1.0.6",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};o.prototype={fulfill:function(e){return t(this,1,"fulfillValue",e)},reject:function(e){return t(this,2,"rejectReason",e)},then:function(e,t){var n=new o;return this.onFulfilled.push(a(e,n,"fulfill")),this.onRejected.push(a(t,n,"reject")),i(this),n.proxy}};var t=function(e,t,n,o){return 0===e.state&&(e.state=t,e[n]=o,i(e)),e},i=function(e){1===e.state?n(e,"onFulfilled",e.fulfillValue):2===e.state&&n(e,"onRejected",e.rejectReason)},n=function(e,t,n){var o,i;0!==e[t].length&&(o=e[t],e[t]=[],i=function(){for(var e=0;e<o.length;e++)o[e](n)},"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick(i):"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0))},a=function(n,o,i){return function(e){if("function"!=typeof n)o[i].call(o,e);else{var t;try{t=n(e)}catch(e){return void o.reject(e)}r(o,t)}}},r=function(t,n){if(t!==n&&t.proxy!==n){var e;if("object"==typeof n&&null!==n||"function"==typeof n)try{e=n.then}catch(e){return void t.reject(e)}if("function"!=typeof e)t.fulfill(n);else{var o=!1;try{e.call(n,function(e){o||(o=!0,e===n?t.reject(new TypeError("circular thenable chain")):r(t,e))},function(e){o||(o=!0,t.reject(e))})}catch(e){o||t.reject(e)}}}else t.reject(new TypeError("cannot resolve promise with itself"))};return o}(),Event:function(){var a=/[\s\,]+/;return this.parent={events:this.events,findEvents:this.findEvents,parent:this.parent,utils:this.utils},this.events={},this.on=function(e,t){if(t&&"function"==typeof t)for(var n=e.split(a),o=0;o<n.length;o++)this.events[n[o]]=[t].concat(this.events[n[o]]||[]);return this},this.off=function(e,n){return this.findEvents(e,function(e,t){n&&this.events[e][t]!==n||(this.events[e][t]=null)}),this},this.emit=function(n){var o=Array.prototype.slice.call(arguments,1);o.push(n);function e(e,t){o[o.length-1]="*"===e?n:e,this.events[e][t].apply(this,o)}for(var t=this;t&&t.findEvents;)t.findEvents(n+",*",e),t=t.parent;return this},this.emitAfter=function(){var e=this,t=arguments;return setTimeout(function(){e.emit.apply(e,t)},0),this},this.findEvents=function(e,t){var n=e.split(a);for(var o in this.events)if(this.events.hasOwnProperty(o)&&-1<n.indexOf(o))for(var i=0;i<this.events[o].length;i++)this.events[o][i]&&t.call(this,o,i)},this},globalEvent:function(e,t){return t=t||"_hellojs_"+parseInt(1e12*Math.random(),10).toString(36),window[t]=function(){try{e.apply(this,arguments)&&delete window[t]}catch(e){console.error(e)}},t},popup:function(e,t,n){var o,i,a,r,s=document.documentElement;n.height&&(o=void 0!==window.screenTop?window.screenTop:screen.top,i=screen.height||window.innerHeight||s.clientHeight,n.top=parseInt((i-n.height)/2,10)+o),n.width&&(a=void 0!==window.screenLeft?window.screenLeft:screen.left,r=screen.width||window.innerWidth||s.clientWidth,n.left=parseInt((r-n.width)/2,10)+a);var l=[];Object.keys(n).forEach(function(e){var t=n[e];l.push(e+(null!==t?"="+t:""))}),-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")&&(e=t+"#oauth_redirect="+encodeURIComponent(encodeURIComponent(e)));var u=window.open(e,"_blank",l.join(","));return u&&u.focus&&u.focus(),u},responseHandler:function(e,t){var n,r=this,o=e.location,i=r.param(o.search);if(i&&i.state&&(i.code||i.oauth_token)){var a=JSON.parse(i.state);i.redirect_uri=a.redirect_uri||o.href.replace(/[\?\#].*$/,"");var s=a.oauth_proxy+"?"+r.param(i);o.assign(s)}else if((i=r.merge(r.param(o.search||""),r.param(o.hash||"")))&&"state"in i){try{var l=JSON.parse(i.state);r.extend(i,l)}catch(e){console.error("Could not decode state parameter")}"access_token"in i&&i.access_token&&i.network?(i.expires_in&&0!==parseInt(i.expires_in,10)||(i.expires_in=0),i.expires_in=parseInt(i.expires_in,10),i.expires=(new Date).getTime()/1e3+(i.expires_in||31536e3),u(i,0,t)):"error"in i&&i.error&&i.network?(i.error={code:i.error,message:i.error_message||i.error_description}
1,u(i,0,t)):i.callback&&i.callback in t&&(n=!!("result"in i&&i.result)&&JSON.parse(i.result),c(t,i.callback)(n),d()),i.page_uri&&o.assign(i.page_uri)}else if("oauth_redirect"in i)return void o.assign(decodeURIComponent(i.oauth_redirect));function u(e,t,n){var o=e.callback,i=e.network;if(r.store(i,e),!("display"in e&&"page"===e.display)){if(n&&o&&o in n){try{delete e.callback}catch(e){}r.store(i,e);var a=JSON.stringify(e);try{c(n,o)(a)}catch(e){}}d()}}function c(e,t){return 0!==t.indexOf("_hellojs_")?function(){throw"Could not execute callback "+t}:e[t]}function d(){if(e.frameElement)t.document.body.removeChild(e.frameElement);else{try{e.close()}catch(e){}e.addEventListener&&e.addEventListener("load",function(){e.close()})}}}}),hello.utils.Event.call(hello),function(u){var c={},d={};u.on("auth.login, auth.logout",function(e){e&&"object"==typeof e&&e.network&&(c[e.network]=u.utils.store(e.network)||{})}),function e(){function t(e){u.emit("auth."+e,{network:o,authResponse:i})}var n=(new Date).getTime()/1e3;for(var o in u.services)if(u.services.hasOwnProperty(o)){if(!u.services[o].id)continue;var i=u.utils.store(o)||{},a=u.services[o],r=c[o]||{};if(i&&"callback"in i){var s=i.callback;try{delete i.callback}catch(e){}u.utils.store(o,i);try{window[s](i)}catch(e){}}if(i&&"expires"in i&&i.expires<n){var l=a.refresh||i.refresh_token;!l||o in d&&!(d[o]<n)?l||o in d||(t("expired"),d[o]=!0):(u.emit("notice",o+" has expired trying to resignin"),u.login(o,{display:"none",force:!1}),d[o]=600+n);continue}if(r.access_token===i.access_token&&r.expires===i.expires)continue;!i.access_token&&r.access_token?t("logout"):i.access_token&&!r.access_token?t("login"):i.expires!==r.expires&&t("update"),c[o]=i,o in d&&delete d[o]}setTimeout(e,1e3)}()}(hello),hello.api=function(){var e=this,i=e.utils,a=i.error,r=i.Promise(),s=i.args({path:"s!",query:"o",method:"s",data:"o",timeout:"i",callback:"f"},arguments);s.method=(s.method||"get").toLowerCase(),s.headers=s.headers||{},s.query=s.query||{},"get"!==s.method&&"delete"!==s.method||(i.extend(s.query,s.data),s.data={});var t=s.data=s.data||{};if(r.then(s.callback,s.callback),!s.path)return r.reject(a("invalid_path","Missing the path parameter from the request"));s.path=s.path.replace(/^\/+/,"");var n,o=(s.path.split(/[\/\:]/,2)||[])[0].toLowerCase();o in e.services&&(s.network=o,n=new RegExp("^"+o+":?/?"),s.path=s.path.replace(n,"")),s.network=e.settings.default_service=s.network||e.settings.default_service;var l=e.services[s.network];if(!l)return r.reject(a("invalid_network","Could not match the service requested: "+s.network));if(s.method in l&&s.path in l[s.method]&&!1===l[s.method][s.path])return r.reject(a("invalid_path","The provided path is not available on the selected network"));s.oauth_proxy||(s.oauth_proxy=e.settings.oauth_proxy),"proxy"in s||(s.proxy=s.oauth_proxy&&l.oauth&&1===parseInt(l.oauth.version,10)),"timeout"in s||(s.timeout=e.settings.timeout),"formatResponse"in s||(s.formatResponse=!0),s.authResponse=e.getAuthResponse(s.network),s.authResponse&&s.authResponse.access_token&&(s.query.access_token=s.authResponse.access_token);var u,c=s.path;s.options=i.clone(s.query),s.data=i.clone(t);var d,p=l[{delete:"del"}[s.method]||s.method]||{};return"get"!==s.method||(d=c.split(/[\?#]/)[1])&&(i.extend(s.query,i.param(d)),c=c.replace(/\?.*?(#|$)/,"$1")),(u=c.match(/#(.+)/,""))?(c=c.split("#")[0],s.path=u[1]):c in p?c=p[s.path=c]:"default"in p&&(c=p.default),s.redirect_uri=e.settings.redirect_uri,s.xhr=l.xhr,s.jsonp=l.jsonp,s.form=l.form,"function"==typeof c?c(s,f):f(c),r.proxy;function f(e){(e=e.replace(/\@\{([a-z\_\-]+)(\|.*?)?\}/gi,function(e,t,n){var o=n?n.replace(/^\|/,""):"";return t in s.query?(o=s.query[t],delete s.query[t]):s.data&&t in s.data?(o=s.data[t],delete s.data[t]):n||r.reject(a("missing_attribute","The attribute "+t+" is missing from the request")),o})).match(/^https?:\/\//)||(e=l.base+e),s.url=e,i.request(s,function(e,t){var n,o;s.formatResponse?(e=!0===e?{success:!0}:e||{},"delete"===s.method&&(e=!e||i.isEmpty(e)?{success:!0}:e),l.wrap&&(s.path in l.wrap||"default"in l.wrap)&&(n=s.path in l.wrap?s.path:"default",(new Date).getTime(),(o=l.wrap[n](e,t,s))&&
1(e=o)),e&&"paging"in e&&e.paging.next&&("?"===e.paging.next[0]?e.paging.next=s.path+e.paging.next:e.paging.next+="#"+s.path),!e||"error"in e?r.reject(e):r.fulfill(e)):("object"==typeof t?400<=t.statusCode:"object"==typeof e&&"error"in e)?r.reject(e):r.fulfill(e)})}},hello.utils.extend(hello.utils,{request:function(n,o){var i=this,e=i.error;if(i.isEmpty(n.data)||"FileList"in window||!i.hasBinary(n.data)||(n.xhr=!1,n.jsonp=!1),this.request_cors(function(){return void 0===n.xhr||n.xhr&&("function"!=typeof n.xhr||n.xhr(n,n.query))}))r(n,function(e){var t=i.xhr(n.method,e,n.headers,n.data,o);t.onprogress=n.onprogress||null,t.upload&&n.onuploadprogress&&(t.upload.onprogress=n.onuploadprogress)});else{var t,a=n.query;if(n.query=i.clone(n.query),n.callbackID=i.globalEvent(),!1!==n.jsonp){if(n.query.callback=n.callbackID,"function"==typeof n.jsonp&&n.jsonp(n,n.query),"get"===n.method)return void r(n,function(e){i.jsonp(e,o,n.callbackID,n.timeout)});n.query=a}if(!1!==n.form&&(n.query.redirect_uri=n.redirect_uri,n.query.state=JSON.stringify({callback:n.callbackID}),"function"==typeof n.form&&(t=n.form(n,n.query)),"post"===n.method&&!1!==t))return void r(n,function(e){i.post(e,n.data,t,o,n.callbackID,n.timeout)});o(e("invalid_request","There was no mechanism for handling this request"))}function r(e,t){var n;e.authResponse&&e.authResponse.oauth&&1===parseInt(e.authResponse.oauth.version,10)&&(n=e.query.access_token,delete e.query.access_token,e.proxy=!0),!e.data||"get"!==e.method&&"delete"!==e.method||(i.extend(e.query,e.data),e.data=null);var o=i.qs(e.url,e.query);e.proxy&&(o=i.qs(e.oauth_proxy,{path:o,access_token:n||"",then:e.proxy_response_type||("get"===e.method.toLowerCase()?"redirect":"proxy"),method:e.method.toLowerCase(),suppress_response_codes:!0})),t(o)}},request_cors:function(e){return"withCredentials"in new XMLHttpRequest&&e()},domInstance:function(e,t){var n="HTML"+(e||"").replace(/^[a-z]/,function(e){return e.toUpperCase()})+"Element";return!!t&&(window[n]?t instanceof window[n]:window.Element?t instanceof window.Element&&(!e||t.tagName&&t.tagName.toLowerCase()===e):!(t instanceof Object||t instanceof Array||t instanceof String||t instanceof Number)&&t.tagName&&t.tagName.toLowerCase()===e)},clone:function(e){if(null===e||"object"!=typeof e||e instanceof Date||"nodeName"in e||this.isBinary(e)||"function"==typeof FormData&&e instanceof FormData)return e;if(Array.isArray(e))return e.map(this.clone.bind(this));var t={};for(var n in e)t[n]=this.clone(e[n]);return t},xhr:function(o,e,t,n,i){var a,r=new XMLHttpRequest,s=this.error,l=!1;if("blob"===o&&(l=o,o="GET"),o=o.toUpperCase(),r.onload=function(e){var t=r.response;try{t=JSON.parse(r.responseText)}catch(e){401===r.status&&(t=s("access_denied",r.statusText))}var n=function(e){var t,n={},o=/([a-z\-]+):\s?(.*);?/gi;for(;t=o.exec(e);)n[t[1]]=t[2];return n}(r.getAllResponseHeaders());n.statusCode=r.status,i(t||("GET"===o?s("empty_response","Could not get resource"):{}),n)},r.onerror=function(e){var t=r.responseText;try{t=JSON.parse(r.responseText)}catch(e){}i(t||s("access_denied","Could not get resource"))},"GET"===o||"DELETE"===o)n=null;else if(n&&"string"!=typeof n&&!(n instanceof FormData)&&!(n instanceof File)&&!(n instanceof Blob)){var u=new FormData;for(a in n)n.hasOwnProperty(a)&&(n[a]instanceof HTMLInputElement?"files"in n[a]&&0<n[a].files.length&&u.append(a,n[a].files[0]):n[a]instanceof Blob?u.append(a,n[a],n.name):u.append(a,n[a]));n=u}if(r.open(o,e,!0),l&&("responseType"in r?r.responseType=l:r.overrideMimeType("text/plain; charset=x-user-defined")),t)for(a in t)r.setRequestHeader(a,t[a]);return r.send(n),r},jsonp:function(e,t,n,o){function i(){s++||window.setTimeout(function(){t(u),l.removeChild(c)},0)}var a,r=this.error,s=0,l=document.getElementsByTagName("head")[0],u=r("server_error","server_error");n=this.globalEvent(function(e){return u=e,!0},n),e=e.replace(new RegExp("=\\?(&|$)"),"="+n+"$1");var c=this.append("script",{id:n,name:n,src:e,async:!0,onload:i,onerror:i,onreadystatechange:function(){/loaded|complete/i.test(this.readyState)&&i()}});-1<window.navigator.userAgent.toLowerCase().indexOf("opera")&&(a=this.append("script",{text:"document.getElementById('"+n+"').onerror
1();"}),c.async=!1),o&&window.setTimeout(function(){u=r("timeout","timeout"),i()},o),l.appendChild(c),a&&l.appendChild(a)},post:function(e,t,n,o,i,a){function r(e){v++||o(e)}var s,l,u,c=this,d=c.error,p=document,f=null,m=[],h=0,g=null,v=0;c.globalEvent(r,i);try{l=p.createElement('<iframe name="'+i+'">')}catch(e){l=p.createElement("iframe")}if(l.name=i,l.id=i,l.style.display="none",n&&n.callbackonload&&(l.onload=function(){r({response:"posted",message:"Content was posted"})}),a&&setTimeout(function(){r(d("timeout","The post operation timed out"))},a),p.body.appendChild(l),c.domInstance("form",t)){for(f=t.form,h=0;h<f.elements.length;h++)f.elements[h]!==t&&f.elements[h].setAttribute("disabled",!0);t=f}if(c.domInstance("form",t))for(f=t,h=0;h<f.elements.length;h++)f.elements[h].disabled||"file"!==f.elements[h].type||(f.encoding=f.enctype="multipart/form-data",f.elements[h].setAttribute("name","file"));else{for(g in t)t.hasOwnProperty(g)&&c.domInstance("input",t[g])&&"file"===t[g].type&&((f=t[g].form).encoding=f.enctype="multipart/form-data");for(g in f||(f=p.createElement("form"),p.body.appendChild(f),s=f),t)if(t.hasOwnProperty(g)){var y=c.domInstance("input",t[g])||c.domInstance("textArea",t[g])||c.domInstance("select",t[g]);if(y&&t[g].form===f)y&&t[g].name!==g&&(t[g].setAttribute("name",g),t[g].name=g);else{var w=f.elements[g];if(u)for(w instanceof NodeList||(w=[w]),h=0;h<w.length;h++)w[h].parentNode.removeChild(w[h]);(u=p.createElement("input")).setAttribute("type","hidden"),u.setAttribute("name",g),y?u.value=t[g].value:c.domInstance(null,t[g])?u.value=t[g].innerHTML||t[g].innerText:u.value=t[g],f.appendChild(u)}}for(h=0;h<f.elements.length;h++)(u=f.elements[h]).name in t||!0===u.getAttribute("disabled")||(u.setAttribute("disabled",!0),m.push(u))}f.setAttribute("method","POST"),f.setAttribute("target",i),f.target=i,f.setAttribute("action",e),setTimeout(function(){f.submit(),setTimeout(function(){try{s&&s.parentNode.removeChild(s)}catch(e){try{console.error("HelloJS: could not remove iframe")}catch(e){}}for(var e=0;e<m.length;e++)m[e]&&(m[e].setAttribute("disabled",!1),m[e].disabled=!1)},0)},100)},hasBinary:function(e){for(var t in e)if(e.hasOwnProperty(t)&&this.isBinary(e[t]))return!0;return!1},isBinary:function(e){return e instanceof Object&&(this.domInstance("input",e)&&"file"===e.type||"FileList"in window&&e instanceof window.FileList||"File"in window&&e instanceof window.File||"Blob"in window&&e instanceof window.Blob)},toBlob:function(e){var t=/^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i,n=e.match(t);if(!n)return e;for(var o=atob(e.replace(t,"")),i=[],a=0;a<o.length;a++)i.push(o.charCodeAt(a));return new Blob([new Uint8Array(i)],{type:n[1]})}}),function(e){var t=e.api,n=e.utils;n.extend(n,{dataToJSON:function(e){var t=this,n=window,o=e.data;if(t.domInstance("form",o)?o=t.nodeListToJSON(o.elements):"NodeList"in n&&o instanceof NodeList?o=t.nodeListToJSON(o):t.domInstance("input",o)&&(o=t.nodeListToJSON([o])),("File"in n&&o instanceof n.File||"Blob"in n&&o instanceof n.Blob||"FileList"in n&&o instanceof n.FileList)&&(o={file:o}),!("FormData"in n&&o instanceof n.FormData))for(var i in o)if(o.hasOwnProperty(i))if("FileList"in n&&o[i]instanceof n.FileList)1===o[i].length&&(o[i]=o[i][0]);else{if(t.domInstance("input",o[i])&&"file"===o[i].type)continue;t.domInstance("input",o[i])||t.domInstance("select",o[i])||t.domInstance("textArea",o[i])?o[i]=o[i].value:t.domInstance(null,o[i])&&(o[i]=o[i].innerHTML||o[i].innerText)}return e.data=o},nodeListToJSON:function(e){for(var t={},n=0;n<e.length;n++){var o=e[n];!o.disabled&&o.name&&("file"===o.type?t[o.name]=o:t[o.name]=o.value||o.innerHTML)}return t}}),e.api=function(){var e=n.args({path:"s!",method:"s",data:"o",timeout:"i",callback:"f"},arguments);return e.data&&n.dataToJSON(e),t.call(this,e)}}(hello),hello.utils.responseHandler(window,window.opener||window.parent),"object"==typeof chrome&&"object"==typeof chrome.identity&&chrome.identity.launchWebAuthFlow&&function(){hello.utils.popup=function(e){return i(e,!0)},hello.utils.iframe=function(e){i(e,!1)},hello.utils.request_cors=function(e){return e(),!0};var n={};function i(e,t){var o={closed:!1}
1;return chrome.identity.launchWebAuthFlow({url:e,interactive:t},function(e){var t,n;void 0!==e?(n={location:{assign:function(e){i(e,!1)},search:(t=hello.utils.url(e)).search,hash:t.hash,href:t.href},close:function(){}},hello.utils.responseHandler(n,window)):o.closed=!0}),o}chrome.storage.local.get("hello",function(e){n=e.hello||{}}),hello.utils.store=function(e,t){return 0===arguments.length?n:1===arguments.length?n[e]||null:t?(n[e]=t,chrome.storage.local.set({hello:n}),t):null===t?(delete n[e],chrome.storage.local.set({hello:n}),null):void 0}}(),function(){var r;/^file:\/{3}[^\/]/.test(window.location.href)&&window.cordova&&(hello.utils.iframe=function(e,t){hello.utils.popup(e,t,{hidden:"yes"})},r=hello.utils.popup,hello.utils.popup=function(e,t,n){var o,i,a=r.call(this,e,t,n);try{a&&a.addEventListener&&(o=hello.utils.url(t),i=o.origin||o.protocol+"//"+o.hostname,a.addEventListener("loadstart",function(e){var t,n,o=e.url;0===o.indexOf(i)&&(n={location:{assign:function(e){a.executeScript({code:'window.location.href = "'+e+';"'})},search:(t=hello.utils.url(o)).search,hash:t.hash,href:t.href},close:function(){if(a.close){a.close();try{a.closed=!0}catch(e){}}}},hello.utils.responseHandler(n,window))}))}catch(e){}return a})}(),function(i){var n={version:"1.0",auth:"https://www.dropbox.com/1/oauth/authorize",request:"https://api.dropbox.com/1/oauth/request_token",token:"https://api.dropbox.com/1/oauth/access_token"},o={version:2,auth:"https://www.dropbox.com/1/oauth2/authorize",grant:"https://api.dropbox.com/1/oauth2/token"};function a(e){e&&"error"in e&&(e.error={code:"server_error",message:e.error.message||e.error})}function r(e,t,n){var o;"object"!=typeof e||"undefined"!=typeof Blob&&e instanceof Blob||"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer||"error"in e||(o=(o=("app_folder"!==e.root?e.root:"")+e.path.replace(/\&/g,"%26")).replace(/^\//,""),e.thumb_exists&&(e.thumbnail=n.oauth_proxy+"?path="+encodeURIComponent("https://api-content.dropbox.com/1/thumbnails/auto/"+o+"?format=jpeg&size=m")+"&access_token="+n.options.access_token),e.type=e.is_dir?"folder":e.mime_type,e.name=e.path.replace(/.*\//g,""),e.is_dir?e.files=o.replace(/^\//,""):(e.downloadLink=i.settings.oauth_proxy+"?path="+encodeURIComponent("https://api-content.dropbox.com/1/files/auto/"+o)+"&access_token="+n.options.access_token,e.file="https://api-content.dropbox.com/1/files/auto/"+o),e.id||(e.id=e.path.replace(/^\//,"")))}function e(n){return function(e,t){delete e.query.limit,t(n)}}i.init({dropbox:{name:"Dropbox",oauth:o,login:function(e){e.qs.scope="";var t=decodeURIComponent(e.qs.redirect_uri);0===t.indexOf("http:")&&0!==t.indexOf("http://localhost/")?i.services.dropbox.oauth=n:i.services.dropbox.oauth=o,e.options.popup.width=1e3,e.options.popup.height=1e3},base:"https://api.dropbox.com/1/",root:"sandbox",get:{me:"account/info","me/files":e("metadata/auto/@{parent|}"),"me/folder":e("metadata/auto/@{id}"),"me/folders":e("metadata/auto/"),default:function(e,t){e.path.match("https://api-content.dropbox.com/1/files/")&&(e.method="blob"),t(e.path)}},post:{"me/files":function(e,t){var n=e.data.parent,o=e.data.name;e.data={file:e.data.file},"string"==typeof e.data.file&&(e.data.file=i.utils.toBlob(e.data.file)),t("https://api-content.dropbox.com/1/files_put/auto/"+n+"/"+o)},"me/folders":function(e,t){var n=e.data.name;e.data={},t("fileops/create_folder?root=@{root|sandbox}&"+i.utils.param({path:n}))}},del:{"me/files":"fileops/delete?root=@{root|sandbox}&path=@{id}","me/folder":"fileops/delete?root=@{root|sandbox}&path=@{id}"},wrap:{me:function(e){if(a(e),!e.uid)return e;e.name=e.display_name;var t=e.name.split(" ");return e.first_name=t.shift(),e.last_name=t.join(" "),e.id=e.uid,delete e.uid,delete e.display_name,e},default:function(t,e,n){return a(t),t.is_dir&&t.contents&&(t.data=t.contents,delete t.contents,t.data.forEach(function(e){e.root=t.root,r(e,0,n)})),r(t,0,n),t.is_deleted&&(t.success=!0),t}},xhr:function(e){var t;return e.data&&e.data.file&&((t=e.data.file)&&(t.files?e.data=t.files[0]:e.data=t)),"delete"===e.method&&(e.method="post"),!0},form:function(e,t){delete t.state,delete t.redirect_uri}}})}(hello),function(a){a.init({facebook:{name:"Facebook",oauth:{version:2,auth:"https://www.facebook.com/dialog/oauth/",grant:"https://graph.facebook.com/oauth/access_token"},scope:{basic:"public_profile",email:"email",share:"user_posts",birthday:"user_birthday",events:"user_events",photos:"user_photos",videos:"user_videos",friends:"user_friends",files:"user_photos,user_videos",publish_files:"user_photos,user_videos,publish_actions",publish:"publish_actions",offline_access:""},refresh:!1,login:function(e){e.options.force&&(e.qs.auth_type="reauthenticate"),e.qs.display=e.options.display||"popup"},logout:function(e,t){var n=a.utils.globalEvent(e),o=encodeURIComponent(a.settings.redirect_uri+"?"+a.utils.param({callback:n,result:JSON.stringify({force:!0}),state:"{}"})),i=(t.authResponse||{}).access_token;if(a.utils.iframe("https://www.facebook.com/logout.php?next="+o+"&access_token="+i),!i)return!1},base:"https://graph.facebook.com/v2.7/",get:{me:"me?fields=email,first_name,last_name,name,timezone,verified","me/friends":"me/friends","me/following":"me/friends","me/followers":"me/friends","me/share":"me/feed","me/like":"me/likes","me/files":"me/albums","me/albums":"me/albums?fields=cover_photo,name","me/album":"@{id}/photos?fields=picture","me/photos":"me/photos","me/photo":"@{id}","friend/albums":"@{id}/albums","friend/photos":"@{id}/photos"},post:{"me/share":"me/feed","me/photo":"@{id}"},wrap:{me:t,"me/friends":e,"me/following":e,"me/followers":e,"me/albums":n,"me/photos":n,"me/files":n,default:n},xhr:function(e,t){return"get"!==e.method&&"post"!==e.method||(t.suppress_response_codes=!0),"post"===e.method&&e.data&&"string"==typeof e.data.file&&(e.data.file=a.utils.toBlob(e.data.file)),!0},jsonp:function(e,t){var n=e.method;"get"===n||a.utils.hasBinary(e.data)?"delete"===e.method&&(t.method="delete",e.method="post"):(e.data.method=n,e.method="get")},form:function(e){return{callbackonload:!0}}}});var r="https://graph.facebook.com/";function t(e){return e.id&&(e.thumbnail=e.picture="https://graph.facebook.com/"+e.id+"/picture"),e}function e(e){return"data"in e&&e.data.forEach(t),e}function n(e,t,n){var o,i;return"boolean"==typeof e&&(e={success:e}),e&&"data"in e&&(o=n.query.access_token,e.data instanceof Array||(i=e.data,delete e.data,e.data=[i]),e.data.forEach(function(e){e.picture&&(e.thumbnail=e.picture),e.pictures=(e.images||[]).sort(function(e,t){return e.width-t.width}),e.cover_photo&&e.cover_photo.id&&(e.thumbnail=r+e.cover_photo.id+"/picture?access_token="+o),"album"===e.type&&(e.files=e.photos=r+e.id+"/photos"),e.can_upload&&(e.upload_location=r+e.id+"/photos")})),e}}(hello),function(r){function s(e,t,n){var o=(n?"":"flickr:")+"?method="+e+"&api_key="+r.services.flickr.id+"&format=json";for(var i in t)t.hasOwnProperty(i)&&(o+="&"+i+"="+t[i]);return o}function e(i,a){return a=a||{},function(e,t){var n,o;n=function(e){a.user_id=e,t(s(i,a,!0))},o=r.getAuthResponse("flickr"),n(o&&o.user_nsid?o.user_nsid:null)}}function o(e,t){var n="https://www.flickr.com/images/buddyicon.gif";return e.nsid&&e.iconserver&&e.iconfarm&&(n="https://farm"+e.iconfarm+".staticflickr.com/"+e.iconserver+"/buddyicons/"+e.nsid+(t?"_"+t:"")+".jpg"),n}function a(e,t,n,o,i){return"https://farm"+t+".staticflickr.com/"+n+"/"+e+"_"+o+(i=i?"_"+i:"")+".jpg"}function i(e){e&&e.stat&&"ok"!=e.stat.toLowerCase()&&(e.error={code:"invalid_request",message:e.message})}function t(e){if(e.photoset||e.photos){u(e=l(e,"photoset"in e?"photoset":"photos")),e.data=e.photo,delete e.photo;for(var t=0;t<e.data.length;t++){var n=e.data[t];n.name=n.title,n.picture=a(n.id,n.farm,n.server,n.secret,""),n.pictures=function(t,n,o,i){return[{id:"t",max:100},{id:"m",max:240},{id:"n",max:320},{id:"",max:500},{id:"z",max:640},{id:"c",max:800},{id:"b",max:1024},{id:"h",max:1600},{id:"k",max:2048},{id:"o",max:2048}].map(function(e){return{source:a(t,n,o,i,e.id),width:e.max,height:e.max}})}(n.id,n.farm,n.server,n.secret),n.source=a(n.id,n.farm,n.server,n.secret,"b"),n.thumbnail=a(n.id,n.farm,n.server,n.secret,"m")}}return e}function l(e,t){return t in e?e=e[t]:"error"in e||(e.error={code:"invalid_request",message:e.message||"Failed to get data from Flickr"}),e}function n(e){if(i(e),e.contacts){u(e=l(e,"contacts")),e.data=e.contact,delete e.contact;
1for(var t=0;t<e.data.length;t++){var n=e.data[t];n.id=n.nsid,n.name=n.realname||n.username,n.thumbnail=o(n,"m")}}return e}function u(e){e.page&&e.pages&&e.page!==e.pages&&(e.paging={next:"?page="+ ++e.page})}r.init({flickr:{name:"Flickr",oauth:{version:"1.0a",auth:"https://www.flickr.com/services/oauth/authorize?perms=read",request:"https://www.flickr.com/services/oauth/request_token",token:"https://www.flickr.com/services/oauth/access_token"},base:"https://api.flickr.com/services/rest",get:{me:e("flickr.people.getInfo"),"me/friends":e("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/following":e("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/followers":e("flickr.contacts.getList",{per_page:"@{limit|50}"}),"me/albums":e("flickr.photosets.getList",{per_page:"@{limit|50}"}),"me/album":e("flickr.photosets.getPhotos",{photoset_id:"@{id}"}),"me/photos":e("flickr.people.getPhotos",{per_page:"@{limit|50}"})},wrap:{me:function(e){var t;return i(e),(e=l(e,"person")).id&&(e.realname&&(e.name=e.realname._content,t=e.name.split(" "),e.first_name=t.shift(),e.last_name=t.join(" ")),e.thumbnail=o(e,"l"),e.picture=o(e,"l")),e},"me/friends":n,"me/followers":n,"me/following":n,"me/albums":function(e){return i(e),u(e=l(e,"photosets")),e.photoset&&(e.data=e.photoset,e.data.forEach(function(e){e.name=e.title._content,e.photos="https://api.flickr.com/services/rest"+s("flickr.photosets.getPhotos",{photoset_id:e.id},!0)}),delete e.photoset),e},"me/photos":function(e){return i(e),t(e)},default:function(e){return i(e),t(e)}},xhr:!1,jsonp:function(e,t){"get"==e.method&&(delete t.callback,t.jsoncallback=e.callbackID)}}})}(hello),function(){function t(e){!e.meta||400!==e.meta.code&&401!==e.meta.code||(e.error={code:"access_denied",message:e.meta.errorDetail})}function n(e){e&&e.id&&(e.thumbnail=e.photo.prefix+"100x100"+e.photo.suffix,e.name=e.firstName+" "+e.lastName,e.first_name=e.firstName,e.last_name=e.lastName,e.contact&&e.contact.email&&(e.email=e.contact.email))}function e(e,t){var n=t.access_token;return delete t.access_token,t.oauth_token=n,t.v=20121125,!0}hello.init({foursquare:{name:"Foursquare",oauth:{version:2,auth:"https://foursquare.com/oauth2/authenticate",grant:"https://foursquare.com/oauth2/access_token"},refresh:!0,base:"https://api.foursquare.com/v2/",get:{me:"users/self","me/friends":"users/self/friends","me/followers":"users/self/friends","me/following":"users/self/friends"},wrap:{me:function(e){return t(e),e&&e.response&&n(e=e.response.user),e},default:function(e){return t(e),e&&"response"in e&&"friends"in e.response&&"items"in e.response.friends&&(e.data=e.response.friends.items,e.data.forEach(n),delete e.response),e}},xhr:e,jsonp:e}})}(),function(){function o(e,t){var n=t?t.statusCode:e&&"meta"in e&&"status"in e.meta&&e.meta.status;401!==n&&403!==n||(e.error={code:"access_denied",message:e.message||(e.data?e.data.message:"Could not get response")},delete e.message)}function i(e){e.id&&(e.thumbnail=e.picture=e.avatar_url,e.name=e.login)}hello.init({github:{name:"GitHub",oauth:{version:2,auth:"https://github.com/login/oauth/authorize",grant:"https://github.com/login/oauth/access_token",response_type:"code"},scope:{email:"user:email"},base:"https://api.github.com/",get:{me:"user","me/friends":"user/following?per_page=@{limit|100}","me/following":"user/following?per_page=@{limit|100}","me/followers":"user/followers?per_page=@{limit|100}","me/like":"user/starred?per_page=@{limit|100}"},wrap:{me:function(e,t){return o(e,t),i(e),e},default:function(e,t,n){return o(e,t),Array.isArray(e)&&(e={data:e}),e.data&&(function(e,t){{var n;e.data&&e.data.length&&t&&t.Link&&((n=t.Link.match(/<(.*?)>;\s*rel=\"next\"/))&&(e.paging={next:n[1]}))}}(e,t),e.data.forEach(i)),e}},xhr:function(e){return"get"!==e.method&&e.data&&(e.headers=e.headers||{},e.headers["Content-Type"]="application/json","object"==typeof e.data&&(e.data=JSON.stringify(e.data))),!0}}})}(),function(t){var e="https://www.google.com/m8/feeds/contacts/default/full?v=3.0&alt=json&max-results=@{limit|1000}&start-index=@{start|1}";function o(e){return parseInt(e,10)}function n(e){return u(e),e.data=e.items,delete e.items,e}function i(e){if(!e.error)return e.name||(e.name=e.title||e.message),e.picture||(e.picture=e.thumbnailLink),e.thumbnail||(e.thumbnail=e.thumbnailLink),"application/vnd.google-apps.folder"===e.mimeType&&(e.type="folder",e.files="https://www.googleapis.com/drive/v2/files?q=%22"+e.id+"%22+in+parents"),e}
1function c(e){return{source:e.url,width:e.width,height:e.height}}function a(e){if(u(e),"feed"in e&&"entry"in e.feed)e.data=e.feed.entry.map(l),delete e.feed;else{if("entry"in e)return l(e.entry);"items"in e?(e.data=e.items.map(i),delete e.items):i(e)}return e}function r(e){e.name=e.displayName||e.name,e.picture=e.picture||(e.image?e.image.url:null),e.thumbnail=e.picture}function s(e,t,n){u(e);if("feed"in e&&"entry"in e.feed){for(var o=n.query.access_token,i=0;i<e.feed.entry.length;i++){var a,r=e.feed.entry[i];r.id=r.id.$t,r.name=r.title.$t,delete r.title,r.gd$email&&(r.email=r.gd$email&&0<r.gd$email.length?r.gd$email[0].address:null,r.emails=r.gd$email,delete r.gd$email),r.updated&&(r.updated=r.updated.$t),r.link&&((a=0<r.link.length?r.link[0].href:null)&&r.link[0].gd$etag&&(a+=(-1<a.indexOf("?")?"&":"?")+"access_token="+o,r.picture=a,r.thumbnail=a),delete r.link),r.category&&delete r.category}e.data=e.feed.entry,delete e.feed}return e}function l(e){var t,n=e.media$group,o=n.media$content.length?n.media$content[0]:{},i=n.media$content||[],a=n.media$thumbnail||[],r=i.concat(a).map(c).sort(function(e,t){return e.width-t.width}),s=0,l={id:e.id.$t,name:e.title.$t,description:e.summary.$t,updated_time:e.updated.$t,created_time:e.published.$t,picture:o?o.url:null,pictures:r,images:[],thumbnail:o?o.url:null,width:o.width,height:o.height};if("link"in e)for(s=0;s<e.link.length;s++){var u=e.link[s];if(u.rel.match(/\#feed$/)){l.upload_location=l.files=l.photos=u.href;break}}if("category"in e&&e.category.length)for(t=e.category,s=0;s<t.length;s++)t[s].scheme&&t[s].scheme.match(/\#kind$/)&&(l.type=t[s].term.replace(/^.*?\#/,""));return"media$thumbnail"in n&&n.media$thumbnail.length&&(t=n.media$thumbnail,l.thumbnail=t[0].url,l.images=t.map(c)),(t=n.media$content)&&t.length&&l.images.push(c(t[0])),l}function u(e){var t,n;"feed"in e&&e.feed.openSearch$itemsPerPage?(t=o(e.feed.openSearch$itemsPerPage.$t),(n=o(e.feed.openSearch$startIndex.$t))+t<o(e.feed.openSearch$totalResults.$t)&&(e.paging={next:"?start="+(n+t)})):"nextPageToken"in e&&(e.paging={next:"?pageToken="+e.nextPageToken})}function d(){var n=[],t=(1e10*Math.random()).toString(32),a=0,r="\r\n",o=r+"--"+t,i=function(){},s=/^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i;function l(e,t){n.push(r+"Content-Type: "+t+r+r+e),a--,i()}this.append=function(e,t){"string"!=typeof e&&"length"in Object(e)||(e=[e]);for(var n=0;n<e.length;n++){a++;var o,i=e[n];"undefined"!=typeof File&&i instanceof File||"undefined"!=typeof Blob&&i instanceof Blob?function(t){var e=new FileReader;e.onload=function(e){l(btoa(e.target.result),t.type+r+"Content-Transfer-Encoding: base64")},e.readAsBinaryString(t)}(i):"string"==typeof i&&i.match(s)?(o=i.match(s),l(i.replace(s,""),o[1]+r+"Content-Transfer-Encoding: base64")):l(i,t)}},this.onready=function(e){(i=function(){0===a&&(n.unshift(""),n.push("--"),e(n.join(o),t),n=[])})()}}function p(n,o){var e,t,i={};n.data&&"undefined"!=typeof HTMLInputElement&&n.data instanceof HTMLInputElement&&(n.data={file:n.data}),!n.data.name&&Object(Object(n.data.file).files).length&&"post"===n.method&&(n.data.name=n.data.file.files[0].name),"post"===n.method?n.data={title:n.data.name,parents:[{id:n.data.parent||"root"}],file:n.data.file}:(i=n.data,n.data={},i.parent&&(n.data.parents=[{id:n.data.parent||"root"}]),i.file&&(n.data.file=i.file),i.name&&(n.data.title=i.name)),"file"in n.data&&(e=n.data.file,delete n.data.file,"object"==typeof e&&"files"in e&&(e=e.files),!e||!e.length)?o({error:{code:"request_invalid",message:"There were no files attached with this request to upload"}}):((t=new d).append(JSON.stringify(n.data),"application/json"),e&&t.append(e),t.onready(function(e,t){n.headers["content-type"]='multipart/related; boundary="'+t+'"',n.data=e,o("upload/drive/v2/files"+(i.id?"/"+i.id:"")+"?uploadType=multipart")}))}t.init({google:{name:"Google Plus",oauth:{version:2,auth:"https://accounts.google.com/o/oauth2/auth",grant:"https://accounts.google.com/o/oauth2/token"},scope:{basic:"https://www.googleapis.com/auth/plus.me profile",email:"email",birthday:"",events:"",photos:"https://picasaweb.google.com/data/",videos:"http://gdata.youtube.com",friends:"https://www.google.com/m8/feeds, https://www.googleapis.com/auth/plus.login",files:"https://www.googleapis.com/auth/drive.readonly",publish:"",publish_files:"https://www.googleapis.com/auth/drive",share:"",create_event:"",offline_access:""},scope_delim:" ",login:function(e){"code"===e.qs.response_type&&(e.qs.access_type="offline"),e.options.force&&(e.qs.approval_prompt="force")},base:"https://www.googleapis.com/",get:{me:"plus/v1/people/me","me/friends":"plus/v1/people/me/people/visible?maxResults=@{limit|100}","me/following":e,"me/followers":e,"me/contacts":e,"me/share":"plus/v1/people/me/activities/public?maxResults=@{limit|100}","me/feed":"plus/v1/people/me/activities/public?maxResults=@{limit|100}","me/albums":"https://picasaweb.google.com/data/feed/api/user/default?alt=json&max-results=@{limit|100}&start-index=@{start|1}","me/album":function(e,t){var n=e.query.id;delete e.query.id,t(n.replace("/entry/","/feed/"))},"me/photos":"https://picasaweb.google.com/data/feed/api/user/default?alt=json&kind=photo&max-results=@{limit|100}&start-index=@{start|1}","me/file":"drive/v2/files/@{id}","me/files":"drive/v2/files?q=%22@{parent|root}%22+in+parents+and+trashed=false&maxResults=@{limit|100}","me/folders":"drive/v2/files?q=%22@{id|root}%22+in+parents+and+mimeType+=+%22application/vnd.google-apps.folder%22+and+trashed=false&maxResults=@{limit|100}","me/folder":"drive/v2/files?q=%22@{id|root}%22+in+parents+and+trashed=false&maxResults=@{limit|100}"},post:{"me/files":p,"me/folders":function(e,t){e.data={title:e.data.name,parents:[{id:e.data.parent||"root"}],mimeType:"application/vnd.google-apps.folder"},t("drive/v2/files")}},put:{"me/files":p},del:{"me/files":"drive/v2/files/@{id}","me/folder":"drive/v2/files/@{id}"},patch:{"me/file":"drive/v2/files/@{id}"},wrap:{me:function(e){return e.id&&(e.last_name=e.family_name||(e.name?e.name.familyName:null),e.first_name=e.given_name||(e.name?e.name.givenName:null),e.emails&&e.emails.length&&(e.email=e.emails[0].value),r(e)),e},"me/friends":function(e){return e.items&&(u(e),e.data=e.items,e.data.forEach(r),delete e.items),e},"me/contacts":s,"me/followers":s,"me/following":s,"me/share":n,"me/feed":n,"me/albums":a,"me/photos":function(e){e.data=e.feed.entry.map(l),delete e.feed},default:a},xhr:function(e){return"post"===e.method||"put"===e.method?function(e){if("object"==typeof e.data)try{e.data=JSON.stringify(e.data),e.headers["content-type"]="application/json"}catch(e){}}(e):"patch"===e.method&&(t.utils.extend(e.query,e.data),e.data=null),!0},form:!1}})}(hello),function(){function t(e){return"string"==typeof e?{error:{code:"invalid_request",message:e}}:(e&&"meta"in e&&"error_type"in e.meta&&(e.error={code:e.meta.error_type,message:e.meta.error_message}),e)}function e(e){return o(e),e&&"data"in e&&e.data.forEach(n),e}function n(e){e.id&&(e.thumbnail=e.profile_picture,e.name=e.full_name||e.username)}function o(e){"pagination"in e&&(e.paging={next:e.pagination.next_url},delete e.pagination)}hello.init({instagram:{name:"Instagram",oauth:{version:2,auth:"https://instagram.com/oauth/authorize/",grant:"https://api.instagram.com/oauth/access_token"},refresh:!0,scope:{basic:"basic",photos:"",friends:"relationships",publish:"likes comments",email:"",share:"",publish_files:"",files:"",videos:"",offline_access:""},scope_delim:" ",base:"https://api.instagram.com/v1/",get:{me:"users/self","me/feed":"users/self/feed?count=@{limit|100}
1","me/photos":"users/self/media/recent?min_id=0&count=@{limit|100}","me/friends":"users/self/follows?count=@{limit|100}","me/following":"users/self/follows?count=@{limit|100}","me/followers":"users/self/followed-by?count=@{limit|100}","friend/photos":"users/@{id}/media/recent?min_id=0&count=@{limit|100}"},post:{"me/like":function(e,t){var n=e.data.id;e.data={},t("media/"+n+"/likes")}},del:{"me/like":"media/@{id}/likes"},wrap:{me:function(e){return t(e),"data"in e&&(e.id=e.data.id,e.thumbnail=e.data.profile_picture,e.name=e.data.full_name||e.data.username),e},"me/friends":e,"me/following":e,"me/followers":e,"me/photos":function(e){return t(e),o(e),"data"in e&&(e.data=e.data.filter(function(e){return"image"===e.type}),e.data.forEach(function(o){o.name=o.caption?o.caption.text:null,o.thumbnail=o.images.thumbnail.url,o.picture=o.images.standard_resolution.url,o.pictures=Object.keys(o.images).map(function(e){var t,n=o.images[e];return{source:(t=n).url,width:t.width,height:t.height}}).sort(function(e,t){return e.width-t.width})})),e},default:function(e){return o(e=t(e)),e}},xhr:function(e,t){var n=e.method,o="get"!==n;return o&&("post"!==n&&"put"!==n||!e.query.access_token||(e.data.access_token=e.query.access_token,delete e.query.access_token),e.proxy=o),o},form:!1}})}(),function(){function n(e,t){var n,o;return e&&"Message"in e&&(o=e.Message,delete e.Message,"ErrorCode"in e?(n=e.ErrorCode,delete e.ErrorCode):n=function(e){switch(e.statusCode){case 400:return"invalid_request";case 403:return"stale_token";case 401:return"invalid_token";case 500:default:return"server_error"}}(t),e.error={code:n,message:o,details:e}),e}hello.init({joinme:{name:"join.me",oauth:{version:2,auth:"https://secure.join.me/api/public/v1/auth/oauth2",grant:"https://secure.join.me/api/public/v1/auth/oauth2"},refresh:!1,scope:{basic:"user_info",user:"user_info",scheduler:"scheduler",start:"start_meeting",email:"",friends:"",share:"",publish:"",photos:"",publish_files:"",files:"",videos:"",offline_access:""},scope_delim:" ",login:function(e){e.options.popup.width=400,e.options.popup.height=700},base:"https://api.join.me/v1/",get:{me:"user",meetings:"meetings","meetings/info":"meetings/@{id}"},post:{"meetings/start/adhoc":function(e,t){t("meetings/start")},"meetings/start/scheduled":function(e,t){var n=e.data.meetingId;e.data={},t("meetings/"+n+"/start")},"meetings/schedule":function(e,t){t("meetings")}},patch:{"meetings/update":function(e,t){t("meetings/"+e.data.meetingId)}},del:{"meetings/delete":"meetings/@{id}"},wrap:{me:function(e,t){return n(e,t),e.email&&(e.name=e.fullName,e.first_name=e.name.split(" ")[0],e.last_name=e.name.split(" ")[1],e.id=e.email),e},default:function(e,t){return n(e,t),e}},xhr:function(e,t){var n=t.access_token;delete t.access_token,e.headers.Authorization="Bearer "+n,"get"!==e.method&&e.data&&(e.headers["Content-Type"]="application/json","object"==typeof e.data&&(e.data=JSON.stringify(e.data)));"put"===e.method&&(e.method="patch");return!0}}})}(),function(){function i(e){e&&"errorCode"in e&&(e.error={code:e.status,message:e.message})}function t(e){if(!e.error)return e.first_name=e.firstName,e.last_name=e.lastName,e.name=e.formattedName||e.first_name+" "+e.last_name,e.thumbnail=e.pictureUrl,e.email=e.emailAddress,e}function e(e){return i(e),a(e),e.values&&(e.data=e.values.map(t),delete e.values),e}function a(e){"_count"in e&&"_start"in e&&e._count+e._start<e._total&&(e.paging={next:"?start="+(e._start+e._count)+"&count="+e._count})}function n(e){e.access_token&&(e.oauth2_access_token=e.access_token,delete e.access_token)}function o(e,t){e.headers["x-li-format"]="json";var n=e.data.id;e.data=("delete"!==e.method).toString(),e.method="put",t("people/~/network/updates/key="+n+"/is-liked")}hello.init({linkedin:{oauth:{version:2,response_type:"code",auth:"https://www.linkedin.com/uas/oauth2/authorization",grant:"https://www.linkedin.com/uas/oauth2/accessToken"},refresh:!0,scope:{basic:"r_basicprofile",email:"r_emailaddress",files:"",friends:"",photos:"",publish:"w_share",publish_files:"w_share",share:"",videos:"",offline_access:""},scope_delim:" ",base:"https://api.linkedin.com/v1/",get:{me:"people/~:(picture-url,first-name,last-name,id,formatted-name,email-address)","me/share":"people/~/network/updates?count=@{limit|250}"},post:{"me/share":function(e,t){var n={visibility:{code:"anyone"}};e.data.id?n.attribution={share:{id:e.data.id}}:(n.comment=e.data.message,e.data.picture&&e.data.link&&(n.content={"submitted-url":e.data.link,"submitted-image-url":e.data.picture})),e.data=JSON.stringify(n),t("people/~/shares?format=json")},"me/like":o},del:{"me/like":o},wrap:{me:function(e){return i(e),t(e),e},"me/friends":e,"me/following":e,"me/followers":e,"me/share":function(e){return i(e),a(e),e.values&&(e.data=e.values.map(t),e.data.forEach(function(e){e.message=e.headline}),delete e.values),e},default:function(e,t){var n,o;i(e),n=e,o=t,"{}"===JSON.stringify(n)&&200===o.statusCode&&(n.success=!0),a(e)}},jsonp:function(e,t){n(t),"get"===e.method&&(t.format="jsonp",t["error-callback"]=e.callbackID)},xhr:function(e,t){return"get"!==e.method&&(n(t),e.headers["Content-Type"]="application/json",e.headers["x-li-format"]="json",e.proxy=!0)}}})}(),function(){function e(e,t){var n=t.access_token;return delete t.access_token,t.oauth_token=n,t["_status_code_map[302]"]=200,!0}function n(e){return e.id&&(e.picture=e.avatar_url,e.thumbnail=e.avatar_url,e.name=e.username||e.full_name),e}hello.init({soundcloud:{name:"SoundCloud",oauth:{version:2,auth:"https://soundcloud.com/connect",grant:"https://soundcloud.com/oauth2/token"},base:"https://api.soundcloud.com/",get:{me:"me.json","me/friends":"me/followings.json","me/followers":"me/followers.json","me/following":"me/followings.json",default:function(e,t){t(e.path+".json")}},wrap:{me:function(e){return n(e),e},default:function(e){var t;return Array.isArray(e)&&(e={data:e.map(n)}),"next_href"in(t=e)&&(t.paging={next:t.next_href}),e}},xhr:e,jsonp:e}})}(),function(i){var e="https://api.twitter.com/";function t(e){var t;return e.id&&(e.name&&(t=e.name.split(" "),e.first_name=t.shift(),e.last_name=t.join(" ")),e.thumbnail=e.profile_image_url_https||e.profile_image_url),e}function n(e){return o(e),a(e),e.users&&(e.data=e.users.map(t),delete e.users),e}function o(e){var t;e.errors&&(t=e.errors[0],e.error={code:"request_failed",message:t.message})}function a(e){"next_cursor_str"in e&&(e.paging={next:"?cursor="+e.next_cursor_str})}i.init({twitter:{oauth:{version:"1.0a",auth:e+"oauth/authenticate",request:e+"oauth/request_token",token:e+"oauth/access_token"},login:function(e){var t="?force_login=true";this.oauth.auth=this.oauth.auth.replace(t,"")+(e.options.force?t:"")},base:e+"1.1/",get:{me:"account/verify_credentials.json","me/friends":"friends/list.json?count=@{limit|200}","me/following":"friends/list.json?count=@{limit|200}","me/followers":"followers/list.json?count=@{limit|200}","me/share":"statuses/user_timeline.json?count=@{limit|200}","me/like":"favorites/list.json?count=@{limit|200}"},post:{"me/share":function(e,t){var n=e.data;e.data=null;var o=[];n.message&&(o.push(n.message),delete n.message),n.link&&(o.push(n.link),delete n.link),n.picture&&(o.push(n.picture),delete n.picture),o.length&&(n.status=o.join(" ")),n.file?(n["media[]"]=n.file,delete n.file,e.data=n,t("statuses/update_with_media.json")):"id"in n?t("statuses/retweet/"+n.id+".json"):(i.utils.extend(e.query,n),t("statuses/update.json?include_entities=1"))}
1,"me/like":function(e,t){var n=e.data.id;e.data=null,t("favorites/create.json?id="+n)}},del:{"me/like":function(){p.method="post";var e=p.data.id;p.data=null,callback("favorites/destroy.json?id="+e)}},wrap:{me:function(e){return o(e),t(e),e},"me/friends":n,"me/followers":n,"me/following":n,"me/share":function(e){return o(e),a(e),!e.error&&"length"in e?{data:e}:e},default:function(e){var t;return t=e,a(e=Array.isArray(t)?{data:t}:t),e}},xhr:function(e){return"get"!==e.method}}})}(hello),hello.init({vk:{name:"Vk",oauth:{version:2,auth:"https://oauth.vk.com/authorize",grant:"https://oauth.vk.com/access_token"},scope:{email:"email",friends:"friends",photos:"photos",videos:"video",share:"share",offline_access:"offline"},refresh:!0,login:function(e){e.qs.display=window.navigator&&window.navigator.userAgent&&/ipad|phone|phone|android/.test(window.navigator.userAgent.toLowerCase())?"mobile":"popup"},base:"https://api.vk.com/method/",get:{me:function(e,t){e.query.fields="id,first_name,last_name,photo_max",t("users.get")}},wrap:{me:function(e,t,n){return function(e){{var t;e.error&&(t=e.error,e.error={code:t.error_code,message:t.error_msg})}}(e),function(e,t){null!==e&&"response"in e&&null!==e.response&&e.response.length&&((e=e.response[0]).id=e.uid,e.thumbnail=e.picture=e.photo_max,e.name=e.first_name+" "+e.last_name,t.authResponse&&null!==t.authResponse.email&&(e.email=t.authResponse.email));return e}(e,n)}},xhr:!1,jsonp:!0,form:!1}}),function(t){function e(e){return"data"in e&&e.data.forEach(function(e){e.picture&&(e.thumbnail=e.picture),e.images&&(e.pictures=e.images.map(n).sort(function(e,t){return e.width-t.width}))}),e}function n(e){return{width:e.width,height:e.height,source:e.source}}function o(e,t,n){var o,i;return e.id&&(o=n.query.access_token,e.emails&&(e.email=e.emails.preferred),!1!==e.is_friend&&(i=e.user_id||e.id,e.thumbnail=e.picture="https://apis.live.net/v5.0/"+i+"/picture?access_token="+o)),e}function i(e,t,n){return"data"in e&&e.data.forEach(function(e){o(e,0,n)}),e}t.init({windows:{name:"Windows live",oauth:{version:2,auth:"https://login.live.com/oauth20_authorize.srf",grant:"https://login.live.com/oauth20_token.srf"},refresh:!0,logout:function(){return"http://login.live.com/oauth20_logout.srf?ts="+(new Date).getTime()},scope:{basic:"wl.signin,wl.basic",email:"wl.emails",birthday:"wl.birthday",events:"wl.calendars",photos:"wl.photos",videos:"wl.photos",friends:"wl.contacts_emails",files:"wl.skydrive",publish:"wl.share",publish_files:"wl.skydrive_update",share:"wl.share",create_event:"wl.calendars_update,wl.events_create",offline_access:"wl.offline_access"},base:"https://apis.live.net/v5.0/",get:{me:"me","me/friends":"me/friends","me/following":"me/contacts","me/followers":"me/friends","me/contacts":"me/contacts","me/albums":"me/albums","me/album":"@{id}/files","me/photo":"@{id}","me/files":"@{parent|me/skydrive}/files","me/folders":"@{id|me/skydrive}/files","me/folder":"@{id|me/skydrive}/files"},post:{"me/albums":"me/albums","me/album":"@{id}/files/","me/folders":"@{id|me/skydrive/}","me/files":"@{parent|me/skydrive}/files"},del:{"me/album":"@{id}","me/photo":"@{id}","me/folder":"@{id}","me/files":"@{id}"},wrap:{me:o,"me/friends":i,"me/contacts":i,"me/followers":i,"me/following":i,"me/albums":function(e){"data"in e&&e.data.forEach(function(e){e.photos=e.files="https://apis.live.net/v5.0/"+e.id+"/photos"});return e},"me/photos":e,default:e},xhr:function(e){return"get"===e.method||"delete"===e.method||t.utils.hasBinary(e.data)||("string"==typeof e.data.file?e.data.file=t.utils.toBlob(e.data.file):(e.data=JSON.stringify(e.data),e.headers={"Content-Type":"application/json"})),!0},jsonp:function(e){"get"===e.method||t.utils.hasBinary(e.data)||(e.data.method=e.method,e.method="get")}}})}(hello),function(){function o(e){e&&"meta"in e&&"error_type"in e.meta&&(e.error={code:e.meta.error_type,message:e.meta.error_message})}function e(e,t,n){return o(e),a(e,0,n),e.query&&e.query.results&&e.query.results.contact&&(e.data=e.query.results.contact,delete e.query,Array.isArray(e.data)||(e.data=[e.data]),e.data.forEach(i)),e}function i(t){t.id=null,!t.fields||t.fields instanceof Array||(t.fields=[t.fields]),(t.fields||[]).forEac
1h(function(e){"email"===e.type&&(t.email=e.value),"name"===e.type&&(t.first_name=e.value.givenName,t.last_name=e.value.familyName,t.name=e.value.givenName+" "+e.value.familyName),"yahooid"===e.type&&(t.id=e.value)})}function a(e,t,n){return e.query&&e.query.count&&n.options&&(e.paging={next:"?start="+(e.query.count+(+n.options.start||1))}),e}function t(e){return"https://query.yahooapis.com/v1/yql?q="+(e+" limit @{limit|100} offset @{start|0}").replace(/\s/g,"%20")+"&format=json"}hello.init({yahoo:{oauth:{version:"1.0a",auth:"https://api.login.yahoo.com/oauth/v2/request_auth",request:"https://api.login.yahoo.com/oauth/v2/get_request_token",token:"https://api.login.yahoo.com/oauth/v2/get_token"},login:function(e){e.options.popup.width=560;try{delete e.qs.state.scope}catch(e){}},base:"https://social.yahooapis.com/v1/",get:{me:t("select * from social.profile(0) where guid=me"),"me/friends":t("select * from social.contacts(0) where guid=me"),"me/following":t("select * from social.contacts(0) where guid=me")},wrap:{me:function(e){{var t;o(e),e.query&&e.query.results&&e.query.results.profile&&((e=e.query.results.profile).id=e.guid,e.last_name=e.familyName,e.first_name=e.givenName||e.nickname,t=[],e.first_name&&t.push(e.first_name),e.last_name&&t.push(e.last_name),e.name=t.join(" "),e.email=e.emails&&e.emails[0]?e.emails[0].handle:null,e.thumbnail=e.image?e.image.imageUrl:null)}return e},"me/friends":e,"me/following":e,default:a}}})}(),"function"==typeof define&&define.amd&&define(function(){return hello}),"object"==typeof module&&module.exports&&(module.exports=hello);
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.