conjur-asset-ui 1.4.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -3
  3. data/CHANGELOG.md +10 -0
  4. data/Makefile +19 -0
  5. data/README.md +0 -3
  6. data/Rakefile +22 -17
  7. data/TODO.md +0 -23
  8. data/app/.csscomb.json +304 -0
  9. data/app/.eslintignore +3 -0
  10. data/app/.eslintrc +265 -0
  11. data/app/config/preprocessor.js +19 -0
  12. data/app/config/webpack.js +124 -0
  13. data/app/gulpfile.js +96 -0
  14. data/app/package.json +86 -0
  15. data/app/src/actions.js +550 -0
  16. data/app/src/app.js +83 -0
  17. data/app/src/clients/audit.js +34 -0
  18. data/app/src/clients/auth.js +24 -0
  19. data/app/src/clients/generic.js +52 -0
  20. data/app/src/clients/graph.js +7 -0
  21. data/app/src/clients/layer_members.js +18 -0
  22. data/app/src/clients/list.js +31 -0
  23. data/app/src/clients/members.js +20 -0
  24. data/app/src/clients/request.js +531 -0
  25. data/app/src/clients/search.js +5 -0
  26. data/app/src/components/app/__tests__/app-test.js +22 -0
  27. data/app/src/components/app/app.js +36 -0
  28. data/app/src/components/app/wrapper.js +17 -0
  29. data/app/src/components/audit/__tests__/table_header-test.js +22 -0
  30. data/app/src/components/audit/box.js +9 -0
  31. data/app/src/components/audit/constants.js +5 -0
  32. data/app/src/components/audit/entry.js +105 -0
  33. data/app/src/components/audit/fields_mixin.js +11 -0
  34. data/app/src/components/audit/humanize_event.js +213 -0
  35. data/app/src/components/audit/table.js +64 -0
  36. data/app/src/components/audit/table_header.js +37 -0
  37. data/app/src/components/audit/timestamp.js +28 -0
  38. data/app/src/components/auth/login.js +177 -0
  39. data/app/src/components/auth/login.less +71 -0
  40. data/app/src/components/auth/logout.js +42 -0
  41. data/app/src/components/auth/logout.less +21 -0
  42. data/app/src/components/chart/chart.js +540 -0
  43. data/app/src/components/chart/chart_helper_mixin.js +78 -0
  44. data/app/src/components/custom/list.js +3 -0
  45. data/app/src/components/custom/view.js +81 -0
  46. data/app/src/components/dashboard/activity.js +144 -0
  47. data/app/src/components/dashboard/dashboard.js +46 -0
  48. data/app/src/components/flash/flash.js +98 -0
  49. data/app/src/components/flash/flash.less +3 -0
  50. data/app/src/components/generic/__tests__/time-test.js +42 -0
  51. data/app/src/components/generic/annotations.js +39 -0
  52. data/app/src/components/generic/breadcrumbs.js +57 -0
  53. data/app/src/components/generic/foldable_audit_section.js +204 -0
  54. data/app/src/components/generic/list.js +141 -0
  55. data/app/src/components/generic/list_factory.js +41 -0
  56. data/app/src/components/generic/resource_link.js +64 -0
  57. data/app/src/components/generic/role_link.js +66 -0
  58. data/app/src/components/generic/tab_mixin.js +146 -0
  59. data/app/src/components/generic/time.js +32 -0
  60. data/app/src/components/graph/__tests__/collapse-test.js +133 -0
  61. data/app/src/components/graph/__tests__/edges-from-vertices-test.js +48 -0
  62. data/app/src/components/graph/__tests__/new-vertex-set-test.js +16 -0
  63. data/app/src/components/graph/__tests__/next-id-test.js +27 -0
  64. data/app/src/components/graph/__tests__/role-kind-from-id-test.js +24 -0
  65. data/app/src/components/graph/__tests__/vertices-from-edges-test.js +72 -0
  66. data/app/src/components/graph/graph.js +449 -0
  67. data/app/src/components/graph/graph.less +39 -0
  68. data/app/src/components/graph/helpers.js +368 -0
  69. data/app/src/components/group/list.js +3 -0
  70. data/app/src/components/group/view.js +153 -0
  71. data/app/src/components/host/activity.js +111 -0
  72. data/app/src/components/host/details.js +28 -0
  73. data/app/src/components/host/executors.js +77 -0
  74. data/app/src/components/host/host_link.js +18 -0
  75. data/app/src/components/host/list.js +3 -0
  76. data/app/src/components/host/updaters.js +77 -0
  77. data/app/src/components/host/view.js +145 -0
  78. data/app/src/components/layer/list.js +3 -0
  79. data/app/src/components/layer/view.js +197 -0
  80. data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
  81. data/app/src/components/navbar/nav_search_form.js +40 -0
  82. data/app/src/components/navbar/navbar.js +96 -0
  83. data/app/src/components/notfound/notfound.js +35 -0
  84. data/app/src/components/notfound/notfound.less +21 -0
  85. data/app/src/components/owned_resources/owned_resources.js +84 -0
  86. data/app/src/components/owned_resources/owned_resources_box.js +101 -0
  87. data/app/src/components/permissions/permissions.js +138 -0
  88. data/app/src/components/permissions/permissions_table.js +101 -0
  89. data/app/src/components/policy/list.js +3 -0
  90. data/app/src/components/policy/view.js +107 -0
  91. data/app/src/components/refresh/refresh.js +29 -0
  92. data/app/src/components/refresh/refresh.less +15 -0
  93. data/app/src/components/search/group.js +43 -0
  94. data/app/src/components/search/group_heading.js +50 -0
  95. data/app/src/components/search/group_title.js +37 -0
  96. data/app/src/components/search/result_item.js +55 -0
  97. data/app/src/components/search/search.js +118 -0
  98. data/app/src/components/user/activity.js +112 -0
  99. data/app/src/components/user/details.js +30 -0
  100. data/app/src/components/user/list.js +3 -0
  101. data/app/src/components/user/pubkeys.js +118 -0
  102. data/app/src/components/user/pubkeys.less +56 -0
  103. data/app/src/components/user/view.js +143 -0
  104. data/app/src/components/variable/activity.js +101 -0
  105. data/app/src/components/variable/details.js +46 -0
  106. data/app/src/components/variable/fetchers.js +77 -0
  107. data/app/src/components/variable/list.js +3 -0
  108. data/app/src/components/variable/updaters.js +77 -0
  109. data/app/src/components/variable/view.js +115 -0
  110. data/app/src/constants.js +36 -0
  111. data/{public → app/src}/images/conjur-logo.svg +0 -0
  112. data/{public → app/src}/images/icon-client-pc.svg +0 -0
  113. data/{public → app/src}/images/icon-environment.png +0 -0
  114. data/{public → app/src}/images/icon-person.svg +0 -0
  115. data/{public → app/src}/images/icon-policy.png +0 -0
  116. data/{public → app/src}/images/icon-resource.png +0 -0
  117. data/{public → app/src}/images/icon-service-dots.svg +0 -0
  118. data/{public → app/src}/images/icon-variable.png +0 -0
  119. data/app/src/pages/index.html +27 -0
  120. data/app/src/routes.js +64 -0
  121. data/app/src/stores/app_store.js +35 -0
  122. data/app/src/stores/audit_store.js +143 -0
  123. data/app/src/stores/graph_store.js +51 -0
  124. data/app/src/stores/group_store.js +104 -0
  125. data/app/src/stores/host_store.js +111 -0
  126. data/app/src/stores/layer_store.js +115 -0
  127. data/app/src/stores/policy_store.js +88 -0
  128. data/app/src/stores/resources_store.js +115 -0
  129. data/app/src/stores/route_store.js +21 -0
  130. data/app/src/stores/search_store.js +77 -0
  131. data/app/src/stores/user_store.js +109 -0
  132. data/app/src/stores/variable_store.js +93 -0
  133. data/app/src/styles/bootstrap.less +54 -0
  134. data/{public/css → app/src/styles}/styles.less +26 -82
  135. data/app/src/utils.js +38 -0
  136. data/app/src/vendor/pace.js +2 -0
  137. data/conjur-asset-ui.gemspec +3 -4
  138. data/docker/assets-build/Dockerfile +12 -0
  139. data/docker/conjur-ui/Dockerfile +33 -0
  140. data/docker/conjur-ui/README.md +38 -0
  141. data/docker/conjur-ui/mime.types +90 -0
  142. data/docker/conjur-ui/nginx.conf +110 -0
  143. data/docker/conjur-ui/start.py +72 -0
  144. data/docker/conjur-ui/start.sh +18 -0
  145. data/docker/conjur-ui/test.env +8 -0
  146. data/lib/conjur-asset-ui-version.rb +1 -1
  147. data/lib/conjur/command/ui.rb +10 -2
  148. data/lib/conjur/webserver/home.rb +3 -3
  149. data/lib/conjur/webserver/login.rb +1 -1
  150. data/lib/conjur/webserver/server.rb +16 -4
  151. data/public/js/views/roleGraph.js +91 -0
  152. metadata +167 -105
  153. data/.jshintrc +0 -41
  154. data/bower.json +0 -98
  155. data/gulpfile.js +0 -139
  156. data/package.json +0 -47
  157. data/preprocessor.js +0 -7
  158. data/public/_client_libs.html +0 -9
  159. data/public/index.html.erb +0 -63
  160. data/public/js/init.js +0 -196
  161. data/public/js/lib/pace.js +0 -2
  162. data/public/js/lib/sorted-set.no-require.js +0 -1145
  163. data/public/js/lib/sorted-set.no-require.js.txt +0 -6
  164. data/public/js/models/groupRecord.js +0 -72
  165. data/public/js/models/hostRecord.js +0 -60
  166. data/public/js/models/layerRecord.js +0 -79
  167. data/public/js/models/namespace.js +0 -12
  168. data/public/js/models/policyList.js +0 -16
  169. data/public/js/models/policyRecord.js +0 -54
  170. data/public/js/models/record.js +0 -117
  171. data/public/js/models/resourceList.js +0 -87
  172. data/public/js/models/userList.js +0 -25
  173. data/public/js/models/userRecord.js +0 -75
  174. data/public/js/models/variableList.js +0 -27
  175. data/public/js/models/variableRecord.js +0 -77
  176. data/public/js/routers.js +0 -242
  177. data/public/js/views/annotations.js +0 -47
  178. data/public/js/views/audit.js +0 -369
  179. data/public/js/views/breadcrumbs.js +0 -62
  180. data/public/js/views/chart.js +0 -617
  181. data/public/js/views/dashboard.js +0 -146
  182. data/public/js/views/generic.js +0 -122
  183. data/public/js/views/group.js +0 -109
  184. data/public/js/views/groups.js +0 -26
  185. data/public/js/views/host.js +0 -200
  186. data/public/js/views/hosts.js +0 -26
  187. data/public/js/views/layer.js +0 -146
  188. data/public/js/views/layers.js +0 -26
  189. data/public/js/views/mixins/search.js +0 -22
  190. data/public/js/views/mixins/tabs.js +0 -154
  191. data/public/js/views/namespaces.js +0 -40
  192. data/public/js/views/navSearch.js +0 -36
  193. data/public/js/views/owned.js +0 -184
  194. data/public/js/views/permissions.js +0 -254
  195. data/public/js/views/policies.js +0 -26
  196. data/public/js/views/policy.js +0 -70
  197. data/public/js/views/resource.js +0 -59
  198. data/public/js/views/role.js +0 -63
  199. data/public/js/views/searchResults.js +0 -212
  200. data/public/js/views/sections.js +0 -226
  201. data/public/js/views/time.js +0 -39
  202. data/public/js/views/user.js +0 -297
  203. data/public/js/views/users.js +0 -26
  204. data/public/js/views/variable.js +0 -310
  205. data/public/js/views/variables.js +0 -26
  206. data/spec/javascripts/helpers/.gitkeep +0 -0
  207. data/spec/javascripts/support/jasmine.yml +0 -112
  208. data/spec/javascripts/support/jasmine_helper.rb +0 -22
  209. data/spec/javascripts/support/run.html.erb +0 -23
  210. data/spec/javascripts/views/AuditSpec.js +0 -22
  211. data/spec/javascripts/views/AuditSpec.ls +0 -18
