window.ls=window.ls||{};window.ls.container=function(){let stock={};let cachePrefix='none';let memory={};let setCachePrefix=function(prefix){cachePrefix=prefix;return this;};let getCachePrefix=function(){return cachePrefix;};let set=function(name,object,singleton,cache=false,watch=true){if(typeof name!=='string'){throw new Error('var name must be of type string');} if(typeof singleton!=='boolean'){throw new Error('var singleton "'+singleton+'" of service "'+name+'" must be of type boolean');} if(cache){window.localStorage.setItem(getCachePrefix()+'.'+name,JSON.stringify(object));} stock[name]={name:name,object:object,singleton:singleton,instance:null,watch:watch,};return this;};let get=function(name){let service=(undefined!==stock[name])?stock[name]:null;if(null===service){if(memory[getCachePrefix()+'.'+name]){return memory[getCachePrefix()+'.'+name];} let cached=window.localStorage.getItem(getCachePrefix()+'.'+name);if(cached){cached=JSON.parse(cached);memory[getCachePrefix()+'.'+name]=cached;return cached;} return null;} if(service.instance===null){let instance=(typeof service.object==='function')?this.resolve(service.object):service.object;let skip=false;if(service.watch&&name!=='window'&&name!=='document'&&name!=='element'&&typeof instance==='object'&&instance!==null){let handler={name:service.name,watch:function(){},get:function(target,key){if(key==="__name"){return this.name;} if(key==="__watch"){return this.watch;} if(key==="__proxy"){return true;} if(typeof target[key]==='object'&&target[key]!==null&&!target[key].__proxy){let handler=Object.assign({},this);handler.name=handler.name+'.'+key;return new Proxy(target[key],handler)} else{return target[key];}},set:function(target,key,value,receiver){if(key==="__name"){return this.name=value;} if(key==="__watch"){return this.watch=value;} target[key]=value;let path=receiver.__name+'.'+key;document.dispatchEvent(new CustomEvent(path+'.changed'));if(skip){return true;} skip=true;container.set('$prop',key,true);container.set('$value',value,true);container.resolve(this.watch);container.set('$key',null,true);container.set('$value',null,true);skip=false;return true;},};instance=new Proxy(instance,handler);} if(service.singleton){service.instance=instance;} return instance;} return service.instance;};let resolve=function(target){if(!target){return function(){};} let self=this;let FN_ARGS=/^function\s*[^\(]*\(\s*([^\)]*)\)/m;let text=target.toString()||'';let args=text.match(FN_ARGS)[1].split(',');return target.apply(target,args.map(function(value){return self.get(value.trim());}));};let path=function(path,value,as,prefix){as=(as)?as:container.get('$as');prefix=(prefix)?prefix:container.get('$prefix');path=path.replace(as+'.',prefix+'.').split('.');let name=path.shift();let object=this.get(name);let result=null;while(path.length>1){if(undefined===object){return null;} object=object[path.shift()];} if(undefined!==value){object[path.shift()]=value;return true;} if(undefined===object){return null;} let shift=path.shift();if(undefined===shift){result=object;} else{return object[shift];} return result;};let bind=function(element,path,callback,as,prefix){as=(as)?as:container.get('$as');prefix=(prefix)?prefix:container.get('$prefix');let event=path.replace(as+'.',prefix+'.')+'.changed';let printer=function(){if(!document.body.contains(element)){element=null;document.removeEventListener(event,printer,false);return false;} callback();};document.addEventListener(event,printer);};let container={set:set,get:get,resolve:resolve,path:path,bind:bind,setCachePrefix:setCachePrefix,getCachePrefix:getCachePrefix};set('container',container,true,false,false);return container;}();window.ls.container.set('http',function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){param=encodeURIComponent(param);let a=document.createElement('a');param+=(value?"="+encodeURIComponent(value):"");a.href=url;a.search+=(a.search?"&":"")+param;return a.href;};let request=function(method,url,headers,payload,progress){let i;if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('var method must contain a valid HTTP method name');} if(typeof url!=='string'){throw new Error('var url must be of type string');} if(typeof headers!=='object'){throw new Error('var headers must be of type object');} if(typeof url!=='string'){throw new Error('var url must be of type string');} for(i=0;i-1?part.substr(0,eq):part;let val=eq>-1?decodeURIComponent(part.substr(eq+1)):'';let from=key.indexOf('[');if(from===-1){result[decodeURIComponent(key)]=val;} else{let to=key.indexOf(']');let index=decodeURIComponent(key.substring(from+1,to));key=decodeURIComponent(key.substring(0,from));if(!result[key]){result[key]=[];} if(!index){result[key].push(val);} else{result[key][index]=val;}}});return result;};let state={setParam:setParam,getParam:getParam,getParams:getParams,getURL:getURL,add:add,change:change,reload:reload,reset:reset,match:match,getCurrent:getCurrent,setCurrent:setCurrent,getPrevious:getPrevious,setPrevious:setPrevious,params:getJsonFromUrl(window.location.search),hash:window.location.hash};return state;},true,false,false);window.ls.container.set('expression',function(container,filter,$as,$prefix){let reg=/(\{{.*?\}})/gi;let paths=[];return{parse:function(string,def,as,prefix){def=def||'';paths=[];return string.replace(reg,function(match) {let reference=match.substring(2,match.length-2).replace('[\'','.').replace('\']','').trim();reference=reference.split('|');let path=(reference[0]||'');let result=container.path(path,undefined,as,prefix);if(!paths.includes(path)){paths.push(path);} result=(null===result||undefined===result)?def:result;result=(typeof result==='object')?JSON.stringify(result):result;if(reference.length>=2){for(let i=1;i/g,'>').replace(/\"/g,'"').replace(/\'/g,''').replace(/\//g,'/');});window.ls=window.ls||{};window.ls.container.set('window',window,true,false,false).set('document',window.document,true,false,false).set('element',window.document,true,false,false);window.ls.run=function(window){try{this.view.render(window.document);} catch(error){let handler=window.ls.container.resolve(this.error);handler(error);}};window.ls.error=function(){return function(error){console.error('ls-error',error.message,error.stack,error.toString());}};window.ls.router=window.ls.container.get('router');window.ls.view=window.ls.container.get('view');window.ls.filter=window.ls.container.get('filter');window.ls.container.get('view').add({selector:'data-ls-router',controller:function(element,window,document,view,router){let firstFromServer=(element.getAttribute('data-first-from-server')==='true');let scope={selector:'data-ls-scope',template:false,repeat:true,controller:function(){},};let scopeElement=document.createElement('div');let init=function(route){window.scrollTo(0,0);if(window.document.body.scrollTo){window.document.body.scrollTo(0,0);} router.reset();if(null===route){return;} scope.template=(undefined!==route.view.template)?route.view.template:null;scope.controller=(undefined!==route.view.controller)?route.view.controller:function(){};document.dispatchEvent(new CustomEvent('state-change'));if(firstFromServer&&null===router.getPrevious()){scope.template='';} else if(null!==router.getPrevious()){view.render(element);} document.dispatchEvent(new CustomEvent('state-changed'));};let findParent=function(tagName,el){if((el.nodeName||el.tagName).toLowerCase()===tagName.toLowerCase()){return el;} while(el=el.parentNode){if((el.nodeName||el.tagName).toLowerCase()===tagName.toLowerCase()){return el;}} return null;};scopeElement.setAttribute('data-ls-scope','');element.insertBefore(scopeElement,element.firstChild);view.add(scope);document.addEventListener('click',function(event){let target=findParent('a',event.target);if(!target){return false;} if(!target.href){return false;} if((event.metaKey)){return false;} if((target.hasAttribute('target'))&&('_blank'===target.getAttribute('target'))){return false;} if(target.hostname!==window.location.hostname){return false;} let route=router.match(target);if(null===route){return false;} event.preventDefault();if(window.location===target.href){return false;} route.view.state=(undefined===route.view.state)?true:route.view.state;if(true===route.view.state){if(router.getPrevious()&&router.getPrevious().view&&(router.getPrevious().view.scope!==route.view.scope)){window.location.href=target.href;return false;} window.history.pushState({},'Unknown',target.href);} init(route);return true;});window.addEventListener('popstate',function(){init(router.match(window.location));});window.addEventListener('hashchange',function(){init(router.match(window.location));});init(router.match(window.location));}});window.ls.container.get('view').add({selector:'data-ls-attrs',controller:function(element,expression,container,$as,$prefix){let attrs=element.getAttribute('data-ls-attrs').trim().split(',');let paths=[];let check=function(){for(let i=0;i';} return;} http.get(template).then(function(element){return function(data){parse(data,element);}}(element),function(){throw new Error('Failed loading template');});}});(function(a,b){(function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};t=a.document,d="before",c="after",m="readyState",l="addEventListener",k="removeEventListener",g="dispatchEvent",q="XMLHttpRequest",h="FormData",n=["load","loadend","loadstart"],e=["progress","abort","error","timeout"],w=parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1]),isNaN(w)&&(w=parseInt((/trident\/.*; rv:(\d+)/.exec(navigator.userAgent.toLowerCase())||[])[1])),(A=Array.prototype).indexOf||(A.indexOf=function(a){var b,c,d,e;for(b=d=0,e=this.length;e>d;b=++d)if(c=this[b],c===a)return b;return-1}),y=function(a,b){return Array.prototype.slice.call(a,b)},s=function(a){return"returnValue"===a||"totalSize"===a||"position"===a},v=function(a,b){var c,d;for(c in a)if(d=a[c],!s(c))try{b[c]=a[c]}catch(e){}return b},x=function(a,b,c){var d,e,f,h;for(e=function(a){return function(d){var e,f,h;e={};for(f in d)s(f)||(h=d[f],e[f]=h===b?c:h);return c[g](a,e)}},f=0,h=a.length;h>f;f++)d=a[f],c._has(d)&&(b["on"+d]=e(d))},u=function(a){var b;if(null!=t.createEventObject)return b=t.createEventObject(),b.type=a,b;try{return new Event(a)}catch(c){return{type:a}}},f=function(a){var c,d,e;return d={},e=function(a){return d[a]||[]},c={},c[l]=function(a,c,f){d[a]=e(a),d[a].indexOf(c)>=0||(f=f===b?d[a].length:f,d[a].splice(f,0,c))},c[k]=function(a,c){var f;return a===b?void(d={}):(c===b&&(d[a]=[]),f=e(a).indexOf(c),void(-1!==f&&e(a).splice(f,1)))},c[g]=function(){var b,d,f,g,h,i,j,k;for(b=y(arguments),d=b.shift(),a||(b[0]=v(b[0],u(d))),g=c["on"+d],g&&g.apply(c,b),k=e(d).concat(e("*")),f=i=0,j=k.length;j>i;f=++i)h=k[f],h.apply(c,b)},c._has=function(a){return!(!d[a]&&!c["on"+a])},a&&(c.listeners=function(a){return y(e(a))},c.on=c[l],c.off=c[k],c.fire=c[g],c.once=function(a,b){var d;return d=function(){return c.off(a,d),b.apply(null,arguments)},c.on(a,d)},c.destroy=function(){return d={}}),c},z=f(!0),z.EventEmitter=f,z[d]=function(a,b){if(a.length<1||a.length>2)throw"invalid hook";return z[l](d,a,b)},z[c]=function(a,b){if(a.length<2||a.length>3)throw"invalid hook";return z[l](c,a,b)},z.enable=function(){a[q]=p,i&&(a[h]=o)},z.disable=function(){a[q]=z[q],i&&(a[h]=i)},r=z.headers=function(a,b){var c,d,e,f,g,h,i,j,k;switch(null==b&&(b={}),typeof a){case"object":d=[];for(e in a)g=a[e],f=e.toLowerCase(),d.push(""+f+": "+g);return d.join("\n");case"string":for(d=a.split("\n"),i=0,j=d.length;j>i;i++)c=d[i],/([^:]+):\s*(.+)/.test(c)&&(f=null!=(k=RegExp.$1)?k.toLowerCase():void 0,h=RegExp.$2,null==b[f]&&(b[f]=h));return b}},i=a[h],o=function(a){var b;this.fd=a?new i(a):new i,this.form=a,b=[],Object.defineProperty(this,"entries",{get:function(){var c;return c=a?y(a.querySelectorAll("input,select")).filter(function(a){var b;return"checkbox"!==(b=a.type)&&"radio"!==b||a.checked}).map(function(a){return[a.name,"file"===a.type?a.files:a.value]}):[],c.concat(b)}}),this.append=function(a){return function(){var c;return c=y(arguments),b.push(c),a.fd.append.apply(a.fd,c)}}(this)},i&&(z[h]=i,a[h]=o),j=a[q],z[q]=j,p=a[q]=function(){var a,b,h,i,j,k,p,s,t,u,y,A,C,D,E,F,G,H,I,J,K;a=-1,H=new z[q],y={},D=null,p=void 0,E=void 0,A=void 0,u=function(){var b,c,d,e;if(A.status=D||H.status,D===a&&10>w||(A.statusText=H.statusText),D!==a){e=r(H.getAllResponseHeaders());for(b in e)d=e[b],A.headers[b]||(c=b.toLowerCase(),A.headers[c]=d)}},t=function(){H.responseType&&"text"!==H.responseType?"document"===H.responseType?(A.xml=H.responseXML,A.data=H.responseXML):A.data=H.response:(A.text=H.responseText,A.data=H.responseText),"responseURL"in H&&(A.finalUrl=H.responseURL)},G=function(){k.status=A.status,k.statusText=A.statusText},F=function(){"text"in A&&(k.responseText=A.text),"xml"in A&&(k.responseXML=A.xml),"data"in A&&(k.response=A.data),"finalUrl"in A&&(k.responseURL=A.finalUrl)},i=function(a){for(;a>b&&4>b;)k[m]=++b,1===b&&k[g]("loadstart",{}),2===b&&G(),4===b&&(G(),F()),k[g]("readystatechange",{}),4===b&&setTimeout(h,0)},h=function(){p||k[g]("load",{}),k[g]("loadend",{}),p&&(k[m]=0)},b=0,C=function(a){var b,d;return 4!==a?void i(a):(b=z.listeners(c),d=function(){var a;return b.length?(a=b.shift(),2===a.length?(a(y,A),d()):3===a.length&&y.async?a(y,A,d):d()):i(4)},void d())},k=y.xhr=f(),H.onreadystatechange=function(){try{2===H[m]&&u()}catch(a){}4===H[m]&&(E=!1,u(),t()),C(H[m])},s=function(){p=!0},k[l]("error",s),k[l]("timeout",s),k[l]("abort",s),k[l]("progress",function(){3>b?C(3):k[g]("readystatechange",{})}),("withCredentials"in H||z.addWithCredentials)&&(k.withCredentials=!1),k.status=0,K=e.concat(n);for(I=0,J=K.length;J>I;I++)j=K[I],k["on"+j]=null;return k.open=function(a,c,d,e,f){b=0,p=!1,E=!1,y.headers={},y.headerNames={},y.status=0,A={},A.headers={},y.method=a,y.url=c,y.async=d!==!1,y.user=e,y.pass=f,C(1)},k.send=function(a){var b,c,f,g,h,i,j,l;for(l=["type","timeout","withCredentials"],i=0,j=l.length;j>i;i++)c=l[i],f="type"===c?"responseType":c,f in k&&(y[c]=k[f]);y.body=a,h=function(){var a,b,d,g,h,i;for(x(e,H,k),k.upload&&x(e.concat(n),H.upload,k.upload),E=!0,H.open(y.method,y.url,y.async,y.user,y.pass),h=["type","timeout","withCredentials"],d=0,g=h.length;g>d;d++)c=h[d],f="type"===c?"responseType":c,c in y&&(H[f]=y[c]);i=y.headers;for(a in i)b=i[a],a&&H.setRequestHeader(a,b);y.body instanceof o&&(y.body=y.body.fd),H.send(y.body)},b=z.listeners(d),(g=function(){var a,c;return b.length?(a=function(a){return"object"!=typeof a||"number"!=typeof a.status&&"number"!=typeof A.status?void g():(v(a,A),B.call(a,"data")<0&&(a.data=a.response||a.text),void C(4))},a.head=function(a){return v(a,A),C(2)},a.progress=function(a){return v(a,A),C(3)},c=b.shift(),1===c.length?a(c(y)):2===c.length&&y.async?c(y,a):a()):h()})()},k.abort=function(){D=a,E?H.abort():k[g]("abort",{})},k.setRequestHeader=function(a,b){var c,d;c=null!=a?a.toLowerCase():void 0,d=y.headerNames[c]=y.headerNames[c]||a,y.headers[d]&&(b=y.headers[d]+", "+b),y.headers[d]=b},k.getResponseHeader=function(a){var b;return b=null!=a?a.toLowerCase():void 0,A.headers[b]},k.getAllResponseHeaders=function(){return r(A.headers)},H.overrideMimeType&&(k.overrideMimeType=function(){return H.overrideMimeType.apply(H,arguments)}),H.upload&&(k.upload=y.upload=f()),k},"function"==typeof define&&define.amd?define("xhook",[],function(){return z}):(this.exports||this).xhook=z}).call(this,a);var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O;s=!1,D=function(a){var b,c;s||q();for(b in a)c=a[b],x("adding slave: "+b),D[b]=c},m={},n=function(a,b){var c;return m[a]?m[a]:(c=j.createElement("iframe"),c.id=c.name=o(),x("creating iframe "+c.id),c.src=""+a+b,c.setAttribute("style","display:none;"),j.body.appendChild(c),m[a]=c.contentWindow)},q=function(){var a,b,c;return s=!0,b=function(a,b){var c,d,e,f,g;return e=a[0],f=a[1],c=u(f,"Blob"),d=u(f,"File"),c||d?(g=new FileReader,g.onload=function(){return a[1]=null,d&&(a[2]=f.name),b(["XD_BLOB",a,this.result,f.type])},g.readAsArrayBuffer(f),1):0},a=function(a,c){var d;a.forEach(function(b,c){var d,e,f,g,h;if(e=b[0],f=b[1],u(f,"FileList"))for(a.splice(c,1),g=0,h=f.length;h>g;g++)d=f[g],a.splice(c,0,[e,d])}),d=0,a.forEach(function(e,f){d+=b(e,function(b){a[f]=b,0===--d&&c()})}),0===d&&c()},c=function(b,c){var d,e,f;return c.on("xhr-event",function(){return b.xhr.dispatchEvent.apply(null,arguments)}),c.on("xhr-upload-event",function(){return b.xhr.upload.dispatchEvent.apply(null,arguments)}),e=H(b),e.headers=b.headers,b.withCredentials&&(g.master&&(e.headers[g.master]=j.cookie),e.slaveCookie=g.slave),f=function(){return c.emit("request",e)},b.body&&(e.body=b.body,u(e.body,"FormData"))?(d=e.body.entries,e.body=["XD_FD",d],void a(d,f)):void f()},"addWithCredentials"in L||(L.addWithCredentials=!0),L.before(function(a,b){var d,e,f;return e=B(a.url),e&&e.origin!==i?D[e.origin]?(x("proxying request to slave: '"+e.origin+"'"),a.async===!1?(J("sync not supported"),b()):(d=n(e.origin,D[e.origin]),f=h(o(),d),f.on("response",function(a){return b(a),f.close()}),a.xhr.addEventListener("abort",function(){return f.emit("abort")}),void(f.ready?c(a,f):f.once("ready",function(){return c(a,f)})))):(e&&x("no slave matching: '"+e.origin+"'"),b()):b()})},t=!1,z=function(a){var b,c;t||r();for(b in a)c=a[b],x("adding master: "+b),z[b]=c},p=null,r=function(){return t=!0,x("handling incoming sockets..."),p=function(a,b){var c,d,e,f;"null"===a&&(a="*"),e=null;for(c in z){f=z[c];try{if(d=I(c),d.test(a)){e=I(f);break}}catch(g){}}return e?(b.once("request",function(a){var c,d,f,g,h,i,k,l,m,n,o;if(x("request: "+a.method+" "+a.url),i=B(a.url),!i||!e.test(i.path))return J("blocked request to path: '"+i.path+"' by regex: "+e),void b.close();l=new XMLHttpRequest,l.open(a.method,a.url),l.addEventListener("*",function(a){return b.emit("xhr-event",a.type,H(a))}),l.upload&&l.upload.addEventListener("*",function(a){return b.emit("xhr-upload-event",a.type,H(a))}),b.once("abort",function(){return l.abort()}),l.onreadystatechange=function(){var a;if(4===l.readyState){a={status:l.status,statusText:l.statusText,data:l.response,headers:L.headers(l.getAllResponseHeaders())};try{a.text=l.responseText}catch(c){}return b.emit("response",a)}},a.withCredentials&&(l.withCredentials=!0,a.slaveCookie&&(a.headers[a.slaveCookie]=j.cookie)),a.timeout&&(l.timeout=a.timeout),a.type&&(l.responseType=a.type),o=a.headers;for(h in o)k=o[h],l.setRequestHeader(h,k);if(a.body instanceof Array&&"XD_FD"===a.body[0]){for(g=new L.FormData,f=a.body[1],m=0,n=f.length;n>m;m++)c=f[m],"XD_BLOB"===c[0]&&4===c.length&&(d=new Blob([c[2]],{type:c[3]}),c=c[1],c[1]=d),g.append.apply(g,c);a.body=g}l.send(a.body||null)}),void x("slave listening for requests on socket: "+b.id)):void J("blocked request from: '"+a+"'")},a===a.parent?J("slaves must be in an iframe"):a.parent.postMessage("XDPING_"+d,"*")},e="XD_CHECK",F={},v=!0,h=function(a,b){var d,f,g,h,i,j;return i=!1,j=F[a]=L.EventEmitter(!0),j.id=a,j.once("close",function(){return j.destroy(),j.close()}),h=[],j.emit=function(){var b,c;b=E(arguments),c="string"==typeof b[1]?" -> "+b[1]:"",x("send socket: "+a+": "+b[0]+c),b.unshift(a),i?g(b):h.push(b)},g=function(a){v&&(a=JSON.stringify(a)),b.postMessage(a,"*")},j.close=function(){j.emit("close"),x("close socket: "+a),F[a]=null},j.once(e,function(b){for(v="string"==typeof b,i=j.ready=!0,j.emit("ready"),x("ready socket: "+a+" (emit #"+h.length+" pending)");h.length;)g(h.shift())}),f=0,d=function(){return function(){b.postMessage([a,e,{}],"*"),i||(f++>=K.timeout/c?(J("Timeout waiting on iframe socket"),k.fire("timeout"),j.fire("abort")):setTimeout(d,c))}}(this),setTimeout(d),x("new socket: "+a),j},A=function(b){return j.addEventListener?a.addEventListener("message",b):a.attachEvent("onmessage",b)},G=function(){return A(function(a){var c,e,f,g;if(c=a.data,"string"==typeof c){if(/^XDPING(_(V\d+))?$/.test(c)&&RegExp.$2!==d)return J("your master is not compatible with your slave, check your xdomain.js version");if(/^xdomain-/.test(c))c=c.split(",");else if(v)try{c=JSON.parse(c)}catch(i){return}}if(c instanceof Array&&(f=c.shift(),/^xdomain-/.test(f)&&(g=F[f],null!==g))){if(g===b){if(!p)return;g=h(f,a.source),p(a.origin,g)}e="string"==typeof c[1]?" -> "+c[1]:"",x("receive socket: "+f+": "+c[0]+e),g.fire.apply(g,c)}})},L=(this.exports||this).xhook,K=function(a){a&&(a.masters&&z(a.masters),a.slaves&&D(a.slaves))},K.masters=z,K.slaves=D,K.debug=!1,K.timeout=15e3,c=100,g=K.cookies={master:"Master-Cookie",slave:"Slave-Cookie"},j=a.document,w=a.location,i=K.origin=w.protocol+"//"+w.host,o=function(){return"xdomain-"+Math.round(Math.random()*Math.pow(2,32)).toString(16)},E=function(a,b){return Array.prototype.slice.call(a,b)},f=a.console||{},k=null,C=function(){k=L.EventEmitter(!0),K.on=k.on,K.off=k.off},L&&C(),y=function(a){return function(b){b="xdomain ("+i+"): "+b,k.fire(a,b),("log"!==a||K.debug)&&(a in K?K[a](b):a in f?f[a](b):"warn"===a&&alert(b))}},x=y("log"),J=y("warn"),O=["postMessage","JSON"];for(M=0,N=O.length;N>M;M++)if(l=O[M],!a[l])return void J("requires '"+l+"' and this browser does not support it");u=function(b,c){return c in a?b instanceof a[c]:!1},d="V1",B=K.parseUrl=function(a){return/^((https?:)?\/\/[^\/\?]+)(\/.*)?/.test(a)?{origin:(RegExp.$2?"":w.protocol)+RegExp.$1,path:RegExp.$3}:(x("failed to parse absolute url: "+a),null)},I=function(a){var b;return a instanceof RegExp?a:(b=a.toString().replace(/\W/g,function(a){return"\\"+a}).replace(/\\\*/g,".*"),new RegExp("^"+b+"$"))},H=function(a){var b,c,d,e;b={};for(c in a)"returnValue"!==c&&(d=a[c],"function"!=(e=typeof d)&&"object"!==e&&(b[c]=d));return b},function(){var a,b,c,d,e,f,g,h,i,k,l;for(a={debug:function(a){return"string"==typeof a?K.debug="false"!==a:void 0},slave:function(a){var b,c;if(a&&(b=B(a)))return c={},c[b.origin]=b.path,D(c)},master:function(a){var b,c;if(a&&(c="*"===a?{origin:"*",path:"*"}:B(a)))return b={},b[c.origin]=c.path.replace(/^\//,"")?c.path:"*",z(b)}},k=j.getElementsByTagName("script"),f=0,h=k.length;h>f;f++)if(e=k[f],/xdomain/.test(e.src))for(l=["","data-"],g=0,i=l.length;i>g;g++){d=l[g];for(c in a)(b=a[c])(e.getAttribute(d+c))}}(),G(),"function"==typeof define&&define.amd?define("xdomain",["xhook"],function(a){return L=a,C(),K}):(this.exports||this).xdomain=K}).call(this,window);xdomain.slaves({"https://appwrite.test":"/v1/proxy?v=1&project="+APP_ENV.PROJECT,"https://appwrite.io":"/v1/proxy?v=1&project="+APP_ENV.PROJECT});(function(window){window.AppwriteSDK=function(){let config={domain:'https://appwrite.io',version:'v1',project:0,locale:'en',mode:'default'};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search)) if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href;};let request=function(method,url,headers,payload,progress){let i;http.addGlobalHeader('X-Appwrite-Project',config.project);http.addGlobalHeader('X-Appwrite-Locale',config.locale);http.addGlobalHeader('X-Appwrite-Mode',config.mode);if(-1===['GET','POST','PUT','DELETE','TRACE','HEAD','OPTIONS','CONNECT','PATCH'].indexOf(method)){throw new Error('let method must contain a valid HTTP method name');} if(typeof url!=='string'){throw new Error('let url must be of type string');} if(typeof headers!=='object'){throw new Error('let headers must be of type object');} if(typeof url!=='string'){throw new Error('let url must be of type string');} for(i=0;i=xmlhttp.status){resolve(xmlhttp.response);} else{reject(new Error(xmlhttp.statusText));}};if(progress){xmlhttp.addEventListener('progress',progress);xmlhttp.upload.addEventListener('progress',progress,false);} xmlhttp.onerror=function(){reject(new Error("Network Error"));};xmlhttp.send(payload);});promise.abort=function(){xmlhttp.abort();};return promise;};return{'get':function(url){return request('GET',url,{},'')},'post':function(url,headers,payload,progress){return request('POST',url,headers,payload,progress)},'put':function(url,headers,payload){return request('PUT',url,headers,payload)},'patch':function(url,headers,payload){return request('PATCH',url,headers,payload)},'delete':function(url){return request('DELETE',url,{},'')},'addGlobalParam':function(key,value){globalParams.push({key:key,value:value});},'addGlobalHeader':function(key,value){globalHeaders[key]={key:key,value:value};},'version':'1.0.0'}}(window.document);let iframe=function(method,url,params){let form=document.createElement('form');form.setAttribute('method',method);form.setAttribute('action',url);for(let key in params){if(params.hasOwnProperty(key)){let hiddenField=document.createElement("input");hiddenField.setAttribute("type","hidden");hiddenField.setAttribute("name",key);hiddenField.setAttribute("value",params[key]);form.appendChild(hiddenField);}} document.body.appendChild(form);return form.submit();};let auth={register:function(email,password,name,redirect,success,failure){return iframe('post',config.domain+'/'+config.version+'/auth/register',{project:config.project,'email':email,'password':password,'name':name,'redirect':redirect,success:success,failure:failure});},confirm:function(userId,token){return http.post(config.domain+'/'+config.version+'/auth/register/confirm',{'Content-type':'application/json'},JSON.stringify({'userId':userId,'token':token}));},confirmResend:function(redirect){return http.post(config.domain+'/'+config.version+'/auth/register/confirm/resend',{'Content-type':'application/json'},JSON.stringify({'redirect':redirect}));},login:function(email,password,success,failure){return iframe('post',config.domain+'/'+config.version+'/auth/login',{project:config.project,email:email,password:password,success:success,failure:failure});},invite:function(team,name,email,roles,redirect){return http.post(config.domain+'/'+config.version+'/auth/invite',{'Content-type':'application/json'},JSON.stringify({'team':team,'name':name,'email':email,'roles':roles,'redirect':redirect}));},inviteResend:function(inviteId,redirect){return http.post(config.domain+'/'+config.version+'/auth/invite/resend',{'Content-type':'application/json'},JSON.stringify({'inviteId':inviteId,'redirect':redirect}));},join:function(inviteId,userId,secret,success,failure){return iframe('post',config.domain+'/'+config.version+'/auth/join',{project:config.project,inviteId:inviteId,userId:userId,secret:secret,success:success,failure:failure});},leave:function(inviteId){return http.delete(config.domain+'/'+config.version+'/auth/leave/'+inviteId);},loginWithFacebook:function(success,failure){return config.domain+'/'+config.version+'/oauth/facebook?project='+config.project+'&success='+encodeURI(success)+'&failure='+encodeURI(failure);},loginWithGithub:function(success,failure){return config.domain+'/'+config.version+'/oauth/github?project='+config.project+'&success='+encodeURI(success)+'&failure='+encodeURI(failure);},loginWithTwitter:function(success,failure){return config.domain+'/'+config.version+'/oauth/twitter?project='+config.project+'&success='+encodeURI(success)+'&failure='+encodeURI(failure);},loginWithLinkedIn:function(success,failure){return config.domain+'/'+config.version+'/oauth/linkedin?project='+config.project+'&success='+encodeURI(success)+'&failure='+encodeURI(failure);},logout:function(){return http.delete(config.domain+'/'+config.version+'/auth/logout');},logoutById:function(userId){return http.delete(config.domain+'/'+config.version+'/auth/logout/'+userId);},recovery:function(email,redirect){return http.post(config.domain+'/'+config.version+'/auth/recovery',{'Content-type':'application/json'},JSON.stringify({'email':email,'redirect':redirect}));},recoveryReset:function(userId,token,passwordA,passwordB){return http.put(config.domain+'/'+config.version+'/auth/recovery/reset',{'Content-type':'application/json'},JSON.stringify({'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB}));}};let account={get:function(){return http.get(config.domain+'/'+config.version+'/account');},prefs:function(){return http.get(config.domain+'/'+config.version+'/account/prefs');},sessions:function(){return http.get(config.domain+'/'+config.version+'/account/sessions');},security:function(){return http.get(config.domain+'/'+config.version+'/account/security');},updateName:function(name){return http.patch(config.domain+'/'+config.version+'/account/name',{'Content-type':'application/json'},JSON.stringify({'name':name}));},updateEmail:function(email,password){return http.patch(config.domain+'/'+config.version+'/account/email',{'Content-type':'application/json'},JSON.stringify({'email':email,'password':password}));},updatePassword:function(password,oldPassword){return http.patch(config.domain+'/'+config.version+'/account/password',{'Content-type':'application/json'},JSON.stringify({'password':password,'old-password':oldPassword}));},updatePrefs:function(prefs){return http.patch(config.domain+'/'+config.version+'/account/prefs',{'Content-type':'application/json'},JSON.stringify({'prefs':prefs}));},deactivate:function(){return http.delete(config.domain+'/'+config.version+'/account');},};let users={list:function(search,limit,offset){return http.get(config.domain+'/'+config.version+'/users?search='+search+'&limit='+limit+'&offset='+offset);},get:function(userId){return http.get(config.domain+'/'+config.version+'/users/'+userId);},getPrefs:function(userId){return http.get(config.domain+'/'+config.version+'/users/'+userId+'/prefs');},getSessions:function(userId){return http.get(config.domain+'/'+config.version+'/users/'+userId+'/sessions');},getLogs:function(userId){return http.get(config.domain+'/'+config.version+'/users/'+userId+'/logs');},create:function(email,password,name){return http.post(config.domain+'/'+config.version+'/users',{'Content-type':'application/json'},JSON.stringify({email:email,password:password,name:name}));},updateStatus:function(userId,status){return http.patch(config.domain+'/'+config.version+'/users/'+userId+'/status',{'Content-type':'application/json'},JSON.stringify({'status':status}));},delete:function(userId){return http.delete(config.domain+'/'+config.version+'/teams/'+userId);},deleteSession:function(userId,sessionId){return http.delete(config.domain+'/'+config.version+'/users/'+userId+'/sessions/'+sessionId);},deleteSessions:function(userId){return http.delete(config.domain+'/'+config.version+'/users/'+userId+'/sessions');}};let teams={list:function(search,limit,offset){return http.get(config.domain+'/'+config.version+'/teams?search='+search+'&limit='+limit+'&offset='+offset);},get:function(teamId){return http.get(config.domain+'/'+config.version+'/teams/'+teamId);},getMembers:function(teamId){return http.get(config.domain+'/'+config.version+'/teams/'+teamId+'/members');},create:function(name,parent){return http.post(config.domain+'/'+config.version+'/teams',{'Content-type':'application/json'},JSON.stringify({name:name,parent:parent}));},update:function(teamId,name){return http.put(config.domain+'/'+config.version+'/teams/'+teamId,{'Content-type':'application/json'},JSON.stringify({'name':name}));},delete:function(teamId){return http.delete(config.domain+'/'+config.version+'/teams/'+teamId);}};let storage={getDownload:function(fileId){return config.domain+'/'+config.version+'/storage/files/'+fileId+'/download?project='+config.project;},getPreview:function(fileId,token,width,height){let params=[];if(token){params.push('token='+token);} if(width){params.push('width='+width);} if(height){params.push('height='+height);} if(00){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);} return message.id;};return service;},true);})(window);(function(window){"use strict";window.Litespeed.container.set('console',function(window){var sdk=new window.AppwriteSDK();sdk.config.domain='https://appwrite.io';sdk.config.domain=APP_ENV.API;sdk.config.project=0;sdk.config.locale=APP_ENV.LOCALE;return sdk;},true);})(window);(function(window){"use strict";window.Litespeed.container.set('date',function(){function format(format,timestamp){var jsdate,f var txtWords=['Sun','Mon','Tues','Wednes','Thurs','Fri','Satur','January','February','March','April','May','June','July','August','September','October','November','December'] var formatChr=/\\?(.?)/gi var formatChrCb=function(t,s){return f[t]?f[t]():s} var _pad=function(n,c){n=String(n) while(n.length9?-1:0)},Y:function(){return jsdate.getFullYear()},y:function(){return f.Y().toString().slice(-2)},a:function(){return jsdate.getHours()>11?'pm':'am'},A:function(){return f.a().toUpperCase()},B:function(){var H=jsdate.getUTCHours()*36e2 var i=jsdate.getUTCMinutes()*60 var s=jsdate.getUTCSeconds() return _pad(Math.floor((H+i+s+36e2)/86.4)%1e3,3)},g:function(){return f.G()%12||12},G:function(){return jsdate.getHours()},h:function(){return _pad(f.g(),2)},H:function(){return _pad(f.G(),2)},i:function(){return _pad(jsdate.getMinutes(),2)},s:function(){return _pad(jsdate.getSeconds(),2)},u:function(){return _pad(jsdate.getMilliseconds()*1000,6)},e:function(){var msg='Not supported (see source code of date() for timezone on how to add support)' throw new Error(msg)},I:function(){var a=new Date(f.Y(),0) var c=Date.UTC(f.Y(),0) var b=new Date(f.Y(),6) var d=Date.UTC(f.Y(),6) return((a-c)!==(b-d))?1:0},O:function(){var tzo=jsdate.getTimezoneOffset() var a=Math.abs(tzo) return(tzo>0?'-':'+')+_pad(Math.floor(a/60)*100+a%60,4)},P:function(){var O=f.O() return(O.substr(0,3)+':'+O.substr(3,2))},T:function(){return'UTC'},Z:function(){return-jsdate.getTimezoneOffset()*60},c:function(){return'Y-m-d\\TH:i:sP'.replace(formatChr,formatChrCb)},r:function(){return'D, d M Y H:i:s O'.replace(formatChr,formatChrCb)},U:function(){return jsdate/1000|0}} var _date=function(format,timestamp){jsdate=(timestamp===undefined?new Date():(timestamp instanceof Date)?new Date(timestamp):new Date(timestamp*1000)) return format.replace(formatChr,formatChrCb)} return _date(format,timestamp)} function strtotime(text,now){var parsed var match var today var year var date var days var ranges var len var times var regex var i var fail=false if(!text){return fail} text=text.replace(/^\s+|\s+$/g,'').replace(/\s{2,}/g,' ').replace(/[\t\r\n]/g,'').toLowerCase() var pattern=new RegExp(['^(\\d{1,4})','([\\-\\.\\/:])','(\\d{1,2})','([\\-\\.\\/:])','(\\d{1,4})','(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?','(?:\\s([A-Z]+)?)?$'].join('')) match=text.match(pattern) if(match&&match[2]===match[4]){if(match[1]>1901){switch(match[2]){case'-':if(match[3]>12||match[5]>31){return fail} return new Date(match[1],parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000 case'.':return fail case'/':if(match[3]>12||match[5]>31){return fail} return new Date(match[1],parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}}else if(match[5]>1901){switch(match[2]){case'-':if(match[3]>12||match[1]>31){return fail} return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000 case'.':if(match[3]>12||match[1]>31){return fail} return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000 case'/':if(match[1]>12||match[3]>31){return fail} return new Date(match[5],parseInt(match[1],10)-1,match[3],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000}}else{switch(match[2]){case'-':if(match[3]>12||match[5]>31||(match[1]<70&&match[1]>38)){return fail} year=match[1]>=0&&match[1]<=38?+match[1]+2000:match[1] return new Date(year,parseInt(match[3],10)-1,match[5],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000 case'.':if(match[5]>=70){if(match[3]>12||match[1]>31){return fail} return new Date(match[5],parseInt(match[3],10)-1,match[1],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000} if(match[5]<60&&!match[6]){if(match[1]>23||match[3]>59){return fail} today=new Date() return new Date(today.getFullYear(),today.getMonth(),today.getDate(),match[1]||0,match[3]||0,match[5]||0,match[9]||0)/1000} return fail case'/':if(match[1]>12||match[3]>31||(match[5]<70&&match[5]>38)){return fail} year=match[5]>=0&&match[5]<=38?+match[5]+2000:match[5] return new Date(year,parseInt(match[1],10)-1,match[3],match[6]||0,match[7]||0,match[8]||0,match[9]||0)/1000 case':':if(match[1]>23||match[3]>59||match[5]>59){return fail} today=new Date() return new Date(today.getFullYear(),today.getMonth(),today.getDate(),match[1]||0,match[3]||0,match[5]||0)/1000}}} if(text==='now'){return now===null||isNaN(now)?new Date().getTime()/1000|0:now|0} if(!isNaN(parsed=Date.parse(text))){return parsed/1000|0} pattern=new RegExp(['^([0-9]{4}-[0-9]{2}-[0-9]{2})','[ t]','([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)','([\\+-][0-9]{2}(:[0-9]{2})?|z)'].join('')) match=text.match(pattern) if(match){if(match[4]==='z'){match[4]='Z'}else if(match[4].match(/^([+-][0-9]{2})$/)){match[4]=match[4]+':00'} if(!isNaN(parsed=Date.parse(match[1]+'T'+match[2]+match[4]))){return parsed/1000|0}} date=now?new Date(now*1000):new Date() days={'sun':0,'mon':1,'tue':2,'wed':3,'thu':4,'fri':5,'sat':6} ranges={'yea':'FullYear','mon':'Month','day':'Date','hou':'Hours','min':'Minutes','sec':'Seconds'} function lastNext(type,range,modifier){var diff var day=days[range] if(typeof day!=='undefined'){diff=day-date.getDay() if(diff===0){diff=7*modifier}else if(diff>0&&type==='last'){diff-=7}else if(diff<0&&type==='next'){diff+=7} date.setDate(date.getDate()+diff)}} function process(val){var splt=val.split(' ') var type=splt[0] var range=splt[1].substring(0,3) var typeIsNumber=/\d+/.test(type) var ago=splt[2]==='ago' var num=(type==='last'?-1:1)*(ago?-1:1) if(typeIsNumber){num*=parseInt(type,10)} if(ranges.hasOwnProperty(range)&&!splt[1].match(/^mon(day|\.)?$/i)){return date['set'+ranges[range]](date['get'+ranges[range]]()+num)} if(range==='wee'){return date.setDate(date.getDate()+(num*7))} if(type==='next'||type==='last'){lastNext(type,range,num)}else if(!typeIsNumber){return false} return true} times='(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec'+'|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?'+'|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)' regex='([+-]?\\d+\\s'+times+'|'+'(last|next)\\s'+times+')(\\sago)?' match=text.match(new RegExp(regex,'gi')) if(!match){return fail} for(i=0,len=match.length;i=60){if(value%60===0){return Math.ceil(value/60)+' hours';} else{return Math.ceil(value/60)+' hours and '+(value%60)+' minutes';}} return value+' minutes';});filter.add('ms2hum',function(value,options){let temp=value;const years=Math.floor(temp/31536000),days=Math.floor((temp%=31536000)/86400),hours=Math.floor((temp%=86400)/3600),minutes=Math.floor((temp%=3600)/60),seconds=temp%60;if(days||hours||seconds||minutes){return(years?years+"y ":"")+ (days?days+"d ":"")+ (hours?hours+"h ":"")+ (minutes?minutes+"m ":"")+ Number.parseFloat(seconds).toFixed(0)+"s";} return"< 1s";});filter.add('nl2p',function(value,options){let result="

"+value+"

";result=result.replace(/\r\n\r\n/g,"

").replace(/\n\n/g,"

");result=result.replace(/\r\n/g,"
").replace(/\n/g,"
");return result;});filter.add('markdown',function(value,options){return markdown.render(value);});filter.add('id2name',function(value,options){let members=container.get('members');if(members===null){return'';} for(let y=0;y=thresh&&u'+units[u]+'';});filter.add('statsTotal',function(value){if(!value){return 0;} value=abbreviate(value,1,false,false);return(value==='0')?'N/A':value;});function abbreviate(number,maxPlaces,forcePlaces,forceLetter){number=Number(number);forceLetter=forceLetter||false;if(forceLetter!==false){return annotate(number,maxPlaces,forcePlaces,forceLetter);} let abbr;if(number>=1e12){abbr='T';} else if(number>=1e9){abbr='B';} else if(number>=1e6){abbr='M';} else if(number>=1e3){abbr='K';} else{abbr='';} return annotate(number,maxPlaces,forcePlaces,abbr);} function annotate(number,maxPlaces,forcePlaces,abbr){let rounded=0;switch(abbr){case'T':rounded=number/1e12;break;case'B':rounded=number/1e9;break;case'M':rounded=number/1e6;break;case'K':rounded=number/1e3;break;case'':rounded=number;break} if(maxPlaces!==false){let test=new RegExp('\\.\\d{'+(maxPlaces+1)+',}$') if(test.test((''+rounded))){rounded=rounded.toFixed(maxPlaces)}} if(forcePlaces!==false){rounded=Number(rounded).toFixed(forcePlaces)} return rounded+abbr} window.Litespeed.container.get('view').add({selector:'data-acl',controller:function(element,document,state,alerts){document.body.classList.remove('console');document.body.classList.remove('home');document.body.classList.add(state.getCurrent().view.scope);if(!state.getCurrent().view.project){document.body.classList.add('hide-nav');document.body.classList.remove('show-nav');} else{document.body.classList.add('show-nav');document.body.classList.remove('hide-nav');} if('/console'===state.getCurrent().path){document.body.classList.add('index');} else{document.body.classList.remove('index');}}}).add({selector:'data-cookie-policy',repeat:false,controller:function(element,alerts,cookie){if(!cookie.get('cp-cookie-alert')){let text=element.dataset['cookiePolicy']||'';alerts.send({text:text,class:'cookie-alert',link:'/policy/cookies',remove:function(){cookie.set('cp-cookie-alert','true',365*10);}},0);}}}).add({selector:'data-login-fb',controller:function(element,console,expression){let success=expression.parse(element.dataset['success']||'');let failure=expression.parse(element.dataset['failure']||'');element.href=console.auth.loginWithFacebook(success,failure);}}).add({selector:'data-login-linkedin',controller:function(element,console,expression){let success=expression.parse(element.dataset['success']||'');let failure=expression.parse(element.dataset['failure']||'');element.href=console.auth.loginWithLinkedIn(success,failure);}}).add({selector:'data-login-github',controller:function(element,console,expression){let success=expression.parse(element.dataset['success']||'');let failure=expression.parse(element.dataset['failure']||'');element.href=console.auth.loginWithGithub(success,failure);}}).add({selector:'data-billing-invoice-print',controller:function(element,expression,sdk){let id=expression.parse(element.dataset['billingInvoicePrint']||'');element.href=sdk.billing.invoices.getForPrint(id);}}).add({selector:'data-billing-invoice-download',controller:function(element,expression,sdk){let id=expression.parse(element.dataset['billingInvoiceDownload']||'');element.href=sdk.billing.invoices.getForDownload(id);}}).add({selector:'data-auto-cc-master',controller:function(element,expression,document){let price=parseInt(expression.parse(element.dataset['autoCcMaster']||'0'));let check=function(){if(element.checked&&0===price){document.body.classList.add('free-plan');document.dispatchEvent(new CustomEvent('set-free-plan',{bubbles:false,cancelable:true}));} else if(element.checked){document.body.classList.remove('free-plan');document.dispatchEvent(new CustomEvent('unset-free-plan',{bubbles:false,cancelable:true}));}};element.addEventListener('change',check);check();}}).add({selector:'data-auto-cc-slave',controller:function(element){document.addEventListener('set-free-plan',function(){element.checked=true;});document.addEventListener('unset-free-plan',function(){element.checked=false;});}}).add({selector:'data-ls-ui-alerts',controller:function(element,window,view){window.document.addEventListener('alerted',function(){view.render(element);},true);}}).add({selector:'data-ls-ui-alerts-delete',controller:function(document,element,alerts,expression){let message=expression.parse(element.dataset['message']);let remove=function(){alerts.remove(message);};element.addEventListener('click',remove);}}).add({selector:'data-ls-ui-chart-line',repeat:true,controller:function(element,document,expression){new Chartist.Line(element,{labels:['16.05','17.05','18.05','19.05','20.05'],series:[[12,9,7,8,5],[2,1,3.5,7,3],[1,3,4,5,6],[2,6,10,5,9],[3,1,1,8,3]]},{height:'300px',width:'100%',fullWidth:true,showArea:true,chartPadding:{right:30}});}}).add({selector:'data-ls-ui-chart-pie',repeat:true,controller:function(element,document,expression){new Chartist.Pie(element,{series:[20,10,30,40]},{donut:true,donutSolid:true,showLabel:true});}}).add({selector:'data-forms-headers',repeat:false,controller:function(element){let key=document.createElement('input');let value=document.createElement('input');let wrap=document.createElement('div');let cell1=document.createElement('div');let cell2=document.createElement('div');key.type='text';key.className='margin-bottom-no';key.placeholder='Key';value.type='text';value.className='margin-bottom-no';value.placeholder='Value';wrap.className='row thin margin-bottom-small';cell1.className='col span-6';cell2.className='col span-6';element.parentNode.insertBefore(wrap,element);cell1.appendChild(key);cell2.appendChild(value);wrap.appendChild(cell1);wrap.appendChild(cell2);key.addEventListener('input',function(){syncA();});value.addEventListener('input',function(){syncA();});element.addEventListener('change',function(){syncB();});let syncA=function(){element.value=key.value.toLowerCase()+':'+value.value.toLowerCase();};let syncB=function(){let split=element.value.toLowerCase().split(':');key.value=split[0]||'';value.value=split[1]||'';key.value=key.value.trim();value.value=value.value.trim();};syncB();}}).add({selector:'data-prism',repeat:false,controller:function(window,document,element,alerts){Prism.highlightElement(element);let copy=document.createElement('i');copy.className='icon-docs copy';copy.title='Copy to Clipboard';copy.addEventListener('click',function(){window.getSelection().removeAllRanges();let range=document.createRange();range.selectNode(element);window.getSelection().addRange(range);try{document.execCommand('copy');alerts.send({text:'Copied to clipboard',class:''},3000);}catch(err){alerts.send({text:"Failed to copy text ",class:'error'},3000);} window.getSelection().removeAllRanges();});element.parentNode.parentNode.appendChild(copy);}}).add({selector:'data-code-example',repeat:false,controller:function(window,document,element,cookie){let prefix=element.dataset['codeExample']||'unknown';element.addEventListener('change',function(){select(element.value);});let select=function(value){for(let i=0;i=","<=","=",">","<"];let operator=null;for(let key=0;key-1){operator=operatorsMap[key];}} if(operator===null){throw new Error("Invalid operator");} filter=filter.split(operator);if(filter.length!==2){throw new Error("Invalid filter expression");} return{"key":filter[0],"value":filter[1],"operator":operator};};let flatten=function(params){let list={};for(let key in params){if(params.hasOwnProperty(key)){if(key!=='filters'){list[key]=params[key];} else{for(let i=0;i60) return meter.className='password-meter strong';if(score>30) return meter.className='password-meter medium';if(score>=0) return meter.className='password-meter weak';};var meter=window.document.createElement('div');meter.className='password-meter';element.parentNode.insertBefore(meter,element.nextSibling);element.addEventListener('change',callback);element.addEventListener('keypress',callback);element.addEventListener('keyup',callback);element.addEventListener('keydown',callback);}});})(window);(function(window){"use strict";window.Litespeed.container.get('view').add({selector:'data-forms-pell',repeat:false,controller:function(element,window,document,markdown){var div=document.createElement('div');element.className='pell hide';div.className='input pell';element.parentNode.insertBefore(div,element);element.tabIndex=-1;var turndownService=new TurndownService();turndownService.addRule('underline',{filter:['u'],replacement:function(content){return'__'+content+'__'}});var editor=window.pell.init({element:div,onChange:function onChange(html){element.value=turndownService.turndown(html);},defaultParagraphSeparator:'p',actions:[{name:'bold',icon:''},{name:'underline',icon:''},{name:'italic',icon:''},{name:'olist',icon:''},{name:'ulist',icon:''}]});element.addEventListener('change',function(){editor.content.innerHTML=markdown.render(element.value);});editor.content.setAttribute('placeholder',element.placeholder);editor.content.innerHTML=markdown.render(element.value);editor.content.tabIndex=0;editor.content.onkeydown=function preventTab(event){if(event.which===9){event.preventDefault();if(document.activeElement){var focussable=Array.prototype.filter.call(document.querySelectorAll('a:not([disabled]), button:not([disabled]), select:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'),function(element){return element.offsetWidth>0||element.offsetHeight>0||element===document.activeElement});var index=focussable.indexOf(document.activeElement);if(index>-1){if(event.shiftKey){var prevElement=focussable[index-1]||focussable[focussable.length-1];prevElement.focus();} else{var nextElement=focussable[index+1]||focussable[0];nextElement.focus();}}}}};var clean=function(e){e.stopPropagation();e.preventDefault();var clipboardData=e.clipboardData||window.clipboardData;window.pell.exec('insertText',clipboardData.getData('Text'));return true;};div.addEventListener('paste',clean);div.addEventListener('drop',clean);}});})(window);(function(window){"use strict";window.Litespeed.container.get('view').add({selector:'data-forms-recaptcha',repeat:false,controller:function(element,document,window){var form=document.getElementById(element.dataset['formsRecaptcha']||'');var captcha=document.createElement('input');captcha.type='hidden';captcha.name='g-recaptcha-response';element.parentNode.insertBefore(captcha,element.nextSibling);var render=function(){window.grecaptcha.render(element,{'sitekey':element.dataset['sitekey']||'','size':'invisible','badge':'inline','callback':function(token){captcha.value=token;form.submit();}});};if(window.grecaptchaReady){render();} else{document.addEventListener('recaptcha-loaded',render);} form.addEventListener('submit',function(){if(''===captcha.value){event.preventDefault();window.grecaptcha.execute();}});}});})(window);(function(window){"use strict";window.Litespeed.container.get('view').add({selector:'data-forms-remove',repeat:false,controller:function(element){Array.prototype.slice.call(element.querySelectorAll('[data-remove]')).map(function(obj){obj.addEventListener('click',function(){element.parentNode.removeChild(element);});});}});})(window);(function(window){"use strict";window.Litespeed.container.get('view').add({selector:'data-forms-switch',repeat:false,controller:function(element){let input=window.document.createElement('input');input.type='checkbox';input.className='switch';let syncA=function(){element.value=(input.checked)?'on':'off';};let syncB=function(){input.checked=(element.value==='on');};input.addEventListener('input',syncA);input.addEventListener('change',syncA);element.addEventListener('input',syncB);element.addEventListener('change',syncB);syncA();element.parentNode.insertBefore(input,element);}});})(window);(function(window){"use strict";window.Litespeed.container.get('view').add({selector:'data-forms-text-count',repeat:false,controller:function(element){var counter=document.createElement('span');counter.className='counter';element.parentNode.insertBefore(counter,element.nextSibling);var count=function(){if(0<=element.maxLength){counter.innerText=(element.maxLength-element.value.length).toString()+' / '+element.maxLength;} else{var words=(element.value!=='')?element.value.trim().split(' ').length:0;counter.innerText=words+' words and '+element.value.length.toString()+' chars';}};element.addEventListener('keyup',count);element.addEventListener('change',count);element.addEventListener('cut',count);element.addEventListener('paste',count);element.addEventListener('drop',count);count();}});})(window);(function(window){"use strict";window.Litespeed.container.get('view').add({selector:'data-forms-text-direction',repeat:false,controller:function(element){var rtlStock='^ا^ب^ت^ث^ج^ح^خ^د^ذ^ر^ز^س^ش^ص^ض^ط^ظ^ع^غ^ف^ق^ك^ل^م^ن^ه^و^ي^א^ב^ג^ד^ה^ו^ז^ח^ט^י^כ^ך^ל^מ^ם^נ^ן^ס^ע^פ^ף^צ^ץ^ק^ר^ש^ת^';var special=['\n',' ','״','"','_','\'','!','@','#','$','^','&','%','*','(',')','+','=','-','[',']','\\','/','{','}','|',':','<','>','?',',','.','0','1','2','3','4','5','6','7','8','9'];var setDirection=function(){var value=(element.value[0])?element.value:'';var direction='ltr';var align='left';for(var i=0;i=thresh&&u=thresh&&u=max)){input.disabled=true;upload.classList.add('disabled');} else{input.disabled=false;upload.classList.remove('disabled');} var remove=(function(obj){return function(event){output=(Array.isArray(output))?output.filter(function(e){return e!==obj}):[];render(output);}})(obj);file.addEventListener('click',remove);file.addEventListener('keypress',remove);element.value=(multiple)?JSON.stringify(output):output[0];});};input.addEventListener('change',function(){var message=alerts.send({text:labelLoading,class:''},0);var files=input.files;var formData=new FormData();var read=JSON.parse(expression.parse(element.dataset['read']||'[]'));var write=JSON.parse(expression.parse(element.dataset['write']||'[]'));if(!multiple){output=[];} for(var i=0;imax){break;} var file=files[i];formData.append('files[]',file);total=total+file.size;} for(var x=0;x>>(32-d))}function K(G,k){let I,d,F,H,x;F=(G&2147483648);H=(k&2147483648);I=(G&1073741824);d=(k&1073741824);x=(G&1073741823)+(k&1073741823);if(I&d){return(x^2147483648^F^H)}if(I|d){if(x&1073741824){return(x^3221225472^F^H)}else{return(x^1073741824^F^H)}}else{return(x^F^H)}}function r(d,F,k){return(d&F)|((~d)&k)}function q(d,F,k){return(d&k)|(F&(~k))}function p(d,F,k){return(d^F^k)}function n(d,F,k){return(F^(d|(~k)))}function u(G,F,aa,Z,k,H,I){G=K(G,K(K(r(F,aa,Z),k),I));return K(L(G,H),F)}function f(G,F,aa,Z,k,H,I){G=K(G,K(K(q(F,aa,Z),k),I));return K(L(G,H),F)}function D(G,F,aa,Z,k,H,I){G=K(G,K(K(p(F,aa,Z),k),I));return K(L(G,H),F)}function t(G,F,aa,Z,k,H,I){G=K(G,K(K(n(F,aa,Z),k),I));return K(L(G,H),F)}function e(G){let Z;let F=G.length;let x=F+8;let k=(x-(x%64))/64;let I=(k+1)*16;let aa=Array(I-1);let d=0;let H=0;while(H>>29;return aa}function B(x){let k="",F="",G,d;for(d=0;d<=3;d++){G=(x>>>(d*8))&255;F="0"+G.toString(16);k=k+F.substr(F.length-2,2)}return k}function J(k){k=k.replace(/rn/g,"n");let d="";for(let F=0;F127)&&(x<2048)){d+=String.fromCharCode((x>>6)|192);d+=String.fromCharCode((x&63)|128)}else{d+=String.fromCharCode((x>>12)|224);d+=String.fromCharCode(((x>>6)&63)|128);d+=String.fromCharCode((x&63)|128)}}}return d}let C=Array();let P,h,E,v,g,Y,X,W,V;let S=7,Q=12,N=17,M=22;let A=5,z=9,y=14,w=20;let o=4,m=11,l=16,j=23;let U=6,T=10,R=15,O=21;s=J(s);C=e(s);Y=1732584193;X=4023233417;W=2562383102;V=271733878;for(P=0;P0)?current+' / '+total:'';}});})(window);(function(window){window.Litespeed.container.get('view').add({selector:'data-ui-phases',controller:function(element,window,document,expression,view){var tabs=document.createElement('ul');var container=document.createElement('div');var titles=Array.prototype.slice.call(element.getElementsByTagName('h2'));var next=Array.prototype.slice.call(element.querySelectorAll('[data-next]'));var previous=Array.prototype.slice.call(element.querySelectorAll('[data-previous]'));var position=0;for(var i=0;i=i){index=0;} if(auto){interval=window.setTimeout(function(){move(index++)},7000);}} move(0);}});})(window);