diff --git a/public/css/app.css b/public/css/app.css index ffe6b30..02b2d39 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -1 +1 @@ -/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:400}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:400}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}@font-face{font-family:'Rubik';font-style:normal;font-weight:300;src:local("Rubik Light"),local("Rubik-Light"),url("fonts/Rubik_300.eot?#iefix") format("embedded-opentype"),url("fonts/Rubik_300.woff") format("woff"),url("fonts/Rubik_300.woff2") format("woff2"),url("fonts/Rubik_300.svg#Rubik") format("svg"),url("fonts/Rubik_300.ttf") format("truetype")}@font-face{font-family:'Rubik';font-style:normal;font-weight:400;src:local("Rubik"),local("Rubik-Regular"),url("fonts/Rubik_400.eot?#iefix") format("embedded-opentype"),url("fonts/Rubik_400.woff") format("woff"),url("fonts/Rubik_400.woff2") format("woff2"),url("fonts/Rubik_400.svg#Rubik") format("svg"),url("fonts/Rubik_400.ttf") format("truetype")}.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}.column,.columns{width:100%;float:left;box-sizing:border-box}@media (min-width: 400px){.container{width:85%;padding:0}}@media (min-width: 550px){.container{width:80%}.column,.columns{margin-left:4%}.column:first-child,.columns:first-child{margin-left:0}.one.column,.one.columns{width:4.66666666667%}.two.columns{width:13.3333333333%}.three.columns{width:22%}.four.columns{width:30.6666666667%}.five.columns{width:39.3333333333%}.six.columns{width:48%}.seven.columns{width:56.6666666667%}.eight.columns{width:65.3333333333%}.nine.columns{width:74.0%}.ten.columns{width:82.6666666667%}.eleven.columns{width:91.3333333333%}.twelve.columns{width:100%;margin-left:0}.one-third.column{width:30.6666666667%}.two-thirds.column{width:65.3333333333%}.one-half.column{width:48%}.offset-by-one.column,.offset-by-one.columns{margin-left:8.66666666667%}.offset-by-two.column,.offset-by-two.columns{margin-left:17.3333333333%}.offset-by-three.column,.offset-by-three.columns{margin-left:26%}.offset-by-four.column,.offset-by-four.columns{margin-left:34.6666666667%}.offset-by-five.column,.offset-by-five.columns{margin-left:43.3333333333%}.offset-by-six.column,.offset-by-six.columns{margin-left:52%}.offset-by-seven.column,.offset-by-seven.columns{margin-left:60.6666666667%}.offset-by-eight.column,.offset-by-eight.columns{margin-left:69.3333333333%}.offset-by-nine.column,.offset-by-nine.columns{margin-left:78.0%}.offset-by-ten.column,.offset-by-ten.columns{margin-left:86.6666666667%}.offset-by-eleven.column,.offset-by-eleven.columns{margin-left:95.3333333333%}.offset-by-one-third.column,.offset-by-one-third.columns{margin-left:34.6666666667%}.offset-by-two-thirds.column,.offset-by-two-thirds.columns{margin-left:69.3333333333%}.offset-by-one-half.column,.offset-by-one-half.columns{margin-left:52%}}html{font-size:62.5%}body{font-size:1.5em;line-height:1.6;font-weight:300;font-family:"Rubik", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;color:#222}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:2rem;font-weight:300}h1{font-size:4.0rem;line-height:1.2;letter-spacing:-.1rem}h2{font-size:3.6rem;line-height:1.25;letter-spacing:-.1rem}h3{font-size:3.0rem;line-height:1.3;letter-spacing:-.1rem}h4{font-size:2.4rem;line-height:1.35;letter-spacing:-.08rem}h5{font-size:1.8rem;line-height:1.5;letter-spacing:-.05rem}h6{font-size:1.5rem;line-height:1.6;letter-spacing:0}@media (min-width: 550px){h1{font-size:5.0rem}h2{font-size:4.2rem}h3{font-size:3.6rem}h4{font-size:3.0rem}h5{font-size:2.4rem}h6{font-size:1.5rem}}p{margin-top:0}a{color:#1EAEDB}a:hover{color:#0FA0CE}.button,button,input[type="submit"],input[type="reset"],input[type="button"]{display:inline-block;height:38px;padding:0 30px;color:#555;text-align:center;font-size:11px;font-weight:400;line-height:38px;letter-spacing:.1rem;text-transform:uppercase;text-decoration:none;white-space:nowrap;background-color:transparent;border-radius:4px;border:1px solid #bbb;cursor:pointer;box-sizing:border-box}.button:hover,button:hover,input[type="submit"]:hover,input[type="reset"]:hover,input[type="button"]:hover,.button:focus,button:focus,input[type="submit"]:focus,input[type="reset"]:focus,input[type="button"]:focus{color:#333;border-color:#888;outline:0}.button.button-primary,button.button-primary,input[type="submit"].button-primary,input[type="reset"].button-primary,input[type="button"].button-primary{color:#FFF;background-color:#33C3F0;border-color:#33C3F0}.button.button-primary:hover,button.button-primary:hover,input[type="submit"].button-primary:hover,input[type="reset"].button-primary:hover,input[type="button"].button-primary:hover,.button.button-primary:focus,button.button-primary:focus,input[type="submit"].button-primary:focus,input[type="reset"].button-primary:focus,input[type="button"].button-primary:focus{color:#FFF;background-color:#1EAEDB;border-color:#1EAEDB}.button.no-padding{padding:0}.button.no-border{border:none}input[type="email"],input[type="number"],input[type="search"],input[type="text"],input[type="tel"],input[type="url"],input[type="password"],textarea,select{height:38px;padding:6px 10px;background-color:#fff;border:1px solid #D1D1D1;border-radius:4px;box-shadow:none;box-sizing:border-box}input[type="email"],input[type="number"],input[type="search"],input[type="text"],input[type="tel"],input[type="url"],input[type="password"],textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none}textarea{min-height:65px;padding-top:6px;padding-bottom:6px}input[type="email"]:focus,input[type="number"]:focus,input[type="search"]:focus,input[type="text"]:focus,input[type="tel"]:focus,input[type="url"]:focus,input[type="password"]:focus,textarea:focus,select:focus{border:1px solid #33C3F0;outline:0}label,legend{display:block;margin-bottom:.5rem;font-weight:400}fieldset{padding:0;border-width:0}input[type="checkbox"],input[type="radio"]{display:inline}label>.label-body{display:inline-block;margin-left:.5rem;font-weight:normal}ul{list-style:circle inside}ol{list-style:decimal inside}ol,ul{padding-left:0;margin-top:0}ul ul,ul ol,ol ol,ol ul{margin:1.5rem 0 1.5rem 3rem;font-size:90%}li{margin-bottom:1rem}code{padding:.2rem .5rem;margin:0 .2rem;font-size:90%;white-space:nowrap;background:#F1F1F1;border:1px solid #E1E1E1;border-radius:4px}pre>code{display:block;padding:1rem 1.5rem;white-space:pre}th,td{padding:12px 15px;text-align:left;border-bottom:1px solid #E1E1E1}th:first-child,td:first-child{padding-left:0}th:last-child,td:last-child{padding-right:0}button,.button{margin-bottom:1rem}input,textarea,select,fieldset{margin-bottom:1.5rem}pre,blockquote,dl,figure,table,p,ul,ol,form{margin-bottom:2.5rem}.u-full-width{width:100%;box-sizing:border-box}.u-max-full-width{max-width:100%;box-sizing:border-box}.u-pull-right{float:right}.u-pull-left{float:left}hr{margin-top:3rem;margin-bottom:3.5rem;border-width:0;border-top:1px solid #E1E1E1}.container:after,.row:after,.u-cf{content:"";display:table;clear:both}@keyframes loading{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}body,html{background-color:#fff;height:100%}h6{text-transform:uppercase;letter-spacing:.2rem;font-weight:400}h6 span{letter-spacing:0;text-transform:none}.hidden{display:none}.container{min-height:100%}a.logo{width:100%;height:12rem;position:relative;display:block;text-align:center}a.logo svg{display:inline-block;width:100%;height:100%}a.logo svg use{transition:fill 200ms ease-in-out}a.logo strong{position:absolute;top:0;left:0;width:100%;line-height:13rem;color:#040000;letter-spacing:0.2rem;text-transform:uppercase;transition:color 200ms ease-in-out}a.logo.active svg use,a.logo:hover svg use{fill:#040000}a.logo.active strong,a.logo:hover strong{color:#fff}.errorContainer{position:fixed;top:0;left:0;width:100%;background-color:#ff7878;color:#fff;z-index:5}.errorContainer label{margin-top:2.5rem}.errorContainer .columns{max-width:960px;margin:0 auto;float:none;padding:0 20px}.copyButton:after{content:' copied'}.copyButton.button-primary:before{content:'Copy '}.copyButton.button-primary:after{content:''}.copyButton+.fileName{margin-top:0.5rem}.feedbackSendButton.processing:after,.containerCreateButton.processing:after,.containerLoadButton.processing:after,.chatCreateButton.processing:after{content:'';width:10px;height:10px;border:1px solid #555;border-right-color:transparent;margin-left:1rem;display:inline-block;vertical-align:middle;border-radius:50%;animation:loading 1s linear infinite}svg use{stroke-width:1px;stroke:#040000;fill:transparent}form{position:relative;margin-bottom:0}form textarea{resize:none;display:block}form #messageFile,form #chatFile{display:none}form .fileName{word-wrap:break-word;margin-bottom:1.5rem}form .createContainer{margin-top:1.5rem}form .decryptionFailed{margin-bottom:0}form .decryptionFailed ~ .createContainer{margin-top:0}form .attachedFile{margin-bottom:1.5rem}.attachedFile{display:block;min-height:calc(38px + 0.5rem);position:relative;padding-left:4rem;padding-top:0.7rem;box-sizing:border-box;color:#a9a9a9}.attachedFile.multiline{word-break:break-all}.attachedFile.oneline{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.attachedFile i.file{pointer-events:none;display:inline-block;width:30px;height:38px;box-shadow:inset 0 0 0 3px #eee;border-radius:4px;position:absolute;top:0;left:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1.1rem;font-style:normal;line-height:38px;text-align:center;transition:background-color 200ms ease-in-out, box-shadow 200ms ease-in-out}.attachedFile.active{color:inherit}.attachedFile.active i.file{color:#fff;box-shadow:inset 0 0 0 3px #555;background-color:#555}.attachedFile .drop{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fff;border-style:dashed;opacity:0.8;pointer-events:none;display:none}.attachedFile .drop.active{display:block}.navbar{z-index:4;height:7rem;border-bottom:1px solid #eee;margin-bottom:2.5rem;background-color:#fff}.navbar-spacer{overflow:hidden;height:0}.navbar-spacer.docked{height:7rem;border-bottom:1px solid #eee;margin-bottom:2.5rem}.navbar.docked{position:fixed;top:0;left:0;width:100%}.navbar.docked .columns{max-width:960px;margin:0 auto;float:none;padding:0 20px}.navbar ul{list-style:none;margin-bottom:0}.navbar ul li{float:left;margin-bottom:0}.navbar ul li:not(:last-child){margin-right:1.2rem}.navbar ul li a{position:relative;display:block;color:#040000;text-transform:uppercase;letter-spacing:.2rem;font-weight:400;text-decoration:none;line-height:7rem;outline:none;cursor:pointer}.navbar ul li a:after{content:'';width:4px;height:4px;position:absolute;bottom:1.3rem;left:50%;margin-left:-2px;background-color:transparent;border-radius:50%;transition:background-color 100ms ease-in-out}.navbar ul li a.active:after{background-color:#040000}.navbar ul li a.chat:before{pointer-events:none;content:'offline';position:absolute;top:60%;left:0;letter-spacing:.1rem;line-height:1rem;font-size:0.8rem;width:100%;text-align:center;color:transparent;transition:color 100ms ease-in-out}.navbar ul li a.chat:not(.online){pointer-events:none;color:#a9a9a9}.navbar ul li a.chat:not(.online):before{color:#a9a9a9}.navbar ul li a.chat:not(.online).active:after{background-color:#a9a9a9}.navbar ul li a.chat i{position:absolute;background-color:#ff7878;border-radius:50%;width:8px;height:8px;top:1rem;left:50%;margin-left:-4px;opacity:0;transition:opacity 100ms ease-in-out}.navbar ul li a.chat i.unread{opacity:1}button,.button{transition:background-color 100ms ease-in-out, color 100ms ease-in-out, border-color 100ms ease-in-out}.counter{text-align:center;padding:2rem 0 0 0;color:#a9a9a9;opacity:0;transition:opacity 200ms ease-in-out}.counter.active{opacity:1}.counter span{font-weight:400;font-size:1.2rem;text-transform:uppercase}.counter-wrapper{overflow:hidden;max-height:0;transition:max-height 200ms ease-in-out}.counter-wrapper.active{max-height:100px}.chat-feed{min-height:100%;display:flex;flex-flow:column nowrap;justify-content:flex-end;align-content:flex-end;align-items:stretch}.chat-feed-wrapper{box-sizing:border-box;height:100%;overflow-y:auto}.chat-feed>div{padding:0.5rem 1rem;border-radius:4px;margin-top:1rem;overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;order:0;flex:0 0 auto;box-sizing:border-box;max-width:calc(100% - 60px);position:relative}.chat-feed>div:first-child{margin-top:0}.chat-feed>div.self{box-shadow:inset 0 0 0 1px #eee;border-top-right-radius:0;align-self:flex-end}.chat-feed>div.other{background-color:#eee;border-top-left-radius:0;align-self:flex-start}.chat-feed>div.stick{margin-top:0.5rem}.chat-feed>div.stick.self{border-top-right-radius:4px}.chat-feed>div.stick.other{border-top-left-radius:4px}.chat-feed>div>.text{white-space:pre-wrap;word-break:break-all}.chat-feed>div>.text+.file{padding-top:0.5rem}.chat-feed>div>.file .attachedFile{text-decoration:none;margin-top:0.5rem}.chat-feed>strong{float:left;clear:both;margin-top:1rem;position:relative;overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;order:0;flex:0 0 auto}.chat-feed>strong.self{align-self:flex-end}.chat-feed>strong.other{align-self:flex-start}.chat-feed>strong.stick{margin-top:0.5rem}.chat-feed>strong+div{margin-top:0.5rem}.chat-feed>strong.unread:after{top:50%;transform:translate(150%, -50%)}.chat-feed .system{align-self:center}.chat-feed .unread:after{content:'';position:absolute;background-color:#ff7878;border-radius:50%;width:8px;height:8px;top:0;right:0;transform:translate(25%, -25%)}.chat-interlocutors strong{display:block}.chat-interlocutors ul li{margin-bottom:0}.chat-form{position:absolute;box-sizing:border-box;padding:0 20px;bottom:0;left:0;width:100%}.chat-form textarea{height:65px}.chat-form-controls{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.chat-form-controls>.chatSendButton{flex:0 1 auto}.chat-form-controls>.attachedFile{flex:0 1 auto}.chat-header a{float:right;margin-bottom:0;margin-top:-0.7rem;margin-left:0.5rem}.chat-header a svg{vertical-align:middle}.chat-header a.users{padding-right:15px}.chat-header a.users svg{margin-right:-0.5rem}.chat-header h6{float:left}.chat-header h6+a{float:left;margin-left:0}.modal{position:fixed;z-index:6;top:0;left:0;width:100%;height:100%;pointer-events:none;text-align:center}.modal:before{content:'';display:inline-block;height:100%;vertical-align:middle}.modal .underlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:transparent;transition:background-color 200ms ease-in-out}.modal .content{text-align:left;float:none;padding:1rem 1.5rem 1.5rem 1.5rem;display:inline-block;vertical-align:middle;background-color:#fff;width:90%;max-width:540px;opacity:0;box-sizing:border-box;border-radius:4px;transform:scale(0.7);transition:transform 200ms ease-in-out, opacity 200ms ease-in-out}.modal .content .header{text-align:center;font-size:1.5rem;line-height:32px;white-space:nowrap;text-transform:uppercase;letter-spacing:.2rem;font-weight:400}.modal .content .roster{margin-bottom:1rem}.modal .content .roster li{margin-bottom:0}.modal.active{pointer-events:auto}.modal.active .underlay{background-color:rgba(0,0,0,0.4)}.modal.active>div{transform:scale(1);opacity:1}.modal-buttons{text-align:center}.modal-buttons a{margin-bottom:0}#chat-feed-block{position:relative;box-sizing:border-box;padding-bottom:1.5rem}#chat-feed-block .toBottom{position:absolute;bottom:0;right:0;width:38px;margin-bottom:1.5rem;opacity:0;pointer-events:none;transform:translateY(-1rem);transition:opacity 100ms ease-in-out, transform 100ms ease-in-out}#chat-feed-block .toBottom.active{opacity:1;transform:translateY(0);pointer-events:auto}#chat-feed-block .toBottom.unread:after{content:'';top:0;left:0;transform:translate(-30%, -30%);position:absolute;background-color:#ff7878;border-radius:50%;width:8px;height:8px}#chat-form-block .attachedFile{margin-left:1rem;cursor:pointer}svg.white use{fill:#fff}svg.black use{fill:#040000}svg.icon use{stroke-width:0px}svg.icon.small{width:36px;height:36px}@media (min-width: 400px){.navbar.docked .columns,.errorContainer .columns{width:85%;padding:0}.chat-form{box-sizing:content-box;padding:0}.navbar ul li:not(:last-child){margin-right:2rem}}@media (min-width: 550px){.navbar.docked .columns,.errorContainer .columns{width:80%}.counter{text-align:left;padding:5.3rem 0 0 0}.counter-wrapper{max-height:100px;transition:none}}@media (max-width: 400px){.chat-header{margin-top:-1.5rem}.chat-header h6{margin-bottom:1rem}#chat-feed-block{padding-bottom:0.5rem}#chat-feed-block .toBottom{margin-bottom:0.5rem}#chat-form-block textarea{margin-bottom:0.5rem}#chat-form-block .chat-form-controls button{margin-bottom:0.5rem}#chat-form-block .chat-form-controls .attachedFile{margin-bottom:0}} +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:400}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:400}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}@font-face{font-family:'Rubik';font-style:normal;font-weight:300;src:local("Rubik Light"),local("Rubik-Light"),url("fonts/Rubik_300.eot?#iefix") format("embedded-opentype"),url("fonts/Rubik_300.woff") format("woff"),url("fonts/Rubik_300.woff2") format("woff2"),url("fonts/Rubik_300.svg#Rubik") format("svg"),url("fonts/Rubik_300.ttf") format("truetype")}@font-face{font-family:'Rubik';font-style:normal;font-weight:400;src:local("Rubik"),local("Rubik-Regular"),url("fonts/Rubik_400.eot?#iefix") format("embedded-opentype"),url("fonts/Rubik_400.woff") format("woff"),url("fonts/Rubik_400.woff2") format("woff2"),url("fonts/Rubik_400.svg#Rubik") format("svg"),url("fonts/Rubik_400.ttf") format("truetype")}.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}.column,.columns{width:100%;float:left;box-sizing:border-box}@media (min-width: 400px){.container{width:85%;padding:0}}@media (min-width: 550px){.container{width:80%}.column,.columns{margin-left:4%}.column:first-child,.columns:first-child{margin-left:0}.one.column,.one.columns{width:4.66666666667%}.two.columns{width:13.3333333333%}.three.columns{width:22%}.four.columns{width:30.6666666667%}.five.columns{width:39.3333333333%}.six.columns{width:48%}.seven.columns{width:56.6666666667%}.eight.columns{width:65.3333333333%}.nine.columns{width:74.0%}.ten.columns{width:82.6666666667%}.eleven.columns{width:91.3333333333%}.twelve.columns{width:100%;margin-left:0}.one-third.column{width:30.6666666667%}.two-thirds.column{width:65.3333333333%}.one-half.column{width:48%}.offset-by-one.column,.offset-by-one.columns{margin-left:8.66666666667%}.offset-by-two.column,.offset-by-two.columns{margin-left:17.3333333333%}.offset-by-three.column,.offset-by-three.columns{margin-left:26%}.offset-by-four.column,.offset-by-four.columns{margin-left:34.6666666667%}.offset-by-five.column,.offset-by-five.columns{margin-left:43.3333333333%}.offset-by-six.column,.offset-by-six.columns{margin-left:52%}.offset-by-seven.column,.offset-by-seven.columns{margin-left:60.6666666667%}.offset-by-eight.column,.offset-by-eight.columns{margin-left:69.3333333333%}.offset-by-nine.column,.offset-by-nine.columns{margin-left:78.0%}.offset-by-ten.column,.offset-by-ten.columns{margin-left:86.6666666667%}.offset-by-eleven.column,.offset-by-eleven.columns{margin-left:95.3333333333%}.offset-by-one-third.column,.offset-by-one-third.columns{margin-left:34.6666666667%}.offset-by-two-thirds.column,.offset-by-two-thirds.columns{margin-left:69.3333333333%}.offset-by-one-half.column,.offset-by-one-half.columns{margin-left:52%}}html{font-size:62.5%}body{font-size:1.5em;line-height:1.6;font-weight:300;font-family:"Rubik", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;color:#222}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:2rem;font-weight:300}h1{font-size:4.0rem;line-height:1.2;letter-spacing:-.1rem}h2{font-size:3.6rem;line-height:1.25;letter-spacing:-.1rem}h3{font-size:3.0rem;line-height:1.3;letter-spacing:-.1rem}h4{font-size:2.4rem;line-height:1.35;letter-spacing:-.08rem}h5{font-size:1.8rem;line-height:1.5;letter-spacing:-.05rem}h6{font-size:1.5rem;line-height:1.6;letter-spacing:0}@media (min-width: 550px){h1{font-size:5.0rem}h2{font-size:4.2rem}h3{font-size:3.6rem}h4{font-size:3.0rem}h5{font-size:2.4rem}h6{font-size:1.5rem}}p{margin-top:0}a{color:#1EAEDB}a:hover{color:#0FA0CE}.button,button,input[type="submit"],input[type="reset"],input[type="button"]{display:inline-block;height:38px;padding:0 30px;color:#555;text-align:center;font-size:11px;font-weight:400;line-height:38px;letter-spacing:.1rem;text-transform:uppercase;text-decoration:none;white-space:nowrap;background-color:transparent;border-radius:4px;border:1px solid #bbb;cursor:pointer;box-sizing:border-box}.button:hover,button:hover,input[type="submit"]:hover,input[type="reset"]:hover,input[type="button"]:hover,.button:focus,button:focus,input[type="submit"]:focus,input[type="reset"]:focus,input[type="button"]:focus{color:#333;border-color:#888;outline:0}.button.button-primary,button.button-primary,input[type="submit"].button-primary,input[type="reset"].button-primary,input[type="button"].button-primary{color:#FFF;background-color:#555;border-color:#555}.button.button-primary:hover,button.button-primary:hover,input[type="submit"].button-primary:hover,input[type="reset"].button-primary:hover,input[type="button"].button-primary:hover,.button.button-primary:focus,button.button-primary:focus,input[type="submit"].button-primary:focus,input[type="reset"].button-primary:focus,input[type="button"].button-primary:focus{color:#FFF;background-color:#666;border-color:#666}.button.no-padding{padding:0}.button.no-border{border:none}input[type="email"],input[type="number"],input[type="search"],input[type="text"],input[type="tel"],input[type="url"],input[type="password"],textarea,select{height:38px;padding:6px 10px;background-color:#fff;border:1px solid #D1D1D1;border-radius:4px;box-shadow:none;box-sizing:border-box}input[type="email"],input[type="number"],input[type="search"],input[type="text"],input[type="tel"],input[type="url"],input[type="password"],textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none}textarea{min-height:65px;padding-top:6px;padding-bottom:6px}input[type="email"]:focus,input[type="number"]:focus,input[type="search"]:focus,input[type="text"]:focus,input[type="tel"]:focus,input[type="url"]:focus,input[type="password"]:focus,textarea:focus,select:focus{border:1px solid #33C3F0;outline:0}label,legend{display:block;margin-bottom:.5rem;font-weight:400}fieldset{padding:0;border-width:0}input[type="checkbox"],input[type="radio"]{display:inline}label>.label-body{display:inline-block;margin-left:.5rem;font-weight:normal}ul{list-style:circle inside}ol{list-style:decimal inside}ol,ul{padding-left:0;margin-top:0}ul ul,ul ol,ol ol,ol ul{margin:1.5rem 0 1.5rem 3rem;font-size:90%}li{margin-bottom:1rem}code{padding:.2rem .5rem;margin:0 .2rem;font-size:90%;white-space:nowrap;background:#F1F1F1;border:1px solid #E1E1E1;border-radius:4px}pre>code{display:block;padding:1rem 1.5rem;white-space:pre}th,td{padding:12px 15px;text-align:left;border-bottom:1px solid #E1E1E1}th:first-child,td:first-child{padding-left:0}th:last-child,td:last-child{padding-right:0}button,.button{margin-bottom:1rem}input,textarea,select,fieldset{margin-bottom:1.5rem}pre,blockquote,dl,figure,table,p,ul,ol,form{margin-bottom:2.5rem}.u-full-width{width:100%;box-sizing:border-box}.u-max-full-width{max-width:100%;box-sizing:border-box}.u-pull-right{float:right}.u-pull-left{float:left}hr{margin-top:3rem;margin-bottom:3.5rem;border-width:0;border-top:1px solid #E1E1E1}.container:after,.row:after,.u-cf{content:"";display:table;clear:both}@keyframes loading{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}body,html{background-color:#fff;height:100%}h6{text-transform:uppercase;letter-spacing:.2rem;font-weight:400}h6 span{letter-spacing:0;text-transform:none}.hidden{display:none}.container{min-height:100%}a.logo{width:100%;height:12rem;position:relative;display:block;text-align:center}a.logo svg{display:inline-block;width:100%;height:100%}a.logo svg use{transition:fill 200ms ease-in-out}a.logo strong{position:absolute;top:0;left:0;width:100%;line-height:13rem;color:#040000;letter-spacing:0.2rem;text-transform:uppercase;transition:color 200ms ease-in-out}a.logo.active svg use,a.logo:hover svg use{fill:#040000}a.logo.active strong,a.logo:hover strong{color:#fff}.errorContainer{position:fixed;top:0;left:0;width:100%;background-color:#ff7878;color:#fff;z-index:5}.errorContainer label{margin-top:2.5rem}.errorContainer .columns{max-width:960px;margin:0 auto;float:none;padding:0 20px}.copyButton:after{content:' copied'}.copyButton.button-primary:before{content:'Copy '}.copyButton.button-primary:after{content:''}.copyButton+.fileName{margin-top:0.5rem}.feedbackSendButton.processing:after,.containerCreateButton.processing:after,.containerLoadButton.processing:after,.chatCreateButton.processing:after{content:'';width:10px;height:10px;border:1px solid #555;border-right-color:transparent;margin-left:1rem;display:inline-block;vertical-align:middle;border-radius:50%;animation:loading 1s linear infinite}svg use{stroke-width:1px;stroke:#040000;fill:transparent}form{position:relative;margin-bottom:0}form textarea{resize:none;display:block}form #messageFile,form #chatFile{display:none}form .fileName{word-wrap:break-word;margin-bottom:1.5rem}form .createContainer{margin-top:1.5rem}form .decryptionFailed{margin-bottom:0}form .decryptionFailed ~ .createContainer{margin-top:0}form .attachedFile{margin-bottom:1.5rem}.attachedFile{display:block;min-height:calc(38px + 0.5rem);position:relative;padding-left:4rem;padding-top:0.7rem;box-sizing:border-box;color:#a9a9a9}.attachedFile.multiline{word-break:break-all}.attachedFile.oneline{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.attachedFile i.file{pointer-events:none;display:inline-block;width:30px;height:38px;box-shadow:inset 0 0 0 3px #eee;border-radius:4px;position:absolute;top:0;left:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:1.1rem;font-style:normal;line-height:38px;text-align:center;transition:background-color 200ms ease-in-out, box-shadow 200ms ease-in-out}.attachedFile.active{color:inherit}.attachedFile.active i.file{color:#fff;box-shadow:inset 0 0 0 3px #555;background-color:#555}.attachedFile .drop{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#fff;border-style:dashed;opacity:0.8;pointer-events:none;display:none}.attachedFile .drop.active{display:block}.navbar{z-index:4;height:7rem;border-bottom:1px solid #eee;margin-bottom:2.5rem;background-color:#fff}.navbar-spacer{overflow:hidden;height:0}.navbar-spacer.docked{height:7rem;border-bottom:1px solid #eee;margin-bottom:2.5rem}.navbar.docked{position:fixed;top:0;left:0;width:100%}.navbar.docked .columns{max-width:960px;margin:0 auto;float:none;padding:0 20px}.navbar ul{list-style:none;margin-bottom:0}.navbar ul li{float:left;margin-bottom:0}.navbar ul li:not(:last-child){margin-right:1.2rem}.navbar ul li a{position:relative;display:block;color:#040000;text-transform:uppercase;letter-spacing:.2rem;font-weight:400;text-decoration:none;line-height:7rem;outline:none;cursor:pointer}.navbar ul li a:after{content:'';width:4px;height:4px;position:absolute;bottom:1.3rem;left:50%;margin-left:-2px;background-color:transparent;border-radius:50%;transition:background-color 100ms ease-in-out}.navbar ul li a.active:after{background-color:#040000}.navbar ul li a.chat:before{pointer-events:none;content:'offline';position:absolute;top:60%;left:0;letter-spacing:.1rem;line-height:1rem;font-size:0.8rem;width:100%;text-align:center;color:transparent;transition:color 100ms ease-in-out}.navbar ul li a.chat:not(.online){pointer-events:none;color:#a9a9a9}.navbar ul li a.chat:not(.online):before{color:#a9a9a9}.navbar ul li a.chat:not(.online).active:after{background-color:#a9a9a9}.navbar ul li a.chat i{position:absolute;background-color:#ff7878;border-radius:50%;width:8px;height:8px;top:1rem;left:50%;margin-left:-4px;opacity:0;transition:opacity 100ms ease-in-out}.navbar ul li a.chat i.unread{opacity:1}button,.button{transition:background-color 100ms ease-in-out, color 100ms ease-in-out, border-color 100ms ease-in-out}.counter{text-align:center;padding:2rem 0 0 0;color:#a9a9a9;opacity:0;transition:opacity 200ms ease-in-out}.counter.active{opacity:1}.counter span{font-weight:400;font-size:1.2rem;text-transform:uppercase}.counter-wrapper{overflow:hidden;max-height:0;transition:max-height 200ms ease-in-out}.counter-wrapper.active{max-height:100px}.chat-feed{min-height:100%;display:flex;flex-flow:column nowrap;justify-content:flex-end;align-content:flex-end;align-items:stretch}.chat-feed-wrapper{box-sizing:border-box;height:100%;overflow-y:auto}.chat-feed>div{padding:0.5rem 1rem;border-radius:4px;margin-top:1rem;overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;order:0;flex:0 0 auto;box-sizing:border-box;max-width:calc(100% - 60px);position:relative}.chat-feed>div:first-child{margin-top:0}.chat-feed>div.self{box-shadow:inset 0 0 0 1px #eee;border-top-right-radius:0;align-self:flex-end}.chat-feed>div.other{background-color:#eee;border-top-left-radius:0;align-self:flex-start}.chat-feed>div.stick{margin-top:0.5rem}.chat-feed>div.stick.self{border-top-right-radius:4px}.chat-feed>div.stick.other{border-top-left-radius:4px}.chat-feed>div>.text{white-space:pre-wrap;word-break:break-all}.chat-feed>div>.text+.file{padding-top:0.5rem}.chat-feed>div>.file .attachedFile{text-decoration:none;margin-top:0.5rem}.chat-feed>strong{float:left;clear:both;margin-top:1rem;position:relative;overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;order:0;flex:0 0 auto}.chat-feed>strong.self{align-self:flex-end}.chat-feed>strong.other{align-self:flex-start}.chat-feed>strong.stick{margin-top:0.5rem}.chat-feed>strong+div{margin-top:0.5rem}.chat-feed>strong.unread:after{top:50%;transform:translate(150%, -50%)}.chat-feed .system{align-self:center}.chat-feed .unread:after{content:'';position:absolute;background-color:#ff7878;border-radius:50%;width:8px;height:8px;top:0;right:0;transform:translate(25%, -25%)}.chat-interlocutors strong{display:block}.chat-interlocutors ul li{margin-bottom:0}.chat-form{position:absolute;box-sizing:border-box;padding:0 20px;bottom:0;left:0;width:100%}.chat-form textarea{height:65px}.chat-form-controls{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.chat-form-controls>.chatSendButton{flex:0 1 auto}.chat-form-controls>.attachedFile{flex:0 1 auto}.chat-header a{float:right;margin-bottom:0;margin-top:-0.7rem;margin-left:0.5rem}.chat-header a svg{vertical-align:middle}.chat-header a.users{padding-right:15px}.chat-header a.users svg{margin-right:-0.5rem}.chat-header h6{float:left}.chat-header h6+a{float:left;margin-left:0}.modal{position:fixed;z-index:6;top:0;left:0;width:100%;height:100%;pointer-events:none;text-align:center}.modal:before{content:'';display:inline-block;height:100%;vertical-align:middle}.modal .underlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:transparent;transition:background-color 200ms ease-in-out}.modal .content{text-align:left;float:none;padding:1rem 1.5rem 1.5rem 1.5rem;display:inline-block;vertical-align:middle;background-color:#fff;width:90%;max-width:540px;opacity:0;box-sizing:border-box;border-radius:4px;transform:scale(0.7);transition:transform 200ms ease-in-out, opacity 200ms ease-in-out}.modal .content .header{text-align:center;font-size:1.5rem;line-height:32px;white-space:nowrap;text-transform:uppercase;letter-spacing:.2rem;font-weight:400}.modal .content .roster{margin-bottom:1rem}.modal .content .roster li{margin-bottom:0}.modal.active{pointer-events:auto}.modal.active .underlay{background-color:rgba(0,0,0,0.4)}.modal.active>div{transform:scale(1);opacity:1}.modal-buttons{text-align:center}.modal-buttons a{margin-bottom:0}#chat-feed-block{position:relative;box-sizing:border-box;padding-bottom:1.5rem}#chat-feed-block .toBottom{position:absolute;bottom:0;right:0;width:38px;margin-bottom:1.5rem;opacity:0;pointer-events:none;transform:translateY(-1rem);transition:opacity 100ms ease-in-out, transform 100ms ease-in-out}#chat-feed-block .toBottom.active{opacity:1;transform:translateY(0);pointer-events:auto}#chat-feed-block .toBottom.unread:after{content:'';top:0;left:0;transform:translate(-30%, -30%);position:absolute;background-color:#ff7878;border-radius:50%;width:8px;height:8px}#chat-form-block .attachedFile{margin-left:1rem;cursor:pointer}svg.white use{fill:#fff}svg.black use{fill:#040000}svg.icon use{stroke-width:0px}svg.icon.small{width:36px;height:36px}@media (min-width: 400px){.navbar.docked .columns,.errorContainer .columns{width:85%;padding:0}.chat-form{box-sizing:content-box;padding:0}.navbar ul li:not(:last-child){margin-right:2rem}}@media (min-width: 550px){.navbar.docked .columns,.errorContainer .columns{width:80%}.counter{text-align:left;padding:5.3rem 0 0 0}.counter-wrapper{max-height:100px;transition:none}}@media (max-width: 400px){.chat-header{margin-top:-1.5rem}.chat-header h6{margin-bottom:1rem}#chat-feed-block{padding-bottom:0.5rem}#chat-feed-block .toBottom{margin-bottom:0.5rem}#chat-form-block textarea{margin-bottom:0.5rem}#chat-form-block .chat-form-controls button{margin-bottom:0.5rem}#chat-form-block .chat-form-controls .attachedFile{margin-bottom:0}} diff --git a/public/js/app.js b/public/js/app.js index 1a289eb..8835304 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,528 +1,627 @@ var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(b){this.toString=function(){return"CORRUPT: "+this.message};this.message=b},invalid:function(b){this.toString=function(){return"INVALID: "+this.message};this.message=b},bug:function(b){this.toString=function(){return"BUG: "+this.message};this.message=b},notReady:function(b){this.toString=function(){return"NOT READY: "+this.message};this.message=b}}}; -"undefined"!==typeof module&&module.exports&&(module.exports=sjcl);"function"===typeof define&&define([],function(){return sjcl}); -sjcl.cipher.aes=function(b){this.s[0][0][0]||this.O();var a,d,c,f,g=this.s[0][4],h=this.s[1];a=b.length;var k=1;if(4!==a&&6!==a&&8!==a)throw new sjcl.exception.invalid("invalid aes key size");this.b=[c=b.slice(0),f=[]];for(b=a;b<4*a+28;b++){d=c[b-1];if(0===b%a||8===a&&4===b%a)d=g[d>>>24]<<24^g[d>>16&255]<<16^g[d>>8&255]<<8^g[d&255],0===b%a&&(d=d<<8^d>>>24^k<<24,k=k<<1^283*(k>>7));c[b]=c[b-a]^d}for(a=0;b;a++,b--)d=c[a&3?b:b-4],f[a]=4>=b||4>a?d:h[0][g[d>>>24]]^h[1][g[d>>16&255]]^h[2][g[d>>8&255]]^h[3][g[d& +sjcl.cipher.aes=function(b){this.s[0][0][0]||this.O();var a,e,c,g,h=this.s[0][4],k=this.s[1];a=b.length;var l=1;if(4!==a&&6!==a&&8!==a)throw new sjcl.exception.invalid("invalid aes key size");this.b=[c=b.slice(0),g=[]];for(b=a;b<4*a+28;b++){e=c[b-1];if(0===b%a||8===a&&4===b%a)e=h[e>>>24]<<24^h[e>>16&255]<<16^h[e>>8&255]<<8^h[e&255],0===b%a&&(e=e<<8^e>>>24^l<<24,l=l<<1^283*(l>>7));c[b]=c[b-a]^e}for(a=0;b;a++,b--)e=c[a&3?b:b-4],g[a]=4>=b||4>a?e:k[0][h[e>>>24]]^k[1][h[e>>16&255]]^k[2][h[e>>8&255]]^k[3][h[e& 255]]}; -sjcl.cipher.aes.prototype={encrypt:function(b){return u(this,b,0)},decrypt:function(b){return u(this,b,1)},s:[[[],[],[],[],[]],[[],[],[],[],[]]],O:function(){var b=this.s[0],a=this.s[1],d=b[4],c=a[4],f,g,h,k=[],l=[],n,m,p,q;for(f=0;256>f;f++)l[(k[f]=f<<1^283*(f>>7))^f]=f;for(g=h=0;!d[g];g^=n||1,h=l[h]||1)for(p=h^h<<1^h<<2^h<<3^h<<4,p=p>>8^p&255^99,d[g]=p,c[p]=g,m=k[f=k[n=k[g]]],q=16843009*m^65537*f^257*n^16843008*g,m=257*k[p]^16843008*p,f=0;4>f;f++)b[f][g]=m=m<<24^m>>>8,a[f][p]=q=q<<24^q>>>8;for(f= -0;5>f;f++)b[f]=b[f].slice(0),a[f]=a[f].slice(0)}}; -function u(b,a,d){if(4!==a.length)throw new sjcl.exception.invalid("invalid aes block size");var c=b.b[d],f=a[0]^c[0],g=a[d?3:1]^c[1],h=a[2]^c[2];a=a[d?1:3]^c[3];var k,l,n,m=c.length/4-2,p,q=4,r=[0,0,0,0];k=b.s[d];b=k[0];var x=k[1],J=k[2],P=k[3],U=k[4];for(p=0;p>>24]^x[g>>16&255]^J[h>>8&255]^P[a&255]^c[q],l=b[g>>>24]^x[h>>16&255]^J[a>>8&255]^P[f&255]^c[q+1],n=b[h>>>24]^x[a>>16&255]^J[f>>8&255]^P[g&255]^c[q+2],a=b[a>>>24]^x[f>>16&255]^J[g>>8&255]^P[h&255]^c[q+3],q+=4,f=k,g=l,h=n;for(p= -0;4>p;p++)r[d?3&-p:p]=U[f>>>24]<<24^U[g>>16&255]<<16^U[h>>8&255]<<8^U[a&255]^c[q++],k=f,f=g,g=h,h=a,a=k;return r} -sjcl.bitArray={bitSlice:function(b,a,d){b=sjcl.bitArray.$(b.slice(a/32),32-(a&31)).slice(1);return void 0===d?b:sjcl.bitArray.clamp(b,d-a)},extract:function(b,a,d){var c=Math.floor(-a-d&31);return((a+d-1^a)&-32?b[a/32|0]<<32-c^b[a/32+1|0]>>>c:b[a/32|0]>>>c)&(1<>a-1,1));return b},partial:function(b,a,d){return 32===b?a:(d?a|0:a<<32-b)+1099511627776*b},getPartial:function(b){return Math.round(b/1099511627776)||32},equal:function(b,a){if(sjcl.bitArray.bitLength(b)!==sjcl.bitArray.bitLength(a))return!1;var d=0,c;for(c=0;c>>a),d=b[f]<<32-a;f=b.length?b[b.length-1]:0;b=sjcl.bitArray.getPartial(f);c.push(sjcl.bitArray.partial(a+b&31,32>>24|d>>>8&65280|(d&65280)<<8|d<<24;return b}}; -sjcl.codec.utf8String={fromBits:function(b){var a="",d=sjcl.bitArray.bitLength(b),c,f;for(c=0;c>>24),f<<=8;return decodeURIComponent(escape(a))},toBits:function(b){b=unescape(encodeURIComponent(b));var a=[],d,c=0;for(d=0;d>>h)>>>f),hm){if(!a)try{return sjcl.codec.base32hex.toBits(b)}catch(q){}throw new sjcl.exception.invalid("this isn't "+p+"!");}k>f?(k-=f,g.push(n^m>>>k),n=m<g;g++)m[(l[g]=g<<1^283*(g>>7))^g]=g;for(h=k=0;!e[h];h^=n||1,k=m[k]||1)for(r=k^k<<1^k<<2^k<<3^k<<4,r=r>>8^r&255^99,e[h]=r,c[r]=h,p=l[g=l[n=l[h]]],v=16843009*p^65537*g^257*n^16843008*h,p=257*l[r]^16843008*r,g=0;4>g;g++)b[g][h]=p=p<<24^p>>>8,a[g][r]=v=v<<24^v>>>8;for(g= +0;5>g;g++)b[g]=b[g].slice(0),a[g]=a[g].slice(0)}}; +function t(b,a,e){if(4!==a.length)throw new sjcl.exception.invalid("invalid aes block size");var c=b.b[e],g=a[0]^c[0],h=a[e?3:1]^c[1],k=a[2]^c[2];a=a[e?1:3]^c[3];var l,m,n,p=c.length/4-2,r,v=4,w=[0,0,0,0];l=b.s[e];b=l[0];var L=l[1],J=l[2],V=l[3],ha=l[4];for(r=0;r>>24]^L[h>>16&255]^J[k>>8&255]^V[a&255]^c[v],m=b[h>>>24]^L[k>>16&255]^J[a>>8&255]^V[g&255]^c[v+1],n=b[k>>>24]^L[a>>16&255]^J[g>>8&255]^V[h&255]^c[v+2],a=b[a>>>24]^L[g>>16&255]^J[h>>8&255]^V[k&255]^c[v+3],v+=4,g=l,h=m,k=n;for(r= +0;4>r;r++)w[e?3&-r:r]=ha[g>>>24]<<24^ha[h>>16&255]<<16^ha[k>>8&255]<<8^ha[a&255]^c[v++],l=g,g=h,h=k,k=a,a=l;return w} +sjcl.bitArray={bitSlice:function(b,a,e){b=sjcl.bitArray.$(b.slice(a/32),32-(a&31)).slice(1);return void 0===e?b:sjcl.bitArray.clamp(b,e-a)},extract:function(b,a,e){var c=Math.floor(-a-e&31);return((a+e-1^a)&-32?b[a/32|0]<<32-c^b[a/32+1|0]>>>c:b[a/32|0]>>>c)&(1<>a-1,1));return b},partial:function(b,a,e){return 32===b?a:(e?a|0:a<<32-b)+1099511627776*b},getPartial:function(b){return Math.round(b/1099511627776)||32},equal:function(b,a){if(sjcl.bitArray.bitLength(b)!==sjcl.bitArray.bitLength(a))return!1;var e=0,c;for(c=0;c>>a),e=b[g]<<32-a;g=b.length?b[b.length-1]:0;b=sjcl.bitArray.getPartial(g);c.push(sjcl.bitArray.partial(a+b&31,32>>24|e>>>8&65280|(e&65280)<<8|e<<24;return b}}; +sjcl.codec.utf8String={fromBits:function(b){var a="",e=sjcl.bitArray.bitLength(b),c,g;for(c=0;c>>24),g<<=8;return decodeURIComponent(escape(a))},toBits:function(b){b=unescape(encodeURIComponent(b));var a=[],e,c=0;for(e=0;e>>k)>>>g),kp){if(!a)try{return sjcl.codec.base32hex.toBits(b)}catch(v){}throw new sjcl.exception.invalid("this isn't "+r+"!");}l>g?(l-=g,h.push(n^p>>>l),n=p<>>f)>>>26),6>f?(h=b[d]<<6-f,f+=26,d++):(h<<=6,f-=6);for(;c.length&3&&!a;)c+="=";return c},toBits:function(b,a){b=b.replace(/\s|=/g,"");var d=[],c,f=0,g=sjcl.codec.base64.B,h=0,k;a&&(g=g.substr(0,62)+"-_");for(c=0;ck)throw new sjcl.exception.invalid("this isn't base64!");26>>f),h=k<<32-f):(f+=6,h^=k<<32-f)}f&56&&d.push(sjcl.bitArray.partial(f&56,h,1));return d}};sjcl.codec.base64url={fromBits:function(b){return sjcl.codec.base64.fromBits(b,1,1)},toBits:function(b){return sjcl.codec.base64.toBits(b,1)}};sjcl.hash.sha256=function(b){this.b[0]||this.O();b?(this.F=b.F.slice(0),this.A=b.A.slice(0),this.l=b.l):this.reset()};sjcl.hash.sha256.hash=function(b){return(new sjcl.hash.sha256).update(b).finalize()}; -sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.F=this.Y.slice(0);this.A=[];this.l=0;return this},update:function(b){"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));var a,d=this.A=sjcl.bitArray.concat(this.A,b);a=this.l;b=this.l=a+sjcl.bitArray.bitLength(b);for(a=512+a&-512;a<=b;a+=512)v(this,d.splice(0,16));return this},finalize:function(){var b,a=this.A,d=this.F,a=sjcl.bitArray.concat(a,[sjcl.bitArray.partial(1,1)]);for(b=a.length+2;b&15;b++)a.push(0);a.push(Math.floor(this.l/ -4294967296));for(a.push(this.l|0);a.length;)v(this,a.splice(0,16));this.reset();return d},Y:[],b:[],O:function(){function b(a){return 4294967296*(a-Math.floor(a))|0}var a=0,d=2,c;a:for(;64>a;d++){for(c=2;c*c<=d;c++)if(0===d%c)continue a;8>a&&(this.Y[a]=b(Math.pow(d,.5)));this.b[a]=b(Math.pow(d,1/3));a++}}}; -function v(b,a){var d,c,f,g=a.slice(0),h=b.F,k=b.b,l=h[0],n=h[1],m=h[2],p=h[3],q=h[4],r=h[5],x=h[6],J=h[7];for(d=0;64>d;d++)16>d?c=g[d]:(c=g[d+1&15],f=g[d+14&15],c=g[d&15]=(c>>>7^c>>>18^c>>>3^c<<25^c<<14)+(f>>>17^f>>>19^f>>>10^f<<15^f<<13)+g[d&15]+g[d+9&15]|0),c=c+J+(q>>>6^q>>>11^q>>>25^q<<26^q<<21^q<<7)+(x^q&(r^x))+k[d],J=x,x=r,r=q,q=p+c|0,p=m,m=n,n=l,l=c+(n&m^p&(n^m))+(n>>>2^n>>>13^n>>>22^n<<30^n<<19^n<<10)|0;h[0]=h[0]+l|0;h[1]=h[1]+n|0;h[2]=h[2]+m|0;h[3]=h[3]+p|0;h[4]=h[4]+q|0;h[5]=h[5]+r|0;h[6]= -h[6]+x|0;h[7]=h[7]+J|0} -sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(b){sjcl.mode.ccm.G.push(b)},unListenProgress:function(b){b=sjcl.mode.ccm.G.indexOf(b);-1l)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(g=2;4>g&&n>>>8*g;g++);g<15-l&&(g=15-l);d=k.clamp(d, -8*(15-g));a=sjcl.mode.ccm.V(b,a,d,c,f,g);h=sjcl.mode.ccm.C(b,h,d,a,f,g);return k.concat(h.data,h.tag)},decrypt:function(b,a,d,c,f){f=f||64;c=c||[];var g=sjcl.bitArray,h=g.bitLength(d)/8,k=g.bitLength(a),l=g.clamp(a,k-f),n=g.bitSlice(a,k-f),k=(k-f)/8;if(7>h)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(a=2;4>a&&k>>>8*a;a++);a<15-h&&(a=15-h);d=g.clamp(d,8*(15-a));l=sjcl.mode.ccm.C(b,l,d,n,f,a);b=sjcl.mode.ccm.V(b,l.data,d,c,f,a);if(!g.equal(l.tag,b))throw new sjcl.exception.corrupt("ccm: tag doesn't match"); -return l.data},na:function(b,a,d,c,f,g){var h=[],k=sjcl.bitArray,l=k.i;c=[k.partial(8,(a.length?64:0)|c-2<<2|g-1)];c=k.concat(c,d);c[3]|=f;c=b.encrypt(c);if(a.length)for(d=k.bitLength(a)/8,65279>=d?h=[k.partial(16,d)]:4294967295>=d&&(h=k.concat([k.partial(16,65534)],[d])),h=k.concat(h,a),a=0;af||16m&&(sjcl.mode.ccm.fa(h/ -l),m+=p),d[3]++,f=b.encrypt(d),a[h]^=f[0],a[h+1]^=f[1],a[h+2]^=f[2],a[h+3]^=f[3];return{tag:c,data:k.clamp(a,n)}}}; -sjcl.mode.ocb2={name:"ocb2",encrypt:function(b,a,d,c,f,g){if(128!==sjcl.bitArray.bitLength(d))throw new sjcl.exception.invalid("ocb iv must be 128 bits");var h,k=sjcl.mode.ocb2.S,l=sjcl.bitArray,n=l.i,m=[0,0,0,0];d=k(b.encrypt(d));var p,q=[];c=c||[];f=f||64;for(h=0;h+4f.bitLength(d)&&(k=g(k,c(k)),d=f.concat(d,[-2147483648,0,0,0]));h=g(h,d); -return b.encrypt(g(c(g(k,c(k))),h))},S:function(b){return[b[0]<<1^b[1]>>>31,b[1]<<1^b[2]>>>31,b[2]<<1^b[3]>>>31,b[3]<<1^135*(b[0]>>>31)]}}; -sjcl.mode.gcm={name:"gcm",encrypt:function(b,a,d,c,f){var g=a.slice(0);a=sjcl.bitArray;c=c||[];b=sjcl.mode.gcm.C(!0,b,g,c,d,f||128);return a.concat(b.data,b.tag)},decrypt:function(b,a,d,c,f){var g=a.slice(0),h=sjcl.bitArray,k=h.bitLength(g);f=f||128;c=c||[];f<=k?(a=h.bitSlice(g,k-f),g=h.bitSlice(g,0,k-f)):(a=g,g=[]);b=sjcl.mode.gcm.C(!1,b,g,c,d,f);if(!h.equal(b.tag,a))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return b.data},ka:function(b,a){var d,c,f,g,h,k=sjcl.bitArray.i;f=[0,0, -0,0];g=a.slice(0);for(d=0;128>d;d++){0!==(b[Math.floor(d/32)]&1<<31-d%32)&&(f=k(f,g));h=0!==(g[3]&1);for(c=3;0>>1|(g[c-1]&1)<<31;g[0]>>>=1;h&&(g[0]^=-520093696)}return f},j:function(b,a,d){var c,f=d.length;a=a.slice(0);for(c=0;cf&&(b=a.hash(b));for(c=0;c>>g)>>>26),6>g?(k=b[e]<<6-g,g+=26,e++):(k<<=6,g-=6);for(;c.length&3&&!a;)c+="=";return c},toBits:function(b,a){b=b.replace(/\s|=/g,"");var e=[],c,g=0,h=sjcl.codec.base64.B,k=0,l;a&&(h=h.substr(0,62)+"-_");for(c=0;cl)throw new sjcl.exception.invalid("this isn't base64!");26>>g),k=l<<32-g):(g+=6,k^=l<<32-g)}g&56&&e.push(sjcl.bitArray.partial(g&56,k,1));return e}};sjcl.codec.base64url={fromBits:function(b){return sjcl.codec.base64.fromBits(b,1,1)},toBits:function(b){return sjcl.codec.base64.toBits(b,1)}};sjcl.hash.sha256=function(b){this.b[0]||this.O();b?(this.F=b.F.slice(0),this.A=b.A.slice(0),this.l=b.l):this.reset()};sjcl.hash.sha256.hash=function(b){return(new sjcl.hash.sha256).update(b).finalize()}; +sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.F=this.Y.slice(0);this.A=[];this.l=0;return this},update:function(b){"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));var a,e=this.A=sjcl.bitArray.concat(this.A,b);a=this.l;b=this.l=a+sjcl.bitArray.bitLength(b);if(9007199254740991a;e++){g=!0;for(c=2;c*c<=e;c++)if(0===e%c){g= +!1;break}g&&(8>a&&(this.Y[a]=b(Math.pow(e,.5))),this.b[a]=b(Math.pow(e,1/3)),a++)}}}; +function u(b,a){var e,c,g,h=b.F,k=b.b,l=h[0],m=h[1],n=h[2],p=h[3],r=h[4],v=h[5],w=h[6],L=h[7];for(e=0;64>e;e++)16>e?c=a[e]:(c=a[e+1&15],g=a[e+14&15],c=a[e&15]=(c>>>7^c>>>18^c>>>3^c<<25^c<<14)+(g>>>17^g>>>19^g>>>10^g<<15^g<<13)+a[e&15]+a[e+9&15]|0),c=c+L+(r>>>6^r>>>11^r>>>25^r<<26^r<<21^r<<7)+(w^r&(v^w))+k[e],L=w,w=v,v=r,r=p+c|0,p=n,n=m,m=l,l=c+(m&n^p&(m^n))+(m>>>2^m>>>13^m>>>22^m<<30^m<<19^m<<10)|0;h[0]=h[0]+l|0;h[1]=h[1]+m|0;h[2]=h[2]+n|0;h[3]=h[3]+p|0;h[4]=h[4]+r|0;h[5]=h[5]+v|0;h[6]=h[6]+w|0;h[7]= +h[7]+L|0} +sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(b){sjcl.mode.ccm.G.push(b)},unListenProgress:function(b){b=sjcl.mode.ccm.G.indexOf(b);-1m)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(h=2;4>h&&n>>>8*h;h++);h<15-m&&(h=15-m);e=l.clamp(e, +8*(15-h));a=sjcl.mode.ccm.V(b,a,e,c,g,h);k=sjcl.mode.ccm.C(b,k,e,a,g,h);return l.concat(k.data,k.tag)},decrypt:function(b,a,e,c,g){g=g||64;c=c||[];var h=sjcl.bitArray,k=h.bitLength(e)/8,l=h.bitLength(a),m=h.clamp(a,l-g),n=h.bitSlice(a,l-g),l=(l-g)/8;if(7>k)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(a=2;4>a&&l>>>8*a;a++);a<15-k&&(a=15-k);e=h.clamp(e,8*(15-a));m=sjcl.mode.ccm.C(b,m,e,n,g,a);b=sjcl.mode.ccm.V(b,m.data,e,c,g,a);if(!h.equal(m.tag,b))throw new sjcl.exception.corrupt("ccm: tag doesn't match"); +return m.data},na:function(b,a,e,c,g,h){var k=[],l=sjcl.bitArray,m=l.i;c=[l.partial(8,(a.length?64:0)|c-2<<2|h-1)];c=l.concat(c,e);c[3]|=g;c=b.encrypt(c);if(a.length)for(e=l.bitLength(a)/8,65279>=e?k=[l.partial(16,e)]:4294967295>=e&&(k=l.concat([l.partial(16,65534)],[e])),k=l.concat(k,a),a=0;ag||16p&&(sjcl.mode.ccm.fa(k/ +m),p+=r),e[3]++,g=b.encrypt(e),a[k]^=g[0],a[k+1]^=g[1],a[k+2]^=g[2],a[k+3]^=g[3];return{tag:c,data:l.clamp(a,n)}}}; +sjcl.mode.ocb2={name:"ocb2",encrypt:function(b,a,e,c,g,h){if(128!==sjcl.bitArray.bitLength(e))throw new sjcl.exception.invalid("ocb iv must be 128 bits");var k,l=sjcl.mode.ocb2.S,m=sjcl.bitArray,n=m.i,p=[0,0,0,0];e=l(b.encrypt(e));var r,v=[];c=c||[];g=g||64;for(k=0;k+4g.bitLength(e)&&(l=h(l,c(l)),e=g.concat(e,[-2147483648,0,0,0]));k=h(k,e); +return b.encrypt(h(c(h(l,c(l))),k))},S:function(b){return[b[0]<<1^b[1]>>>31,b[1]<<1^b[2]>>>31,b[2]<<1^b[3]>>>31,b[3]<<1^135*(b[0]>>>31)]}}; +sjcl.mode.gcm={name:"gcm",encrypt:function(b,a,e,c,g){var h=a.slice(0);a=sjcl.bitArray;c=c||[];b=sjcl.mode.gcm.C(!0,b,h,c,e,g||128);return a.concat(b.data,b.tag)},decrypt:function(b,a,e,c,g){var h=a.slice(0),k=sjcl.bitArray,l=k.bitLength(h);g=g||128;c=c||[];g<=l?(a=k.bitSlice(h,l-g),h=k.bitSlice(h,0,l-g)):(a=h,h=[]);b=sjcl.mode.gcm.C(!1,b,h,c,e,g);if(!k.equal(b.tag,a))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return b.data},ka:function(b,a){var e,c,g,h,k,l=sjcl.bitArray.i;g=[0,0, +0,0];h=a.slice(0);for(e=0;128>e;e++){0!==(b[Math.floor(e/32)]&1<<31-e%32)&&(g=l(g,h));k=0!==(h[3]&1);for(c=3;0>>1|(h[c-1]&1)<<31;h[0]>>>=1;k&&(h[0]^=-520093696)}return g},j:function(b,a,e){var c,g=e.length;a=a.slice(0);for(c=0;cg&&(b=a.hash(b));for(c=0;cc||0>d)throw sjcl.exception.invalid("invalid params to pbkdf2");"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));f=f||sjcl.misc.hmac;b=new f(b);var g,h,k,l,n=[],m=sjcl.bitArray;for(l=1;32*n.length<(c||1);l++){f=g=b.encrypt(m.concat(a,[l]));for(h=1;hc||0>e)throw new sjcl.exception.invalid("invalid params to pbkdf2");"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));g=g||sjcl.misc.hmac;b=new g(b);var h,k,l,m,n=[],p=sjcl.bitArray;for(m=1;32*n.length<(c||1);m++){g=h=b.encrypt(p.concat(a,[m]));for(k=1;kh;h++)f.push(4294967296*Math.random()|0);for(h=0;h=1<this.o&&(this.o= -g);this.P++;this.b=sjcl.hash.sha256.hash(this.b.concat(f));this.L=new sjcl.cipher.aes(this.b);for(c=0;4>c&&(this.h[c]=this.h[c]+1|0,!this.h[c]);c++);}for(c=0;c>>=1;this.c[h].update([c,this.N++,2,a,g,b.length].concat(b))}break;case "string":void 0===a&&(a=b.length);this.c[h].update([c,this.N++,3,a,g,b.length]);this.c[h].update(b);break;default:l=1}if(l)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[h]+=a;this.f+=a;k===this.u&&(this.isReady()!==this.u&&A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))},isReady:function(b){b=this.T[void 0!== -b?b:this.M];return this.o&&this.o>=b?this.m[0]>this.ba&&(new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=b?this.J|this.u:this.u},getProgress:function(b){b=this.T[b?b:this.M];return this.o>=b?1:this.f>b?1:this.f/b},startCollectors:function(){if(!this.D){this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)};if(window.addEventListener)window.addEventListener("load",this.a.loadTimeCollector, -!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else if(document.attachEvent)document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector);else throw new sjcl.exception.bug("can't attach event"); +sjcl.prng.prototype={randomWords:function(b,a){var e=[],c;c=this.isReady(a);var g;if(c===this.u)throw new sjcl.exception.notReady("generator isn't seeded");if(c&this.J){c=!(c&this.I);g=[];var h=0,k;this.Z=g[0]=(new Date).valueOf()+this.da;for(k=0;16>k;k++)g.push(4294967296*Math.random()|0);for(k=0;k=1<this.o&&(this.o= +h);this.P++;this.b=sjcl.hash.sha256.hash(this.b.concat(g));this.L=new sjcl.cipher.aes(this.b);for(c=0;4>c&&(this.h[c]=this.h[c]+1|0,!this.h[c]);c++);}for(c=0;c>>=1;this.c[k].update([c,this.N++,2,a,h,b.length].concat(b))}break;case "string":void 0===a&&(a=b.length);this.c[k].update([c,this.N++,3,a,h,b.length]);this.c[k].update(b);break;default:m=1}if(m)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[k]+=a;this.f+=a;l===this.u&&(this.isReady()!==this.u&&A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))}, +isReady:function(b){b=this.T[void 0!==b?b:this.M];return this.o&&this.o>=b?this.m[0]>this.ba&&(new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=b?this.J|this.u:this.u},getProgress:function(b){b=this.T[b?b:this.M];return this.o>=b?1:this.f>b?1:this.f/b},startCollectors:function(){if(!this.D){this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)};if(window.addEventListener)window.addEventListener("load", +this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else if(document.attachEvent)document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector);else throw new sjcl.exception.bug("can't attach event"); this.D=!0}},stopCollectors:function(){this.D&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove", -this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(b,a){this.K[b][this.ga++]=a},removeEventListener:function(b,a){var d,c,f=this.K[b],g=[];for(c in f)f.hasOwnProperty(c)&&f[c]===a&&g.push(c);for(d=0;da&&(b.h[a]=b.h[a]+1|0,!b.h[a]);a++);return b.L.encrypt(b.h)}function B(b,a){return function(){a.apply(b,arguments)}}sjcl.random=new sjcl.prng(6); +this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(b,a){this.K[b][this.ga++]=a},removeEventListener:function(b,a){var e,c,g=this.K[b],h=[];for(c in g)g.hasOwnProperty(c)&&g[c]===a&&h.push(c);for(e=0;ea&&(b.h[a]=b.h[a]+1|0,!b.h[a]);a++);return b.L.encrypt(b.h)} +function B(b,a){return function(){a.apply(b,arguments)}}sjcl.random=new sjcl.prng(6); a:try{var D,E,F,G;if(G="undefined"!==typeof module&&module.exports){var H;try{H=require("crypto")}catch(b){H=null}G=E=H}if(G&&E.randomBytes)D=E.randomBytes(128),D=new Uint32Array((new Uint8Array(D)).buffer),sjcl.random.addEntropy(D,1024,"crypto['randomBytes']");else if("undefined"!==typeof window&&"undefined"!==typeof Uint32Array){F=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(F);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(F); else break a;sjcl.random.addEntropy(F,1024,"crypto['getRandomValues']")}}catch(b){"undefined"!==typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(b))} -sjcl.json={defaults:{v:1,iter:1E3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},ja:function(b,a,d,c){d=d||{};c=c||{};var f=sjcl.json,g=f.g({iv:sjcl.random.randomWords(4,0)},f.defaults),h;f.g(g,d);d=g.adata;"string"===typeof g.salt&&(g.salt=sjcl.codec.base64.toBits(g.salt));"string"===typeof g.iv&&(g.iv=sjcl.codec.base64.toBits(g.iv));if(!sjcl.mode[g.mode]||!sjcl.cipher[g.cipher]||"string"===typeof b&&100>=g.iter||64!==g.ts&&96!==g.ts&&128!==g.ts||128!==g.ks&&192!==g.ks&&256!==g.ks||2>g.iv.length|| -4=a.iter||64!==a.ts&&96!==a.ts&&128!==a.ts||128!==a.ks&&192!==a.ks&&256!==a.ks||!a.iv||2>a.iv.length||4=h.iter||64!==h.ts&&96!==h.ts&&128!==h.ts||128!==h.ks&&192!==h.ks&&256!==h.ks||2>h.iv.length|| +4=a.iter||64!==a.ts&&96!==a.ts&&128!==a.ts||128!==a.ks&&192!==a.ks&&256!==a.ks||!a.iv||2>a.iv.length||4')}catch(a){l=document.createElement("iframe"), -l.name=f.iframeId,l.src="javascript:0"}l.id=f.iframeId;f.form.appendChild(l);f.iframe=l}var f=this;if(!this.form){var g=document.createElement("form"),h=document.createElement("textarea"),k=this.iframeId="eio_iframe_"+this.index,l;g.className="socketio";g.style.position="absolute";g.style.top="-1000px";g.style.left="-1000px";g.target=k;g.method="POST";g.setAttribute("accept-charset","utf-8");h.name="d";g.appendChild(h);document.body.appendChild(g);this.form=g;this.area=h}this.form.action=this.uri(); -d();a=a.replace(m,"\\\n");this.area.value=a.replace(n,"\\n");try{this.form.submit()}catch(p){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"==f.iframe.readyState&&c()}:this.iframe.onload=c}}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:{})},{"./polling":8,"component-inherit":16}],7:[function(a,b,c){(function(c){function g(){}function h(a){m.call(this,a);if(c.location){var b="https:"==location.protocol, -d=location.port;d||(d=b?443:80);this.xd=a.hostname!=c.location.hostname||d!=a.port;this.xs=a.secure!=b}else this.extraHeaders=a.extraHeaders}function k(a){this.method=a.method||"GET";this.uri=a.uri;this.xd=!!a.xd;this.xs=!!a.xs;this.async=!1!==a.async;this.data=void 0!=a.data?a.data:null;this.agent=a.agent;this.isBinary=a.isBinary;this.supportsBinary=a.supportsBinary;this.enablesXDR=a.enablesXDR;this.pfx=a.pfx;this.key=a.key;this.passphrase=a.passphrase;this.cert=a.cert;this.ca=a.ca;this.ciphers= -a.ciphers;this.rejectUnauthorized=a.rejectUnauthorized;this.extraHeaders=a.extraHeaders;this.create()}function l(){for(var a in k.requests)k.requests.hasOwnProperty(a)&&k.requests[a].abort()}var n=a("xmlhttprequest-ssl"),m=a("./polling"),p=a("component-emitter"),q=a("component-inherit"),r=a("debug")("engine.io-client:polling-xhr");b.exports=h;b.exports.Request=k;q(h,m);h.prototype.supportsBinary=!0;h.prototype.request=function(a){a=a||{};a.uri=this.uri();a.xd=this.xd;a.xs=this.xs;a.agent=this.agent|| -!1;a.supportsBinary=this.supportsBinary;a.enablesXDR=this.enablesXDR;a.pfx=this.pfx;a.key=this.key;a.passphrase=this.passphrase;a.cert=this.cert;a.ca=this.ca;a.ciphers=this.ciphers;a.rejectUnauthorized=this.rejectUnauthorized;a.extraHeaders=this.extraHeaders;return new k(a)};h.prototype.doWrite=function(a,b){var c=this.request({method:"POST",data:a,isBinary:"string"!==typeof a&&void 0!==a}),d=this;c.on("success",b);c.on("error",function(a){d.onError("xhr post error",a)});this.sendXhr=c};h.prototype.doPoll= -function(){r("xhr poll");var a=this.request(),b=this;a.on("data",function(a){b.onData(a)});a.on("error",function(a){b.onError("xhr poll error",a)});this.pollXhr=a};p(k.prototype);k.prototype.create=function(){var a={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};a.pfx=this.pfx;a.key=this.key;a.passphrase=this.passphrase;a.cert=this.cert;a.ca=this.ca;a.ciphers=this.ciphers;a.rejectUnauthorized=this.rejectUnauthorized;var b=this.xhr=new n(a),d=this;try{r("xhr open %s: %s", -this.method,this.uri);b.open(this.method,this.uri,this.async);try{if(this.extraHeaders){b.setDisableHeaderCheck(!0);for(var g in this.extraHeaders)this.extraHeaders.hasOwnProperty(g)&&b.setRequestHeader(g,this.extraHeaders[g])}}catch(h){}this.supportsBinary&&(b.responseType="arraybuffer");if("POST"==this.method)try{this.isBinary?b.setRequestHeader("Content-type","application/octet-stream"):b.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(h){}"withCredentials"in b&&(b.withCredentials= -!0);this.hasXDR()?(b.onload=function(){d.onLoad()},b.onerror=function(){d.onError(b.responseText)}):b.onreadystatechange=function(){if(4==b.readyState)if(200==b.status||1223==b.status)d.onLoad();else setTimeout(function(){d.onError(b.status)},0)};r("xhr data %s",this.data);b.send(this.data)}catch(h){setTimeout(function(){d.onError(h)},0);return}c.document&&(this.index=k.requestsCount++,k.requests[this.index]=this)};k.prototype.onSuccess=function(){this.emit("success");this.cleanup()};k.prototype.onData= -function(a){this.emit("data",a);this.onSuccess()};k.prototype.onError=function(a){this.emit("error",a);this.cleanup(!0)};k.prototype.cleanup=function(a){if("undefined"!=typeof this.xhr&&null!==this.xhr){this.hasXDR()?this.xhr.onload=this.xhr.onerror=g:this.xhr.onreadystatechange=g;if(a)try{this.xhr.abort()}catch(b){}c.document&&delete k.requests[this.index];this.xhr=null}};k.prototype.onLoad=function(){var a;try{var b;try{b=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(c){}if("application/octet-stream"=== -b)a=this.xhr.response;else if(this.supportsBinary)try{a=String.fromCharCode.apply(null,new Uint8Array(this.xhr.response))}catch(c){var d=new Uint8Array(this.xhr.response);b=[];for(var f=0,g=d.length;f=d.count)throw Error("after called too many times");--d.count;a?(n=!0,b(a),b=c):0!==d.count||n||b(null,f)}var n=!1;c=c||f;d.count=a;return 0===a?b():d}},{}],12:[function(a,b,c){b.exports=function(a,b,c){var d=a.byteLength;b=b||0;c=c||d;if(a.slice)return a.slice(b,c);0> -b&&(b+=d);0>c&&(c+=d);c>d&&(c=d);if(b>=d||b>=c||0===d)return new ArrayBuffer(0);a=new Uint8Array(a);for(var d=new Uint8Array(c-b),l=0;b>2],l+=a[(b[c]&3)<<4|b[c+1]>>4],l+=a[(b[c+1]&15)<<2|b[c+2]>>6],l+=a[b[c+2]&63];2===d%3?l=l.substring(0,l.length-1)+"=":1===d%3&&(l=l.substring(0,l.length-2)+"==");return l};c.decode=function(b){var c= -.75*b.length,d=b.length,l=0,n,m,p,q;"="===b[b.length-1]&&(c--,"="===b[b.length-2]&&c--);for(var r=new ArrayBuffer(c),x=new Uint8Array(r),c=0;c>4,x[l++]=(m&15)<<4|p>>2,x[l++]=(p&3)<<6|q&63;return r}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],14:[function(a,b,c){(function(a){function c(a){for(var b=0;b=f&&c=a)throw Error("Lone surrogate U+"+a.toString(16).toUpperCase()+" is not a scalar value");}function l(){if(P>=J)throw Error("Invalid byte index");var a=x[P]&255;P++;if(128==(a&192))return a&63;throw Error("Invalid continuation byte"); -}function n(){var a,b,c,d;if(P>J)throw Error("Invalid byte index");if(P==J)return!1;a=x[P]&255;P++;if(0==(a&128))return a;if(192==(a&224)){b=l();a=(a&31)<<6|b;if(128<=a)return a;throw Error("Invalid continuation byte");}if(224==(a&240)){b=l();c=l();a=(a&15)<<12|b<<6|c;if(2048<=a)return k(a),a;throw Error("Invalid continuation byte");}if(240==(a&248)&&(b=l(),c=l(),d=l(),a=(a&15)<<18|b<<12|c<<6|d,65536<=a&&1114111>=a))return a;throw Error("Invalid UTF-8 detected");}var m="object"==typeof c&&c,p="object"== -typeof b&&b&&b.exports==m&&b,q="object"==typeof a&&a;if(q.global===q||q.window===q)g=q;var r=String.fromCharCode,x,J,P,q={version:"2.0.0",encode:function(a){a=h(a);for(var b=a.length,c=-1,d,f="";++c>6&31|192):0==(d&4294901760)?(k(d),g=r(d>>12&15|224),g+=r(d>>6&63|128)):0==(d&4292870144)&&(g=r(d>>18&7|240),g+=r(d>>12&63|128),g+=r(d>>6&63|128));d=g+=r(d&63|128)}f+=d}return f},decode:function(a){x=h(a);J=x.length;P=0;a=[]; -for(var b;!1!==(b=n());)a.push(b);b=a.length;for(var c=-1,d,f="";++c>>10&1023|55296),d=56320|d&1023),f+=r(d);return f}};if(m&&!m.nodeType)if(p)p.exports=q;else{g={}.hasOwnProperty;for(var U in q)g.call(q,U)&&(m[U]=q[U])}else g.utf8=q})(this)}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:{})},{}],30:[function(a,b,c){function f(a){var b="";do b=h[a%64]+b,a=Math.floor(a/64);while(0n;n++)k[h[n]]=n;g.encode=f;g.decode=function(a){var b=0;for(n=0;n=this._reconnectionAttempts)m("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var b=this.backoff.duration();m("will wait %dms before reconnect attempt",b);this.reconnecting=!0;var c=setTimeout(function(){a.skipReconnect||(m("attempting reconnect"), -a.emitAll("reconnect_attempt",a.backoff.attempts),a.emitAll("reconnecting",a.backoff.attempts),a.skipReconnect||a.open(function(b){b?(m("reconnect attempt error"),a.reconnecting=!1,a.reconnect(),a.emitAll("reconnect_error",b.data)):(m("reconnect success"),a.onreconnect())}))},b);this.subs.push({destroy:function(){clearTimeout(c)}})}};f.prototype.onreconnect=function(){var a=this.backoff.attempts;this.reconnecting=!1;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",a)}},{"./on":33, -"./socket":34,backo2:36,"component-bind":37,"component-emitter":38,debug:39,"engine.io-client":1,indexof:42,"socket.io-parser":47}],33:[function(a,b,c){b.exports=function(a,b,c){a.on(b,c);return{destroy:function(){a.removeListener(b,c)}}}},{}],34:[function(a,b,c){function f(a,b){this.io=a;this.nsp=b;this.json=this;this.ids=0;this.acks={};this.receiveBuffer=[];this.sendBuffer=[];this.connected=!1;this.disconnected=!0;this.io.autoConnect&&this.open()}var g=a("socket.io-parser");c=a("component-emitter"); -var h=a("to-array"),k=a("./on"),l=a("component-bind"),n=a("debug")("socket.io-client:socket"),m=a("has-binary");b.exports=f;var p={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},q=c.prototype.emit;c(f.prototype);f.prototype.subEvents=function(){if(!this.subs){var a=this.io;this.subs=[k(a,"open",l(this,"onopen")),k(a,"packet",l(this,"onpacket")),k(a,"close",l(this,"onclose"))]}}; -f.prototype.open=f.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();this.emit("connecting");return this};f.prototype.send=function(){var a=h(arguments);a.unshift("message");this.emit.apply(this,a);return this};f.prototype.emit=function(a){if(p.hasOwnProperty(a))return q.apply(this,arguments),this;var b=h(arguments),c=g.EVENT;m(b)&&(c=g.BINARY_EVENT);c={type:c,data:b,options:{}};c.options.compress=!this.flags||!1!== -this.flags.compress;"function"==typeof b[b.length-1]&&(n("emitting packet with ack id %d",this.ids),this.acks[this.ids]=b.pop(),c.id=this.ids++);this.connected?this.packet(c):this.sendBuffer.push(c);delete this.flags;return this};f.prototype.packet=function(a){a.nsp=this.nsp;this.io.packet(a)};f.prototype.onopen=function(){n("transport is open - connecting");"/"!=this.nsp&&this.packet({type:g.CONNECT})};f.prototype.onclose=function(a){n("close (%s)",a);this.connected=!1;this.disconnected=!0;delete this.id; -this.emit("disconnect",a)};f.prototype.onpacket=function(a){if(a.nsp==this.nsp)switch(a.type){case g.CONNECT:this.onconnect();break;case g.EVENT:this.onevent(a);break;case g.BINARY_EVENT:this.onevent(a);break;case g.ACK:this.onack(a);break;case g.BINARY_ACK:this.onack(a);break;case g.DISCONNECT:this.ondisconnect();break;case g.ERROR:this.emit("error",a.data)}};f.prototype.onevent=function(a){var b=a.data||[];n("emitting event %j",b);null!=a.id&&(n("attaching ack callback to event"),b.push(this.ack(a.id))); -this.connected?q.apply(this,b):this.receiveBuffer.push(b)};f.prototype.ack=function(a){var b=this,c=!1;return function(){if(!c){c=!0;var d=h(arguments);n("sending ack %j",d);var f=m(d)?g.BINARY_ACK:g.ACK;b.packet({type:f,id:a,data:d})}}};f.prototype.onack=function(a){var b=this.acks[a.id];"function"==typeof b?(n("calling ack %s with %j",a.id,a.data),b.apply(this,a.data),delete this.acks[a.id]):n("bad ack %s",a.id)};f.prototype.onconnect=function(){this.connected=!0;this.disconnected=!1;this.emit("connect"); -this.emitBuffered()};f.prototype.emitBuffered=function(){var a;for(a=0;a=a.jitter?a.jitter:0;this.attempts=0}b.exports=f;f.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter)var b= -Math.random(),c=Math.floor(b*this.jitter*a),a=0==(Math.floor(10*b)&1)?a-c:a+c;return Math.min(a,this.max)|0};f.prototype.reset=function(){this.attempts=0};f.prototype.setMin=function(a){this.ms=a};f.prototype.setMax=function(a){this.max=a};f.prototype.setJitter=function(a){this.jitter=a}},{}],37:[function(a,b,c){var f=[].slice;b.exports=function(a,b){"string"==typeof b&&(b=a[b]);if("function"!=typeof b)throw Error("bind() requires a function");var c=f.call(arguments,2);return function(){return b.apply(a, -c.concat(f.call(arguments)))}}},{}],38:[function(a,b,c){function f(a){if(a){for(var b in f.prototype)a[b]=f.prototype[b];return a}}b.exports=f;f.prototype.on=f.prototype.addEventListener=function(a,b){this._callbacks=this._callbacks||{};(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b);return this};f.prototype.once=function(a,b){function c(){this.off(a,c);b.apply(this,arguments)}c.fn=b;this.on(a,c);return this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener= -function(a,b){this._callbacks=this._callbacks||{};if(0==arguments.length)return this._callbacks={},this;var c=this._callbacks["$"+a];if(!c)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var d,f=0;fh?b+("\\u00"+ga(2,h.toString(16))):b+(f?g[c]:a.charAt(c))}}return b+'"'},Ka=function(a,b,c,d,f,g,h){var k,l,n,m,q,r,x,I,J;try{k=b[a]}catch(L){}if("object"==typeof k&&k)if(l=V.call(k),"[object Date]"!=l||W.call(k,"toJSON"))"function"==typeof k.toJSON&&("[object Number]"!=l&&"[object String]"!=l&&"[object Array]"!=l||W.call(k,"toJSON"))&&(k=k.toJSON(a));else if(k>-1/0&&k<1/0){if(xa){m=fa(k/864E5);for(l=fa(m/ -365.2425)+1970-1;xa(l+1,0)<=m;l++);for(n=fa((m-xa(l,0))/30.42);xa(l,n+1)<=m;n++);m=1+m-xa(l,n);q=(k%864E5+864E5)%864E5;r=fa(q/36E5)%24;x=fa(q/6E4)%60;I=fa(q/1E3)%60;q%=1E3}else l=k.getUTCFullYear(),n=k.getUTCMonth(),m=k.getUTCDate(),r=k.getUTCHours(),x=k.getUTCMinutes(),I=k.getUTCSeconds(),q=k.getUTCMilliseconds();k=(0>=l||1E4<=l?(0>l?"-":"+")+ga(6,0>l?-l:l):ga(4,l))+"-"+ga(2,n+1)+"-"+ga(2,m)+"T"+ga(2,r)+":"+ga(2,x)+":"+ga(2,I)+"."+ga(3,q)+"Z"}else k=null;c&&(k=c.call(b,a,k));if(null===k)return"null"; -l=V.call(k);if("[object Boolean]"==l)return""+k;if("[object Number]"==l)return k>-1/0&&k<1/0?""+k:"null";if("[object String]"==l)return Za(""+k);if("object"==typeof k){for(a=h.length;a--;)if(h[a]===k)throw p();h.push(k);J=[];b=g;g+=f;if("[object Array]"==l){n=0;for(a=k.length;n=c.length?c:c.slice(0,10));return Ka("",(m={},m[""]= -a,m),f,g,d,"",[])}}if(!c("json-parse")){var sb=f.fromCharCode,ha={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},I,Da,R=function(){I=Da=null;throw m();},na=function(){for(var a=Da,b=a.length,c,d,f,g,h;Ih)R();else if(92==h)switch(h=a.charCodeAt(++I),h){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:c+= -ha[h];I++;break;case 117:d=++I;for(f=I+4;I=h||97<=h&&102>=h||65<=h&&70>=h||R();c+=sb("0x"+a.slice(d,I));break;default:R()}else{if(34==h)break;h=a.charCodeAt(I);for(d=I;32<=h&&92!=h&&34!=h;)h=a.charCodeAt(++I);c+=a.slice(d,I)}if(34==a.charCodeAt(I))return I++,c;R();default:d=I;45==h&&(g=!0,h=a.charCodeAt(++I));if(48<=h&&57>=h){for(48==h&&(h=a.charCodeAt(I+1),48<=h&&57>=h)&&R();I=h);I++);if(46==a.charCodeAt(I)){for(f=++I;f=h);f++);f==I&&R();I=f}h=a.charCodeAt(I);if(101==h||69==h){h=a.charCodeAt(++I);43!=h&&45!=h||I++;for(f=I;f=h);f++);f==I&&R();I=f}return+a.slice(d,I)}g&&R();if("true"==a.slice(I,I+4))return I+=4,!0;if("false"==a.slice(I,I+5))return I+=5,!1;if("null"==a.slice(I,I+4))return I+=4,null;R()}return"$"},ya=function(a){var b,c;"$"==a&&R();if("string"==typeof a){if("@"==(Q?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(b=[];;c||(c=!0)){a=na();if("]"==a)break;c&& -(","==a?(a=na(),"]"==a&&R()):R());","==a&&R();b.push(ya(a))}return b}if("{"==a){for(b={};;c||(c=!0)){a=na();if("}"==a)break;c&&(","==a?(a=na(),"}"==a&&R()):R());","!=a&&"string"==typeof a&&"@"==(Q?a.charAt(0):a[0])&&":"==na()||R();b[a.slice(1)]=ya(na())}return b}R()}return a},$a=function(a,b,c){c=tb(a,b,c);c===ea?delete a[b]:a[b]=c},tb=function(a,b,c){var d=a[b],f;if("object"==typeof d&&d)if("[object Array]"==V.call(d))for(f=d.length;f--;)$a(d,f,c);else ma(d,function(a){$a(d,a,c)});return c.call(a, -b,d)};b.parse=function(a,b){var c,d;I=0;Da=""+a;c=ya(na());"$"!=na()&&R();I=Da=null;return b&&"[object Function]"==V.call(b)?tb((d={},d[""]=c,d),"",b):c}}}b.runInContext=g;return b}var h={"function":!0,object:!0},k=h[typeof c]&&c&&!c.nodeType&&c,l=h[typeof window]&&window||this,n=k&&h[typeof b]&&b&&!b.nodeType&&"object"==typeof a&&a;!n||n.global!==n&&n.window!==n&&n.self!==n||(l=n);if(k)g(l,k);else{var m=l.JSON,p=l.JSON3,q=!1,r=g(l,l.JSON3={noConflict:function(){q||(q=!0,l.JSON=m,l.JSON3=p,m=p=null); -return r}});l.JSON={parse:r.parse,stringify:r.stringify}}}).call(this)}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:{})},{}],51:[function(a,b,c){b.exports=function(a,b){for(var c=[],d=(b=b||0)||0;d -b[0]&&(b[0]=e.length+Math.max(b[0],-e.length));2>b.length;)b.push(0);b[1]=Math.min(b[1],e.length-b[0]);return b;case "sort":case "reverse":return null;case "pop":return e.length?[e.length-1,1]:[0,0];case "push":return[e.length,0].concat(b);case "shift":return[0,e.length?1:0];case "unshift":return[0,0].concat(b)}}function xg(e){return e.trim?e.trim():e.replace(/^\s+/,"").replace(/\s+$/,"")}function yg(e){return e.str}function od(e,a){a&&a.constructor!==Object&&"function"!==typeof a&&("object"!==typeof a? -m("data option must be an object or a function, `"+a+"` is not valid"):x("If supplied, options.data should be a plain JavaScript object - using a non-POJO as the root object may work, but is discouraged"));var b="function"===typeof e,c="function"===typeof a;a||b||(a={});return b||c?function(){var d=c?pd(a,this):a,f=b?pd(e,this):e;return qd(d,f)}:qd(a,e)}function pd(e,a){var b=e.call(a);if(b)return"object"!==typeof b&&m("Data function must return an object"),b.constructor!==Object&&J("Data function returned something other than a plain JavaScript object. This might work, but is strongly discouraged"), -b}function qd(e,a){if(e&&a){for(var b in a)b in e||(e[b]=a[b]);return e}return e||a}function zg(e,a){var b,c,d;b=e.pos;if(e.matchString("\\"+a.open)){if(0===b||"\\"!==e.str[b-1])return a.open}else if(!e.matchString(a.open))return null;if(c=Gg(e)){if(!e.matchString(a.close))return null;a.open=c[0];a.close=c[1];e.sortMustacheTags();return Hg}e.allowWhitespace();e.matchString("/")&&(--e.pos,d=e.pos,wd(e)?e.pos=d:(e.pos=d-a.close.length,e.error("Attempted to close a section that wasn't open")));for(d= -0;db?b:159>=b?yd[b-128]:55296>b?b:57343>=b?65533:65535>=b?b:65533:65533):e})}function Wb(e){return e.replace(zd,"&").replace(Ad,"<").replace(Bd,">")}function Ma(e){return"string"===typeof e}function va(e,a,b,c,d){var f,h,k,l,m,n,p;for(f=1;f=a.length)return"_"+b;c=a[b];return void 0===c?"undefined":c.isSpecial?(c=c.value,"number"===typeof c?c:'"'+c+'"'):c.str})}function Xg(e){return void 0!==e&&"@"!==e[0]}function Yg(e,a){var b,c,d;if(e.__ractive_nowrap)return e;c="__ractive_"+a._guid;if(b=e[c])return b;if(/this/.test(e.toString())){oa(e,c,{value:Zg.call(e, -a),configurable:!0});for(d in e)e.hasOwnProperty(d)&&(e[c][d]=e[d]);a._boundFunctions.push({fn:e,prop:c});return e[c]}oa(e,"__ractive_nowrap",{value:e});return e.__ractive_nowrap}function $g(e){return e.value}function ah(e){return void 0!=e}function bh(e){e.forceResolution()}function ch(e){e.rebind("","")}function db(e,a,b){if(52===a&&e.indexRefs&&e.indexRefs[0]){var c=e.indexRefs[0];(b&&"i"===c.t||!b&&"k"===c.t)&&!b&&(e.length=0,e.fragmentsToUnrender=e.fragments.slice(0),e.fragmentsToUnrender.forEach(function(e){return e.unbind()})); -c.t=b?"k":"i"}e.currentSubtype=a}function dh(e,a){var b={template:e.template.f||[],root:e.root,pElement:e.parentFragment.pElement,owner:e};e.hasContext=!0;if(e.subtype)switch(e.subtype){case 50:return e.hasContext=!1,ac(e,a,!1,b);case 51:return e.hasContext=!1,ac(e,a,!0,b);case 53:return bc(e,b);case 54:return b=a?bc(e,b):Vd(e),b;case 52:if(l(a))return db(e,e.subtype,!0),Wd(e,a,b)}e.ordered=!!cc.test(ab.call(a));if(e.ordered){db(e,52,!1);var c,d,f;d=a.length;if(d===e.length)b=!1;else{if(de.length)for(c=e.length;c";return fa(ec.childNodes[0].attributes)}function Yd(){var e;N.call(this);e=this._ractive.root.viewmodel.get(this._ractive.binding.keypath);this.value=void 0==e?"":e}function kh(){var e=this._ractive.binding, -a=this;e._timeout&&clearTimeout(e._timeout);e._timeout=setTimeout(function(){e.rendered&&N.call(a);e._timeout=void 0},e.element.lazy)}function lh(e){return e.isChecked}function mh(e){return e.element.getAttribute("value")}function Ba(e){return e&&e.isBindable}function nh(e){var a,b;a=this.root;if("function"!==typeof a[this.method])throw Error('Attempted to call a non-existent method ("'+this.method+'")');b=this.keypaths.map(function(b){var t,c,d;if(void 0!==b){if(b.eventObject){if(t=e,c=b.refinements.length)for(d= -0;d "+e);d=void 0;(d=b.node||c.fragment&&c.fragment.rendered&&c.find("*"))&&a.push(d)}}console.warn.apply(console,["%cRactive.js: %c"+e,"color: rgb(114, 157, 52);","color: rgb(85, 85, 85);"].concat(a))};Rb=function(){console.log.apply(console,arguments)}}():ub=Rb=ib=Y;var Sa=function(e,a){return'Missing "'+e+'" '+a+" plugin. You may need to download a plugin via http://docs.ractivejs.org/latest/plugins#"+ -a+"s"},Eb=function(e,a,b,c){if(e===a)return Z(a);if(c){if(b=P("interpolators",b,c))return b(e,a)||Z(a);m(Sa(c,"interpolator"))}return Db.number(e,a)||Db.array(e,a)||Db.object(e,a)||Z(a)},Db={number:function(e,a){var b;if(!k(e)||!k(a))return null;e=+e;return(b=+a-e)?function(a){return e+a*b}:function(){return e}},array:function(e,a){var b,c,d,f;if(!g(e)||!g(a))return null;b=[];c=[];for(f=d=Math.min(e.length,a.length);f--;)c[f]=Eb(e[f],a[f]);for(f=d;f=this.duration)return null!==b&&(w.start(this.root),this.root.viewmodel.set(b,this.to),w.end()),this.step&&this.step(1,this.to),this.complete(this.to),a=this.root._animations.indexOf(this), --1===a&&x("Animation was not found"),this.root._animations.splice(a,1),this.running=!1;e=this.easing?this.easing(e/this.duration):e/this.duration;null!==b&&(a=this.interpolator(e),w.start(this.root),this.root.viewmodel.set(b,a),w.end());this.step&&this.step(e,a);return!0}return!1},stop:function(){var e;this.running=!1;e=this.root._animations.indexOf(this);-1===e&&x("Animation was not found");this.root._animations.splice(e,1)}};var Eg=Ee,Dg={stop:Y},pi=new aa("detach"),qi=function(e,a){if(this._isComponentQuery? -!this.selector||e.name===this.selector:e.node&&ra(e.node,this.selector))return this.push(e.node||e.instance),a||this._makeDirty(),!0},ri=function(){var e,a,b;e=this._root[this._isComponentQuery?"liveComponentQueries":"liveQueries"];a=this.selector;b=e.indexOf(a);-1!==b&&(e.splice(b,1),e[a]=null)},Fe=function(e,a){var b,c,d,f,g,h,k;b=ld(e.component||e._ractive.proxy);c=ld(a.component||a._ractive.proxy);d=T(b);for(f=T(c);d&&d===f;)b.pop(),c.pop(),g=d,d=T(b),f=T(c);d=d.component||d;f=f.component||f; -h=d.parentFragment;k=f.parentFragment;if(h===k)return h=h.items.indexOf(d),k=k.items.indexOf(f),h-k||b.length-c.length;if(f=g.fragments)return h=f.indexOf(h),k=f.indexOf(k),h-k||b.length-c.length;throw Error("An unexpected condition was met while comparing the position of two components. Please file an issue at https://github.com/RactiveJS/Ractive/issues - thanks!");},si=function(e,a){var b;return e.compareDocumentPosition?(b=e.compareDocumentPosition(a),b&2?1:-1):Fe(e,a)},ti=function(){this.sort(this._isComponentQuery? -Fe:si);this._dirty=!1},ui=function(){var e=this;this._dirty||(this._dirty=!0,w.scheduleTask(function(){e._sort()}))},vi=function(e){e=this.indexOf(this._isComponentQuery?e.instance:e);-1!==e&&this.splice(e,1)},Ge=function(e,a,b,c){var d=[];Ta(d,{selector:{value:a},live:{value:b},_isComponentQuery:{value:c},_test:{value:qi}});if(!b)return d;Ta(d,{cancel:{value:ri},_root:{value:e},_sort:{value:ti},_makeDirty:{value:ui},_remove:{value:vi},_dirty:{value:!1,writable:!0}});return d},xb={enqueue:function(e, -a){e.event&&(e._eventQueue=e._eventQueue||[],e._eventQueue.push(e.event));e.event=a},dequeue:function(e){e._eventQueue&&e._eventQueue.length?e.event=e._eventQueue.pop():delete e.event}},eb=function(e,a,b){b=void 0===b?{}:b;a&&(b.event?b.event.name=a:b.event={name:a,_noArg:!0},a=L(a).wildcardMatches(),md(e,a,b.event,b.args,!0))},wi={capture:!0,noUnwrap:!0,fullRootGet:!0},Fg=new aa("insert"),He=function(e,a,b,c){this.root=e;this.keypath=a;this.callback=b;this.defer=c.defer;this.context=c&&c.context? -c.context:e};He.prototype={init:function(e){this.value=this.root.get(this.keypath.str);!1!==e?this.update():this.oldValue=this.value},setValue:function(e){var a=this;h(e,this.value)||(this.value=e,this.defer&&this.ready?w.scheduleTask(function(){return a.update()}):this.update())},update:function(){this.updating||(this.updating=!0,this.callback.call(this.context,this.value,this.oldValue,this.keypath.str),this.oldValue=this.value,this.updating=!1)}};var Ie=function(e,a){var b,c;b=qb(e,a);c={};b.forEach(function(a){c[a.str]= -e.get(a.str)});return c},xc,xi=Array.prototype.slice;xc=function(e,a,b,c){this.root=e;this.callback=b;this.defer=c.defer;this.keypath=a;this.regex=new RegExp("^"+a.str.replace(/\./g,"\\.").replace(/\*/g,"([^\\.]+)")+"$");this.values={};this.defer&&(this.proxies=[]);this.context=c&&c.context?c.context:e};xc.prototype={init:function(e){var a,b;a=Ie(this.root,this.keypath);if(!1!==e)for(b in a)a.hasOwnProperty(b)&&this.update(L(b));else this.values=a},update:function(e){var a=this,b;if(e.isPattern)for(e in b= -Ie(this.root,e),b)b.hasOwnProperty(e)&&this.update(L(e));else this.root.viewmodel.implicitChanges[e.str]||(this.defer&&this.ready?w.scheduleTask(function(){return a.getProxy(e).update()}):this.reallyUpdate(e))},reallyUpdate:function(e){var a,b;a=e.str;e=this.root.viewmodel.get(e);this.updating?this.values[a]=e:(this.updating=!0,h(e,this.values[a])&&this.ready||(b=xi.call(this.regex.exec(a),1),b=[e,this.values[a],a].concat(b),this.values[a]=e,this.callback.apply(this.context,b)),this.updating=!1)}, -getProxy:function(e){var a=this;this.proxies[e.str]||(this.proxies[e.str]={update:function(){return a.reallyUpdate(e)}});return this.proxies[e.str]}};var yc=function(e,a,b,c){var d,f,g;a=L(la(a));c=c||yi;a.isPattern?(d=new xc(e,a,b,c),e.viewmodel.patternObservers.push(d),f=!0):d=new He(e,a,b,c);d.init(c.init);e.viewmodel.register(a,d,f?"patternObservers":"observers");d.ready=!0;b={cancel:function(){var b;g||(f?(b=e.viewmodel.patternObservers.indexOf(d),e.viewmodel.patternObservers.splice(b,1),e.viewmodel.unregister(a, -d,"patternObservers")):e.viewmodel.unregister(a,d,"observers"),g=!0)}};e._observers.push(b);return b},yi={},Je=function(e){return e.trim()},Ke=function(e){return""!==e},Le=function(e,a,b){var c=[],d,f,g,h;a=wg(e,a,b);if(!a)return null;b=e.length;g=a.length-2-a[1];d=Math.min(b,a[0]);f=d+a[1];for(h=0;h\~:]))+)((?::[^\s\+\>\~\(]+(?:\([^\)]+\))?)?\s*[\s\+\>\~]?)\s*/g,Hi=/^@media/,Qe=/\[data-ractive-css~="\{[a-z0-9-]+\}"]/g,Ji=1,Sd={name:"css",extend:function(e,a,b){b.css&&(e=Ji++,b=b.noCssTransform?b.css:Ii(b.css,e),a.cssId=e,Pe.add({id:e,styles:b}))},init:function(){}},qc={name:"data",extend:function(e,a,b){var c=e=void 0;if(b.data&&l(b.data))for(e in b.data)(c=b.data[e])&&"object"===typeof c&&(l(c)||g(c))&&x("Passing a `data` option with object and array properties to Ractive.extend() is discouraged, as mutating them is likely to cause bugs. Consider using a data function instead:\n\n // this...\n data: function () {\n return {\n myObject: {}\n };\n })\n\n // instead of this:\n data: {\n myObject: {}\n }"); -a.data=od(a.data,b.data)},init:function(e,a,b){e=od(e.prototype.data,b.data);"function"===typeof e&&(e=e.call(a));return e||{}},reset:function(e){var a=this.init(e.constructor,e,e.viewmodel);e.viewmodel.reset(a);return!0}},Ca,Dc,Ki=/^\s+/;Dc=function(e){this.name="ParseError";this.message=e;try{throw Error(e);}catch(a){this.stack=a.stack}};Dc.prototype=Error.prototype;Ca=function(e,a){var b,c,d=0;this.str=e;this.options=a||{};this.pos=0;this.lines=this.str.split("\n");this.lineEnds=this.lines.map(function(e){return d= -e=d+e.length+1},0);this.init&&this.init(e,a);for(b=[];this.pos=this.lineEnds[a];)b=this.lineEnds[a],a+=1;return[a+1,e-b+1,e]},error:function(e){var a=this.getLinePos(this.pos), -b=a[0],c=a[1],d=0,f=this.lines[a[0]-1].replace(/\t/g,function(e,b){b')}catch(a){m=document.createElement("iframe"), +m.name=g.iframeId,m.src="javascript:0"}m.id=g.iframeId;g.form.appendChild(m);g.iframe=m}var g=this;if(!this.form){var h=document.createElement("form"),k=document.createElement("textarea"),l=this.iframeId="eio_iframe_"+this.index,m;h.className="socketio";h.style.position="absolute";h.style.top="-1000px";h.style.left="-1000px";h.target=l;h.method="POST";h.setAttribute("accept-charset","utf-8");k.name="d";h.appendChild(k);document.body.appendChild(h);this.form=h;this.area=k}this.form.action=this.uri(); +e();a=a.replace(p,"\\\n");this.area.value=a.replace(n,"\\n");try{this.form.submit()}catch(r){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"==g.iframe.readyState&&c()}:this.iframe.onload=c}}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:{})},{"./polling":8,"component-inherit":16}],7:[function(a,b,c){(function(c){function h(){}function k(a){p.call(this,a);if(c.location){var b="https:"==location.protocol, +e=location.port;e||(e=b?443:80);this.xd=a.hostname!=c.location.hostname||e!=a.port;this.xs=a.secure!=b}else this.extraHeaders=a.extraHeaders}function l(a){this.method=a.method||"GET";this.uri=a.uri;this.xd=!!a.xd;this.xs=!!a.xs;this.async=!1!==a.async;this.data=void 0!=a.data?a.data:null;this.agent=a.agent;this.isBinary=a.isBinary;this.supportsBinary=a.supportsBinary;this.enablesXDR=a.enablesXDR;this.pfx=a.pfx;this.key=a.key;this.passphrase=a.passphrase;this.cert=a.cert;this.ca=a.ca;this.ciphers= +a.ciphers;this.rejectUnauthorized=a.rejectUnauthorized;this.extraHeaders=a.extraHeaders;this.create()}function m(){for(var a in l.requests)l.requests.hasOwnProperty(a)&&l.requests[a].abort()}var n=a("xmlhttprequest-ssl"),p=a("./polling"),r=a("component-emitter"),v=a("component-inherit"),w=a("debug")("engine.io-client:polling-xhr");b.exports=k;b.exports.Request=l;v(k,p);k.prototype.supportsBinary=!0;k.prototype.request=function(a){a=a||{};a.uri=this.uri();a.xd=this.xd;a.xs=this.xs;a.agent=this.agent|| +!1;a.supportsBinary=this.supportsBinary;a.enablesXDR=this.enablesXDR;a.pfx=this.pfx;a.key=this.key;a.passphrase=this.passphrase;a.cert=this.cert;a.ca=this.ca;a.ciphers=this.ciphers;a.rejectUnauthorized=this.rejectUnauthorized;a.extraHeaders=this.extraHeaders;return new l(a)};k.prototype.doWrite=function(a,b){var c=this.request({method:"POST",data:a,isBinary:"string"!==typeof a&&void 0!==a}),e=this;c.on("success",b);c.on("error",function(a){e.onError("xhr post error",a)});this.sendXhr=c};k.prototype.doPoll= +function(){w("xhr poll");var a=this.request(),b=this;a.on("data",function(a){b.onData(a)});a.on("error",function(a){b.onError("xhr poll error",a)});this.pollXhr=a};r(l.prototype);l.prototype.create=function(){var a={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};a.pfx=this.pfx;a.key=this.key;a.passphrase=this.passphrase;a.cert=this.cert;a.ca=this.ca;a.ciphers=this.ciphers;a.rejectUnauthorized=this.rejectUnauthorized;var b=this.xhr=new n(a),e=this;try{w("xhr open %s: %s", +this.method,this.uri);b.open(this.method,this.uri,this.async);try{if(this.extraHeaders){b.setDisableHeaderCheck(!0);for(var h in this.extraHeaders)this.extraHeaders.hasOwnProperty(h)&&b.setRequestHeader(h,this.extraHeaders[h])}}catch(k){}this.supportsBinary&&(b.responseType="arraybuffer");if("POST"==this.method)try{this.isBinary?b.setRequestHeader("Content-type","application/octet-stream"):b.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(k){}"withCredentials"in b&&(b.withCredentials= +!0);this.hasXDR()?(b.onload=function(){e.onLoad()},b.onerror=function(){e.onError(b.responseText)}):b.onreadystatechange=function(){if(4==b.readyState)if(200==b.status||1223==b.status)e.onLoad();else setTimeout(function(){e.onError(b.status)},0)};w("xhr data %s",this.data);b.send(this.data)}catch(k){setTimeout(function(){e.onError(k)},0);return}c.document&&(this.index=l.requestsCount++,l.requests[this.index]=this)};l.prototype.onSuccess=function(){this.emit("success");this.cleanup()};l.prototype.onData= +function(a){this.emit("data",a);this.onSuccess()};l.prototype.onError=function(a){this.emit("error",a);this.cleanup(!0)};l.prototype.cleanup=function(a){if("undefined"!=typeof this.xhr&&null!==this.xhr){this.hasXDR()?this.xhr.onload=this.xhr.onerror=h:this.xhr.onreadystatechange=h;if(a)try{this.xhr.abort()}catch(b){}c.document&&delete l.requests[this.index];this.xhr=null}};l.prototype.onLoad=function(){var a;try{var b;try{b=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(c){}if("application/octet-stream"=== +b)a=this.xhr.response;else if(this.supportsBinary)try{a=String.fromCharCode.apply(null,new Uint8Array(this.xhr.response))}catch(c){var e=new Uint8Array(this.xhr.response);b=[];for(var g=0,h=e.length;g=e.count)throw Error("after called too many times");--e.count;a?(n=!0,b(a),b=c):0!==e.count||n||b(null,g)}var n=!1;c=c||g;e.count=a;return 0===a?b():e}},{}],12:[function(a,b,c){b.exports=function(a,b,c){var e=a.byteLength;b=b||0;c=c||e;if(a.slice)return a.slice(b,c);0> +b&&(b+=e);0>c&&(c+=e);c>e&&(c=e);if(b>=e||b>=c||0===e)return new ArrayBuffer(0);a=new Uint8Array(a);for(var e=new Uint8Array(c-b),m=0;b>2],m+=a[(b[c]&3)<<4|b[c+1]>>4],m+=a[(b[c+1]&15)<<2|b[c+2]>>6],m+=a[b[c+2]&63];2===e%3?m=m.substring(0,m.length-1)+"=":1===e%3&&(m=m.substring(0,m.length-2)+"==");return m};c.decode=function(b){var c= +.75*b.length,e=b.length,m=0,n,p,r,v;"="===b[b.length-1]&&(c--,"="===b[b.length-2]&&c--);for(var w=new ArrayBuffer(c),L=new Uint8Array(w),c=0;c>4,L[m++]=(p&15)<<4|r>>2,L[m++]=(r&3)<<6|v&63;return w}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],14:[function(a,b,c){(function(a){function c(a){for(var b=0;b=g&&c=a)throw Error("Lone surrogate U+"+a.toString(16).toUpperCase()+" is not a scalar value");}function m(){if(V>=J)throw Error("Invalid byte index");var a=L[V]&255;V++;if(128==(a&192))return a&63;throw Error("Invalid continuation byte");}function n(){var a,b,c,e;if(V>J)throw Error("Invalid byte index");if(V==J)return!1;a=L[V]&255;V++;if(0==(a&128))return a;if(192==(a&224)){b=m();a=(a&31)<<6|b;if(128<=a)return a;throw Error("Invalid continuation byte");}if(224== +(a&240)){b=m();c=m();a=(a&15)<<12|b<<6|c;if(2048<=a)return l(a),a;throw Error("Invalid continuation byte");}if(240==(a&248)&&(b=m(),c=m(),e=m(),a=(a&15)<<18|b<<12|c<<6|e,65536<=a&&1114111>=a))return a;throw Error("Invalid UTF-8 detected");}var p="object"==typeof c&&c,r="object"==typeof b&&b&&b.exports==p&&b,v="object"==typeof a&&a;if(v.global===v||v.window===v)h=v;var w=String.fromCharCode,L,J,V,v={version:"2.0.0",encode:function(a){a=k(a);for(var b=a.length,c=-1,e,g="";++c>6&31|192):0==(e&4294901760)?(l(e),h=w(e>>12&15|224),h+=w(e>>6&63|128)):0==(e&4292870144)&&(h=w(e>>18&7|240),h+=w(e>>12&63|128),h+=w(e>>6&63|128));e=h+=w(e&63|128)}g+=e}return g},decode:function(a){L=k(a);J=L.length;V=0;a=[];for(var b;!1!==(b=n());)a.push(b);b=a.length;for(var c=-1,e,g="";++c>>10&1023|55296),e=56320|e&1023),g+=w(e);return g}};if(p&&!p.nodeType)if(r)r.exports=v;else{h={}.hasOwnProperty;for(var ha in v)h.call(v, +ha)&&(p[ha]=v[ha])}else h.utf8=v})(this)}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:{})},{}],30:[function(a,b,c){function g(a){var b="";do b=k[a%64]+b,a=Math.floor(a/64);while(0n;n++)l[k[n]]=n;h.encode=g;h.decode=function(a){var b=0;for(n=0;n=this._reconnectionAttempts)p("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting= +!1;else{var b=this.backoff.duration();p("will wait %dms before reconnect attempt",b);this.reconnecting=!0;var c=setTimeout(function(){a.skipReconnect||(p("attempting reconnect"),a.emitAll("reconnect_attempt",a.backoff.attempts),a.emitAll("reconnecting",a.backoff.attempts),a.skipReconnect||a.open(function(b){b?(p("reconnect attempt error"),a.reconnecting=!1,a.reconnect(),a.emitAll("reconnect_error",b.data)):(p("reconnect success"),a.onreconnect())}))},b);this.subs.push({destroy:function(){clearTimeout(c)}})}}; +g.prototype.onreconnect=function(){var a=this.backoff.attempts;this.reconnecting=!1;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",a)}},{"./on":33,"./socket":34,backo2:36,"component-bind":37,"component-emitter":38,debug:39,"engine.io-client":1,indexof:42,"socket.io-parser":47}],33:[function(a,b,c){b.exports=function(a,b,c){a.on(b,c);return{destroy:function(){a.removeListener(b,c)}}}},{}],34:[function(a,b,c){function g(a,b){this.io=a;this.nsp=b;this.json=this;this.ids=0;this.acks= +{};this.receiveBuffer=[];this.sendBuffer=[];this.connected=!1;this.disconnected=!0;this.io.autoConnect&&this.open()}var h=a("socket.io-parser");c=a("component-emitter");var k=a("to-array"),l=a("./on"),m=a("component-bind"),n=a("debug")("socket.io-client:socket"),p=a("has-binary");b.exports=g;var r={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},v=c.prototype.emit;c(g.prototype); +g.prototype.subEvents=function(){if(!this.subs){var a=this.io;this.subs=[l(a,"open",m(this,"onopen")),l(a,"packet",m(this,"onpacket")),l(a,"close",m(this,"onclose"))]}};g.prototype.open=g.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();this.emit("connecting");return this};g.prototype.send=function(){var a=k(arguments);a.unshift("message");this.emit.apply(this,a);return this};g.prototype.emit=function(a){if(r.hasOwnProperty(a))return v.apply(this, +arguments),this;var b=k(arguments),c=h.EVENT;p(b)&&(c=h.BINARY_EVENT);c={type:c,data:b,options:{}};c.options.compress=!this.flags||!1!==this.flags.compress;"function"==typeof b[b.length-1]&&(n("emitting packet with ack id %d",this.ids),this.acks[this.ids]=b.pop(),c.id=this.ids++);this.connected?this.packet(c):this.sendBuffer.push(c);delete this.flags;return this};g.prototype.packet=function(a){a.nsp=this.nsp;this.io.packet(a)};g.prototype.onopen=function(){n("transport is open - connecting");"/"!= +this.nsp&&this.packet({type:h.CONNECT})};g.prototype.onclose=function(a){n("close (%s)",a);this.connected=!1;this.disconnected=!0;delete this.id;this.emit("disconnect",a)};g.prototype.onpacket=function(a){if(a.nsp==this.nsp)switch(a.type){case h.CONNECT:this.onconnect();break;case h.EVENT:this.onevent(a);break;case h.BINARY_EVENT:this.onevent(a);break;case h.ACK:this.onack(a);break;case h.BINARY_ACK:this.onack(a);break;case h.DISCONNECT:this.ondisconnect();break;case h.ERROR:this.emit("error",a.data)}}; +g.prototype.onevent=function(a){var b=a.data||[];n("emitting event %j",b);null!=a.id&&(n("attaching ack callback to event"),b.push(this.ack(a.id)));this.connected?v.apply(this,b):this.receiveBuffer.push(b)};g.prototype.ack=function(a){var b=this,c=!1;return function(){if(!c){c=!0;var e=k(arguments);n("sending ack %j",e);var g=p(e)?h.BINARY_ACK:h.ACK;b.packet({type:g,id:a,data:e})}}};g.prototype.onack=function(a){var b=this.acks[a.id];"function"==typeof b?(n("calling ack %s with %j",a.id,a.data),b.apply(this, +a.data),delete this.acks[a.id]):n("bad ack %s",a.id)};g.prototype.onconnect=function(){this.connected=!0;this.disconnected=!1;this.emit("connect");this.emitBuffered()};g.prototype.emitBuffered=function(){var a;for(a=0;a=a.jitter?a.jitter:0;this.attempts=0}b.exports=g;g.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter)var b=Math.random(),c=Math.floor(b*this.jitter*a),a=0==(Math.floor(10*b)&1)?a-c:a+c;return Math.min(a,this.max)|0};g.prototype.reset=function(){this.attempts=0};g.prototype.setMin=function(a){this.ms=a};g.prototype.setMax=function(a){this.max=a};g.prototype.setJitter=function(a){this.jitter=a}},{}],37:[function(a,b,c){var g=[].slice;b.exports=function(a, +b){"string"==typeof b&&(b=a[b]);if("function"!=typeof b)throw Error("bind() requires a function");var c=g.call(arguments,2);return function(){return b.apply(a,c.concat(g.call(arguments)))}}},{}],38:[function(a,b,c){function g(a){if(a){for(var b in g.prototype)a[b]=g.prototype[b];return a}}b.exports=g;g.prototype.on=g.prototype.addEventListener=function(a,b){this._callbacks=this._callbacks||{};(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b);return this};g.prototype.once=function(a,b){function c(){this.off(a, +c);b.apply(this,arguments)}c.fn=b;this.on(a,c);return this};g.prototype.off=g.prototype.removeListener=g.prototype.removeAllListeners=g.prototype.removeEventListener=function(a,b){this._callbacks=this._callbacks||{};if(0==arguments.length)return this._callbacks={},this;var c=this._callbacks["$"+a];if(!c)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var e,g=0;gk?b+("\\u00"+na(2,k.toString(16))):b+(g?h[c]:a.charAt(c))}}return b+'"'},Za=function(a,b,c,e,g,h,k){var l,m,n,p,w,v,x,L,J;try{l=b[a]}catch(M){}if("object"==typeof l&&l)if(m=T.call(l),"[object Date]"!= +m||W.call(l,"toJSON"))"function"==typeof l.toJSON&&("[object Number]"!=m&&"[object String]"!=m&&"[object Array]"!=m||W.call(l,"toJSON"))&&(l=l.toJSON(a));else if(l>-1/0&&l<1/0){if(Va){p=wa(l/864E5);for(m=wa(p/365.2425)+1970-1;Va(m+1,0)<=p;m++);for(n=wa((p-Va(m,0))/30.42);Va(m,n+1)<=p;n++);p=1+p-Va(m,n);w=(l%864E5+864E5)%864E5;v=wa(w/36E5)%24;x=wa(w/6E4)%60;L=wa(w/1E3)%60;w%=1E3}else m=l.getUTCFullYear(),n=l.getUTCMonth(),p=l.getUTCDate(),v=l.getUTCHours(),x=l.getUTCMinutes(),L=l.getUTCSeconds(),w= +l.getUTCMilliseconds();l=(0>=m||1E4<=m?(0>m?"-":"+")+na(6,0>m?-m:m):na(4,m))+"-"+na(2,n+1)+"-"+na(2,p)+"T"+na(2,v)+":"+na(2,x)+":"+na(2,L)+"."+na(3,w)+"Z"}else l=null;c&&(l=c.call(b,a,l));if(null===l)return"null";m=T.call(l);if("[object Boolean]"==m)return""+l;if("[object Number]"==m)return l>-1/0&&l<1/0?""+l:"null";if("[object String]"==m)return Ya(""+l);if("object"==typeof l){for(a=k.length;a--;)if(k[a]===l)throw r();k.push(l);J=[];b=h;h+=g;if("[object Array]"==m){n=0;for(a=l.length;n=c.length?c:c.slice(0,10));return Za("",(p={},p[""]=a,p),g,h,e,"",[])}}if(!c("json-parse")){var Qb=g.fromCharCode,xa={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},x,va,S=function(){x=va=null;throw p();},ea=function(){for(var a=va,b=a.length,c,e,g,h,k;xk)S();else if(92==k)switch(k=a.charCodeAt(++x),k){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:c+=xa[k];x++;break;case 117:e=++x;for(g=x+4;x=k||97<=k&&102>=k||65<=k&&70>=k||S();c+=Qb("0x"+a.slice(e,x));break;default:S()}else{if(34==k)break;k=a.charCodeAt(x);for(e=x;32<=k&&92!=k&&34!=k;)k=a.charCodeAt(++x);c+=a.slice(e,x)}if(34==a.charCodeAt(x))return x++,c;S();default:e= +x;45==k&&(h=!0,k=a.charCodeAt(++x));if(48<=k&&57>=k){for(48==k&&(k=a.charCodeAt(x+1),48<=k&&57>=k)&&S();x=k);x++);if(46==a.charCodeAt(x)){for(g=++x;g=k);g++);g==x&&S();x=g}k=a.charCodeAt(x);if(101==k||69==k){k=a.charCodeAt(++x);43!=k&&45!=k||x++;for(g=x;g=k);g++);g==x&&S();x=g}return+a.slice(e,x)}h&&S();if("true"==a.slice(x,x+4))return x+=4,!0;if("false"==a.slice(x,x+5))return x+=5,!1;if("null"==a.slice(x, +x+4))return x+=4,null;S()}return"$"},Wa=function(a){var b,c;"$"==a&&S();if("string"==typeof a){if("@"==(ua?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(b=[];;c||(c=!0)){a=ea();if("]"==a)break;c&&(","==a?(a=ea(),"]"==a&&S()):S());","==a&&S();b.push(Wa(a))}return b}if("{"==a){for(b={};;c||(c=!0)){a=ea();if("}"==a)break;c&&(","==a?(a=ea(),"}"==a&&S()):S());","!=a&&"string"==typeof a&&"@"==(ua?a.charAt(0):a[0])&&":"==ea()||S();b[a.slice(1)]=Wa(ea())}return b}S()}return a},rb=function(a,b,c){c=qb(a, +b,c);c===da?delete a[b]:a[b]=c},qb=function(a,b,c){var e=a[b],g;if("object"==typeof e&&e)if("[object Array]"==T.call(e))for(g=e.length;g--;)rb(e,g,c);else Da(e,function(a){rb(e,a,c)});return c.call(a,b,e)};b.parse=function(a,b){var c,e;x=0;va=""+a;c=Wa(ea());"$"!=ea()&&S();x=va=null;return b&&"[object Function]"==T.call(b)?qb((e={},e[""]=c,e),"",b):c}}}b.runInContext=h;return b}var k={"function":!0,object:!0},l=k[typeof c]&&c&&!c.nodeType&&c,m=k[typeof window]&&window||this,n=l&&k[typeof b]&&b&&!b.nodeType&& +"object"==typeof a&&a;!n||n.global!==n&&n.window!==n&&n.self!==n||(m=n);if(l)h(m,l);else{var p=m.JSON,r=m.JSON3,v=!1,w=h(m,m.JSON3={noConflict:function(){v||(v=!0,m.JSON=p,m.JSON3=r,p=r=null);return w}});m.JSON={parse:w.parse,stringify:w.stringify}}}).call(this)}).call(this,"undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:{})},{}],51:[function(a,b,c){b.exports=function(a,b){for(var c=[],e=(b=b||0)||0;ef[0]&&(f[0]=d+Math.max(f[0],-d));for(void 0=== +f[0]&&(f[0]=0);2>f.length;)f.push(d-f[0]);"number"!==typeof f[1]&&(f[1]=d-f[0]);f[1]=Math.min(f[1],d-f[0]);return f;case "sort":case "reverse":return null;case "pop":return d?[d-1,1]:[0,0];case "push":return[d,0].concat(f);case "shift":return[0,d?1:0];case "unshift":return[0,0].concat(f)}}function oa(d){function a(q,b){var c=q.get();if(!n(c)){if(void 0===c){var c=[],e=he[d].apply(c,b),g=I.start(this,!0).then(function(){return e});q.set(c);I.end();return g}throw Error("shuffle array method "+d+" called on non-array at "+ +q.getKeypath());}var g=ge(c.length,d,b),h=he[d].apply(c,b),c=I.start(this,!0).then(function(){return h});c.result=h;g?q.shuffle(g):q.set(h);I.end();return c}return{path:function(d){for(var b=[],c=arguments.length-1;0b?b:159>=b?Fh[b-128]:55296>b?b:57343>=b?Yb:65535>=b?b:Ee?65536<=b&&131071>=b||131072<=b&&196607>=b?b:Yb:Yb:Yb):d})}function Sc(d){return d.replace(Gh,"&").replace(Hh,"<").replace(Ih,">")}function Fe(d){var a;return(a=d.matchPattern(Jh))?{t:20,v:a}:null}function Ge(d){return function(a){for(var f='"',b=!1,c;!b;)(c=a.matchPattern(He)||a.matchPattern(Ie)||a.matchString(d))?f='"'===c?f+'\\"':"\\'"===c?f+"'":f+c:(c=a.matchPattern(Je))?f+="\\u"+("000"+c.charCodeAt(1).toString(16)).slice(-4): +b=!0;return JSON.parse(f+'"')}}function Tc(d){var a,f;a=d.pos;return d.matchString('"')?(f=Kh(d),d.matchString('"')?{t:21,v:f}:(d.pos=a,null)):d.matchString("'")?(f=Lh(d),d.matchString("'")?{t:21,v:f}:(d.pos=a,null)):null}function Ke(d){var a;return(a=Tc(d))?Mh.test(a.v)?a.v:'"'+a.v.replace(/"/g,'\\"')+'"':(a=Fe(d))?a.v:(a=d.matchPattern(Uc))?a:null}function Nh(d){var a,f,b;a=d.pos;d.allowWhitespace();b="'"!==d.nextChar()&&'"'!==d.nextChar();f=Ke(d);if(null===f)return d.pos=a,null;d.allowWhitespace(); +if(b&&(","===d.nextChar()||"}"===d.nextChar()))return Uc.test(f)||d.error("Expected a valid reference, but found '"+f+"' instead."),{t:27,k:f,v:{t:30,n:f}};if(!d.matchString(":"))return d.pos=a,null;d.allowWhitespace();b=ia(d);return null===b?(d.pos=a,null):{t:27,k:f,v:b}}function Le(d){var a,f,b;a=d.pos;f=Nh(d);if(null===f)return null;f=[f];return d.matchString(",")?(b=Le(d),b?f.concat(b):(d.pos=a,null)):f}function Vc(d){d.allowWhitespace();var a=ia(d);if(null===a)return null;a=[a];d.allowWhitespace(); +if(d.matchString(",")){var f=Vc(d);null===f&&d.error("Expected a JavaScript expression");a.push.apply(a,f)}return a}function Wc(d){var a,f,b,c,e,g;a=d.pos;b=d.matchPattern(Oh);"@keypath"!==b&&"@rootpath"!==b||!d.matchPattern(Ph)||((g=Wc(d))||d.error("Expected a valid reference for a keypath expression"),d.allowWhitespace(),d.matchString(")")||d.error("Unclosed keypath expression"),b+="("+g.n+")");g=!b&&d.spreadArgs&&d.matchPattern(Qh);b||((f=d.matchPattern(Rh)||"",b=!f&&d.relaxedNames&&d.matchPattern(Sh)|| +d.matchPattern(Th),b||"."!==f)?!b&&f&&(b=f,f=""):(f="",b="."));if(!b)return null;if(!f&&!d.relaxedNames&&Me.test(b))return d.pos=a,null;if(!f&&Xc.test(b))return b=Xc.exec(b)[0],d.pos=a+b.length,{t:26,v:(g?"...":"")+b};c=(g?3:0)+(f||"").length+b.length;f=(f||"")+(b?b.replace(Cc,".$1"):"");d.matchString("(")&&(e=f.lastIndexOf("."),-1!==e&&"]"!==b[b.length-1]?(b=f.length,f=f.substr(0,e),d.pos=a+(c-(b-e))):--d.pos);return{t:30,n:(g?"...":"")+f.replace(/^this\./,"./").replace(/^this$/,".")}}function Uh(d){var a; +(a=Fe(d))||(a=d.remaining(),"true"===a.substr(0,4)?(d.pos+=4,a={t:24,v:"true"}):"false"===a.substr(0,5)?(d.pos+=5,a={t:24,v:"false"}):a=null);if(!(a=a||Tc(d))){var f;a=d.pos;d.allowWhitespace();d.matchString("{")?(f=Le(d),d.allowWhitespace(),d.matchString("}")?a={t:23,m:f}:(d.pos=a,a=null)):(d.pos=a,a=null)}a||(a=d.pos,d.allowWhitespace(),d.matchString("[")?(f=Vc(d),d.matchString("]")?a={t:22,m:f}:(d.pos=a,a=null)):(d.pos=a,a=null));(a=a||Be(d)||Wc(d))||(d.matchString("(")?(d.allowWhitespace(),(a= +ia(d))||d.error("Expected a JavaScript expression"),d.allowWhitespace(),d.matchString(")")||d.error("Expected closing paren"),a={t:34,x:a}):a=null);if(!a)return null;for(;a;){a:{f=d;f.strictRefinement||f.allowWhitespace();if(f.matchString(".")){f.allowWhitespace();var b=f.matchPattern(Uc);if(b){f={t:31,n:b};break a}f.error("Expected a property name")}f.matchString("[")?(f.allowWhitespace(),(b=ia(f))||f.error("Expected a JavaScript expression"),f.allowWhitespace(),f.matchString("]")||f.error("Expected ']'"), +f={t:31,x:b}):f=null}if(f)a={t:32,x:a,r:f};else if(d.matchString("("))d.allowWhitespace(),f=d.spreadArgs,d.spreadArgs=!0,b=Vc(d),d.spreadArgs=f,d.allowWhitespace(),d.matchString(")")||d.error("Expected closing paren"),a={t:40,x:a},b&&(a.o=b);else break}return a}function ia(d){var a,f,b;f=Vh(d);if(!f)return null;a=d.pos;d.allowWhitespace();if(!d.matchString("?"))return d.pos=a,f;d.allowWhitespace();(a=ia(d))||d.error("Expected a JavaScript expression");d.allowWhitespace();d.matchString(":")||d.error('Expected ":"'); +d.allowWhitespace();(b=ia(d))||d.error("Expected a JavaScript expression");return{t:35,o:[f,a,b]}}function Zb(d){function a(d){switch(d.t){case 24:case 26:case 20:case 25:return d.v;case 21:return JSON.stringify(String(d.v));case 22:return"["+(d.m?d.m.map(a).join(","):"")+"]";case 23:return"{"+(d.m?d.m.map(a).join(","):"")+"}";case 27:return d.k+":"+a(d.v);case 33:return("typeof"===d.s?"typeof ":d.s)+a(d.o);case 36:return a(d.o[0])+("in"===d.s.substr(0,2)?" "+d.s+" ":d.s)+a(d.o[1]);case 40:if(d.spread){var c= +b++;return"(spread$"+c+" = "+a(d.x)+").apply(spread$"+c+", [].concat("+(d.o?d.o.map(function(d){return d.n&&0===d.n.indexOf("...")?a(d):"["+a(d)+"]"}).join(","):"")+") )"}return a(d.x)+"("+(d.o?d.o.map(a).join(","):"")+")";case 34:return"("+a(d.x)+")";case 32:return a(d.x)+a(d.r);case 31:return d.n?"."+d.n:"["+a(d.x)+"]";case 35:return a(d.o[0])+"?"+a(d.o[1])+":"+a(d.o[2]);case 30:return"_"+f.indexOf(d.n);default:throw Error("Expected legal JavaScript");}}var f,b=0;gb(d,f=[]);d=a(d);f=f.map(function(d){return 0=== +d.indexOf("...")?d.substr(3):d});return{r:f,s:function(d){for(var a=[],f=b-1;0<=f;f--)a.push("spread$"+f);return a.length?"(function(){var "+a.join(",")+";return("+d+");})()":d}(d)}}function gb(d,a){var f,b;30===d.t&&-1===a.indexOf(d.n)&&a.unshift(d.n);if(b=d.o||d.m)if(v(b))gb(b,a);else for(f=b.length;f--;)b[f].n&&0===b[f].n.indexOf("...")&&(d.spread=!0),gb(b[f],a);d.x&&gb(d.x,a);d.r&&gb(d.r,a);d.v&&gb(d.v,a)}function Wh(d){d.allowWhitespace();var a=Ke(d);if(!a)return null;a={key:a};d.allowWhitespace(); +if(!d.matchString(":"))return null;d.allowWhitespace();d=d.read();if(!d)return null;a.value=d.v;return a}function $b(d,a){return(new Xh(d,{values:a})).result}function ac(d,a,f){var b,c,e,g;if("string"===typeof d){g=a.pos-d.length;if(71===f||72===f)return a=new Yc("["+d+"]"),{a:Zb(a.result[0])};70===f&&(b=Yh.exec(d))&&(P(a.getContextMessage(g,"Unqualified method events are deprecated. Prefix methods with '@this.' to call methods on the current Ractive instance.")[2]),d="@this."+b[1]+""+d.substr(b[1].length)); +if(70===f&&~d.indexOf("(")){b=new Yc("["+d+"]");if(b.result&&b.result[0])return b.remaining().length&&(a.pos=g+d.length-b.remaining().length,a.error("Invalid input after event expression '"+b.remaining()+"'")),{x:Zb(b.result[0])};if(d.indexOf(":")>d.indexOf("(")||!~d.indexOf(":"))a.pos=g,a.error("Invalid input in event expression '"+d+"'")}if(-1===d.indexOf(":"))return d.trim();d=[d]}e=[];g=[];if(d){for(;d.length;)if(b=d.shift(),"string"===typeof b)if(c=b.indexOf(":"),-1===c)e.push(b);else{c&&e.push(b.substr(0, +c));b.length>c+1&&(g[0]=b.substring(c+1));break}else e.push(b);g=g.concat(d)}e.length?g.length||"string"!==typeof e?(d={n:1===e.length&&"string"===typeof e[0]?e[0]:e},1===g.length&&"string"===typeof g[0]?(b=$b("["+g[0]+"]"),d.a=b?b.value:[g[0].trim()]):d.d=g):d=e:d="";g.length&&f&&P(a.getContextMessage(a.pos,"Proxy events with arguments are deprecated. You can fire events with arguments using \"@this.fire('eventName', arg1, arg2, ...)\".")[2]);return d}function Ne(d){var a,f,b,c;a=d.pos;f=d.matchPattern(Zh); +if(!f)return null;b=f;c=d.tags.map(function(d){return d.open});-1!==(b=Xb(b,c))&&(f=f.substr(0,b),d.pos=a+f.length);return f}function Oe(d,a){var f,b,c;f=d.pos;if(!d.matchString(a))return null;d.inAttribute=a;b=[];for(c=hb(d)||Pe(d,a);null!==c;)b.push(c),c=hb(d)||Pe(d,a);if(!d.matchString(a))return d.pos=f,null;d.inAttribute=!1;return b}function Pe(d,a){var f=d.remaining(),b=d.tags.map(function(d){return d.open});b.push(a);b=Xb(f,b);-1===b&&d.error("Quoted attribute value must have a closing quote"); +if(!b)return null;d.pos+=b;return f.substr(0,b)}function hb(d){var a,f;if(!1===d.interpolate[d.inside])return null;for(f=0;f\s]/.test(d.nextChar())||d.error("Expected `=`, `/`, `>` or whitespace");d.allowWhitespace(); +if(d.matchString("=")){d.allowWhitespace();a=d.pos;f=d.sectionDepth;if(!(c=Oe(d,"'")||Oe(d,'"'))){var e;d.inAttribute=!0;c=[];for(e=hb(d)||Ne(d);e;)c.push(e),e=hb(d)||Ne(d);c.length?d.inAttribute=!1:c=null}null===c&&d.error("Expected valid attribute value");d.sectionDepth!==f&&(d.pos=a,d.error("An attribute value must contain as many opening section tags as closing section tags"));a=c.length?1===c.length&&"string"===typeof c[0]?Rc(c[0]):c:""}else d.pos=a,a=null;null!=a&&(b.f=a)}}else b=null;if(b){if(a= +bi[b.n]){b.t=a.t;a.v&&(b.v=a.v);delete b.n;if(72===a.t||71===a.t)b.f=ac(b.f,d);72===a.t?Y(""+("t0"===a.v?"intro-outro":"t1"===a.v?"intro":"outro")+" is deprecated. To specify tranisitions, use the transition name suffixed with '-in', '-out', or '-in-out' as an attribute. Arguments can be specified in the attribute value as a simple list of expressions without mustaches."):71===a.t&&Y("decorator is deprecated. To specify decorators, use the decorator name prefixed with 'as-' as an attribute. Arguments can be specified in the attribute value as a simple list of expressions without mustaches.")}else if(a= +ci.exec(b.n))delete b.n,b.t=71,b.f=ac(b.f,d,71),"object"===typeof b.f?b.f.n=a[1]:b.f=a[1];else if(a=di.exec(b.n))delete b.n,b.t=72,b.f=ac(b.f,d,72),"object"===typeof b.f?b.f.n=a[1]:b.f=a[1],b.v="in-out"===a[2]?"t0":"in"===a[2]?"t1":"t2";else if(a=ei.exec(b.n))b.n=a[1],b.t=70,b.f=ac(b.f,d,70),fi.test(b.f.n||b.f)&&(d.pos-=(b.f.n||b.f).length,d.error("Cannot use reserved event names (change, reset, teardown, update, construct, config, init, render, unrender, detach, insert)"));else if(d.sanitizeEventAttributes&& +gi.test(b.n)){a={exclude:!0};break a}else b.f=b.f||(""===b.f?"":0),b.t=13;a=b}else a=null}if(a)return d.allowWhitespace(),a}}function $h(d,a){var f,b,c;f=d.pos;if(d.matchString("\\"+a.open)){if(0===f||"\\"!==d.str[f-1])return a.open}else if(!d.matchString(a.open))return null;if(b=zh(d)){if(!d.matchString(a.close))return null;a.open=b[0];a.close=b[1];d.sortMustacheTags();return hi}d.allowWhitespace();if(d.matchString("/"))if(--d.pos,c=d.pos,Be(d))d.pos=c;else{d.pos=c-a.close.length;if(d.inAttribute)return d.pos= +f,null;d.error("Attempted to close a section that wasn't open")}for(c=0;cg.m.length&&delete g.m)}for(e=d.length;e--;)"string"=== +typeof d[e]&&("string"===typeof d[e+1]&&(d[e]+=d[e+1],d.splice(e+1,1)),f||(d[e]=d[e].replace(ti," ")),""===d[e]&&d.splice(e,1))}}function ui(d){var a,f;a=d.pos;if(!d.matchString("")&&ua(mf.childNodes[0].attributes):[]}function ej(d,a,f,b){d=d.__model;b&&d.shuffle(b)}function fj(d,a,f,b){if(d.set&&d.set.__magic)return d.set.__magic.dependants.push({ractive:a,keypath:f}),d;var c, +e=[{ractive:a,keypath:f}];a={get:function(){return"value"in d?d.value:d.get.call(this)},set:function(a){c||("value"in d?d.value=a:d.set.call(this,a),b.locked||(c=!0,e.forEach(function(d){d.ractive.set(d.keypath,a)}),c=!1))},enumerable:!0};a.set.__magic={dependants:e,originalDescriptor:d};return a}function gj(d){d=d.replace(/^\t+/gm,function(d){return d.split("\t").join(" ")}).split("\n");var a=2>d.length?0:d.slice(1).reduce(function(d,a){return Math.min(d,/^\s*/.exec(a)[0].length)},Infinity);return d.map(function(d, +b){return" "+(b?d.substring(a):d)}).join("\n")}function hj(d,a,f){var b,c,e,g,h;"function"===typeof f&&(b=S(f,d),e=f.toString(),g=!0);"string"===typeof f&&(b=af(f,d),e=f);"object"===typeof f&&("string"===typeof f.get?(b=af(f.get,d),e=f.get):"function"===typeof f.get?(b=S(f.get,d),e=f.get.toString(),g=!0):J("`%s` computation must have a `get()` method",a),"function"===typeof f.set&&(c=S(f.set,d),h=f.set.toString()));return{getter:b,setter:c,getterString:e,setterString:h,getterUseStack:g}}function ed(d, +a){Z.DEBUG&&Cb();ij(d);Ha(d,"data",{get:jj});kj.fire(d,a);lj.forEach(function(f){d[f]=l(ra(d.constructor[f]||null),a[f])});var f=new mj({adapt:nj(d,d.adapt,a),data:cc.init(d.constructor,d,a),ractive:d});d.viewmodel=f;var b=l(ra(d.constructor.prototype.computed),a.computed),c;for(c in b){var e=hj(d,c,b[c]);f.compute(c,e)}}function oj(d){var a=[];d=a.concat.apply(a,d);for(var f=d.length;f--;)~a.indexOf(d[f])||a.unshift(d[f]);return a}function nj(d,a,f){function b(a){"string"===typeof a&&((a=pb("adaptors", +d,a))||J(ab(a,"adaptor")));return a}a=a.map(b);var c=Da(f.adapt).map(b),e=[];a=[a,c];d.parent&&!d.isolated&&a.push(d.parent.viewmodel.adaptors);a.push(e);c="modifyArrays"in f?f.modifyArrays:d.modifyArrays;if("magic"in f?f.magic:d.magic){if(!dc)throw Error("Getters and setters (magic mode) are not supported in this browser");c&&e.push(pj);e.push(fd)}c&&e.push(gd);return oj(a)}function ij(d){d._guid="r-"+qj++;d._subs=ra(null);d._config={};d.nodes={};d.event=null;d._eventQueue=[];d._liveQueries=[];d._liveComponentQueries= +[];d._observers=[];d.component||(d.root=d,d.parent=d.container=null)}function jj(){throw Error("Using `ractive.data` is no longer supported - you must use the `ractive.get()` API instead");}function nf(d,a){return d[a._guid]||(d[a._guid]=[])}function of(d,a){var f=nf(d.queue,a);for(d.hook.fire(a);f.length;)of(d,f.shift());delete d.queue[a._guid]}function hd(d,b,f){Object.keys(d.viewmodel.computations).forEach(function(a){var f=d.viewmodel.computations[a];d.viewmodel.value.hasOwnProperty(a)&&f.set(d.viewmodel.value[a])}); +id.init(d.constructor,d,b);rj.fire(d);pf.begin(d);var c;if(d.template){var e;if(f.cssIds||d.cssId)e=f.cssIds?f.cssIds.slice():[],d.cssId&&e.push(d.cssId);d.fragment=c=(new K({owner:d,template:d.template,cssIds:e})).bind(d.viewmodel)}pf.end(d);if(c&&(b=a(d.el))&&(b=d.render(b,d.append),Z.DEBUG_PROMISES))b["catch"](function(a){Y("Promise debugging is enabled, to help solve errors that happen asynchronously. Some browsers will log unhandled promise rejections, in which case you can safely disable promise debugging:\n Ractive.DEBUG_PROMISES = false;"); +P("An error happened during rendering",{ractive:d});V(a);throw a;})}function sj(d){d.makeDirty()}function tj(d){var a=d.node,f=d.ractive;do for(var b=f._liveQueries,c=b.length;c--;){var e=b["_"+b[c]];e.test(a)&&(e.add(a),d.liveQueries.push(e))}while(f=f.parent)}function qf(d,a){Y("The "+d+" being used for two-way binding is ambiguous, and may cause unexpected results. Consider initialising your data to eliminate the ambiguity",{ractive:a})}function Q(){this._ractive.binding.handleChange()}function rf(d, +a,f){d=""+d+"-bindingGroup";return a[d]||(a[d]=new Db(d,a,f))}function uj(){var d=[];this.bindings.filter(function(d){return d.node&&d.node.checked}).map(function(d){return d.element.getAttribute("value")}).forEach(function(a){W(d,a)||d.push(a)});return d}function sf(){Q.call(this);var d=this._ractive.binding.model.get();this.value=void 0==d?"":d}function vj(d){var a;return function(){var f=this;a&&clearTimeout(a);a=setTimeout(function(){f._ractive.binding.rendered&&Q.call(f);a=null},d)}}function jd(d){return d.selectedOptions? +ua(d.selectedOptions):d.options?ua(d.options).filter(function(d){return d.selected}):[]}function wj(){var d=this.bindings.filter(function(d){return d.node.checked});if(0%s}}) cannot contain nested inline partials",a,{ractive:d}),(b?f:f.partials.hasOwnProperty(a)?f:wf(f.constructor,a)).partials[a]=c=c.t),b&&(c._fn=b),b=c.v?c.t:c):(P('A function was specified for "%s" %s, but no %s was returned',a,"partial","partial",{ractive:d}),b=void 0)):b=void 0;if(b)return b;if(b=qa.fromId(a,{noThrow:!0}))return b=qa.parseFor(b,d),b.p&&m(d.partials,b.p),d.partials[a]=b.t}function wf(d,a){if(d)return d.partials.hasOwnProperty(a)? +d:wf(d._Parent,a)}function vf(d,a){if(a){if(a.template&&a.template.p&&a.template.p[d])return a.template.p[d];if(a.parentFragment&&a.parentFragment.owner)return vf(d,a.parentFragment.owner)}}function xf(d,a,f){var b;try{b=qa.parse(a,qa.getParseOptions(f))}catch(c){P("Could not parse partial from expression '"+d+"'\n"+c.message)}return b||{t:[]}}function yf(d){return d.replace(/-([a-zA-Z])/g,function(d,a){return a.toUpperCase()})}function zf(){Eb=!N[gc]}function kd(){Eb=!1}function ld(){Eb=!0}function Af(d){if(!d)return""; +Mj.test(d)&&(d="-"+d);return d.replace(/[A-Z]/g,function(d){return"-"+d.toLowerCase()})}function Nj(d,a){a?d.setAttribute("style",a):(d.getAttribute("style"),d.removeAttribute("style"))}function md(d){return Bf[d]||(Bf[d]=za(d))}function Cf(d,a){var f=yc("components",d,a),b;if(f&&(b=f.components[a],!b._Parent)){var c=b.bind(f);c.isOwner=f.components.hasOwnProperty(a);b=c();if(!b){P('A function was specified for "%s" %s, but no %s was returned',a,"component","component",{ractive:d});return}"string"=== +typeof b&&(b=Cf(d,b));b._fn=c;f.components[a]=b}return b}function hc(d){if("string"===typeof d.template)return new Oj(d);if(7===d.template.t){var a=Cf(d.parentFragment.ractive,d.template.e);if(a)return new Pj(d,a);a=d.template.e.toLowerCase();return new (Qj[a]||Fb)(d)}if(13===d.template.t){a=d.owner;if(!a||15!==a.type&&7!==a.type)a=ja(d.parentFragment);d.element=a;a=15===a.type?Rj:Df}else a=sa[d.template.t];if(!a)throw Error("Unrecognised item type "+d.template.t);return new a(d)}function ic(d,a, +f,b){void 0===b&&(b=0);return d.map(function(d){if(1===d.type)return d.template;if(d.fragment)return d.fragment.iterations?d.fragment.iterations.map(function(d){return ic(d.items,a,f,b)}).join(""):ic(d.fragment.items,a,f,b);var c=""+f+"-"+b++;d=d.model||d.newModel;a[c]=d?d.wrapper?d.wrapperValue:d.get():void 0;return"${"+c+"}"}).join("")}function Sj(d){d.unrender(!0)}function Ef(){var d=[this.cssId].concat(this.findAllComponents().map(function(d){return d.cssId})),d=Object.keys(d.reduce(function(d, +a){return d[a]=!0,d},{}));return Vb(d)}function Ff(){return this.fragment.toString(!0)}function Tj(d,a,f){return f||"function"===typeof a&&/_super/.test(d)?function(){var f="_super"in this,b=this._super,c;this._super=a;c=d.apply(this,arguments);f&&(this._super=b);return c}:d}function Uj(d){for(var a={};d;)Vj(d,a),Wj(d,a),d=d._Parent!==Z?d._Parent:!1;return a}function Vj(d,a){Ab.forEach(function(f){Xj(f.useDefaults?d.prototype:d,a,f.name)})}function Xj(d,a,f){var b,c=Object.keys(d[f]);c.length&&((b= +a[f])||(b=a[f]={}),c.filter(function(d){return!(d in b)}).forEach(function(a){return b[a]=d[f][a]}))}function Wj(d,a){Object.keys(d.prototype).forEach(function(f){if("computed"!==f){var b=d.prototype[f];if(!(f in a))a[f]=b._method?b._method:b;else if("function"===typeof a[f]&&"function"===typeof b&&a[f]._method){var c=b._method;c&&(b=b._method);b=Tj(a[f]._method,b);c&&(b._method=b);a[f]=b}}})}function Gf(){for(var d=[],a=arguments.length;a--;)d[a]=arguments[a];return d.length?d.reduce(Hf,this):Hf(this)} +function Hf(d,a){void 0===a&&(a={});var f,b;a.prototype instanceof Z&&(a=Uj(a));f=function(d){if(!(this instanceof f))return new f(d);ed(this,d||{});hd(this,d||{},{})};b=ra(d.prototype);b.constructor=f;wb(f,{defaults:{value:b},extend:{value:Gf,writable:!0,configurable:!0},_Parent:{value:d}});id.extend(d,b,a);cc.extend(d,b,a);a.computed&&(b.computed=l(ra(d.prototype.computed),a.computed));f.prototype=b;return f}function Z(d){if(!(this instanceof Z))return new Z(d);ed(this,d||{});hd(this,d||{},{})} +var If={el:void 0,append:!1,template:null,delimiters:["{{","}}"],tripleDelimiters:["{{{","}}}"],staticDelimiters:["[[","]]"],staticTripleDelimiters:["[[[","]]]"],csp:!0,interpolate:!1,preserveWhitespace:!1,sanitize:!1,stripComments:!0,contextLines:0,data:{},computed:{},magic:!1,modifyArrays:!1,adapt:[],isolated:!1,twoway:!0,lazy:!1,noIntro:!1,transitionsEnabled:!0,complete:void 0,css:null,noCssTransform:!1},Jf={linear:function(d){return d},easeIn:function(d){return Math.pow(d,3)},easeOut:function(d){return Math.pow(d- +1,3)+1},easeInOut:function(d){return 1>(d/=.5)?.5*Math.pow(d,3):.5*(Math.pow(d-2,3)+2)}},fa="undefined"!==typeof window?window:null,N=fa?document:null,nd=!!N;"undefined"!==typeof navigator&&/jsDom/.test(navigator.appName);var Kf="undefined"!==typeof console&&"function"===typeof console.warn&&"function"===typeof console.warn.apply,dc;try{Object.defineProperty({},"test",{value:0}),dc=!0}catch(d){dc=!1}var Lf=N?N.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"):!1, +Ja=["o","ms","moz","webkit"],Mf={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns"},za,Ka,mb,od,Gb,pd,jc,Nf,qd;za=Lf?function(d,a,f){return a&&"http://www.w3.org/1999/xhtml"!==a?f?N.createElementNS(a,d,f):N.createElementNS(a,d):f?N.createElement(d,f):N.createElement(d)}:function(d,a,f){if(a&&"http://www.w3.org/1999/xhtml"!== +a)throw"This browser does not support namespaces other than http://www.w3.org/1999/xhtml. The most likely cause of this error is that you're trying to render SVG in an older browser. See http://docs.ractivejs.org/latest/svg-and-older-browsers for more information";return f?N.createElement(d,f):N.createElement(d)};if(nd){mb=za("div");od=["matches","matchesSelector"];qd=function(d){return function(a,f){return a[d](f)}};for(jc=od.length;jc--&&!Ka;)if(Gb=od[jc],mb[Gb])Ka=qd(Gb);else for(Nf=Ja.length;Nf--;)if(pd= +Ja[jc]+Gb.substr(0,1).toUpperCase()+Gb.substring(1),mb[pd]){Ka=qd(pd);break}Ka||(Ka=function(d,a){var f,b;f=d.parentNode;f||(mb.innerHTML="",f=mb,d=d.cloneNode(),mb.appendChild(d));f=f.querySelectorAll(a);for(b=f.length;b--;)if(f[b]===d)return!0;return!1})}else Ka=null;var tg=/(-.)/g,ug=/[A-Z]/g,ra,Ha,wb;try{Object.defineProperty({},"test",{get:function(){},set:function(){}}),N&&Object.defineProperty(za("div"),"test",{value:0}),Ha=Object.defineProperty}catch(d){Ha=function(d,a,b){d[a]=b.get?b.get(): +b.value}}try{try{Object.defineProperties({},{test:{value:0}})}catch(d){throw d;}N&&Object.defineProperties(za("div"),{test:{value:0}});wb=Object.defineProperties}catch(d){wb=function(d,a){for(var b in a)a.hasOwnProperty(b)&&Ha(d,b,a[b])}}try{Object.create(null),ra=Object.create}catch(d){ra=function(){var d=function(){};return function(a,b){var c;if(null===a)return{};d.prototype=a;c=new d;b&&Object.defineProperties(c,b);return c}}()}var Xa=Object.prototype.hasOwnProperty,Rd=Object.prototype.toString, +Sd={},Bc,Rb,Cb;if(Kf){var Of=["%cRactive.js %c0.8.7 %cin debug mode, %cmore...","color: rgb(114, 157, 52); font-weight: normal;","color: rgb(85, 85, 85); font-weight: normal;","color: rgb(85, 85, 85); font-weight: normal;","color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;"];Cb=function(){if(!1!==Z.WELCOME_MESSAGE){var d="WELCOME_MESSAGE"in Z?Z.WELCOME_MESSAGE:"You're running Ractive 0.8.7 in debug mode - messages will be printed to the console to help you fix problems and optimise your application.\n\nTo disable debug mode, add this line at the start of your app:\n Ractive.DEBUG = false;\n\nTo disable debug mode when your app is minified, add this snippet:\n Ractive.DEBUG = /unminified/.test(function(){/*unminified*/});\n\nGet help and support:\n http://docs.ractivejs.org\n http://stackoverflow.com/questions/tagged/ractivejs\n http://groups.google.com/forum/#!forum/ractive-js\n http://twitter.com/ractivejs\n\nFound a bug? Raise an issue:\n https://github.com/ractivejs/ractive/issues\n\n", +a=!!console.groupCollapsed;a&&console.groupCollapsed.apply(console,Of);console.log(d);a&&console.groupEnd(Of)}Cb=w};Rb=function(d,a){Cb();if("object"===typeof a[a.length-1]){var b=a.pop(),c=b?b.ractive:null;if(c){var e;c.component&&(e=c.component.name)&&(d="<"+e+"> "+d);var g;(g=b.node||c.fragment&&c.fragment.rendered&&c.find("*"))&&a.push(g)}}console.warn.apply(console,["%cRactive.js: %c"+d,"color: rgb(114, 157, 52);","color: rgb(85, 85, 85);"].concat(a))};Bc=function(){console.log.apply(console, +arguments)}}else Rb=Bc=Cb=w;var ab=function(d,a){return'Missing "'+d+'" '+a+" plugin. You may need to download a plugin via http://docs.ractivejs.org/latest/plugins#"+a+"s"},Sb={number:function(d,a){var b;if(!r(d)||!r(a))return null;d=+d;return(b=+a-d)?function(a){return d+a*b}:function(){return d}},array:function(d,a){var b,c,e,g;if(!n(d)||!n(a))return null;b=[];c=[];for(g=e=Math.min(d.length,a.length);g--;)c[g]=Mb(d[g],a[g]);for(g=e;gthis.end)return this.step&&this.step(1),this.complete&&this.complete(1),!1;a=this.easing((a-this.start)/this.duration);this.step&&this.step(a);return!0};kc.prototype.stop=function(){this.abort&&this.abort();this.running=!1};var Jc={},Ta=function(a){function b(f,c){a.call(this,f);this.ticker=null;f&&(this.key=va(c),this.isReadonly=f.isReadonly,f.value&& +(this.value=f.value[this.key],n(this.value)&&(this.length=this.value.length),this.adapt()))}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.adapt=function(){var a=this.root.adaptors,d=a.length;this.rewrap=!1;if(0!==d){var b=this.wrapper?"newWrapperValue"in this?this.newWrapperValue:this.wrapperValue:this.value,c=this.root.ractive,q=this.getKeypath();if(this.wrapper)if(this.wrapperValue===b?0:!this.wrapper.reset||!1===this.wrapper.reset(b)){if(this.wrapper.teardown(), +this.wrapper=null,void 0!==this.value){var e=this.parent.value||this.parent.createBranch(this.key);e[this.key]!==b&&(e[this.key]=b)}}else{delete this.newWrapperValue;this.wrapperValue=b;this.value=this.wrapper.get();return}for(e=0;e~:]))+)((?:::?[^\s\+\>\~\(:]+(?:\([^\)]+\))?)*\s*[\s\+\>\~]?)\s*/g, +wh=/^(?:@|\d+%)/,ue=/\[data-ractive-css~="\{[a-z0-9-]+\}"]/g,gf={name:"css",extend:function(a,b,f){f.css&&(a=Ra()+Ra()+"-"+Ra()+"-"+Ra()+"-"+Ra()+"-"+Ra()+Ra()+Ra(),f=f.noCssTransform?f.css:th(f.css,a),b.cssId=a,Lc.push({id:a,styles:f}),Mc=!0)},init:function(a,b,f){f.css&&P("\nThe css option is currently not supported on a per-instance basis and will be discarded. Instead, we recommend instantiating from a component definition with a css option.\n\nconst Component = Ractive.extend({\n\t...\n\tcss: '/* your css */',\n\t...\n});\n\nconst componentInstance = new Component({ ... })\n\t\t")}}, +cc={name:"data",extend:function(a,b,f){var c;if(f.data&&v(f.data))for(c in f.data)(a=f.data[c])&&"object"===typeof a&&(v(a)||n(a))&&P("Passing a `data` option with object and array properties to Ractive.extend() is discouraged, as mutating them is likely to cause bugs. Consider using a data function instead:\n\n // this...\n data: function () {\n return {\n myObject: {}\n };\n })\n\n // instead of this:\n data: {\n myObject: {}\n }");b.data=ve(b.data,f.data)},init:function(a,b, +f){a=ve(a.prototype.data,f.data);"function"===typeof a&&(a=a.call(b));if(a&&a.constructor===Object)for(var c in a)"function"===typeof a[c]&&(a[c]=S(a[c],b));return a||{}},reset:function(a){var b=this.init(a.constructor,a,a.viewmodel);a.viewmodel.root.set(b);return!0}},yh=/\$\{([^\}]+)\}/g,xb=ra(null),Ua,td,ek=/^\s+/;td=function(a){this.name="ParseError";this.message=a;try{throw Error(a);}catch(b){this.stack=b.stack}};td.prototype=Error.prototype;Ua=function(a,b){var f,c,e=0;this.str=a;this.options= +b||{};this.pos=0;this.lines=this.str.split("\n");this.lineEnds=this.lines.map(function(a){return e=a=e+a.length+1},0);this.init&&this.init(a,b);for(f=[];this.posc-1-this.options.contextLines?0:c-1-this.options.contextLines,g=this.lines.slice(g,c-1-g).join("\n").replace(/\t/g," "),h=this.lines.slice(c,c+this.options.contextLines).join("\n").replace(/\t/g," "),g&&(g+="\n"),h&&(h="\n"+h));var k=0,f=g+f.replace(/\t/g,function(a,d){d=this.lineEnds[b];)f=this.lineEnds[b],b+=1;return[b+1,a-f+1,a]},error:function(a){var b=this.getContextMessage(this.pos,a),f=b[0],c=b[1],b=new td(b[2]);b.line=f;b.character=c;b.shortMessage=a;throw b;},matchString:function(a){if(this.str.substr(this.pos,a.length)===a)return this.pos+=a.length,a},matchPattern:function(a){if(a=a.exec(this.remaining()))return this.pos+=a[0].length,a[1]||a[0]},allowWhitespace:function(){this.matchPattern(ek)}, +remaining:function(){return this.str.substring(this.pos)},nextChar:function(){return this.str.charAt(this.pos)}};Ua.extend=function(a){var b,f;b=function(a,d){Ua.call(this,a,d)};b.prototype=ra(this.prototype);for(f in a)Xa.call(a,f)&&(b.prototype[f]=a[f]);b.extend=Ua.extend;return b};var Ae=/^[^\s=]+/,Ah=/^\s+/,Bh=/^(\/(?:[^\n\r\u2028\u2029/\\[]|\\.|\[(?:[^\n\r\u2028\u2029\]\\]|\\.)*])+\/(?:([gimuy])(?![a-z]*\2))*(?![a-zA-Z_$0-9]))/,Ch=/[-/\\^$*+?.()|[\]{}]/g,Ce={},ud=/^(allowFullscreen|async|autofocus|autoplay|checked|compact|controls|declare|default|defaultChecked|defaultMuted|defaultSelected|defer|disabled|enabled|formNoValidate|hidden|indeterminate|inert|isMap|itemScope|loop|multiple|muted|noHref|noResize|noShade|noValidate|noWrap|open|pauseOnExit|readOnly|required|reversed|scoped|seamless|selected|sortable|translate|trueSpeed|typeMustMatch|visible)$/i, +vd=/^(?:area|base|br|col|command|doctype|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i,De={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197, AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246, divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956, nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592, uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969, -lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};yd=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376];xd=new RegExp("&(#?(?:x[\\w\\d]+|\\d+|"+Object.keys(Vb).join("|")+"));?","g");Ad=//g;zd=/&/g;var Oa=/^\s*\r?\n/,Na=/\r?\n\s*$/,Cd=function(e,a,b){var c;a&&(c=e[0],"string"===typeof c&&((c=c.replace(a,""))?e[0]=c:e.shift()));b&&(c=T(e),"string"=== -typeof c&&((c=c.replace(b,""))?e[e.length-1]=c:e.pop()))},Mg=/[ \t\f\r\n]+/g,Jg=/^(?:pre|script|style|textarea)$/i,Dd=/^[ \t\f\r\n]+/,Ed=/[ \t\f\r\n]+$/,Kg=/^(?:\r\n|\r|\n)/,Lg=/(?:\r\n|\r|\n)$/,ej=function(e){var a,b;a=e.pos;if(!e.matchString("/,Xb=function(e,a){var b,c,d;for(b=a.length;b--;){c=e.indexOf(a[b]);if(!c)return 0; --1!==c&&(!d||c\s]/.test(e.nextChar())||e.error("Expected `=`, `/`, `>` or whitespace");e.allowWhitespace();if(e.matchString("=")){e.allowWhitespace();b=e.pos;c=e.sectionDepth;if(!(d=Gd(e,"'")||Gd(e,'"'))){var f;e.inAttribute=!0;d=[];for(f=Pa(e)||Fd(e);null!==f;)d.push(f),f=Pa(e)||Fd(e);d.length?e.inAttribute=!1:d=null}null===d&&e.error("Expected valid attribute value"); -e.sectionDepth!==c&&(e.pos=b,e.error("An attribute value must contain as many opening section tags as closing section tags"));e=d.length?1===d.length&&"string"===typeof d[0]?Ub(d[0]):d:""}else e.pos=b,e=null;null!=e&&(a.value=e);return a},fj=/^[^\s"'>\/=]+/,Ng=/^[^\s"'=<>`]+/,jf,Hc,kf,lf,mf,nf,of;Hc={"true":!0,"false":!1,undefined:void 0,"null":null};kf=new RegExp("^(?:"+Object.keys(Hc).join("|")+")");lf=/^(?:[+-]?)(?:(?:(?:0|[1-9]\d*)?\.\d+)|(?:(?:0|[1-9]\d*)\.)|(?:0|[1-9]\d*))(?:[eE][+-]?\d+)?/; -mf=/\$\{([^\}]+)\}/g;nf=/^\$\{([^\}]+)\}/;of=/^\s*$/;jf=Ca.extend({init:function(a,b){this.values=b.values;this.allowWhitespace()},postProcess:function(a){return 1===a.length&&of.test(this.leftover)?{value:a[0].v}:null},converters:[function(a){var b;if(!a.values)return null;if((b=a.matchPattern(nf))&&a.values.hasOwnProperty(b))return{v:a.values[b]}},function(a){if(a=a.matchPattern(kf))return{v:Hc[a]}},function(a){if(a=a.matchPattern(lf))return{v:+a}},function(a){var b=Ec(a),c;return b&&(c=a.values)? -{v:b.v.replace(mf,function(a,e){return e in c?c[e]:e})}:b},function(a){var b,c;if(!a.matchString("{"))return null;b={};a.allowWhitespace();if(a.matchString("}"))return{v:b};for(;c=Og(a);){b[c.key]=c.value;a.allowWhitespace();if(a.matchString("}"))return{v:b};if(!a.matchString(","))break}return null},function(a){var b,c;if(!a.matchString("["))return null;b=[];a.allowWhitespace();if(a.matchString("]"))return{v:b};for(;c=a.read();){b.push(c.v);a.allowWhitespace();if(a.matchString("]"))return{v:b};if(!a.matchString(","))break; -a.allowWhitespace()}return null}]});var Gb=function(a,b){return(new jf(a,{values:b})).result},qf=function(a,b){var c,d,f,g;if("string"===typeof a){if(c=hj.exec(a))return d=a.lastIndexOf(")"),ij.test(a)||b.error("Invalid input after method call expression '"+a.slice(d+1)+"'"),c={m:c[1]},d="["+a.slice(c.m.length+1,d)+"]",d=new pf(d),c.a=kb(d.result[0]),c;if(-1===a.indexOf(":"))return a.trim();a=[a]}g=[];d=[];if(a){for(;a.length;)if(c=a.shift(),"string"===typeof c)if(f=c.indexOf(":"),-1===f)g.push(c); -else{f&&g.push(c.substr(0,f));c.length>f+1&&(d[0]=c.substring(f+1));break}else g.push(c);d=d.concat(a)}g.length?d.length||"string"!==typeof g?(c={n:1===g.length&&"string"===typeof g[0]?g[0]:g},1===d.length&&"string"===typeof d[0]?(f=Gb("["+d[0]+"]"),c.a=f?f.value:d[0].trim()):c.d=d):c=g:c="";return c},hj=/^([a-zA-Z_$][a-zA-Z_$0-9]*)\(/,ij=/\)\s*$/,pf;pf=Ca.extend({converters:[function(a){return X(a)}]});var jj=/^[a-zA-Z]{1,}:?[a-zA-Z0-9\-]*/,kj=/^[\s\n\/>]/,lj=/^on/,mj=/^on-([a-zA-Z\\*\\.$_][a-zA-Z\\*\\.$_0-9\-]+)$/, -nj=/^(?:change|reset|teardown|update|construct|config|init|render|unrender|detach|insert)$/,oj={"intro-outro":"t0",intro:"t1",outro:"t2",decorator:"o"},pj={exclude:!0},Jd;Jd={li:["li"],dt:["dt","dd"],dd:["dt","dd"],p:"address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul".split(" "),rt:["rt","rp"],rp:["rt","rp"],optgroup:["optgroup"],option:["option","optgroup"],thead:["tbody","tfoot"],tbody:["tbody","tfoot"],tfoot:["tbody"], -tr:["tr","tbody"],td:["td","th","tr"],th:["td","th","tr"]};var rf=/[-/\\^$*+?.()|[\]{}]/g,qj=/^\x3c!--\s*/,rj=/s*>\s*([a-zA-Z_$][-a-zA-Z_$0-9]*)\s*/,sj=/\s*--\x3e/,sf,tj=/^#\s*partial\s+/,yb=function(a,b){return(new tf(a,b||{})).result},uj=[function(a,b){var c,d,f;if(!a.matchString(">"))return null;a.allowWhitespace();a.relaxedNames=!0;c=X(a);a.relaxedNames=!1;a.allowWhitespace();d=X(a);a.allowWhitespace();if(!c)return null;f={t:8};Aa(c,f);a.allowWhitespace();d&&(f={t:4,n:53,f:[f]},Aa(d,f));a.matchString(b.close)|| -a.error("Expected closing delimiter '"+b.close+"'");return f},df,gf,function(a,b){var c,d;if(!a.matchPattern(Yi))return null;c=a.matchPattern(/^[a-zA-Z_$][a-zA-Z_$0-9\-]*/);a.allowWhitespace();a.matchString(b.close)||a.error("expected legal partial name");d={t:16};c&&(d.n=c);return d},ef,function(a,b){var c;if(!a.matchString("!"))return null;c=a.remaining().indexOf(b.close);if(-1!==c)return a.pos+=c+b.close.length,{t:9}}],uf=[function(a,b){var c=X(a),d;if(!c)return null;a.matchString(b.close)||a.error("Expected closing delimiter '"+ -b.close+"'");d={t:3};Aa(c,d);return d}],vj=[df,gf,ef],tf=void 0,lb=[Pa,function(a){var b,c,d;b=a.pos;if(!a.matchString("\x3c!--"))return null;c=a.remaining();d=c.indexOf("--\x3e");-1===d&&a.error("Illegal HTML - expected closing comment sequence ('--\x3e')");c=c.substr(0,d);a.pos+=d+3;d={t:9,c:c};a.includeLinePositions&&(d.p=a.getLinePos(b));return d},function(a){var b,c,d,f,g,h,k,l,m;b=a.pos;if(a.inside||a.inAttribute||!a.matchString("<")||"/"===a.nextChar())return null;c={};a.includeLinePositions&& -(c.p=a.getLinePos(b));if(a.matchString("!"))return c.t=18,a.matchPattern(/^doctype/i)||a.error("Expected DOCTYPE declaration"),c.a=a.matchPattern(/^(.+?)>/),c;c.t=7;c.e=a.matchPattern(jj);if(!c.e)return null;kj.test(a.nextChar())||a.error("Illegal tag name");b=function(b,d){var K=d.n||d;nj.test(K)&&(a.pos-=K.length,a.error("Cannot use reserved event names (change, reset, teardown, update, construct, config, init, render, unrender, detach, insert)"));c.v[b]=d};for(a.allowWhitespace();f=Pa(a)||gj(a);)f.name? -(d=oj[f.name])?c[d]=qf(f.value,a):(d=mj.exec(f.name))?(c.v||(c.v={}),f=qf(f.value,a),b(d[1],f)):a.sanitizeEventAttributes&&lj.test(f.name)||(c.a||(c.a={}),c.a[f.name]=f.value||(""===f.value?"":0)):(c.m||(c.m=[]),c.m.push(f)),a.allowWhitespace();a.allowWhitespace();a.matchString("/")&&(g=!0);if(!a.matchString(">"))return null;b=c.e.toLowerCase();d=a.preserveWhitespace;if(!g&&!Fb.test(c.e)){a.elementStack.push(b);if("script"===b||"style"===b)a.inside=b;g=[];f=O(null);do m=a.pos,k=a.remaining(),Pg(b, -k)?(k=ej(a))?(l=!0,k=k.e.toLowerCase(),k!==b&&(a.pos=m,~a.elementStack.indexOf(k)||(m="Unexpected closing tag",Fb.test(k)&&(m+=" (<"+k+"> is a void element - it cannot contain children)"),a.error(m)))):(k=Gc(a,{open:a.standardDelimiters[0],close:a.standardDelimiters[1]}))?(l=!0,a.pos=m):(k=a.read(vf))?(f[k.n]&&(a.pos=m,a.error("Duplicate partial definition")),va(k.f,a.stripComments,d,!d,!d),f[k.n]=k.f,h=!0):(k=a.read(lb))?g.push(k):l=!0:l=!0;while(!l);g.length&&(c.f=g);h&&(c.p=f);a.elementStack.pop()}a.inside= -null;return a.sanitizeElements&&-1!==a.sanitizeElements.indexOf(b)?pj:c},function(a){var b,c,d;c=a.remaining();d=a.inside?"","`"):a.inAttribute?b.push(a.inAttribute):b.push(d),b=Xb(c,b));if(!b)return null;-1===b&&(b=c.length);a.pos+=b;return a.inside?c.substr(0,b):Ub(c.substr(0,b))}],vf=[function(a){var b= -a.pos,c=a.standardDelimiters[0],d=a.standardDelimiters[1],f=void 0,g=void 0;if(!a.matchPattern(qj)||!a.matchString(c))return a.pos=b,null;var h=a.matchPattern(rj);J("Inline partial comments are deprecated.\nUse this...\n {{#partial "+h+"}} ... {{/partial}}\n\n...instead of this:\n \x3c!-- {{>"+h+"}} --\x3e ... \x3c!-- {{/"+h+"}} --\x3e'");if(!a.matchString(d)||!a.matchPattern(sj))return a.pos=b,null;f=[];b=new RegExp("^\x3c!--\\s*"+c.replace(rf,"\\$&")+"\\s*\\/\\s*"+h+"\\s*"+d.replace(rf,"\\$&")+ -"\\s*--\x3e");do a.matchPattern(b)?g=!0:((sf=a.read(lb))||a.error("expected closing comment ('\x3c!-- "+c+"/"+h+""+d+" --\x3e')"),f.push(sf));while(!g);return{t:17,f:f,n:h}},function(a){var b,c,d,f;b=a.pos;var g=a.standardDelimiters;if(!a.matchString(g[0]))return null;if(!a.matchPattern(tj))return a.pos=b,null;(b=a.matchPattern(/^[a-zA-Z_$][a-zA-Z_$0-9\-]*/))||a.error("expected legal partial name");a.matchString(g[1])||a.error("Expected closing delimiter '"+g[1]+"'");c=[];do Gc(a,{open:a.standardDelimiters[0], -close:a.standardDelimiters[1]})?f=!0:((d=a.read(lb))||a.error("Expected "+g[0]+"/partial"+g[1]),c.push(d));while(!f);return{t:17,n:b,f:c}}],tf=Ca.extend({init:function(a,b){var c=b.tripleDelimiters||["{{{","}}}"],d=b.staticDelimiters||["[[","]]"],f=b.staticTripleDelimiters||["[[[","]]]"];this.standardDelimiters=b.delimiters||["{{","}}"];this.tags=[{isStatic:!1,isTriple:!1,open:this.standardDelimiters[0],close:this.standardDelimiters[1],readers:uj},{isStatic:!1,isTriple:!0,open:c[0],close:c[1],readers:uf}, -{isStatic:!0,isTriple:!1,open:d[0],close:d[1],readers:vj},{isStatic:!0,isTriple:!0,open:f[0],close:f[1],readers:uf}];this.sortMustacheTags();this.sectionDepth=0;this.elementStack=[];this.interpolate={script:!b.interpolate||!1!==b.interpolate.script,style:!b.interpolate||!1!==b.interpolate.style};!0===b.sanitize&&(b.sanitize={elements:"applet base basefont body frame frameset head html isindex link meta noframes noscript object param script style title".split(" "),eventAttributes:!0});this.stripComments= -!1!==b.stripComments;this.preserveWhitespace=b.preserveWhitespace;this.sanitizeElements=b.sanitize&&b.sanitize.elements;this.sanitizeEventAttributes=b.sanitize&&b.sanitize.eventAttributes;this.includeLinePositions=b.includeLinePositions},postProcess:function(a){if(!a.length)return{t:[],v:3};0 element");}return"textContent"in c?c.textContent:c.innerHTML},isHashedId:Ld,isParsed:function(a){return"string"!== -typeof a},getParseOptions:function(a){a.defaults&&(a=a.defaults);return wj.reduce(function(b,c){b[c]=a[c];return b},{})},createHelper:function(a){var b=O(wf);b.parse=function(b,c){return Kd(b,c||a)};return b},parse:Kd},ia=wf,Yb={name:"template",extend:function(a,b,c){"template"in c&&(a=c.template,b.template="function"===typeof a?a:zb(a,b))},init:function(a,b,c){a="template"in c?c.template:a.prototype.template;"function"===typeof a&&(c=a,a=Md(b,c),b._config.template={fn:c,result:a});a=zb(a,b);b.template= -a.t;a.p&&Nd(b.partials,a.p)},reset:function(a){var b;b=a._config.template;var c;b&&b.fn?(c=Md(a,b.fn),c!==b.result?(b.result=c,b=c=zb(c,a)):b=void 0):b=void 0;if(b)return b=zb(b,a),a.template=b.t,Nd(a.partials,b.p,!0),!0}},Hb;Hb=function(a,b){this.name=a;this.useDefaults=b};Hb.prototype={constructor:Hb,extend:function(a,b,c){this.configure(this.useDefaults?a.defaults:a,this.useDefaults?b:b.constructor,c)},init:function(){},configure:function(a,b,c){var d=this.name;c=c[d];a=O(a[d]);for(var f in c)a[f]= -c[f];b[d]=a},reset:function(a){var b=a[this.name],c=!1;Object.keys(b).forEach(function(a){var e=b[a];e._fn&&(e._fn.isOwner?b[a]=e._fn:delete b[a],c=!0)});return c}};var cb="adaptors components computed decorators easing events interpolators partials transitions".split(" ").map(function(a){return new Hb(a,"computed"===a)}),Ug=function(a,b,c){if(!/_super/.test(c))return c;var d=function(){var a=Rg(d._parent,b),e="_super"in this,f=this._super;this._super=a;a=c.apply(this,arguments);e?this._super=f:delete this._super; -return a};d._parent=a;d._method=c;return d},Sg=function(a){bb(a,"beforeInit","onconstruct");bb(a,"init","onrender");bb(a,"complete","oncomplete");bb(a,"eventDefinitions","events");g(a.adaptors)&&bb(a,"adaptors","adapt")},Ic,Ib,Wa,Td,Qd;Wa={adapt:Rd,css:Sd,data:qc,template:Yb};Ib=Object.keys(te);Qd=Ud(Ib.filter(function(a){return!Wa[a]}));Td=Ud(Ib.concat(cb.map(function(a){return a.name})));Ic=[].concat(Ib.filter(function(a){return!cb[a]&&!Wa[a]}),cb,Wa.data,Wa.template,Wa.css);var pc={extend:function(a, -b,c){return Pd("extend",a,b,c)},init:function(a,b,c){return Pd("init",a,b,c)},reset:function(a){return Ic.filter(function(b){return b.reset&&b.reset(a)}).map(function(a){return a.name})},order:Ic},Jc=function(){return a(this.node)},xf=function(a){this.type=1;this.text=a.template};xf.prototype={detach:Jc,firstNode:function(){return this.node},render:function(){this.node||(this.node=document.createTextNode(this.text));return this.node},toString:function(a){return a?Wb(this.text):this.text},unrender:function(a){if(a)return this.detach()}}; -var Sh=xf,Xa=function(){this.registered&&this.root.viewmodel.unregister(this.keypath,this);this.resolver&&this.resolver.unbind()},Kc=function(a,b,c){this.ref=b;this.resolved=!1;this.root=a.root;this.parentFragment=a.parentFragment;this.callback=c;a=wb(a.root,b,a.parentFragment);void 0!=a?this.resolve(a):w.addUnresolved(this)};Kc.prototype={resolve:function(a){this.keypath&&!a&&w.addUnresolved(this);this.resolved=!0;this.keypath=a;this.callback(a)},forceResolution:function(){this.resolve(L(this.ref))}, -rebind:function(a,b){var c;void 0!=this.keypath&&(c=this.keypath.replace(a,b),void 0!==c&&this.resolve(c))},unbind:function(){this.resolved||w.removeUnresolved(this)}};var yf=function(a,b,c){this.parentFragment=a.parentFragment;this.ref=b;this.callback=c;this.rebind()},xj={"@keypath":{prefix:"c",prop:["context"]},"@index":{prefix:"i",prop:["index"]},"@key":{prefix:"k",prop:["key","index"]}};yf.prototype={rebind:function(){var a=this.ref,b=this.parentFragment,c=xj[a],d;if(!c)throw Error('Unknown special reference "'+ -a+'" - valid references are @index, @key and @keypath');if(this.cached)return this.callback(L("@"+c.prefix+$b(this.cached,c)));if(-1!==c.prop.indexOf("index")||-1!==c.prop.indexOf("key"))for(;b;){if(52===b.owner.currentSubtype&&void 0!==(d=$b(b,c)))return this.cached=b,b.registerIndexRef(this),this.callback(L("@"+c.prefix+d));b=!b.parent&&b.owner&&b.owner.component&&b.owner.component.parentFragment&&!b.owner.component.instance.isolated?b.owner.component.parentFragment:b.parent}else for(;b;){if(void 0!== -(d=$b(b,c)))return this.callback(L("@"+c.prefix+d.str));b=b.parent}},unbind:function(){this.cached&&this.cached.unregisterIndexRef(this)}};var zf=function(a,b,c){this.parentFragment=a.parentFragment;this.ref=b;this.callback=c;b.ref.fragment.registerIndexRef(this);this.rebind()};zf.prototype={rebind:function(){var a;a=this.ref.ref;a="k"===a.ref.t?"k"+a.fragment.key:"i"+a.fragment.index;void 0!==a&&this.callback(L("@"+a))},unbind:function(){this.ref.ref.fragment.unregisterIndexRef(this)}};Qa.resolve= -function(a){var b={},c,d;for(c in a.refs)d=a.refs[c],b[d.ref.n]="k"===d.ref.t?d.fragment.key:d.fragment.index;return b};var gb=function(a,b,c){var d;return"@"===b.charAt(0)?new yf(a,b,c):(d=Qa(a.parentFragment,b))?new zf(a,d,c):new Kc(a,b,c)},Af=function(a,b){var c;if(Lc[a])return Lc[a];for(c=[];b--;)c[b]="_"+b;c=new Function(c.join(","),"return("+a+")");return Lc[a]=c},Lc={},Mc,Zg=Function.prototype.bind;Mc=function(a,b,c,d){var f=this;this.root=a.root;this.parentFragment=b;this.callback=d;this.owner= -a;this.str=c.s;this.keypaths=[];this.pending=c.r.length;this.refResolvers=c.r.map(function(a,e){return gb(f,a,function(a){f.resolve(e,a)})});this.ready=!0;this.bubble()};Mc.prototype={bubble:function(){this.ready&&(this.uniqueString=Wg(this.str,this.keypaths),this.keypath=L("${"+this.uniqueString.replace(/[\.\[\]]/g,"-").replace(/\*/,"#MUL#")+"}"),this.createEvaluator(),this.callback(this.keypath))},unbind:function(){for(var a;a=this.refResolvers.pop();)a.unbind()},resolve:function(a,b){this.keypaths[a]= -b;this.bubble()},createEvaluator:function(){var a=this,b,c,d,f;d=this.keypath;(b=this.root.viewmodel.computations[d.str])?this.root.viewmodel.mark(d):(f=Af(this.str,this.refResolvers.length),c=this.keypaths.map(function(b){var c;return"undefined"===b?function(){}:b.isSpecial?(c=b.value,function(){return c}):function(){var c=a.root.viewmodel.get(b,{noUnwrap:!0,fullRootGet:!0});"function"===typeof c&&(c=Yg(c,a.root));return c}}),b={deps:this.keypaths.filter(Xg),getter:function(){var a=c.map(Vg);return f.apply(null, -a)}},b=this.root.viewmodel.compute(d,b))},rebind:function(a,b){this.refResolvers.forEach(function(c){return c.rebind(a,b)})}};var nc=Mc,Bf=function(a,b,c){var d=this;this.resolver=b;this.root=b.root;this.parentFragment=c;this.viewmodel=b.root.viewmodel;"string"===typeof a?this.value=a:30===a.t?this.refResolver=gb(this,a.n,function(a){d.resolve(a)}):new nc(b,c,a,function(a){d.resolve(a)})};Bf.prototype={resolve:function(a){this.keypath&&this.viewmodel.unregister(this.keypath,this);this.keypath=a;this.value= -this.viewmodel.get(a);this.bind();this.resolver.bubble()},bind:function(){this.viewmodel.register(this.keypath,this)},rebind:function(a,b){this.refResolver&&this.refResolver.rebind(a,b)},setValue:function(a){this.value=a;this.resolver.bubble()},unbind:function(){this.keypath&&this.viewmodel.unregister(this.keypath,this);this.refResolver&&this.refResolver.unbind()},forceResolution:function(){this.refResolver&&this.refResolver.forceResolution()}};var Cf=function(a,b,c){var d=this,f,g,h;this.parentFragment= -h=a.parentFragment;this.root=f=a.root;this.mustache=a;this.ref=a=b.r;this.callback=c;this.unresolved=[];(g=wb(f,a,h))?this.base=g:this.baseResolver=new Kc(this,a,function(a){d.base=a;d.baseResolver=null;d.bubble()});this.members=b.m.map(function(a){return new Bf(a,d,h)});this.ready=!0;this.bubble()};Cf.prototype={getKeypath:function(){var a=this.members.map($g);return!a.every(ah)||this.baseResolver?null:this.base.join(a.join("."))},bubble:function(){this.ready&&!this.baseResolver&&this.callback(this.getKeypath())}, -unbind:function(){this.members.forEach(ha)},rebind:function(a,b){var c;if(this.base){var d=this.base.replace(a,b);d&&d!==this.base&&(this.base=d,c=!0)}this.members.forEach(function(d){d.rebind(a,b)&&(c=!0)});c&&this.bubble()},forceResolution:function(){this.baseResolver&&(this.base=L(this.ref),this.baseResolver.unbind(),this.baseResolver=null);this.members.forEach(bh);this.bubble()}};var pe=Cf,Df=function(a,b){this.fragments&&this.fragments.forEach(function(c){return c.rebind(a,b)});this.resolver&& -this.resolver.rebind(a,b)},ba={getValue:function(){return this.value},init:function(a,b){function c(b){a.resolve(b)}function d(b){var c=a.keypath;b!=c&&(a.resolve(b),void 0!==c&&a.fragments&&a.fragments.forEach(function(a){a.rebind(c,b)}))}var f,g;g=b.parentFragment;f=b.template;a.root=g.root;a.parentFragment=g;a.pElement=g.pElement;a.template=b.template;a.index=b.index||0;a.isStatic=b.template.s;a.type=b.template.t;a.registered=!1;if(f=f.r)a.resolver=gb(a,f,c);b.template.x&&(a.resolver=new nc(a, -g,b.template.x,d));b.template.rx&&(a.resolver=new pe(a,b.template.rx,d));51!==a.template.n||a.hasOwnProperty("value")||a.setValue(void 0)},resolve:function(a){var b,c,d;a&&a.isSpecial?(this.keypath=a,this.setValue(a.value)):(this.registered&&(this.root.viewmodel.unregister(this.keypath,this),this.registered=!1,b=!0),this.keypath=a,void 0!=a&&(c=this.root.viewmodel.get(a),this.root.viewmodel.register(a,this),this.registered=!0),this.setValue(c),b&&(d=this.twowayBinding)&&d.rebound())},rebind:Df},Ef= -function(a){this.type=2;ba.init(this,a)};Ef.prototype={update:function(){this.node.data=void 0==this.value?"":this.value},resolve:ba.resolve,rebind:ba.rebind,detach:Jc,unbind:Xa,render:function(){this.node||(this.node=document.createTextNode(d(this.value)));return this.node},unrender:function(e){e&&a(this.node)},getValue:ba.getValue,setValue:function(a){var b;this.keypath&&(b=this.root.viewmodel.wrapped[this.keypath.str])&&(a=b.get());h(a,this.value)||(this.value=a,this.parentFragment.bubble(),this.node&& -w.addView(this))},firstNode:function(){return this.node},toString:function(a){var b=""+d(this.value);return a?Wb(b):b}};var Uh=Ef,Ff=function(a){this.type=4;this.subtype=this.currentSubtype=a.template.n;this.inverted=51===this.subtype;this.pElement=a.pElement;this.fragments=[];this.fragmentsToCreate=[];this.fragmentsToRender=[];this.fragmentsToUnrender=[];a.template.i&&(this.indexRefs=a.template.i.split(",").map(function(a,e){return{n:a,t:0===e?"k":"i"}}));this.renderedFragments=[];this.length=0; -ba.init(this,a)};Ff.prototype={bubble:function(){this.parentFragment.bubble()},detach:function(){var a;if(1===this.fragments.length)return this.fragments[0].detach();a=document.createDocumentFragment();this.fragments.forEach(function(b){a.appendChild(b.detach())});return a},find:function(a){var b,c,d;c=this.fragments.length;for(b=0;b',""],THEAD:['',"
"],TBODY:['',"
"],TR:['',"
"],SELECT:['"]}}var If=function(a,b,c){var d,f=[],g,h;if(null!= -a&&""!==a){Gf&&(g=Hf[b.tagName])?(d=dc("DIV"),d.innerHTML=g[0]+a+g[1],d=d.querySelector(".x"),"SELECT"===d.tagName&&(h=d.options[d.selectedIndex])):b.namespaceURI===ka.svg?(d=dc("DIV"),d.innerHTML=''+a+"",d=d.querySelector(".x")):(d=dc(b.tagName),d.innerHTML=a,"SELECT"===d.tagName&&(h=d.options[d.selectedIndex]));for(;a=d.firstChild;)f.push(a),c.appendChild(a);if("SELECT"===b.tagName)for(b=f.length;b--;)f[b]!==h&&(f[b].selected=!1)}return f},Jf=function(a){var b,c;if(a&&"select"=== -a.name&&a.binding){b=fa(a.node.options).filter(ih);if(a.getAttribute("multiple"))c=b.map(function(a){return a.value});else if(b=b[0])c=b.value;void 0!==c&&a.binding.setValue(c);a.bubble()}},Kf=function(a){this.type=3;ba.init(this,a)};Kf.prototype={detach:function(){var a,b;if(this.docFrag){a=this.nodes.length;for(b=0;b)", -b.resolver.uniqueString,a.name,{ractive:this.root}),!1;if(c.isSpecial)return J("Two-way binding does not work with %s",b.resolver.ref,{ractive:this.root}),!1}else x("The %s being used for two-way binding is ambiguous, and may cause unexpected results. Consider initialising your data to eliminate the ambiguity",b.template.r?"'"+b.template.r+"' reference":"expression",{ractive:this.root}),b.resolver.forceResolution(),c=b.keypath;this.attribute.isTwoway=!0;this.keypath=c;b=this.root.viewmodel.get(c); -void 0===b&&this.getInitialValue&&(b=this.getInitialValue(),void 0!==b&&this.root.viewmodel.set(c,b));a:{for(;a=a.parent;)if("form"===a.name)break a;a=void 0}a&&(this.resetValue=b,a.formBindings.push(this))};ca.prototype={handleChange:function(){var a=this;w.start(this.root);this.attribute.locked=!0;this.root.viewmodel.set(this.keypath,this.getValue());w.scheduleTask(function(){return a.attribute.locked=!1});w.end()},rebound:function(){var a,b;a=this.keypath;b=this.attribute.interpolator.keypath; -a!==b&&(Q(this.root._twowayBindings[a.str],this),this.keypath=b,a=this.root._twowayBindings[b.str]||(this.root._twowayBindings[b.str]=[]),a.push(this))},unbind:function(){}};ca.extend=function(a){var b;b=function(a){ca.call(this,a);this.init&&this.init()};b.prototype=O(this.prototype);c(b.prototype,a);b.extend=ca.extend;return b};var N=function(){this._ractive.binding.handleChange()},Jb=ca.extend({getInitialValue:function(){return""},getValue:function(){return this.element.node.value},render:function(){var a= -this.element.node,b,c=!1;this.rendered=!0;b=this.root.lazy;!0===this.element.lazy?b=!0:!1===this.element.lazy?b=!1:k(this.element.lazy)?(b=!1,c=+this.element.lazy):k(b||"")&&(c=+b,b=!1,this.element.lazy=c);this.handler=c?kh:N;a.addEventListener("change",N,!1);b||(a.addEventListener("input",this.handler,!1),a.attachEvent&&a.addEventListener("keyup",this.handler,!1));a.addEventListener("blur",Yd,!1)},unrender:function(){var a=this.element.node;this.rendered=!1;a.removeEventListener("change",N,!1);a.removeEventListener("input", -this.handler,!1);a.removeEventListener("keyup",this.handler,!1);a.removeEventListener("blur",Yd,!1)}}),Mj=Jb.extend({getInitialValue:function(){return this.element.fragment?this.element.fragment.toString():""},getValue:function(){return this.element.node.innerHTML}}),Oc=function(a,b,c){a=a+b+c;return Qf[a]||(Qf[a]=[])},Qf={},Nj=ca.extend({name:"checked",init:function(){this.siblings=Oc(this.root._guid,"radio",this.element.getAttribute("name"));this.siblings.push(this)},render:function(){var a=this.element.node; -a.addEventListener("change",N,!1);a.attachEvent&&a.addEventListener("click",N,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",N,!1);a.removeEventListener("click",N,!1)},handleChange:function(){w.start(this.root);this.siblings.forEach(function(a){a.root.viewmodel.set(a.keypath,a.getValue())});w.end()},getValue:function(){return this.element.node.checked},unbind:function(){Q(this.siblings,this)}}),Oj=ca.extend({name:"name",init:function(){this.siblings=Oc(this.root._guid, -"radioname",this.keypath.str);this.siblings.push(this);this.radioName=!0},getInitialValue:function(){if(this.element.getAttribute("checked"))return this.element.getAttribute("value")},render:function(){var a=this.element.node;a.name="{{"+this.keypath.str+"}}";a.checked=this.root.viewmodel.get(this.keypath)==this.element.getAttribute("value");a.addEventListener("change",N,!1);a.attachEvent&&a.addEventListener("click",N,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change", -N,!1);a.removeEventListener("click",N,!1)},getValue:function(){var a=this.element.node;return a._ractive?a._ractive.value:a.value},handleChange:function(){this.element.node.checked&&ca.prototype.handleChange.call(this)},rebound:function(a,b){var c;ca.prototype.rebound.call(this,a,b);if(c=this.element.node)c.name="{{"+this.keypath.str+"}}"},unbind:function(){Q(this.siblings,this)}}),Pj=ca.extend({name:"name",getInitialValue:function(){this.noInitialValue=!0;return[]},init:function(){var a,b;this.checkboxName= -!0;this.siblings=Oc(this.root._guid,"checkboxes",this.keypath.str);this.siblings.push(this);this.noInitialValue&&(this.siblings.noInitialValue=!0);this.siblings.noInitialValue&&this.element.getAttribute("checked")&&(a=this.root.viewmodel.get(this.keypath),b=this.element.getAttribute("value"),a.push(b))},unbind:function(){Q(this.siblings,this)},render:function(){var a=this.element.node,b,c;b=this.root.viewmodel.get(this.keypath);c=this.element.getAttribute("value");g(b)?this.isChecked=W(b,c):this.isChecked= -b==c;a.name="{{"+this.keypath.str+"}}";a.checked=this.isChecked;a.addEventListener("change",N,!1);a.attachEvent&&a.addEventListener("click",N,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",N,!1);a.removeEventListener("click",N,!1)},changed:function(){var a=!!this.isChecked;this.isChecked=this.element.node.checked;return this.isChecked===a},handleChange:function(){this.isChecked=this.element.node.checked;ca.prototype.handleChange.call(this)},getValue:function(){return this.siblings.filter(lh).map(mh)}}), -Qj=ca.extend({name:"checked",render:function(){var a=this.element.node;a.addEventListener("change",N,!1);a.attachEvent&&a.addEventListener("click",N,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",N,!1);a.removeEventListener("click",N,!1)},getValue:function(){return this.element.node.checked}}),Pc=ca.extend({getInitialValue:function(){var a=this.element.options,b,c,d,f;if(void 0===this.element.getAttribute("value")&&(c=b=a.length)){for(;c--;)if(a[c].getAttribute("selected")){d= -a[c].getAttribute("value");f=!0;break}if(!f)for(;++c is not valid',a.name,b),this.invalid=!0);c.m?(b=c.a.r,this.method= -c.m,this.keypaths=[],this.fn=Af(c.a.s,b.length),this.parentFragment=a.parentFragment,this.refResolvers=[],b.forEach(function(a,b){var e=void 0;(e=Uj.exec(a))?d.keypaths[b]={eventObject:!0,refinements:e[1]?e[1].split("."):[]}:d.refResolvers.push(gb(d,a,function(a){return d.resolve(b,a)}))}),this.fire=nh):(a=c.n||c,"string"!==typeof a&&(a=new S({template:a,root:this.root,owner:this})),this.action=a,c.d?(this.dynamicParams=new S({template:c.d,root:this.root,owner:this.element}),this.fire=ph):c.a&&(this.params= -c.a,this.fire=oh))},listen:function(){var a,b=this.name;if(!this.invalid){if(a=P("events",this.root,b))this.custom=a(this.node,qh(b));else{if(!("on"+b in this.node||window&&"on"+b in window||ue)){Vj[b]||J(Sa(b,"event"),{node:this.node});return}this.node.addEventListener(b,Rf,!1)}this.hasListener=!0}},rebind:function(a,b){function c(d){d&&d.rebind(a,b)}this.method?this.refResolvers.forEach(c):("string"!==typeof this.action&&c(this.action),this.dynamicParams&&c(this.dynamicParams))},render:function(){this.node= -this.element.node;this.node._ractive.events[this.name]=this;(this.method||this.getAction())&&this.listen()},resolve:function(a,b){this.keypaths[a]=b},unbind:function(){this.method?this.refResolvers.forEach(ha):("string"!==typeof this.action&&this.action.unbind(),this.dynamicParams&&this.dynamicParams.unbind())},unrender:function(){this.custom?this.custom.teardown():this.node.removeEventListener(this.name,Rf,!1);this.hasListener=!1}};var Tf=function(a,b){var c=this,d,f,g;this.element=a;this.root=d= -a.root;f=b.n||b;if("string"!==typeof f&&(g=new S({template:f,root:d,owner:a}),f=g.toString(),g.unbind(),""===f))return;b.a?this.params=b.a:b.d&&(this.fragment=new S({template:b.d,root:d,owner:a}),this.params=this.fragment.getArgsList(),this.fragment.bubble=function(){this.dirtyArgs=this.dirtyValue=!0;c.params=this.getArgsList();c.ready&&c.update()});(this.fn=P("decorators",d,f))||m(Sa(f,"decorator"))};Tf.prototype={init:function(){var a;a=this.element.node;this.params?(a=[a].concat(this.params),a= -this.fn.apply(this.root,a)):a=this.fn.call(this.root,a);if(!a||!a.teardown)throw Error("Decorator definition must return an object with a teardown method");this.actual=a;this.ready=!0},update:function(){this.actual.update?this.actual.update.apply(this.root,this.params):(this.actual.teardown(!0),this.init())},rebind:function(a,b){this.fragment&&this.fragment.rebind(a,b)},teardown:function(a){this.torndown=!0;this.ready&&this.actual.teardown();!a&&this.fragment&&this.fragment.unbind()}};var Qc=function(a){return a.replace(/-([a-zA-Z])/g, -function(a,b){return b.toUpperCase()})},Rc,mb,Sc;pa?(mb={},Sc=wa("div").style,Rc=function(a){var b,c,d;a=Qc(a);if(!mb[a])if(void 0!==Sc[a])mb[a]=a;else for(d=a.charAt(0).toUpperCase()+a.substring(1),b=qa.length;b--;)if(c=qa[b],void 0!==Sc[c+d]){mb[a]=c+d;break}return mb[a]}):Rc=null;var sa=Rc,Tc,Uf;pa?(Uf=window.getComputedStyle||null.getComputedStyle,Tc=function(a){var b,c,d,f,h;b=Uf(this.node);if("string"===typeof a)return h=b[sa(a)],"0px"===h&&(h=0),h;if(!g(a))throw Error("Transition$getStyle must be passed a string, or an array of strings representing CSS properties"); -c={};for(d=a.length;d--;)f=a[d],h=b[sa(f)],"0px"===h&&(h=0),c[f]=h;return c}):Tc=null;var Wj=Tc,Vf=function(a){var b;this.duration=a.duration;this.step=a.step;this.complete=a.complete;"string"===typeof a.easing?(b=a.root.easing[a.easing],b||(J(Sa(a.easing,"easing")),b=$d)):b="function"===typeof a.easing?a.easing:$d;this.easing=b;this.start=Ae();this.end=this.start+this.duration;this.running=!0;Tb.add(this)};Vf.prototype={tick:function(a){if(!this.running)return!1;if(a>this.end)return this.step&&this.step(1), -this.complete&&this.complete(1),!1;a=this.easing((a-this.start)/this.duration);this.step&&this.step(a);return!0},stop:function(){this.abort&&this.abort();this.running=!1}};var Xj=new RegExp("^-(?:"+qa.join("|")+")-"),Yj=new RegExp("^(?:"+qa.join("|")+")([A-Z])"),Wf=function(a){if(!a)return"";Yj.test(a)&&(a="-"+a);return a.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()})},Uc,Vc,Ya,nb,ob,Xf,Yf,Zf,Wc={},Kb={};pa?(Vc=wa("div").style,void 0!==Vc.transition?(Ya="transition",nb="transitionend",ob= -!0):void 0!==Vc.webkitTransition?(Ya="webkitTransition",nb="webkitTransitionEnd",ob=!0):ob=!1,Ya&&(Xf=Ya+"Duration",Yf=Ya+"Property",Zf=Ya+"TimingFunction"),Uc=function(a,b,c,d,f){setTimeout(function(){var g,h,k,l,m;l=function(){h&&k&&(a.root.fire(a.name+":end",a.node,a.isIntro),f())};g=(a.node.namespaceURI||"")+a.node.tagName;a.node.style[Yf]=d.map(sa).map(Wf).join(",");a.node.style[Zf]=Wf(c.easing||"linear");a.node.style[Xf]=c.duration/1E3+"s";m=function(b){b=d.indexOf(Qc(b.propertyName.replace(Xj, -"")));-1!==b&&d.splice(b,1);d.length||(a.node.removeEventListener(nb,m,!1),k=!0,l())};a.node.addEventListener(nb,m,!1);setTimeout(function(){for(var f=d.length,n,ua,p=[],q;f--;)if(q=d[f],n=g+q,ob&&!Kb[n]&&(a.node.style[sa(q)]=b[q],Wc[n]||(ua=a.getStyle(q),Wc[n]=a.getStyle(q)!=b[q],Kb[n]=!Wc[n],Kb[n]&&(a.node.style[sa(q)]=ua))),!ob||Kb[n])void 0===ua&&(ua=a.getStyle(q)),n=d.indexOf(q),-1===n?x("Something very strange happened with transitions. Please raise an issue at https://github.com/ractivejs/ractive/issues - thanks!", -{node:a.node}):d.splice(n,1),n=/[^\d]*$/.exec(b[q])[0],p.push({name:sa(q),interpolator:Eb(parseFloat(ua),parseFloat(b[q])),suffix:n});p.length?new Vf({root:a.root,duration:c.duration,easing:Qc(c.easing||""),step:function(b){var c,d;for(d=p.length;d--;)c=p[d],a.node.style[c.name]=c.interpolator(b)+c.suffix},complete:function(){h=!0;l()}}):h=!0;d.length||(a.node.removeEventListener(nb,m,!1),k=!0,l())},0)},c.delay||0)}):Uc=null;var Zj=Uc,fb,Xc,Lb,Yc,Ra;if("undefined"!==typeof document){fb="hidden";Ra= -{};if(fb in document)Lb="";else for(Yc=qa.length;Yc--;)Xc=qa[Yc],fb=Xc+"Hidden",fb in document&&(Lb=Xc);void 0!==Lb?(document.addEventListener(Lb+"visibilitychange",ae),ae()):("onfocusout"in document?(document.addEventListener("focusout",gc),document.addEventListener("focusin",hc)):(window.addEventListener("pagehide",gc),window.addEventListener("blur",gc),window.addEventListener("pageshow",hc),window.addEventListener("focus",hc)),Ra.hidden=!1)}var ak=Ra,Zc,$f,ag;pa?($f=window.getComputedStyle||null.getComputedStyle, -Zc=function(a,b,c){var d=this,f;if(4===arguments.length)throw Error("t.animateStyle() returns a promise - use .then() instead of passing a callback");if(ak.hidden)return this.setStyle(a,b),ag||(ag=Ga.resolve());"string"===typeof a?(f={},f[a]=b):(f=a,c=b);c||(J('The "%s" transition does not supply an options object to `t.animateStyle()`. This will break in a future version of Ractive. For more info see https://github.com/RactiveJS/Ractive/issues/340',this.name),c=this);return new Ga(function(a){var b, -e,g,h,K,k;if(c.duration){b=Object.keys(f);e=[];g=$f(d.node);for(K=b.length;K--;)k=b[K],h=g[sa(k)],"0px"===h&&(h=0),h!=f[k]&&(e.push(k),d.node.style[sa(k)]=h);e.length?Zj(d,f,c,e,a):a()}else d.setStyle(f),a()})}):Zc=null;var $c=function(a,b,c){this.init(a,b,c)};$c.prototype={init:function(a,b,c){var d,f;this.element=a;this.root=d=a.root;this.isIntro=c;c=b.n||b;if("string"!==typeof c&&(f=new S({template:c,root:d,owner:a}),c=f.toString(),f.unbind(),""===c))return;this.name=c;b.a?this.params=b.a:b.d&& -(f=new S({template:b.d,root:d,owner:a}),this.params=f.getArgsList(),f.unbind());(this._fn=P("transitions",d,c))||J(Sa(c,"transition"),{ractive:this.root})},start:function(){var a=this,b,c,d;b=this.node=this.element.node;c=b.getAttribute("style");this.complete=function(f){d||(!f&&a.isIntro&&(c?b.setAttribute("style",c):(b.getAttribute("style"),b.removeAttribute("style"))),b._ractive.transition=null,a._manager.remove(a),d=!0)};this._fn?this._fn.apply(this.root,[this].concat(this.params)):this.complete()}, -getStyle:Wj,setStyle:function(a,b){var c;if("string"===typeof a)this.node.style[sa(a)]=b;else for(c in a)a.hasOwnProperty(c)&&(this.node.style[sa(c)]=a[c]);return this},animateStyle:Zc,processParams:function(a,b){"number"===typeof a?a={duration:a}:"string"===typeof a?a="slow"===a?{duration:600}:"fast"===a?{duration:200}:{duration:400}:a||(a={});return f({},a,b)}};var bg,cg;bg=function(){var a=this.node,b=this.fragment.toString(!1);window&&window.appearsToBeIELessEqual8&&(a.type="text/css");if(a.styleSheet)a.styleSheet.cssText= -b;else{for(;a.hasChildNodes();)a.removeChild(a.firstChild);a.appendChild(document.createTextNode(b))}};cg=function(){this.node.type&&"text/javascript"!==this.node.type||x("Script tag was updated. This does not cause the code to be re-evaluated!",{ractive:this.root});this.node.text=this.fragment.toString(!1)};var dg=function(a){this.init(a)};dg.prototype={bubble:function(){this.parentFragment.bubble()},detach:function(){var a=this.node,b;if(a)return(b=a.parentNode)&&b.removeChild(a),a},find:function(a){if(!this.node)return null; -if(ra(this.node,a))return this.node;if(this.fragment&&this.fragment.find)return this.fragment.find(a)},findAll:function(a,b){b._test(this,!0)&&b.live&&(this.liveQueries||(this.liveQueries=[])).push(b);this.fragment&&this.fragment.findAll(a,b)},findAllComponents:function(a,b){this.fragment&&this.fragment.findAllComponents(a,b)},findComponent:function(a){if(this.fragment)return this.fragment.findComponent(a)},findNextNode:function(){return null},firstNode:function(){return this.node},getAttribute:function(a){if(this.attributes&& -this.attributes[a])return this.attributes[a].value},init:function(a){var b,c,d,f,g,h;this.type=7;c=this.parentFragment=a.parentFragment;d=this.template=a.template;this.parent=a.pElement||c.pElement;this.root=c=c.root;this.index=a.index;this.key=a.key;this.name=Nc(d.e);if("option"===this.name){b:{if(a=this.parent){do if("select"===a.name)break b;while(a=a.parent)}a=void 0}if(this.select=a)this.select.options.push(this),d.a||(d.a={}),void 0!==d.a.value||d.a.hasOwnProperty("disabled")||(d.a.value=d.f), -"selected"in d.a&&void 0!==this.select.getAttribute("value")&&delete d.a.selected}"select"===this.name&&(this.options=[],this.bubble=rh);"form"===this.name&&(this.formBindings=[]);var k,l;l=d.a||{};b=a=void 0;k=l.twoway;void 0!==k&&(a=0===k||Lf.test(k));k=l.lazy;void 0!==k&&(0!==k&&yj.test(k)?b=parseInt(k):b=0===k||Lf.test(k));k=d.a;var m;l=[];for(h in k)"twoway"!==h&&"lazy"!==h&&k.hasOwnProperty(h)&&(m=new Of({element:this,name:h,value:k[h],root:this.root}),l[h]=m,"value"!==h&&l.push(m));(m=l.value)&& -l.push(m);this.attributes=l;this.conditionalAttributes=Lj(this,d.m);d.f&&(this.fragment=new S({template:d.f,root:c,owner:this,pElement:this,cssIds:null}));h=c.twoway;!1===a?h=!1:!0===a&&(h=!0);this.twoway=h;this.lazy=b;if(h){var n;m=this.attributes;this.binding&&(this.binding.teardown(),this.binding=null);(this.getAttribute("contenteditable")||m.contenteditable&&Ba(m.contenteditable))&&Ba(m.value)?n=Mj:"input"===this.name?(f=this.getAttribute("type"),"radio"===f||"checkbox"===f?(h=Ba(m.name),m=Ba(m.checked), -h&&m&&x("A radio input can have two-way binding on its name attribute, or its checked attribute - not both",{ractive:this.root}),h?n="radio"===f?Oj:Pj:m&&(n="radio"===f?Nj:Qj)):"file"===f&&Ba(m.value)?n=Sj:Ba(m.value)&&(n="number"===f||"range"===f?Tj:Jb)):"select"===this.name&&Ba(m.value)?n=this.getAttribute("multiple")?Rj:Pc:"textarea"===this.name&&Ba(m.value)&&(n=Jb);n=n&&(g=new n(this))&&g.keypath?g:void 0;h=f=n}h&&(this.binding=f,g=this.root._twowayBindings[f.keypath.str]||(this.root._twowayBindings[f.keypath.str]= -[]),g.push(f));if(d.v){g=d.v;var p;m=[];for(p in g)if(g.hasOwnProperty(p))for(f=p.split("-"),n=f.length;n--;)h=new Sf(this,f[n],g[p]),m.push(h);this.eventHandlers=m}d.o&&(this.decorator=new Tf(this,d.o));this.intro=d.t0||d.t1;this.outro=d.t0||d.t2},rebind:function(a,b){function c(d){d.rebind(a,b)}var d,f,g;this.attributes&&this.attributes.forEach(c);this.conditionalAttributes&&this.conditionalAttributes.forEach(c);this.eventHandlers&&this.eventHandlers.forEach(c);this.decorator&&c(this.decorator); -this.fragment&&c(this.fragment);if(g=this.liveQueries)for(d=g.length;d--;)g[d]._makeDirty();this.node&&(f=this.node._ractive)&&jd(f,"keypath",a,b)},render:function(){var a=this,b=this.root,c,d,f;c=vh(this);d=this.node=wa(this.name,c);this.parentFragment.cssIds&&this.node.setAttribute("data-ractive-css",this.parentFragment.cssIds.map(function(a){return"{"+a+"}"}).join(" "));oa(this.node,"_ractive",{value:{proxy:this,keypath:Ce(this.parentFragment),events:O(null),root:b}});this.attributes.forEach(function(a){return a.render(d)}); -this.conditionalAttributes.forEach(function(a){return a.render(d)});this.fragment&&("script"===this.name?(this.bubble=cg,this.node.text=this.fragment.toString(!1),this.fragment.unrender=Y):"style"===this.name?(this.bubble=bg,this.bubble(),this.fragment.unrender=Y):this.binding&&this.getAttribute("contenteditable")?this.fragment.unrender=Y:this.node.appendChild(this.fragment.render()));this.binding&&(this.binding.render(),this.node._ractive.binding=this.binding);this.eventHandlers&&this.eventHandlers.forEach(function(a){return a.render()}); -"option"===this.name&&wh(this);"img"===this.name?th(this):"form"===this.name?this.node.addEventListener("reset",Zd,!1):"input"===this.name||"textarea"===this.name?this.node.defaultValue=this.node.value:"option"===this.name&&(this.node.defaultSelected=this.node.selected);this.decorator&&this.decorator.fn&&w.scheduleTask(function(){a.decorator.torndown||a.decorator.init()},!0);b.transitionsEnabled&&this.intro&&(f=new $c(this,this.intro,!0),w.registerTransition(f),w.scheduleTask(function(){return f.start()}, -!0),this.transition=f);this.node.autofocus&&w.scheduleTask(function(){return a.node.focus()},!0);xh(this);return this.node},toString:function(){var a,b;if(this.template.y)return"";a="<"+this.template.e;a+=this.attributes.map(be).join("")+this.conditionalAttributes.map(be).join("");if(b="option"===this.name)a:{var c,d;b=this.getAttribute("value");if(void 0!==b&&this.select)if(c=this.select.getAttribute("value"),c==b)b=!0;else{if(this.select.getAttribute("multiple")&&g(c))for(d= -c.length;d--;)if(c[d]==b){b=!0;break a}b=void 0}else b=!1}b&&(a+=" selected");if(b="input"===this.name)d=this.attributes,b=d.type,c=d.value,d=d.name,b=b&&"radio"===b.value&&c&&d.interpolator?c.value===d.interpolator.value?!0:void 0:void 0;b&&(a+=" checked");a+=">";"textarea"===this.name&&void 0!==this.getAttribute("value")?a+=Wb(this.getAttribute("value")):void 0!==this.getAttribute("contenteditable")&&(a+=this.getAttribute("value")||"");this.fragment&&(b="script"!==this.name&&"style"!==this.name, -a+=this.fragment.toString(b));Fb.test(this.template.e)||(a+="");return a},unbind:function(){this.fragment&&this.fragment.unbind();this.binding&&this.binding.unbind();this.eventHandlers&&this.eventHandlers.forEach(ha);"option"===this.name&&this.select&&Q(this.select.options,this);this.attributes.forEach(ha);this.conditionalAttributes.forEach(ha)},unrender:function(a){var b,c;(c=this.transition)&&c.complete();"option"===this.name?this.detach():a&&w.detachWhenReady(this);this.fragment&& -this.fragment.unrender(!1);if(a=this.binding)this.binding.unrender(),this.node._ractive.binding=null,b=this.root._twowayBindings[a.keypath.str],b.splice(b.indexOf(a),1);this.eventHandlers&&this.eventHandlers.forEach(I);this.decorator&&w.registerDecorator(this.decorator);this.root.transitionsEnabled&&this.outro&&(c=new $c(this,this.outro,!1),w.registerTransition(c),w.scheduleTask(function(){return c.start()}));this.liveQueries&&yh(this);"form"===this.name&&this.node.removeEventListener("reset",Zd, -!1)}};var Zh=dg,eg=/^\s*$/,Ah=/^\s*/,bk=function(a){var b,c,d;b=a.split("\n");c=b[0];void 0!==c&&eg.test(c)&&b.shift();c=T(b);void 0!==c&&eg.test(c)&&b.pop();(d=b.reduce(zh,null))&&(a=b.map(function(a){return a.replace(d,"")}).join("\n"));return a},ad=function(a,b,c){var d;d=void 0;var f=de(b,(c||{}).owner);f?d=f:(c=U("partials",a,b))?(f=c.partials[b],"function"===typeof f&&(d=f.bind(c),d.isOwner=c.partials.hasOwnProperty(b),f=d.call(a,ia)),f||""===f?(ia.isParsed(f)||(f=ia.parse(f,ia.getParseOptions(c)), -f.p&&x("Partials ({{>%s}}) cannot contain nested inline partials",b,{ractive:a}),(d?c:c.partials.hasOwnProperty(b)?c:ce(c.constructor,b)).partials[b]=f=f.t),d&&(f._fn=d),d=f.v?f.t:f):(x('A function was specified for "%s" %s, but no %s was returned',b,"partial","partial",{ractive:a}),d=void 0)):d=void 0;if(d)return d;if(d=ia.fromId(b,{noThrow:!0}))return d=bk(d),d=ia.parse(d,ia.getParseOptions(a)),a.partials[b]=d.t},ck=function(a,b){return b?a.split("\n").map(function(a,e){return e?b+a:a}).join("\n"): -a},fg=function(a){var b;b=this.parentFragment=a.parentFragment;this.root=b.root;this.type=8;this.index=a.index;this.name=a.template.r;this.rendered=!1;this.fragment=this.fragmentToRender=this.fragmentToUnrender=null;ba.init(this,a);this.keypath||((a=ad(this.root,this.name,b))?(Xa.call(this),this.isNamed=!0,this.setTemplate(a)):J('Could not find template for partial "%s"',this.name))};fg.prototype={bubble:function(){this.parentFragment.bubble()},detach:function(){return this.fragment.detach()},find:function(a){return this.fragment.find(a)}, -findAll:function(a,b){return this.fragment.findAll(a,b)},findComponent:function(a){return this.fragment.findComponent(a)},findAllComponents:function(a,b){return this.fragment.findAllComponents(a,b)},firstNode:function(){return this.fragment.firstNode()},findNextNode:function(){return this.parentFragment.findNextNode(this)},getPartialName:function(){return this.isNamed&&this.name?this.name:void 0===this.value?this.name:this.value},getValue:function(){return this.fragment.getValue()},rebind:function(a, -b){this.isNamed||Df.call(this,a,b);this.fragment&&this.fragment.rebind(a,b)},render:function(){this.docFrag=document.createDocumentFragment();this.update();this.rendered=!0;return this.docFrag},resolve:ba.resolve,setValue:function(a){var b;if(void 0===a||a!==this.value)void 0!==a&&(b=ad(this.root,""+a,this.parentFragment)),!b&&this.name&&(b=ad(this.root,this.name,this.parentFragment))&&(Xa.call(this),this.isNamed=!0),b||J('Could not find template for partial "%s"',this.name,{ractive:this.root}),this.value= -a,this.setTemplate(b||[]),this.bubble(),this.rendered&&w.addView(this)},setTemplate:function(a){this.fragment&&(this.fragment.unbind(),this.rendered&&(this.fragmentToUnrender=this.fragment));this.fragmentToRender=this.fragment=new S({template:a,root:this.root,owner:this,pElement:this.parentFragment.pElement})},toString:function(a){var b,c;a=this.fragment.toString(a);b=this.parentFragment.items[this.index-1];if(!b||1!==b.type)return a;b=b.text.split("\n").pop();return(c=/^\s+$/.exec(b))?ck(a,c[0]): -a},unbind:function(){this.isNamed||Xa.call(this);this.fragment&&this.fragment.unbind()},unrender:function(a){this.rendered&&(this.fragment&&this.fragment.unrender(a),this.rendered=!1)},update:function(){var a,b;this.fragmentToUnrender&&(this.fragmentToUnrender.unrender(!0),this.fragmentToUnrender=null);this.fragmentToRender&&(this.docFrag.appendChild(this.fragmentToRender.render()),this.fragmentToRender=null);this.rendered&&(a=this.parentFragment.getNode(),b=this.parentFragment.findNextNode(this), -a.insertBefore(this.docFrag,b))}};var $h=fg,Xh=ee,dk=new aa("detach"),bd=[],pb="pop push reverse shift sort splice unshift".split(" "),Mb,cd;pb.forEach(function(a){oa(bd,a,{value:function(){for(var b=arguments.length,c=Array(b),d=0;d component has a default `el` property; it has been disregarded",a.name);for(f=l;f;){if(16===f.owner.type){n=f.owner.container;break}f=f.parent}d&&Object.keys(d).forEach(function(b){var c= -d[b],f;if("string"===typeof c)f=Gb(c),q[b]=f?f.value:c;else if(0===c)q[b]=!0;else if(g(c))1===c.length&&2===c[0].t?(r[b]={origin:a.root.viewmodel,keypath:void 0},c=Ph(a,c[0],function(a){a.isSpecial?w?k.set(b,a.value):(q[b]=a.value,delete r[b]):w?k.viewmodel.mappings[b].resolve(a):r[b].keypath=a})):c=new oe(a,c,function(a){w?k.set(b,a):q[b]=a}),I.push(c);else throw Error("erm wut");});k=O(b.prototype);oc(k,{el:null,append:!0,data:q,partials:h,magic:m.magic||b.defaults.magic,modifyArrays:m.modifyArrays, -adapt:m.adapt},{parent:m,component:a,container:n,mappings:r,inlinePartials:p,cssIds:l.cssIds});w=!0;a.resolvers=I;return k},nk=new aa("teardown"),pg=function(a,b){this.init(a,b)};pg.prototype={detach:function(){var a=this.instance.fragment.detach();dk.fire(this.instance);return a},find:function(a){return this.instance.fragment.find(a)},findAll:function(a,b){return this.instance.fragment.findAll(a,b)},findAllComponents:function(a,b){b._test(this,!0);this.instance.fragment&&this.instance.fragment.findAllComponents(a, -b)},findComponent:function(a){return a&&a!==this.name?this.instance.fragment?this.instance.fragment.findComponent(a):null:this.instance},findNextNode:function(){return this.parentFragment.findNextNode(this)},firstNode:function(){return this.rendered?this.instance.fragment.firstNode():null},init:function(a,b){if(!b)throw Error('Component "'+this.name+'" not found');this.root=(this.parentFragment=a.parentFragment).root;this.type=15;this.name=a.template.e;this.index=a.index;this.indexRefBindings={}; -this.yielders={};this.resolvers=[];mk(this,b,a.template.a,a.template.f,a.template.p);var c=a.template.v,d;for(d in c)c.hasOwnProperty(d)&&Qh(this.instance,this.root,d,c[d]);(a.template.t0||a.template.t1||a.template.t2||a.template.o)&&x('The "intro", "outro" and "decorator" directives have no effect on components',{ractive:this.instance});for(var f,c=this.root;c;)(f=c._liveComponentQueries["_"+this.name])&&f.push(this.instance),c=c.parent},rebind:function(a,b){function c(d){d.rebind(a,b)}var d;this.resolvers.forEach(c); -for(var f in this.yielders)this.yielders[f][0]&&c(this.yielders[f][0]);(d=this.root._liveComponentQueries["_"+this.name])&&d._makeDirty()},render:function(){var a=this.instance;a.render(this.parentFragment.getNode());this.rendered=!0;return a.fragment.detach()},toString:function(){return this.instance.fragment.toString()},unbind:function(){var a=this.instance;this.resolvers.forEach(ha);var b,c;b=this.root;do(c=b._liveComponentQueries["_"+this.name])&&c._remove(this);while(b=b.parent);a._observers.forEach(Da); -a.fragment.unbind();a.viewmodel.teardown();a.fragment.rendered&&a.el.__ractive_instances__&&Q(a.el.__ractive_instances__,a);nk.fire(a)},unrender:function(a){this.shouldDestroy=a;this.instance.unrender()}};var Yh=pg,qg=function(a){this.type=9;this.value=a.template.c};qg.prototype={detach:Jc,firstNode:function(){return this.node},render:function(){this.node||(this.node=document.createComment(this.value));return this.node},toString:function(){return"\x3c!--"+this.value+"--\x3e"},unrender:function(a){a&& -this.node.parentNode.removeChild(this.node)}};var ai=qg,rg=function(a){var b,c;this.type=16;this.container=b=a.parentFragment.root;this.component=c=b.component;this.container=b;this.containerFragment=a.parentFragment;this.parentFragment=c.parentFragment;var d=this.name=a.template.n||"",f=b._inlinePartials[d];f||(x('Could not find template for partial "'+d+'"',{ractive:a.root}),f=[]);this.fragment=new S({owner:this,root:b.parent,template:f,pElement:this.containerFragment.pElement});g(c.yielders[d])? -c.yielders[d].push(this):c.yielders[d]=[this];w.scheduleTask(function(){if(1"}};var bi=sg,tg=function(a){this.init(a)};tg.prototype={bubble:function(){this.dirtyValue=this.dirtyArgs=!0;this.bound&&"function"===typeof this.owner.bubble&&this.owner.bubble()},detach:function(){var a;if(1===this.items.length)return this.items[0].detach();a=document.createDocumentFragment();this.items.forEach(function(b){(b=b.detach())&&a.appendChild(b)});return a},find:function(a){var b, -c,d,f;if(this.items){c=this.items.length;for(b=0;b(a/=.5)?.5*Math.pow(a,3):.5*(Math.pow(a-2,3)+2)}}},events:{writable:!0,value:{}},interpolators:{writable:!0,value:Db},partials:{writable:!0, -value:{}},transitions:{writable:!0,value:{}}});ta.prototype=c(yk,te);ta.prototype.constructor=ta;ta.defaults=ta.prototype;if("function"!==typeof Date.now||"function"!==typeof String.prototype.trim||"function"!==typeof Object.keys||"function"!==typeof Array.prototype.indexOf||"function"!==typeof Array.prototype.forEach||"function"!==typeof Array.prototype.map||"function"!==typeof Array.prototype.filter||"undefined"!==typeof window&&"function"!==typeof window.addEventListener)throw Error("It looks like you're attempting to use Ractive.js in an older browser. You'll need to use one of the 'legacy builds' in order to continue - see http://docs.ractivejs.org/latest/legacy-builds for more information."); -var za=ta;return za});(function(b,a){"object"===typeof exports&&"undefined"!==typeof module?module.exports=a():"function"===typeof define&&define.amd?define(a):b.Ractive.events.tap=a()})(this,function(){function b(a,b){this.node=a;this.callback=b;this.preventMousedownEvents=!1;this.bind(a)}function a(a){this.__tap_handler__.mousedown(a)}function d(a){this.__tap_handler__.touchdown(a)}function c(){this.addEventListener("keydown",g,!1);this.addEventListener("blur",f,!1)}function f(){this.removeEventListener("keydown",g, -!1);this.removeEventListener("blur",f,!1)}function g(a){32===a.which&&this.__tap_handler__.fire()}b.prototype={bind:function(b){window.navigator.pointerEnabled?b.addEventListener("pointerdown",a,!1):window.navigator.msPointerEnabled?b.addEventListener("MSPointerDown",a,!1):b.addEventListener("mousedown",a,!1);b.addEventListener("touchstart",d,!1);"BUTTON"!==b.tagName&&"button"!==b.type||b.addEventListener("focus",c,!1);b.__tap_handler__=this},fire:function(a,b,c){this.callback({node:this.node,original:a, -x:b,y:c})},mousedown:function(a){var b=this;if(!this.preventMousedownEvents&&(void 0===a.which||1===a.which)){var c=a.clientX,d=a.clientY,f=a.pointerId,g=function(a){a.pointerId==f&&(b.fire(a,c,d),r())},q=function(a){a.pointerId==f&&(5<=Math.abs(a.clientX-c)||5<=Math.abs(a.clientY-d))&&r()},r=function J(){b.node.removeEventListener("MSPointerUp",g,!1);document.removeEventListener("MSPointerMove",q,!1);document.removeEventListener("MSPointerCancel",J,!1);b.node.removeEventListener("pointerup",g,!1); -document.removeEventListener("pointermove",q,!1);document.removeEventListener("pointercancel",J,!1);b.node.removeEventListener("click",g,!1);document.removeEventListener("mousemove",q,!1)};window.navigator.pointerEnabled?(this.node.addEventListener("pointerup",g,!1),document.addEventListener("pointermove",q,!1),document.addEventListener("pointercancel",r,!1)):window.navigator.msPointerEnabled?(this.node.addEventListener("MSPointerUp",g,!1),document.addEventListener("MSPointerMove",q,!1),document.addEventListener("MSPointerCancel", -r,!1)):(this.node.addEventListener("click",g,!1),document.addEventListener("mousemove",q,!1));setTimeout(r,400)}},touchdown:function(){var a=this,b=event.touches[0],c=b.clientX,d=b.clientY,f=b.identifier,g=function(b){b.changedTouches[0].identifier===f&&(b.preventDefault(),a.preventMousedownEvents=!0,clearTimeout(a.preventMousedownTimeout),a.preventMousedownTimeout=setTimeout(function(){a.preventMousedownEvents=!1},400),a.fire(b,c,d));r()},q=function(a){1===a.touches.length&&a.touches[0].identifier=== -f||r();a=a.touches[0];(5<=Math.abs(a.clientX-c)||5<=Math.abs(a.clientY-d))&&r()},r=function J(){a.node.removeEventListener("touchend",g,!1);window.removeEventListener("touchmove",q,!1);window.removeEventListener("touchcancel",J,!1)};this.node.addEventListener("touchend",g,!1);window.addEventListener("touchmove",q,!1);window.addEventListener("touchcancel",r,!1);setTimeout(r,400)},teardown:function(){var b=this.node;b.removeEventListener("pointerdown",a,!1);b.removeEventListener("MSPointerDown",a,!1); -b.removeEventListener("mousedown",a,!1);b.removeEventListener("touchstart",d,!1);b.removeEventListener("focus",c,!1)}};return function(a,c){return new b(a,c)}});(function(b,a){"object"===typeof exports&&"undefined"!==typeof module?a(exports):"function"===typeof define&&define.amd?define(["exports"],a):a(b.Ractive.events)})(this,function(b){function a(a,b){return function(c,d){function f(g){function h(){g.preventDefault();d({node:c,original:g})}(g.which||g.keyCode)===a&&(b?g[b]&&h():h())}c.addEventListener("keydown",f,!1);return{teardown:function(){c.removeEventListener("keydown",f,!1)}}}}var d=a(13),c=a(9),f=a(27),g=a(32),h=a(37),k=a(39),l=a(40),n=a(38), -m=a(13,"ctrlKey");b.enter=d;b.ctrlenter=m;b.tab=c;b.escape=f;b.space=g;b.leftarrow=h;b.rightarrow=k;b.downarrow=l;b.uparrow=n});(function(b,a){"function"===typeof define&&define.amd?define([],a):"object"===typeof exports?module.exports=a():b.Autolinker=a()})(this,function(){var b=function(a){a=a||{};this.version=b.version;this.urls=this.normalizeUrlsCfg(a.urls);this.email="boolean"===typeof a.email?a.email:!0;this.twitter="boolean"===typeof a.twitter?a.twitter:!0;this.phone="boolean"===typeof a.phone?a.phone:!0;this.hashtag=a.hashtag||!1;this.newWindow="boolean"===typeof a.newWindow?a.newWindow:!0;this.stripPrefix="boolean"=== -typeof a.stripPrefix?a.stripPrefix:!0;var d=this.hashtag;if(!1!==d&&"twitter"!==d&&"facebook"!==d&&"instagram"!==d)throw Error("invalid `hashtag` cfg - see docs");this.truncate=this.normalizeTruncateCfg(a.truncate);this.className=a.className||"";this.replaceFn=a.replaceFn||null;this.tagBuilder=this.matchers=this.htmlParser=null};b.link=function(a,d){return(new b(d)).link(a)};b.version="0.26.0";b.prototype={constructor:b,normalizeUrlsCfg:function(a){null==a&&(a=!0);return"boolean"===typeof a?{schemeMatches:a, -wwwMatches:a,tldMatches:a}:{schemeMatches:"boolean"===typeof a.schemeMatches?a.schemeMatches:!0,wwwMatches:"boolean"===typeof a.wwwMatches?a.wwwMatches:!0,tldMatches:"boolean"===typeof a.tldMatches?a.tldMatches:!0}},normalizeTruncateCfg:function(a){return"number"===typeof a?{length:a,location:"end"}:b.Util.defaults(a||{},{length:Number.POSITIVE_INFINITY,location:"end"})},parse:function(a){a=this.getHtmlParser().parse(a);for(var b=0,c=[],f=0,g=a.length;fb&&(c=null==c?"..":c,a=a.substring(0,b-c.length)+c);return a},indexOf:function(a,b){if(Array.prototype.indexOf)return a.indexOf(b); -for(var c=0,f=a.length;c/g,Gh=/&/g,Yb=65533,Jh=/^(?:[+-]?)0*(?:(?:(?:[1-9]\d*)?\.\d+)|(?:(?:0|[1-9]\d*)\.)|(?:0|[1-9]\d*))(?:[eE][+-]?\d+)?/, +He,Ie,Je;He=/^(?=.)[^"'\\]+?(?:(?!.)|(?=["'\\]))/;Ie=/^\\(?:['"\\bfnrt]|0(?![0-9])|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|(?=.)[^ux0-9])/;Je=/^\\(?:\r\n|[\u000A\u000D\u2028\u2029])/;var Lh=Ge('"'),Kh=Ge("'"),Uc=/^[a-zA-Z_$][a-zA-Z_$0-9]*/,Mh=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/,Rh=/^(?:~\/|(?:\.\.\/)+|\.\/(?:\.\.\/)*|\.)/,Xc,Me;Xc=/^(?:Array|console|Date|RegExp|decodeURIComponent|decodeURI|encodeURIComponent|encodeURI|isFinite|isNaN|parseFloat|parseInt|JSON|Math|NaN|undefined|null|Object|Number|String|Boolean)\b/; +Me=/^(?:break|case|catch|continue|debugger|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|void|while|with)$/;var Th=/^(?:[a-zA-Z$_0-9]|\\\.)+(?:(?:\.(?:[a-zA-Z$_0-9]|\\\.)+)|(?:\[[0-9]+\]))*/,Sh=/^[a-zA-Z_$][-\/a-zA-Z_$0-9]*/,Oh=/^@(?:keypath|rootpath|index|key|this|global)/,Ph=/^\s*\(/,Qh=/^\s*\.{3}/,Sf,Tf;Tf=function(a,b){return function(f){var c;if(c=b(f))return c;if(!f.matchString(a))return null;f.allowWhitespace();(c=ia(f))||f.error("Expected a JavaScript expression"); +return{s:a,o:c,t:33}}};(function(){var a,b,f,c;c=["!","~","+","-","typeof"];f=Uh;a=0;for(b=c.length;a\/=]+/,gi=/^on/,ei=/^on-([a-zA-Z\\*\\.$_][a-zA-Z\\*\\.$_0-9\-]+)$/,fi=/^(?:change|reset|teardown|update|construct|config|init|render|unrender|detach|insert)$/, +ci=/^as-([a-z-A-Z][-a-zA-Z_0-9]*)$/,di=/^([a-zA-Z](?:(?!-in-out)[-a-zA-Z_0-9])*)-(in|out|in-out)$/,bi={"intro-outro":{t:72,v:"t0"},intro:{t:72,v:"t1"},outro:{t:72,v:"t2"},lazy:{t:73,v:"l"},twoway:{t:73,v:"t"},decorator:{t:71}},Zh=/^[^\s"'=<>\/`]+/,hi={t:10,exclude:!0},ji=/^(?:[a-zA-Z$_0-9]|\\\.)+(?:(?:(?:[a-zA-Z$_0-9]|\\\.)+)|(?:\[[0-9]+\]))*/,ii=/^as/i,lk=/^yield\s*/,oi=/^\s*else\s*/,ni=/^\s*elseif\s+/,Ue={each:52,"if":50,"with":54,unless:51},li=/^\s*:\s*([a-zA-Z_$][a-zA-Z_$0-9]*)/,mi=/^\s*,\s*([a-zA-Z_$][a-zA-Z_$0-9]*)/, +ki=new RegExp("^("+Object.keys(Ue).join("|")+")\\b"),kb=/^[ \t\f\r\n]*\r?\n/,jb=/\r?\n[ \t\f\r\n]*$/,ti=/[ \t\f\r\n]+/g,qi=/^(?:pre|script|style|textarea)$/i,We=/^[ \t\f\r\n]+/,Xe=/[ \t\f\r\n]+$/,ri=/^(?:\r\n|\r|\n)/,si=/(?:\r\n|\r|\n)$/,vi=/^([a-zA-Z]{1,}:?[a-zA-Z0-9\-]*)\s*\>/,mk=/^[a-zA-Z]{1,}:?[a-zA-Z0-9\-]*/,nk=/^[\s\n\/>]/,ok={exclude:!0},Ye;Ye={li:["li"],dt:["dt","dd"],dd:["dt","dd"],p:"address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul".split(" "), +rt:["rt","rp"],rp:["rt","rp"],optgroup:["optgroup"],option:["option","optgroup"],thead:["tbody","tfoot"],tbody:["tbody","tfoot"],tfoot:["tbody"],tr:["tr","tbody"],td:["td","th","tr"],th:["td","th","tr"]};var pk=/^\x3c!--\s*/,qk=/s*>\s*([a-zA-Z_$][-a-zA-Z_$0-9]*)\s*/,rk=/\s*--\x3e/,sk=/^\s*#\s*partial\s+/,tk=[function(a,b){if(!a.matchString(">"))return null;a.allowWhitespace();a.relaxedNames=a.strictRefinement=!0;var f=ia(a);a.relaxedNames=a.strictRefinement=!1;if(!f)return null;var c={t:8};Fa(f,c); +a.allowWhitespace();if(f=Re(a))c={t:19,z:f,f:[c]};else if(f=ia(a))c={t:4,n:53,f:[c]},Fa(f,c);a.allowWhitespace();a.matchString(b.close)||a.error("Expected closing delimiter '"+b.close+"'");return c},Qe,Te,function(a,b){if(!a.matchPattern(lk))return null;var f=a.matchPattern(/^[a-zA-Z_$][a-zA-Z_$0-9\-]*/);a.allowWhitespace();a.matchString(b.close)||a.error("expected legal partial name");var c={t:16};f&&(c.n=f);return c},Se,function(a,b){var f;if(!a.matchString("!"))return null;f=a.remaining().indexOf(b.close); +if(-1!==f)return a.pos+=f+b.close.length,{t:9}}],Xf=[function(a,b){var f=ia(a),c;if(!f)return null;a.matchString(b.close)||a.error("Expected closing delimiter '"+b.close+"'");c={t:3};Fa(f,c);return c}],uk=[Qe,Te,Se],$e;lb.computedStrings=function(a){if(!a)return[];Object.keys(a).forEach(function(b){var f=a[b];"string"===typeof f&&(a[b]=Oc(f))})};var yb=[hb,function(a){var b,f,c;b=a.pos;if(a.textOnlyMode||!a.matchString("\x3c!--"))return null;f=a.remaining();c=f.indexOf("--\x3e");-1===c&&a.error("Illegal HTML - expected closing comment sequence ('--\x3e')"); +f=f.substr(0,c);a.pos+=c+3;c={t:9,c:f};a.includeLinePositions&&(c.p=a.getLinePos(b));return c},function(a){var b,f,c,e,g,h,k,l;b=a.pos;if(a.inside||a.inAttribute||a.textOnlyMode||!a.matchString("<")||"/"===a.nextChar())return null;f={};a.includeLinePositions&&(f.p=a.getLinePos(b));if(a.matchString("!"))return f.t=18,a.matchPattern(/^doctype/i)||a.error("Expected DOCTYPE declaration"),f.a=a.matchPattern(/^(.+?)>/),f;f.t=7;f.e=a.matchPattern(mk);if(!f.e)return null;nk.test(a.nextChar())||a.error("Illegal tag name"); +a.allowWhitespace();for(a.inTag=!0;b=hb(a);)!1!==b&&(f.m||(f.m=[]),f.m.push(b)),a.allowWhitespace();a.inTag=!1;a.allowWhitespace();a.matchString("/")&&(c=!0);if(!a.matchString(">"))return null;b=f.e.toLowerCase();var m=a.preserveWhitespace;if(!c&&!vd.test(f.e)){a.elementStack.push(b);if("script"===b||"style"===b||"textarea"===b)a.inside=b;c=[];e=ra(null);do l=a.pos,(h=a.remaining())||a.error("Missing end "+(1"}).join("")+")"),wi(b,h)?(h=ui(a))?(k=!0,h=h.e.toLowerCase(),h!==b&&(a.pos=l,~a.elementStack.indexOf(h)||(l="Unexpected closing tag",vd.test(h)&&(l+=" (<"+h+"> is a void element - it cannot contain children)"),a.error(l)))):(h=$c(a,{open:a.standardDelimiters[0],close:a.standardDelimiters[1]}))?(k=!0,a.pos=l):(h=a.read(Yf))?(e[h.n]&&(a.pos=l,a.error("Duplicate partial definition")),Ga(h.f,a.stripComments,m,!m,!m),e[h.n]=h.f,g=!0):(h=a.read(yb))?c.push(h):k=!0:k=!0;while(!k);c.length&&(f.f=c); +g&&(f.p=e);a.elementStack.pop()}a.inside=null;return a.sanitizeElements&&-1!==a.sanitizeElements.indexOf(b)?ok:f},function(a){var b,f,c;f=a.remaining();a.textOnlyMode?(b=a.tags.map(function(a){return a.open}),b=b.concat(a.tags.map(function(a){return"\\"+a.open})),b=Xb(f,b)):(c=a.inside?"","`"): +a.inAttribute?b.push(a.inAttribute):b.push(c),b=Xb(f,b)));if(!b)return null;-1===b&&(b=f.length);a.pos+=b;return a.inside&&"textarea"!==a.inside||a.textOnlyMode?f.substr(0,b):Rc(f.substr(0,b))}],Yf=[function(a){var b=a.pos,f=a.standardDelimiters[0],c=a.standardDelimiters[1];if(!a.matchPattern(pk)||!a.matchString(f))return a.pos=b,null;var e=a.matchPattern(qk);Y("Inline partial comments are deprecated.\nUse this...\n {{#partial "+e+"}} ... {{/partial}}\n\n...instead of this:\n \x3c!-- {{>"+e+"}} --\x3e ... \x3c!-- {{/"+ +e+"}} --\x3e'");if(!a.matchString(c)||!a.matchPattern(rk))return a.pos=b,null;var b=[],g,h=new RegExp("^\x3c!--\\s*"+Qc(f)+"\\s*\\/\\s*"+e+"\\s*"+Qc(c)+"\\s*--\x3e");do if(a.matchPattern(h))g=!0;else{var k=a.read(yb);k||a.error("expected closing comment ('\x3c!-- "+f+"/"+e+""+c+" --\x3e')");b.push(k)}while(!g);return{t:17,f:b,n:e}},function(a){var b,f,c,e;b=a.pos;var g=a.standardDelimiters;if(!a.matchString(g[0]))return null;if(!a.matchPattern(sk))return a.pos=b,null;(b=a.matchPattern(/^[a-zA-Z_$][a-zA-Z_$0-9\-\/]*/))|| +a.error("expected legal partial name");a.allowWhitespace();a.matchString(g[1])||a.error("Expected closing delimiter '"+g[1]+"'");f=[];do $c(a,{open:a.standardDelimiters[0],close:a.standardDelimiters[1]})?e=!0:((c=a.read(yb))||a.error("Expected "+g[0]+"/partial"+g[1]),f.push(c));while(!e);return{t:17,n:b,f:f}}];$e=Ua.extend({init:function(a,b){var f=b.tripleDelimiters||["{{{","}}}"],c=b.staticDelimiters||["[[","]]"],e=b.staticTripleDelimiters||["[[[","]]]"];this.standardDelimiters=b.delimiters||["{{", +"}}"];this.tags=[{isStatic:!1,isTriple:!1,open:this.standardDelimiters[0],close:this.standardDelimiters[1],readers:tk},{isStatic:!1,isTriple:!0,open:f[0],close:f[1],readers:Xf},{isStatic:!0,isTriple:!1,open:c[0],close:c[1],readers:uk},{isStatic:!0,isTriple:!0,open:e[0],close:e[1],readers:Xf}];this.contextLines=b.contextLines||0;this.sortMustacheTags();this.sectionDepth=0;this.elementStack=[];this.interpolate={script:!b.interpolate||!1!==b.interpolate.script,style:!b.interpolate||!1!==b.interpolate.style, +textarea:!0};!0===b.sanitize&&(b.sanitize={elements:"applet base basefont body frame frameset head html isindex link meta noframes noscript object param script style title".split(" "),eventAttributes:!0});this.stripComments=!1!==b.stripComments;this.preserveWhitespace=b.preserveWhitespace;this.sanitizeElements=b.sanitize&&b.sanitize.elements;this.sanitizeEventAttributes=b.sanitize&&b.sanitize.eventAttributes;this.includeLinePositions=b.includeLinePositions;this.textOnlyMode=b.textOnlyMode;this.csp= +b.csp},postProcess:function(a){if(!a.length)return{t:[],v:4};0 element");}return"textContent"in f?f.textContent:f.innerHTML},isParsed:function(a){return"string"!== +typeof a},getParseOptions:function(a){a.defaults&&(a=a.defaults);return vk.reduce(function(b,f){b[f]=a[f];return b},{})},parse:function(a,b){Pc(lb,"template",ye);var f=lb(a,b);ze(f);return f},parseFor:function(a,b){return this.parse(a,this.getParseOptions(b))}},bd={name:"template",extend:function(a,b,f){"template"in f&&(a=f.template,b.template="function"===typeof a?a:ad(a,b))},init:function(a,b,f){a=(a="template"in f?f.template:a.prototype.template)||{v:4,t:[]};"function"===typeof a&&(f=a,a=bf(b, +f),b._config.template={fn:f,result:a});a=ad(a,b);b.template=a.t;a.p&&cf(b.partials,a.p)},reset:function(a){var b;if((b=a._config.template)&&b.fn){var f=bf(a,b.fn);b=f!==b.result?b.result=f:void 0}else b=void 0;if(b)return b=ad(b,a),a.template=b.t,cf(a.partials,b.p,!0),!0}},Hb=function(a,b){this.name=a;this.useDefaults=b};Hb.prototype.extend=function(a,b,f){this.configure(this.useDefaults?a.defaults:a,this.useDefaults?b:b.constructor,f)};Hb.prototype.init=function(){};Hb.prototype.configure=function(a, +b,f){var c=this.name;f=f[c];a=ra(a[c]);for(var e in f)a[e]=f[e];b[c]=a};Hb.prototype.reset=function(a){var b=a[this.name],f=!1;Object.keys(b).forEach(function(a){var d=b[a];d._fn&&(d._fn.isOwner?b[a]=d._fn:delete b[a],f=!0)});return f};var Ab="adaptors components computed decorators easing events interpolators partials transitions".split(" ").map(function(a){return new Hb(a,"computed"===a)}),mc={adapt:ff,css:gf,data:cc,template:bd},wd=Object.keys(If),Bi=hf(wd.filter(function(a){return!mc[a]})),Di= +hf(wd.concat(Ab.map(function(a){return a.name}))),Zf=[].concat(wd.filter(function(a){return!Ab[a]&&!mc[a]}),Ab,mc.template,mc.css),id={extend:function(a,b,f){return ef("extend",a,b,f)},init:function(a,b,f){return ef("init",a,b,f)},reset:function(a){return Zf.filter(function(b){return b.reset&&b.reset(a)}).map(function(a){return a.name})},order:Zf},wk=["template","partials","components","decorators","events"],xk=new ca("complete"),yk=new ca("reset"),zk=new ca("render"),Ak=new ca("unrender"),X=function(a){this.parentFragment= +a.parentFragment;this.ractive=a.parentFragment.ractive;this.template=a.template;this.index=a.index;this.type=a.template.t;this.dirty=!1};X.prototype.bubble=function(){this.dirty||(this.dirty=!0,this.parentFragment.bubble())};X.prototype.destroyed=function(){this.fragment&&this.fragment.destroyed()};X.prototype.find=function(){return null};X.prototype.findAll=function(){};X.prototype.findComponent=function(){return null};X.prototype.findAllComponents=function(){};X.prototype.findNextNode=function(){return this.parentFragment.findNextNode(this)}; +X.prototype.shuffled=function(){this.fragment&&this.fragment.shuffled()};X.prototype.valueOf=function(){return this.toString()};var $f=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.get=function(a){a&&Oa(this);return(a=this.parent.get())?a[this.key]:void 0};b.prototype.handleChange=function(){this.dirty=!0;this.links.forEach(bb);this.deps.forEach(aa);this.children.forEach(aa);this.clearUnresolveds()};b.prototype.joinKey= +function(a){if(void 0===a||""===a)return this;if(!this.childByKey.hasOwnProperty(a)){var d=new b(this,a);this.children.push(d);this.childByKey[a]=d}return this.childByKey[a]};return b}(Ta),jf=function(a){function b(f,c){var e=this;a.call(this,f.ractive.viewmodel,null);this.fragment=f;this.template=c;this.dirty=this.isReadonly=!0;this.fn=Wb(c.s,c.r.length);this.resolvers=[];this.models=this.template.r.map(function(a,b){var d=pa(e.fragment,a);d||Fi(e,a,b);return d});this.dependencies=[];this.shuffle= +void 0;this.bubble()}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bubble=function(a){void 0===a&&(a=!0);this.registered&&delete this.root.expressions[this.keypath];this.keypath=void 0;a&&(this.dirty=!0,this.handleChange())};b.prototype.get=function(a){a&&Oa(this);this.dirty&&(this.dirty=!1,this.value=this.getValue(),this.wrapper&&(this.newWrapperValue=this.value),this.adapt());return a&&this.wrapper?this.wrapperValue:this.value};b.prototype.getKeypath=function(){var a= +this;if(!this.template)return"@undefined";this.keypath||(this.keypath="@"+this.template.s.replace(/_(\d+)/g,function(b,d){if(d>=a.models.length)return b;var c=a.models[d];return c?c.getKeypath():"@undefined"}),this.root.expressions[this.keypath]=this,this.registered=!0);return this.keypath};b.prototype.getValue=function(){var a=this;sb.push(tb=[]);var b;try{var d=this.models.map(function(a){return a?a.get(!0):void 0});b=this.fn.apply(this.fragment.ractive,d)}catch(c){P("Failed to compute "+this.getKeypath()+ +": "+(c.message||c))}var e=Od();this.dependencies.filter(function(a){return!~e.indexOf(a)}).forEach(function(b){b.unregister(a);M(a.dependencies,b)});e.filter(function(b){return!~a.dependencies.indexOf(b)}).forEach(function(b){b.register(a);a.dependencies.push(b)});return b};b.prototype.handleChange=function(){this.dirty=!0;this.links.forEach(bb);this.deps.forEach(aa);this.children.forEach(aa);this.clearUnresolveds()};b.prototype.joinKey=function(a){if(void 0===a||""===a)return this;if(!this.childByKey.hasOwnProperty(a)){var b= +new $f(this,a);this.children.push(b);this.childByKey[a]=b}return this.childByKey[a]};b.prototype.mark=function(){this.handleChange()};b.prototype.rebinding=function(a,b,d){var c=this.models.indexOf(b);~c&&(a=Pa(this.template.r[c],a,b),a!==b&&(b.unregister(this),this.models.splice(c,1,a),a&&a.addShuffleRegister(this,"mark")));this.bubble(!d)};b.prototype.retrieve=function(){return this.get()};b.prototype.teardown=function(){var b=this;this.unbind();this.fragment=void 0;this.dependencies&&this.dependencies.forEach(function(a){return a.unregister(b)}); +a.prototype.teardown.call(this)};b.prototype.unregister=function(b){a.prototype.unregister.call(this,b);this.deps.length||this.teardown()};b.prototype.unbind=function(){this.resolvers.forEach(Ea)};return b}(Ta),Bk=function(a){function b(f,c){a.call(this,f,c)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.applyValue=function(a){if(!p(a,this.value))for(var b=this.parent,d=[this.key];b;){if(b.base){b.model.joinAll(d).applyValue(a);break}d.unshift(b.key);b=b.parent}}; +b.prototype.joinKey=function(a){if(void 0===a||""===a)return this;if(!this.childByKey.hasOwnProperty(a)){var d=new b(this,a);this.children.push(d);this.childByKey[a]=d}return this.childByKey[a]};b.prototype.retrieve=function(){var a=this.parent.get();return a&&this.key in a?a[this.key]:void 0};return b}(Ta),Gi=function(a){function b(f,c){var e=this;a.call(this,null,null);this.dirty=!0;this.root=f.ractive.viewmodel;this.template=c;this.resolvers=[];this.base=bc(f,c);var q;this.base||(q=f.resolve(c.r, +function(a){e.base=a;e.bubble();M(e.resolvers,q)}),this.resolvers.push(q));var g=this.intermediary={handleChange:function(){return e.handleChange()},rebinding:function(a,b){if(b===e.base)a=Pa(c,a,b),a!==e.base&&(e.base.unregister(g),e.base=a);else{var d=e.members.indexOf(b);~d&&(a=Pa(c.m[d].n,a,b),a!==e.members[d]&&e.members.splice(d,1,a))}a!==b&&b.unregister(g);a&&a.addShuffleTask(function(){return a.register(g)});e.bubble()}};this.members=c.m.map(function(a,b){if("string"===typeof a)return{get:function(){return a}}; +var d,c;if(30===a.t)return(d=pa(f,a.n))?d.register(g):(c=f.resolve(a.n,function(a){e.members[b]=a;a.register(g);e.handleChange();M(e.resolvers,c)}),e.resolvers.push(c)),d;d=new jf(f,a);d.register(g);return d});this.isUnresolved=!0;this.bubble()}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bubble=function(){this.base&&(this.dirty||this.handleChange())};b.prototype.forceResolution=function(){this.resolvers.forEach(function(a){return a.forceResolution()});this.dirty= +!0;this.bubble()};b.prototype.get=function(a){if(this.dirty){this.bubble();for(var b=this.members.length,d=!0;d&&b--;)this.members[b]||(d=!1);this.base&&d&&(b=this.members.map(function(a){return xa(String(a.get()))}),b=this.base.joinAll(b),b!==this.model&&(this.model&&(this.model.unregister(this),this.model.unregisterTwowayBinding(this)),this.model=b,this.parent=b.parent,this.model.register(this),this.model.registerTwowayBinding(this),this.keypathModel&&this.keypathModel.handleChange()));this.value= +this.model?this.model.get(a):void 0;this.dirty=!1;this.mark();return this.value}return this.model?this.model.get(a):void 0};b.prototype.getValue=function(){this.value=this.model?this.model.get():void 0;for(var a=this.bindings.length;a--;){var b=this.bindings[a].getValue();if(b!==this.value)return b}return(a=Zd(this.deps))?a.value:this.value};b.prototype.getKeypath=function(){return this.model?this.model.getKeypath():"@undefined"};b.prototype.handleChange=function(){this.dirty=!0;this.mark()};b.prototype.joinKey= +function(a){if(void 0===a||""===a)return this;if(!this.childByKey.hasOwnProperty(a)){var b=new Bk(this,a);this.children.push(b);this.childByKey[a]=b}return this.childByKey[a]};b.prototype.mark=function(){this.dirty&&this.deps.forEach(aa);this.links.forEach(bb);this.children.forEach(Pb);this.clearUnresolveds()};b.prototype.retrieve=function(){return this.value};b.prototype.rebinding=function(){};b.prototype.set=function(a){if(!this.model)throw Error("Unresolved reference expression. This should not happen!"); +this.model.set(a)};b.prototype.unbind=function(){this.resolvers.forEach(Ea);this.model&&(this.model.unregister(this),this.model.unregisterTwowayBinding(this))};return b}(Ta),Ck=function(a){function c(b){a.call(this,b);this.fragment=null}c.prototype=Object.create(a&&a.prototype);c.prototype.constructor=c;c.prototype.bind=function(){kf(this);this.fragment=(new K({owner:this,template:this.template.f})).bind()};c.prototype.detach=function(){return this.fragment?this.fragment.detach():b()};c.prototype.find= +function(a){if(this.fragment)return this.fragment.find(a)};c.prototype.findAll=function(a,b){this.fragment&&this.fragment.findAll(a,b)};c.prototype.findComponent=function(a){if(this.fragment)return this.fragment.findComponent(a)};c.prototype.findAllComponents=function(a,b){this.fragment&&this.fragment.findAllComponents(a,b)};c.prototype.firstNode=function(a){return this.fragment&&this.fragment.firstNode(a)};c.prototype.rebinding=function(){var a=this;this.locked||(this.locked=!0,I.scheduleTask(function(){a.locked= +!1;kf(a)}))};c.prototype.render=function(a){this.rendered=!0;this.fragment&&this.fragment.render(a)};c.prototype.toString=function(a){return this.fragment?this.fragment.toString(a):""};c.prototype.unbind=function(){this.aliases={};this.fragment&&this.fragment.unbind()};c.prototype.unrender=function(a){this.rendered&&this.fragment&&this.fragment.unrender(a);this.rendered=!1};c.prototype.update=function(){this.dirty&&(this.dirty=!1,this.fragment.update())};return c}(X),Li=/\s+/,Ji=/\/\*(?:[\s\S]*?)\*\//g, +Ii=/url\(\s*(['"])(?:\\[\s\S]|(?!\1).)*\1\s*\)|url\((?:\\[\s\S]|[^)])*\)|(['"])(?:\\[\s\S]|(?!\1).)*\2/gi,Ki=/\0(\d+)/g,Si=[void 0,"text","search","url","email","hidden","password","search","reset","submit"],Dk={"accept-charset":"acceptCharset",accesskey:"accessKey",bgcolor:"bgColor","class":"className",codebase:"codeBase",colspan:"colSpan",contenteditable:"contentEditable",datetime:"dateTime",dirname:"dirName","for":"htmlFor","http-equiv":"httpEquiv",ismap:"isMap",maxlength:"maxLength",novalidate:"noValidate", +pubdate:"pubDate",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"},Df=function(a){function b(f){a.call(this,f);this.name=f.template.n;this.namespace=null;this.owner=f.owner||f.parentFragment.owner||f.element||ja(f.parentFragment);this.element=f.element||(this.owner.attributeByName?this.owner:ja(f.parentFragment));this.parentFragment=f.parentFragment;this.ractive=this.parentFragment.ractive;this.rendered=!1;this.fragment=this.updateDelegate=null;this.element.attributeByName[this.name]= +this;n(f.template.f)?this.fragment=new K({owner:this,template:f.template.f}):(this.value=f.template.f,0===this.value&&(this.value=""));if(this.interpolator=this.fragment&&1===this.fragment.items.length&&2===this.fragment.items[0].type&&this.fragment.items[0])this.interpolator.owner=this}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){this.fragment&&this.fragment.bind()};b.prototype.bubble=function(){this.dirty||(this.parentFragment.bubble(),this.element.bubble(), +this.dirty=!0)};b.prototype.destroyed=function(){this.updateDelegate(!0)};b.prototype.getString=function(){return this.fragment?this.fragment.toString():null!=this.value?""+this.value:""};b.prototype.getValue=function(){return this.fragment?this.fragment.valueOf():ud.test(this.name)?!0:this.value};b.prototype.render=function(){var a=this.element.node;this.node=a;if(!a.namespaceURI||a.namespaceURI===Mf.html){this.propertyName=Dk[this.name]||this.name;void 0!==a[this.propertyName]&&(this.useProperty= +!0);if(ud.test(this.name)||this.isTwoway)this.isBoolean=!0;"value"===this.propertyName&&(a._ractive.value=this.value)}if(a.namespaceURI){var b=this.name.indexOf(":");if(-1!==b){a:{for(var b=this.name.slice(0,b),d="xmlns:"+b;a;){if(a.hasAttribute&&a.hasAttribute(d)){a=a.getAttribute(d);break a}a=a.parentNode}a=Mf[b]}this.namespace=a}else this.namespace=a.namespaceURI}this.rendered=!0;this.updateDelegate=Mi(this);this.updateDelegate()};b.prototype.toString=function(){var a=this.getValue();if("value"!== +this.name||void 0===this.element.getAttribute("contenteditable")&&"select"!==this.element.name&&"textarea"!==this.element.name){if("name"===this.name&&"input"===this.element.name&&this.interpolator&&"radio"===this.element.getAttribute("type"))return'name="{{'+this.interpolator.model.getKeypath()+'}}"';if(this.owner!==this.element||"style"!==this.name&&"class"!==this.name&&!this.styleName&&!this.inlineClass){if(this.rendered||this.owner!==this.element||this.name.indexOf("style-")&&this.name.indexOf("class-"))return ud.test(this.name)? +a?this.name:"":null==a?"":(a=g(this.getString()))?""+this.name+'="'+a+'"':this.name;this.name.indexOf("style-")?this.inlineClass=this.name.substr(6):this.styleName=h(this.name.substr(6))}}};b.prototype.unbind=function(){this.fragment&&this.fragment.unbind()};b.prototype.unrender=function(){this.updateDelegate(!0);this.rendered=!1};b.prototype.update=function(){this.dirty&&(this.dirty=!1,this.fragment&&this.fragment.update(),this.rendered&&this.updateDelegate(),this.isTwoway&&!this.locked&&this.interpolator.twowayBinding.lastVal(!0, +this.interpolator.model.get()))};return b}(X),Ek=function(a){function b(f){a.call(this,f);this.owner=f.owner||f.parentFragment.owner||ja(f.parentFragment);this.element=this.owner.attributeByName?this.owner:ja(f.parentFragment);this.flag="l"===f.template.v?"lazy":"twoway";7===this.element.type&&(n(f.template.f)&&(this.fragment=new K({owner:this,template:f.template.f})),this.interpolator=this.fragment&&1===this.fragment.items.length&&2===this.fragment.items[0].type&&this.fragment.items[0])}b.prototype= +Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){this.fragment&&this.fragment.bind();dd(this,this.getValue(),!0)};b.prototype.bubble=function(){this.dirty||(this.element.bubble(),this.dirty=!0)};b.prototype.getValue=function(){return this.fragment?this.fragment.valueOf():"value"in this?this.value:"f"in this.template?this.template.f:!0};b.prototype.render=function(){dd(this,this.getValue(),!0)};b.prototype.toString=function(){return""};b.prototype.unbind=function(){this.fragment&& +this.fragment.unbind();delete this.element[this.flag]};b.prototype.unrender=function(){this.element.rendered&&this.element.recreateTwowayBinding()};b.prototype.update=function(){this.dirty&&(this.fragment&&this.fragment.update(),dd(this,this.getValue(),!0))};return b}(X),mf=N?za("div"):null,Sa=!1,ag=function(a){function b(f){a.call(this,f);this.attributes=[];this.owner=f.owner;this.fragment=new K({ractive:this.ractive,owner:this,template:this.template});this.fragment.findNextNode=w;this.dirty=!1} +b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){this.fragment.bind()};b.prototype.bubble=function(){this.dirty||(this.dirty=!0,this.owner.bubble())};b.prototype.render=function(){if(this.node=this.owner.node)this.isSvg="http://www.w3.org/2000/svg"===this.node.namespaceURI;Sa=!0;this.rendered||this.fragment.render();Sa=!1;this.dirty=this.rendered=!0;this.update()};b.prototype.toString=function(){return this.fragment.toString()};b.prototype.unbind=function(){this.fragment.unbind()}; +b.prototype.unrender=function(){this.rendered=!1;this.fragment.unrender()};b.prototype.update=function(){var a=this,b,d;this.dirty&&(this.dirty=!1,Sa=!0,this.fragment.update(),Sa=!1,this.rendered&&this.node&&(b=this.fragment.toString(),d=dj(b,this.isSvg),this.attributes.filter(function(a){a:{for(var b=d.length;b--;)if(d[b].name===a.name){a=!1;break a}a=!0}return a}).forEach(function(b){a.node.removeAttribute(b.name)}),d.forEach(function(b){a.node.setAttribute(b.name,b.value)}),this.attributes=d))}; +return b}(X),Ib="pop push reverse shift sort splice unshift".split(" "),xd=[];Ib.forEach(function(a){Ha(xd,a,{value:function(){for(var b=[],f=arguments.length;f--;)b[f]=arguments[f];b=ge(this.length,a,b);this._ractive.wrappers.forEach(function(a){a.magic&&(a.magic.locked=!0)});f=Array.prototype[a].apply(this,arguments);I.start();this._ractive.setting=!0;for(var c=this._ractive.wrappers.length;c--;)ej(this._ractive.wrappers[c],this,a,b);I.end();this._ractive.setting=!1;this._ractive.wrappers.forEach(function(a){a.magic&& +(a.magic.locked=!1)});return f},configurable:!0})});var nc,yd;({}).__proto__?(nc=function(a){return a.__proto__=xd},yd=function(a){return a.__proto__=Array.prototype}):(nc=function(a){for(var b=Ib.length;b--;){var f=Ib[b];Ha(a,f,{value:xd[f],configurable:!0})}},yd=function(a){for(var b=Ib.length;b--;)delete a[Ib[b]]});nc.unpatch=yd;var bg=nc,gd={filter:function(a){return n(a)&&(!a._ractive||!a._ractive.setting)},wrap:function(a,b,f){return new oc(a,b,f)}},oc=function(a,b){this.root=a;this.value=b; +this.__model=null;b._ractive||(Ha(b,"_ractive",{value:{wrappers:[],instances:[],setting:!1},configurable:!0}),bg(b));b._ractive.instances[a._guid]||(b._ractive.instances[a._guid]=0,b._ractive.instances.push(a));b._ractive.instances[a._guid]+=1;b._ractive.wrappers.push(this)};oc.prototype.get=function(){return this.value};oc.prototype.reset=function(a){return this.value===a};oc.prototype.teardown=function(){var a,b,f,c;a=this.value;b=a._ractive;f=b.wrappers;c=b.instances;if(b.setting)return!1;b=f.indexOf(this); +if(-1===b)throw Error("Something went wrong in a rather interesting way");f.splice(b,1);if(f.length){if(--c[this.root._guid],!c[this.root._guid]){b=c.indexOf(this.root);if(-1===b)throw Error("Something went wrong in a rather interesting way");c.splice(b,1)}}else delete a._ractive,bg.unpatch(this.value)};var zd;try{Object.defineProperty({},"test",{get:function(){},set:function(){}}),zd={filter:function(a){return a&&"object"===typeof a},wrap:function(a,b,f){return new Jb(a,b,f)}}}catch(d){zd=!1}var fd= +zd,Jb=function(a,b,f){var c=this;this.ractive=a;this.value=b;this.keypath=f;this.originalDescriptors={};Object.keys(b).forEach(function(b){var e=Object.getOwnPropertyDescriptor(c.value,b);c.originalDescriptors[b]=e;var g=f?""+f+"."+xa(b):xa(b),e=fj(e,a,g,c);Object.defineProperty(c.value,b,e)})};Jb.prototype.get=function(){return this.value};Jb.prototype.reset=function(a){return this.value===a};Jb.prototype.set=function(a,b){this.value[a]=b};Jb.prototype.teardown=function(){var a=this;Object.keys(this.value).forEach(function(b){var f= +Object.getOwnPropertyDescriptor(a.value,b);if(f.set&&f.set.__magic){a:if(f.set&&f.set.__magic)for(var c=f.set.__magic,e=c.length;e--;){var g=c[e];if(void 0===g.ractive&&void 0===g.keypath){c.splice(e,1);break a}}1===f.set.__magic.dependants.length&&Object.defineProperty(a.value,b,f.set.__magic.originalDescriptor)}})};var pc=function(a,b,f){this.value=b;this.magic=!0;this.magicWrapper=fd.wrap(a,b,f);this.arrayWrapper=gd.wrap(a,b,f);this.arrayWrapper.magic=this.magicWrapper;Object.defineProperty(this, +"__model",{get:function(){return this.arrayWrapper.__model},set:function(a){this.arrayWrapper.__model=a}})};pc.prototype.get=function(){return this.value};pc.prototype.teardown=function(){this.arrayWrapper.teardown();this.magicWrapper.teardown()};pc.prototype.reset=function(a){return this.arrayWrapper.reset(a)&&this.magicWrapper.reset(a)};var pj={filter:function(a,b,f){return fd.filter(a,b,f)&&gd.filter(a)},wrap:function(a,b,f){return new pc(a,b,f)}},cg=function(a){function b(f,c,e){a.call(this,null, +null);this.root=this.parent=f;this.signature=c;this.isExpression=(this.key=e)&&"@"===e[0];this.isReadonly=!this.signature.setter;this.context=f.computationContext;this.dependencies=[];this.children=[];this.childByKey={};this.deps=[];this.dirty=!0;this.shuffle=void 0}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.get=function(a){a&&Oa(this);this.dirty&&(this.dirty=!1,this.value=this.getValue(),this.wrapper&&(this.newWrapperValue=this.value),this.adapt());return a&& +this.wrapper?this.wrapperValue:this.value};b.prototype.getValue=function(){sb.push(tb=[]);var a;try{a=this.signature.getter.call(this.context)}catch(b){if(P("Failed to compute "+this.getKeypath()+": "+(b.message||b)),Kf){console.groupCollapsed&&console.groupCollapsed("%cshow details","color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;");var d=gj(this.signature.getterString),c;if(this.signature.getterUseStack){a:if(c=b.stack){c=c.split("\n");for(var e=cg.name+".getValue",g= +[],q=c.length,h=1;h is not valid');this.name=a;this.owner=b;this.handler=this.node=null};Bd.prototype.listen=function(a){var b=this.node=this.owner.node, +c=this.name;"on"+c in b||ma(ab(c,"events"));b.addEventListener(c,this.handler=function(c){a.fire({node:b,original:c})},!1)};Bd.prototype.unlisten=function(){this.node.removeEventListener(this.name,this.handler,!1)};var Cd=function(a,b){this.eventPlugin=a;this.owner=b;this.handler=null};Cd.prototype.listen=function(a){var b=this.owner.node;this.handler=this.eventPlugin(b,function(c){void 0===c&&(c={});c.node=c.node||b;a.fire(c)})};Cd.prototype.unlisten=function(){this.handler.teardown()};var qc=function(a, +b){this.ractive=a;this.name=b;this.handler=null};qc.prototype.listen=function(a){var b=this.ractive;this.handler=b.on(this.name,function(){var c;arguments.length&&arguments[0]&&arguments[0].node&&(c=Array.prototype.shift.call(arguments),c.component=b);var e=Array.prototype.slice.call(arguments);a.fire(c,e);return!1})};qc.prototype.unlisten=function(){this.handler.cancel()};var Gk=/^(event|arguments)(\..+)?$/,Hk=/^\$(\d+)(\..+)?$/,ta=function(a){var b=this;this.owner=a.owner||a.parentFragment.owner|| +ja(a.parentFragment);this.element=this.owner.attributeByName?this.owner:ja(a.parentFragment);this.template=a.template;this.parentFragment=a.parentFragment;this.ractive=a.parentFragment.ractive;this.events=[];15===this.element.type?this.template.n.split("-").forEach(function(a){b.events.push(new qc(b.element.instance,a))}):this.template.n.split("-").forEach(function(a){var d=pb("events",b.ractive,a);b.events.push(d?new Cd(d,b.element):new Bd(a,b.element))});this.args=this.action=this.models=this.resolvers= +this.context=null};ta.prototype.bind=function(){var a=this;this.context=this.parentFragment.findContext();var b=this.template.f;b.x?(this.fn=Wb(b.x.s,b.x.r.length),this.resolvers=[],this.models=b.x.r.map(function(b,c){var e=Gk.exec(b);if(e)return{special:e[1],keys:e[2]?x(e[2].substr(1)):[]};if(e=Hk.exec(b))return{special:"arguments",keys:[e[1]-1].concat(e[2]?x(e[2].substr(1)):[])};var g;(e=pa(a.parentFragment,b))?e.register(a):(g=a.parentFragment.resolve(b,function(b){a.models[c]=b;M(a.resolvers, +g);b.register(a)}),a.resolvers.push(g));return e})):(this.action="string"===typeof b?b:"string"===typeof b.n?b.n:new K({owner:this,template:b.n}),this.args=b.a?"string"===typeof b.a?[b.a]:b.a:b.d?new K({owner:this,template:b.d}):[]);this.action&&"string"!==typeof this.action&&this.action.bind();this.args&&b.d&&this.args.bind()};ta.prototype.bubble=function(){this.dirty||(this.dirty=!0,this.owner.bubble())};ta.prototype.destroyed=function(){this.events.forEach(function(a){return a.unlisten()})};ta.prototype.fire= +function(a,b){void 0===b&&(b=[]);a&&!a.hasOwnProperty("_element")&&le(a,this.owner);if(this.fn){var c=[];a&&b.unshift(a);this.models&&this.models.forEach(function(e){if(!e)return c.push(void 0);if(e.special){var g="event"===e.special?a:b;for(e=e.keys.slice();e.length;)g=g[e.shift()];return c.push(g)}if(e.wrapper)return c.push(e.wrapperValue);c.push(e.get())});var e=this.ractive,g=e.event;e.event=a;if(!1===this.fn.apply(e,c).pop()){var h=a?a.original:void 0;h?(h.preventDefault&&h.preventDefault(), +h.stopPropagation&&h.stopPropagation()):Y("handler '"+this.template.n+"' returned false, but there is no event available to cancel")}e.event=g}else e=this.action.toString(),g=this.template.f.d?this.args.getArgsList():this.args,b.length&&(g=g.concat(b)),a&&(a.name=e),Jd(this.ractive,e,{event:a,args:g})};ta.prototype.handleChange=function(){};ta.prototype.rebinding=function(a,b){var c=this;if(this.models){var e=this.models.indexOf(b);~e&&(this.models.splice(e,1,a),b.unregister(this),a&&a.addShuffleTask(function(){return a.register(c)}))}}; +ta.prototype.render=function(){var a=this;I.scheduleTask(function(){return a.events.forEach(function(b){return b.listen(a)},!0)})};ta.prototype.toString=function(){return""};ta.prototype.unbind=function(){var a=this;this.template.f.m?(this.resolvers&&this.resolvers.forEach(Ea),this.resolvers=[],this.models&&this.models.forEach(function(b){b.unregister&&b.unregister(a)}),this.models=null):(this.action&&this.action.unbind&&this.action.unbind(),this.args&&this.args.unbind&&this.args.unbind())};ta.prototype.unrender= +function(){this.events.forEach(function(a){return a.unlisten()})};ta.prototype.update=function(){!this.method&&this.dirty&&(this.dirty=!1,this.action&&this.action.update&&this.action.update(),this.args&&this.args.update&&this.args.update())};var Ik=new ca("teardown"),Pj=function(a){function b(c,e){var g=this;a.call(this,c);this.type=15;var q=ra(e.prototype);this.instance=q;this.name=c.template.e;this.parentFragment=c.parentFragment;this.liveQueries=[];q.el&&P("The <"+this.name+"> component has a default 'el' property; it has been disregarded"); +var h=c.template.p||{};"content"in h||(h.content=c.template.f||[]);this._partials=h;this.yielders={};for(var k=c.parentFragment,l;k;){if(16===k.owner.type){l=k.owner.container;break}k=k.parent}q.parent=this.parentFragment.ractive;q.container=l||null;q.root=q.parent.root;q.component=this;ed(this.instance,{partials:h});q._inlinePartials=h;this.attributeByName={};this.attributes=[];var m=[];(this.template.m||[]).forEach(function(a){switch(a.t){case 13:case 70:case 72:g.attributes.push(hc({owner:g,parentFragment:g.parentFragment, +template:a}));break;case 73:case 71:break;default:m.push(a)}});this.attributes.push(new ag({owner:this,parentFragment:this.parentFragment,template:m}));this.eventHandlers=[];this.template.v&&this.setupEvents()}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){this.attributes.forEach(Ob);hd(this.instance,{partials:this._partials},{cssIds:this.parentFragment.cssIds});this.eventHandlers.forEach(Ob);this.bound=!0};b.prototype.bubble=function(){this.dirty|| +(this.dirty=!0,this.parentFragment.bubble())};b.prototype.checkYielders=function(){var a=this;Object.keys(this.yielders).forEach(function(b){if(1"};b.prototype.unbind=function(){};b.prototype.unrender=function(){};b.prototype.update=function(){};return b}(X), +ka=function(a,b){void 0===b&&(b="value");this.element=a;this.ractive=a.ractive;this.attribute=a.attributeByName[b];var c=this.attribute.interpolator;c.twowayBinding=this;var e=c.model;if(!e)c.resolver.forceResolution(),e=c.model,qf("'"+c.template.r+"' reference",this.ractive);else if(e.isUnresolved)e.forceResolution(),qf("expression",this.ractive);else if(e.isReadonly)return e=e.getKeypath().replace(/^@/,""),Y("Cannot use two-way binding on <"+a.name+"> element: "+e+" is read-only. To suppress this warning use <"+ +a.name+" twoway='false'...>",{ractive:this.ractive}),!1;this.attribute.isTwoway=!0;this.model=e;c=e.get();this.wasUndefined=void 0===c;void 0===c&&this.getInitialValue&&(c=this.getInitialValue(),e.set(c));this.lastVal(!0,c);if(e=ja(this.element,!1,"form"))this.resetValue=c,e.formBindings.push(this)};ka.prototype.bind=function(){this.model.registerTwowayBinding(this)};ka.prototype.handleChange=function(){var a=this,b=this.getValue();this.lastVal()!==b&&(I.start(this.root),this.attribute.locked=!0, +this.model.set(b),this.lastVal(!0,b),this.model.get()!==b?this.attribute.locked=!1:I.scheduleTask(function(){return a.attribute.locked=!1}),I.end())};ka.prototype.lastVal=function(a,b){if(a)this.lastValue=b;else return this.lastValue};ka.prototype.rebinding=function(a,b){var c=this;this.model&&this.model===b&&b.unregisterTwowayBinding(this);a&&(this.model=a,I.scheduleTask(function(){return a.registerTwowayBinding(c)}))};ka.prototype.render=function(){this.node=this.element.node;this.node._ractive.binding= +this;this.rendered=!0};ka.prototype.setFromNode=function(a){this.model.set(a.value)};ka.prototype.unbind=function(){this.model.unregisterTwowayBinding(this)};ka.prototype.unrender=function(){};var tf=function(a){function b(c){a.call(this,c,"checked")}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.render=function(){a.prototype.render.call(this);this.node.addEventListener("change",Q,!1);this.node.attachEvent&&this.node.addEventListener("click",Q,!1)};b.prototype.unrender= +function(){this.node.removeEventListener("change",Q,!1);this.node.removeEventListener("click",Q,!1)};b.prototype.getInitialValue=function(){return!!this.element.getAttribute("checked")};b.prototype.getValue=function(){return this.node.checked};b.prototype.setFromNode=function(a){this.model.set(a.checked)};return b}(ka),Db=function(a,b,c){var e=this;this.model=b;this.hash=a;this.getValue=function(){e.value=c.call(e);return e.value};this.bindings=[]};Db.prototype.add=function(a){this.bindings.push(a)}; +Db.prototype.bind=function(){this.value=this.model.get();this.model.registerTwowayBinding(this);this.bound=!0};Db.prototype.remove=function(a){M(this.bindings,a);this.bindings.length||this.unbind()};Db.prototype.unbind=function(){this.model.unregisterTwowayBinding(this);this.bound=!1;delete this.model[this.hash]};var Kk=[].push,Aj=function(a){function b(c){a.call(this,c,"name");this.checkboxName=!0;this.group=rf("checkboxes",this.model,uj);this.group.add(this);this.noInitialValue&&(this.group.noInitialValue= +!0);if(this.group.noInitialValue&&this.element.getAttribute("checked")){c=this.model.get();var e=this.element.getAttribute("value");W(c,e)||Kk.call(c,e)}}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){this.group.bound||this.group.bind()};b.prototype.changed=function(){var a=!!this.isChecked;this.isChecked=this.node.checked;return this.isChecked===a};b.prototype.getInitialValue=function(){this.noInitialValue=!0;return[]};b.prototype.getValue=function(){return this.group.value}; +b.prototype.handleChange=function(){this.isChecked=this.element.node.checked;this.group.value=this.model.get();var b=this.element.getAttribute("value");this.isChecked&&!W(this.group.value,b)?this.group.value.push(b):!this.isChecked&&W(this.group.value,b)&&M(this.group.value,b);this.lastValue=null;a.prototype.handleChange.call(this)};b.prototype.render=function(){a.prototype.render.call(this);var b=this.node,c=this.model.get(),e=this.element.getAttribute("value");n(c)?this.isChecked=W(c,e):this.isChecked= +c==e;b.name="{{"+this.model.getKeypath()+"}}";b.checked=this.isChecked;b.addEventListener("change",Q,!1);b.attachEvent&&b.addEventListener("click",Q,!1)};b.prototype.setFromNode=function(a){this.group.bindings.forEach(function(a){return a.wasUndefined=!0});a.checked&&(a=this.group.getValue(),a.push(this.element.getAttribute("value")),this.group.model.set(a))};b.prototype.unbind=function(){this.group.remove(this)};b.prototype.unrender=function(){var a=this.element.node;a.removeEventListener("change", +Q,!1);a.removeEventListener("click",Q,!1)};return b}(ka),yj=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.getInitialValue=function(){return this.element.fragment?this.element.fragment.toString():""};b.prototype.getValue=function(){return this.element.node.innerHTML};b.prototype.render=function(){a.prototype.render.call(this);var b=this.node;b.addEventListener("change",Q,!1);b.addEventListener("blur",Q,!1);this.ractive.lazy|| +(b.addEventListener("input",Q,!1),b.attachEvent&&b.addEventListener("keyup",Q,!1))};b.prototype.setFromNode=function(a){this.model.set(a.innerHTML)};b.prototype.unrender=function(){var a=this.node;a.removeEventListener("blur",Q,!1);a.removeEventListener("change",Q,!1);a.removeEventListener("input",Q,!1);a.removeEventListener("keyup",Q,!1)};return b}(ka),ec=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.getInitialValue= +function(){return""};b.prototype.getValue=function(){return this.node.value};b.prototype.render=function(){a.prototype.render.call(this);var b=this.ractive.lazy,c=!1;"lazy"in this.element&&(b=this.element.lazy);r(b)&&(c=+b,b=!1);this.handler=c?vj(c):Q;c=this.node;c.addEventListener("change",Q,!1);b||(c.addEventListener("input",this.handler,!1),c.attachEvent&&c.addEventListener("keyup",this.handler,!1));c.addEventListener("blur",sf,!1)};b.prototype.unrender=function(){var a=this.element.node;this.rendered= +!1;a.removeEventListener("change",Q,!1);a.removeEventListener("input",this.handler,!1);a.removeEventListener("keyup",this.handler,!1);a.removeEventListener("blur",sf,!1)};return b}(ka),Cj=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.getInitialValue=function(){};b.prototype.getValue=function(){return this.node.files};b.prototype.render=function(){this.element.lazy=!1;a.prototype.render.call(this)};b.prototype.setFromNode= +function(a){this.model.set(a.files)};return b}(ec),Ej=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.forceUpdate=function(){var a=this,b=this.getValue();void 0!==b&&(this.attribute.locked=!0,I.scheduleTask(function(){return a.attribute.locked=!1}),this.model.set(b))};b.prototype.getInitialValue=function(){return this.element.options.filter(function(a){return a.getAttribute("selected")}).map(function(a){return a.getAttribute("value")})}; +b.prototype.getValue=function(){for(var a=this.element.node.options,b=a.length,d=[],c=0;c element cannot contain other elements (encountered <"+this.name+">)");this.decorators=[];this.attributeByName={};this.attributes=[];var g=[];(this.template.m||[]).forEach(function(a){switch(a.t){case 13:case 73:case 71:case 70:case 72:e.attributes.push(hc({owner:e,parentFragment:e.parentFragment,template:a}));break;default:g.push(a)}});g.length&&this.attributes.push(new ag({owner:this,parentFragment:this.parentFragment, +template:g}));for(var h=this.attributes.length;h--;){var q=e.attributes[h];"type"===q.name?e.attributes.unshift(e.attributes.splice(h,1)[0]):"max"===q.name?e.attributes.unshift(e.attributes.splice(h,1)[0]):"min"===q.name?e.attributes.unshift(e.attributes.splice(h,1)[0]):"class"===q.name?e.attributes.unshift(e.attributes.splice(h,1)[0]):"value"===q.name&&e.attributes.push(e.attributes.splice(h,1)[0])}c.template.f&&!c.deferContent&&(this.fragment=new K({template:c.template.f,owner:this,cssIds:null})); +this.binding=null}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){this.attributes.binding=!0;this.attributes.forEach(Ob);this.attributes.binding=!1;this.fragment&&this.fragment.bind();this.binding||this.recreateTwowayBinding()};b.prototype.createTwowayBinding=function(){if("twoway"in this?!this.twoway:!this.ractive.twoway)return null;var a=xj(this);return a?(a=new a(this),a.model)?a:null:null};b.prototype.destroyed=function(){this.attributes.forEach(function(a){return a.destroyed()}); +this.fragment&&this.fragment.destroyed()};b.prototype.detach=function(){this.rendered||this.destroyed();return e(this.node)};b.prototype.find=function(a){if(this.node&&Ka(this.node,a))return this.node;if(this.fragment)return this.fragment.find(a)};b.prototype.findAll=function(a,b){b.test(this.node)&&(b.add(this.node),b.live&&this.liveQueries.push(b));this.fragment&&this.fragment.findAll(a,b)};b.prototype.findComponent=function(a){if(this.fragment)return this.fragment.findComponent(a)};b.prototype.findAllComponents= +function(a,b){this.fragment&&this.fragment.findAllComponents(a,b)};b.prototype.findNextNode=function(){return null};b.prototype.firstNode=function(){return this.node};b.prototype.getAttribute=function(a){return(a=this.attributeByName[a])?a.getValue():void 0};b.prototype.recreateTwowayBinding=function(){this.binding&&(this.binding.unbind(),this.binding.unrender());if(this.binding=this.createTwowayBinding())this.binding.bind(),this.rendered&&this.binding.render()};b.prototype.render=function(a,b){this.namespace= +Jj(this);var d,c=!1;if(b)for(var g;g=b.shift();)if(g.nodeName.toUpperCase()===this.template.e.toUpperCase()&&g.namespaceURI===this.namespace){this.node=d=g;c=!0;break}else e(g);d||(this.node=d=za(this.template.e,this.namespace,this.getAttribute("is")));Ha(d,"_ractive",{value:{proxy:this}});this.parentFragment.cssIds&&d.setAttribute("data-ractive-css",this.parentFragment.cssIds.map(function(a){return"{"+a+"}"}).join(" "));c&&this.foundNode&&this.foundNode(d);this.fragment&&(g=c?ua(d.childNodes):void 0, +this.fragment.render(d,g),g&&g.forEach(e));if(c)for(this.binding&&this.binding.wasUndefined&&this.binding.setFromNode(d),g=d.attributes.length;g--;){var h=d.attributes[g].name;h in this.attributeByName||d.removeAttribute(h)}this.attributes.forEach(Fc);this.binding&&this.binding.render();tj(this);this._introTransition&&this.ractive.transitionsEnabled&&(this._introTransition.isIntro=!0,I.registerTransition(this._introTransition));c||a.appendChild(d);this.rendered=!0};b.prototype.shuffled=function(){this.liveQueries.forEach(Gj); +a.prototype.shuffled.call(this)};b.prototype.toString=function(){var a=this.template.e,b=this.attributes.map(Ij).join("");"option"===this.name&&this.isSelected()&&(b+=" selected");"input"===this.name&&Hj(this)&&(b+=" checked");var d,c;this.attributes.forEach(function(a){"class"===a.name?c=(c||"")+(c?" ":"")+g(a.getString()):"style"===a.name?(d=(d||"")+(d?" ":"")+g(a.getString()))&&!Lk.test(d)&&(d+=";"):a.styleName?d=(d||"")+(d?" ":"")+""+k(a.styleName)+": "+g(a.getString())+";":a.inlineClass&&a.getValue()&& +(c=(c||"")+(c?" ":"")+a.inlineClass)});void 0!==d&&(b=" style"+(d?'="'+d+'"':"")+b);void 0!==c&&(b=" class"+(c?'="'+c+'"':"")+b);b="<"+a+""+b+">";if(this.isVoid)return b;"textarea"===this.name&&void 0!==this.getAttribute("value")?b+=Sc(this.getAttribute("value")):void 0!==this.getAttribute("contenteditable")&&(b+=this.getAttribute("value")||"");this.fragment&&(b+=this.fragment.toString(!/^(?:script|style)$/i.test(this.template.e)));return b+("")};b.prototype.unbind=function(){this.attributes.forEach(Ea); +this.binding&&this.binding.unbind();this.fragment&&this.fragment.unbind()};b.prototype.unrender=function(a){if(this.rendered){this.rendered=!1;var b=this._introTransition;b&&b.complete&&b.complete();"option"===this.name?this.detach():a&&I.detachWhenReady(this);this.fragment&&this.fragment.unrender();this.binding&&this.binding.unrender();this._outroTransition&&this.ractive.transitionsEnabled&&(this._outroTransition.isIntro=!1,I.registerTransition(this._outroTransition));for(a=this.liveQueries.length;a--;)this.liveQueries[a].remove(this.node)}}; +b.prototype.update=function(){this.dirty&&(this.dirty=!1,this.attributes.forEach(cb),this.fragment&&this.fragment.update())};return b}(X),Mk=function(a){function b(c){a.call(this,c);this.formBindings=[]}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.render=function(b,c){a.prototype.render.call(this,b,c);this.node.addEventListener("reset",uf,!1)};b.prototype.unrender=function(b){this.node.removeEventListener("reset",uf,!1);a.prototype.unrender.call(this,b)};return b}(Fb), +rc=function(a){function b(c){a.call(this,c);this.parentFragment=c.parentFragment;this.template=c.template;this.index=c.index;c.owner&&(this.parent=c.owner);this.isStatic=!!c.template.s;this.model=null;this.dirty=!1}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){var a=this,b=bc(this.parentFragment,this.template),d=b?b.get():void 0;this.isStatic?this.model={get:function(){return d}}:b?(b.register(this),this.model=b):this.resolver=this.parentFragment.resolve(this.template.r, +function(b){a.model=b;b.register(a);a.handleChange();a.resolver=null})};b.prototype.handleChange=function(){this.bubble()};b.prototype.rebinding=function(a,b,d){a=Pa(this.template,a,b);if(this["static"]||a===this.model)return!1;this.model&&this.model.unregister(this);a&&a.addShuffleRegister(this,"mark");this.model=a;d||this.handleChange();return!0};b.prototype.unbind=function(){this.isStatic||(this.model&&this.model.unregister(this),this.model=void 0,this.resolver&&this.resolver.unbind())};return b}(X), +Nk=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bubble=function(){this.owner&&this.owner.bubble();a.prototype.bubble.call(this)};b.prototype.detach=function(){return e(this.node)};b.prototype.firstNode=function(){return this.node};b.prototype.getString=function(){return this.model?c(this.model.get()):""};b.prototype.render=function(a,b){if(!Sa){var d=this.getString();this.rendered=!0;if(b){var c=b[0];c&&3===c.nodeType? +(b.shift(),c.nodeValue!==d&&(c.nodeValue=d)):(c=this.node=N.createTextNode(d),b[0]?a.insertBefore(c,b[0]):a.appendChild(c));this.node=c}else this.node=N.createTextNode(d),a.appendChild(this.node)}};b.prototype.toString=function(a){var b=this.getString();return a?Sc(b):b};b.prototype.unrender=function(a){a&&this.detach();this.rendered=!1};b.prototype.update=function(){this.dirty&&(this.dirty=!1,this.rendered&&(this.node.data=this.getString()))};b.prototype.valueOf=function(){return this.model?this.model.get(): +void 0};return b}(rc),gg=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.render=function(b,c){a.prototype.render.call(this,b,c);this.node.defaultValue=this.node.value};return b}(Fb),Rj=function(a){function b(c){a.call(this,c);this.name=c.template.n;this.owner=c.owner||c.parentFragment.owner||c.element||ja(c.parentFragment);this.element=c.element||(this.owner.attributeByName?this.owner:ja(c.parentFragment));this.parentFragment= +this.element.parentFragment;this.ractive=this.parentFragment.ractive;this.fragment=null;this.element.attributeByName[this.name]=this;this.value=c.template.f}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){this.fragment&&this.fragment.bind();var a=this.template.f,b=this.element.instance.viewmodel;if(0===a)b.joinKey(this.name).set(!0);else if("string"===typeof a){var d=$b(a);b.joinKey(this.name).set(d?d.value:a)}else n(a)&&Lj(this,!0)};b.prototype.render= +function(){};b.prototype.unbind=function(){this.fragment&&this.fragment.unbind();this.boundFragment&&this.boundFragment.unbind();this.element.bound&&this.link.target===this.model&&this.link.owner.unlink()};b.prototype.unrender=function(){};b.prototype.update=function(){this.dirty&&(this.dirty=!1,this.fragment&&this.fragment.update(),this.boundFragment&&this.boundFragment.update(),this.rendered&&this.updateDelegate())};return b}(X),Ok=function(a){function b(c){var e=c.template;e.a||(e.a={});void 0!== +e.a.value||"disabled"in e.a||(e.a.value=e.f||"");a.call(this,c);this.select=ja(this.parent||this.parentFragment,!1,"select")}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){if(this.select){var b=this.attributeByName.selected;b&&void 0!==this.select.getAttribute("value")&&(b=this.attributes.indexOf(b),this.attributes.splice(b,1),delete this.attributeByName.selected);a.prototype.bind.call(this);this.select.options.push(this)}else a.prototype.bind.call(this)}; +b.prototype.bubble=function(){var b=this.getAttribute("value");this.node&&this.node.value!==b&&(this.node._ractive.value=b);a.prototype.bubble.call(this)};b.prototype.getAttribute=function(a){var b=this.attributeByName[a];return b?b.getValue():"value"===a&&this.fragment?this.fragment.valueOf():void 0};b.prototype.isSelected=function(){var a=this.getAttribute("value");if(void 0===a||!this.select)return!1;var b=this.select.getAttribute("value");if(b==a)return!0;if(this.select.getAttribute("multiple")&& +n(b))for(var d=b.length;d--;)if(b[d]==a)return!0};b.prototype.render=function(b,c){a.prototype.render.call(this,b,c);this.attributeByName.value||(this.node._ractive.value=this.getAttribute("value"))};b.prototype.unbind=function(){a.prototype.unbind.call(this);this.select&&M(this.select.options,this)};return b}(Fb),Pk=function(a){function b(){a.apply(this,arguments)}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){var b=(this.refName=this.template.r)? +fc(this.ractive,this.refName,this.parentFragment)||null:null,c;b&&(this.named=!0,this.setTemplate(this.template.r,b));b||(a.prototype.bind.call(this),this.model&&(c=this.model.get())&&"object"===typeof c&&("string"===typeof c.template||n(c.t))?(c.template?(this.source=c.template,c=xf(this.template.r,c.template,this.ractive)):this.source=c.t,this.setTemplate(this.template.r,c.t)):this.model&&"string"===typeof this.model.get()||!this.refName?this.setTemplate(this.model.get()):this.setTemplate(this.refName, +b));this.fragment=(new K({owner:this,template:this.partialTemplate})).bind()};b.prototype.detach=function(){return this.fragment.detach()};b.prototype.find=function(a){return this.fragment.find(a)};b.prototype.findAll=function(a,b){this.fragment.findAll(a,b)};b.prototype.findComponent=function(a){return this.fragment.findComponent(a)};b.prototype.findAllComponents=function(a,b){this.fragment.findAllComponents(a,b)};b.prototype.firstNode=function(a){return this.fragment.firstNode(a)};b.prototype.forceResetTemplate= +function(){var a=this;this.partialTemplate=void 0;this.refName&&(this.partialTemplate=fc(this.ractive,this.refName,this.parentFragment));this.partialTemplate||(this.partialTemplate=fc(this.ractive,this.name,this.parentFragment));this.partialTemplate||(Y("Could not find template for partial '"+this.name+"'"),this.partialTemplate=[]);this.inAttribute?cj(function(){return a.fragment.resetTemplate(a.partialTemplate)}):this.fragment.resetTemplate(this.partialTemplate);this.bubble()};b.prototype.render= +function(a,b){this.fragment.render(a,b)};b.prototype.setTemplate=function(a,b){this.name=a;b||null===b||(b=fc(this.ractive,a,this.parentFragment));b||Y("Could not find template for partial '"+a+"'");this.partialTemplate=b||[]};b.prototype.toString=function(a){return this.fragment.toString(a)};b.prototype.unbind=function(){a.prototype.unbind.call(this);this.fragment.unbind()};b.prototype.unrender=function(a){this.fragment.unrender(a)};b.prototype.update=function(){var a;this.dirty&&(this.dirty=!1, +this.named||(this.model&&(a=this.model.get()),a&&"string"===typeof a&&a!==this.name?(this.setTemplate(a),this.fragment.resetTemplate(this.partialTemplate)):a&&"object"===typeof a&&("string"===typeof a.template||n(a.t))&&a.t!==this.source&&a.template!==this.source&&(a.template?(this.source=a.template,a=xf(this.name,a.template,this.ractive)):this.source=a.t,this.setTemplate(this.name,a.t),this.fragment.resetTemplate(this.partialTemplate))),this.fragment.update())};return b}(rc),U=function(a){this.parent= +a.owner.parentFragment;this.parentFragment=this;this.owner=a.owner;this.ractive=this.parent.ractive;this.cssIds="cssIds"in a?a.cssIds:this.parent?this.parent.cssIds:null;this.context=null;this.rendered=!1;this.iterations=[];this.template=a.template;this.indexRef=a.indexRef;this.keyRef=a.keyRef;this.previousIterations=this.pendingNewIndices=null;this.isArray=!1};U.prototype.bind=function(a){var b=this;this.context=a;a=a.get();if(this.isArray=n(a)){this.iterations=[];a=a.length;for(var c=0;cc.length&&(g=this.iterations.splice(c.length)));else if(v(c)&&!e)for(k=!1,g=[],h={},l=this.iterations.length;l--;)e= +a.iterations[l],e.key in c?h[e.key]=!0:(a.iterations.splice(l,1),g.push(e));k&&(g=this.iterations,this.iterations=[]);g&&g.forEach(function(a){a.unbind();a.unrender(!0)});this.iterations.forEach(cb);var m,p;if((n(c)?c.length:v(c)?Object.keys(c).length:0)>this.iterations.length){m=this.rendered?b():null;l=this.iterations.length;if(n(c))for(;l',""],THEAD:['',"
"],TBODY:['',"
"],TR:['',"
"],SELECT:['"]}}var Xk=function(a){function c(b){a.call(this,b)}c.prototype=Object.create(a&&a.prototype);c.prototype.constructor=c;c.prototype.detach=function(){var a=b();this.nodes.forEach(function(b){return a.appendChild(b)});return a};c.prototype.find=function(a){var b=this.nodes.length, +d;for(d=0;d'+b+"",e=e.querySelector(".x")):"TEXTAREA"===d.tagName?(e=za("div"),"undefined"!==typeof e.textContent?e.textContent=b:e.innerHTML=b):(e=md(d.tagName),e.innerHTML=b,"SELECT"===e.tagName&&(h=e.options[e.selectedIndex])); +for(;b=e.firstChild;)c.push(b),a.appendChild(b);if("SELECT"===d.tagName)for(a=c.length;a--;)c[a]!==h&&(c[a].selected=!1)}this.nodes=c;this.rendered=!0};c.prototype.toString=function(){return this.model&&null!=this.model.get()?Rc(""+this.model.get()):""};c.prototype.unrender=function(){this.nodes&&this.nodes.forEach(function(a){return e(a)});this.rendered=!1};c.prototype.update=function(){if(this.rendered&&this.dirty){this.dirty=!1;this.unrender();var a=b();this.render(a);var d=this.parentFragment.findParentNode(), +c=this.parentFragment.findNextNode(this);d.insertBefore(a,c)}else this.dirty=!1};return c}(rc),Yk=function(a){function b(c){a.call(this,c);this.container=c.parentFragment.ractive;this.component=this.container.component;this.containerFragment=c.parentFragment;this.parentFragment=this.component.parentFragment;this.name=c.template.n||""}b.prototype=Object.create(a&&a.prototype);b.prototype.constructor=b;b.prototype.bind=function(){var a=this.name;(this.component.yielders[a]||(this.component.yielders[a]= +[])).push(this);var b=this.container._inlinePartials[a||"content"];"string"===typeof b&&(b=lb(b).t);b||(P('Could not find template for partial "'+a+'"',{ractive:this.ractive}),b=[]);this.fragment=(new K({owner:this,ractive:this.container.parent,template:b})).bind()};b.prototype.bubble=function(){this.dirty||(this.containerFragment.bubble(),this.dirty=!0)};b.prototype.detach=function(){return this.fragment.detach()};b.prototype.find=function(a){return this.fragment.find(a)};b.prototype.findAll=function(a, +b){this.fragment.findAll(a,b)};b.prototype.findComponent=function(a){return this.fragment.findComponent(a)};b.prototype.findAllComponents=function(a,b){this.fragment.findAllComponents(a,b)};b.prototype.findNextNode=function(){return this.containerFragment.findNextNode(this)};b.prototype.firstNode=function(a){return this.fragment.firstNode(a)};b.prototype.render=function(a,b){return this.fragment.render(a,b)};b.prototype.setTemplate=function(a){a=this.parentFragment.ractive.partials[a];"string"=== +typeof a&&(a=lb(a).t);this.partialTemplate=a||[]};b.prototype.toString=function(a){return this.fragment.toString(a)};b.prototype.unbind=function(){this.fragment.unbind();M(this.component.yielders[this.name],this)};b.prototype.unrender=function(a){this.fragment.unrender(a)};b.prototype.update=function(){this.dirty=!1;this.fragment.update()};return b}(X),sa={};sa[19]=Ck;sa[18]=eg;sa[2]=Nk;sa[8]=Pk;sa[4]=Qk;sa[3]=Xk;sa[16]=Yk;sa[13]=Df;sa[73]=Ek;sa[71]=Aa;sa[70]=ta;sa[72]=ga;var Qj={doctype:eg,form:Mk, +input:gg,option:Ok,select:Rk,textarea:Sk},K=function(a){this.owner=a.owner;this.parent=(this.isRoot=!a.owner.parentFragment)?null:this.owner.parentFragment;this.ractive=a.ractive||(this.isRoot?a.owner:this.parent.ractive);this.componentParent=this.isRoot&&this.ractive.component?this.ractive.component.parentFragment:null;this.context=null;this.rendered=!1;this.cssIds="cssIds"in a?a.cssIds:this.parent?this.parent.cssIds:null;this.resolvers=[];this.dirty=!1;this.dirtyArgs=this.dirtyValue=!0;this.template= +a.template||[];this.createItems()};K.prototype.bind=function(a){this.context=a;this.items.forEach(Ob);this.bound=!0;this.dirty&&this.update();return this};K.prototype.bubble=function(){this.dirtyArgs=this.dirtyValue=!0;this.dirty||(this.dirty=!0,this.isRoot?this.ractive.component?this.ractive.component.bubble():this.bound&&I.addFragment(this):this.owner.bubble())};K.prototype.createItems=function(){var a=this.template.length;this.items=[];for(var b=0;bb&&(c=null==c?"..":c,a=a.substring(0,b-c.length)+c);return a},indexOf:function(a,b){if(Array.prototype.indexOf)return a.indexOf(b); +for(var c=0,g=a.length;c",this.getInnerHtml(),""].join("")},buildAttrsStr:function(){if(!this.attrs)return"";var a=this.getAttrs(),b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c+'="'+a[c]+'"');return b.join(" ")}});b.RegexLib={alphaNumericCharsStr:"A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b4\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16f1-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2183\u2184\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u3006\u3031-\u3035\u303b\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6e5\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ad\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc0-9\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0de6-\u0def\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\ua9f0-\ua9f9\uaa50-\uaa59\uabf0-\uabf9\uff10-\uff19", domainNameRegex:RegExp("[A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b4\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16f1-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2183\u2184\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u3006\u3031-\u3035\u303b\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6e5\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ad\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc0-9\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0de6-\u0def\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\ua9f0-\ua9f9\uaa50-\uaa59\uabf0-\uabf9\uff10-\uff19.\\-]*[A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b4\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16f1-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2183\u2184\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u3006\u3031-\u3035\u303b\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6e5\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ad\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc0-9\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0de6-\u0def\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\ua9f0-\ua9f9\uaa50-\uaa59\uabf0-\uabf9\uff10-\uff19\\-]"), tldRegex:/(?:travelersinsurance|sandvikcoromant|kerryproperties|cancerresearch|weatherchannel|kerrylogistics|spreadbetting|international|wolterskluwer|lifeinsurance|construction|pamperedchef|scholarships|versicherung|bridgestone|creditunion|kerryhotels|investments|productions|blackfriday|enterprises|lamborghini|photography|motorcycles|williamhill|playstation|contractors|barclaycard|accountants|redumbrella|engineering|management|telefonica|protection|consulting|tatamotors|creditcard|vlaanderen|schaeffler|associates|properties|foundation|republican|bnpparibas|boehringer|eurovision|extraspace|industries|immobilien|university|technology|volkswagen|healthcare|restaurant|cuisinella|vistaprint|apartments|accountant|travelers|homedepot|institute|vacations|furniture|fresenius|insurance|christmas|bloomberg|solutions|barcelona|firestone|financial|kuokgroup|fairwinds|community|passagens|goldpoint|equipment|lifestyle|yodobashi|aquarelle|marketing|analytics|education|amsterdam|statefarm|melbourne|allfinanz|directory|microsoft|stockholm|montblanc|accenture|lancaster|landrover|everbank|istanbul|graphics|grainger|ipiranga|softbank|attorney|pharmacy|saarland|catering|airforce|yokohama|mortgage|frontier|mutuelle|stcgroup|memorial|pictures|football|symantec|cipriani|ventures|telecity|cityeats|verisign|flsmidth|boutique|cleaning|firmdale|clinique|clothing|redstone|infiniti|deloitte|feedback|services|broadway|plumbing|commbank|training|barclays|exchange|computer|brussels|software|delivery|barefoot|builders|business|bargains|engineer|holdings|download|security|helsinki|lighting|movistar|discount|hdfcbank|supplies|marriott|property|diamonds|capetown|partners|democrat|jpmorgan|bradesco|budapest|rexroth|zuerich|shriram|academy|science|support|youtube|singles|surgery|alibaba|statoil|dentist|schwarz|android|cruises|cricket|digital|markets|starhub|systems|courses|coupons|netbank|country|domains|corsica|network|neustar|realtor|lincoln|limited|schmidt|yamaxun|cooking|contact|auction|spiegel|liaison|leclerc|latrobe|lasalle|abogado|compare|lanxess|exposed|express|company|cologne|college|avianca|lacaixa|fashion|recipes|ferrero|komatsu|storage|wanggou|clubmed|sandvik|fishing|fitness|bauhaus|kitchen|flights|florist|flowers|watches|weather|temasek|samsung|bentley|forsale|channel|theater|frogans|theatre|okinawa|website|tickets|jewelry|gallery|tiffany|iselect|shiksha|brother|organic|wedding|genting|toshiba|origins|philips|hyundai|hotmail|hoteles|hosting|rentals|windows|cartier|bugatti|holiday|careers|whoswho|hitachi|panerai|caravan|reviews|guitars|capital|trading|hamburg|hangout|finance|stream|family|abbott|health|review|travel|report|hermes|hiphop|gratis|career|toyota|hockey|dating|repair|google|social|soccer|reisen|global|otsuka|giving|unicom|casino|photos|center|broker|rocher|orange|bostik|garden|insure|ryukyu|bharti|safety|physio|sakura|oracle|online|jaguar|gallup|piaget|tienda|futbol|pictet|joburg|webcam|berlin|office|juegos|kaufen|chanel|chrome|xihuan|church|tennis|circle|kinder|flickr|bayern|claims|clinic|viajes|nowruz|xperia|norton|yachts|studio|coffee|camera|sanofi|nissan|author|expert|events|comsec|lawyer|tattoo|viking|estate|villas|condos|realty|yandex|energy|emerck|virgin|vision|durban|living|school|coupon|london|taobao|natura|taipei|nagoya|luxury|walter|aramco|sydney|madrid|credit|maison|makeup|schule|market|anquan|direct|design|swatch|suzuki|alsace|vuelos|dental|alipay|voyage|shouji|voting|airtel|mutual|degree|supply|agency|museum|mobily|dealer|monash|select|mormon|active|moscow|racing|datsun|quebec|nissay|rodeo|email|gifts|works|photo|chloe|edeka|cheap|earth|vista|tushu|koeln|glass|shoes|globo|tunes|gmail|nokia|space|kyoto|black|ricoh|seven|lamer|sener|epson|cisco|praxi|trust|citic|crown|shell|lease|green|legal|lexus|ninja|tatar|gripe|nikon|group|video|wales|autos|gucci|party|nexus|guide|linde|adult|parts|amica|lixil|boats|azure|loans|locus|cymru|lotte|lotto|stada|click|poker|quest|dabur|lupin|nadex|paris|faith|dance|canon|place|gives|trade|skype|rocks|mango|cloud|boots|smile|final|swiss|homes|honda|media|horse|cards|deals|watch|bosch|house|pizza|miami|osaka|tours|total|xerox|coach|sucks|style|delta|toray|iinet|tools|money|codes|beats|tokyo|salon|archi|movie|baidu|study|actor|yahoo|store|apple|world|forex|today|bible|tmall|tirol|irish|tires|forum|reise|vegas|vodka|sharp|omega|weber|jetzt|audio|promo|build|bingo|chase|gallo|drive|dubai|rehab|press|solar|sale|beer|bbva|bank|band|auto|sapo|sarl|saxo|audi|asia|arte|arpa|army|yoga|ally|zara|scor|scot|sexy|seat|zero|seek|aero|adac|zone|aarp|maif|meet|meme|menu|surf|mini|mobi|mtpc|porn|desi|star|ltda|name|talk|navy|love|loan|live|link|news|limo|like|spot|life|nico|lidl|lgbt|land|taxi|team|tech|kred|kpmg|sony|song|kiwi|kddi|jprs|jobs|sohu|java|itau|tips|info|immo|icbc|hsbc|town|host|page|toys|here|help|pars|haus|guru|guge|tube|goog|golf|gold|sncf|gmbh|gift|ggee|gent|gbiz|game|vana|pics|fund|ford|ping|pink|fish|film|fast|farm|play|fans|fail|plus|skin|pohl|fage|moda|post|erni|dvag|prod|doha|prof|docs|viva|diet|luxe|site|dell|sina|dclk|show|qpon|date|vote|cyou|voto|read|coop|cool|wang|club|city|chat|cern|cash|reit|rent|casa|cars|care|camp|rest|call|cafe|weir|wien|rich|wiki|buzz|wine|book|bond|room|work|rsvp|shia|ruhr|blue|bing|shaw|bike|safe|xbox|best|pwc|mtn|lds|aig|boo|fyi|nra|nrw|ntt|car|gal|obi|zip|aeg|vin|how|one|ong|onl|dad|ooo|bet|esq|org|htc|bar|uol|ibm|ovh|gdn|ice|icu|uno|gea|ifm|bot|top|wtf|lol|day|pet|eus|wtc|ubs|tvs|aco|ing|ltd|ink|tab|abb|afl|cat|int|pid|pin|bid|cba|gle|com|cbn|ads|man|wed|ceb|gmo|sky|ist|gmx|tui|mba|fan|ski|iwc|app|pro|med|ceo|jcb|jcp|goo|dev|men|aaa|meo|pub|jlc|bom|jll|gop|jmp|mil|got|gov|win|jot|mma|joy|trv|red|cfa|cfd|bio|moe|moi|mom|ren|biz|aws|xin|bbc|dnp|buy|kfh|mov|thd|xyz|fit|kia|rio|rip|kim|dog|vet|nyc|bcg|mtr|bcn|bms|bmw|run|bzh|rwe|tel|stc|axa|kpn|fly|krd|cab|bnl|foo|crs|eat|tci|sap|srl|nec|sas|net|cal|sbs|sfr|sca|scb|csc|edu|new|xxx|hiv|fox|wme|ngo|nhk|vip|sex|frl|lat|yun|law|you|tax|soy|sew|om|ac|hu|se|sc|sg|sh|sb|sa|rw|ru|rs|ro|re|qa|py|si|pw|pt|ps|sj|sk|pr|pn|pm|pl|sl|sm|pk|sn|ph|so|pg|pf|pe|pa|zw|nz|nu|nr|np|no|nl|ni|ng|nf|sr|ne|st|nc|na|mz|my|mx|mw|mv|mu|mt|ms|mr|mq|mp|mo|su|mn|mm|ml|mk|mh|mg|me|sv|md|mc|sx|sy|ma|ly|lv|sz|lu|lt|ls|lr|lk|li|lc|lb|la|tc|kz|td|ky|kw|kr|kp|kn|km|ki|kh|tf|tg|th|kg|ke|jp|jo|jm|je|it|is|ir|tj|tk|tl|tm|iq|tn|to|io|in|im|il|ie|ad|sd|ht|hr|hn|hm|tr|hk|gy|gw|gu|gt|gs|gr|gq|tt|gp|gn|gm|gl|tv|gi|tw|tz|ua|gh|ug|uk|gg|gf|ge|gd|us|uy|uz|va|gb|ga|vc|ve|fr|fo|fm|fk|fj|vg|vi|fi|eu|et|es|er|eg|ee|ec|dz|do|dm|dk|vn|dj|de|cz|cy|cx|cw|vu|cv|cu|cr|co|cn|cm|cl|ck|ci|ch|cg|cf|cd|cc|ca|wf|bz|by|bw|bv|bt|bs|br|bo|bn|bm|bj|bi|ws|bh|bg|bf|be|bd|bb|ba|az|ax|aw|au|at|as|ye|ar|aq|ao|am|al|yt|ai|za|ag|af|ae|zm|id)\b/}; -b.AnchorTagBuilder=b.Util.extend(Object,{constructor:function(a){b.Util.assign(this,a)},build:function(a){return new b.HtmlTag({tagName:"a",attrs:this.createAttrs(a.getType(),a.getAnchorHref()),innerHtml:this.processAnchorText(a.getAnchorText())})},createAttrs:function(a,b){var c={href:b},f=this.createCssClass(a);f&&(c["class"]=f);this.newWindow&&(c.target="_blank",c.rel="noopener noreferrer");return c},createCssClass:function(a){var b=this.className;return b?b+" "+b+"-"+a:""},processAnchorText:function(a){return a= -this.doTruncate(a)},doTruncate:function(a){var d=this.truncate;if(!d||!d.length)return a;var c=d.length,d=d.location;return"smart"===d?b.truncate.TruncateSmart(a,c,".."):"middle"===d?b.truncate.TruncateMiddle(a,c,".."):b.truncate.TruncateEnd(a,c,"..")}});b.htmlParser.HtmlParser=b.Util.extend(Object,{htmlRegex:function(){var a=/(?:"[^"]*?"|'[^']*?'|[^'"=<>`\s]+)/,b=/[^\s\0"'>\/=\x01-\x1F\x7F]+/.source+"(?:\\s*=\\s*"+a.source+")?";return new RegExp(["(?:<(!DOCTYPE)(?:\\s+(?:",b,"|",a.source+")",")*>)|(?:<(/)?(?:", -/!--([\s\S]+?)--/.source,"|(?:","("+/[0-9a-zA-Z][0-9a-zA-Z:]*/.source+")","(?:\\s*",b,")*\\s*/?))>)"].join(""),"gi")}(),htmlCharacterEntitiesRegex:/( | |<|<|>|>|"|"|')/gi,parse:function(a){for(var b=this.htmlRegex,c,f=0,g=[];null!==(c=b.exec(a));){var h=c[0],k=c[3],l=c[1]||c[4],n=!!c[2];c=c.index;var m=a.substring(f,c);m&&(f=this.parseTextAndEntityNodes(f,m),g.push.apply(g,f));k?g.push(this.createCommentNode(c,h,k)):g.push(this.createElementNode(c,h,l,n));f=c+ -h.length}f`\s]+)/,b=/[^\s\0"'>\/=\x01-\x1F\x7F]+/.source+"(?:\\s*=\\s*"+a.source+")?";return new RegExp(["(?:<(!DOCTYPE)(?:\\s+(?:",b,"|",a.source+")",")*>)|(?:<(/)?(?:", +/!--([\s\S]+?)--/.source,"|(?:","("+/[0-9a-zA-Z][0-9a-zA-Z:]*/.source+")","(?:\\s*",b,")*\\s*/?))>)"].join(""),"gi")}(),htmlCharacterEntitiesRegex:/( | |<|<|>|>|"|"|')/gi,parse:function(a){for(var b=this.htmlRegex,c,g=0,h=[];null!==(c=b.exec(a));){var k=c[0],l=c[3],m=c[1]||c[4],n=!!c[2];c=c.index;var p=a.substring(g,c);p&&(g=this.parseTextAndEntityNodes(g,p),h.push.apply(h,g));l?h.push(this.createCommentNode(c,k,l)):h.push(this.createElementNode(c,k,m,n));g=c+ +k.length}gd&&(g=a.substr(d));return a.substr(0,f)+c+g};if(a.length<=b)return a;var h=b-c.length,k=function(a){var b={},c=a.match(/^([a-z]+):\/\//i);c&&(b.scheme=c[1],a=a.substr(c[0].length));if(c=a.match(/^(.*?)(?=(\?|#|\/|$))/i))b.host=c[1],a=a.substr(c[0].length);if(c=a.match(/^\/(.*?)(?=(\?|#|$))/i))b.path=c[1],a=a.substr(c[0].length);if(c=a.match(/^\?(.*?)(?=(#|$))/i))b.query= -c[1],a=a.substr(c[0].length);if(c=a.match(/^#(.*?)$/i))b.fragment=c[1];return b}(a);if(k.query){var l=k.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);l&&(k.query=k.query.substr(0,l[1].length),a=f(k))}if(a.length<=b)return a;k.host&&(k.host=k.host.replace(/^www\./,""),a=f(k));if(a.length<=b)return a;a="";k.host&&(a+=k.host);if(a.length>=h)return k.host.length==b?(k.host.substr(0,b-c.length)+c).substr(0,b):g(a,h).substr(0,b);f="";k.path&&(f+="/"+k.path);k.query&&(f+="?"+k.query);if(f){if((a+f).length>=h)return(a+ -f).length==b?(a+f).substr(0,b):(a+g(f,h-a.length)).substr(0,b);a+=f}if(k.fragment){f="#"+k.fragment;if((a+f).length>=h)return(a+f).length==b?(a+f).substr(0,b):(a+g(f,h-a.length)).substr(0,b);a+=f}if(k.scheme&&k.host&&(g=k.scheme+"://",(a+g).lengththis.status?a(this.response):d(this.statusText)};c.onerror=function(){d(this.statusText)}})},sendFeedback:function(b){var a=this._data;return this.call({method:"POST",contentType:"application/json;charset=UTF-8",data:JSON.stringify(b),url:a.url.api.host+a.url.api.feedback})},requestContainer:function(b){var a=this._data;return this.call({method:"GET",url:a.url.api.host+a.url.api.get+b})},sendContainer:function(b){var a=this._data; +urlMatchDoesNotHaveAtLeastOneWordChar:function(a,b){return a&&b?!this.hasWordCharAfterProtocolRegex.test(a):!1}};b.truncate.TruncateEnd=function(a,e,c){return b.Util.ellipsis(a,e,c)};b.truncate.TruncateMiddle=function(a,b,c){if(a.length<=b)return a;var g=b-c.length,h="";0e&&(h=a.substr(e));return a.substr(0,g)+c+h};if(a.length<=b)return a;var k=b-c.length,l=function(a){var b={},c=a.match(/^([a-z]+):\/\//i);c&&(b.scheme=c[1],a=a.substr(c[0].length));if(c=a.match(/^(.*?)(?=(\?|#|\/|$))/i))b.host=c[1],a=a.substr(c[0].length);if(c=a.match(/^\/(.*?)(?=(\?|#|$))/i))b.path=c[1],a=a.substr(c[0].length);if(c=a.match(/^\?(.*?)(?=(#|$))/i))b.query= +c[1],a=a.substr(c[0].length);if(c=a.match(/^#(.*?)$/i))b.fragment=c[1];return b}(a);if(l.query){var m=l.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);m&&(l.query=l.query.substr(0,m[1].length),a=g(l))}if(a.length<=b)return a;l.host&&(l.host=l.host.replace(/^www\./,""),a=g(l));if(a.length<=b)return a;a="";l.host&&(a+=l.host);if(a.length>=k)return l.host.length==b?(l.host.substr(0,b-c.length)+c).substr(0,b):h(a,k).substr(0,b);g="";l.path&&(g+="/"+l.path);l.query&&(g+="?"+l.query);if(g){if((a+g).length>=k)return(a+ +g).length==b?(a+g).substr(0,b):(a+h(g,k-a.length)).substr(0,b);a+=g}if(l.fragment){g="#"+l.fragment;if((a+g).length>=k)return(a+g).length==b?(a+g).substr(0,b):(a+h(g,k-a.length)).substr(0,b);a+=g}if(l.scheme&&l.host&&(h=l.scheme+"://",(a+h).lengththis.status?a(this.response):e(this.statusText)};c.onerror=function(){e(this.statusText)}})},sendFeedback:function(b){var a=this._data;return this.call({method:"POST",contentType:"application/json;charset=UTF-8",data:JSON.stringify(b),url:a.url.api.host+a.url.api.feedback})},requestContainer:function(b){var a=this._data;return this.call({method:"GET",url:a.url.api.host+a.url.api.get+b})},sendContainer:function(b){var a=this._data; return this.call({method:"POST",contentType:"application/json;charset=UTF-8",data:JSON.stringify(b),url:a.url.api.host+a.url.api.post})}};window.SECU=window.SECU||{}; window.SECU.Socket={_data:{},initStats:function(){var b=this._data;b.stats=io.connect(window.SECU.Ajax._data.url.api.host+":"+window.SECU.Ajax._data.url.api.port,{secure:!0});b.stats.on("secu-channel:App\\Events\\SecuWasCreated",function(a){window.SECU.App.refreshCount(a.id)})},initChat:function(){var b=this._data,a=window.SECU.App._data.app;b.chat=io.connect(window.SECU.Ajax._data.url.api.host+":"+window.SECU.Ajax._data.url.api.port+"/c",{secure:!0});b.chat.on("connect",function(){window.SECU.Chat.enable()}); b.chat.on("reconnect",function(){window.SECU.Chat.enable()});b.chat.on("connecting",function(){window.SECU.Chat.disable()});b.chat.on("reconnecting",function(){window.SECU.Chat.disable()});b.chat.on("reconnect_failed",function(){window.SECU.Chat.disable()});b.chat.on("disconnect",function(){window.SECU.Chat.disable()});b.chat.on("connect_failed",function(){window.SECU.Chat.disable()});b.chat.on("connect_error",function(){window.SECU.Chat.disable()});b.chat.on("close",function(){window.SECU.Chat.disable()}); @@ -556,44 +655,44 @@ window.SECU.Chat.refreshRoster(a)});b.chat.on("room.data",function(a){a.hasOwnPr window.SECU.Crypt={_data:{encryptionParameters:{iterations:4096,keySize:256,authenticationStrength:128,authenticatedData:"S\u00cbCU",cipherMode:"gcm"}},getRandomHexValue:function(b,a){return sjcl.random.randomWords(b,a)},decrypt:function(b){return sjcl.decrypt(b.password,b.message,{},{})},encrypt:function(b){var a=this._data.encryptionParameters,a={adata:a.authenticatedData+"-"+(new Date).getTime(),iter:a.iterations,mode:a.cipherMode,ts:a.authenticationStrength,ks:a.keySize,iv:this.getRandomHexValue(4, 0),salt:this.getRandomHexValue(2,0)};return sjcl.encrypt(b.password,b.message,a,{})}};window.SECU=window.SECU||{}; window.SECU.Helpers={_data:{},getHumanTime:function(b){function a(a){1===a.toString().length&&(a="0"+a);return a}b=new Date(b);return a(b.getHours())+":"+a(b.getMinutes())},checkVisibility:function(){var b=window.SECU.App._data.app;switch(document.visibilityState){case "hidden":b.set("windowFocused",!1);break;default:b.set("windowFocused",!0)}},watchWindowFocus:function(){document.addEventListener("visibilitychange",this.checkVisibility)},parseNewLines:function(b){return b=b.replace(/(?:\r\n|\r|\n)/g, -"
")},convertToPlainText:function(b){return b.replace(/[&<>"']/g,function(a){return"&"+{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#39"}[a]+";"})},getPosition:function(b){b=b.getBoundingClientRect();var a=document.body,d=document.documentElement;return{top:Math.round(b.top+(window.pageYOffset||d.scrollTop||a.scrollTop)-(d.clientTop||a.clientTop||0)),left:Math.round(b.left+(window.pageXOffset||d.scrollLeft||a.scrollLeft)-(d.clientLeft||a.clientLeft||0))}},generateTimestamp:function(b){var a=null, -a=b?new Date(b):new Date;return a.getTime()},watchResize:function(){window.addEventListener("resize",this.fixChatFeedHeight,!1)},dockNavbar:function(b){window.SECU.App._data.app.set("dock.navbar",b)},watchScroll:function(){var b=this._data,a=window.SECU.App._data.app;b.nav={};b.nav.spacer=document.getElementsByClassName("navbar-spacer")[0];window.addEventListener("scroll",function(d){if(!a.get("show.chat")||a.get("chat.formActive"))document.body.scrollTop>b.nav.spacer.offsetTop?window.SECU.Helpers.dockNavbar(!0): -window.SECU.Helpers.dockNavbar(!1)},!1)},watchDragDrop:function(){function b(b){b.preventDefault();clearTimeout(d.dropTimeout);var f=null,g=null,h=null;switch(b.type){case "dragenter":case "dragover":a.set("dropActive",!0);d.dropTimeout=setTimeout(function(){a.set("dropActive",!1)},1E3);break;case "dragleave":d.dropTimeout=setTimeout(function(){a.set("dropActive",!1)},1E3);break;case "drop":a.set("dropActive",!1),h=b.dataTransfer.files,document.getElementById("chatFile")?(f="room",g="chat.room.rawFile"): -document.getElementById("messageFile")&&(f="encrypt",g="encrypt.rawFile"),h.length&&f&&g&&(a.set(g,[b.dataTransfer.files[0]]),a.fire("checkFile",null,f))}}var a=window.SECU.App._data.app,d=this._data;a.get("supportedFeatures.dragdrop")&&(document.body.addEventListener("dragover",b,!1),document.body.addEventListener("dragenter",b,!1),document.body.addEventListener("dragleave",b,!1),document.body.addEventListener("drop",b,!1))},checkLocation:function(){var b=null;-1")},convertToPlainText:function(b){return b.replace(/[&<>"']/g,function(a){return"&"+{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#39"}[a]+";"})},getPosition:function(b){b=b.getBoundingClientRect();var a=document.body,e=document.documentElement;return{top:Math.round(b.top+(window.pageYOffset||e.scrollTop||a.scrollTop)-(e.clientTop||a.clientTop||0)),left:Math.round(b.left+(window.pageXOffset||e.scrollLeft||a.scrollLeft)-(e.clientLeft||a.clientLeft||0))}},generateTimestamp:function(b){var a=null, +a=b?new Date(b):new Date;return a.getTime()},watchResize:function(){window.addEventListener("resize",this.fixChatFeedHeight,!1)},dockNavbar:function(b){window.SECU.App._data.app.set("dock.navbar",b)},watchScroll:function(){var b=this._data,a=window.SECU.App._data.app;b.nav={};b.nav.spacer=document.getElementsByClassName("navbar-spacer")[0];window.addEventListener("scroll",function(e){if(!a.get("show.chat")||a.get("chat.formActive"))document.body.scrollTop>b.nav.spacer.offsetTop?window.SECU.Helpers.dockNavbar(!0): +window.SECU.Helpers.dockNavbar(!1)},!1)},watchDragDrop:function(){function b(b){b.preventDefault();clearTimeout(e.dropTimeout);var g=null,h=null,k=null;switch(b.type){case "dragenter":case "dragover":a.set("dropActive",!0);e.dropTimeout=setTimeout(function(){a.set("dropActive",!1)},1E3);break;case "dragleave":e.dropTimeout=setTimeout(function(){a.set("dropActive",!1)},1E3);break;case "drop":a.set("dropActive",!1),k=b.dataTransfer.files,document.getElementById("chatFile")?(g="room",h="chat.room.rawFile"): +document.getElementById("messageFile")&&(g="encrypt",h="encrypt.rawFile"),k.length&&g&&h&&(a.set(h,[b.dataTransfer.files[0]]),a.fire("checkFile",null,g))}}var a=window.SECU.App._data.app,e=this._data;a.get("supportedFeatures.dragdrop")&&(document.body.addEventListener("dragover",b,!1),document.body.addEventListener("dragenter",b,!1),document.body.addEventListener("dragleave",b,!1),document.body.addEventListener("drop",b,!1))},checkLocation:function(){var b=null;-1c.offsetHeight&&d.set(a+".textareaHeight",c.scrollHeight+2*f+"px")},copyText:function(b){b.select();document.execCommand("copy");b.blur();window.getSelection().removeAllRanges()},formatCounter:function(b){b=parseInt(b,10);return b.toLocaleString()}};window.SECU=window.SECU||{}; -window.SECU.File={_data:{maxFileSize:1572864},base64ToBlob:function(b){var a=atob(b.split(",")[1]);b=b.split(",")[0].split(":")[1].split(";")[0];for(var d=new ArrayBuffer(a.length),c=new Uint8Array(d),f=0;fthis._data.maxFileSize?["The file is too big"]:b:!1}};window.SECU=window.SECU||{};window.SECU.Error={_data:{},show:function(b){var a=window.SECU.Error,d=a._data,c=window.SECU.App._data.app;c.set("errors.messages",b);c.set("errors.show",!0);clearTimeout(d.errorTimeout);d.errorTimeout=setTimeout(function(){a.hide()},3E3)},hide:function(){var b=window.SECU.Error._data;window.SECU.App._data.app.set("errors.show",!1);clearTimeout(b.errorTimeout)}};window.SECU=window.SECU||{}; -window.SECU.Chat={_data:{sentQueue:[]},unreadPos:function(){var b=this.getChat().getElementsByClassName("unread");return b[b.length-1].offsetTop},watchFeedScroll:function(b){function a(a){c.set("chat.room.unread",!1);c.set("chat.room.scrolled",d.scrolledToBottom())}var d=this,c=window.SECU.App._data.app,f=this.getChat();f&&(b?f.removeEventListener("scroll",a,!1):f.addEventListener("scroll",a,!1))},logout:function(b){window.SECU.Socket._data.chat.emit("room.leave",b)},sortRoster:function(b){var a=window.SECU.App._data.app.get("chat.room.connection.name"), -d=null;if(1===b.length||b[0].name===a)return b;for(var c=0;c=b.scrollHeight-b.offsetHeight?!0:!1:!1},updateScroll:function(b){var a=this.getChat();if(a){switch(b){case "top":b=0;break;case "bottom":b=a.scrollHeight}a.scrollTop=b}},decryptData:function(b){var a="",d=null,c=[];if("string"!==typeof b.text)try{a=window.SECU.Crypt.decrypt({message:JSON.stringify(b.text), -password:window.SECU.App._data.app.get("chat.room.connection.key")})}catch(f){a="Error. Couldn't decrypt text data."}else a=b.text;b.files&&b.files.length&&(d=b.files[0],c[0]={name:d.name,extension:window.SECU.File.getExtension(d.name)},c[0].data="string"===typeof d.data?window.SECU.File.base64ToBlob(d.data):window.SECU.File.base64ToBlob(window.SECU.Crypt.decrypt({message:JSON.stringify(d.data),password:window.SECU.App._data.app.get("chat.room.connection.key")})));return{text:a,files:c}},appendOwnData:function(b){this.appendData(this.extractSentQueue(b.sent_at))}, -appendData:function(b){var a=window.SECU.App._data.app,d=this.scrolledToBottom(),c=a.get("windowFocused");b.data=this.decryptData(b.data);b.data.text=window.SECU.Helpers.convertToPlainText(b.data.text);b.data.text=window.SECU.Helpers.parseNewLines(b.data.text);b.data.text=window.SECU.Helpers.Autolinker.link(b.data.text);b.delivered_at=b.delivered_at||window.SECU.Helpers.generateTimestamp();a.get("chat.room.unread")||c&&a.get("show.chat")&&(!this.scrollPresent()||d)||(a.set("chat.room.feed.*.unread", -!1),b.unread=!0);a.push("chat.room.feed",b);c?b.sender===a.get("chat.room.connection.name")||d?(a.set("chat.room.feed.*.unread",!1),this.updateScroll("bottom")):!this.scrollPresent()&&a.get("show.chat")||a.set("chat.room.unread",!0):(a.set("chat.room.unread",!0),a.set("chat.room.scrolled",this.scrolledToBottom()));a.get("supportedFeatures.notification")&&!c&&(a=null,a="SYS"===b.sender?b.data.text:b.sender+" has sent a message",window.SECU.Notifications.fire({body:a}))},sendData:function(b){window.SECU.Socket._data.chat.emit("room.data", +"download"in document.createElement("a"))},checkDragDrop:function(){var b=document.createElement("div");window.SECU.App._data.app.set("supportedFeatures.dragdrop","ondragstart"in b&&"ondrop"in b)},fixChatFeedHeight:function(){var b=window.SECU.Helpers,a=document.getElementById("chat-feed-block"),e=document.getElementById("chat-form-block"),c=window.SECU.Chat.scrolledToBottom();a&&(a.style.height="0px",a.style.height=b.getPosition(e).top-b.getPosition(a).top+"px",c&&window.SECU.Chat.updateScroll("bottom"))}, +fixTextareaHeight:function(b,a){var e=window.SECU.App._data.app,c=b?b.node:document.getElementById(a+"ContainerBody"),g=getComputedStyle(c).getPropertyValue("border-width"),g=g.length?parseInt(g,10):1;e.set(a+".textareaHeight","0px");c.scrollHeight>c.offsetHeight&&e.set(a+".textareaHeight",c.scrollHeight+2*g+"px")},copyText:function(b){b.select();document.execCommand("copy");b.blur();window.getSelection().removeAllRanges()},formatCounter:function(b){b=parseInt(b,10);return b.toLocaleString()}};window.SECU=window.SECU||{}; +window.SECU.File={_data:{maxFileSize:1572864},base64ToBlob:function(b){var a=atob(b.split(",")[1]);b=b.split(",")[0].split(":")[1].split(";")[0];for(var e=new ArrayBuffer(a.length),c=new Uint8Array(e),g=0;gthis._data.maxFileSize?["The file is too big"]:b:!1}};window.SECU=window.SECU||{};window.SECU.Error={_data:{},show:function(b){var a=window.SECU.Error,e=a._data,c=window.SECU.App._data.app;c.set("errors.messages",b);c.set("errors.show",!0);clearTimeout(e.errorTimeout);e.errorTimeout=setTimeout(function(){a.hide()},3E3)},hide:function(){var b=window.SECU.Error._data;window.SECU.App._data.app.set("errors.show",!1);clearTimeout(b.errorTimeout)}};window.SECU=window.SECU||{}; +window.SECU.Chat={_data:{sentQueue:[]},unreadPos:function(){var b=this.getChat().getElementsByClassName("unread");return b[b.length-1].offsetTop},watchFeedScroll:function(b){function a(a){c.set("chat.room.unread",!1);c.set("chat.room.scrolled",e.scrolledToBottom())}var e=this,c=window.SECU.App._data.app,g=this.getChat();g&&(b?g.removeEventListener("scroll",a,!1):g.addEventListener("scroll",a,!1))},logout:function(b){window.SECU.Socket._data.chat.emit("room.leave",b)},sortRoster:function(b){var a=window.SECU.App._data.app.get("chat.room.connection.name"), +e=null;if(1===b.length||b[0].name===a)return b;for(var c=0;c=b.scrollHeight-b.offsetHeight?!0:!1:!1},updateScroll:function(b){var a=this.getChat();if(a){switch(b){case "top":b=0;break;case "bottom":b=a.scrollHeight}a.scrollTop=b}},decryptData:function(b){var a="",e=null,c=[];if("string"!==typeof b.text)try{a=window.SECU.Crypt.decrypt({message:JSON.stringify(b.text), +password:window.SECU.App._data.app.get("chat.room.connection.key")})}catch(g){a="Error. Couldn't decrypt text data."}else a=b.text;b.files&&b.files.length&&(e=b.files[0],c[0]={name:e.name,extension:window.SECU.File.getExtension(e.name)},c[0].data="string"===typeof e.data?window.SECU.File.base64ToBlob(e.data):window.SECU.File.base64ToBlob(window.SECU.Crypt.decrypt({message:JSON.stringify(e.data),password:window.SECU.App._data.app.get("chat.room.connection.key")})));return{text:a,files:c}},appendOwnData:function(b){this.appendData(this.extractSentQueue(b.sent_at))}, +appendData:function(b){var a=window.SECU.App._data.app,e=this.scrolledToBottom(),c=a.get("windowFocused");b.data=this.decryptData(b.data);b.data.text=window.SECU.Helpers.convertToPlainText(b.data.text);b.data.text=window.SECU.Helpers.parseNewLines(b.data.text);b.data.text=window.SECU.Helpers.Autolinker.link(b.data.text);b.delivered_at=b.delivered_at||window.SECU.Helpers.generateTimestamp();a.get("chat.room.unread")||c&&a.get("show.chat")&&(!this.scrollPresent()||e)||(a.set("chat.room.feed.*.unread", +!1),b.unread=!0);a.push("chat.room.feed",b);c?b.sender===a.get("chat.room.connection.name")||e?(a.set("chat.room.feed.*.unread",!1),this.updateScroll("bottom")):!this.scrollPresent()&&a.get("show.chat")||a.set("chat.room.unread",!0):(a.set("chat.room.unread",!0),a.set("chat.room.scrolled",this.scrolledToBottom()));a.get("supportedFeatures.notification")&&!c&&(a=null,a="SYS"===b.sender?b.data.text:b.sender+" has sent a message",window.SECU.Notifications.fire({body:a}))},sendData:function(b){window.SECU.Socket._data.chat.emit("room.data", b)},refreshRoster:function(b){window.SECU.App._data.app.set("chat.room.roster",b)},join:function(b){window.SECU.Socket._data.chat.emit("room.join",b)},create:function(b){window.SECU.Socket._data.chat.emit("room.create",{password:b.password})},enable:function(){window.SECU.App._data.app.set("chat.enabled",!0)},disable:function(){var b=window.SECU.App._data.app;b.get("show.chat")&&window.SECU.App._data.app.fire("toggleView",null,"main");b.get("chat.room.connection.key").length&&(window.SECU.App.reinitApp("chat"), -window.SECU.Error.show(["Connection error"]));b.set("chat.enabled",!1);this.watchFeedScroll(!0)},start:function(b){var a=window.SECU.App._data.app,d=window.SECU.Ajax._data.url,c=a.get("chat.form.room");a.set("chat.done",!0);a.set("chat.room.connection",{link:d.web.host+d.web.chat+c,room:c,name:b.name,key:b.key});this.appendData({sender:"SYS",data:{text:b.name+" joined the room"}});a.set("chat.formActive",!1);a.set("chat.form",{room:"",password:""});a.set("dock.chat",!0);window.SECU.Helpers.dockNavbar(!0); +window.SECU.Error.show(["Connection error"]));b.set("chat.enabled",!1);this.watchFeedScroll(!0)},start:function(b){var a=window.SECU.App._data.app,e=window.SECU.Ajax._data.url,c=a.get("chat.form.room");a.set("chat.done",!0);a.set("chat.room.connection",{link:e.web.host+e.web.chat+c,room:c,name:b.name,key:b.key});this.appendData({sender:"SYS",data:{text:b.name+" joined the room"}});a.set("chat.formActive",!1);a.set("chat.form",{room:"",password:""});a.set("dock.chat",!0);window.SECU.Helpers.dockNavbar(!0); setTimeout(function(){window.SECU.Helpers.fixChatFeedHeight()},0);this.watchFeedScroll();a.get("supportedFeatures.notification")&&window.SECU.Notifications.init()},init:function(){window.SECU.Helpers.fixChatFeedHeight();this.watchFeedScroll();window.SECU.App._data.app.get("chat.room.unread")?this.updateScroll(this.unreadPos()):this.updateScroll("bottom")}};window.SECU=window.SECU||{}; window.SECU.Notifications={_data:{active:null,activeTimeout:null,timeout:4E3},fire:function(b){if("granted"===Notification.permission){var a=this._data;clearTimeout(a.activeTimeout);a.active&&(b.vibrate=200);b.tag="SECU_SYS";b.icon="/images/secu.png";a.active=new Notification("S\u00cbCU",b);a.activeTimeout=setTimeout(function(){a.active.close();a.active=null},a.timeout)}},init:function(){if("denied"!==Notification.permission){var b=this;"granted"!==Notification.permission&&Notification.requestPermission(function(a){"granted"=== a&&b.fire({body:"Thanks!"})})}}};Ractive.DEBUG=!1;window.SECU=window.SECU||{}; window.SECU.App={_data:{params:{encrypt:{done:!1,link:"",formActive:!0,formDisabled:!1,rawFile:[],fileData:{size:"",name:"",extension:""},file:{message:"",password:""},form:{message:"",password:""},textareaHeight:"0px"},decrypt:{done:!1,success:!0,hash:"",loaded:!1,formDisabled:!1,formActive:!1,message:"",files:[],fileForm:{message:"",password:""},form:{message:"",password:""},textareaHeight:"0px"},feedback:{formDisabled:!1,sent:!1,form:{body:"",email:""},textareaHeight:"0px"},chat:{enabled:!1,done:!1, -formDisabled:!1,formActive:!0,room:{scrolled:!0,unread:!1,connection:{link:"",room:"",name:"",key:""},feed:[],roster:[],rawFile:[],fileData:{size:"",name:"",extension:""},input:{text:"",file:""},feedHeight:"0px"},form:{room:"",password:""}}}},reinitApp:function(b){var a=this._data,d=a.app;d.set("textCopied",!1);d.set("dropActive",!1);b&&(window.SECU.Error.hide(),history.replaceState({},"S\u00ebcu","/"));switch(b){case "package":d.set("decrypt",JSON.parse(JSON.stringify(a.params.decrypt)));d.set("encrypt", -JSON.parse(JSON.stringify(a.params.encrypt)));break;case "feedback":d.set("feedback",JSON.parse(JSON.stringify(a.params.feedback)));break;case "chat":d.set("chat",JSON.parse(JSON.stringify(a.params.chat)));break;default:d.set("decrypt",JSON.parse(JSON.stringify(a.params.decrypt))),d.set("encrypt",JSON.parse(JSON.stringify(a.params.encrypt))),d.set("feedback",JSON.parse(JSON.stringify(a.params.feedback))),d.set("chat",JSON.parse(JSON.stringify(a.params.chat)))}},refreshCount:function(b){var a=this._data; -a.app.set("counter.number",window.SECU.Helpers.formatCounter(b));a.app.set("counter.show",!0)},init:function(){var b=this,a=this._data,d=new Ractive({el:document.getElementsByClassName("secuApp")[0],template:"#secuApp",data:{windowFocused:!0,dock:{navbar:!1,chat:!1},modal:{active:!1,closeText:"Close"},counter:{show:!1,number:"9000"},show:{main:!0,chat:!1,faq:!1,feedback:!1},textCopied:!1,dropActive:!1,supportedFeatures:{copy:!0,download:!0,dragdrop:!0},errors:{show:!1,messages:[]},humanTime:window.SECU.Helpers.getHumanTime}}); -a.app=d;this.reinitApp();d.on({scrollToBottom:function(){this.get("chat.room.unread")?window.SECU.Chat.updateScroll(window.SECU.Chat.unreadPos()):window.SECU.Chat.updateScroll("bottom")},cancelSubmit:function(){return!1},hideError:function(){window.SECU.Error.hide()},chatLogout:function(){window.SECU.Chat.logout({room:this.get("chat.room.connection.room")});b.reinitApp("chat");window.SECU.Chat.enable();this.set("dock.chat",!1);window.SECU.Helpers.dockNavbar(!1);this.fire("modalClose")},showChatLogout:function(){this.set("modal.type", +formDisabled:!1,formActive:!0,room:{scrolled:!0,unread:!1,connection:{link:"",room:"",name:"",key:""},feed:[],roster:[],rawFile:[],fileData:{size:"",name:"",extension:""},input:{text:"",file:""},feedHeight:"0px"},form:{room:"",password:""}}}},reinitApp:function(b){var a=this._data,e=a.app;e.set("textCopied",!1);e.set("dropActive",!1);b&&(window.SECU.Error.hide(),history.replaceState({},"S\u00ebcu","/"));switch(b){case "package":e.set("decrypt",JSON.parse(JSON.stringify(a.params.decrypt)));e.set("encrypt", +JSON.parse(JSON.stringify(a.params.encrypt)));break;case "feedback":e.set("feedback",JSON.parse(JSON.stringify(a.params.feedback)));break;case "chat":e.set("chat",JSON.parse(JSON.stringify(a.params.chat)));break;default:e.set("decrypt",JSON.parse(JSON.stringify(a.params.decrypt))),e.set("encrypt",JSON.parse(JSON.stringify(a.params.encrypt))),e.set("feedback",JSON.parse(JSON.stringify(a.params.feedback))),e.set("chat",JSON.parse(JSON.stringify(a.params.chat)))}},refreshCount:function(b){var a=this._data; +a.app.set("counter.number",window.SECU.Helpers.formatCounter(b));a.app.set("counter.show",!0)},init:function(){var b=this,a=this._data,e=new Ractive({el:document.getElementsByClassName("secuApp")[0],template:"#secuApp",data:{windowFocused:!0,dock:{navbar:!1,chat:!1},modal:{active:!1,closeText:"Close"},counter:{show:!1,number:"9000"},show:{main:!0,chat:!1,faq:!1,feedback:!1},textCopied:!1,dropActive:!1,supportedFeatures:{copy:!0,download:!0,dragdrop:!0},errors:{show:!1,messages:[]},humanTime:window.SECU.Helpers.getHumanTime}}); +a.app=e;this.reinitApp();e.on({scrollToBottom:function(){this.get("chat.room.unread")?window.SECU.Chat.updateScroll(window.SECU.Chat.unreadPos()):window.SECU.Chat.updateScroll("bottom")},cancelSubmit:function(){return!1},hideError:function(){window.SECU.Error.hide()},chatLogout:function(){window.SECU.Chat.logout({room:this.get("chat.room.connection.room")});b.reinitApp("chat");window.SECU.Chat.enable();this.set("dock.chat",!1);window.SECU.Helpers.dockNavbar(!1);this.fire("modalClose")},showChatLogout:function(){this.set("modal.type", "chatLogout");this.set("modal.closeText","No");this.set("modal.active",!0)},showChatLink:function(){this.set("modal.type","chatLink");this.set("modal.closeText","Close");this.set("modal.active",!0)},showChatUsers:function(){this.set("modal.type","chatRoster");this.set("modal.closeText","Close");this.set("modal.active",!0)},modalClose:function(){document.activeElement.blur();this.set("modal.active",!1)},toggleView:function(a,b){a&&a.original&&a.original.preventDefault();if(this.get("show."+b))return!1; -window.SECU.Error.hide();var g=this.get("show"),h;for(h in g)this.set("show."+h,!1);this.set("show."+b,!0);"chat"===b?this.get("chat.formActive")||(this.set("dock.chat",!0),window.SECU.Helpers.dockNavbar(!0),setTimeout(function(){window.SECU.Chat.init();(!window.SECU.Chat.scrollPresent()||window.SECU.Chat.scrollPresent()&&window.SECU.Chat.scrolledToBottom())&&d.set("chat.room.unread",!1)},0)):(this.set("dock.chat",!1),window.SECU.Chat.watchFeedScroll(!0),window.SECU.Helpers.dockNavbar(!1))},sendFeedback:function(a){a&& +window.SECU.Error.hide();var h=this.get("show"),k;for(k in h)this.set("show."+k,!1);this.set("show."+b,!0);"chat"===b?this.get("chat.formActive")||(this.set("dock.chat",!0),window.SECU.Helpers.dockNavbar(!0),setTimeout(function(){window.SECU.Chat.init();(!window.SECU.Chat.scrollPresent()||window.SECU.Chat.scrollPresent()&&window.SECU.Chat.scrolledToBottom())&&e.set("chat.room.unread",!1)},0)):(this.set("dock.chat",!1),window.SECU.Chat.watchFeedScroll(!0),window.SECU.Helpers.dockNavbar(!1))},sendFeedback:function(a){a&& a.original&&a.original.preventDefault();a=this.get("feedback.form");var b=this;window.SECU.Error.hide();if(!a.body.length)return window.SECU.Error.show(["The message can't be empty"]),!1;b.set("feedback.formDisabled",!0);window.SECU.Ajax.sendFeedback(a).then(function(a){b.set("feedback.sent",!0);b.set("feedback.formDisabled",!1);b.set("feedback.form",{body:"",email:""})},function(a){window.SECU.Error.show([a])})},fixTextareaHeight:window.SECU.Helpers.fixTextareaHeight,attachFile:function(a,b){a&& -a.original&&a.original.preventDefault();var d=null;switch(b){case "room":d={raw:"chat.room.rawFile",ractive:"chat.room.input.file",id:"#chatFile"};break;case "encrypt":d={raw:"encrypt.rawFile",ractive:"encrypt.file.message",id:"#messageFile"}}this.get(d.raw).length?(this.set(d.raw,[]),this.set(d.ractive,""),this.find(d.id).value=""):this.find(d.id).click()},downloadFile:function(a){this.get("supportedFeatures.download")||(a&&a.original&&a.original.preventDefault(),window.open(a.node.href,"_blank").focus())}, -checkFile:function(a,b){window.SECU.Error.hide();var d=this,h=null;switch(b){case "room":h={raw:"chat.room.rawFile",ractive:"chat.room.input.file",data:"chat.room.fileData"};break;case "encrypt":h={raw:"encrypt.rawFile",ractive:"encrypt.file.message",data:"encrypt.fileData"}}h||window.SECU.Error.show(["No file domain"]);var k=window.SECU.File.validated(this.get(h.raw));if(k&&!k[0]){var l=window.SECU.File.prettifySize(k.size),n=window.SECU.File.getExtension(k.name);window.SECU.File.fileToBase64(k).then(function(a){d.set(h.ractive, -a);d.set(h.data,{name:k.name,size:l,extension:n})},function(a){window.SECU.Error.show([a])})}else this.set(h.data,{name:"",size:"",extension:""}),k[0]&&(this.set(h.raw,[]),window.SECU.Error.show(["The file is too big"]))},resetApp:function(a,d){a&&a.original&&a.original.preventDefault();b.reinitApp(d)},requestContainer:function(a,b){a&&a.original&&a.original.preventDefault();var d=this,h=null;d.set("decrypt.formDisabled",!0);window.SECU.Ajax.requestContainer(b).then(function(a){a=JSON.parse(a);"string"=== -typeof a.data.text?(d.set("decrypt.message",a.data.text),d.set("decrypt.done",!0),a.data.text.length&&setTimeout(function(){window.SECU.Helpers.fixTextareaHeight(null,"decrypt")},0)):d.set("decrypt.form.message",JSON.stringify(a.data.text));a.data.files&&a.data.files[0]&&(h=a.data.files[0],d.set("decrypt.files.0.name",h.name),d.set("decrypt.files.0.extension",window.SECU.File.getExtension(h.name)),"string"===typeof h.data?(d.set("decrypt.done",!0),d.set("decrypt.files.0.data",window.SECU.File.base64ToBlob(h.data))): -d.set("decrypt.fileForm.message",JSON.stringify(h.data)));d.set("decrypt.loaded",!0);d.set("decrypt.formActive",!0);d.set("decrypt.formDisabled",!1)},function(a){window.SECU.Error.show([a])})},selectInput:function(a){a.node.select()},copyText:function(a,b){a&&a.original&&a.original.preventDefault();var d=this;window.SECU.Helpers.copyText(document.getElementById(b));this.set("textCopied",!0);setTimeout(function(){d.set("textCopied",!1)},1E3)},sendChat:function(a){a&&a.original&&a.original.preventDefault(); -a=this.get("chat.room");var b=a.input.text,d=a.input.file;if(b.trim().length||d.length){var b=b.trim().length?JSON.parse(window.SECU.Crypt.encrypt({message:b,password:a.connection.key})):"",d=d.length?[{data:JSON.parse(window.SECU.Crypt.encrypt({message:d,password:a.connection.key})),name:a.fileData.name}]:[],h=window.SECU.Helpers.generateTimestamp();a={room:a.connection.room,data:{text:b,files:d},sent_at:h};window.SECU.Chat.addSentQueue(a);window.SECU.Chat.sendData(a);this.set("chat.room.input", +a.original&&a.original.preventDefault();var e=null;switch(b){case "room":e={raw:"chat.room.rawFile",ractive:"chat.room.input.file",id:"#chatFile"};break;case "encrypt":e={raw:"encrypt.rawFile",ractive:"encrypt.file.message",id:"#messageFile"}}this.get(e.raw).length?(this.set(e.raw,[]),this.set(e.ractive,""),this.find(e.id).value=""):this.find(e.id).click()},downloadFile:function(a){this.get("supportedFeatures.download")||(a&&a.original&&a.original.preventDefault(),window.open(a.node.href,"_blank").focus())}, +checkFile:function(a,b){window.SECU.Error.hide();var e=this,k=null;switch(b){case "room":k={raw:"chat.room.rawFile",ractive:"chat.room.input.file",data:"chat.room.fileData"};break;case "encrypt":k={raw:"encrypt.rawFile",ractive:"encrypt.file.message",data:"encrypt.fileData"}}k||window.SECU.Error.show(["No file domain"]);var l=window.SECU.File.validated(this.get(k.raw));if(l&&!l[0]){var m=window.SECU.File.prettifySize(l.size),n=window.SECU.File.getExtension(l.name);window.SECU.File.fileToBase64(l).then(function(a){e.set(k.ractive, +a);e.set(k.data,{name:l.name,size:m,extension:n})},function(a){window.SECU.Error.show([a])})}else this.set(k.data,{name:"",size:"",extension:""}),l[0]&&(this.set(k.raw,[]),window.SECU.Error.show(["The file is too big"]))},resetApp:function(a,e){a&&a.original&&a.original.preventDefault();b.reinitApp(e)},requestContainer:function(a,b){a&&a.original&&a.original.preventDefault();var e=this,k=null;e.set("decrypt.formDisabled",!0);window.SECU.Ajax.requestContainer(b).then(function(a){a=JSON.parse(a);"string"=== +typeof a.data.text?(e.set("decrypt.message",a.data.text),e.set("decrypt.done",!0),a.data.text.length&&setTimeout(function(){window.SECU.Helpers.fixTextareaHeight(null,"decrypt")},0)):e.set("decrypt.form.message",JSON.stringify(a.data.text));a.data.files&&a.data.files[0]&&(k=a.data.files[0],e.set("decrypt.files.0.name",k.name),e.set("decrypt.files.0.extension",window.SECU.File.getExtension(k.name)),"string"===typeof k.data?(e.set("decrypt.done",!0),e.set("decrypt.files.0.data",window.SECU.File.base64ToBlob(k.data))): +e.set("decrypt.fileForm.message",JSON.stringify(k.data)));e.set("decrypt.loaded",!0);e.set("decrypt.formActive",!0);e.set("decrypt.formDisabled",!1)},function(a){window.SECU.Error.show([a])})},selectInput:function(a){a.node.select()},copyText:function(a,b){a&&a.original&&a.original.preventDefault();var e=this;window.SECU.Helpers.copyText(document.getElementById(b));this.set("textCopied",!0);setTimeout(function(){e.set("textCopied",!1)},1E3)},sendChat:function(a){a&&a.original&&a.original.preventDefault(); +a=this.get("chat.room");var b=a.input.text,e=a.input.file;if(b.trim().length||e.length){var b=b.trim().length?JSON.parse(window.SECU.Crypt.encrypt({message:b,password:a.connection.key})):"",e=e.length?[{data:JSON.parse(window.SECU.Crypt.encrypt({message:e,password:a.connection.key})),name:a.fileData.name}]:[],k=window.SECU.Helpers.generateTimestamp();a={room:a.connection.room,data:{text:b,files:e},sent_at:k};window.SECU.Chat.addSentQueue(a);window.SECU.Chat.sendData(a);this.set("chat.room.input", {text:"",file:""});this.set("chat.room.rawFile",[]);this.find("#chatFile").value=""}},createChat:function(a){a&&a.original&&a.original.preventDefault();window.SECU.Error.hide();if(!this.get("chat.form.password").length)return window.SECU.Error.show(["You should provide a password"]),!1;this.set("chat.formDisabled",!0);a=this.get("chat.form");a.room.length?window.SECU.Chat.join(a):window.SECU.Chat.create(a)},createContainer:function(a){a&&a.original&&a.original.preventDefault();window.SECU.Error.hide(); -if(!this.get("encrypt.form.message").length&&!this.get("encrypt.rawFile").length)return window.SECU.Error.show(["There should be either message or file"]),!1;this.set("encrypt.formDisabled",!0);var b=this;a=this.get("encrypt.form.password");var d="",h=[],d=a.length?JSON.parse(window.SECU.Crypt.encrypt(this.get("encrypt.form"))):this.get("encrypt.form.message");this.get("encrypt.rawFile").length&&(a.length?(this.set("encrypt.file.password",a),h.push({data:JSON.parse(window.SECU.Crypt.encrypt(this.get("encrypt.file"))), -name:this.get("encrypt.fileData.name")})):h.push({data:this.get("encrypt.file.message"),name:this.get("encrypt.fileData.name")}));window.SECU.Ajax.sendContainer({data:{text:d,files:h}}).then(function(a){a=JSON.parse(a);b.set("encrypt.link",window.SECU.Ajax._data.url.web.host+window.SECU.Ajax._data.url.web.page+a.hash);b.set("encrypt.formActive",!1);b.set("encrypt.done",!0);b.set("encrypt.formDisabled",!1);setTimeout(function(){document.getElementById("containerLink").select()},0)},function(a){window.SECU.Error.show([a])})}, +if(!this.get("encrypt.form.message").length&&!this.get("encrypt.rawFile").length)return window.SECU.Error.show(["There should be either message or file"]),!1;this.set("encrypt.formDisabled",!0);var b=this;a=this.get("encrypt.form.password");var e="",k=[],e=a.length?JSON.parse(window.SECU.Crypt.encrypt(this.get("encrypt.form"))):this.get("encrypt.form.message");this.get("encrypt.rawFile").length&&(a.length?(this.set("encrypt.file.password",a),k.push({data:JSON.parse(window.SECU.Crypt.encrypt(this.get("encrypt.file"))), +name:this.get("encrypt.fileData.name")})):k.push({data:this.get("encrypt.file.message"),name:this.get("encrypt.fileData.name")}));window.SECU.Ajax.sendContainer({data:{text:e,files:k}}).then(function(a){a=JSON.parse(a);b.set("encrypt.link",window.SECU.Ajax._data.url.web.host+window.SECU.Ajax._data.url.web.page+a.hash);b.set("encrypt.formActive",!1);b.set("encrypt.done",!0);b.set("encrypt.formDisabled",!1);setTimeout(function(){document.getElementById("containerLink").select()},0)},function(a){window.SECU.Error.show([a])})}, decryptContainer:function(a){a&&a.original&&a.original.preventDefault();window.SECU.Error.hide();if(!this.get("decrypt.form.password").length)return window.SECU.Error.show(["You must provide a password"]),!1;a=this.get("decrypt.form.password");this.set("decrypt.formDisabled",!0);this.set("decrypt.fileForm.password",a);if(this.get("decrypt.form.message").length)try{this.set("decrypt.message",window.SECU.Crypt.decrypt(this.get("decrypt.form")))}catch(b){this.set("decrypt.success",!1)}if(this.get("decrypt.fileForm.message").length)try{this.set("decrypt.files.0.data", window.SECU.File.base64ToBlob(window.SECU.Crypt.decrypt(this.get("decrypt.fileForm"))))}catch(b){this.set("decrypt.success",!1)}this.set("decrypt.fileForm",{message:"",password:""});this.set("decrypt.form",{message:"",password:""});this.set("decrypt.done",!0);this.set("decrypt.formDisabled",!1);this.get("decrypt.success")&&this.get("decrypt.message").length&&setTimeout(function(){window.SECU.Helpers.fixTextareaHeight(null,"decrypt");setTimeout(function(){document.getElementById("decryptContainerBody").select()}, -0)},0)}});d.observe("windowFocused",function(a,b,d){a&&this.get("show.chat")&&(window.SECU.Chat.scrollPresent()||this.set("chat.room.unread",!1))});window.SECU.Helpers.Autolinker=new Autolinker({twitter:!1});window.SECU.Helpers.checkLocation();window.SECU.Helpers.checkCopy();window.SECU.Helpers.checkDownload();window.SECU.Helpers.checkDragDrop();window.SECU.Helpers.checkNotification();window.SECU.Helpers.watchDragDrop();window.SECU.Helpers.watchScroll();window.SECU.Helpers.watchResize();window.SECU.Helpers.watchWindowFocus(); +0)},0)}});e.observe("windowFocused",function(a,b,e){a&&this.get("show.chat")&&(window.SECU.Chat.scrollPresent()||this.set("chat.room.unread",!1))});window.SECU.Helpers.Autolinker=new Autolinker({twitter:!1});window.SECU.Helpers.checkLocation();window.SECU.Helpers.checkCopy();window.SECU.Helpers.checkDownload();window.SECU.Helpers.checkDragDrop();window.SECU.Helpers.checkNotification();window.SECU.Helpers.watchDragDrop();window.SECU.Helpers.watchScroll();window.SECU.Helpers.watchResize();window.SECU.Helpers.watchWindowFocus(); window.SECU.Helpers.checkVisibility();window.SECU.Ajax.assignHost();window.SECU.Socket.init()}};window.SECU.App.init(); diff --git a/source/css/_skeleton.scss b/source/css/_skeleton.scss index 50122e7..c694d06 100644 --- a/source/css/_skeleton.scss +++ b/source/css/_skeleton.scss @@ -206,8 +206,8 @@ input[type="submit"].button-primary, input[type="reset"].button-primary, input[type="button"].button-primary { color: #FFF; - background-color: #33C3F0; - border-color: #33C3F0; } + background-color: #555; + border-color: #555; } .button.button-primary:hover, button.button-primary:hover, input[type="submit"].button-primary:hover, @@ -219,8 +219,8 @@ input[type="submit"].button-primary:focus, input[type="reset"].button-primary:focus, input[type="button"].button-primary:focus { color: #FFF; - background-color: #1EAEDB; - border-color: #1EAEDB; } + background-color: #666; + border-color: #666; } .button.no-padding{ padding: 0; } diff --git a/source/js/ractive.js b/source/js/ractive.js index 8cec691..9d4388a 100644 --- a/source/js/ractive.js +++ b/source/js/ractive.js @@ -1,60 +1,60 @@ /* - Ractive.js v0.7.3 - Sat Apr 25 2015 13:52:38 GMT-0400 (EDT) - commit da40f81c660ba2f09c45a09a9c20fdd34ee36d80 + Ractive.js v0.8.7 + Wed Dec 07 2016 01:37:29 GMT+0000 (UTC) - commit c734e03d202b67fc68dd27d7ae9a9c40505543f4 - http://ractivejs.org - http://twitter.com/RactiveJS + http://ractivejs.org + http://twitter.com/RactiveJS - Released under the MIT License. + Released under the MIT License. */ + (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - global.Ractive = factory() + ((function() { var current = global.Ractive; var next = factory(); next.noConflict = function() { global.Ractive = current; return next; }; return global.Ractive = next; })()); }(this, function () { 'use strict'; - var TEMPLATE_VERSION = 3; - - var defaultOptions = { - - // render placement: - el: void 0, - append: false, - - // template: - template: { v: TEMPLATE_VERSION, t: [] }, - - // parse: // TODO static delimiters? - preserveWhitespace: false, - sanitize: false, - stripComments: true, - delimiters: ["{{", "}}"], - tripleDelimiters: ["{{{", "}}}"], - interpolate: false, - - // data & binding: - data: {}, - computed: {}, - magic: false, - modifyArrays: true, - adapt: [], - isolated: false, - twoway: true, - lazy: false, - - // transitions: - noIntro: false, - transitionsEnabled: true, - complete: void 0, - - // css: - css: null, - noCssTransform: false + var defaults = { + // render placement: + el: void 0, + append: false, + + // template: + template: null, + + // parse: + delimiters: [ '{{', '}}' ], + tripleDelimiters: [ '{{{', '}}}' ], + staticDelimiters: [ '[[', ']]' ], + staticTripleDelimiters: [ '[[[', ']]]' ], + csp: true, + interpolate: false, + preserveWhitespace: false, + sanitize: false, + stripComments: true, + contextLines: 0, + + // data & binding: + data: {}, + computed: {}, + magic: false, + modifyArrays: false, + adapt: [], + isolated: false, + twoway: true, + lazy: false, + + // transitions: + noIntro: false, + transitionsEnabled: true, + complete: void 0, + + // css: + css: null, + noCssTransform: false }; - var config_defaults = defaultOptions; - // These are a subset of the easing equations found at // https://raw.github.com/danro/easing-js - license info // follows: @@ -78,2919 +78,3319 @@ // You can add additional easing functions to this list, and they // will be globally available. - var static_easing = { - linear: function (pos) { - return pos; - }, - easeIn: function (pos) { - return Math.pow(pos, 3); - }, - easeOut: function (pos) { - return Math.pow(pos - 1, 3) + 1; - }, - easeInOut: function (pos) { - if ((pos /= 0.5) < 1) { - return 0.5 * Math.pow(pos, 3); - } - return 0.5 * (Math.pow(pos - 2, 3) + 2); - } + + var easing = { + linear: function ( pos ) { return pos; }, + easeIn: function ( pos ) { return Math.pow( pos, 3 ); }, + easeOut: function ( pos ) { return ( Math.pow( ( pos - 1 ), 3 ) + 1 ); }, + easeInOut: function ( pos ) { + if ( ( pos /= 0.5 ) < 1 ) { return ( 0.5 * Math.pow( pos, 3 ) ); } + return ( 0.5 * ( Math.pow( ( pos - 2 ), 3 ) + 2 ) ); + } }; - /*global console, navigator */ - var isClient, isJsdom, hasConsole, environment__magic, namespaces, svg, vendors; + var legacy = null; - isClient = typeof document === "object"; + /*global console, navigator */ - isJsdom = typeof navigator !== "undefined" && /jsDom/.test(navigator.appName); + var win = typeof window !== 'undefined' ? window : null; + var doc = win ? document : null; - hasConsole = typeof console !== "undefined" && typeof console.warn === "function" && typeof console.warn.apply === "function"; + var isClient = !!doc; + var isJsdom = ( typeof navigator !== 'undefined' && /jsDom/.test( navigator.appName ) ); + var hasConsole = ( typeof console !== 'undefined' && typeof console.warn === 'function' && typeof console.warn.apply === 'function' ); + var magicSupported; try { - Object.defineProperty({}, "test", { value: 0 }); - environment__magic = true; - } catch (e) { - environment__magic = false; - } - - namespaces = { - html: "http://www.w3.org/1999/xhtml", - mathml: "http://www.w3.org/1998/Math/MathML", - svg: "http://www.w3.org/2000/svg", - xlink: "http://www.w3.org/1999/xlink", - xml: "http://www.w3.org/XML/1998/namespace", - xmlns: "http://www.w3.org/2000/xmlns/" - }; - - if (typeof document === "undefined") { - svg = false; - } else { - svg = document && document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"); - } - - vendors = ["o", "ms", "moz", "webkit"]; - - var createElement, matches, dom__div, methodNames, unprefixed, prefixed, dom__i, j, makeFunction; - + Object.defineProperty({}, 'test', { value: 0 }); + magicSupported = true; + } catch ( e ) { + magicSupported = false; + } + + var svg = doc ? + doc.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1' ) : + false; + + var vendors = [ 'o', 'ms', 'moz', 'webkit' ]; + + var html = 'http://www.w3.org/1999/xhtml'; + var mathml = 'http://www.w3.org/1998/Math/MathML'; + var svg$1 = 'http://www.w3.org/2000/svg'; + var xlink = 'http://www.w3.org/1999/xlink'; + var xml = 'http://www.w3.org/XML/1998/namespace'; + var xmlns = 'http://www.w3.org/2000/xmlns'; + + var namespaces = { html: html, mathml: mathml, svg: svg$1, xlink: xlink, xml: xml, xmlns: xmlns }; + + var createElement; + var matches; + var div; + var methodNames; + var unprefixed; + var prefixed; + var i; + var j; + var makeFunction; // Test for SVG support - if (!svg) { - createElement = function (type, ns) { - if (ns && ns !== namespaces.html) { - throw "This browser does not support namespaces other than http://www.w3.org/1999/xhtml. The most likely cause of this error is that you're trying to render SVG in an older browser. See http://docs.ractivejs.org/latest/svg-and-older-browsers for more information"; - } - - return document.createElement(type); - }; + if ( !svg ) { + createElement = function ( type, ns, extend ) { + if ( ns && ns !== html ) { + throw 'This browser does not support namespaces other than http://www.w3.org/1999/xhtml. The most likely cause of this error is that you\'re trying to render SVG in an older browser. See http://docs.ractivejs.org/latest/svg-and-older-browsers for more information'; + } + + return extend ? + doc.createElement( type, extend ) : + doc.createElement( type ); + }; } else { - createElement = function (type, ns) { - if (!ns || ns === namespaces.html) { - return document.createElement(type); - } + createElement = function ( type, ns, extend ) { + if ( !ns || ns === html ) { + return extend ? + doc.createElement( type, extend ) : + doc.createElement( type ); + } + + return extend ? + doc.createElementNS( ns, type, extend ) : + doc.createElementNS( ns, type ); + }; + } - return document.createElementNS(ns, type); - }; + function createDocumentFragment () { + return doc.createDocumentFragment(); } - function getElement(input) { - var output; + function getElement ( input ) { + var output; - if (!input || typeof input === "boolean") { - return; - } + if ( !input || typeof input === 'boolean' ) { return; } - if (typeof window === "undefined" || !document || !input) { - return null; - } + if ( !win || !doc || !input ) { + return null; + } - // We already have a DOM node - no work to do. (Duck typing alert!) - if (input.nodeType) { - return input; - } + // We already have a DOM node - no work to do. (Duck typing alert!) + if ( input.nodeType ) { + return input; + } - // Get node from string - if (typeof input === "string") { - // try ID first - output = document.getElementById(input); + // Get node from string + if ( typeof input === 'string' ) { + // try ID first + output = doc.getElementById( input ); - // then as selector, if possible - if (!output && document.querySelector) { - output = document.querySelector(input); - } + // then as selector, if possible + if ( !output && doc.querySelector ) { + output = doc.querySelector( input ); + } - // did it work? - if (output && output.nodeType) { - return output; - } - } + // did it work? + if ( output && output.nodeType ) { + return output; + } + } - // If we've been given a collection (jQuery, Zepto etc), extract the first item - if (input[0] && input[0].nodeType) { - return input[0]; - } + // If we've been given a collection (jQuery, Zepto etc), extract the first item + if ( input[0] && input[0].nodeType ) { + return input[0]; + } - return null; + return null; } - if (!isClient) { - matches = null; + if ( !isClient ) { + matches = null; } else { - dom__div = createElement("div"); - methodNames = ["matches", "matchesSelector"]; + div = createElement( 'div' ); + methodNames = [ 'matches', 'matchesSelector' ]; - makeFunction = function (methodName) { - return function (node, selector) { - return node[methodName](selector); - }; - }; + makeFunction = function ( methodName ) { + return function ( node, selector ) { + return node[ methodName ]( selector ); + }; + }; - dom__i = methodNames.length; + i = methodNames.length; - while (dom__i-- && !matches) { - unprefixed = methodNames[dom__i]; + while ( i-- && !matches ) { + unprefixed = methodNames[i]; - if (dom__div[unprefixed]) { - matches = makeFunction(unprefixed); - } else { - j = vendors.length; - while (j--) { - prefixed = vendors[dom__i] + unprefixed.substr(0, 1).toUpperCase() + unprefixed.substring(1); + if ( div[ unprefixed ] ) { + matches = makeFunction( unprefixed ); + } else { + j = vendors.length; + while ( j-- ) { + prefixed = vendors[i] + unprefixed.substr( 0, 1 ).toUpperCase() + unprefixed.substring( 1 ); - if (dom__div[prefixed]) { - matches = makeFunction(prefixed); - break; - } - } - } - } + if ( div[ prefixed ] ) { + matches = makeFunction( prefixed ); + break; + } + } + } + } - // IE8... - if (!matches) { - matches = function (node, selector) { - var nodes, parentNode, i; + // IE8... + if ( !matches ) { + matches = function ( node, selector ) { + var nodes, parentNode, i; - parentNode = node.parentNode; + parentNode = node.parentNode; - if (!parentNode) { - // empty dummy
- dom__div.innerHTML = ""; + if ( !parentNode ) { + // empty dummy
+ div.innerHTML = ''; - parentNode = dom__div; - node = node.cloneNode(); + parentNode = div; + node = node.cloneNode(); - dom__div.appendChild(node); - } + div.appendChild( node ); + } - nodes = parentNode.querySelectorAll(selector); + nodes = parentNode.querySelectorAll( selector ); - i = nodes.length; - while (i--) { - if (nodes[i] === node) { - return true; - } - } + i = nodes.length; + while ( i-- ) { + if ( nodes[i] === node ) { + return true; + } + } - return false; - }; - } + return false; + }; + } } - function detachNode(node) { - if (node && typeof node.parentNode !== "unknown" && node.parentNode) { - node.parentNode.removeChild(node); - } + function detachNode ( node ) { + if ( node && typeof node.parentNode !== 'unknown' && node.parentNode ) { + node.parentNode.removeChild( node ); + } - return node; + return node; } - function safeToStringValue(value) { - return value == null || !value.toString ? "" : value; + function safeToStringValue ( value ) { + return ( value == null || !value.toString ) ? '' : '' + value; } - var legacy = null; + function safeAttributeString ( string ) { + return safeToStringValue( string ) + .replace( /&/g, '&' ) + .replace( /"/g, '"' ) + .replace( /'/g, ''' ); + } + + var camel = /(-.)/g; + function camelize ( string ) { + return string.replace( camel, function ( s ) { return s.charAt( 1 ).toUpperCase(); } ); + } - var create, defineProperty, defineProperties; + var decamel = /[A-Z]/g; + function decamelize ( string ) { + return string.replace( decamel, function ( s ) { return ("-" + (s.toLowerCase())); } ); + } + var create; + var defineProperty; + var defineProperties; try { - Object.defineProperty({}, "test", { value: 0 }); + Object.defineProperty({}, 'test', { get: function() {}, set: function() {} }); - if (isClient) { - Object.defineProperty(document.createElement("div"), "test", { value: 0 }); - } + if ( doc ) { + Object.defineProperty( createElement( 'div' ), 'test', { value: 0 }); + } - defineProperty = Object.defineProperty; - } catch (err) { - // Object.defineProperty doesn't exist, or we're in IE8 where you can - // only use it with DOM objects (what were you smoking, MSFT?) - defineProperty = function (obj, prop, desc) { - obj[prop] = desc.value; - }; + defineProperty = Object.defineProperty; + } catch ( err ) { + // Object.defineProperty doesn't exist, or we're in IE8 where you can + // only use it with DOM objects (what were you smoking, MSFT?) + defineProperty = function ( obj, prop, desc ) { + if ( desc.get ) obj[ prop ] = desc.get(); + else obj[ prop ] = desc.value; + }; } try { - try { - Object.defineProperties({}, { test: { value: 0 } }); - } catch (err) { - // TODO how do we account for this? noMagic = true; - throw err; - } - - if (isClient) { - Object.defineProperties(createElement("div"), { test: { value: 0 } }); - } - - defineProperties = Object.defineProperties; - } catch (err) { - defineProperties = function (obj, props) { - var prop; - - for (prop in props) { - if (props.hasOwnProperty(prop)) { - defineProperty(obj, prop, props[prop]); - } - } - }; + try { + Object.defineProperties({}, { test: { value: 0 } }); + } catch ( err ) { + // TODO how do we account for this? noMagic = true; + throw err; + } + + if ( doc ) { + Object.defineProperties( createElement( 'div' ), { test: { value: 0 } }); + } + + defineProperties = Object.defineProperties; + } catch ( err ) { + defineProperties = function ( obj, props ) { + var prop; + + for ( prop in props ) { + if ( props.hasOwnProperty( prop ) ) { + defineProperty( obj, prop, props[ prop ] ); + } + } + }; } try { - Object.create(null); + Object.create( null ); - create = Object.create; - } catch (err) { - // sigh - create = (function () { - var F = function () {}; + create = Object.create; + } catch ( err ) { + // sigh + create = (function () { + var F = function () {}; - return function (proto, props) { - var obj; + return function ( proto, props ) { + var obj; - if (proto === null) { - return {}; - } + if ( proto === null ) { + return {}; + } - F.prototype = proto; - obj = new F(); + F.prototype = proto; + obj = new F(); - if (props) { - Object.defineProperties(obj, props); - } + if ( props ) { + Object.defineProperties( obj, props ); + } - return obj; - }; - })(); + return obj; + }; + }()); } - function utils_object__extend(target) { - for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - sources[_key - 1] = arguments[_key]; - } + function extendObj ( target ) { + var sources = [], len = arguments.length - 1; + while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ]; - var prop, source; + var prop; - while (source = sources.shift()) { - for (prop in source) { - if (hasOwn.call(source, prop)) { - target[prop] = source[prop]; - } - } - } + sources.forEach( function ( source ) { + for ( prop in source ) { + if ( hasOwn.call( source, prop ) ) { + target[ prop ] = source[ prop ]; + } + } + }); - return target; + return target; } - function fillGaps(target) { - for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - sources[_key - 1] = arguments[_key]; - } + function fillGaps ( target ) { + var sources = [], len = arguments.length - 1; + while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ]; - sources.forEach(function (s) { - for (var key in s) { - if (s.hasOwnProperty(key) && !(key in target)) { - target[key] = s[key]; - } - } - }); + sources.forEach( function ( s ) { + for ( var key in s ) { + if ( hasOwn.call( s, key ) && !( key in target ) ) { + target[ key ] = s[ key ]; + } + } + }); - return target; + return target; } var hasOwn = Object.prototype.hasOwnProperty; + var toString = Object.prototype.toString; // thanks, http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/ - var is__toString = Object.prototype.toString, - arrayLikePattern = /^\[object (?:Array|FileList)\]$/; - function isArray(thing) { - return is__toString.call(thing) === "[object Array]"; + function isArray ( thing ) { + return toString.call( thing ) === '[object Array]'; + } + + function isEqual ( a, b ) { + if ( a === null && b === null ) { + return true; + } + + if ( typeof a === 'object' || typeof b === 'object' ) { + return false; + } + + return a === b; + } + + // http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric + function isNumeric ( thing ) { + return !isNaN( parseFloat( thing ) ) && isFinite( thing ); + } + + function isObject ( thing ) { + return ( thing && toString.call( thing ) === '[object Object]' ); + } + + function noop () {} + + var alreadyWarned = {}; + var log; + var printWarning; + var welcome; + if ( hasConsole ) { + var welcomeIntro = [ + ("%cRactive.js %c0.8.7 %cin debug mode, %cmore..."), + 'color: rgb(114, 157, 52); font-weight: normal;', + 'color: rgb(85, 85, 85); font-weight: normal;', + 'color: rgb(85, 85, 85); font-weight: normal;', + 'color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;' + ]; + var welcomeMessage = "You're running Ractive 0.8.7 in debug mode - messages will be printed to the console to help you fix problems and optimise your application.\n\nTo disable debug mode, add this line at the start of your app:\n Ractive.DEBUG = false;\n\nTo disable debug mode when your app is minified, add this snippet:\n Ractive.DEBUG = /unminified/.test(function(){/*unminified*/});\n\nGet help and support:\n http://docs.ractivejs.org\n http://stackoverflow.com/questions/tagged/ractivejs\n http://groups.google.com/forum/#!forum/ractive-js\n http://twitter.com/ractivejs\n\nFound a bug? Raise an issue:\n https://github.com/ractivejs/ractive/issues\n\n"; + + welcome = function () { + if ( Ractive.WELCOME_MESSAGE === false ) { + welcome = noop; + return; + } + var message = 'WELCOME_MESSAGE' in Ractive ? Ractive.WELCOME_MESSAGE : welcomeMessage; + var hasGroup = !!console.groupCollapsed; + if ( hasGroup ) console.groupCollapsed.apply( console, welcomeIntro ); + console.log( message ); + if ( hasGroup ) { + console.groupEnd( welcomeIntro ); + } + + welcome = noop; + }; + + printWarning = function ( message, args ) { + welcome(); + + // extract information about the instance this message pertains to, if applicable + if ( typeof args[ args.length - 1 ] === 'object' ) { + var options = args.pop(); + var ractive = options ? options.ractive : null; + + if ( ractive ) { + // if this is an instance of a component that we know the name of, add + // it to the message + var name; + if ( ractive.component && ( name = ractive.component.name ) ) { + message = "<" + name + "> " + message; + } + + var node; + if ( node = ( options.node || ( ractive.fragment && ractive.fragment.rendered && ractive.find( '*' ) ) ) ) { + args.push( node ); + } + } + } + + console.warn.apply( console, [ '%cRactive.js: %c' + message, 'color: rgb(114, 157, 52);', 'color: rgb(85, 85, 85);' ].concat( args ) ); + }; + + log = function () { + console.log.apply( console, arguments ); + }; + } else { + printWarning = log = welcome = noop; } - function isArrayLike(obj) { - return arrayLikePattern.test(is__toString.call(obj)); + function format ( message, args ) { + return message.replace( /%s/g, function () { return args.shift(); } ); } - function isEqual(a, b) { - if (a === null && b === null) { - return true; - } - - if (typeof a === "object" || typeof b === "object") { - return false; - } - - return a === b; - } + function fatal ( message ) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; - function is__isNumeric(thing) { - return !isNaN(parseFloat(thing)) && isFinite(thing); + message = format( message, args ); + throw new Error( message ); } - function isObject(thing) { - return thing && is__toString.call(thing) === "[object Object]"; + function logIfDebug () { + if ( Ractive.DEBUG ) { + log.apply( null, arguments ); + } } - var noop = function () {}; + function warn ( message ) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; - /* global console */ - var alreadyWarned = {}, - log, - printWarning, - welcome; - - if (hasConsole) { - (function () { - var welcomeIntro = ["%cRactive.js %c0.7.3 %cin debug mode, %cmore...", "color: rgb(114, 157, 52); font-weight: normal;", "color: rgb(85, 85, 85); font-weight: normal;", "color: rgb(85, 85, 85); font-weight: normal;", "color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;"]; - var welcomeMessage = "You're running Ractive 0.7.3 in debug mode - messages will be printed to the console to help you fix problems and optimise your application.\n\nTo disable debug mode, add this line at the start of your app:\n Ractive.DEBUG = false;\n\nTo disable debug mode when your app is minified, add this snippet:\n Ractive.DEBUG = /unminified/.test(function(){/*unminified*/});\n\nGet help and support:\n http://docs.ractivejs.org\n http://stackoverflow.com/questions/tagged/ractivejs\n http://groups.google.com/forum/#!forum/ractive-js\n http://twitter.com/ractivejs\n\nFound a bug? Raise an issue:\n https://github.com/ractivejs/ractive/issues\n\n"; - - welcome = function () { - var hasGroup = !!console.groupCollapsed; - console[hasGroup ? "groupCollapsed" : "log"].apply(console, welcomeIntro); - console.log(welcomeMessage); - if (hasGroup) { - console.groupEnd(welcomeIntro); - } - - welcome = noop; - }; - - printWarning = function (message, args) { - welcome(); + message = format( message, args ); + printWarning( message, args ); + } - // extract information about the instance this message pertains to, if applicable - if (typeof args[args.length - 1] === "object") { - var options = args.pop(); - var ractive = options ? options.ractive : null; + function warnOnce ( message ) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; - if (ractive) { - // if this is an instance of a component that we know the name of, add - // it to the message - var _name = undefined; - if (ractive.component && (_name = ractive.component.name)) { - message = "<" + _name + "> " + message; - } + message = format( message, args ); - var node = undefined; - if (node = options.node || ractive.fragment && ractive.fragment.rendered && ractive.find("*")) { - args.push(node); - } - } - } + if ( alreadyWarned[ message ] ) { + return; + } - console.warn.apply(console, ["%cRactive.js: %c" + message, "color: rgb(114, 157, 52);", "color: rgb(85, 85, 85);"].concat(args)); - }; + alreadyWarned[ message ] = true; + printWarning( message, args ); + } - log = function () { - console.log.apply(console, arguments); - }; - })(); - } else { - printWarning = log = welcome = noop; + function warnIfDebug () { + if ( Ractive.DEBUG ) { + warn.apply( null, arguments ); + } } - function format(message, args) { - return message.replace(/%s/g, function () { - return args.shift(); - }); + function warnOnceIfDebug () { + if ( Ractive.DEBUG ) { + warnOnce.apply( null, arguments ); + } } - function fatal(message) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } + // Error messages that are used (or could be) in multiple places + var badArguments = 'Bad arguments'; + var noRegistryFunctionReturn = 'A function was specified for "%s" %s, but no %s was returned'; + var missingPlugin = function ( name, type ) { return ("Missing \"" + name + "\" " + type + " plugin. You may need to download a plugin via http://docs.ractivejs.org/latest/plugins#" + type + "s"); }; - message = format(message, args); - throw new Error(message); + function findInViewHierarchy ( registryName, ractive, name ) { + var instance = findInstance( registryName, ractive, name ); + return instance ? instance[ registryName ][ name ] : null; } - function logIfDebug() { - if (_Ractive.DEBUG) { - log.apply(null, arguments); - } - } + function findInstance ( registryName, ractive, name ) { + while ( ractive ) { + if ( name in ractive[ registryName ] ) { + return ractive; + } - function warn(message) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } + if ( ractive.isolated ) { + return null; + } - message = format(message, args); - printWarning(message, args); + ractive = ractive.parent; + } } - function warnOnce(message) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } + function interpolate ( from, to, ractive, type ) { + if ( from === to ) return null; - message = format(message, args); + if ( type ) { + var interpol = findInViewHierarchy( 'interpolators', ractive, type ); + if ( interpol ) return interpol( from, to ) || null; - if (alreadyWarned[message]) { - return; - } + fatal( missingPlugin( type, 'interpolator' ) ); + } - alreadyWarned[message] = true; - printWarning(message, args); + return interpolators.number( from, to ) || + interpolators.array( from, to ) || + interpolators.object( from, to ) || + null; } - function warnIfDebug() { - if (_Ractive.DEBUG) { - warn.apply(null, arguments); - } + function snap ( to ) { + return function () { return to; }; } - function warnOnceIfDebug() { - if (_Ractive.DEBUG) { - warnOnce.apply(null, arguments); - } - } + var interpolators = { + number: function ( from, to ) { + var delta; - // Error messages that are used (or could be) in multiple places - var badArguments = "Bad arguments"; - var noRegistryFunctionReturn = "A function was specified for \"%s\" %s, but no %s was returned"; - var missingPlugin = function (name, type) { - return "Missing \"" + name + "\" " + type + " plugin. You may need to download a plugin via http://docs.ractivejs.org/latest/plugins#" + type + "s"; - }; + if ( !isNumeric( from ) || !isNumeric( to ) ) { + return null; + } - function findInViewHierarchy(registryName, ractive, name) { - var instance = findInstance(registryName, ractive, name); - return instance ? instance[registryName][name] : null; - } + from = +from; + to = +to; - function findInstance(registryName, ractive, name) { - while (ractive) { - if (name in ractive[registryName]) { - return ractive; - } + delta = to - from; - if (ractive.isolated) { - return null; - } + if ( !delta ) { + return function () { return from; }; + } - ractive = ractive.parent; - } - } + return function ( t ) { + return from + ( t * delta ); + }; + }, - var interpolate = function (from, to, ractive, type) { - if (from === to) { - return snap(to); - } + array: function ( from, to ) { + var intermediate, interpolators, len, i; - if (type) { + if ( !isArray( from ) || !isArray( to ) ) { + return null; + } - var interpol = findInViewHierarchy("interpolators", ractive, type); - if (interpol) { - return interpol(from, to) || snap(to); - } + intermediate = []; + interpolators = []; - fatal(missingPlugin(type, "interpolator")); - } + i = len = Math.min( from.length, to.length ); + while ( i-- ) { + interpolators[i] = interpolate( from[i], to[i] ); + } - return static_interpolators.number(from, to) || static_interpolators.array(from, to) || static_interpolators.object(from, to) || snap(to); - }; + // surplus values - don't interpolate, but don't exclude them either + for ( i=len; i elements caused the binding on the - // to update - then we start over - if (batch.ractives.length) return flushChanges(); + if ( item.component && ( parentFragment = item.component.parentFragment ) ) { + return parentFragment.owner; + } } - function attemptKeypathResolution() { - var i, item, keypath, resolved; + function getAncestry ( item ) { + var ancestry = [ item ]; + var ancestor = getParent( item ); - i = unresolved.length; + while ( ancestor ) { + ancestry.push( ancestor ); + ancestor = getParent( ancestor ); + } - // see if we can resolve any unresolved references - while (i--) { - item = unresolved[i]; + return ancestry; + } - if (item.keypath) { - // it resolved some other way. TODO how? two-way binding? Seems - // weird that we'd still end up here - unresolved.splice(i, 1); - continue; // avoid removing the wrong thing should the next condition be true - } - if (keypath = shared_resolveRef(item.root, item.ref, item.parentFragment)) { - (resolved || (resolved = [])).push({ - item: item, - keypath: keypath - }); + var Query = function Query ( ractive, selector, live, isComponentQuery ) { + this.ractive = ractive; + this.selector = selector; + this.live = live; + this.isComponentQuery = isComponentQuery; - unresolved.splice(i, 1); - } - } + this.result = []; - if (resolved) { - resolved.forEach(global_runloop__resolve); - } - } + this.dirty = true; + }; - function global_runloop__resolve(resolved) { - resolved.item.resolve(resolved.keypath); - } + Query.prototype.add = function add ( item ) { + this.result.push( item ); + this.makeDirty(); + }; - var queue = []; + Query.prototype.cancel = function cancel () { + var liveQueries = this._root[ this.isComponentQuery ? 'liveComponentQueries' : 'liveQueries' ]; + var selector = this.selector; - var animations = { - tick: function () { - var i, animation, now; + var index = liveQueries.indexOf( selector ); - now = utils_getTime(); + if ( index !== -1 ) { + liveQueries.splice( index, 1 ); + liveQueries[ selector ] = null; + } + }; - global_runloop.start(); + Query.prototype.init = function init () { + this.dirty = false; + }; - for (i = 0; i < queue.length; i += 1) { - animation = queue[i]; + Query.prototype.makeDirty = function makeDirty () { + var this$1 = this; - if (!animation.tick(now)) { - // animation is complete, remove it from the stack, and decrement i so we don't miss one - queue.splice(i--, 1); - } - } + if ( !this.dirty ) { + this.dirty = true; - global_runloop.end(); + // Once the DOM has been updated, ensure the query + // is correctly ordered + runloop.scheduleTask( function () { return this$1.update(); } ); + } + }; - if (queue.length) { - rAF(animations.tick); - } else { - animations.running = false; - } - }, + Query.prototype.remove = function remove ( nodeOrComponent ) { + var index = this.result.indexOf( this.isComponentQuery ? nodeOrComponent.instance : nodeOrComponent ); + if ( index !== -1 ) this.result.splice( index, 1 ); + }; - add: function (animation) { - queue.push(animation); + Query.prototype.update = function update () { + this.result.sort( this.isComponentQuery ? sortByItemPosition : sortByDocumentPosition ); + this.dirty = false; + }; - if (!animations.running) { - animations.running = true; - rAF(animations.tick); - } - }, + Query.prototype.test = function test ( item ) { + return this.isComponentQuery ? + ( !this.selector || item.name === this.selector ) : + ( item ? matches( item, this.selector ) : null ); + }; - // TODO optimise this - abort: function (keypath, root) { - var i = queue.length, - animation; + function Ractive$findAll ( selector, options ) { + if ( !this.el ) throw new Error( ("Cannot call ractive.findAll('" + selector + "', ...) unless instance is rendered to the DOM") ); - while (i--) { - animation = queue[i]; + options = options || {}; + var liveQueries = this._liveQueries; - if (animation.root === root && animation.keypath === keypath) { - animation.stop(); - } - } - } - }; + // Shortcut: if we're maintaining a live query with this + // selector, we don't need to traverse the parallel DOM + var query = liveQueries[ selector ]; + if ( query ) { + // Either return the exact same query, or (if not live) a snapshot + return ( options && options.live ) ? query : query.slice(); + } - var shared_animations = animations; + query = new Query( this, selector, !!options.live, false ); - var Animation = function (options) { - var key; + // Add this to the list of live queries Ractive needs to maintain, + // if applicable + if ( query.live ) { + liveQueries.push( selector ); + liveQueries[ '_' + selector ] = query; + } - this.startTime = Date.now(); + this.fragment.findAll( selector, query ); - // from and to - for (key in options) { - if (options.hasOwnProperty(key)) { - this[key] = options[key]; - } - } + query.init(); + return query.result; + } - this.interpolator = shared_interpolate(this.from, this.to, this.root, this.interpolator); - this.running = true; + function Ractive$findAllComponents ( selector, options ) { + options = options || {}; + var liveQueries = this._liveComponentQueries; - this.tick(); - }; + // Shortcut: if we're maintaining a live query with this + // selector, we don't need to traverse the parallel DOM + var query = liveQueries[ selector ]; + if ( query ) { + // Either return the exact same query, or (if not live) a snapshot + return ( options && options.live ) ? query : query.slice(); + } - Animation.prototype = { - tick: function () { - var elapsed, t, value, timeNow, index, keypath; + query = new Query( this, selector, !!options.live, true ); - keypath = this.keypath; + // Add this to the list of live queries Ractive needs to maintain, + // if applicable + if ( query.live ) { + liveQueries.push( selector ); + liveQueries[ '_' + selector ] = query; + } - if (this.running) { - timeNow = Date.now(); - elapsed = timeNow - this.startTime; + this.fragment.findAllComponents( selector, query ); - if (elapsed >= this.duration) { - if (keypath !== null) { - global_runloop.start(this.root); - this.root.viewmodel.set(keypath, this.to); - global_runloop.end(); - } + query.init(); + return query.result; + } - if (this.step) { - this.step(1, this.to); - } + function Ractive$findComponent ( selector ) { + return this.fragment.findComponent( selector ); + } - this.complete(this.to); + function Ractive$findContainer ( selector ) { + if ( this.container ) { + if ( this.container.component && this.container.component.name === selector ) { + return this.container; + } else { + return this.container.findContainer( selector ); + } + } - index = this.root._animations.indexOf(this); + return null; + } - // TODO investigate why this happens - if (index === -1) { - warnIfDebug("Animation was not found"); - } + function Ractive$findParent ( selector ) { - this.root._animations.splice(index, 1); + if ( this.parent ) { + if ( this.parent.component && this.parent.component.name === selector ) { + return this.parent; + } else { + return this.parent.findParent ( selector ); + } + } - this.running = false; - return false; // remove from the stack - } + return null; + } - t = this.easing ? this.easing(elapsed / this.duration) : elapsed / this.duration; + function enqueue ( ractive, event ) { + if ( ractive.event ) { + ractive._eventQueue.push( ractive.event ); + } - if (keypath !== null) { - value = this.interpolator(t); - global_runloop.start(this.root); - this.root.viewmodel.set(keypath, value); - global_runloop.end(); - } + ractive.event = event; + } - if (this.step) { - this.step(t, value); - } + function dequeue ( ractive ) { + if ( ractive._eventQueue.length ) { + ractive.event = ractive._eventQueue.pop(); + } else { + ractive.event = null; + } + } - return true; // keep in the stack - } + var starMaps = {}; - return false; // remove from the stack - }, + // This function takes a keypath such as 'foo.bar.baz', and returns + // all the variants of that keypath that include a wildcard in place + // of a key, such as 'foo.bar.*', 'foo.*.baz', 'foo.*.*' and so on. + // These are then checked against the dependants map (ractive.viewmodel.depsMap) + // to see if any pattern observers are downstream of one or more of + // these wildcard keypaths (e.g. 'foo.bar.*.status') + function getPotentialWildcardMatches ( keypath ) { + var keys, starMap, mapper, i, result, wildcardKeypath; - stop: function () { - var index; + keys = splitKeypathI( keypath ); + if( !( starMap = starMaps[ keys.length ]) ) { + starMap = getStarMap( keys.length ); + } - this.running = false; + result = []; - index = this.root._animations.indexOf(this); + mapper = function ( star, i ) { + return star ? '*' : keys[i]; + }; - // TODO investigate why this happens - if (index === -1) { - warnIfDebug("Animation was not found"); - } + i = starMap.length; + while ( i-- ) { + wildcardKeypath = starMap[i].map( mapper ).join( '.' ); - this.root._animations.splice(index, 1); - } - }; + if ( !result.hasOwnProperty( wildcardKeypath ) ) { + result.push( wildcardKeypath ); + result[ wildcardKeypath ] = true; + } + } - var animate_Animation = Animation; + return result; + } - var prototype_animate = Ractive$animate; + // This function returns all the possible true/false combinations for + // a given number - e.g. for two, the possible combinations are + // [ true, true ], [ true, false ], [ false, true ], [ false, false ]. + // It does so by getting all the binary values between 0 and e.g. 11 + function getStarMap ( num ) { + var ones = '', max, binary, starMap, mapper, i, j, l, map; - var noAnimation = { stop: noop }; - function Ractive$animate(keypath, to, options) { - var promise, fulfilPromise, k, animation, animations, easing, duration, step, complete, makeValueCollector, currentValues, collectValue, dummy, dummyOptions; + if ( !starMaps[ num ] ) { + starMap = []; - promise = new utils_Promise(function (fulfil) { - return fulfilPromise = fulfil; - }); + while ( ones.length < num ) { + ones += 1; + } - // animate multiple keypaths - if (typeof keypath === "object") { - options = to || {}; - easing = options.easing; - duration = options.duration; + max = parseInt( ones, 2 ); - animations = []; + mapper = function ( digit ) { + return digit === '1'; + }; - // we don't want to pass the `step` and `complete` handlers, as they will - // run for each animation! So instead we'll store the handlers and create - // our own... - step = options.step; - complete = options.complete; + for ( i = 0; i <= max; i += 1 ) { + binary = i.toString( 2 ); + while ( binary.length < num ) { + binary = '0' + binary; + } - if (step || complete) { - currentValues = {}; + map = []; + l = binary.length; + for (j = 0; j < l; j++) { + map.push( mapper( binary[j] ) ); + } + starMap[i] = map; + } - options.step = null; - options.complete = null; + starMaps[ num ] = starMap; + } - makeValueCollector = function (keypath) { - return function (t, value) { - currentValues[keypath] = value; - }; - }; - } + return starMaps[ num ]; + } - for (k in keypath) { - if (keypath.hasOwnProperty(k)) { - if (step || complete) { - collectValue = makeValueCollector(k); - options = { easing: easing, duration: duration }; + var wildcardCache = {}; - if (step) { - options.step = collectValue; - } - } + function fireEvent ( ractive, eventName, options ) { + if ( options === void 0 ) options = {}; - options.complete = complete ? collectValue : noop; - animations.push(animate(this, k, keypath[k], options)); - } - } - - // Create a dummy animation, to facilitate step/complete - // callbacks, and Promise fulfilment - dummyOptions = { easing: easing, duration: duration }; - - if (step) { - dummyOptions.step = function (t) { - return step(t, currentValues); - }; - } - - if (complete) { - promise.then(function (t) { - return complete(t, currentValues); - }); - } - - dummyOptions.complete = fulfilPromise; - - dummy = animate(this, null, null, dummyOptions); - animations.push(dummy); - - promise.stop = function () { - var animation; - - while (animation = animations.pop()) { - animation.stop(); - } - - if (dummy) { - dummy.stop(); - } - }; - - return promise; - } - - // animate a single keypath - options = options || {}; + if ( !eventName ) { return; } - if (options.complete) { - promise.then(options.complete); - } + if ( !options.event ) { + options.event = { + name: eventName, + // until event not included as argument default + _noArg: true + }; + } else { + options.event.name = eventName; + } - options.complete = fulfilPromise; - animation = animate(this, keypath, to, options); - - promise.stop = function () { - return animation.stop(); - }; - return promise; - } - - function animate(root, keypath, to, options) { - var easing, duration, animation, from; - - if (keypath) { - keypath = getKeypath(normalise(keypath)); - } + var eventNames = getWildcardNames( eventName ); - if (keypath !== null) { - from = root.viewmodel.get(keypath); - } + return fireEventAs( ractive, eventNames, options.event, options.args, true ); + } - // cancel any existing animation - // TODO what about upstream/downstream keypaths? - shared_animations.abort(keypath, root); + function getWildcardNames ( eventName ) { + if ( wildcardCache.hasOwnProperty( eventName ) ) { + return wildcardCache[ eventName ]; + } else { + return wildcardCache[ eventName ] = getPotentialWildcardMatches( eventName ); + } + } - // don't bother animating values that stay the same - if (isEqual(from, to)) { - if (options.complete) { - options.complete(options.to); - } + function fireEventAs ( ractive, eventNames, event, args, initialFire ) { - return noAnimation; - } + if ( initialFire === void 0 ) initialFire = false; - // easing function - if (options.easing) { - if (typeof options.easing === "function") { - easing = options.easing; - } else { - easing = root.easing[options.easing]; - } + var subscribers, i, bubble = true; - if (typeof easing !== "function") { - easing = null; - } - } + enqueue( ractive, event ); - // duration - duration = options.duration === undefined ? 400 : options.duration; + for ( i = eventNames.length; i >= 0; i-- ) { + subscribers = ractive._subs[ eventNames[ i ] ]; - // TODO store keys, use an internal set method - animation = new animate_Animation({ - keypath: keypath, - from: from, - to: to, - root: root, - duration: duration, - easing: easing, - interpolator: options.interpolator, + if ( subscribers ) { + bubble = notifySubscribers( ractive, subscribers, event, args ) && bubble; + } + } - // TODO wrap callbacks if necessary, to use instance as context - step: options.step, - complete: options.complete - }); + dequeue( ractive ); - shared_animations.add(animation); - root._animations.push(animation); + if ( ractive.parent && bubble ) { - return animation; - } + if ( initialFire && ractive.component ) { + var fullName = ractive.component.name + '.' + eventNames[ eventNames.length-1 ]; + eventNames = getWildcardNames( fullName ); - var prototype_detach = Ractive$detach; - var prototype_detach__detachHook = new hooks_Hook("detach"); - function Ractive$detach() { - if (this.detached) { - return this.detached; - } + if( event && !event.component ) { + event.component = ractive; + } + } - if (this.el) { - removeFromArray(this.el.__ractive_instances__, this); - } - this.detached = this.fragment.detach(); - prototype_detach__detachHook.fire(this); - return this.detached; + fireEventAs( ractive.parent, eventNames, event, args ); + } + + return bubble; } - var prototype_find = Ractive$find; + function notifySubscribers ( ractive, subscribers, event, args ) { + var originalEvent = null, stopEvent = false; - function Ractive$find(selector) { - if (!this.el) { - return null; - } + if ( event && !event._noArg ) { + args = [ event ].concat( args ); + } - return this.fragment.find(selector); - } + // subscribers can be modified inflight, e.g. "once" functionality + // so we need to copy to make sure everyone gets called + subscribers = subscribers.slice(); - var test = Query$test; - function Query$test(item, noDirty) { - var itemMatches; + for ( var i = 0, len = subscribers.length; i < len; i += 1 ) { + if ( !subscribers[ i ].off && subscribers[ i ].apply( ractive, args ) === false ) { + stopEvent = true; + } + } - if (this._isComponentQuery) { - itemMatches = !this.selector || item.name === this.selector; - } else { - itemMatches = item.node ? matches(item.node, this.selector) : null; - } + if ( event && !event._noArg && stopEvent && ( originalEvent = event.original ) ) { + originalEvent.preventDefault && originalEvent.preventDefault(); + originalEvent.stopPropagation && originalEvent.stopPropagation(); + } - if (itemMatches) { - this.push(item.node || item.instance); + return !stopEvent; + } - if (!noDirty) { - this._makeDirty(); - } + function Ractive$fire ( eventName ) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; - return true; - } + return fireEvent( this, eventName, { args: args }); } - var makeQuery_cancel = function () { - var liveQueries, selector, index; + function badReference ( key ) { + throw new Error( ("An index or key reference (" + key + ") cannot have child properties") ); + } - liveQueries = this._root[this._isComponentQuery ? "liveComponentQueries" : "liveQueries"]; - selector = this.selector; + function resolveAmbiguousReference ( fragment, ref ) { + var localViewmodel = fragment.findContext().root; + var keys = splitKeypathI( ref ); + var key = keys[0]; - index = liveQueries.indexOf(selector); + var hasContextChain; + var crossedComponentBoundary; + var aliases; - if (index !== -1) { - liveQueries.splice(index, 1); - liveQueries[selector] = null; - } - }; + while ( fragment ) { + // repeated fragments + if ( fragment.isIteration ) { + if ( key === fragment.parent.keyRef ) { + if ( keys.length > 1 ) badReference( key ); + return fragment.context.getKeyModel( fragment.key ); + } - var sortByItemPosition = function (a, b) { - var ancestryA, ancestryB, oldestA, oldestB, mutualAncestor, indexA, indexB, fragments, fragmentA, fragmentB; + if ( key === fragment.parent.indexRef ) { + if ( keys.length > 1 ) badReference( key ); + return fragment.context.getKeyModel( fragment.index ); + } + } - ancestryA = getAncestry(a.component || a._ractive.proxy); - ancestryB = getAncestry(b.component || b._ractive.proxy); + // alias node or iteration + if ( ( ( aliases = fragment.owner.aliases ) || ( aliases = fragment.aliases ) ) && aliases.hasOwnProperty( key ) ) { + var model = aliases[ key ]; - oldestA = lastItem(ancestryA); - oldestB = lastItem(ancestryB); + if ( keys.length === 1 ) return model; + else if ( typeof model.joinAll === 'function' ) { + return model.joinAll( keys.slice( 1 ) ); + } + } - // remove items from the end of both ancestries as long as they are identical - // - the final one removed is the closest mutual ancestor - while (oldestA && oldestA === oldestB) { - ancestryA.pop(); - ancestryB.pop(); + if ( fragment.context ) { + // TODO better encapsulate the component check + if ( !fragment.isRoot || fragment.ractive.component ) hasContextChain = true; - mutualAncestor = oldestA; + if ( fragment.context.has( key ) ) { + if ( crossedComponentBoundary ) { + return localViewmodel.createLink( key, fragment.context.joinKey( keys.shift() ), key ).joinAll( keys ); + } - oldestA = lastItem(ancestryA); - oldestB = lastItem(ancestryB); - } + return fragment.context.joinAll( keys ); + } + } - // now that we have the mutual ancestor, we can find which is earliest - oldestA = oldestA.component || oldestA; - oldestB = oldestB.component || oldestB; + if ( fragment.componentParent && !fragment.ractive.isolated ) { + // ascend through component boundary + fragment = fragment.componentParent; + crossedComponentBoundary = true; + } else { + fragment = fragment.parent; + } + } - fragmentA = oldestA.parentFragment; - fragmentB = oldestB.parentFragment; + if ( !hasContextChain ) { + return localViewmodel.joinAll( keys ); + } + } - // if both items share a parent fragment, our job is easy - if (fragmentA === fragmentB) { - indexA = fragmentA.items.indexOf(oldestA); - indexB = fragmentB.items.indexOf(oldestB); + var stack = []; + var captureGroup; - // if it's the same index, it means one contains the other, - // so we see which has the longest ancestry - return indexA - indexB || ancestryA.length - ancestryB.length; - } + function startCapturing () { + stack.push( captureGroup = [] ); + } - // if mutual ancestor is a section, we first test to see which section - // fragment comes first - if (fragments = mutualAncestor.fragments) { - indexA = fragments.indexOf(fragmentA); - indexB = fragments.indexOf(fragmentB); + function stopCapturing () { + var dependencies = stack.pop(); + captureGroup = stack[ stack.length - 1 ]; + return dependencies; + } - return indexA - indexB || ancestryA.length - ancestryB.length; - } + function capture ( model ) { + if ( captureGroup ) { + captureGroup.push( model ); + } + } - throw new Error("An unexpected condition was met while comparing the position of two components. Please file an issue at https://github.com/RactiveJS/Ractive/issues - thanks!"); + var KeyModel = function KeyModel ( key, parent ) { + this.value = key; + this.isReadonly = this.isKey = true; + this.deps = []; + this.links = []; + this.parent = parent; }; - function getParent(item) { - var parentFragment; + KeyModel.prototype.get = function get ( shouldCapture ) { + if ( shouldCapture ) capture( this ); + return unescapeKey( this.value ); + }; - if (parentFragment = item.parentFragment) { - return parentFragment.owner; - } + KeyModel.prototype.getKeypath = function getKeypath () { + return unescapeKey( this.value ); + }; - if (item.component && (parentFragment = item.component.parentFragment)) { - return parentFragment.owner; - } - } + KeyModel.prototype.rebinding = function rebinding ( next, previous ) { + var this$1 = this; - function getAncestry(item) { - var ancestry, ancestor; + var i = this.deps.length; + while ( i-- ) this$1.deps[i].rebinding( next, previous, false ); - ancestry = [item]; + i = this.links.length; + while ( i-- ) this$1.links[i].rebinding( next, previous, false ); + }; - ancestor = getParent(item); + KeyModel.prototype.register = function register ( dependant ) { + this.deps.push( dependant ); + }; - while (ancestor) { - ancestry.push(ancestor); - ancestor = getParent(ancestor); - } + KeyModel.prototype.registerLink = function registerLink ( link ) { + addToArray( this.links, link ); + }; - return ancestry; - } + KeyModel.prototype.unregister = function unregister ( dependant ) { + removeFromArray( this.deps, dependant ); + }; + + KeyModel.prototype.unregisterLink = function unregisterLink ( link ) { + removeFromArray( this.links, link ); + }; - var sortByDocumentPosition = function (node, otherNode) { - var bitmask; + function bind$1 ( x ) { x.bind(); } + function cancel ( x ) { x.cancel(); } + function handleChange ( x ) { x.handleChange(); } + function mark ( x ) { x.mark(); } + function marked ( x ) { x.marked(); } + function notifiedUpstream ( x ) { x.notifiedUpstream(); } + function render ( x ) { x.render(); } + function teardown ( x ) { x.teardown(); } + function unbind ( x ) { x.unbind(); } + function unrender ( x ) { x.unrender(); } + function unrenderAndDestroy ( x ) { x.unrender( true ); } + function update ( x ) { x.update(); } + function toString$1 ( x ) { return x.toString(); } + function toEscapedString ( x ) { return x.toString( true ); } + + var KeypathModel = function KeypathModel ( parent, ractive ) { + this.parent = parent; + this.ractive = ractive; + this.value = ractive ? parent.getKeypath( ractive ) : parent.getKeypath(); + this.deps = []; + this.children = {}; + this.isReadonly = this.isKeypath = true; + }; - if (node.compareDocumentPosition) { - bitmask = node.compareDocumentPosition(otherNode); - return bitmask & 2 ? 1 : -1; - } + KeypathModel.prototype.get = function get ( shouldCapture ) { + if ( shouldCapture ) capture( this ); + return this.value; + }; - // In old IE, we can piggy back on the mechanism for - // comparing component positions - return sortByItemPosition(node, otherNode); + KeypathModel.prototype.getChild = function getChild ( ractive ) { + if ( !( ractive._guid in this.children ) ) { + var model = new KeypathModel( this.parent, ractive ); + this.children[ ractive._guid ] = model; + model.owner = this; + } + return this.children[ ractive._guid ]; }; - var sort = function () { - this.sort(this._isComponentQuery ? sortByItemPosition : sortByDocumentPosition); - this._dirty = false; + KeypathModel.prototype.getKeypath = function getKeypath () { + return this.value; }; - var makeQuery_dirty = function () { - var _this = this; + KeypathModel.prototype.handleChange = function handleChange$1 () { + var this$1 = this; - if (!this._dirty) { - this._dirty = true; + var keys = Object.keys( this.children ); + var i = keys.length; + while ( i-- ) { + this$1.children[ keys[i] ].handleChange(); + } - // Once the DOM has been updated, ensure the query - // is correctly ordered - global_runloop.scheduleTask(function () { - _this._sort(); - }); - } + this.deps.forEach( handleChange ); }; - var remove = function (nodeOrComponent) { - var index = this.indexOf(this._isComponentQuery ? nodeOrComponent.instance : nodeOrComponent); + KeypathModel.prototype.rebindChildren = function rebindChildren ( next ) { + var this$1 = this; - if (index !== -1) { - this.splice(index, 1); - } + var keys = Object.keys( this.children ); + var i = keys.length; + while ( i-- ) { + var child = this$1.children[keys[i]]; + child.value = next.getKeypath( child.ractive ); + child.handleChange(); + } }; - var _makeQuery = makeQuery; - function makeQuery(ractive, selector, live, isComponentQuery) { - var query = []; - - defineProperties(query, { - selector: { value: selector }, - live: { value: live }, + KeypathModel.prototype.rebinding = function rebinding ( next, previous ) { + var this$1 = this; - _isComponentQuery: { value: isComponentQuery }, - _test: { value: test } - }); + var model = next ? next.getKeypathModel( this.ractive ) : undefined; - if (!live) { - return query; - } + var keys = Object.keys( this.children ); + var i = keys.length; + while ( i-- ) { + this$1.children[ keys[i] ].rebinding( next, previous, false ); + } - defineProperties(query, { - cancel: { value: makeQuery_cancel }, + i = this.deps.length; + while ( i-- ) { + this$1.deps[i].rebinding( model, this$1, false ); + } + }; - _root: { value: ractive }, - _sort: { value: sort }, - _makeDirty: { value: makeQuery_dirty }, - _remove: { value: remove }, + KeypathModel.prototype.register = function register ( dep ) { + this.deps.push( dep ); + }; - _dirty: { value: false, writable: true } - }); + KeypathModel.prototype.removeChild = function removeChild( model ) { + if ( model.ractive ) delete this.children[ model.ractive._guid ]; + }; - return query; - } + KeypathModel.prototype.teardown = function teardown () { + var this$1 = this; - var prototype_findAll = Ractive$findAll; - function Ractive$findAll(selector, options) { - var liveQueries, query; + if ( this.owner ) this.owner.removeChild( this ); - if (!this.el) { - return []; - } + var keys = Object.keys( this.children ); + var i = keys.length; + while ( i-- ) { + this$1.children[ keys[i] ].teardown(); + } + }; - options = options || {}; - liveQueries = this._liveQueries; + KeypathModel.prototype.unregister = function unregister ( dep ) { + removeFromArray( this.deps, dep ); + if ( !this.deps.length ) this.teardown(); + }; - // Shortcut: if we're maintaining a live query with this - // selector, we don't need to traverse the parallel DOM - if (query = liveQueries[selector]) { + var hasProp = Object.prototype.hasOwnProperty; - // Either return the exact same query, or (if not live) a snapshot - return options && options.live ? query : query.slice(); - } + var shuffleTasks = { early: [], mark: [] }; + var registerQueue = { early: [], mark: [] }; - query = _makeQuery(this, selector, !!options.live, false); + var ModelBase = function ModelBase ( parent ) { + this.deps = []; - // Add this to the list of live queries Ractive needs to maintain, - // if applicable - if (query.live) { - liveQueries.push(selector); - liveQueries["_" + selector] = query; - } + this.children = []; + this.childByKey = {}; + this.links = []; - this.fragment.findAll(selector, query); - return query; - } + this.keyModels = {}; - var prototype_findAllComponents = Ractive$findAllComponents; - function Ractive$findAllComponents(selector, options) { - var liveQueries, query; + this.unresolved = []; + this.unresolvedByKey = {}; - options = options || {}; - liveQueries = this._liveComponentQueries; + this.bindings = []; + this.patternObservers = []; - // Shortcut: if we're maintaining a live query with this - // selector, we don't need to traverse the parallel DOM - if (query = liveQueries[selector]) { + if ( parent ) { + this.parent = parent; + this.root = parent.root; + } + }; - // Either return the exact same query, or (if not live) a snapshot - return options && options.live ? query : query.slice(); - } + ModelBase.prototype.addUnresolved = function addUnresolved ( key, resolver ) { + if ( !this.unresolvedByKey[ key ] ) { + this.unresolved.push( key ); + this.unresolvedByKey[ key ] = []; + } - query = _makeQuery(this, selector, !!options.live, true); + this.unresolvedByKey[ key ].push( resolver ); + }; - // Add this to the list of live queries Ractive needs to maintain, - // if applicable - if (query.live) { - liveQueries.push(selector); - liveQueries["_" + selector] = query; - } + ModelBase.prototype.addShuffleTask = function addShuffleTask ( task, stage ) { if ( stage === void 0 ) stage = 'early'; - this.fragment.findAllComponents(selector, query); - return query; - } + shuffleTasks[stage].push( task ); }; + ModelBase.prototype.addShuffleRegister = function addShuffleRegister ( item, stage ) { if ( stage === void 0 ) stage = 'early'; - var prototype_findComponent = Ractive$findComponent; + registerQueue[stage].push({ model: this, item: item }); }; - function Ractive$findComponent(selector) { - return this.fragment.findComponent(selector); - } + ModelBase.prototype.clearUnresolveds = function clearUnresolveds ( specificKey ) { + var this$1 = this; - var findContainer = Ractive$findContainer; + var i = this.unresolved.length; - function Ractive$findContainer(selector) { - if (this.container) { - if (this.container.component && this.container.component.name === selector) { - return this.container; - } else { - return this.container.findContainer(selector); - } - } + while ( i-- ) { + var key = this$1.unresolved[i]; - return null; - } + if ( specificKey && key !== specificKey ) continue; - var findParent = Ractive$findParent; + var resolvers = this$1.unresolvedByKey[ key ]; + var hasKey = this$1.has( key ); - function Ractive$findParent(selector) { + var j = resolvers.length; + while ( j-- ) { + if ( hasKey ) resolvers[j].attemptResolution(); + if ( resolvers[j].resolved ) resolvers.splice( j, 1 ); + } - if (this.parent) { - if (this.parent.component && this.parent.component.name === selector) { - return this.parent; - } else { - return this.parent.findParent(selector); - } - } + if ( !resolvers.length ) { + this$1.unresolved.splice( i, 1 ); + this$1.unresolvedByKey[ key ] = null; + } + } + }; - return null; - } + ModelBase.prototype.findMatches = function findMatches ( keys ) { + var len = keys.length; - var eventStack = { - enqueue: function (ractive, event) { - if (ractive.event) { - ractive._eventQueue = ractive._eventQueue || []; - ractive._eventQueue.push(ractive.event); - } - ractive.event = event; - }, - dequeue: function (ractive) { - if (ractive._eventQueue && ractive._eventQueue.length) { - ractive.event = ractive._eventQueue.pop(); - } else { - delete ractive.event; - } - } - }; + var existingMatches = [ this ]; + var matches; + var i; - var shared_eventStack = eventStack; + var loop = function ( ) { + var key = keys[i]; - var shared_fireEvent = fireEvent; + if ( key === '*' ) { + matches = []; + existingMatches.forEach( function ( model ) { + matches.push.apply( matches, model.getValueChildren( model.get() ) ); + }); + } else { + matches = existingMatches.map( function ( model ) { return model.joinKey( key ); } ); + } - function fireEvent(ractive, eventName) { - var options = arguments[2] === undefined ? {} : arguments[2]; + existingMatches = matches; + }; - if (!eventName) { - return; - } + for ( i = 0; i < len; i += 1 ) loop( ); - if (!options.event) { - options.event = { - name: eventName, - // until event not included as argument default - _noArg: true - }; - } else { - options.event.name = eventName; - } + return matches; + }; - var eventNames = getKeypath(eventName).wildcardMatches(); - fireEventAs(ractive, eventNames, options.event, options.args, true); - } + ModelBase.prototype.getKeyModel = function getKeyModel ( key, skip ) { + if ( key !== undefined && !skip ) return this.parent.getKeyModel( key, true ); - function fireEventAs(ractive, eventNames, event, args) { - var initialFire = arguments[4] === undefined ? false : arguments[4]; + if ( !( key in this.keyModels ) ) this.keyModels[ key ] = new KeyModel( escapeKey( key ), this ); - var subscribers, - i, - bubble = true; + return this.keyModels[ key ]; + }; - shared_eventStack.enqueue(ractive, event); + ModelBase.prototype.getKeypath = function getKeypath ( ractive ) { + if ( ractive !== this.ractive && this._link ) return this._link.target.getKeypath( ractive ); - for (i = eventNames.length; i >= 0; i--) { - subscribers = ractive._subs[eventNames[i]]; + if ( !this.keypath ) { + this.keypath = this.parent.isRoot ? this.key : ("" + (this.parent.getKeypath( ractive )) + "." + (escapeKey( this.key ))); + } - if (subscribers) { - bubble = notifySubscribers(ractive, subscribers, event, args) && bubble; - } - } + return this.keypath; + }; - shared_eventStack.dequeue(ractive); + ModelBase.prototype.getValueChildren = function getValueChildren ( value ) { + var this$1 = this; + + var children; + if ( isArray( value ) ) { + children = []; + if ( 'length' in this && this.length !== value.length ) { + children.push( this.joinKey( 'length' ) ); + } + value.forEach( function ( m, i ) { + children.push( this$1.joinKey( i ) ); + }); + } + + else if ( isObject( value ) || typeof value === 'function' ) { + children = Object.keys( value ).map( function ( key ) { return this$1.joinKey( key ); } ); + } + + else if ( value != null ) { + return []; + } + + return children; + }; - if (ractive.parent && bubble) { + ModelBase.prototype.getVirtual = function getVirtual ( shouldCapture ) { + var this$1 = this; + + var value = this.get( shouldCapture, { virtual: false } ); + if ( isObject( value ) ) { + var result = isArray( value ) ? [] : {}; + + var keys = Object.keys( value ); + var i = keys.length; + while ( i-- ) { + var child = this$1.childByKey[ keys[i] ]; + if ( !child ) result[ keys[i] ] = value[ keys[i] ]; + else if ( child._link ) result[ keys[i] ] = child._link.getVirtual(); + else result[ keys[i] ] = child.getVirtual(); + } + + i = this.children.length; + while ( i-- ) { + var child$1 = this$1.children[i]; + if ( !( child$1.key in result ) && child$1._link ) { + result[ child$1.key ] = child$1._link.getVirtual(); + } + } + + return result; + } else return value; + }; - if (initialFire && ractive.component) { - var fullName = ractive.component.name + "." + eventNames[eventNames.length - 1]; - eventNames = getKeypath(fullName).wildcardMatches(); + ModelBase.prototype.has = function has ( key ) { + if ( this._link ) return this._link.has( key ); - if (event) { - event.component = ractive; - } - } + var value = this.get(); + if ( !value ) return false; - fireEventAs(ractive.parent, eventNames, event, args); - } - } + key = unescapeKey( key ); + if ( hasProp.call( value, key ) ) return true; - function notifySubscribers(ractive, subscribers, event, args) { - var originalEvent = null, - stopEvent = false; + // We climb up the constructor chain to find if one of them contains the key + var constructor = value.constructor; + while ( constructor !== Function && constructor !== Array && constructor !== Object ) { + if ( hasProp.call( constructor.prototype, key ) ) return true; + constructor = constructor.constructor; + } - if (event && !event._noArg) { - args = [event].concat(args); - } + return false; + }; - // subscribers can be modified inflight, e.g. "once" functionality - // so we need to copy to make sure everyone gets called - subscribers = subscribers.slice(); + ModelBase.prototype.joinAll = function joinAll ( keys, opts ) { + var model = this; + for ( var i = 0; i < keys.length; i += 1 ) { + if ( opts && opts.lastLink === false && i + 1 === keys.length && model.childByKey[keys[i]] && model.childByKey[keys[i]]._link ) return model.childByKey[keys[i]]; + model = model.joinKey( keys[i], opts ); + } - for (var i = 0, len = subscribers.length; i < len; i += 1) { - if (subscribers[i].apply(ractive, args) === false) { - stopEvent = true; - } - } + return model; + }; - if (event && !event._noArg && stopEvent && (originalEvent = event.original)) { - originalEvent.preventDefault && originalEvent.preventDefault(); - originalEvent.stopPropagation && originalEvent.stopPropagation(); - } + ModelBase.prototype.notifyUpstream = function notifyUpstream () { + var parent = this.parent, path = [ this.key ]; + while ( parent ) { + if ( parent.patternObservers.length ) parent.patternObservers.forEach( function ( o ) { return o.notify( path.slice() ); } ); + path.unshift( parent.key ); + parent.links.forEach( notifiedUpstream ); + parent.deps.forEach( handleChange ); + parent = parent.parent; + } + }; - return !stopEvent; - } + ModelBase.prototype.rebinding = function rebinding ( next, previous, safe ) { + // tell the deps to move to the new target + var this$1 = this; + + var i = this.deps.length; + while ( i-- ) { + if ( this$1.deps[i].rebinding ) this$1.deps[i].rebinding( next, previous, safe ); + } + + i = this.links.length; + while ( i-- ) { + var link = this$1.links[i]; + // only relink the root of the link tree + if ( link.owner._link ) link.relinking( next, true, safe ); + } + + i = this.children.length; + while ( i-- ) { + var child = this$1.children[i]; + child.rebinding( next ? next.joinKey( child.key ) : undefined, child, safe ); + } + + i = this.unresolved.length; + while ( i-- ) { + var unresolved = this$1.unresolvedByKey[ this$1.unresolved[i] ]; + var c = unresolved.length; + while ( c-- ) { + unresolved[c].rebinding( next, previous ); + } + } + + if ( this.keypathModel ) this.keypathModel.rebinding( next, previous, false ); + + i = this.bindings.length; + while ( i-- ) { + this$1.bindings[i].rebinding( next, previous, safe ); + } + }; - var prototype_fire = Ractive$fire; - function Ractive$fire(eventName) { + ModelBase.prototype.register = function register ( dep ) { + this.deps.push( dep ); + }; - var options = { - args: Array.prototype.slice.call(arguments, 1) - }; + ModelBase.prototype.registerChange = function registerChange ( key, value ) { + if ( !this.isRoot ) { + this.root.registerChange( key, value ); + } else { + this.changes[ key ] = value; + runloop.addInstance( this.root.ractive ); + } + }; - shared_fireEvent(this, eventName, options); - } + ModelBase.prototype.registerLink = function registerLink ( link ) { + addToArray( this.links, link ); + }; - var prototype_get = Ractive$get; - var options = { - capture: true, // top-level calls should be intercepted - noUnwrap: true, // wrapped values should NOT be unwrapped - fullRootGet: true // root get should return mappings + ModelBase.prototype.registerPatternObserver = function registerPatternObserver ( observer ) { + this.patternObservers.push( observer ); + this.register( observer ); }; - function Ractive$get(keypath) { - var value; - keypath = getKeypath(normalise(keypath)); - value = this.viewmodel.get(keypath, options); + ModelBase.prototype.registerTwowayBinding = function registerTwowayBinding ( binding ) { + this.bindings.push( binding ); + }; - // Create inter-component binding, if necessary - if (value === undefined && this.parent && !this.isolated) { - if (shared_resolveRef(this, keypath.str, this.component.parentFragment)) { - // creates binding as side-effect, if appropriate - value = this.viewmodel.get(keypath); - } - } + ModelBase.prototype.removeUnresolved = function removeUnresolved ( key, resolver ) { + var resolvers = this.unresolvedByKey[ key ]; - return value; - } + if ( resolvers ) { + removeFromArray( resolvers, resolver ); + } + }; - var insert = Ractive$insert; + ModelBase.prototype.shuffled = function shuffled () { + var this$1 = this; + + var i = this.children.length; + while ( i-- ) { + this$1.children[i].shuffled(); + } + if ( this.wrapper ) { + this.wrapper.teardown(); + this.wrapper = null; + this.rewrap = true; + } + }; - var insertHook = new hooks_Hook("insert"); - function Ractive$insert(target, anchor) { - if (!this.fragment.rendered) { - // TODO create, and link to, documentation explaining this - throw new Error("The API has changed - you must call `ractive.render(target[, anchor])` to render your Ractive instance. Once rendered you can use `ractive.insert()`."); - } + ModelBase.prototype.unregister = function unregister ( dependant ) { + removeFromArray( this.deps, dependant ); + }; - target = getElement(target); - anchor = getElement(anchor) || null; + ModelBase.prototype.unregisterLink = function unregisterLink ( link ) { + removeFromArray( this.links, link ); + }; - if (!target) { - throw new Error("You must specify a valid target to insert into"); - } + ModelBase.prototype.unregisterPatternObserver = function unregisterPatternObserver ( observer ) { + removeFromArray( this.patternObservers, observer ); + this.unregister( observer ); + }; - target.insertBefore(this.detach(), anchor); - this.el = target; + ModelBase.prototype.unregisterTwowayBinding = function unregisterTwowayBinding ( binding ) { + removeFromArray( this.bindings, binding ); + }; - (target.__ractive_instances__ || (target.__ractive_instances__ = [])).push(this); - this.detached = null; + ModelBase.prototype.updateFromBindings = function updateFromBindings$1 ( cascade ) { + var this$1 = this; + + var i = this.bindings.length; + while ( i-- ) { + var value = this$1.bindings[i].getValue(); + if ( value !== this$1.value ) this$1.set( value ); + } + + // check for one-way bindings if there are no two-ways + if ( !this.bindings.length ) { + var oneway = findBoundValue( this.deps ); + if ( oneway && oneway.value !== this.value ) this.set( oneway.value ); + } + + if ( cascade ) { + this.children.forEach( updateFromBindings ); + this.links.forEach( updateFromBindings ); + if ( this._link ) this._link.updateFromBindings( cascade ); + } + }; - fireInsertHook(this); + function updateFromBindings ( model ) { + model.updateFromBindings( true ); + } + + function findBoundValue( list ) { + var i = list.length; + while ( i-- ) { + if ( list[i].bound ) { + var owner = list[i].owner; + if ( owner ) { + var value = owner.name === 'checked' ? + owner.node.checked : + owner.node.value; + return { value: value }; + } + } + } } - function fireInsertHook(ractive) { - insertHook.fire(ractive); + function fireShuffleTasks ( stage ) { + if ( !stage ) { + fireShuffleTasks( 'early' ); + fireShuffleTasks( 'mark' ); + } else { + var tasks = shuffleTasks[stage]; + shuffleTasks[stage] = []; + var i = tasks.length; + while ( i-- ) tasks[i](); + + var register = registerQueue[stage]; + registerQueue[stage] = []; + i = register.length; + while ( i-- ) register[i].model.register( register[i].item ); + } + } + + KeyModel.prototype.addShuffleTask = ModelBase.prototype.addShuffleTask; + KeyModel.prototype.addShuffleRegister = ModelBase.prototype.addShuffleRegister; + KeypathModel.prototype.addShuffleTask = ModelBase.prototype.addShuffleTask; + KeypathModel.prototype.addShuffleRegister = ModelBase.prototype.addShuffleRegister; + + // this is the dry method of checking to see if a rebind applies to + // a particular keypath because in some cases, a dep may be bound + // directly to a particular keypath e.g. foo.bars.0.baz and need + // to avoid getting kicked to foo.bars.1.baz if foo.bars is unshifted + function rebindMatch ( template, next, previous ) { + var keypath = template.r || template; + + // no valid keypath, go with next + if ( !keypath || typeof keypath !== 'string' ) return next; + + // completely contextual ref, go with next + if ( keypath === '.' || keypath[0] === '@' || (next || previous).isKey || (next || previous).isKeypath ) return next; + + var parts = keypath.split( '/' ); + var keys = splitKeypathI( parts[ parts.length - 1 ] ); + + // check the keypath against the model keypath to see if it matches + var model = next || previous; + var i = keys.length; + var match = true, shuffling = false; + + while ( model && i-- ) { + if ( model.shuffling ) shuffling = true; + // non-strict comparison to account for indices in keypaths + if ( keys[i] != model.key ) match = false; + model = model.parent; + } + + // next is undefined, but keypath is shuffling and previous matches + if ( !next && match && shuffling ) return previous; + // next is defined, but doesn't match the keypath + else if ( next && !match && shuffling ) return previous; + else return next; + } + + var LinkModel = (function (ModelBase) { + function LinkModel ( parent, owner, target, key ) { + ModelBase.call( this, parent ); + + this.owner = owner; + this.target = target; + this.key = key === undefined ? owner.key : key; + if ( owner.isLink ) this.sourcePath = "" + (owner.sourcePath) + "." + (this.key); + + target.registerLink( this ); + + this.isReadonly = parent.isReadonly; + + this.isLink = true; + } + + LinkModel.prototype = Object.create( ModelBase && ModelBase.prototype ); + LinkModel.prototype.constructor = LinkModel; + + LinkModel.prototype.animate = function animate ( from, to, options, interpolator ) { + return this.target.animate( from, to, options, interpolator ); + }; + + LinkModel.prototype.applyValue = function applyValue ( value ) { + this.target.applyValue( value ); + }; + + LinkModel.prototype.get = function get ( shouldCapture, opts ) { + if ( shouldCapture ) { + capture( this ); + + // may need to tell the target to unwrap + opts = opts || {}; + opts.unwrap = true; + } + + return this.target.get( false, opts ); + }; + + LinkModel.prototype.getKeypath = function getKeypath ( ractive ) { + if ( ractive && ractive !== this.root.ractive ) return this.target.getKeypath( ractive ); + + return ModelBase.prototype.getKeypath.call( this, ractive ); + }; + + LinkModel.prototype.getKeypathModel = function getKeypathModel ( ractive ) { + if ( !this.keypathModel ) this.keypathModel = new KeypathModel( this ); + if ( ractive && ractive !== this.root.ractive ) return this.keypathModel.getChild( ractive ); + return this.keypathModel; + }; + + LinkModel.prototype.handleChange = function handleChange$1 () { + this.deps.forEach( handleChange ); + this.links.forEach( handleChange ); + this.notifyUpstream(); + }; + + LinkModel.prototype.joinKey = function joinKey ( key ) { + // TODO: handle nested links + if ( key === undefined || key === '' ) return this; + + if ( !this.childByKey.hasOwnProperty( key ) ) { + var child = new LinkModel( this, this, this.target.joinKey( key ), key ); + this.children.push( child ); + this.childByKey[ key ] = child; + } - ractive.findAllComponents("*").forEach(function (child) { - fireInsertHook(child.instance); - }); - } + return this.childByKey[ key ]; + }; - var prototype_merge = Ractive$merge; - function Ractive$merge(keypath, array, options) { - var currentArray, promise; + LinkModel.prototype.mark = function mark () { + this.target.mark(); + }; - keypath = getKeypath(normalise(keypath)); - currentArray = this.viewmodel.get(keypath); + LinkModel.prototype.marked = function marked$1 () { + this.links.forEach( marked ); - // If either the existing value or the new value isn't an - // array, just do a regular set - if (!isArray(currentArray) || !isArray(array)) { - return this.set(keypath, array, options && options.complete); - } + this.deps.forEach( handleChange ); + this.clearUnresolveds(); + }; - // Manage transitions - promise = global_runloop.start(this, true); - this.viewmodel.merge(keypath, currentArray, array, options); - global_runloop.end(); + LinkModel.prototype.notifiedUpstream = function notifiedUpstream$1 () { + this.links.forEach( notifiedUpstream ); + this.deps.forEach( handleChange ); + }; - return promise; - } + LinkModel.prototype.relinked = function relinked () { + this.target.registerLink( this ); + this.children.forEach( function ( c ) { return c.relinked(); } ); + }; - var Observer = function (ractive, keypath, callback, options) { - this.root = ractive; - this.keypath = keypath; - this.callback = callback; - this.defer = options.defer; + LinkModel.prototype.relinking = function relinking ( target, root, safe ) { + var this$1 = this; + + if ( root && this.sourcePath ) target = rebindMatch( this.sourcePath, target, this.target ); + if ( !target || this.target === target ) return; - // default to root as context, but allow it to be overridden - this.context = options && options.context ? options.context : ractive; + this.target.unregisterLink( this ); + if ( this.keypathModel ) this.keypathModel.rebindChildren( target ); + + this.target = target; + this.children.forEach( function ( c ) { + c.relinking( target.joinKey( c.key ), false, safe ); + }); + + if ( root ) this.addShuffleTask( function () { + this$1.relinked(); + if ( !safe ) this$1.notifyUpstream(); + }); + }; + + LinkModel.prototype.set = function set ( value ) { + this.target.set( value ); + }; + + LinkModel.prototype.shuffle = function shuffle ( newIndices ) { + // watch for extra shuffles caused by a shuffle in a downstream link + var this$1 = this; + + if ( this.shuffling ) return; + + // let the real model handle firing off shuffles + if ( !this.target.shuffling ) { + this.target.shuffle( newIndices ); + } else { + this.shuffling = true; + + var i = newIndices.length; + while ( i-- ) { + var idx = newIndices[ i ]; + // nothing is actually changing, so move in the index and roll on + if ( i === idx ) { + continue; + } + + // rebind the children on i to idx + if ( i in this$1.childByKey ) this$1.childByKey[ i ].rebinding( !~idx ? undefined : this$1.joinKey( idx ), this$1.childByKey[ i ], true ); + + if ( !~idx && this$1.keyModels[ i ] ) { + this$1.keyModels[i].rebinding( undefined, this$1.keyModels[i], false ); + } else if ( ~idx && this$1.keyModels[ i ] ) { + if ( !this$1.keyModels[ idx ] ) this$1.childByKey[ idx ].getKeyModel( idx ); + this$1.keyModels[i].rebinding( this$1.keyModels[ idx ], this$1.keyModels[i], false ); + } + } + + var upstream = this.source().length !== this.source().value.length; + + this.links.forEach( function ( l ) { return l.shuffle( newIndices ); } ); + + i = this.deps.length; + while ( i-- ) { + if ( this$1.deps[i].shuffle ) this$1.deps[i].shuffle( newIndices ); + } + + this.marked(); + + if ( upstream ) this.notifyUpstream(); + + this.shuffling = false; + } + + }; + + LinkModel.prototype.source = function source () { + if ( this.target.source ) return this.target.source(); + else return this.target; + }; + + LinkModel.prototype.teardown = function teardown$1 () { + if ( this._link ) this._link.teardown(); + this.children.forEach( teardown ); + }; + + return LinkModel; + }(ModelBase)); + + ModelBase.prototype.link = function link ( model, keypath ) { + var lnk = this._link || new LinkModel( this.parent, this, model, this.key ); + lnk.sourcePath = keypath; + if ( this._link ) this._link.relinking( model, true, false ); + this.rebinding( lnk, this, false ); + fireShuffleTasks(); + + var unresolved = !this._link; + this._link = lnk; + if ( unresolved ) this.parent.clearUnresolveds(); + lnk.marked(); + return lnk; }; - Observer.prototype = { - init: function (immediate) { - this.value = this.root.get(this.keypath.str); - - if (immediate !== false) { - this.update(); - } else { - this.oldValue = this.value; - } - }, - - setValue: function (value) { - var _this = this; - - if (!isEqual(value, this.value)) { - this.value = value; - - if (this.defer && this.ready) { - global_runloop.scheduleTask(function () { - return _this.update(); - }); - } else { - this.update(); - } - } - }, - - update: function () { - // Prevent infinite loops - if (this.updating) { - return; - } - - this.updating = true; - - this.callback.call(this.context, this.value, this.oldValue, this.keypath.str); - this.oldValue = this.value; - - this.updating = false; - } + ModelBase.prototype.unlink = function unlink () { + if ( this._link ) { + var ln = this._link; + this._link = undefined; + ln.rebinding( this, this._link ); + fireShuffleTasks(); + ln.teardown(); + } }; - var observe_Observer = Observer; + var requestAnimationFrame; - var observe_getPattern = getPattern; - function getPattern(ractive, pattern) { - var matchingKeypaths, values; + // If window doesn't exist, we don't need requestAnimationFrame + if ( !win ) { + requestAnimationFrame = null; + } else { + // https://gist.github.com/paulirish/1579671 + (function(vendors, lastTime, win) { - matchingKeypaths = getMatchingKeypaths(ractive, pattern); + var x, setTimeout; - values = {}; - matchingKeypaths.forEach(function (keypath) { - values[keypath.str] = ractive.get(keypath.str); - }); + if ( win.requestAnimationFrame ) { + return; + } - return values; - } + for ( x = 0; x < vendors.length && !win.requestAnimationFrame; ++x ) { + win.requestAnimationFrame = win[vendors[x]+'RequestAnimationFrame']; + } - var PatternObserver, - slice = Array.prototype.slice; + if ( !win.requestAnimationFrame ) { + setTimeout = win.setTimeout; - PatternObserver = function (ractive, keypath, callback, options) { - this.root = ractive; + win.requestAnimationFrame = function(callback) { + var currTime, timeToCall, id; - this.callback = callback; - this.defer = options.defer; + currTime = Date.now(); + timeToCall = Math.max( 0, 16 - (currTime - lastTime ) ); + id = setTimeout( function() { callback(currTime + timeToCall); }, timeToCall ); - this.keypath = keypath; - this.regex = new RegExp("^" + keypath.str.replace(/\./g, "\\.").replace(/\*/g, "([^\\.]+)") + "$"); - this.values = {}; + lastTime = currTime + timeToCall; + return id; + }; + } - if (this.defer) { - this.proxies = []; - } + }( vendors, 0, win )); - // default to root as context, but allow it to be overridden - this.context = options && options.context ? options.context : ractive; - }; + requestAnimationFrame = win.requestAnimationFrame; + } - PatternObserver.prototype = { - init: function (immediate) { - var values, keypath; - - values = observe_getPattern(this.root, this.keypath); - - if (immediate !== false) { - for (keypath in values) { - if (values.hasOwnProperty(keypath)) { - this.update(getKeypath(keypath)); - } - } - } else { - this.values = values; - } - }, - - update: function (keypath) { - var _this = this; - - var values; - - if (keypath.isPattern) { - values = observe_getPattern(this.root, keypath); - - for (keypath in values) { - if (values.hasOwnProperty(keypath)) { - this.update(getKeypath(keypath)); - } - } - - return; - } - - // special case - array mutation should not trigger `array.*` - // pattern observer with `array.length` - if (this.root.viewmodel.implicitChanges[keypath.str]) { - return; - } - - if (this.defer && this.ready) { - global_runloop.scheduleTask(function () { - return _this.getProxy(keypath).update(); - }); - return; - } - - this.reallyUpdate(keypath); - }, - - reallyUpdate: function (keypath) { - var keypathStr, value, keys, args; - - keypathStr = keypath.str; - value = this.root.viewmodel.get(keypath); - - // Prevent infinite loops - if (this.updating) { - this.values[keypathStr] = value; - return; - } - - this.updating = true; - - if (!isEqual(value, this.values[keypathStr]) || !this.ready) { - keys = slice.call(this.regex.exec(keypathStr), 1); - args = [value, this.values[keypathStr], keypathStr].concat(keys); - - this.values[keypathStr] = value; - this.callback.apply(this.context, args); - } - - this.updating = false; - }, - - getProxy: function (keypath) { - var _this = this; - - if (!this.proxies[keypath.str]) { - this.proxies[keypath.str] = { - update: function () { - return _this.reallyUpdate(keypath); - } - }; - } - - return this.proxies[keypath.str]; - } - }; + var rAF = requestAnimationFrame; - var observe_PatternObserver = PatternObserver; + var getTime = ( win && win.performance && typeof win.performance.now === 'function' ) ? + function () { return win.performance.now(); } : + function () { return Date.now(); }; - var observe_getObserverFacade = getObserverFacade; - var emptyObject = {}; - function getObserverFacade(ractive, keypath, callback, options) { - var observer, isPatternObserver, cancelled; - - keypath = getKeypath(normalise(keypath)); - options = options || emptyObject; - - // pattern observers are treated differently - if (keypath.isPattern) { - observer = new observe_PatternObserver(ractive, keypath, callback, options); - ractive.viewmodel.patternObservers.push(observer); - isPatternObserver = true; - } else { - observer = new observe_Observer(ractive, keypath, callback, options); - } + // TODO what happens if a transition is aborted? - observer.init(options.init); - ractive.viewmodel.register(keypath, observer, isPatternObserver ? "patternObservers" : "observers"); + var tickers = []; + var running = false; - // This flag allows observers to initialise even with undefined values - observer.ready = true; + function tick () { + runloop.start(); - var facade = { - cancel: function () { - var index; + var now = getTime(); - if (cancelled) { - return; - } + var i; + var ticker; - if (isPatternObserver) { - index = ractive.viewmodel.patternObservers.indexOf(observer); + for ( i = 0; i < tickers.length; i += 1 ) { + ticker = tickers[i]; - ractive.viewmodel.patternObservers.splice(index, 1); - ractive.viewmodel.unregister(keypath, observer, "patternObservers"); - } else { - ractive.viewmodel.unregister(keypath, observer, "observers"); - } - cancelled = true; - } - }; + if ( !ticker.tick( now ) ) { + // ticker is complete, remove it from the stack, and decrement i so we don't miss one + tickers.splice( i--, 1 ); + } + } - ractive._observers.push(facade); - return facade; - } + runloop.end(); - var observe = Ractive$observe; - function Ractive$observe(keypath, callback, options) { + if ( tickers.length ) { + rAF( tick ); + } else { + running = false; + } + } - var observers, map, keypaths, i; + var Ticker = function Ticker ( options ) { + this.duration = options.duration; + this.step = options.step; + this.complete = options.complete; + this.easing = options.easing; - // Allow a map of keypaths to handlers - if (isObject(keypath)) { - options = callback; - map = keypath; + this.start = getTime(); + this.end = this.start + this.duration; - observers = []; + this.running = true; - for (keypath in map) { - if (map.hasOwnProperty(keypath)) { - callback = map[keypath]; - observers.push(this.observe(keypath, callback, options)); - } - } + tickers.push( this ); + if ( !running ) rAF( tick ); + }; - return { - cancel: function () { - while (observers.length) { - observers.pop().cancel(); - } - } - }; - } + Ticker.prototype.tick = function tick$1 ( now ) { + if ( !this.running ) return false; - // Allow `ractive.observe( callback )` - i.e. observe entire model - if (typeof keypath === "function") { - options = callback; - callback = keypath; - keypath = ""; + if ( now > this.end ) { + if ( this.step ) this.step( 1 ); + if ( this.complete ) this.complete( 1 ); - return observe_getObserverFacade(this, keypath, callback, options); - } + return false; + } - keypaths = keypath.split(" "); + var elapsed = now - this.start; + var eased = this.easing( elapsed / this.duration ); - // Single keypath - if (keypaths.length === 1) { - return observe_getObserverFacade(this, keypath, callback, options); - } + if ( this.step ) this.step( eased ); - // Multiple space-separated keypaths - observers = []; + return true; + }; - i = keypaths.length; - while (i--) { - keypath = keypaths[i]; + Ticker.prototype.stop = function stop () { + if ( this.abort ) this.abort(); + this.running = false; + }; - if (keypath) { - observers.push(observe_getObserverFacade(this, keypath, callback, options)); - } - } + var prefixers = {}; - return { - cancel: function () { - while (observers.length) { - observers.pop().cancel(); - } - } - }; - } + // TODO this is legacy. sooner we can replace the old adaptor API the better + function prefixKeypath ( obj, prefix ) { + var prefixed = {}, key; - var observeOnce = Ractive$observeOnce; + if ( !prefix ) { + return obj; + } - function Ractive$observeOnce(property, callback, options) { + prefix += '.'; - var observer = this.observe(property, function () { - callback.apply(this, arguments); - observer.cancel(); - }, { init: false, defer: options && options.defer }); + for ( key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + prefixed[ prefix + key ] = obj[ key ]; + } + } - return observer; + return prefixed; } - var shared_trim = function (str) { - return str.trim(); - }; - - var notEmptyString = function (str) { - return str !== ""; - }; - - var off = Ractive$off; - function Ractive$off(eventName, callback) { - var _this = this; + function getPrefixer ( rootKeypath ) { + var rootDot; - var eventNames; + if ( !prefixers[ rootKeypath ] ) { + rootDot = rootKeypath ? rootKeypath + '.' : ''; - // if no arguments specified, remove all callbacks - if (!eventName) { - // TODO use this code instead, once the following issue has been resolved - // in PhantomJS (tests are unpassable otherwise!) - // https://github.com/ariya/phantomjs/issues/11856 - // defineProperty( this, '_subs', { value: create( null ), configurable: true }); - for (eventName in this._subs) { - delete this._subs[eventName]; - } - } else { - // Handle multiple space-separated event names - eventNames = eventName.split(" ").map(shared_trim).filter(notEmptyString); + prefixers[ rootKeypath ] = function ( relativeKeypath, value ) { + var obj; - eventNames.forEach(function (eventName) { - var subscribers, index; + if ( typeof relativeKeypath === 'string' ) { + obj = {}; + obj[ rootDot + relativeKeypath ] = value; + return obj; + } - // If we have subscribers for this event... - if (subscribers = _this._subs[eventName]) { - // ...if a callback was specified, only remove that - if (callback) { - index = subscribers.indexOf(callback); - if (index !== -1) { - subscribers.splice(index, 1); - } - } + if ( typeof relativeKeypath === 'object' ) { + // 'relativeKeypath' is in fact a hash, not a keypath + return rootDot ? prefixKeypath( relativeKeypath, rootKeypath ) : relativeKeypath; + } + }; + } - // ...otherwise remove all callbacks - else { - _this._subs[eventName] = []; - } - } - }); - } - - return this; + return prefixers[ rootKeypath ]; } - var on = Ractive$on; - function Ractive$on(eventName, callback) { - var _this = this; + var Model = (function (ModelBase) { + function Model ( parent, key ) { + ModelBase.call( this, parent ); - var listeners, n, eventNames; + this.ticker = null; - // allow mutliple listeners to be bound in one go - if (typeof eventName === "object") { - listeners = []; + if ( parent ) { + this.key = unescapeKey( key ); + this.isReadonly = parent.isReadonly; - for (n in eventName) { - if (eventName.hasOwnProperty(n)) { - listeners.push(this.on(n, eventName[n])); - } - } + if ( parent.value ) { + this.value = parent.value[ this.key ]; + if ( isArray( this.value ) ) this.length = this.value.length; + this.adapt(); + } + } + } - return { - cancel: function () { - var listener; + Model.prototype = Object.create( ModelBase && ModelBase.prototype ); + Model.prototype.constructor = Model; - while (listener = listeners.pop()) { - listener.cancel(); - } - } - }; - } + Model.prototype.adapt = function adapt () { + var this$1 = this; - // Handle multiple space-separated event names - eventNames = eventName.split(" ").map(shared_trim).filter(notEmptyString); + var adaptors = this.root.adaptors; + var len = adaptors.length; + + this.rewrap = false; - eventNames.forEach(function (eventName) { - (_this._subs[eventName] || (_this._subs[eventName] = [])).push(callback); - }); + // Exit early if no adaptors + if ( len === 0 ) return; - return { - cancel: function () { - return _this.off(eventName, callback); - } - }; - } + var value = this.wrapper ? ( 'newWrapperValue' in this ? this.newWrapperValue : this.wrapperValue ) : this.value; - var once = Ractive$once; + // TODO remove this legacy nonsense + var ractive = this.root.ractive; + var keypath = this.getKeypath(); - function Ractive$once(eventName, handler) { + // tear previous adaptor down if present + if ( this.wrapper ) { + var shouldTeardown = this.wrapperValue === value ? false : !this.wrapper.reset || this.wrapper.reset( value ) === false; - var listener = this.on(eventName, function () { - handler.apply(this, arguments); - listener.cancel(); - }); + if ( shouldTeardown ) { + this.wrapper.teardown(); + this.wrapper = null; - // so we can still do listener.cancel() manually - return listener; + // don't branch for undefined values + if ( this.value !== undefined ) { + var parentValue = this.parent.value || this.parent.createBranch( this.key ); + if ( parentValue[ this.key ] !== value ) parentValue[ this.key ] = value; + } + } else { + delete this.newWrapperValue; + this.wrapperValue = value; + this.value = this.wrapper.get(); + return; + } + } + + var i; + + for ( i = 0; i < len; i += 1 ) { + var adaptor = adaptors[i]; + if ( adaptor.filter( value, keypath, ractive ) ) { + this$1.wrapper = adaptor.wrap( ractive, value, keypath, getPrefixer( keypath ) ); + this$1.wrapperValue = value; + this$1.wrapper.__model = this$1; // massive temporary hack to enable array adaptor + + this$1.value = this$1.wrapper.get(); + + break; + } + } + }; + + Model.prototype.animate = function animate ( from, to, options, interpolator ) { + var this$1 = this; + + if ( this.ticker ) this.ticker.stop(); + + var fulfilPromise; + var promise = new Promise$1( function ( fulfil ) { return fulfilPromise = fulfil; } ); + + this.ticker = new Ticker({ + duration: options.duration, + easing: options.easing, + step: function ( t ) { + var value = interpolator( t ); + this$1.applyValue( value ); + if ( options.step ) options.step( t, value ); + }, + complete: function () { + this$1.applyValue( to ); + if ( options.complete ) options.complete( to ); + + this$1.ticker = null; + fulfilPromise(); + } + }); + + promise.stop = this.ticker.stop; + return promise; + }; + + Model.prototype.applyValue = function applyValue ( value ) { + if ( isEqual( value, this.value ) ) return; + + // TODO deprecate this nonsense + this.registerChange( this.getKeypath(), value ); + + if ( this.parent.wrapper && this.parent.wrapper.set ) { + this.parent.wrapper.set( this.key, value ); + this.parent.value = this.parent.wrapper.get(); + + this.value = this.parent.value[ this.key ]; + if ( this.wrapper ) this.newWrapperValue = this.value; + this.adapt(); + } else if ( this.wrapper ) { + this.newWrapperValue = value; + this.adapt(); + } else { + var parentValue = this.parent.value || this.parent.createBranch( this.key ); + parentValue[ this.key ] = value; + + this.value = value; + this.adapt(); + } + + this.parent.clearUnresolveds(); + this.clearUnresolveds(); + + // keep track of array length + if ( isArray( value ) ) this.length = value.length; + + // notify dependants + this.links.forEach( handleChange ); + this.children.forEach( mark ); + this.deps.forEach( handleChange ); + + this.notifyUpstream(); + + if ( this.key === 'length' && isArray( this.parent.value ) ) this.parent.length = this.parent.value.length; + }; + + Model.prototype.createBranch = function createBranch ( key ) { + var branch = isNumeric( key ) ? [] : {}; + this.set( branch ); + + return branch; + }; + + Model.prototype.get = function get ( shouldCapture, opts ) { + if ( this._link ) return this._link.get( shouldCapture, opts ); + if ( shouldCapture ) capture( this ); + // if capturing, this value needs to be unwrapped because it's for external use + if ( opts && opts.virtual ) return this.getVirtual( false ); + return ( shouldCapture || ( opts && opts.unwrap ) ) && this.wrapper ? this.wrapperValue : this.value; + }; + + Model.prototype.getKeypathModel = function getKeypathModel ( ractive ) { + if ( !this.keypathModel ) this.keypathModel = new KeypathModel( this ); + return this.keypathModel; + }; + + Model.prototype.joinKey = function joinKey ( key, opts ) { + if ( this._link ) { + if ( opts && !opts.lastLink === false && ( key === undefined || key === '' ) ) return this; + return this._link.joinKey( key ); + } + + if ( key === undefined || key === '' ) return this; + + + if ( !this.childByKey.hasOwnProperty( key ) ) { + var child = new Model( this, key ); + this.children.push( child ); + this.childByKey[ key ] = child; + } + + if ( this.childByKey[ key ]._link ) return this.childByKey[ key ]._link; + return this.childByKey[ key ]; + }; + + Model.prototype.mark = function mark$1 () { + if ( this._link ) return this._link.mark(); + + var value = this.retrieve(); + + if ( !isEqual( value, this.value ) ) { + var old = this.value; + this.value = value; + + // make sure the wrapper stays in sync + if ( old !== value || this.rewrap ) { + if ( this.wrapper ) this.newWrapperValue = value; + this.adapt(); + } + + // keep track of array lengths + if ( isArray( value ) ) this.length = value.length; + + this.children.forEach( mark ); + this.links.forEach( marked ); + + this.deps.forEach( handleChange ); + this.clearUnresolveds(); + } + }; + + Model.prototype.merge = function merge ( array, comparator ) { + var oldArray = this.value, newArray = array; + if ( oldArray === newArray ) oldArray = recreateArray( this ); + if ( comparator ) { + oldArray = oldArray.map( comparator ); + newArray = newArray.map( comparator ); + } + + var oldLength = oldArray.length; + + var usedIndices = {}; + var firstUnusedIndex = 0; + + var newIndices = oldArray.map( function ( item ) { + var index; + var start = firstUnusedIndex; + + do { + index = newArray.indexOf( item, start ); + + if ( index === -1 ) { + return -1; + } + + start = index + 1; + } while ( ( usedIndices[ index ] === true ) && start < oldLength ); + + // keep track of the first unused index, so we don't search + // the whole of newArray for each item in oldArray unnecessarily + if ( index === firstUnusedIndex ) { + firstUnusedIndex += 1; + } + // allow next instance of next "equal" to be found item + usedIndices[ index ] = true; + return index; + }); + + this.parent.value[ this.key ] = array; + this.shuffle( newIndices ); + }; + + Model.prototype.retrieve = function retrieve () { + return this.parent.value ? this.parent.value[ this.key ] : undefined; + }; + + Model.prototype.set = function set ( value ) { + if ( this.ticker ) this.ticker.stop(); + this.applyValue( value ); + }; + + Model.prototype.shuffle = function shuffle ( newIndices ) { + var this$1 = this; + + this.shuffling = true; + var i = newIndices.length; + while ( i-- ) { + var idx = newIndices[ i ]; + // nothing is actually changing, so move in the index and roll on + if ( i === idx ) { + continue; + } + + // rebind the children on i to idx + if ( i in this$1.childByKey ) this$1.childByKey[ i ].rebinding( !~idx ? undefined : this$1.joinKey( idx ), this$1.childByKey[ i ], true ); + + if ( !~idx && this$1.keyModels[ i ] ) { + this$1.keyModels[i].rebinding( undefined, this$1.keyModels[i], false ); + } else if ( ~idx && this$1.keyModels[ i ] ) { + if ( !this$1.keyModels[ idx ] ) this$1.childByKey[ idx ].getKeyModel( idx ); + this$1.keyModels[i].rebinding( this$1.keyModels[ idx ], this$1.keyModels[i], false ); + } + } + + var upstream = this.length !== this.value.length; + + this.links.forEach( function ( l ) { return l.shuffle( newIndices ); } ); + fireShuffleTasks( 'early' ); + + i = this.deps.length; + while ( i-- ) { + if ( this$1.deps[i].shuffle ) this$1.deps[i].shuffle( newIndices ); + } + + this.mark(); + fireShuffleTasks( 'mark' ); + + if ( upstream ) this.notifyUpstream(); + this.shuffling = false; + }; + + Model.prototype.teardown = function teardown$1 () { + if ( this._link ) this._link.teardown(); + this.children.forEach( teardown ); + if ( this.wrapper ) this.wrapper.teardown(); + if ( this.keypathModel ) this.keypathModel.teardown(); + }; + + return Model; + }(ModelBase)); + + function recreateArray( model ) { + var array = []; + + for ( var i = 0; i < model.length; i++ ) { + array[ i ] = (model.childByKey[i] || {}).value; + } + + return array; + } + + var GlobalModel = (function (Model) { + function GlobalModel ( ) { + Model.call( this, null, '@global' ); + this.value = typeof global !== 'undefined' ? global : window; + this.isRoot = true; + this.root = this; + this.adaptors = []; + } + + GlobalModel.prototype = Object.create( Model && Model.prototype ); + GlobalModel.prototype.constructor = GlobalModel; + + GlobalModel.prototype.getKeypath = function getKeypath() { + return '@global'; + }; + + // global model doesn't contribute changes events because it has no instance + GlobalModel.prototype.registerChange = function registerChange () {}; + + return GlobalModel; + }(Model)); + + var GlobalModel$1 = new GlobalModel(); + + var keypathExpr = /^@[^\(]+\(([^\)]+)\)/; + + function resolveReference ( fragment, ref ) { + var context = fragment.findContext(); + + // special references + // TODO does `this` become `.` at parse time? + if ( ref === '.' || ref === 'this' ) return context; + if ( ref.indexOf( '@keypath' ) === 0 ) { + var match = keypathExpr.exec( ref ); + if ( match && match[1] ) { + var model = resolveReference( fragment, match[1] ); + if ( model ) return model.getKeypathModel(); + } + return context.getKeypathModel(); + } + if ( ref.indexOf( '@rootpath' ) === 0 ) { + // check to see if this is an empty component root + while ( context.isRoot && context.ractive.component ) { + context = context.ractive.component.parentFragment.findContext(); + } + + var match$1 = keypathExpr.exec( ref ); + if ( match$1 && match$1[1] ) { + var model$1 = resolveReference( fragment, match$1[1] ); + if ( model$1 ) return model$1.getKeypathModel( fragment.ractive.root ); + } + return context.getKeypathModel( fragment.ractive.root ); + } + if ( ref === '@index' || ref === '@key' ) { + var repeater = fragment.findRepeatingFragment(); + // make sure the found fragment is actually an iteration + if ( !repeater.isIteration ) return; + return repeater.context.getKeyModel( repeater[ ref[1] === 'i' ? 'index' : 'key' ] ); + } + if ( ref === '@this' ) { + return fragment.ractive.viewmodel.getRactiveModel(); + } + if ( ref === '@global' ) { + return GlobalModel$1; + } + + // ancestor references + if ( ref[0] === '~' ) return fragment.ractive.viewmodel.joinAll( splitKeypathI( ref.slice( 2 ) ) ); + if ( ref[0] === '.' ) { + var parts = ref.split( '/' ); + + while ( parts[0] === '.' || parts[0] === '..' ) { + var part = parts.shift(); + + if ( part === '..' ) { + context = context.parent; + } + } + + ref = parts.join( '/' ); + + // special case - `{{.foo}}` means the same as `{{./foo}}` + if ( ref[0] === '.' ) ref = ref.slice( 1 ); + return context.joinAll( splitKeypathI( ref ) ); + } + + return resolveAmbiguousReference( fragment, ref ); + } + + function Ractive$get ( keypath, opts ) { + if ( typeof keypath !== 'string' ) return this.viewmodel.get( true, keypath ); + + var keys = splitKeypathI( keypath ); + var key = keys[0]; + + var model; + + if ( !this.viewmodel.has( key ) ) { + // if this is an inline component, we may need to create + // an implicit mapping + if ( this.component && !this.isolated ) { + model = resolveReference( this.component.parentFragment, key ); + + if ( model ) { + this.viewmodel.map( key, model ); + } + } + } + + model = this.viewmodel.joinAll( keys ); + return model.get( true, opts ); + } + + function gatherRefs( fragment ) { + var key = {}, index = {}; + + // walk up the template gather refs as we go + while ( fragment ) { + if ( fragment.parent && ( fragment.parent.indexRef || fragment.parent.keyRef ) ) { + var ref = fragment.parent.indexRef; + if ( ref && !( ref in index ) ) index[ref] = fragment.index; + ref = fragment.parent.keyRef; + if ( ref && !( ref in key ) ) key[ref] = fragment.key; + } + + if ( fragment.componentParent && !fragment.ractive.isolated ) { + fragment = fragment.componentParent; + } else { + fragment = fragment.parent; + } + } + + return { key: key, index: index }; } // This function takes an array, the name of a mutator method, and the @@ -3018,13602 +3418,13620 @@ // This information is used to enable fast, non-destructive shuffling of list // sections when you do e.g. `ractive.splice( 'items', 2, 2 ); - var shared_getNewIndices = getNewIndices; - - function getNewIndices(array, methodName, args) { - var spliceArguments, - len, - newIndices = [], - removeStart, - removeEnd, - balance, - i; + function getNewIndices ( length, methodName, args ) { + var spliceArguments, newIndices = [], removeStart, removeEnd, balance, i; - spliceArguments = getSpliceEquivalent(array, methodName, args); + spliceArguments = getSpliceEquivalent( length, methodName, args ); - if (!spliceArguments) { - return null; // TODO support reverse and sort? - } + if ( !spliceArguments ) { + return null; // TODO support reverse and sort? + } - len = array.length; - balance = spliceArguments.length - 2 - spliceArguments[1]; + balance = ( spliceArguments.length - 2 ) - spliceArguments[1]; - removeStart = Math.min(len, spliceArguments[0]); - removeEnd = removeStart + spliceArguments[1]; + removeStart = Math.min( length, spliceArguments[0] ); + removeEnd = removeStart + spliceArguments[1]; + newIndices.startIndex = removeStart; - for (i = 0; i < removeStart; i += 1) { - newIndices.push(i); - } + for ( i = 0; i < removeStart; i += 1 ) { + newIndices.push( i ); + } - for (; i < removeEnd; i += 1) { - newIndices.push(-1); - } + for ( ; i < removeEnd; i += 1 ) { + newIndices.push( -1 ); + } - for (; i < len; i += 1) { - newIndices.push(i + balance); - } + for ( ; i < length; i += 1 ) { + newIndices.push( i + balance ); + } - // there is a net shift for the rest of the array starting with index + balance - if (balance !== 0) { - newIndices.touchedFrom = spliceArguments[0]; - } else { - newIndices.touchedFrom = array.length; - } + // there is a net shift for the rest of the array starting with index + balance + if ( balance !== 0 ) { + newIndices.touchedFrom = spliceArguments[0]; + } else { + newIndices.touchedFrom = length; + } - return newIndices; + return newIndices; } + // The pop, push, shift an unshift methods can all be represented // as an equivalent splice - function getSpliceEquivalent(array, methodName, args) { - switch (methodName) { - case "splice": - if (args[0] !== undefined && args[0] < 0) { - args[0] = array.length + Math.max(args[0], -array.length); - } + function getSpliceEquivalent ( length, methodName, args ) { + switch ( methodName ) { + case 'splice': + if ( args[0] !== undefined && args[0] < 0 ) { + args[0] = length + Math.max( args[0], -length ); + } + + if ( args[0] === undefined ) args[0] = 0; - while (args.length < 2) { - args.push(0); - } + while ( args.length < 2 ) { + args.push( length - args[0] ); + } - // ensure we only remove elements that exist - args[1] = Math.min(args[1], array.length - args[0]); + if ( typeof args[1] !== 'number' ) { + args[1] = length - args[0]; + } - return args; + // ensure we only remove elements that exist + args[1] = Math.min( args[1], length - args[0] ); - case "sort": - case "reverse": - return null; + return args; - case "pop": - if (array.length) { - return [array.length - 1, 1]; - } - return [0, 0]; + case 'sort': + case 'reverse': + return null; - case "push": - return [array.length, 0].concat(args); + case 'pop': + if ( length ) { + return [ length - 1, 1 ]; + } + return [ 0, 0 ]; - case "shift": - return [0, array.length ? 1 : 0]; + case 'push': + return [ length, 0 ].concat( args ); - case "unshift": - return [0, 0].concat(args); - } + case 'shift': + return [ 0, length ? 1 : 0 ]; + + case 'unshift': + return [ 0, 0 ].concat( args ); + } } var arrayProto = Array.prototype; - var makeArrayMethod = function (methodName) { - return function (keypath) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } + function makeArrayMethod ( methodName ) { + function path ( keypath ) { + var args = [], len = arguments.length - 1; + while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; - var array, - newIndices = [], - len, - promise, - result; + return model( this.viewmodel.joinAll( splitKeypathI( keypath ) ), args ); + } - keypath = getKeypath(normalise(keypath)); + function model ( mdl, args ) { + var array = mdl.get(); - array = this.viewmodel.get(keypath); - len = array.length; + if ( !isArray( array ) ) { + if ( array === undefined ) { + array = []; + var result$1 = arrayProto[ methodName ].apply( array, args ); + var promise$1 = runloop.start( this, true ).then( function () { return result$1; } ); + mdl.set( array ); + runloop.end(); + return promise$1; + } else { + throw new Error( ("shuffle array method " + methodName + " called on non-array at " + (mdl.getKeypath())) ); + } + } - if (!isArray(array)) { - throw new Error("Called ractive." + methodName + "('" + keypath.str + "'), but '" + keypath.str + "' does not refer to an array"); - } + var newIndices = getNewIndices( array.length, methodName, args ); + var result = arrayProto[ methodName ].apply( array, args ); - newIndices = shared_getNewIndices(array, methodName, args); + var promise = runloop.start( this, true ).then( function () { return result; } ); + promise.result = result; - result = arrayProto[methodName].apply(array, args); - promise = global_runloop.start(this, true).then(function () { - return result; - }); + if ( newIndices ) { + mdl.shuffle( newIndices ); + } else { + mdl.set( result ); + } - if (!!newIndices) { - this.viewmodel.smartUpdate(keypath, array, newIndices); - } else { - this.viewmodel.mark(keypath); - } + runloop.end(); - global_runloop.end(); + return promise; + } - return promise; - }; - }; + return { path: path, model: model }; + } - var pop = makeArrayMethod("pop"); - - var push = makeArrayMethod("push"); - - var css, - update, - styleElement, - head, - styleSheet, - inDom, - global_css__prefix = "/* Ractive.js component styles */\n", - styles = [], - dirty = false; - - if (!isClient) { - // TODO handle encapsulated CSS in server-rendered HTML! - css = { - add: noop, - apply: noop - }; - } else { - styleElement = document.createElement("style"); - styleElement.type = "text/css"; - - head = document.getElementsByTagName("head")[0]; - - inDom = false; - - // Internet Exploder won't let you use styleSheet.innerHTML - we have to - // use styleSheet.cssText instead - styleSheet = styleElement.styleSheet; - - update = function () { - var css = global_css__prefix + styles.map(function (s) { - return "\n/* {" + s.id + "} */\n" + s.styles; - }).join("\n"); - - if (styleSheet) { - styleSheet.cssText = css; - } else { - styleElement.innerHTML = css; - } - - if (!inDom) { - head.appendChild(styleElement); - inDom = true; - } - }; - - css = { - add: function (s) { - styles.push(s); - dirty = true; - }, - - apply: function () { - if (dirty) { - update(); - dirty = false; - } - } - }; - } - - var global_css = css; - - var prototype_render = Ractive$render; - - var renderHook = new hooks_Hook("render"), - completeHook = new hooks_Hook("complete"); - function Ractive$render(target, anchor) { - var _this = this; - - var promise, instances, transitionsEnabled; - - // if `noIntro` is `true`, temporarily disable transitions - transitionsEnabled = this.transitionsEnabled; - if (this.noIntro) { - this.transitionsEnabled = false; - } - - promise = global_runloop.start(this, true); - global_runloop.scheduleTask(function () { - return renderHook.fire(_this); - }, true); - - if (this.fragment.rendered) { - throw new Error("You cannot call ractive.render() on an already rendered instance! Call ractive.unrender() first"); - } - - target = getElement(target) || this.el; - anchor = getElement(anchor) || this.anchor; - - this.el = target; - this.anchor = anchor; - - if (!this.append && target) { - // Teardown any existing instances *before* trying to set up the new one - - // avoids certain weird bugs - var others = target.__ractive_instances__; - if (others && others.length) { - removeOtherInstances(others); - } - - // make sure we are the only occupants - target.innerHTML = ""; // TODO is this quicker than removeChild? Initial research inconclusive - } - - if (this.cssId) { - // ensure encapsulated CSS is up-to-date - global_css.apply(); - } - - if (target) { - if (!(instances = target.__ractive_instances__)) { - target.__ractive_instances__ = [this]; - } else { - instances.push(this); - } - - if (anchor) { - target.insertBefore(this.fragment.render(), anchor); - } else { - target.appendChild(this.fragment.render()); - } - } - - global_runloop.end(); - - this.transitionsEnabled = transitionsEnabled; - - return promise.then(function () { - return completeHook.fire(_this); - }); - } - - function removeOtherInstances(others) { - others.splice(0, others.length).forEach(teardown); - } - - var adaptConfigurator = { - extend: function (Parent, proto, options) { - proto.adapt = custom_adapt__combine(proto.adapt, ensureArray(options.adapt)); - }, - - init: function () {} - }; - - var custom_adapt = adaptConfigurator; - - function custom_adapt__combine(a, b) { - var c = a.slice(), - i = b.length; - - while (i--) { - if (! ~c.indexOf(b[i])) { - c.push(b[i]); - } - } - - return c; - } - - var transform = transformCss; - - var selectorsPattern = /(?:^|\})?\s*([^\{\}]+)\s*\{/g, - commentsPattern = /\/\*.*?\*\//g, - selectorUnitPattern = /((?:(?:\[[^\]+]\])|(?:[^\s\+\>\~:]))+)((?::[^\s\+\>\~\(]+(?:\([^\)]+\))?)?\s*[\s\+\>\~]?)\s*/g, - mediaQueryPattern = /^@media/, - dataRvcGuidPattern = /\[data-ractive-css~="\{[a-z0-9-]+\}"]/g; - function transformCss(css, id) { - var transformed, dataAttr, addGuid; - - dataAttr = "[data-ractive-css~=\"{" + id + "}\"]"; - - addGuid = function (selector) { - var selectorUnits, - match, - unit, - base, - prepended, - appended, - i, - transformed = []; - - selectorUnits = []; - - while (match = selectorUnitPattern.exec(selector)) { - selectorUnits.push({ - str: match[0], - base: match[1], - modifiers: match[2] - }); - } - - // For each simple selector within the selector, we need to create a version - // that a) combines with the id, and b) is inside the id - base = selectorUnits.map(extractString); - - i = selectorUnits.length; - while (i--) { - appended = base.slice(); - - // Pseudo-selectors should go after the attribute selector - unit = selectorUnits[i]; - appended[i] = unit.base + dataAttr + unit.modifiers || ""; - - prepended = base.slice(); - prepended[i] = dataAttr + " " + prepended[i]; - - transformed.push(appended.join(" "), prepended.join(" ")); - } - - return transformed.join(", "); - }; - - if (dataRvcGuidPattern.test(css)) { - transformed = css.replace(dataRvcGuidPattern, dataAttr); - } else { - transformed = css.replace(commentsPattern, "").replace(selectorsPattern, function (match, $1) { - var selectors, transformed; - - // don't transform media queries! - if (mediaQueryPattern.test($1)) return match; - - selectors = $1.split(",").map(trim); - transformed = selectors.map(addGuid).join(", ") + " "; - - return match.replace($1, transformed); - }); - } - - return transformed; - } - - function trim(str) { - if (str.trim) { - return str.trim(); - } - - return str.replace(/^\s+/, "").replace(/\s+$/, ""); - } - - function extractString(unit) { - return unit.str; - } - - var css_css__uid = 1; - - var cssConfigurator = { - name: "css", - - extend: function (Parent, proto, options) { - if (options.css) { - var id = css_css__uid++; - var styles = options.noCssTransform ? options.css : transform(options.css, id); - - proto.cssId = id; - global_css.add({ id: id, styles: styles }); - } - }, - - init: function () {} - }; - - var css_css = cssConfigurator; - - function validate(data) { - // Warn if userOptions.data is a non-POJO - if (data && data.constructor !== Object) { - if (typeof data === "function") {} else if (typeof data !== "object") { - fatal("data option must be an object or a function, `" + data + "` is not valid"); - } else { - warnIfDebug("If supplied, options.data should be a plain JavaScript object - using a non-POJO as the root object may work, but is discouraged"); - } - } - } - - var dataConfigurator = { - name: "data", - - extend: function (Parent, proto, options) { - var key = undefined, - value = undefined; - - // check for non-primitives, which could cause mutation-related bugs - if (options.data && isObject(options.data)) { - for (key in options.data) { - value = options.data[key]; - - if (value && typeof value === "object") { - if (isObject(value) || isArray(value)) { - warnIfDebug("Passing a `data` option with object and array properties to Ractive.extend() is discouraged, as mutating them is likely to cause bugs. Consider using a data function instead:\n\n // this...\n data: function () {\n return {\n myObject: {}\n };\n })\n\n // instead of this:\n data: {\n myObject: {}\n }"); - } - } - } - } - - proto.data = custom_data__combine(proto.data, options.data); - }, - - init: function (Parent, ractive, options) { - var result = custom_data__combine(Parent.prototype.data, options.data); - - if (typeof result === "function") { - result = result.call(ractive); - } - - return result || {}; - }, - - reset: function (ractive) { - var result = this.init(ractive.constructor, ractive, ractive.viewmodel); - - ractive.viewmodel.reset(result); - return true; - } - }; - - var custom_data = dataConfigurator; - - function custom_data__combine(parentValue, childValue) { - validate(childValue); - - var parentIsFn = typeof parentValue === "function"; - var childIsFn = typeof childValue === "function"; - - // Very important, otherwise child instance can become - // the default data object on Ractive or a component. - // then ractive.set() ends up setting on the prototype! - if (!childValue && !parentIsFn) { - childValue = {}; - } - - // Fast path, where we just need to copy properties from - // parent to child - if (!parentIsFn && !childIsFn) { - return fromProperties(childValue, parentValue); - } - - return function () { - var child = childIsFn ? callDataFunction(childValue, this) : childValue; - var parent = parentIsFn ? callDataFunction(parentValue, this) : parentValue; - - return fromProperties(child, parent); - }; - } - - function callDataFunction(fn, context) { - var data = fn.call(context); - - if (!data) return; - - if (typeof data !== "object") { - fatal("Data function must return an object"); - } - - if (data.constructor !== Object) { - warnOnceIfDebug("Data function returned something other than a plain JavaScript object. This might work, but is strongly discouraged"); - } - - return data; - } - - function fromProperties(primary, secondary) { - if (primary && secondary) { - for (var key in secondary) { - if (!(key in primary)) { - primary[key] = secondary[key]; - } - } - - return primary; - } - - return primary || secondary; - } - - // TODO do we need to support this in the new Ractive() case? - - var Parser, - ParseError, - parse_Parser__leadingWhitespace = /^\s+/; - - ParseError = function (message) { - this.name = "ParseError"; - this.message = message; - try { - throw new Error(message); - } catch (e) { - this.stack = e.stack; - } - }; - - ParseError.prototype = Error.prototype; - - Parser = function (str, options) { - var items, - item, - lineStart = 0; - - this.str = str; - this.options = options || {}; - this.pos = 0; - - this.lines = this.str.split("\n"); - this.lineEnds = this.lines.map(function (line) { - var lineEnd = lineStart + line.length + 1; // +1 for the newline - - lineStart = lineEnd; - return lineEnd; - }, 0); - - // Custom init logic - if (this.init) this.init(str, options); - - items = []; - - while (this.pos < this.str.length && (item = this.read())) { - items.push(item); - } - - this.leftover = this.remaining(); - this.result = this.postProcess ? this.postProcess(items, options) : items; - }; - - Parser.prototype = { - read: function (converters) { - var pos, i, len, item; - - if (!converters) converters = this.converters; - - pos = this.pos; - - len = converters.length; - for (i = 0; i < len; i += 1) { - this.pos = pos; // reset for each attempt - - if (item = converters[i](this)) { - return item; - } - } - - return null; - }, - - getLinePos: function (char) { - var lineNum = 0, - lineStart = 0, - columnNum; - - while (char >= this.lineEnds[lineNum]) { - lineStart = this.lineEnds[lineNum]; - lineNum += 1; - } - - columnNum = char - lineStart; - return [lineNum + 1, columnNum + 1, char]; // line/col should be one-based, not zero-based! - }, - - error: function (message) { - var pos = this.getLinePos(this.pos); - var lineNum = pos[0]; - var columnNum = pos[1]; - - var line = this.lines[pos[0] - 1]; - var numTabs = 0; - var annotation = line.replace(/\t/g, function (match, char) { - if (char < pos[1]) { - numTabs += 1; - } - - return " "; - }) + "\n" + new Array(pos[1] + numTabs).join(" ") + "^----"; - - var error = new ParseError("" + message + " at line " + lineNum + " character " + columnNum + ":\n" + annotation); - - error.line = pos[0]; - error.character = pos[1]; - error.shortMessage = message; - - throw error; - }, - - matchString: function (string) { - if (this.str.substr(this.pos, string.length) === string) { - this.pos += string.length; - return string; - } - }, - - matchPattern: function (pattern) { - var match; - - if (match = pattern.exec(this.remaining())) { - this.pos += match[0].length; - return match[1] || match[0]; - } - }, - - allowWhitespace: function () { - this.matchPattern(parse_Parser__leadingWhitespace); - }, - - remaining: function () { - return this.str.substring(this.pos); - }, - - nextChar: function () { - return this.str.charAt(this.pos); - } - }; - - Parser.extend = function (proto) { - var Parent = this, - Child, - key; - - Child = function (str, options) { - Parser.call(this, str, options); - }; - - Child.prototype = create(Parent.prototype); - - for (key in proto) { - if (hasOwn.call(proto, key)) { - Child.prototype[key] = proto[key]; - } - } - - Child.extend = Parser.extend; - return Child; - }; - - var parse_Parser = Parser; - - var TEXT = 1; - var INTERPOLATOR = 2; - var TRIPLE = 3; - var SECTION = 4; - var INVERTED = 5; - var CLOSING = 6; - var ELEMENT = 7; - var PARTIAL = 8; - var COMMENT = 9; - var DELIMCHANGE = 10; - var ATTRIBUTE = 13; - var CLOSING_TAG = 14; - var COMPONENT = 15; - var YIELDER = 16; - var INLINE_PARTIAL = 17; - var DOCTYPE = 18; - - var NUMBER_LITERAL = 20; - var STRING_LITERAL = 21; - var ARRAY_LITERAL = 22; - var OBJECT_LITERAL = 23; - var BOOLEAN_LITERAL = 24; - var REGEXP_LITERAL = 25; - - var GLOBAL = 26; - var KEY_VALUE_PAIR = 27; - - var REFERENCE = 30; - var REFINEMENT = 31; - var MEMBER = 32; - var PREFIX_OPERATOR = 33; - var BRACKETED = 34; - var CONDITIONAL = 35; - var INFIX_OPERATOR = 36; - - var INVOCATION = 40; - - var SECTION_IF = 50; - var SECTION_UNLESS = 51; - var SECTION_EACH = 52; - var SECTION_WITH = 53; - var SECTION_IF_WITH = 54; - - var ELSE = 60; - var ELSEIF = 61; - - var mustache_readDelimiterChange = readDelimiterChange; - var delimiterChangePattern = /^[^\s=]+/, - whitespacePattern = /^\s+/; - function readDelimiterChange(parser) { - var start, opening, closing; - - if (!parser.matchString("=")) { - return null; - } - - start = parser.pos; - - // allow whitespace before new opening delimiter - parser.allowWhitespace(); - - opening = parser.matchPattern(delimiterChangePattern); - if (!opening) { - parser.pos = start; - return null; - } - - // allow whitespace (in fact, it's necessary...) - if (!parser.matchPattern(whitespacePattern)) { - return null; - } - - closing = parser.matchPattern(delimiterChangePattern); - if (!closing) { - parser.pos = start; - return null; - } - - // allow whitespace before closing '=' - parser.allowWhitespace(); - - if (!parser.matchString("=")) { - parser.pos = start; - return null; - } - - return [opening, closing]; - } - - var readRegexpLiteral = readRegexpLiteral__readNumberLiteral; - var regexpPattern = /^(\/(?:[^\n\r\u2028\u2029/\\[]|\\.|\[(?:[^\n\r\u2028\u2029\]\\]|\\.)*])+\/(?:([gimuy])(?![a-z]*\2))*(?![a-zA-Z_$0-9]))/; - function readRegexpLiteral__readNumberLiteral(parser) { - var result; - - if (result = parser.matchPattern(regexpPattern)) { - return { - t: REGEXP_LITERAL, - v: result - }; - } - - return null; - } - - var converters_readMustache = readMustache; - - var delimiterChangeToken = { t: DELIMCHANGE, exclude: true }; - function readMustache(parser) { - var mustache, i; - - // If we're inside a