@@ -1,2 +0,0 @@
1
- /*! pace 0.4.17 */
2
- (function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V=[].slice,W={}.hasOwnProperty,X=function(a,b){function c(){this.constructor=a}for(var d in b)W.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},Y=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};for(t={catchupTime:500,initialRate:.03,minTime:500,ghostTime:500,maxProgressPerFrame:10,easeFactor:1.25,startOnPageLoad:!0,restartOnPushState:!0,restartOnRequestAfter:500,target:"body",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:!1}},B=function(){var a;return null!=(a="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?a:+new Date},D=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,s=window.cancelAnimationFrame||window.mozCancelAnimationFrame,null==D&&(D=function(a){return setTimeout(a,50)},s=function(a){return clearTimeout(a)}),F=function(a){var b,c;return b=B(),(c=function(){var d;return d=B()-b,d>=33?(b=B(),a(d,function(){return D(c)})):setTimeout(c,33-d)})()},E=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?V.call(arguments,2):[],"function"==typeof c[b]?c[b].apply(c,a):c[b]},u=function(){var a,b,c,d,e,f,g;for(b=arguments[0],d=2<=arguments.length?V.call(arguments,1):[],f=0,g=d.length;g>f;f++)if(c=d[f])for(a in c)W.call(c,a)&&(e=c[a],null!=b[a]&&"object"==typeof b[a]&&null!=e&&"object"==typeof e?u(b[a],e):b[a]=e);return b},p=function(a){var b,c,d,e,f;for(c=b=0,e=0,f=a.length;f>e;e++)d=a[e],c+=Math.abs(d),b++;return c/b},w=function(a,b){var c,d,e;if(null==a&&(a="options"),null==b&&(b=!0),e=document.querySelector("[data-pace-"+a+"]")){if(c=e.getAttribute("data-pace-"+a),!b)return c;try{return JSON.parse(c)}catch(f){return d=f,"undefined"!=typeof console&&null!==console?console.error("Error parsing inline pace options",d):void 0}}},g=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];c<this.bindings[a].length;)this.bindings[a][c].handler===b?e.push(this.bindings[a].splice(c,1)):e.push(c++);return e}},a.prototype.trigger=function(){var a,b,c,d,e,f,g,h,i;if(c=arguments[0],a=2<=arguments.length?V.call(arguments,1):[],null!=(g=this.bindings)?g[c]:void 0){for(e=0,i=[];e<this.bindings[c].length;)h=this.bindings[c][e],d=h.handler,b=h.ctx,f=h.once,d.apply(null!=b?b:this,a),f?i.push(this.bindings[c].splice(e,1)):i.push(e++);return i}},a}(),null==window.Pace&&(window.Pace={}),u(Pace,g.prototype),C=Pace.options=u({},t,window.paceOptions,w()),S=["ajax","document","eventLag","elements"],O=0,Q=S.length;Q>O;O++)I=S[O],C[I]===!0&&(C[I]=t[I]);i=function(a){function b(){return T=b.__super__.constructor.apply(this,arguments)}return X(b,a),b}(Error),b=function(){function a(){this.progress=0}return a.prototype.getElement=function(){var a;if(null==this.el){if(a=document.querySelector(C.target),!a)throw new i;this.el=document.createElement("div"),this.el.className="pace pace-active",document.body.className=document.body.className.replace("pace-done",""),document.body.className+=" pace-running",this.el.innerHTML='<div class="pace-progress">\n <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>',null!=a.firstChild?a.insertBefore(this.el,a.firstChild):a.appendChild(this.el)}return this.el},a.prototype.finish=function(){var a;return a=this.getElement(),a.className=a.className.replace("pace-active",""),a.className+=" pace-inactive",document.body.className=document.body.className.replace("pace-running",""),document.body.className+=" pace-done"},a.prototype.update=function(a){return this.progress=a,this.render()},a.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(a){i=a}return this.el=void 0},a.prototype.render=function(){var a,b;return null==document.querySelector(C.target)?!1:(a=this.getElement(),a.children[0].style.width=""+this.progress+"%",(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0)&&(a.children[0].setAttribute("data-progress-text",""+(0|this.progress)+"%"),this.progress>=100?b="99":(b=this.progress<10?"0":"",b+=0|this.progress),a.children[0].setAttribute("data-progress",""+b)),this.lastRenderedProgress=this.progress)},a.prototype.done=function(){return this.progress>=100},a}(),h=function(){function a(){this.bindings={}}return a.prototype.trigger=function(a,b){var c,d,e,f,g;if(null!=this.bindings[a]){for(f=this.bindings[a],g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(c.call(this,b));return g}},a.prototype.on=function(a,b){var c;return null==(c=this.bindings)[a]&&(c[a]=[]),this.bindings[a].push(b)},a}(),N=window.XMLHttpRequest,M=window.XDomainRequest,L=window.WebSocket,v=function(a,b){var c,d,e,f;f=[];for(d in b.prototype)try{e=b.prototype[d],null==a[d]&&"function"!=typeof e?f.push(a[d]=e):f.push(void 0)}catch(g){c=g}return f},z=[],Pace.ignore=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?V.call(arguments,1):[],z.unshift("ignore"),c=b.apply(null,a),z.shift(),c},Pace.track=function(){var a,b,c;return b=arguments[0],a=2<=arguments.length?V.call(arguments,1):[],z.unshift("track"),c=b.apply(null,a),z.shift(),c},H=function(a){var b;if(null==a&&(a="GET"),"track"===z[0])return"force";if(!z.length&&C.ajax){if("socket"===a&&C.ajax.trackWebSockets)return!0;if(b=a.toUpperCase(),Y.call(C.ajax.trackMethods,b)>=0)return!0}return!1},j=function(a){function b(){var a,c=this;b.__super__.constructor.apply(this,arguments),a=function(a){var b;return b=a.open,a.open=function(d,e){return H(d)&&c.trigger("request",{type:d,url:e,request:a}),b.apply(a,arguments)}},window.XMLHttpRequest=function(b){var c;return c=new N(b),a(c),c},v(window.XMLHttpRequest,N),null!=M&&(window.XDomainRequest=function(){var b;return b=new M,a(b),b},v(window.XDomainRequest,M)),null!=L&&C.ajax.trackWebSockets&&(window.WebSocket=function(a,b){var d;return d=new L(a,b),H("socket")&&c.trigger("request",{type:"socket",url:a,protocols:b,request:d}),d},v(window.WebSocket,L))}return X(b,a),b}(h),P=null,x=function(){return null==P&&(P=new j),P},x().on("request",function(b){var c,d,e,f;return f=b.type,e=b.request,Pace.running||C.restartOnRequestAfter===!1&&"force"!==H(f)?void 0:(d=arguments,c=C.restartOnRequestAfter||0,"boolean"==typeof c&&(c=0),setTimeout(function(){var b,c,g,h,i,j;if(b="socket"===f?e.readyState<2:0<(h=e.readyState)&&4>h){for(Pace.restart(),i=Pace.sources,j=[],c=0,g=i.length;g>c;c++){if(I=i[c],I instanceof a){I.watch.apply(I,d);break}j.push(void 0)}return j}},c))}),a=function(){function a(){var a=this;this.elements=[],x().on("request",function(){return a.watch.apply(a,arguments)})}return a.prototype.watch=function(a){var b,c,d;return d=a.type,b=a.request,c="socket"===d?new m(b):new n(b),this.elements.push(c)},a}(),n=function(){function a(a){var b,c,d,e,f,g,h=this;if(this.progress=0,null!=window.ProgressEvent)for(c=null,a.addEventListener("progress",function(a){return h.progress=a.lengthComputable?100*a.loaded/a.total:h.progress+(100-h.progress)/2}),g=["load","abort","timeout","error"],d=0,e=g.length;e>d;d++)b=g[d],a.addEventListener(b,function(){return h.progress=100});else f=a.onreadystatechange,a.onreadystatechange=function(){var b;return 0===(b=a.readyState)||4===b?h.progress=100:3===a.readyState&&(h.progress=50),"function"==typeof f?f.apply(null,arguments):void 0}}return a}(),m=function(){function a(a){var b,c,d,e,f=this;for(this.progress=0,e=["error","open"],c=0,d=e.length;d>c;c++)b=e[c],a.addEventListener(b,function(){return f.progress=100})}return a}(),d=function(){function a(a){var b,c,d,f;for(null==a&&(a={}),this.elements=[],null==a.selectors&&(a.selectors=[]),f=a.selectors,c=0,d=f.length;d>c;c++)b=f[c],this.elements.push(new e(b))}return a}(),e=function(){function a(a){this.selector=a,this.progress=0,this.check()}return a.prototype.check=function(){var a=this;return document.querySelector(this.selector)?this.done():setTimeout(function(){return a.check()},C.elements.checkInterval)},a.prototype.done=function(){return this.progress=100},a}(),c=function(){function a(){var a,b,c=this;this.progress=null!=(b=this.states[document.readyState])?b:100,a=document.onreadystatechange,document.onreadystatechange=function(){return null!=c.states[document.readyState]&&(c.progress=c.states[document.readyState]),"function"==typeof a?a.apply(null,arguments):void 0}}return a.prototype.states={loading:0,interactive:50,complete:100},a}(),f=function(){function a(){var a,b,c,d,e,f=this;this.progress=0,a=0,e=[],d=0,c=B(),b=setInterval(function(){var g;return g=B()-c-50,c=B(),e.push(g),e.length>C.eventLag.sampleCount&&e.shift(),a=p(e),++d>=C.eventLag.minSamples&&a<C.eventLag.lagThreshold?(f.progress=100,clearInterval(b)):f.progress=100*(3/(a+3))},50)}return a}(),l=function(){function a(a){this.source=a,this.last=this.sinceLastUpdate=0,this.rate=C.initialRate,this.catchup=0,this.progress=this.lastProgress=0,null!=this.source&&(this.progress=E(this.source,"progress"))}return a.prototype.tick=function(a,b){var c;return null==b&&(b=E(this.source,"progress")),b>=100&&(this.done=!0),b===this.last?this.sinceLastUpdate+=a:(this.sinceLastUpdate&&(this.rate=(b-this.last)/this.sinceLastUpdate),this.catchup=(b-this.progress)/C.catchupTime,this.sinceLastUpdate=0,this.last=b),b>this.progress&&(this.progress+=this.catchup*a),c=1-Math.pow(this.progress/100,C.easeFactor),this.progress+=c*this.rate*a,this.progress=Math.min(this.lastProgress+C.maxProgressPerFrame,this.progress),this.progress=Math.max(0,this.progress),this.progress=Math.min(100,this.progress),this.lastProgress=this.progress,this.progress},a}(),J=null,G=null,q=null,K=null,o=null,r=null,Pace.running=!1,y=function(){return C.restartOnPushState?Pace.restart():void 0},null!=window.history.pushState&&(R=window.history.pushState,window.history.pushState=function(){return y(),R.apply(window.history,arguments)}),null!=window.history.replaceState&&(U=window.history.replaceState,window.history.replaceState=function(){return y(),U.apply(window.history,arguments)}),k={ajax:a,elements:d,document:c,eventLag:f},(A=function(){var a,c,d,e,f,g,h,i;for(Pace.sources=J=[],g=["ajax","elements","document","eventLag"],c=0,e=g.length;e>c;c++)a=g[c],C[a]!==!1&&J.push(new k[a](C[a]));for(i=null!=(h=C.extraSources)?h:[],d=0,f=i.length;f>d;d++)I=i[d],J.push(new I(C));return Pace.bar=q=new b,G=[],K=new l})(),Pace.stop=function(){return Pace.trigger("stop"),Pace.running=!1,q.destroy(),r=!0,null!=o&&("function"==typeof s&&s(o),o=null),A()},Pace.restart=function(){return Pace.trigger("restart"),Pace.stop(),Pace.start()},Pace.go=function(){return Pace.running=!0,q.render(),r=!1,o=F(function(a,b){var c,d,e,f,g,h,i,j,k,m,n,o,p,s,t,u,v;for(j=100-q.progress,d=o=0,e=!0,h=p=0,t=J.length;t>p;h=++p)for(I=J[h],m=null!=G[h]?G[h]:G[h]=[],g=null!=(v=I.elements)?v:[I],i=s=0,u=g.length;u>s;i=++s)f=g[i],k=null!=m[i]?m[i]:m[i]=new l(f),e&=k.done,k.done||(d++,o+=k.tick(a));return c=o/d,q.update(K.tick(a,c)),n=B(),q.done()||e||r?(q.update(100),Pace.trigger("done"),setTimeout(function(){return q.finish(),Pace.running=!1,Pace.trigger("hide")},Math.max(C.ghostTime,Math.min(C.minTime,B()-n)))):b()})},Pace.start=function(a){u(C,a),Pace.running=!0;try{q.render()}catch(b){i=b}return document.querySelector(".pace")?(Pace.trigger("start"),Pace.go()):setTimeout(Pace.start,50)},"function"==typeof define&&define.amd?define(function(){return Pace}):"object"==typeof exports?module.exports=Pace:C.startOnPageLoad&&Pace.start()}).call(this);
@@ -1,1145 +0,0 @@
1
- (function () {
2
- /**
3
- * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
4
- * Available via the MIT or new BSD license.
5
- * see: http://github.com/jrburke/almond for details
6
- */
7
- //Going sloppy to avoid 'use strict' string cost, but strict practices should
8
- //be followed.
9
- /*jslint sloppy: true */
10
- /*global setTimeout: false */
11
-
12
- var requirejs, require, define;
13
- (function (undef) {
14
- var main, req, makeMap, handlers,
15
- defined = {},
16
- waiting = {},
17
- config = {},
18
- defining = {},
19
- hasOwn = Object.prototype.hasOwnProperty,
20
- aps = [].slice;
21
-
22
- function hasProp(obj, prop) {
23
- return hasOwn.call(obj, prop);
24
- }
25
-
26
- /**
27
- * Given a relative module name, like ./something, normalize it to
28
- * a real name that can be mapped to a path.
29
- * @param {String} name the relative name
30
- * @param {String} baseName a real name that the name arg is relative
31
- * to.
32
- * @returns {String} normalized name
33
- */
34
- function normalize(name, baseName) {
35
- var nameParts, nameSegment, mapValue, foundMap,
36
- foundI, foundStarMap, starI, i, j, part,
37
- baseParts = baseName && baseName.split("/"),
38
- map = config.map,
39
- starMap = (map && map['*']) || {};
40
-
41
- //Adjust any relative paths.
42
- if (name && name.charAt(0) === ".") {
43
- //If have a base name, try to normalize against it,
44
- //otherwise, assume it is a top-level require that will
45
- //be relative to baseUrl in the end.
46
- if (baseName) {
47
- //Convert baseName to array, and lop off the last part,
48
- //so that . matches that "directory" and not name of the baseName's
49
- //module. For instance, baseName of "one/two/three", maps to
50
- //"one/two/three.js", but we want the directory, "one/two" for
51
- //this normalization.
52
- baseParts = baseParts.slice(0, baseParts.length - 1);
53
-
54
- name = baseParts.concat(name.split("/"));
55
-
56
- //start trimDots
57
- for (i = 0; i < name.length; i += 1) {
58
- part = name[i];
59
- if (part === ".") {
60
- name.splice(i, 1);
61
- i -= 1;
62
- } else if (part === "..") {
63
- if (i === 1 && (name[2] === '..' || name[0] === '..')) {
64
- //End of the line. Keep at least one non-dot
65
- //path segment at the front so it can be mapped
66
- //correctly to disk. Otherwise, there is likely
67
- //no path mapping for a path starting with '..'.
68
- //This can still fail, but catches the most reasonable
69
- //uses of ..
70
- break;
71
- } else if (i > 0) {
72
- name.splice(i - 1, 2);
73
- i -= 2;
74
- }
75
- }
76
- }
77
- //end trimDots
78
-
79
- name = name.join("/");
80
- } else if (name.indexOf('./') === 0) {
81
- // No baseName, so this is ID is resolved relative
82
- // to baseUrl, pull off the leading dot.
83
- name = name.substring(2);
84
- }
85
- }
86
-
87
- //Apply map config if available.
88
- if ((baseParts || starMap) && map) {
89
- nameParts = name.split('/');
90
-
91
- for (i = nameParts.length; i > 0; i -= 1) {
92
- nameSegment = nameParts.slice(0, i).join("/");
93
-
94
- if (baseParts) {
95
- //Find the longest baseName segment match in the config.
96
- //So, do joins on the biggest to smallest lengths of baseParts.
97
- for (j = baseParts.length; j > 0; j -= 1) {
98
- mapValue = map[baseParts.slice(0, j).join('/')];
99
-
100
- //baseName segment has config, find if it has one for
101
- //this name.
102
- if (mapValue) {
103
- mapValue = mapValue[nameSegment];
104
- if (mapValue) {
105
- //Match, update name to the new value.
106
- foundMap = mapValue;
107
- foundI = i;
108
- break;
109
- }
110
- }
111
- }
112
- }
113
-
114
- if (foundMap) {
115
- break;
116
- }
117
-
118
- //Check for a star map match, but just hold on to it,
119
- //if there is a shorter segment match later in a matching
120
- //config, then favor over this star map.
121
- if (!foundStarMap && starMap && starMap[nameSegment]) {
122
- foundStarMap = starMap[nameSegment];
123
- starI = i;
124
- }
125
- }
126
-
127
- if (!foundMap && foundStarMap) {
128
- foundMap = foundStarMap;
129
- foundI = starI;
130
- }
131
-
132
- if (foundMap) {
133
- nameParts.splice(0, foundI, foundMap);
134
- name = nameParts.join('/');
135
- }
136
- }
137
-
138
- return name;
139
- }
140
-
141
- function makeRequire(relName, forceSync) {
142
- return function () {
143
- //A version of a require function that passes a moduleName
144
- //value for items that may need to
145
- //look up paths relative to the moduleName
146
- return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
147
- };
148
- }
149
-
150
- function makeNormalize(relName) {
151
- return function (name) {
152
- return normalize(name, relName);
153
- };
154
- }
155
-
156
- function makeLoad(depName) {
157
- return function (value) {
158
- defined[depName] = value;
159
- };
160
- }
161
-
162
- function callDep(name) {
163
- if (hasProp(waiting, name)) {
164
- var args = waiting[name];
165
- delete waiting[name];
166
- defining[name] = true;
167
- main.apply(undef, args);
168
- }
169
-
170
- if (!hasProp(defined, name) && !hasProp(defining, name)) {
171
- throw new Error('No ' + name);
172
- }
173
- return defined[name];
174
- }
175
-
176
- //Turns a plugin!resource to [plugin, resource]
177
- //with the plugin being undefined if the name
178
- //did not have a plugin prefix.
179
- function splitPrefix(name) {
180
- var prefix,
181
- index = name ? name.indexOf('!') : -1;
182
- if (index > -1) {
183
- prefix = name.substring(0, index);
184
- name = name.substring(index + 1, name.length);
185
- }
186
- return [prefix, name];
187
- }
188
-
189
- /**
190
- * Makes a name map, normalizing the name, and using a plugin
191
- * for normalization if necessary. Grabs a ref to plugin
192
- * too, as an optimization.
193
- */
194
- makeMap = function (name, relName) {
195
- var plugin,
196
- parts = splitPrefix(name),
197
- prefix = parts[0];
198
-
199
- name = parts[1];
200
-
201
- if (prefix) {
202
- prefix = normalize(prefix, relName);
203
- plugin = callDep(prefix);
204
- }
205
-
206
- //Normalize according
207
- if (prefix) {
208
- if (plugin && plugin.normalize) {
209
- name = plugin.normalize(name, makeNormalize(relName));
210
- } else {
211
- name = normalize(name, relName);
212
- }
213
- } else {
214
- name = normalize(name, relName);
215
- parts = splitPrefix(name);
216
- prefix = parts[0];
217
- name = parts[1];
218
- if (prefix) {
219
- plugin = callDep(prefix);
220
- }
221
- }
222
-
223
- //Using ridiculous property names for space reasons
224
- return {
225
- f: prefix ? prefix + '!' + name : name, //fullName
226
- n: name,
227
- pr: prefix,
228
- p: plugin
229
- };
230
- };
231
-
232
- function makeConfig(name) {
233
- return function () {
234
- return (config && config.config && config.config[name]) || {};
235
- };
236
- }
237
-
238
- handlers = {
239
- require: function (name) {
240
- return makeRequire(name);
241
- },
242
- exports: function (name) {
243
- var e = defined[name];
244
- if (typeof e !== 'undefined') {
245
- return e;
246
- } else {
247
- return (defined[name] = {});
248
- }
249
- },
250
- module: function (name) {
251
- return {
252
- id: name,
253
- uri: '',
254
- exports: defined[name],
255
- config: makeConfig(name)
256
- };
257
- }
258
- };
259
-
260
- main = function (name, deps, callback, relName) {
261
- var cjsModule, depName, ret, map, i,
262
- args = [],
263
- usingExports;
264
-
265
- //Use name if no relName
266
- relName = relName || name;
267
-
268
- //Call the callback to define the module, if necessary.
269
- if (typeof callback === 'function') {
270
-
271
- //Pull out the defined dependencies and pass the ordered
272
- //values to the callback.
273
- //Default to [require, exports, module] if no deps
274
- deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
275
- for (i = 0; i < deps.length; i += 1) {
276
- map = makeMap(deps[i], relName);
277
- depName = map.f;
278
-
279
- //Fast path CommonJS standard dependencies.
280
- if (depName === "require") {
281
- args[i] = handlers.require(name);
282
- } else if (depName === "exports") {
283
- //CommonJS module spec 1.1
284
- args[i] = handlers.exports(name);
285
- usingExports = true;
286
- } else if (depName === "module") {
287
- //CommonJS module spec 1.1
288
- cjsModule = args[i] = handlers.module(name);
289
- } else if (hasProp(defined, depName) ||
290
- hasProp(waiting, depName) ||
291
- hasProp(defining, depName)) {
292
- args[i] = callDep(depName);
293
- } else if (map.p) {
294
- map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
295
- args[i] = defined[depName];
296
- } else {
297
- throw new Error(name + ' missing ' + depName);
298
- }
299
- }
300
-
301
- ret = callback.apply(defined[name], args);
302
-
303
- if (name) {
304
- //If setting exports via "module" is in play,
305
- //favor that over return value and exports. After that,
306
- //favor a non-undefined return value over exports use.
307
- if (cjsModule && cjsModule.exports !== undef &&
308
- cjsModule.exports !== defined[name]) {
309
- defined[name] = cjsModule.exports;
310
- } else if (ret !== undef || !usingExports) {
311
- //Use the return value from the function.
312
- defined[name] = ret;
313
- }
314
- }
315
- } else if (name) {
316
- //May just be an object definition for the module. Only
317
- //worry about defining if have a module name.
318
- defined[name] = callback;
319
- }
320
- };
321
-
322
- requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
323
- if (typeof deps === "string") {
324
- if (handlers[deps]) {
325
- //callback in this case is really relName
326
- return handlers[deps](callback);
327
- }
328
- //Just return the module wanted. In this scenario, the
329
- //deps arg is the module name, and second arg (if passed)
330
- //is just the relName.
331
- //Normalize module name, if it contains . or ..
332
- return callDep(makeMap(deps, callback).f);
333
- } else if (!deps.splice) {
334
- //deps is a config object, not an array.
335
- config = deps;
336
- if (callback.splice) {
337
- //callback is an array, which means it is a dependency list.
338
- //Adjust args if there are dependencies
339
- deps = callback;
340
- callback = relName;
341
- relName = null;
342
- } else {
343
- deps = undef;
344
- }
345
- }
346
-
347
- //Support require(['a'])
348
- callback = callback || function () {};
349
-
350
- //If relName is a function, it is an errback handler,
351
- //so remove it.
352
- if (typeof relName === 'function') {
353
- relName = forceSync;
354
- forceSync = alt;
355
- }
356
-
357
- //Simulate async callback;
358
- if (forceSync) {
359
- main(undef, deps, callback, relName);
360
- } else {
361
- //Using a non-zero value because of concern for what old browsers
362
- //do, and latest browsers "upgrade" to 4 if lower value is used:
363
- //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
364
- //If want a value immediately, use require('id') instead -- something
365
- //that works in almond on the global level, but not guaranteed and
366
- //unlikely to work in other AMD implementations.
367
-
368
- main(undef, deps, callback, relName);
369
- }
370
-
371
- return req;
372
- };
373
-
374
- /**
375
- * Just drops the config on the floor, but returns req in case
376
- * the config return value is used.
377
- */
378
- req.config = function (cfg) {
379
- config = cfg;
380
- if (config.deps) {
381
- req(config.deps, config.callback);
382
- }
383
- return req;
384
- };
385
-
386
- define = function (name, deps, callback) {
387
-
388
- //This module may not have dependencies
389
- if (!deps.splice) {
390
- //deps is not an array, so probably means
391
- //an object literal or factory function for
392
- //the value. Adjust args.
393
- callback = deps;
394
- deps = [];
395
- }
396
-
397
- if (!hasProp(defined, name) && !hasProp(waiting, name)) {
398
- waiting[name] = [name, deps, callback];
399
- }
400
- };
401
-
402
- define.amd = {
403
- jQuery: true
404
- };
405
- }());
406
-
407
- define("almond", function(){});
408
-
409
- (function() {
410
- define('SortedSet/AbstractSortedSet',[],function() {
411
- var AbstractSortedSet;
412
- return AbstractSortedSet = (function() {
413
- function AbstractSortedSet(options) {
414
- if ((options != null ? options.strategy : void 0) == null) {
415
- throw 'Must pass options.strategy, a strategy';
416
- }
417
- if ((options != null ? options.comparator : void 0) == null) {
418
- throw 'Must pass options.comparator, a comparator';
419
- }
420
- this.priv = new options.strategy(options);
421
- }
422
-
423
- AbstractSortedSet.prototype.insert = function(value) {
424
- this.priv.insert(value);
425
- return this;
426
- };
427
-
428
- AbstractSortedSet.prototype.remove = function(value) {
429
- this.priv.remove(value);
430
- return this;
431
- };
432
-
433
- AbstractSortedSet.prototype.contains = function(value) {
434
- return this.priv.contains(value);
435
- };
436
-
437
- AbstractSortedSet.prototype.toArray = function() {
438
- return this.priv.toArray();
439
- };
440
-
441
- AbstractSortedSet.prototype.forEach = function(callback, thisArg) {
442
- this.priv.forEachImpl(callback, this, thisArg);
443
- return this;
444
- };
445
-
446
- AbstractSortedSet.prototype.map = function(callback, thisArg) {
447
- var ret;
448
- ret = [];
449
- this.forEach(function(value, index, self) {
450
- return ret.push(callback.call(thisArg, value, index, self));
451
- });
452
- return ret;
453
- };
454
-
455
- AbstractSortedSet.prototype.filter = function(callback, thisArg) {
456
- var ret;
457
- ret = [];
458
- this.forEach(function(value, index, self) {
459
- if (callback.call(thisArg, value, index, self)) {
460
- return ret.push(value);
461
- }
462
- });
463
- return ret;
464
- };
465
-
466
- AbstractSortedSet.prototype.every = function(callback, thisArg) {
467
- var ret;
468
- ret = true;
469
- this.forEach(function(value, index, self) {
470
- if (ret && !callback.call(thisArg, value, index, self)) {
471
- return ret = false;
472
- }
473
- });
474
- return ret;
475
- };
476
-
477
- AbstractSortedSet.prototype.some = function(callback, thisArg) {
478
- var ret;
479
- ret = false;
480
- this.forEach(function(value, index, self) {
481
- if (!ret && callback.call(thisArg, value, index, self)) {
482
- return ret = true;
483
- }
484
- });
485
- return ret;
486
- };
487
-
488
- AbstractSortedSet.prototype.findIterator = function(value) {
489
- return this.priv.findIterator(value);
490
- };
491
-
492
- AbstractSortedSet.prototype.beginIterator = function() {
493
- return this.priv.beginIterator();
494
- };
495
-
496
- AbstractSortedSet.prototype.endIterator = function() {
497
- return this.priv.endIterator();
498
- };
499
-
500
- return AbstractSortedSet;
501
-
502
- })();
503
- });
504
-
505
- }).call(this);
506
-
507
- (function() {
508
- define('SortedSet/ArrayStrategy',[],function() {
509
- var ArrayStrategy, Iterator, binarySearchForIndex;
510
- Iterator = function(priv, index) {
511
- var data;
512
- data = priv.data;
513
- return {
514
- hasNext: function() {
515
- return index < data.length;
516
- },
517
- hasPrevious: function() {
518
- return index > 0;
519
- },
520
- value: function() {
521
- if (index < data.length) {
522
- return data[index];
523
- } else {
524
- return null;
525
- }
526
- },
527
- setValue: function(value) {
528
- if (!priv.options.allowSetValue) {
529
- throw 'Must set options.allowSetValue';
530
- }
531
- if (!this.hasNext()) {
532
- throw 'Cannot set value at end of set';
533
- }
534
- return data[index] = value;
535
- },
536
- next: function() {
537
- if (index >= data.length) {
538
- return null;
539
- } else {
540
- return new Iterator(priv, index + 1);
541
- }
542
- },
543
- previous: function() {
544
- if (index <= 0) {
545
- return null;
546
- } else {
547
- return new Iterator(priv, index - 1);
548
- }
549
- }
550
- };
551
- };
552
- binarySearchForIndex = function(array, value, comparator) {
553
- var high, low, mid;
554
- low = 0;
555
- high = array.length;
556
- while (low < high) {
557
- mid = (low + high) >>> 1;
558
- if (comparator(array[mid], value) < 0) {
559
- low = mid + 1;
560
- } else {
561
- high = mid;
562
- }
563
- }
564
- return low;
565
- };
566
- return ArrayStrategy = (function() {
567
- function ArrayStrategy(options) {
568
- this.options = options;
569
- this.comparator = this.options.comparator;
570
- this.data = [];
571
- }
572
-
573
- ArrayStrategy.prototype.toArray = function() {
574
- return this.data;
575
- };
576
-
577
- ArrayStrategy.prototype.insert = function(value) {
578
- var index;
579
- index = binarySearchForIndex(this.data, value, this.comparator);
580
- if (this.data[index] === value) {
581
- throw 'Value already in set';
582
- }
583
- return this.data.splice(index, 0, value);
584
- };
585
-
586
- ArrayStrategy.prototype.remove = function(value) {
587
- var index;
588
- index = binarySearchForIndex(this.data, value, this.comparator);
589
- if (this.data[index] !== value) {
590
- throw 'Value not in set';
591
- }
592
- return this.data.splice(index, 1);
593
- };
594
-
595
- ArrayStrategy.prototype.contains = function(value) {
596
- return this.data.indexOf(value) !== -1;
597
- };
598
-
599
- ArrayStrategy.prototype.forEachImpl = function(callback, sortedSet, thisArg) {
600
- var index, value, _i, _len, _ref;
601
- _ref = this.data;
602
- for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {
603
- value = _ref[index];
604
- callback.call(thisArg, value, index, sortedSet);
605
- }
606
- return void 0;
607
- };
608
-
609
- ArrayStrategy.prototype.findIterator = function(value) {
610
- var index;
611
- index = binarySearchForIndex(this.data, value, this.comparator);
612
- return new Iterator(this, index);
613
- };
614
-
615
- ArrayStrategy.prototype.beginIterator = function() {
616
- return new Iterator(this, 0);
617
- };
618
-
619
- ArrayStrategy.prototype.endIterator = function() {
620
- return new Iterator(this, this.data.length);
621
- };
622
-
623
- return ArrayStrategy;
624
-
625
- })();
626
- });
627
-
628
- }).call(this);
629
-
630
- (function() {
631
- define('SortedSet/BinaryTreeIterator',[], function() {
632
- var BinaryTreeIterator, descendAllTheWay, moveCursor;
633
- descendAllTheWay = function(leftOrRight, node) {
634
- var parent;
635
- while (node[leftOrRight] !== null) {
636
- parent = node;
637
- node = node[leftOrRight];
638
- node._iteratorParentNode = parent;
639
- }
640
- return node;
641
- };
642
- moveCursor = function(leftOrRight, node) {
643
- var parent, rightOrLeft;
644
- if (node[leftOrRight] !== null) {
645
- parent = node;
646
- node = node[leftOrRight];
647
- node._iteratorParentNode = parent;
648
- rightOrLeft = leftOrRight === 'left' ? 'right' : 'left';
649
- node = descendAllTheWay(rightOrLeft, node);
650
- } else {
651
- while ((parent = node._iteratorParentNode) !== null && parent[leftOrRight] === node) {
652
- node = parent;
653
- }
654
- node = parent;
655
- }
656
- return node;
657
- };
658
- BinaryTreeIterator = (function() {
659
- function BinaryTreeIterator(tree, node) {
660
- this.tree = tree;
661
- this.node = node;
662
- }
663
-
664
- BinaryTreeIterator.prototype.next = function() {
665
- var node;
666
- if (this.node === null) {
667
- return null;
668
- } else {
669
- node = moveCursor('right', this.node);
670
- return new BinaryTreeIterator(this.tree, node);
671
- }
672
- };
673
-
674
- BinaryTreeIterator.prototype.previous = function() {
675
- var node;
676
- if (this.node === null) {
677
- if (this.tree.root === null) {
678
- return null;
679
- } else {
680
- this.tree.root._iteratorParentNode = null;
681
- node = descendAllTheWay('right', this.tree.root);
682
- return new BinaryTreeIterator(this.tree, node);
683
- }
684
- } else {
685
- node = moveCursor('left', this.node);
686
- if (node === null) {
687
- return null;
688
- } else {
689
- return new BinaryTreeIterator(this.tree, node);
690
- }
691
- }
692
- };
693
-
694
- BinaryTreeIterator.prototype.hasNext = function() {
695
- return this.node !== null;
696
- };
697
-
698
- BinaryTreeIterator.prototype.hasPrevious = function() {
699
- return this.previous() !== null;
700
- };
701
-
702
- BinaryTreeIterator.prototype.value = function() {
703
- if (this.node === null) {
704
- return null;
705
- } else {
706
- return this.node.value;
707
- }
708
- };
709
-
710
- BinaryTreeIterator.prototype.setValue = function(value) {
711
- if (!this.tree.options.allowSetValue) {
712
- throw 'Must set options.allowSetValue';
713
- }
714
- if (!this.hasNext()) {
715
- throw 'Cannot set value at end of set';
716
- }
717
- return this.node.value = value;
718
- };
719
-
720
- return BinaryTreeIterator;
721
-
722
- })();
723
- BinaryTreeIterator.find = function(tree, value, comparator) {
724
- var cmp, nextNode, node, root;
725
- root = tree.root;
726
- if (root != null) {
727
- root._iteratorParentNode = null;
728
- }
729
- node = root;
730
- nextNode = null;
731
- while (node !== null) {
732
- cmp = comparator(value, node.value);
733
- if (cmp === 0) {
734
- break;
735
- } else if (cmp < 0) {
736
- if (node.left === null) {
737
- break;
738
- }
739
- nextNode = node;
740
- node.left._iteratorParentNode = node;
741
- node = node.left;
742
- } else {
743
- if (node.right !== null) {
744
- node.right._iteratorParentNode = node;
745
- node = node.right;
746
- } else {
747
- node = nextNode;
748
- break;
749
- }
750
- }
751
- }
752
- return new BinaryTreeIterator(tree, node);
753
- };
754
- BinaryTreeIterator.left = function(tree) {
755
- var node;
756
- if (tree.root === null) {
757
- return new BinaryTreeIterator(tree, null);
758
- } else {
759
- tree.root._iteratorParentNode = null;
760
- node = descendAllTheWay('left', tree.root);
761
- return new BinaryTreeIterator(tree, node);
762
- }
763
- };
764
- BinaryTreeIterator.right = function(tree) {
765
- return new BinaryTreeIterator(tree, null);
766
- };
767
- return BinaryTreeIterator;
768
- });
769
-
770
- }).call(this);
771
-
772
- (function() {
773
- define('SortedSet/AbstractBinaryTreeStrategy',['./BinaryTreeIterator'], function(BinaryTreeIterator) {
774
- var AbstractBinaryTree, binaryTreeTraverse;
775
- binaryTreeTraverse = function(node, callback) {
776
- if (node !== null) {
777
- binaryTreeTraverse(node.left, callback);
778
- callback(node.value);
779
- binaryTreeTraverse(node.right, callback);
780
- }
781
- return void 0;
782
- };
783
- return AbstractBinaryTree = (function() {
784
- function AbstractBinaryTree() {}
785
-
786
- AbstractBinaryTree.prototype.toArray = function() {
787
- var ret;
788
- ret = [];
789
- binaryTreeTraverse(this.root, function(value) {
790
- return ret.push(value);
791
- });
792
- return ret;
793
- };
794
-
795
- AbstractBinaryTree.prototype.forEachImpl = function(callback, sortedSet, thisArg) {
796
- var i;
797
- i = 0;
798
- binaryTreeTraverse(this.root, function(value) {
799
- callback.call(thisArg, value, i, sortedSet);
800
- return i += 1;
801
- });
802
- return void 0;
803
- };
804
-
805
- AbstractBinaryTree.prototype.contains = function(value) {
806
- var cmp, comparator, node;
807
- comparator = this.comparator;
808
- node = this.root;
809
- while (node !== null) {
810
- cmp = comparator(value, node.value);
811
- if (cmp === 0) {
812
- break;
813
- } else if (cmp < 0) {
814
- node = node.left;
815
- } else {
816
- node = node.right;
817
- }
818
- }
819
- return node !== null && node.value === value;
820
- };
821
-
822
- AbstractBinaryTree.prototype.findIterator = function(value) {
823
- return BinaryTreeIterator.find(this, value, this.comparator);
824
- };
825
-
826
- AbstractBinaryTree.prototype.beginIterator = function() {
827
- return BinaryTreeIterator.left(this);
828
- };
829
-
830
- AbstractBinaryTree.prototype.endIterator = function() {
831
- return BinaryTreeIterator.right(this);
832
- };
833
-
834
- return AbstractBinaryTree;
835
-
836
- })();
837
- });
838
-
839
- }).call(this);
840
-
841
- (function() {
842
- var __hasProp = {}.hasOwnProperty,
843
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
844
-
845
- define('SortedSet/BinaryTreeStrategy',['./AbstractBinaryTreeStrategy'], function(AbstractBinaryTreeStrategy) {
846
- var BinaryTreeStrategy, Node, binaryTreeDelete, nodeAllTheWay;
847
- Node = (function() {
848
- function Node(value) {
849
- this.value = value;
850
- this.left = null;
851
- this.right = null;
852
- }
853
-
854
- return Node;
855
-
856
- })();
857
- nodeAllTheWay = function(node, leftOrRight) {
858
- while (node[leftOrRight] !== null) {
859
- node = node[leftOrRight];
860
- }
861
- return node;
862
- };
863
- binaryTreeDelete = function(node, value, comparator) {
864
- var cmp, nextNode;
865
- if (node === null) {
866
- throw 'Value not in set';
867
- }
868
- cmp = comparator(value, node.value);
869
- if (cmp < 0) {
870
- node.left = binaryTreeDelete(node.left, value, comparator);
871
- } else if (cmp > 0) {
872
- node.right = binaryTreeDelete(node.right, value, comparator);
873
- } else {
874
- if (node.left === null && node.right === null) {
875
- node = null;
876
- } else if (node.right === null) {
877
- node = node.left;
878
- } else if (node.left === null) {
879
- node = node.right;
880
- } else {
881
- nextNode = nodeAllTheWay(node.right, 'left');
882
- node.value = nextNode.value;
883
- node.right = binaryTreeDelete(node.right, nextNode.value, comparator);
884
- }
885
- }
886
- return node;
887
- };
888
- return BinaryTreeStrategy = (function(_super) {
889
- __extends(BinaryTreeStrategy, _super);
890
-
891
- function BinaryTreeStrategy(options) {
892
- this.options = options;
893
- this.comparator = this.options.comparator;
894
- this.root = null;
895
- }
896
-
897
- BinaryTreeStrategy.prototype.insert = function(value) {
898
- var cmp, compare, leftOrRight, parent;
899
- compare = this.comparator;
900
- if (this.root != null) {
901
- parent = this.root;
902
- while (true) {
903
- cmp = compare(value, parent.value);
904
- if (cmp === 0) {
905
- throw 'Value already in set';
906
- }
907
- leftOrRight = cmp < 0 ? 'left' : 'right';
908
- if (parent[leftOrRight] === null) {
909
- break;
910
- }
911
- parent = parent[leftOrRight];
912
- }
913
- return parent[leftOrRight] = new Node(value);
914
- } else {
915
- return this.root = new Node(value);
916
- }
917
- };
918
-
919
- BinaryTreeStrategy.prototype.remove = function(value) {
920
- return this.root = binaryTreeDelete(this.root, value, this.comparator);
921
- };
922
-
923
- return BinaryTreeStrategy;
924
-
925
- })(AbstractBinaryTreeStrategy);
926
- });
927
-
928
- }).call(this);
929
-
930
- (function() {
931
- var __hasProp = {}.hasOwnProperty,
932
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
933
-
934
- define('SortedSet/RedBlackTreeStrategy',['./AbstractBinaryTreeStrategy'], function(AbstractBinaryTreeStrategy) {
935
- var Node, RedBlackTreeStrategy, colorFlip, findMinNode, fixUp, insertInNode, moveRedLeft, moveRedRight, removeFromNode, removeMinNode, rotateLeft, rotateRight;
936
- Node = (function() {
937
- function Node(value) {
938
- this.value = value;
939
- this.left = null;
940
- this.right = null;
941
- this.isRed = true;
942
- }
943
-
944
- return Node;
945
-
946
- })();
947
- rotateLeft = function(h) {
948
- var x;
949
- x = h.right;
950
- h.right = x.left;
951
- x.left = h;
952
- x.isRed = h.isRed;
953
- h.isRed = true;
954
- return x;
955
- };
956
- rotateRight = function(h) {
957
- var x;
958
- x = h.left;
959
- h.left = x.right;
960
- x.right = h;
961
- x.isRed = h.isRed;
962
- h.isRed = true;
963
- return x;
964
- };
965
- colorFlip = function(h) {
966
- h.isRed = !h.isRed;
967
- h.left.isRed = !h.left.isRed;
968
- h.right.isRed = !h.right.isRed;
969
- return void 0;
970
- };
971
- moveRedLeft = function(h) {
972
- colorFlip(h);
973
- if (h.right !== null && h.right.left !== null && h.right.left.isRed) {
974
- h.right = rotateRight(h.right);
975
- h = rotateLeft(h);
976
- colorFlip(h);
977
- }
978
- return h;
979
- };
980
- moveRedRight = function(h) {
981
- colorFlip(h);
982
- if (h.left !== null && h.left.left !== null && h.left.left.isRed) {
983
- h = rotateRight(h);
984
- colorFlip(h);
985
- }
986
- return h;
987
- };
988
- insertInNode = function(h, value, compare) {
989
- if (h === null) {
990
- return new Node(value);
991
- }
992
- if (h.value === value) {
993
- throw 'Value already in set';
994
- } else {
995
- if (compare(value, h.value) < 0) {
996
- h.left = insertInNode(h.left, value, compare);
997
- } else {
998
- h.right = insertInNode(h.right, value, compare);
999
- }
1000
- }
1001
- if (h.right !== null && h.right.isRed && !(h.left !== null && h.left.isRed)) {
1002
- h = rotateLeft(h);
1003
- }
1004
- if (h.left !== null && h.left.isRed && h.left.left !== null && h.left.left.isRed) {
1005
- h = rotateRight(h);
1006
- }
1007
- if (h.left !== null && h.left.isRed && h.right !== null && h.right.isRed) {
1008
- colorFlip(h);
1009
- }
1010
- return h;
1011
- };
1012
- findMinNode = function(h) {
1013
- while (h.left !== null) {
1014
- h = h.left;
1015
- }
1016
- return h;
1017
- };
1018
- fixUp = function(h) {
1019
- if (h.right !== null && h.right.isRed) {
1020
- h = rotateLeft(h);
1021
- }
1022
- if (h.left !== null && h.left.isRed && h.left.left !== null && h.left.left.isRed) {
1023
- h = rotateRight(h);
1024
- }
1025
- if (h.left !== null && h.left.isRed && h.right !== null && h.right.isRed) {
1026
- colorFlip(h);
1027
- }
1028
- return h;
1029
- };
1030
- removeMinNode = function(h) {
1031
- if (h.left === null) {
1032
- return null;
1033
- }
1034
- if (!h.left.isRed && !(h.left.left !== null && h.left.left.isRed)) {
1035
- h = moveRedLeft(h);
1036
- }
1037
- h.left = removeMinNode(h.left);
1038
- return fixUp(h);
1039
- };
1040
- removeFromNode = function(h, value, compare) {
1041
- if (h === null) {
1042
- throw 'Value not in set';
1043
- }
1044
- if (h.value !== value && compare(value, h.value) < 0) {
1045
- if (h.left === null) {
1046
- throw 'Value not in set';
1047
- }
1048
- if (!h.left.isRed && !(h.left.left !== null && h.left.left.isRed)) {
1049
- h = moveRedLeft(h);
1050
- }
1051
- h.left = removeFromNode(h.left, value, compare);
1052
- } else {
1053
- if (h.left !== null && h.left.isRed) {
1054
- h = rotateRight(h);
1055
- }
1056
- if (h.right === null) {
1057
- if (value === h.value) {
1058
- return null;
1059
- } else {
1060
- throw 'Value not in set';
1061
- }
1062
- }
1063
- if (!h.right.isRed && !(h.right.left !== null && h.right.left.isRed)) {
1064
- h = moveRedRight(h);
1065
- }
1066
- if (value === h.value) {
1067
- h.value = findMinNode(h.right).value;
1068
- h.right = removeMinNode(h.right);
1069
- } else {
1070
- h.right = removeFromNode(h.right, value, compare);
1071
- }
1072
- }
1073
- if (h !== null) {
1074
- h = fixUp(h);
1075
- }
1076
- return h;
1077
- };
1078
- return RedBlackTreeStrategy = (function(_super) {
1079
- __extends(RedBlackTreeStrategy, _super);
1080
-
1081
- function RedBlackTreeStrategy(options) {
1082
- this.options = options;
1083
- this.comparator = this.options.comparator;
1084
- this.root = null;
1085
- }
1086
-
1087
- RedBlackTreeStrategy.prototype.insert = function(value) {
1088
- this.root = insertInNode(this.root, value, this.comparator);
1089
- this.root.isRed = false;
1090
- return void 0;
1091
- };
1092
-
1093
- RedBlackTreeStrategy.prototype.remove = function(value) {
1094
- this.root = removeFromNode(this.root, value, this.comparator);
1095
- if (this.root !== null) {
1096
- this.root.isRed = false;
1097
- }
1098
- return void 0;
1099
- };
1100
-
1101
- return RedBlackTreeStrategy;
1102
-
1103
- })(AbstractBinaryTreeStrategy);
1104
- });
1105
-
1106
- }).call(this);
1107
-
1108
- (function() {
1109
- var __hasProp = {}.hasOwnProperty,
1110
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
1111
-
1112
- define('SortedSet',['./SortedSet/AbstractSortedSet', './SortedSet/ArrayStrategy', './SortedSet/BinaryTreeStrategy', './SortedSet/RedBlackTreeStrategy'], function(AbstractSortedSet, ArrayStrategy, BinaryTreeStrategy, RedBlackTreeStrategy) {
1113
- var SortedSet;
1114
- SortedSet = (function(_super) {
1115
- __extends(SortedSet, _super);
1116
-
1117
- function SortedSet(options) {
1118
- options || (options = {});
1119
- options.strategy || (options.strategy = RedBlackTreeStrategy);
1120
- options.comparator || (options.comparator = function(a, b) {
1121
- return (a || 0) - (b || 0);
1122
- });
1123
- SortedSet.__super__.constructor.call(this, options);
1124
- }
1125
-
1126
- return SortedSet;
1127
-
1128
- })(AbstractSortedSet);
1129
- SortedSet.ArrayStrategy = ArrayStrategy;
1130
- SortedSet.BinaryTreeStrategy = BinaryTreeStrategy;
1131
- SortedSet.RedBlackTreeStrategy = RedBlackTreeStrategy;
1132
- return SortedSet;
1133
- });
1134
-
1135
- }).call(this);
1136
-
1137
- (function() {
1138
- require(['./SortedSet'], function(SortedSet) {
1139
- return window.SortedSet = SortedSet;
1140
- });
1141
-
1142
- }).call(this);
1143
-
1144
- define("index", function(){});
1145
- }());