You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
17 KiB

!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1506)}({1506:function(t,e,r){"use strict";r.r(e);var n=r(33),o=r.n(n),i=r(52),a=r.n(i),u=r(243);function s(){document.cookie="riot_mobile_redirect_to_guide=false;path=/;max-age=14400",window.location.href="../"}function c(t){t="<h2>Error loading Riot</h2><p>".concat(t,"</p><p>").concat("If this is unexpected, please contact your system administrator or technical support representative.","</p>");var e=document.getElementsByClassName("mx_HomePage_container"),r=document.getElementsByClassName("mx_HomePage_errorContainer"),n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){a.value.innerHTML=""}}catch(t){o=!0,i=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}var s=!0,c=!1,l=void 0;try{for(var f,d=r[Symbol.iterator]();!(s=(f=d.next()).done);s=!0){var h=f.value;h.style.display="block",h.innerHTML=t}}catch(t){c=!0,l=t}finally{try{s||null==d.return||d.return()}finally{if(c)throw l}}}function l(){return(l=a()(o.a.mark((function t(){var e,r,n,i,a,l,f,d,h,p;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return document.getElementById("back_to_riot_button").onclick=s,t.next=3,Object(u.a)("..");case 3:if(e=t.sent,r=e.default_server_config,n=e.default_server_name,i=e.default_hs_url,a=e.default_is_url,!((l=[r,n,i].filter((function(t){return!!t}))).length>1)){t.next=11;break}return t.abrupt("return",c("Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url."));case 11:if(!(l.length<1)){t.next=13;break}return t.abrupt("return",c("Invalid configuration: no default server specified."));case 13:if(f="",d="",r&&r["m.homeserver"]&&(f=r["m.homeserver"].base_url,r["m.identity_server"]&&(d=r["m.identity_server"].base_url)),!n){t.next=31;break}return t.prev=17,t.next=20,fetch("https://".concat(n,"/.well-known/matrix/client"));case 20:return h=t.sent,t.next=23,h.json();case 23:(p=t.sent)&&p["m.homeserver"]&&(f=p["m.homeserver"].base_url,p["m.identity_server"]&&(d=p["m.identity_server"].base_url)),t.next=31;break;case 27:return t.prev=27,t.t0=t.catch(17),console.error(t.t0),t.abrupt("return",c("Unable to fetch homeserver configuration"));case 31:if(i&&(f=i,d=a),f){t.next=34;break}return t.abrupt("return",c("Unable to locate homeserver"));case 34:f&&!f.endsWith("/")&&(f+="/"),d&&!d.endsWith("/")&&(d+="/"),"https://matrix.org/"!==f&&(document.getElementById("configure_riot_button").href="https://riot.im/config/config?hs_url="+encodeURIComponent(f)+"&is_url="+encodeURIComponent(d),document.getElementById("step1_heading").innerHTML="1: Install the app",document.getElementById("step2_container").style.display="block",document.getElementById("hs_url").innerText=f,d&&(document.getElementById("custom_is").style.display="block",document.getElementById("is_url").style.display="block",document.getElementById("is_url").innerText=d));case 37:case"end":return t.stop()}}),t,null,[[17,27]])})))).apply(this,arguments)}!function(){l.apply(this,arguments)}()},186:function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r,n){var o=e&&e.prototype instanceof l?e:l,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=b(a,r);if(u){if(u===c)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=s(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var c={};function l(){}function f(){}function d(){}var h={};h[o]=function(){return this};var p=Object.getPrototypeOf,y=p&&p(p(E([])));y&&y!==e&&r.call(y,o)&&(h=y);var m=d.prototype=l.prototype=Object.create(h);function v(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function g(t){var e;this._invoke=function(n,o){function i(){return new Promise((function(e,i){!function e(n,o,i,a){var u=s(t[n],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then((function(t){e("next",t,i,a)}),(function(t){e("throw",t,i,a)})):Promise.resolve(l).then((function(t){c.value=t,i(c)}),(function(t){return e("throw",t,i,a)}))}a(u.arg)}(n,o,e,i)}))}return e=e?e.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return f.prototype=m.constructor=d,d.constructor=f,d[a]=f.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},v(g.prototype),g.prototype[i]=function(){return this},t.AsyncIterator=g,t.async=function(e,r,n,o){var i=new g(u(e,r,n,o));return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},v(m),m[a]="Generator",m[o]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},243:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(33),o=r.n(n),i=r(52),a=r.n(i),u=r(69),s=r.n(u);function c(t){return l.apply(this,arguments)}function l(){return(l=a()(o.a.mark((function t(e){var r;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e=""),""===e||e.endsWith("/")||(e+="/"),t.prev=2,t.next=5,f("".concat(e,"config.").concat(document.domain,".json"));case 5:if(r=t.sent,0!==Object.keys(r).length){t.next=8;break}throw new Error;case 8:return t.abrupt("return",r);case 11:return t.prev=11,t.t0=t.catch(2),t.next=15,f(e+"config.json");case 15:return t.abrupt("return",t.sent);case 16:case"end":return t.stop()}}),t,null,[[2,11]])})))).apply(this,arguments)}function f(t){return new Promise((function(e,r){s()({method:"GET",url:t,qs:{cachebuster:Date.now()}},(function(t,n,o){try{if(t||n.status<200||n.status>=300)return n&&(404==n.status||0==n.status&&""==o)&&e({}),void r({err:t,response:n});e(JSON.parse(o))}catch(t){r({err:t})}}))}))}},33:function(t,e,r){t.exports=r(186)},52:function(t,e){function r(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function u(t){r(a,o,i,u,s,"next",t)}function s(t){r(a,o,i,u,s,"throw",t)}u(void 0)}))}}},69:function(t,e,r){var n,o,i;o=[],void 0===(i="function"==typeof(n=function(){var t=XMLHttpRequest;if(!t)throw new Error("missing XMLHttpRequest");function e(i,a){if("function"!=typeof a)throw new Error("Bad callback given: "+a);if(!i)throw new Error("No options given");var u=i.onResponse;if((i="string"==typeof i?{uri:i}:JSON.parse(JSON.stringify(i))).onResponse=u,i.verbose&&(e.log=function(){var t,e,r={},i=["trace","debug","info","warn","error"];for(e=0;e<i.length;e++)r[t=i[e]]=n,"undefined"!=typeof console&&console&&console[t]&&(r[t]=o(console,t));return r}()),i.url&&(i.uri=i.url,delete i.url),!i.uri&&""!==i.uri)throw new Error("options.uri is a required argument");if("string"!=typeof i.uri)throw new Error("options.uri must be a string");for(var s=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],c=0;c<s.length;c++)if(i[s[c]])throw new Error("options."+s[c]+" is not supported");if(i.callback=a,i.method=i.method||"GET",i.headers=i.headers||{},i.body=i.body||null,i.timeout=i.timeout||e.DEFAULT_TIMEOUT,i.headers.host)throw new Error("Options.headers.host is not supported");i.json&&(i.headers.accept=i.headers.accept||"application/json","GET"!==i.method&&(i.headers["content-type"]="application/json"),"boolean"!=typeof i.json?i.body=JSON.stringify(i.json):"string"!=typeof i.body&&(i.body=JSON.stringify(i.body)));var l=function(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")};if(i.qs){var f="string"==typeof i.qs?i.qs:l(i.qs);-1!==i.uri.indexOf("?")?i.uri=i.uri+"&"+f:i.uri=i.uri+"?"+f}if(i.form){if("string"==typeof i.form)throw"form name unsupported";if("POST"===i.method){var d=(i.encoding||"application/x-www-form-urlencoded").toLowerCase();switch(i.headers["content-type"]=d,d){case"application/x-www-form-urlencoded":i.body=l(i.form).replace(/%20/g,"+");break;case"multipart/form-data":var h=function(t){var e={};e.boundry="-------------------------------"+Math.floor(1e9*Math.random());var r=[];for(var n in t)t.hasOwnProperty(n)&&r.push("--"+e.boundry+'\nContent-Disposition: form-data; name="'+n+'"\n\n'+t[n]+"\n");return r.push("--"+e.boundry+"--"),e.body=r.join(""),e.length=e.body.length,e.type="multipart/form-data; boundary="+e.boundry,e}(i.form);i.body=h.body,i.headers["content-type"]=h.type;break;default:throw new Error("unsupported encoding:"+d)}}}return i.onResponse=i.onResponse||n,!0===i.onResponse&&(i.onResponse=a,i.callback=n),!i.headers.authorization&&i.auth&&(i.headers.authorization="Basic "+function(t){var e,r,n,o,i,a,u,s,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=0,f=0,d="",h=[];if(!t)return t;do{e=t.charCodeAt(l++),r=t.charCodeAt(l++),n=t.charCodeAt(l++),o=(s=e<<16|r<<8|n)>>18&63,i=s>>12&63,a=s>>6&63,u=63&s,h[f++]=c.charAt(o)+c.charAt(i)+c.charAt(a)+c.charAt(u)}while(l<t.length);switch(d=h.join(""),t.length%3){case 1:d=d.slice(0,-2)+"==";break;case 2:d=d.slice(0,-1)+"="}return d}(i.auth.username+":"+i.auth.password)),function(n){var o=new t,i=!1,a=function(t){var e,r=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/;try{e=location.href}catch(t){(e=document.createElement("a")).href="",e=e.href}var n=r.exec(e.toLowerCase())||[],o=r.exec(t.toLowerCase());return!(!o||o[1]==n[1]&&o[2]==n[2]&&(o[3]||("http:"===o[1]?80:443))==(n[3]||("http:"===n[1]?80:443)))}(n.uri),u="withCredentials"in o;if(r+=1,o.seq_id=r,o.id=r+": "+n.method+" "+n.uri,o._id=o.id,a&&!u){var s=new Error("Browser does not support cross-origin request: "+n.uri);return s.cors="unsupported",n.callback(s,o)}o.timeoutTimer=setTimeout((function(){i=!0;var t=new Error("ETIMEDOUT");return t.code="ETIMEDOUT",t.duration=n.timeout,e.log.error("Timeout",{id:o._id,milliseconds:n.timeout}),n.callback(t,o)}),n.timeout);var c={response:!1,loading:!1,end:!1};return o.onreadystatechange=function(r){if(i)return e.log.debug("Ignoring timed out state change",{state:o.readyState,id:o.id});if(e.log.debug("State change",{state:o.readyState,id:o.id,timed_out:i}),o.readyState===t.OPENED)for(var a in e.log.debug("Request started",{id:o.id}),n.headers)o.setRequestHeader(a,n.headers[a]);else o.readyState===t.HEADERS_RECEIVED?l():o.readyState===t.LOADING?(l(),f()):o.readyState===t.DONE&&(l(),f(),function(){if(c.end)return;if(c.end=!0,e.log.debug("Request done",{id:o.id}),o.body=o.responseText,n.json)try{o.body=JSON.parse(o.responseText)}catch(t){return n.callback(t,o)}n.callback(null,o,o.body)}())},o.open(n.method,n.uri,!0),a&&(o.withCredentials=!!n.withCredentials),o.send(n.body),o;function l(){if(!c.response){if(c.response=!0,e.log.debug("Got response",{id:o.id,status:o.status}),clearTimeout(o.timeoutTimer),o.statusCode=o.status,a&&0==o.statusCode){var t=new Error("CORS request rejected: "+n.uri);return t.cors="rejected",c.loading=!0,c.end=!0,n.callback(t,o)}n.onResponse(null,o)}}function f(){c.loading||(c.loading=!0,e.log.debug("Response body loading",{id:o.id}))}}(i)}e.log={trace:n,debug:n,info:n,warn:n,error:n};var r=0;function n(){}function o(t,e){return function(r,n){return"object"==typeof n&&(r+=" "+JSON.stringify(n)),t[e].call(t,r)}}return e.withCredentials=!1,e.DEFAULT_TIMEOUT=18e4,e.defaults=function(t,r){var n=function(e){return function(r,n){for(var o in r="string"==typeof r?{uri:r}:JSON.parse(JSON.stringify(r)),t)void 0===r[o]&&(r[o]=t[o]);return e(r,n)}},o=n(e);return o.get=n(e.get),o.post=n(e.post),o.put=n(e.put),o.head=n(e.head),o},["get","put","post","head"].forEach((function(t){var r=t.toUpperCase();e[t.toLowerCase()]=function(t){"string"==typeof t?t={method:r,uri:t}:(t=JSON.parse(JSON.stringify(t))).method=r;var n=[t].concat(Array.prototype.slice.apply(arguments,[1]));return e.apply(this,n)}})),e.couch=function(t,r){return"string"==typeof t&&(t={uri:t}),t.json=!0,t.body&&(t.json=t.body),delete t.body,r=r||n,e(t,(function(t,e,n){if(t)return r(t,e,n);if((e.statusCode<200||e.statusCode>299)&&n.error){for(var o in t=new Error("CouchDB error: "+(n.error.reason||n.error.error)),n)t[o]=n[o];return r(t,e,n)}return r(t,e,n)}))},e})?n.apply(e,o):n)||(t.exports=i)}});