Permalink
Browse files

Initial Pedestal import

  • Loading branch information...
0 parents commit 1c86f60e4a200fc6b9f5efe2c97ce066a52a685e Pedestal Team committed Mar 9, 2013
Showing with 29,435 additions and 0 deletions.
  1. +11 −0 .gitignore
  2. +19 −0 README.md
  3. +10 −0 app-template/.gitignore
  4. +43 −0 app-template/README.md
  5. +3 −0 app-template/project.clj
  6. +68 −0 app-template/src/leiningen/new/pedestal_app.clj
  7. +3 −0 app-template/src/leiningen/new/pedestal_app/annotated/.gitignore
  8. +9 −0 app-template/src/leiningen/new/pedestal_app/annotated/README.md
  9. +288 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/assets/javascripts/xpath.js
  10. +11 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/assets/stylesheets/project.css
  11. +87 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/src/behavior.clj
  12. +19 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/src/html_templates.clj
  13. +75 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/src/rendering.cljs
  14. +36 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/src/services.cljs
  15. +3 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/src/simulated/services.cljs
  16. +14 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/src/simulated/start.cljs
  17. +51 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/src/start.cljs
  18. +46 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/templates/application.html
  19. +47 −0 app-template/src/leiningen/new/pedestal_app/annotated/app/templates/project.html
  20. +97 −0 app-template/src/leiningen/new/pedestal_app/annotated/config/config.clj
  21. +50 −0 app-template/src/leiningen/new/pedestal_app/annotated/config/logback.xml
  22. +116 −0 app-template/src/leiningen/new/pedestal_app/annotated/config/user.clj
  23. +10 −0 app-template/src/leiningen/new/pedestal_app/annotated/project.clj
  24. +39 −0 app-template/src/leiningen/new/pedestal_app/annotated/test/behavior.clj
  25. +26 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/404.html
  26. +16 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/design.html
  27. BIN app-template/src/leiningen/new/pedestal_app/annotated/tools/public/favicon.ico
  28. +63 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/index.html
  29. +2,027 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/javascripts/bootstrap.js
  30. +2 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/javascripts/jquery-min.js
  31. +20 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/javascripts/pedestal/js/api.js
  32. +5,774 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/stylesheets/bootstrap.css
  33. +82 −0 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/stylesheets/pedestal.css
  34. +3 −0 app-template/src/leiningen/new/pedestal_app/plain/.gitignore
  35. +9 −0 app-template/src/leiningen/new/pedestal_app/plain/README.md
  36. +288 −0 app-template/src/leiningen/new/pedestal_app/plain/app/assets/javascripts/xpath.js
  37. +11 −0 app-template/src/leiningen/new/pedestal_app/plain/app/assets/stylesheets/project.css
  38. +8 −0 app-template/src/leiningen/new/pedestal_app/plain/app/src/behavior.clj
  39. +6 −0 app-template/src/leiningen/new/pedestal_app/plain/app/src/html_templates.clj
  40. +22 −0 app-template/src/leiningen/new/pedestal_app/plain/app/src/rendering.cljs
  41. +9 −0 app-template/src/leiningen/new/pedestal_app/plain/app/src/simulated/start.cljs
  42. +17 −0 app-template/src/leiningen/new/pedestal_app/plain/app/src/start.cljs
  43. +46 −0 app-template/src/leiningen/new/pedestal_app/plain/app/templates/application.html
  44. +13 −0 app-template/src/leiningen/new/pedestal_app/plain/app/templates/project.html
  45. +44 −0 app-template/src/leiningen/new/pedestal_app/plain/config/config.clj
  46. +50 −0 app-template/src/leiningen/new/pedestal_app/plain/config/logback.xml
  47. +116 −0 app-template/src/leiningen/new/pedestal_app/plain/config/user.clj
  48. +10 −0 app-template/src/leiningen/new/pedestal_app/plain/project.clj
  49. +32 −0 app-template/src/leiningen/new/pedestal_app/plain/test/behavior.clj
  50. +26 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/404.html
  51. +16 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/design.html
  52. BIN app-template/src/leiningen/new/pedestal_app/plain/tools/public/favicon.ico
  53. +63 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/index.html
  54. +2,027 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/javascripts/bootstrap.js
  55. +2 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/javascripts/jquery-min.js
  56. +20 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/javascripts/pedestal/js/api.js
  57. +5,774 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/stylesheets/bootstrap.css
  58. +82 −0 app-template/src/leiningen/new/pedestal_app/plain/tools/public/stylesheets/pedestal.css
  59. +7 −0 app-tools/README.md
  60. +18 −0 app-tools/project.clj
  61. +266 −0 app-tools/src/io/pedestal/app_tools/build.clj
  62. +233 −0 app-tools/src/io/pedestal/app_tools/compile.clj
  63. +22 −0 app-tools/src/io/pedestal/app_tools/compile/config.clj
  64. +20 −0 app-tools/src/io/pedestal/app_tools/compile/repl.clj
  65. +144 −0 app-tools/src/io/pedestal/app_tools/host_page.clj
  66. +14 −0 app-tools/src/io/pedestal/app_tools/middleware.clj
  67. +150 −0 app-tools/src/io/pedestal/app_tools/rendering_view/client.cljs
  68. +157 −0 app-tools/src/io/pedestal/app_tools/rendering_view/record.cljs
  69. +147 −0 app-tools/src/io/pedestal/app_tools/rendering_view/routes.clj
  70. +41 −0 app-tools/src/io/pedestal/app_tools/routes.clj
  71. +6 −0 app-tools/src/io/pedestal/app_tools/server.clj
  72. +77 −0 app-tools/src/io/pedestal/app_tools/service.clj
  73. +16 −0 app-tools/src/io/pedestal/app_tools/tooling.cljs
  74. +5 −0 app-tools/to-port.md
  75. +74 −0 app/README.md
  76. +50 −0 app/dev/logback.xml
  77. +10 −0 app/project.clj
  78. +461 −0 app/src/io/pedestal/app.clj
  79. +142 −0 app/src/io/pedestal/app/messages.clj
  80. +32 −0 app/src/io/pedestal/app/net/repl_client.cljs
  81. +92 −0 app/src/io/pedestal/app/net/xhr.cljs
  82. +17 −0 app/src/io/pedestal/app/protocols.clj
  83. +104 −0 app/src/io/pedestal/app/query.clj
  84. +36 −0 app/src/io/pedestal/app/queue.clj
  85. +26 −0 app/src/io/pedestal/app/render.clj
  86. +61 −0 app/src/io/pedestal/app/render/events.cljs
  87. +138 −0 app/src/io/pedestal/app/render/push.clj
  88. +211 −0 app/src/io/pedestal/app/render/push/cljs_formatter.cljs
  89. +297 −0 app/src/io/pedestal/app/render/push/handlers/automatic.cljs
  90. +50 −0 app/src/io/pedestal/app/render/push/templates.cljs
  91. +217 −0 app/src/io/pedestal/app/templates.clj
  92. +441 −0 app/src/io/pedestal/app/tree.clj
  93. +10 −0 app/src/io/pedestal/app/util/console_log.cljs
  94. +34 −0 app/src/io/pedestal/app/util/log.clj
  95. +38 −0 app/src/io/pedestal/app/util/log.cljs
  96. +15 −0 app/src/io/pedestal/app/util/observers.clj
  97. +49 −0 app/src/io/pedestal/app/util/platform.clj
  98. +39 −0 app/src/io/pedestal/app/util/platform.cljs
  99. +44 −0 app/src/io/pedestal/app/util/scheduler.clj
  100. +15 −0 app/src/io/pedestal/app/util/test.clj
  101. +194 −0 app/test/io/pedestal/app/render/test/dom.clj
  102. +475 −0 app/test/io/pedestal/app/render/test/push.clj
  103. +56 −0 app/test/io/pedestal/app/test/messages.clj
  104. +80 −0 app/test/io/pedestal/app/test/query.clj
  105. +939 −0 app/test/io/pedestal/app/test/tree.clj
  106. +996 −0 app/test/io/pedestal/test/app.clj
  107. +8 −0 jetty/project.clj
  108. +101 −0 jetty/src/io/pedestal/service/http/jetty.clj
  109. +15 −0 project.clj
  110. +9 −0 script/ci
  111. +18 −0 service-template/README.md
  112. +4 −0 service-template/project.clj
  113. +20 −0 service-template/src/leiningen/new/pedestal_service.clj
  114. +2 −0 service-template/src/leiningen/new/pedestal_service/.gitignore
  115. +20 −0 service-template/src/leiningen/new/pedestal_service/README.md
  116. +27 −0 service-template/src/leiningen/new/pedestal_service/dev.clj
  117. +52 −0 service-template/src/leiningen/new/pedestal_service/logback.xml
  118. +21 −0 service-template/src/leiningen/new/pedestal_service/project.clj
  119. +33 −0 service-template/src/leiningen/new/pedestal_service/server.clj
  120. +38 −0 service-template/src/leiningen/new/pedestal_service/service.clj
  121. +18 −0 service-template/src/leiningen/new/pedestal_service/service_test.clj
  122. +5 −0 service-template/src/leiningen/new/pedestal_service/user.clj
  123. +25 −0 service-template/test/pedestal/new_server_integration_test.clj
  124. +31 −0 service/README.md
  125. +130 −0 service/bench/pedestal/log_bench.clj
  126. +54 −0 service/dev/logback.xml
  127. +1 −0 service/dev/public/test.html
  128. +1 −0 service/dev/public/test.js
  129. +1 −0 service/dev/public/test.txt
  130. +112 −0 service/java/pedestal/servlet/ClojureVarServlet.java
  131. +15 −0 service/profiles.clj
  132. +40 −0 service/project.clj
  133. +148 −0 service/src/io/pedestal/service/http.clj
  134. +81 −0 service/src/io/pedestal/service/http/body_params.clj
  135. +337 −0 service/src/io/pedestal/service/http/impl/servlet_interceptor.clj
  136. +110 −0 service/src/io/pedestal/service/http/ring_middlewares.clj
  137. +443 −0 service/src/io/pedestal/service/http/route.clj
  138. +159 −0 service/src/io/pedestal/service/http/route/definition.clj
  139. +192 −0 service/src/io/pedestal/service/http/route/definition/verbose.clj
  140. +61 −0 service/src/io/pedestal/service/http/servlet.clj
  141. +134 −0 service/src/io/pedestal/service/http/sse.clj
  142. +329 −0 service/src/io/pedestal/service/impl/interceptor.clj
  143. +318 −0 service/src/io/pedestal/service/interceptor.clj
  144. +68 −0 service/src/io/pedestal/service/log.clj
  145. +161 −0 service/src/io/pedestal/service/test.clj
  146. +1 −0 service/test/io/pedestal/public/index.html
  147. +60 −0 service/test/io/pedestal/service/http/body_params_test.clj
  148. BIN service/test/io/pedestal/service/http/keystore.jks
  149. +75 −0 service/test/io/pedestal/service/http/request_handling_test.clj
  150. +183 −0 service/test/io/pedestal/service/http/ring_middlewares_test.clj
  151. +741 −0 service/test/io/pedestal/service/http/route_test.clj
  152. +29 −0 service/test/io/pedestal/service/http/sse_test.clj
  153. +112 −0 service/test/io/pedestal/service/http_test.clj
  154. +215 −0 service/test/io/pedestal/service/interceptor_test.clj
  155. +9 −0 tomcat/project.clj
  156. +43 −0 tomcat/src/io/pedestal/service/http/tomcat.clj
11 .gitignore
@@ -0,0 +1,11 @@
+pom.xml
+target/
+.lein-deps-sum
+.lein-failures
+.lein-repl-history
+.DS_Store
+*~
+out/
+tmp/
+logs/
+generated-js/
19 README.md
@@ -0,0 +1,19 @@
+Pedestal
+========
+
+The Pedestal web application framework
+
+### Installing Libraries ###
+
+
+Run `lein sub install` in the top level directory to install all the
+library components in your local Maven repository.
+
+The demo project uses Leiningen checkouts to allow simultaneous
+development of libraries and the application. See the [Leiningen FAQ](https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md)
+for details.
+
+Copyright
+----------------------------------------
+
+Copyright © 2012 Relevance, Inc. All rights reserved.
10 app-template/.gitignore
@@ -0,0 +1,10 @@
+/target
+/lib
+/classes
+/checkouts
+pom.xml
+*.jar
+*.class
+.lein-deps-sum
+.lein-failures
+.lein-plugins
43 app-template/README.md
@@ -0,0 +1,43 @@
+# Pedestal Application template
+
+Generate a new Pedestal Application.
+
+
+## Usage
+
+From within this project run:
+
+```bash
+lein install
+```
+
+Add a new dependency to your Leiningen user profile in `~/.lein/profiles.clj`:
+
+```clj
+{:user {:plugins {pedestal-app/lein-template "0.0.9-SNAPSHOT"}}}
+```
+
+When you are ready to create a new project, run:
+
+```bash
+lein new pedestal-app example
+cd example
+lein repl
+```
+
+where `example` is the project name.
+
+At the REPL type:
+
+```clj
+(run)
+```
+
+and then open a browser to `http://localhost:3000`.
+
+You now have a working development environment!
+
+
+## License
+
+Copyright (c) 2013 Relevance, Inc. All rights reserved.
3 app-template/project.clj
@@ -0,0 +1,3 @@
+(defproject pedestal-app/lein-template "0.0.9-SNAPSHOT"
+ :description "A Pedestal Application template."
+ :eval-in-leiningen true)
68 app-template/src/leiningen/new/pedestal_app.clj
@@ -0,0 +1,68 @@
+(ns leiningen.new.pedestal-app
+ (:use [leiningen.new.templates :only [renderer name-to-path ->files]]))
+
+(defn base-files [render data]
+ [[".gitignore" (render ".gitignore" data)]
+ ["README.md" (render "README.md" data)]
+ ["project.clj" (render "project.clj" data)]
+
+ [(str "app/assets/stylesheets/{{name}}.css")
+ (render "app/assets/stylesheets/project.css" data)]
+ ["app/assets/javascripts/xpath.js"
+ (render "app/assets/javascripts/xpath.js" data)]
+
+ ["tools/public/404.html" (render "tools/public/404.html" data)]
+ ["tools/public/design.html" (render "tools/public/design.html" data)]
+ ["tools/public/favicon.ico" (render "tools/public/favicon.ico" data)]
+ ["tools/public/index.html" (render "tools/public/index.html" data)]
+ ["tools/public/stylesheets/bootstrap.css"
+ (render "tools/public/stylesheets/bootstrap.css" data)]
+ ["tools/public/stylesheets/pedestal.css"
+ (render "tools/public/stylesheets/pedestal.css" data)]
+ ["tools/public/javascripts/bootstrap.js"
+ (render "tools/public/javascripts/bootstrap.js" data)]
+ ["tools/public/javascripts/jquery-min.js"
+ (render "tools/public/javascripts/jquery-min.js" data)]
+ ["tools/public/javascripts/pedestal/js/api.js"
+ (render "tools/public/javascripts/pedestal/js/api.js" data)]
+
+ ["config/config.clj" (render "config/config.clj" data)]
+ ["config/logback.xml" (render "config/logback.xml" data)]
+ ["config/user.clj" (render "config/user.clj" data)]
+
+ ["test/{{sanitized}}/test/behavior.clj" (render "test/behavior.clj" data)]])
+
+(defn annotated-project [data]
+ (let [render (renderer "pedestal-app/annotated")]
+ (apply ->files data
+ ["app/src/{{sanitized}}/behavior.clj" (render "app/src/behavior.clj" data)]
+ ["app/src/{{sanitized}}/services.cljs" (render "app/src/services.cljs" data)]
+ ["app/src/{{sanitized}}/html_templates.clj" (render "app/src/html_templates.clj" data)]
+ ["app/src/{{sanitized}}/rendering.cljs" (render "app/src/rendering.cljs" data)]
+ ["app/src/{{sanitized}}/start.cljs" (render "app/src/start.cljs" data)]
+ ["app/src/{{sanitized}}/simulated/services.cljs" (render "app/src/simulated/services.cljs" data)]
+ ["app/src/{{sanitized}}/simulated/start.cljs" (render "app/src/simulated/start.cljs" data)]
+ ["app/templates/application.html" (render "app/templates/application.html" data)]
+ ["app/templates/{{name}}.html" (render "app/templates/project.html" data)]
+ (base-files render data))))
+
+(defn default-project [data]
+ (let [render (renderer "pedestal-app/plain")]
+ (apply ->files data
+ ["app/src/{{sanitized}}/behavior.clj" (render "app/src/behavior.clj" data)]
+ ["app/src/{{sanitized}}/html_templates.clj" (render "app/src/html_templates.clj" data)]
+ ["app/src/{{sanitized}}/rendering.cljs" (render "app/src/rendering.cljs" data)]
+ ["app/src/{{sanitized}}/start.cljs" (render "app/src/start.cljs" data)]
+ ["app/src/{{sanitized}}/simulated/start.cljs" (render "app/src/simulated/start.cljs" data)]
+ ["app/templates/application.html" (render "app/templates/application.html" data)]
+ ["app/templates/{{name}}.html" (render "app/templates/project.html" data)]
+ (base-files render data))))
+
+(defn pedestal-app
+ "A Pedestal application project template."
+ [name & args]
+ (let [data {:name name
+ :sanitized (name-to-path name)}]
+ (case (first args)
+ "annotated" (annotated-project data)
+ (default-project data))))
3 app-template/src/leiningen/new/pedestal_app/annotated/.gitignore
@@ -0,0 +1,3 @@
+out/
+target/
+logs/
9 app-template/src/leiningen/new/pedestal_app/annotated/README.md
@@ -0,0 +1,9 @@
+# {{name}}
+
+Start working on this application by writing its behavior in the file
+`app/src/{{sanitized}}/behavior.clj`
+
+## Links
+
+* [Getting Started](https://github.com/relevance/platform/tree/master/app#usage)
+* [Overview of how pedestal-client applications work](https://github.com/relevance/platform/wiki/Client-Application-Model)
288 app-template/src/leiningen/new/pedestal_app/annotated/app/assets/javascripts/xpath.js
@@ -0,0 +1,288 @@
+(function(){var ca=void(0);var da={targetFrame:ca,exportInstaller:false,useNative:true,useInnerText:true};var ea;if(window.jsxpath){ea=window.jsxpath;}
+else{var fa=document.getElementsByTagName('script');var ga=fa[fa.length-1];var ha=ga.src;ea={};var ia=ha.match(/\?(.*)$/);if(ia){var ja=ia[1].split('&');for(var i=0,l=ja.length;i<l;i++){var ka=ja[i];var la=ka.split('=');var ma=la[0];var na=la[1];if(na==ca){na==true;}
+else if(na=='false'||/^-?\d+$/.test(na)){na=eval(na);}
+ea[ma]=na;}}}
+for(var n in da){if(!(n in ea))ea[n]=da[n];}
+ea.hasNative=!!(document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null));if(ea.hasNative&&ea.useNative&&!ea.exportInstaller){return;}
+var oa;var pa;var qa;var ra;var sa;var ta;var va;var wa;var xa;var ya;var za;var Aa;var Ba;var Ca;var Da=new function(){var ua=navigator.userAgent;if(RegExp==ca){if(ua.indexOf("Opera")>=0){this.opera=true;}
+else if(ua.indexOf("Netscape")>=0){this.netscape=true;}
+else if(ua.indexOf("Mozilla/")==0){this.mozilla=true;}
+else{this.unknown=true;}
+if(ua.indexOf("Gecko/")>=0){this.gecko=true;}
+if(ua.indexOf("Win")>=0){this.windows=true;}
+else if(ua.indexOf("Mac")>=0){this.mac=true;}
+else if(ua.indexOf("Linux")>=0){this.linux=true;}
+else if(ua.indexOf("BSD")>=0){this.bsd=true;}
+else if(ua.indexOf("SunOS")>=0){this.sunos=true;}}
+else{ /*@cc_on @if(@_jscript)function jscriptVersion(){switch(@_jscript_version){case 3.0:return "4.0";case 5.0:return "5.0";case 5.1:return "5.01";case 5.5:return "5.5";case 5.6:if("XMLHttpRequest" in window)return "7.0";return "6.0";case 5.7:return "7.0";default:return true;}}
+if(@_win16||@_win32||@_win64){this.windows=true;this.trident=jscriptVersion();}
+else if(@_mac||navigator.platform.indexOf("Mac")>=0){this.mac=true;this.tasman=jscriptVersion();}
+if(/MSIE (\d+\.\d+)b?;/.test(ua)){this.ie=RegExp.$1;this['ie'+RegExp.$1.charAt(0)]=true;}@else @*/
+if(/AppleWebKit\/(\d+(?:\.\d+)*)/.test(ua)){this.applewebkit=RegExp.$1;if(RegExp.$1.charAt(0)==4){this.applewebkit2=true;}
+else{this.applewebkit3=true;}}
+else if(typeof Components=="object"&&(/Gecko\/(\d{8})/.test(ua)||navigator.product=="Gecko"&&/^(\d{8})$/.test(navigator.productSub))){this.gecko=RegExp.$1;}/*@end @*/
+if(typeof(opera)=="object"&&typeof(opera.version)=="function"){this.opera=opera.version();this['opera'+this.opera[0]+this.opera[2]]=true;}
+else if(typeof opera=="object"&&(/Opera[\/ ](\d+\.\d+)/.test(ua))){this.opera=RegExp.$1;}
+else if(this.ie){}
+else if(/Safari\/(\d+(?:\.\d+)*)/.test(ua)){this.safari=RegExp.$1;}
+else if(/NetFront\/(\d+(?:\.\d+)*)/.test(ua)){this.netfront=RegExp.$1;}
+else if(/Konqueror\/(\d+(?:\.\d+)*)/.test(ua)){this.konqueror=RegExp.$1;}
+else if(ua.indexOf("(compatible;")<0&&(/^Mozilla\/(\d+\.\d+)/.test(ua))){this.mozilla=RegExp.$1;if(/\([^(]*rv:(\d+(?:\.\d+)*).*?\)/.test(ua))this.mozillarv=RegExp.$1;if(/Firefox\/(\d+(?:\.\d+)*)/.test(ua)){this.firefox=RegExp.$1;}
+else if(/Netscape\d?\/(\d+(?:\.\d+)*)/.test(ua)){this.netscape=RegExp.$1;}}
+else{this.unknown=true;}
+if(ua.indexOf("Win 9x 4.90")>=0){this.windows="ME";}
+else if(/Win(?:dows)? ?(NT ?(\d+\.\d+)?|\d+|ME|Vista|XP)/.test(ua)){this.windows=RegExp.$1;if(RegExp.$2){this.winnt=RegExp.$2;}
+else switch(RegExp.$1){case "2000":this.winnt="5.0";break;case "XP":this.winnt="5.1";break;case "Vista":this.winnt="6.0";break;}}
+else if(ua.indexOf("Mac")>=0){this.mac=true;}
+else if(ua.indexOf("Linux")>=0){this.linux=true;}
+else if(/(\w*BSD)/.test(ua)){this.bsd=RegExp.$1;}
+else if(ua.indexOf("SunOS")>=0){this.sunos=true;}}};var Ea=function(Fa){var Ga=Ea.prototype;var Ha=Fa.match(Ga.regs.token);for(var i=0,l=Ha.length;i<l;i++){if(Ga.regs.strip.test(Ha[i])){Ha.splice(i,1);}}
+for(var n in Ga)Ha[n]=Ga[n];Ha.index=0;return Ha;};Ea.prototype.regs={token:/\$?(?:(?![0-9-])[\w-]+:)?(?![0-9-])[\w-]+|\/\/|\.\.|::|\d+(?:\.\d*)?|\.\d+|"[^"]*"|'[^']*'|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g,strip:/^\s/};Ea.prototype.peek=function(i){return this[this.index+(i||0)];};Ea.prototype.next=function(){return this[this.index++];};Ea.prototype.back=function(){this.index--;};Ea.prototype.empty=function(){return this.length<=this.index;};var Ia=function(Ja,Ka,La){this.node=Ja;this.position=Ka||1;this.last=La||1;};var Ma=function(){};Ma.prototype.number=function(Na){var Oa=this.evaluate(Na);if(Oa.isNodeSet)return Oa.number();return+Oa;};Ma.prototype.string=function(Pa){var Qa=this.evaluate(Pa);if(Qa.isNodeSet)return Qa.string();return ''+Qa;};Ma.prototype.bool=function(Ra){var Sa=this.evaluate(Ra);if(Sa.isNodeSet)return Sa.bool();return!!Sa;};var Ta=function(){};Ta.parsePredicates=function(Ua,Va){while(Ua.peek()=='['){Ua.next();if(Ua.empty()){throw Error('missing predicate expr');}
+var Wa=oa.parse(Ua);Va.predicate(Wa);if(Ua.empty()){throw Error('unclosed predicate expr');}
+if(Ua.next()!=']'){Ua.back();throw Error('bad token: '+Ua.next());}}};Ta.prototype=new Ma();Ta.prototype.evaluatePredicates=function(Xa,Ya){var Za,predicate,nodes,node,Xa,position,reverse;reverse=this.reverse;Za=this.predicates;Xa.sort();for(var i=Ya||0,l0=Za.length;i<l0;i++){predicate=Za[i];var $a=[];var ab=Xa.list();for(var j=0,l1=ab.length;j<l1;j++){position=reverse?(l1-j):(j+1);exrs=predicate.evaluate(new Ia(ab[j],position,l1));switch(typeof exrs){case 'number':exrs=(position==exrs);break;case 'string':exrs=!!exrs;break;case 'object':exrs=exrs.bool();break;}
+if(!exrs){$a.push(j);}}
+for(var j=$a.length-1,l1=0;j>=l1;j--){Xa.del($a[j]);}}
+return Xa;};if(!window.BinaryExpr&&window.defaultConfig)window.BinaryExpr=null;oa=function(op,bb,cb,db){this.op=op;this.left=bb;this.right=cb;this.datatype=oa.ops[op][2];this.needContextPosition=bb.needContextPosition||cb.needContextPosition;this.needContextNode=bb.needContextNode||cb.needContextNode;if(this.op=='='){if(!cb.needContextNode&&!cb.needContextPosition&&cb.datatype!='nodeset'&&cb.datatype!='void'&&bb.quickAttr){this.quickAttr=true;this.attrName=bb.attrName;this.attrValueExpr=cb;}
+else if(!bb.needContextNode&&!bb.needContextPosition&&bb.datatype!='nodeset'&&bb.datatype!='void'&&cb.quickAttr){this.quickAttr=true;this.attrName=cb.attrName;this.attrValueExpr=bb;}}};oa.compare=function(op,eb,fb,gb,hb){var ib,lnodes,rnodes,nodes,nodeset,primitive;fb=fb.evaluate(hb);gb=gb.evaluate(hb);if(fb.isNodeSet&&gb.isNodeSet){lnodes=fb.list();rnodes=gb.list();for(var i=0,l0=lnodes.length;i<l0;i++)for(var j=0,l1=rnodes.length;j<l1;j++)if(eb(wa.to('string',lnodes[i]),wa.to('string',rnodes[j])))return true;return false;}
+if(fb.isNodeSet||gb.isNodeSet){if(fb.isNodeSet)nodeset=fb,primitive=gb;else nodeset=gb,primitive=fb;nodes=nodeset.list();ib=typeof primitive;for(var i=0,l=nodes.length;i<l;i++){if(eb(wa.to(ib,nodes[i]),primitive))return true;}
+return false;}
+if(op=='='||op=='!='){if(typeof fb=='boolean'||typeof gb=='boolean'){return eb(!!fb,!!gb);}
+if(typeof fb=='number'||typeof gb=='number'){return eb(+fb,+gb);}
+return eb(fb,gb);}
+return eb(+fb,+gb);};oa.ops={'div':[6,function(jb,kb,lb){return jb.number(lb)/kb.number(lb);},'number'],'mod':[6,function(mb,nb,ob){return mb.number(ob)%nb.number(ob);},'number'],'*':[6,function(pb,qb,rb){return pb.number(rb)*qb.number(rb);},'number'],'+':[5,function(sb,tb,ub){return sb.number(ub)+tb.number(ub);},'number'],'-':[5,function(vb,wb,xb){return vb.number(xb)-wb.number(xb);},'number'],'<':[4,function(yb,zb,Ab){return oa.compare('<',function(a,b){return a<b},yb,zb,Ab);},'boolean'],'>':[4,function(Bb,Cb,Db){return oa.compare('>',function(a,b){return a>b},Bb,Cb,Db);},'boolean'],'<=':[4,function(Eb,Fb,Gb){return oa.compare('<=',function(a,b){return a<=b},Eb,Fb,Gb);},'boolean'],'>=':[4,function(Hb,Ib,Jb){return oa.compare('>=',function(a,b){return a>=b},Hb,Ib,Jb);},'boolean'],'=':[3,function(Kb,Lb,Mb){return oa.compare('=',function(a,b){return a==b},Kb,Lb,Mb);},'boolean'],'!=':[3,function(Nb,Ob,Pb){return oa.compare('!=',function(a,b){return a!=b},Nb,Ob,Pb);},'boolean'],'and':[2,function(Qb,Rb,Sb){return Qb.bool(Sb)&&Rb.bool(Sb);},'boolean'],'or':[1,function(Tb,Ub,Vb){return Tb.bool(Vb)||Ub.bool(Vb);},'boolean']};oa.parse=function(Wb){var op,precedence,info,expr,stack=[],index=Wb.index;while(true){if(Wb.empty()){throw Error('missing right expression');}
+expr=Aa.parse(Wb);op=Wb.next();if(!op){break;}
+info=this.ops[op];precedence=info&&info[0];if(!precedence){Wb.back();break;}
+while(stack.length&&precedence<=this.ops[stack[stack.length-1]][0]){expr=new oa(stack.pop(),stack.pop(),expr);}
+stack.push(expr,op);}
+while(stack.length){expr=new oa(stack.pop(),stack.pop(),expr);}
+return expr;};oa.prototype=new Ma();oa.prototype.evaluate=function(Xb){return oa.ops[this.op][1](this.left,this.right,Xb);};oa.prototype.show=function(Yb){Yb=Yb||'';var t='';t+=Yb+'binary: '+this.op+'\n';Yb+=' ';t+=this.left.show(Yb);t+=this.right.show(Yb);return t;};if(!window.UnaryExpr&&window.defaultConfig)window.UnaryExpr=null;Aa=function(op,Zb){this.op=op;this.expr=Zb;this.needContextPosition=Zb.needContextPosition;this.needContextNode=Zb.needContextNode;};Aa.ops={'-':1};Aa.parse=function($b){var ac;if(this.ops[$b.peek()])return new Aa($b.next(),Aa.parse($b));else return Ba.parse($b);};Aa.prototype=new Ma();Aa.prototype.datatype='number';Aa.prototype.evaluate=function(bc){return-this.expr.number(bc);};Aa.prototype.show=function(cc){cc=cc||'';var t='';t+=cc+'unary: '+this.op+'\n';cc+=' ';t+=this.expr.show(cc);return t;};if(!window.UnionExpr&&window.defaultConfig)window.UnionExpr=null;Ba=function(){this.paths=[];};Ba.ops={'|':1};Ba.parse=function(dc){var ec,expr;expr=ya.parse(dc);if(!this.ops[dc.peek()])return expr;ec=new Ba();ec.path(expr);while(true){if(!this.ops[dc.next()])break;if(dc.empty()){throw Error('missing next union location path');}
+ec.path(ya.parse(dc));}
+dc.back();return ec;};Ba.prototype=new Ma();Ba.prototype.datatype='nodeset';Ba.prototype.evaluate=function(fc){var gc=this.paths;var hc=new ta();for(var i=0,l=gc.length;i<l;i++){var ic=gc[i].evaluate(fc);if(!ic.isNodeSet)throw Error('PathExpr must be nodeset');hc.merge(ic);}
+return hc;};Ba.prototype.path=function(jc){this.paths.push(jc);if(jc.needContextPosition){this.needContextPosition=true;}
+if(jc.needContextNode){this.needContextNode=true;}}
+Ba.prototype.show=function(kc){kc=kc||'';var t='';t+=kc+'union:'+'\n';kc+=' ';for(var i=0;i<this.paths.length;i++){t+=this.paths[i].show(kc);}
+return t;};if(!window.PathExpr&&window.defaultConfig)window.PathExpr=null;ya=function(lc){this.filter=lc;this.steps=[];this.datatype=lc.datatype;this.needContextPosition=lc.needContextPosition;this.needContextNode=lc.needContextNode;};ya.ops={'//':1,'/':1};ya.parse=function(mc){var op,expr,path,token;if(this.ops[mc.peek()]){op=mc.next();token=mc.peek();if(op=='/'&&(mc.empty()||(token!='.'&&token!='..'&&token!='@'&&token!='*'&&!/(?![0-9])[\w]/.test(token)))){return pa.root();}
+path=new ya(pa.root());if(mc.empty()){throw Error('missing next location step');}
+expr=za.parse(mc);path.step(op,expr);}
+else{expr=pa.parse(mc);if(!expr){expr=za.parse(mc);path=new ya(pa.context());path.step('/',expr);}
+else if(!this.ops[mc.peek()])return expr;else path=new ya(expr);}
+while(true){if(!this.ops[mc.peek()])break;op=mc.next();if(mc.empty()){throw Error('missing next location step');}
+path.step(op,za.parse(mc));}
+return path;};ya.prototype=new Ma();ya.prototype.evaluate=function(nc){var oc=this.filter.evaluate(nc);if(!oc.isNodeSet)throw Exception('Filter nodeset must be nodeset type');var pc=this.steps;for(var i=0,l0=pc.length;i<l0&&oc.length;i++){var qc=pc[i][1];var rc=qc.reverse;var sc=oc.iterator(rc);var tc=oc;oc=null;var uc,next;if(!qc.needContextPosition&&qc.axis=='following'){for(uc=sc();next=sc();uc=next){if(Da.applewebkit2){var vc=false;var wc=next;do{if(wc==uc){vc=true;break;}}
+while(wc=wc.parentNode);if(!vc)break;}
+else{try{if(!uc.contains(next))break}
+catch(e){if(!(next.compareDocumentPosition(uc)&8))break}}}
+oc=qc.evaluate(new Ia(uc));}
+else if(!qc.needContextPosition&&qc.axis=='preceding'){uc=sc();oc=qc.evaluate(new Ia(uc));}
+else{uc=sc();var j=0;oc=qc.evaluate(new Ia(uc),false,tc,j);while(uc=sc()){j++;oc.merge(qc.evaluate(new Ia(uc),false,tc,j));}}}
+return oc;};ya.prototype.step=function(op,xc){xc.op=op;this.steps.push([op,xc]);this.quickAttr=false;if(this.steps.length==1){if(op=='/'&&xc.axis=='attribute'){var yc=xc.test;if(!yc.notOnlyElement&&yc.name!='*'){this.quickAttr=true;this.attrName=yc.name;}}}};ya.prototype.show=function(zc){zc=zc||'';var t='';t+=zc+'path:'+'\n';zc+=' ';t+=zc+'filter:'+'\n';t+=this.filter.show(zc+' ');if(this.steps.length){t+=zc+'steps:'+'\n';zc+=' ';for(var i=0;i<this.steps.length;i++){var Ac=this.steps[i];t+=zc+'operator: '+Ac[0]+'\n';t+=Ac[1].show(zc);}}
+return t;};if(!window.FilterExpr&&window.defaultConfig)window.FilterExpr=null;pa=function(Bc){this.primary=Bc;this.predicates=[];this.datatype=Bc.datatype;this.needContextPosition=Bc.needContextPosition;this.needContextNode=Bc.needContextNode;};pa.parse=function(Cc){var Dc,filter,token,ch;token=Cc.peek();ch=token.charAt(0);switch(ch){case '$':Dc=Ca.parse(Cc);break;case '(':Cc.next();Dc=oa.parse(Cc);if(Cc.empty()){throw Error('unclosed "("');}
+if(Cc.next()!=')'){Cc.back();throw Error('bad token: '+Cc.next());}
+break;case '"':case "'":Dc=ra.parse(Cc);break;default:if(!isNaN(+token)){Dc=xa.parse(Cc);}
+else if(va.types[token]){return null;}
+else if(/(?![0-9])[\w]/.test(ch)&&Cc.peek(1)=='('){Dc=qa.parse(Cc);}
+else{return null;}
+break;}
+if(Cc.peek()!='[')return Dc;filter=new pa(Dc);Ta.parsePredicates(Cc,filter);return filter;};pa.root=function(){return new qa('root-node');};pa.context=function(){return new qa('context-node');};pa.prototype=new Ta();pa.prototype.evaluate=function(Ec){var Fc=this.primary.evaluate(Ec);if(!Fc.isNodeSet){if(this.predicates.length)throw Error('Primary result must be nodeset type '+'if filter have predicate expression');return Fc;}
+return this.evaluatePredicates(Fc);};pa.prototype.predicate=function(Gc){this.predicates.push(Gc);};pa.prototype.show=function(Hc){Hc=Hc||'';var t='';t+=Hc+'filter: '+'\n';Hc+=' ';t+=this.primary.show(Hc);if(this.predicates.length){t+=Hc+'predicates: '+'\n';Hc+=' ';for(var i=0;i<this.predicates.length;i++){t+=this.predicates[i].show(Hc);}}
+return t;};if(!window.NodeUtil&&window.defaultConfig)window.NodeUtil=null;wa={to:function(Ic,Jc){var t,type=Jc.nodeType;if(type==1&&ea.useInnerText&&!Da.applewebkit2){t=Jc.textContent;t=(t==ca||t==null)?Jc.innerText:t;t=(t==ca||t==null)?'':t;}
+if(typeof t!='string'){ /*@cc_on
+if(type==1&&Jc.nodeName.toLowerCase()=='title'){t=Jc.text;}
+else@*/if(type==9||type==1){if(type==9){Jc=Jc.documentElement;}
+else{Jc=Jc.firstChild;}
+for(t='',stack=[],i=0;Jc;){do{if(Jc.nodeType!=1){t+=Jc.nodeValue;} /*@cc_on
+else if(Jc.nodeName.toLowerCase()=='title'){t+=Jc.text;}@*/stack[i++]=Jc;}
+while(Jc=Jc.firstChild);while(i&&!(Jc=stack[--i].nextSibling)){}}}
+else{t=Jc.nodeValue;}}
+switch(Ic){case 'number':return+t;case 'boolean':return!!t;default:return t;}},attrPropMap:{name:'name','class':'className',dir:'dir',id:'id',name:'name',title:'title'},attrMatch:function(Kc,Lc,Mc){ /*@cc_on @if(@_jscript)var Nc=wa.attrPropMap[Lc];if(!Lc||Mc==null&&(Nc&&Kc[Nc]||!Nc&&Kc.getAttribute&&Kc.getAttribute(Lc,2))||Mc!=null&&(Nc&&Kc[Nc]==Mc||!Nc&&Kc.getAttribute&&Kc.getAttribute(Lc,2)==Mc)){@else @*/
+if(!Lc||Mc==null&&Kc.hasAttribute&&Kc.hasAttribute(Lc)||Mc!=null&&Kc.getAttribute&&Kc.getAttribute(Lc)==Mc){/*@end @*/
+return true;}
+else{return false;}},getDescendantNodes:function(Oc,Kc,Pc,Lc,Mc,Qc,Rc){if(Qc){Qc.delDescendant(Kc,Rc);} /*@cc_on
+try{if(!Oc.notOnlyElement||Oc.type==8||(Lc&&Oc.type==0)){var Sc=Kc.all;if(!Sc){return Pc;}
+var Tc=Oc.name;if(Oc.type==8)Tc='!';else if(Oc.type==0)Tc='*';if(Tc!='*'){Sc=Sc.tags(Tc);if(!Sc){return Pc;}}
+if(Lc){var Uc=[]
+var i=0;if(Mc!=null&&(Lc=='id'||Lc=='name')){Sc=Sc[Mc];if(!Sc){return Pc;}
+if(!Sc.length||Sc.nodeType){Sc=[Sc];}}
+while(Kc=Sc[i++]){if(wa.attrMatch(Kc,Lc,Mc))Uc.push(Kc);}
+Sc=Uc;}
+var i=0;while(Kc=Sc[i++]){if(Tc!='*'||Kc.tagName!='!'){Pc.push(Kc);}}
+return Pc;}(function(Vc){var g=arguments.callee;var Kc=Vc.firstChild;if(Kc){for(;Kc;Kc=Kc.nextSibling){if(wa.attrMatch(Kc,Lc,Mc)){if(Oc.match(Kc))Pc.push(Kc);}
+g(Kc);}}})(Kc);return Pc;}
+catch(e){@*/if(Mc&&Lc=='id'&&Kc.getElementById){Kc=Kc.getElementById(Mc);if(Kc&&Oc.match(Kc)){Pc.push(Kc);}}
+else if(Mc&&Lc=='name'&&Kc.getElementsByName){var Wc=Kc.getElementsByName(Mc);for(var i=0,l=Wc.length;i<l;i++){Kc=Wc[i];if(Da.opera?(Kc.name==Mc&&Oc.match(Kc)):Oc.match(Kc)){Pc.push(Kc);}}}
+else if(Mc&&Lc=='class'&&Kc.getElementsByClassName){var Wc=Kc.getElementsByClassName(Mc);for(var i=0,l=Wc.length;i<l;i++){Kc=Wc[i];if(Kc.className==Mc&&Oc.match(Kc)){Pc.push(Kc);}}}
+else if(Oc.notOnlyElement){(function(Xc){var f=arguments.callee;for(var Kc=Xc.firstChild;Kc;Kc=Kc.nextSibling){if(wa.attrMatch(Kc,Lc,Mc)){if(Oc.match(Kc.nodeType))Pc.push(Kc);}
+f(Kc);}})(Kc);}
+else{var Tc=Oc.name;if(Kc.getElementsByTagName){var Wc=Kc.getElementsByTagName(Tc);if(Wc){var i=0;while(Kc=Wc[i++]){if(wa.attrMatch(Kc,Lc,Mc))Pc.push(Kc);}}}}
+return Pc; /*@cc_on }@*/},getChildNodes:function(Yc,Kc,Zc,Lc,Mc){ /*@cc_on
+try{var $c;if((!Yc.notOnlyElement||Yc.type==8||(Lc&&Yc.type==0))&&($c=Kc.children)){var ad,elm;ad=Yc.name;if(Yc.type==8)ad='!';else if(Yc.type==0)ad='*';if(ad!='*'){$c=$c.tags(ad);if(!$c){return Zc;}}
+if(Lc){var bd=[]
+var i=0;if(Lc=='id'||Lc=='name'){$c=$c[Mc];if(!$c){return Zc;}
+if(!$c.length||$c.nodeType){$c=[$c];}}
+while(Kc=$c[i++]){if(wa.attrMatch(Kc,Lc,Mc))bd.push(Kc);}
+$c=bd;}
+var i=0;while(Kc=$c[i++]){if(ad!='*'||Kc.tagName!='!'){Zc.push(Kc);}}
+return Zc;}
+for(var i=0,Kc=Kc.firstChild;Kc;i++,Kc=Kc.nextSibling){if(wa.attrMatch(Kc,Lc,Mc)){if(Yc.match(Kc))Zc.push(Kc);}}
+return Zc;}
+catch(e){@*/for(var Kc=Kc.firstChild;Kc;Kc=Kc.nextSibling){if(wa.attrMatch(Kc,Lc,Mc)){if(Yc.match(Kc))Zc.push(Kc);}}
+return Zc; /*@cc_on }@*/}}; /*@cc_on
+var cd=function(dd,ed,fd){this.node=dd;this.nodeType=2;this.nodeValue=dd.nodeValue;this.nodeName=dd.nodeName;this.parentNode=ed;this.ownerElement=ed;this.parentSourceIndex=fd;};@*/if(!window.Step&&window.defaultConfig)window.Step=null;za=function(gd,hd){this.axis=gd;this.reverse=za.axises[gd][0];this.func=za.axises[gd][1];this.test=hd;this.predicates=[];this._quickAttr=za.axises[gd][2]};za.axises={ancestor:[true,function(jd,kd,ld,_,md,od,pd){while(kd=kd.parentNode){if(od&&kd.nodeType==1){od.reserveDelByNode(kd,pd,true);}
+if(jd.match(kd))ld.unshift(kd);}
+return ld;}],'ancestor-or-self':[true,function(qd,rd,sd,_,td,ud,vd){do{if(ud&&rd.nodeType==1){ud.reserveDelByNode(rd,vd,true);}
+if(qd.match(rd))sd.unshift(rd);}
+while(rd=rd.parentNode)return sd;}],attribute:[false,function(wd,xd,yd){var zd=xd.attributes;if(zd){ /*@cc_on
+var Ad=xd.sourceIndex;@*/if((wd.notOnlyElement&&wd.type==0)||wd.name=='*'){for(var i=0,attr;attr=zd[i];i++){ /*@cc_on @if(@_jscript)if(attr.nodeValue){yd.push(new cd(attr,xd,Ad));}@else @*/
+yd.push(attr);/*@end @*/ }}
+else{var Bd=zd.getNamedItem(wd.name); /*@cc_on @if(@_jscript)if(Bd&&Bd.nodeValue){Bd=new cd(Bd,xd,Ad);;@else @*/
+if(Bd){/*@end @*/
+yd.push(Bd);}}}
+return yd;}],child:[false,wa.getChildNodes,true],descendant:[false,wa.getDescendantNodes,true],'descendant-or-self':[false,function(wd,xd,yd,Cd,Dd,Ed,Fd){if(wa.attrMatch(xd,Cd,Dd)){if(wd.match(xd))yd.push(xd);}
+return wa.getDescendantNodes(wd,xd,yd,Cd,Dd,Ed,Fd);},true],following:[false,function(wd,xd,yd,Gd,Hd){do{var Id=xd;while(Id=Id.nextSibling){if(wa.attrMatch(Id,Gd,Hd)){if(wd.match(Id))yd.push(Id);}
+yd=wa.getDescendantNodes(wd,Id,yd,Gd,Hd);}}
+while(xd=xd.parentNode);return yd;},true],'following-sibling':[false,function(wd,xd,yd,_,Jd,Kd,Ld){while(xd=xd.nextSibling){if(Kd&&xd.nodeType==1){Kd.reserveDelByNode(xd,Ld);}
+if(wd.match(xd)){yd.push(xd);}}
+return yd;}],namespace:[false,function(wd,xd,yd){return yd;}],parent:[false,function(wd,xd,yd){if(xd.nodeType==9){return yd;}
+if(xd.nodeType==2){yd.push(xd.ownerElement);return yd;}
+var xd=xd.parentNode;if(wd.match(xd))yd.push(xd);return yd;}],preceding:[true,function(wd,xd,yd,Md,Nd){var Od=[];do{Od.unshift(xd);}
+while(xd=xd.parentNode);for(var i=1,l0=Od.length;i<l0;i++){var Pd=[];xd=Od[i];while(xd=xd.previousSibling){Pd.unshift(xd);}
+for(var j=0,l1=Pd.length;j<l1;j++){xd=Pd[j];if(wa.attrMatch(xd,Md,Nd)){if(wd.match(xd))yd.push(xd);}
+yd=wa.getDescendantNodes(wd,xd,yd,Md,Nd);}}
+return yd;},true],'preceding-sibling':[true,function(wd,xd,yd,_,Qd,Rd,Sd){while(xd=xd.previousSibling){if(Rd&&xd.nodeType==1){Rd.reserveDelByNode(xd,Sd,true);}
+if(wd.match(xd)){yd.unshift(xd)}}
+return yd;}],self:[false,function(wd,xd,yd){if(wd.match(xd))yd.push(xd);return yd;}]};za.parse=function(Td){var Ud,test,step,token;if(Td.peek()=='.'){step=this.self();Td.next();}
+else if(Td.peek()=='..'){step=this.parent();Td.next();}
+else{if(Td.peek()=='@'){Ud='attribute';Td.next();if(Td.empty()){throw Error('missing attribute name');}}
+else{if(Td.peek(1)=='::'){if(!/(?![0-9])[\w]/.test(Td.peek().charAt(0))){throw Error('bad token: '+Td.next());}
+Ud=Td.next();Td.next();if(!this.axises[Ud]){throw Error('invalid axis: '+Ud);}
+if(Td.empty()){throw Error('missing node name');}}
+else{Ud='child';}}
+token=Td.peek();if(!/(?![0-9])[\w]/.test(token.charAt(0))){if(token=='*'){test=sa.parse(Td)}
+else{throw Error('bad token: '+Td.next());}}
+else{if(Td.peek(1)=='('){if(!va.types[token]){throw Error('invalid node type: '+token);}
+test=va.parse(Td)}
+else{test=sa.parse(Td);}}
+step=new za(Ud,test);}
+Ta.parsePredicates(Td,step);return step;};za.self=function(){return new za('self',new va('node'));};za.parent=function(){return new za('parent',new va('node'));};za.prototype=new Ta();za.prototype.evaluate=function(Vd,Wd,Xd,Yd){var Zd=Vd.node;var $d=false;if(!Wd&&this.op=='//'){if(!this.needContextPosition&&this.axis=='child'){if(this.quickAttr){var ae=this.attrValueExpr?this.attrValueExpr.string(Vd):null;var be=wa.getDescendantNodes(this.test,Zd,new ta(),this.attrName,ae,Xd,Yd);be=this.evaluatePredicates(be,1);}
+else{var be=wa.getDescendantNodes(this.test,Zd,new ta(),null,null,Xd,Yd);be=this.evaluatePredicates(be);}}
+else{var ce=new za('descendant-or-self',new va('node'));var de=ce.evaluate(Vd,false,Xd,Yd).list();var be=null;ce.op='/';for(var i=0,l=de.length;i<l;i++){if(!be){be=this.evaluate(new Ia(de[i]),true);}
+else{be.merge(this.evaluate(new Ia(de[i]),true));}}
+be=be||new ta();}}
+else{if(this.needContextPosition){Xd=null;Yd=null;}
+if(this.quickAttr){var ae=this.attrValueExpr?this.attrValueExpr.string(Vd):null;var be=this.func(this.test,Zd,new ta(),this.attrName,ae,Xd,Yd);be=this.evaluatePredicates(be,1);}
+else{var be=this.func(this.test,Zd,new ta(),null,null,Xd,Yd);be=this.evaluatePredicates(be);}
+if(Xd){Xd.doDel();}}
+return be;};za.prototype.predicate=function(ee){this.predicates.push(ee);if(ee.needContextPosition||ee.datatype=='number'||ee.datatype=='void'){this.needContextPosition=true;}
+if(this._quickAttr&&this.predicates.length==1&&ee.quickAttr){var fe=ee.attrName; /*@cc_on @if(@_jscript)this.attrName=fe.toLowerCase();@else @*/
+this.attrName=fe;/*@end @*/
+this.attrValueExpr=ee.attrValueExpr;this.quickAttr=true;}};za.prototype.show=function(ge){ge=ge||'';var t='';t+=ge+'step: '+'\n';ge+=' ';if(this.axis)t+=ge+'axis: '+this.axis+'\n';t+=this.test.show(ge);if(this.predicates.length){t+=ge+'predicates: '+'\n';ge+=' ';for(var i=0;i<this.predicates.length;i++){t+=this.predicates[i].show(ge);}}
+return t;};if(!window.NodeType&&window.defaultConfig)window.NodeType=null;va=function(he,je){this.name=he;this.literal=je;switch(he){case 'comment':this.type=8;break;case 'text':this.type=3;break;case 'processing-instruction':this.type=7;break;case 'node':this.type=0;break;}};va.types={'comment':1,'text':1,'processing-instruction':1,'node':1};va.parse=function(ke){var le,literal,ch;le=ke.next();ke.next();if(ke.empty()){throw Error('bad nodetype');}
+ch=ke.peek().charAt(0);if(ch=='"'||ch=="'"){literal=ra.parse(ke);}
+if(ke.empty()){throw Error('bad nodetype');}
+if(ke.next()!=')'){ke.back();throw Error('bad token '+ke.next());}
+return new va(le,literal);};va.prototype=new Ma();va.prototype.notOnlyElement=true;va.prototype.match=function(me){return!this.type||this.type==me.nodeType;};va.prototype.show=function(ne){ne=ne||'';var t='';t+=ne+'nodetype: '+this.type+'\n';if(this.literal){ne+=' ';t+=this.literal.show(ne);}
+return t;};if(!window.NameTest&&window.defaultConfig)window.NameTest=null;sa=function(oe){this.name=oe.toLowerCase();};sa.parse=function(pe){if(pe.peek()!='*'&&pe.peek(1)==':'&&pe.peek(2)=='*'){return new sa(pe.next()+pe.next()+pe.next());}
+return new sa(pe.next());};sa.prototype=new Ma();sa.prototype.match=function(qe){var re=qe.nodeType;if(re==1||re==2){if(this.name=='*'||this.name==qe.nodeName.toLowerCase()){return true;}}
+return false;};sa.prototype.show=function(se){se=se||'';var t='';t+=se+'nametest: '+this.name+'\n';return t;};if(!window.VariableReference&&window.defaultConfig)window.VariableReference=null;Ca=function(te){this.name=te.substring(1);};Ca.parse=function(ue){var ve=ue.next();if(ve.length<2){throw Error('unnamed variable reference');}
+return new Ca(ve)};Ca.prototype=new Ma();Ca.prototype.datatype='void';Ca.prototype.show=function(we){we=we||'';var t='';t+=we+'variable: '+this.name+'\n';return t;};if(!window.Literal&&window.defaultConfig)window.Literal=null;ra=function(xe){this.text=xe.substring(1,xe.length-1);};ra.parse=function(ye){var ze=ye.next();if(ze.length<2){throw Error('unclosed literal string');}
+return new ra(ze)};ra.prototype=new Ma();ra.prototype.datatype='string';ra.prototype.evaluate=function(Ae){return this.text;};ra.prototype.show=function(Be){Be=Be||'';var t='';t+=Be+'literal: '+this.text+'\n';return t;};if(!window.Number&&window.defaultConfig)window.Number=null;xa=function(Ce){this.digit=+Ce;};xa.parse=function(De){return new xa(De.next());};xa.prototype=new Ma();xa.prototype.datatype='number';xa.prototype.evaluate=function(Ee){return this.digit;};xa.prototype.show=function(Fe){Fe=Fe||'';var t='';t+=Fe+'number: '+this.digit+'\n';return t;};if(!window.FunctionCall&&window.defaultConfig)window.FunctionCall=null;qa=function(Ge){var He=qa.funcs[Ge];if(!He)throw Error(Ge+' is not a function');this.name=Ge;this.func=He[0];this.args=[];this.datatype=He[1];if(He[2]){this.needContextPosition=true;}
+this.needContextNodeInfo=He[3];this.needContextNode=this.needContextNodeInfo[0]};qa.funcs={'context-node':[function(){if(arguments.length!=0){throw Error('Function context-node expects ()');}
+var ns;ns=new ta();ns.push(this.node);return ns;},'nodeset',false,[true]],'root-node':[function(){if(arguments.length!=0){throw Error('Function root-node expects ()');}
+var ns,ctxn;ns=new ta();ctxn=this.node;if(ctxn.nodeType==9)ns.push(ctxn);else ns.push(ctxn.ownerDocument);return ns;},'nodeset',false,[]],last:[function(){if(arguments.length!=0){throw Error('Function last expects ()');}
+return this.last;},'number',true,[]],position:[function(){if(arguments.length!=0){throw Error('Function position expects ()');}
+return this.position;},'number',true,[]],count:[function(ns){if(arguments.length!=1||!(ns=ns.evaluate(this)).isNodeSet){throw Error('Function count expects (nodeset)');}
+return ns.length;},'number',false,[]],id:[function(s){var Ie,ns,i,id,elm,ctxn,doc;if(arguments.length!=1){throw Error('Function id expects (object)');}
+ctxn=this.node;if(ctxn.nodeType==9)doc=ctxn;else doc=ctxn.ownerDocument; /*@cc_on
+all=doc.all;@*/s=s.string(this);Ie=s.split(/\s+/);ns=new ta();for(i=0,l=Ie.length;i<l;i++){id=Ie[i]; /*@cc_on @if(@_jscript)elm=all[id];if(elm){if((!elm.length||elm.nodeType)&&id==elm.id){ns.push(elm)}
+else if(elm.length){var Je=elm;for(var j=0,l0=Je.length;j<l0;j++){var Ke=Je[j];if(id==Ke.id){ns.push(Ke);break;}}}}@else @*/
+elm=doc.getElementById(id);if(Da.opera&&elm&&elm.id!=id){var Je=doc.getElementsByName(id);for(var j=0,l0=Je.length;j<l0;j++){elm=Je[j];if(elm.id==id){ns.push(elm);}}}
+else{if(elm)ns.push(elm)}/*@end @*/ }
+ns.isSorted=false;return ns;},'nodeset',false,[]],'local-name':[function(ns){var nd;switch(arguments.length){case 0:nd=this.node;break;case 1:if((ns=ns.evaluate(this)).isNodeSet){nd=ns.first();break;}
+default:throw Error('Function local-name expects (nodeset?)');break;}
+return ''+nd.nodeName.toLowerCase();},'string',false,[true,false]],name:[function(ns){return qa.funcs['local-name'][0].apply(this,arguments);},'string',false,[true,false]],'namespace-uri':[function(ns){return '';},'string',false,[true,false]],string:[function(s){switch(arguments.length){case 0:s=wa.to('string',this.node);break;case 1:s=s.string(this);break;default:throw Error('Function string expects (object?)');break;}
+return s;},'string',false,[true,false]],concat:[function(s1,s2){if(arguments.length<2){throw Error('Function concat expects (string, string[, ...])');}
+for(var t='',i=0,l=arguments.length;i<l;i++){t+=arguments[i].string(this);}
+return t;},'string',false,[]],'starts-with':[function(s1,s2){if(arguments.length!=2){throw Error('Function starts-with expects (string, string)');}
+s1=s1.string(this);s2=s2.string(this);return s1.indexOf(s2)==0;},'boolean',false,[]],contains:[function(s1,s2){if(arguments.length!=2){throw Error('Function contains expects (string, string)');}
+s1=s1.string(this);s2=s2.string(this);return s1.indexOf(s2)!=-1;},'boolean',false,[]],substring:[function(s,n1,n2){var a1,a2;s=s.string(this);n1=n1.number(this);switch(arguments.length){case 2:n2=s.length-n1+1;break;case 3:n2=n2.number(this);break;default:throw Error('Function substring expects (string, string)');break;}
+n1=Math.round(n1);n2=Math.round(n2);a1=n1-1;a2=n1+n2-1;if(a2==Infinity){return s.substring(a1<0?0:a1);}
+else{return s.substring(a1<0?0:a1,a2)}},'string',false,[]],'substring-before':[function(s1,s2){var n;if(arguments.length!=2){throw Error('Function substring-before expects (string, string)');}
+s1=s1.string(this);s2=s2.string(this);n=s1.indexOf(s2);if(n==-1)return '';return s1.substring(0,n);},'string',false,[]],'substring-after':[function(s1,s2){if(arguments.length!=2){throw Error('Function substring-after expects (string, string)');}
+s1=s1.string(this);s2=s2.string(this);var n=s1.indexOf(s2);if(n==-1)return '';return s1.substring(n+s2.length);},'string',false,[]],'string-length':[function(s){switch(arguments.length){case 0:s=wa.to('string',this.node);break;case 1:s=s.string(this);break;default:throw Error('Function string-length expects (string?)');break;}
+return s.length;},'number',false,[true,false]],'normalize-space':[function(s){switch(arguments.length){case 0:s=wa.to('string',this.node);break;case 1:s=s.string(this);break;default:throw Error('Function normalize-space expects (string?)');break;}
+return s.replace(/\s+/g,' ').replace(/^ /,'').replace(/ $/,'');},'string',false,[true,false]],translate:[function(s1,s2,s3){if(arguments.length!=3){throw Error('Function translate expects (string, string, string)');}
+s1=s1.string(this);s2=s2.string(this);s3=s3.string(this);var Le=[];for(var i=0,l=s2.length;i<l;i++){var ch=s2.charAt(i);if(!Le[ch])Le[ch]=s3.charAt(i)||'';}
+for(var t='',i=0,l=s1.length;i<l;i++){var ch=s1.charAt(i);var Me=Le[ch]
+t+=(Me!=ca)?Me:ch;}
+return t;},'string',false,[]],'boolean':[function(b){if(arguments.length!=1){throw Error('Function boolean expects (object)');}
+return b.bool(this)},'boolean',false,[]],not:[function(b){if(arguments.length!=1){throw Error('Function not expects (object)');}
+return!b.bool(this)},'boolean',false,[]],'true':[function(){if(arguments.length!=0){throw Error('Function true expects ()');}
+return true;},'boolean',false,[]],'false':[function(){if(arguments.length!=0){throw Error('Function false expects ()');}
+return false;},'boolean',false,[]],lang:[function(s){return false;},'boolean',false,[]],number:[function(n){switch(arguments.length){case 0:n=wa.to('number',this.node);break;case 1:n=n.number(this);break;default:throw Error('Function number expects (object?)');break;}
+return n;},'number',false,[true,false]],sum:[function(ns){var Ne,n,i,l;if(arguments.length!=1||!(ns=ns.evaluate(this)).isNodeSet){throw Error('Function sum expects (nodeset)');}
+Ne=ns.list();n=0;for(i=0,l=Ne.length;i<l;i++){n+=wa.to('number',Ne[i]);}
+return n;},'number',false,[]],floor:[function(n){if(arguments.length!=1){throw Error('Function floor expects (number)');}
+n=n.number(this);return Math.floor(n);},'number',false,[]],ceiling:[function(n){if(arguments.length!=1){throw Error('Function ceiling expects (number)');}
+n=n.number(this);return Math.ceil(n);},'number',false,[]],round:[function(n){if(arguments.length!=1){throw Error('Function round expects (number)');}
+n=n.number(this);return Math.round(n);},'number',false,[]]};qa.parse=function(Oe){var Pe,func=new qa(Oe.next());Oe.next();while(Oe.peek()!=')'){if(Oe.empty()){throw Error('missing function argument list');}
+Pe=oa.parse(Oe);func.arg(Pe);if(Oe.peek()!=',')break;Oe.next();}
+if(Oe.empty()){throw Error('unclosed function argument list');}
+if(Oe.next()!=')'){Oe.back();throw Error('bad token: '+Oe.next());}
+return func};qa.prototype=new Ma();qa.prototype.evaluate=function(Qe){return this.func.apply(Qe,this.args);};qa.prototype.arg=function(Re){this.args.push(Re);if(Re.needContextPosition){this.needContextPosition=true;}
+var Se=this.args;if(Re.needContextNode){Se.needContexNode=true;}
+this.needContextNode=Se.needContextNode||this.needContextNodeInfo[Se.length];};qa.prototype.show=function(Te){Te=Te||'';var t='';t+=Te+'function: '+this.name+'\n';Te+=' ';if(this.args.length){t+=Te+'arguments: '+'\n';Te+=' ';for(var i=0;i<this.args.length;i++){t+=this.args[i].show(Te);}}
+return t;}; /*@cc_on @if(@_jscript)var Ue=function(Ve,We,Xe,Ye){this.node=Ve;this.nodeType=Ve.nodeType;this.sourceIndex=We;this.subIndex=Xe;this.attributeName=Ye||'';this.order=String.fromCharCode(We)+String.fromCharCode(Xe)+Ye;};Ue.prototype.toString=function(){return this.order;};@else @*/
+var Ze={uuid:1,get:function($e){return $e.__ba||($e.__ba=this.uuid++);}};/*@end @*/
+if(!window.NodeSet&&window.defaultConfig)window.NodeSet=null;ta=function(){this.length=0;this.nodes=[];this.seen={};this.idIndexMap=null;this.reserveDels=[];};ta.prototype.isNodeSet=true;ta.prototype.isSorted=true; /*@_cc_on
+ta.prototype.shortcut=true;@*/ta.prototype.merge=function(af){this.isSorted=false;if(af.only){return this.push(af.only);}
+if(this.only){var bf=this.only;delete this.only;this.push(bf);this.length--;}
+var cf=af.nodes;for(var i=0,l=cf.length;i<l;i++){this._add(cf[i]);}};ta.prototype.sort=function(){if(this.only)return;if(this.sortOff)return;if(!this.isSorted){this.isSorted=true;this.idIndexMap=null; /*@cc_on
+if(this.shortcut){this.nodes.sort();}
+else{this.nodes.sort(function(a,b){var df;df=a.sourceIndex-b.sourceIndex;if(df==0)return a.subIndex-a.subIndex;else return df;});}
+return;@*/var ef=this.nodes;ef.sort(function(a,b){if(a==b)return 0;if(a.compareDocumentPosition){var ff=a.compareDocumentPosition(b);if(ff&2)return 1;if(ff&4)return -1;return 0;}
+else{var gf=a,node2=b,ancestor1=a,ancestor2=b,deep1=0,deep2=0;while(ancestor1=ancestor1.parentNode)deep1++;while(ancestor2=ancestor2.parentNode)deep2++;if(deep1>deep2){while(deep1--!=deep2)gf=gf.parentNode;if(gf==node2)return 1;}
+else if(deep2>deep1){while(deep2--!=deep1)node2=node2.parentNode;if(gf==node2)return -1;}
+while((ancestor1=gf.parentNode)!=(ancestor2=node2.parentNode)){gf=ancestor1;node2=ancestor2;}
+while(gf=gf.nextSibling)if(gf==node2)return -1;return 1;}});}}; /*@cc_on @if(@_jscript)ta.prototype.sourceOffset=1;ta.prototype.subOffset=2;ta.prototype.createWrapper=function(hf){var jf,child,attributes,attributesLength,sourceIndex,subIndex,attributeName;sourceIndex=hf.sourceIndex;if(typeof sourceIndex!='number'){type=hf.nodeType;switch(type){case 2:jf=hf.parentNode;sourceIndex=hf.parentSourceIndex;subIndex=-1;attributeName=hf.nodeName;break;case 9:subIndex=-2;sourceIndex=-1;break;default:child=hf;subIndex=0;do{subIndex++;sourceIndex=child.sourceIndex;if(sourceIndex){jf=child;child=child.lastChild;if(!child){child=jf;break;}
+subIndex++;}}
+while(child=child.previousSibling);if(!sourceIndex){sourceIndex=hf.parentNode.sourceIndex;}
+break;}}
+else{subIndex=-2;}
+sourceIndex+=this.sourceOffset;subIndex+=this.subOffset;return new Ue(hf,sourceIndex,subIndex,attributeName);};ta.prototype.reserveDelBySourceIndexAndSubIndex=function(kf,lf,mf,nf){var of=this.createIdIndexMap();var pf;if((of=of[kf])&&(pf=of[lf])){if(nf&&(this.length-mf-1)>pf||!nf&&mf<pf){var qf={value:pf,order:String.fromCharCode(pf),toString:function(){return this.order},valueOf:function(){return this.value}};this.reserveDels.push(qf);}}};@else @*/
+ta.prototype.reserveDelByNodeID=function(id,rf,sf){var tf=this.createIdIndexMap();var uf;if(uf=tf[id]){if(sf&&(this.length-rf-1)>uf||!sf&&rf<uf){var vf={value:uf,order:String.fromCharCode(uf),toString:function(){return this.order},valueOf:function(){return this.value}};this.reserveDels.push(vf);}}};/*@end @*/
+ta.prototype.reserveDelByNode=function(wf,xf,yf){ /*@cc_on @if(@_jscript)wf=this.createWrapper(wf);this.reserveDelBySourceIndexAndSubIndex(wf.sourceIndex,wf.subIndex,xf,yf);@else @*/
+this.reserveDelByNodeID(Ze.get(wf),xf,yf);/*@end @*/ };ta.prototype.doDel=function(){if(!this.reserveDels.length)return;if(this.length<0x10000){var zf=this.reserveDels.sort(function(a,b){return b-a});}
+else{var zf=this.reserveDels.sort(function(a,b){return b-a});}
+for(var i=0,l=zf.length;i<l;i++){this.del(zf[i]);}
+this.reserveDels=[];this.idIndexMap=null;};ta.prototype.createIdIndexMap=function(){if(this.idIndexMap){return this.idIndexMap;}
+else{var Af=this.idIndexMap={};var Bf=this.nodes;for(var i=0,l=Bf.length;i<l;i++){var Cf=Bf[i]; /*@cc_on @if(@_jscript)var Df=Cf.sourceIndex;var Ef=Cf.subIndex;if(!Af[Df])Af[Df]={};Af[Df][Ef]=i;@else @*/
+var id=Ze.get(Cf);Af[id]=i;/*@end @*/ }
+return Af;}};ta.prototype.del=function(Ff){this.length--;if(this.only){delete this.only;}
+else{var Gf=this.nodes.splice(Ff,1)[0];if(this._first==Gf){delete this._first;delete this._firstSourceIndex;delete this._firstSubIndex;} /*@cc_on @if(@_jscript)delete this.seen[Gf.sourceIndex][Gf.subIndex];@else @*/
+delete this.seen[Ze.get(Gf)];/*@end @*/ }};ta.prototype.delDescendant=function(Hf,If){if(this.only)return;var Jf=Hf.nodeType;if(Jf!=1&&Jf!=9)return;if(Da.applewebkit2)return;if(!Hf.contains){if(Jf==1){var Kf=Hf;Hf={contains:function(Lf){return Lf.compareDocumentPosition(Kf)&8;}};}
+else{Hf={contains:function(){return true;}};}}
+var Mf=this.nodes;for(var i=If+1;i<Mf.length;i++){ /*@cc_on @if(@_jscript)if(Mf[i].node.nodeType==1&&Hf.contains(Mf[i].node)){@else @*/
+if(Hf.contains(Mf[i])){/*@end @*/
+this.del(i);i--;}}};ta.prototype._add=function(Nf,Of){ /*@cc_on @if(@_jscript)var Pf,firstSourceIndex,firstSubIndex,sourceIndex,subIndex,attributeName;sourceIndex=Nf.sourceIndex;subIndex=Nf.subIndex;attributeName=Nf.attributeName;seen=this.seen;seen=seen[sourceIndex]||(seen[sourceIndex]={});if(Nf.nodeType==2){seen=seen[subIndex]||(seen[subIndex]={});if(seen[attributeName]){return true;}
+seen[attributeName]=true;}
+else{if(seen[subIndex]){return true;}
+seen[subIndex]=true;}
+if(sourceIndex>=0x10000||subIndex>=0x10000){this.shortcut=false;}
+if(this._first||this.nodes.length==0){Pf=this._first;firstSourceIndex=this._firstSourceIndex;firstSubIndex=this._firstSubIndex;if(!Pf||firstSourceIndex>sourceIndex||(firstSourceIndex==sourceIndex&&firstSubIndex>subIndex)){this._first=Nf;this._firstSourceIndex=sourceIndex;this._firstSubIndex=subIndex}}@else @*/
+var Qf=this.seen;var id=Ze.get(Nf);if(Qf[id])return true;Qf[id]=true;/*@end @*/
+this.length++;if(Of)this.nodes.unshift(Nf);else this.nodes.push(Nf);};ta.prototype.unshift=function(Rf){if(!this.length){this.length++;this.only=Rf;return}
+if(this.only){var Sf=this.only;delete this.only;this.unshift(Sf);this.length--;} /*@cc_on
+Rf=this.createWrapper(Rf);@*/return this._add(Rf,true);};ta.prototype.push=function(Tf){if(!this.length){this.length++;this.only=Tf;return;}
+if(this.only){var Uf=this.only;delete this.only;this.push(Uf);this.length--;} /*@cc_on
+Tf=this.createWrapper(Tf);@*/return this._add(Tf);};ta.prototype.first=function(){if(this.only)return this.only; /*@cc_on
+if(this._first)return this._first.node;if(this.nodes.length>1)this.sort();var Vf=this.nodes[0];return Vf?Vf.node:ca;@*/if(this.nodes.length>1)this.sort();return this.nodes[0];};ta.prototype.list=function(){if(this.only)return[this.only];this.sort(); /*@cc_on
+var i,l,Mf,results;Mf=this.nodes;results=[];for(i=0,l=Mf.length;i<l;i++){results.push(Mf[i].node);}
+return results;@*/return this.nodes;};ta.prototype.string=function(){var Wf=this.only||this.first();return Wf?wa.to('string',Wf):'';};ta.prototype.bool=function(){return!!(this.length||this.only);};ta.prototype.number=function(){return+this.string();};ta.prototype.iterator=function(Xf){this.sort();var Yf=this;if(!Xf){var Zf=0;return function(){if(Yf.only&&Zf++==0)return Yf.only; /*@cc_on @if(@_jscript)var $f=Yf.nodes[Zf++];if($f)return $f.node;return ca;@else @*/
+return Yf.nodes[Zf++];/*@end @*/ };}
+else{var Zf=0;return function(){var ag=Yf.length-(Zf++)-1;if(Yf.only&&ag==0)return Yf.only; /*@cc_on @if(@_jscript)var bg=Yf.nodes[ag];if(bg)return bg.node;return ca;@else @*/
+return Yf.nodes[ag];/*@end @*/ };}};var cg=function(dg){dg=dg||this;var eg=dg.document;var ca=dg.undefined;dg.XPathExpression=function(fg){if(!fg.length){throw dg.Error('no expression');}
+var gg=this.lexer=Ea(fg);if(gg.empty()){throw dg.Error('no expression');}
+this.expr=oa.parse(gg);if(!gg.empty()){throw dg.Error('bad token: '+gg.next());}};dg.XPathExpression.prototype.evaluate=function(hg,ig){return new dg.XPathResult(this.expr.evaluate(new Ia(hg)),ig);};dg.XPathResult=function(jg,kg){if(kg==0){switch(typeof jg){case 'object':kg++;case 'boolean':kg++;case 'string':kg++;case 'number':kg++;}}
+this.resultType=kg;switch(kg){case 1:this.numberValue=jg.isNodeSet?jg.number():+jg;return;case 2:this.stringValue=jg.isNodeSet?jg.string():''+jg;return;case 3:this.booleanValue=jg.isNodeSet?jg.bool():!!jg;return;case 4:case 5:case 6:case 7:this.nodes=jg.list();this.snapshotLength=jg.length;this.index=0;this.invalidIteratorState=false;break;case 8:case 9:this.singleNodeValue=jg.first();return;}};dg.XPathResult.prototype.iterateNext=function(){return this.nodes[this.index++]};dg.XPathResult.prototype.snapshotItem=function(i){return this.nodes[i]};dg.XPathResult.ANY_TYPE=0;dg.XPathResult.NUMBER_TYPE=1;dg.XPathResult.STRING_TYPE=2;dg.XPathResult.BOOLEAN_TYPE=3;dg.XPathResult.UNORDERED_NODE_ITERATOR_TYPE=4;dg.XPathResult.ORDERED_NODE_ITERATOR_TYPE=5;dg.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE=6;dg.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE=7;dg.XPathResult.ANY_UNORDERED_NODE_TYPE=8;dg.XPathResult.FIRST_ORDERED_NODE_TYPE=9;eg.createExpression=function(lg){return new dg.XPathExpression(lg,null);};eg.evaluate=function(mg,ng,_,og){return eg.createExpression(mg,null).evaluate(ng,og);};};var pg;if(ea.targetFrame){var qg=document.getElementById(ea.targetFrame);if(qg)pg=qg.contentWindow;}
+if(ea.exportInstaller){window.install=cg;}
+if(!ea.hasNative||!ea.useNative){cg(pg||window);}})();
11 app-template/src/leiningen/new/pedestal_app/annotated/app/assets/stylesheets/project.css
@@ -0,0 +1,11 @@
+/* CSS for {{name}} */
+
+#content {
+ margin-top: 30px;
+}
+
+.message {
+ font-size: 60px;
+ font-weight: bold;
+ margin-top: 50px;
+}
87 app-template/src/leiningen/new/pedestal_app/annotated/app/src/behavior.clj
@@ -0,0 +1,87 @@
+(ns ^:shared {{name}}.behavior
+ (:require [clojure.string :as string]))
+
+;; While creating new behavior, write tests to confirm that it is
+;; correct. For examples of various kinds of tests, see
+;; test/{{sanitized}}/test/behavior.clj.
+
+(defn example-model [model-state event]
+ (:value event))
+
+(def example-app
+ {:models {:example-model {:init "Hello World!" :fn example-model}}})
+
+
+;; Once this behavior works, run the Data UI and record
+;; rendering data which can be used while working on a custom
+;; renderer. Rendering involves making a template:
+;;
+;; app/templates/{{name}}.html
+;;
+;; slicing the template into pieces you can use:
+;;
+;; app/src/{{sanitized}}/html_templates.cljs
+;;
+;; and then writing the rendering code:
+;;
+;; app/src/{{sanitized}}/rendering.cljs
+
+
+(comment
+
+ ;; The examples below show the signature of each type of function
+ ;; that is used to build a behavior dataflow.
+
+ ;; model
+
+ (defn example-model [model-state event]
+ ;; returns new state
+ )
+
+ ;; output
+
+ (defn example-output [event old-model-state new-model-state]
+ ;; returns vector of messages or map of {:events [] :messages []}
+ )
+
+ ;; view
+
+ (defn example-view-1 [view-state input-name old-model-state new-model-state]
+ ;; returns new view state
+ )
+
+ (defn example-view-2 [view-state inputs]
+ ;; inputs are a map of input names to their old and new state
+ ;; returns new view state
+ )
+
+ ;; events
+
+ (defn example-events [view-name old-view-state new-view-state]
+ ;; returns vector of messages
+ )
+
+ ;; emitter
+
+ (defn example-emitter
+ ([input]
+ ;; input is a map of input names to their old and new state
+ ;; called when emitter is first displayed - returns rendering data
+ )
+ ([input changed-input]
+ ;; input is a map of input names to their old and new state
+ ;; changed-input is a set of the input names which have changed
+ ;; called when inputs are updated - returns rendering data
+ ))
+
+ ;; example dataflow map
+
+ {:models {:example-model {:init "" :fn example-model}}
+ :output {:example-model example-output}
+ :views {:example-view {:fn example-view-1 :input #{:example-model}}}
+ :events {:examle-view example-event}
+ :emitters {:example-emitter {:fn example-emitter :input #{:example-view}}}
+ :navigation {:home [[:a-path]]
+ :default :home}}
+
+ )
19 app-template/src/leiningen/new/pedestal_app/annotated/app/src/html_templates.clj
@@ -0,0 +1,19 @@
+(ns {{name}}.html-templates
+ (:use [io.pedestal.app.templates :only [tfn dtfn tnodes]]))
+
+(defmacro {{name}}-templates
+ []
+ ;; Extract the 'hello' template from the template file {{name}}.html.
+ ;; The 'dtfn' function will create a dynamic template which can be
+ ;; updated after it has been attached to the DOM.
+ ;;
+ ;; To see how this template is used, refer to
+ ;;
+ ;; app/src/{{sanitized}}/rendering.cljs
+ ;;
+ ;; The last argument to 'dtfn' is a set of fields that should be
+ ;; treated as static fields (may only be set once). Dynamic templates
+ ;; use ids to set values so you cannot dynamically set an id.
+ {:{{name}}-page (dtfn (tnodes "{{name}}.html" "hello") #{:id})})
+
+;; Note: this file will not be reloaded automatically when it is changed.
75 app-template/src/leiningen/new/pedestal_app/annotated/app/src/rendering.cljs
@@ -0,0 +1,75 @@
+(ns {{name}}.rendering
+ (:require [domina :as dom]
+ [io.pedestal.app.render.push :as render]
+ [io.pedestal.app.render.push.templates :as templates]
+ [io.pedestal.app.render.push.handlers.automatic :as d])
+ (:require-macros [{{name}}.html-templates :as html-templates]))
+
+;; Load templates.
+
+(def templates (html-templates/{{name}}-templates))
+
+;; The way rendering is handled below is the result of using the
+;; renderer provided in `io.pedestal.app.render`. The only requirement
+;; for a renderer is that it must implement the Renderer protocol.
+;;
+;; This renderer dispatches to rendering functions based on the
+;; requested change. See the render-config table below. Each render
+;; function takes three arguments: renderer, render operation and a
+;; a transmitter which is used to send data back to the application's
+;; behavior. This example does not use the transmitter.
+
+(defn render-page [renderer [_ path] transmitter]
+ (let [;; The renderer that we are using here helps us map changes to
+ ;; the UI tree to the DOM. It keeps a mapping of paths to DOM
+ ;; ids. The `get-parent-id` function will return the DOM id of
+ ;; the parent of the node at path. If the path is [:a :b :c]
+ ;; then this will find the id associated with [:a :b]. The
+ ;; root node [] is configured when we created the renderer.
+ parent (render/get-parent-id renderer path)
+ ;; Use the `new-id!` function to associate a new id to the
+ ;; given path. With two arguments, this function will generate
+ ;; a random unique id. With three arguemnts, the given id will
+ ;; be associated with the given path.
+ id (render/new-id! renderer path)
+ ;; Get the dynamic template named :{{name}}-page
+ ;; from the templates map. The `add-template` function will
+ ;; associate this template with the node at
+ ;; path. `add-template` returns a function that can be called
+ ;; to generate the initial HTML.
+ html (templates/add-template renderer path (:{{name}}-page templates))]
+ ;; Call the `html` function, passing the initial values for the
+ ;; template. This returns an HTML string which is then added to
+ ;; the DOM using Domina.
+ (dom/append! (dom/by-id parent) (html {:id id :message ""}))))
+
+(defn render-message [renderer [_ path _ new-value] transmitter]
+ ;; This function responds to a :value event. It uses the
+ ;; `update-t` function to update the template at `path` with the new
+ ;; values in the passed map.
+ (templates/update-t renderer path {:message new-value}))
+
+;; The data structure below is used to map rendering data to functions
+;; which handle rendering for that specific change. This function is
+;; referenced in config/config.clj and must be a function in order to
+;; be used from the tool's "render" view.
+
+(defn render-config []
+ [;; All :node-create deltas for the node at
+ ;; :io.pedestal.app/view-example-model will be rendered by the
+ ;; `render-page` function. The node name
+ ;; :io.pedestal.app/view-example-model is a default name that is used
+ ;; when we don't provide our own views and emitters. To name your
+ ;; own nodes, create a custom view or emitter in the application's
+ ;; behavior.
+ [:node-create [:io.pedestal.app/view-example-model] render-page]
+ ;; All :node-destroy deltas for this path will be handled by the
+ ;; library function `d/default-exit`.
+ [:node-destroy [:io.pedestal.app/view-example-model] d/default-exit]
+ ;; All :node-create deltas for this path will be handled by the
+ ;; function `render-message`.
+ [:value [:io.pedestal.app/view-example-model] render-message]])
+
+;; In render-config, paths can use wildcard keywords :* and :**. :*
+;; means exatcly one segment with any value. :** means 0 or more
+;; elements.
36 app-template/src/leiningen/new/pedestal_app/annotated/app/src/services.cljs
@@ -0,0 +1,36 @@
+(ns {{name}}.services)
+
+;; The services namespace responsible for communicating with back-end
+;; services. It receives messages from the application's behavior,
+;; makes requests to services and sends responses back to the
+;; behavior.
+;;
+;; This namespace will usually contain a function which can be
+;; configured to receive output events from the bahavior in the file
+;;
+;; app/src/{{sanitized}}/start.cljs
+;;
+;; After creating a new application, set the output handler function
+;; to recieve output
+;;
+;; (app/consume-output app services-fn)
+;;
+;; A very simple example of a services function which echos all events
+;; back to the behavior is shown below
+
+(comment
+
+ ;; The services implementation will need some way to send messages
+ ;; back to the application. The queue passed to services function
+ ;; will convey messages to the application.
+ (defn echo-services-fn [message queue]
+ (put-message queue message))
+
+ )
+
+;; During development, it is helpful to implement services which
+;; simulate communication with the real services. This implementaiton
+;; can be placed in the file
+;;
+;; app/src/{{sanitized}}/simulated/services.cljs
+;;
3 app-template/src/leiningen/new/pedestal_app/annotated/app/src/simulated/services.cljs
@@ -0,0 +1,3 @@
+(ns {{name}}.simulated.services)
+
+;; Implement services to simulate talking to back-end services
14 app-template/src/leiningen/new/pedestal_app/annotated/app/src/simulated/start.cljs
@@ -0,0 +1,14 @@
+(ns {{name}}.simulated.start
+ (:require [io.pedestal.app.render.push.handlers.automatic :as d]
+ [{{name}}.start :as start]
+ ;; This needs to be included somewhere in order for the
+ ;; tools to work.
+ [io.pedestal.app-tools.tooling :as tooling]))
+
+(defn ^:export main []
+ ;; Create an application which uses the data renderer. The :data-ui
+ ;; aspect is configured to run this main function. See
+ ;;
+ ;; config/config.clj
+ ;;
+ (start/create-app d/data-renderer-config))
51 app-template/src/leiningen/new/pedestal_app/annotated/app/src/start.cljs
@@ -0,0 +1,51 @@
+(ns {{name}}.start
+ (:require [io.pedestal.app.protocols :as p]
+ [io.pedestal.app :as app]
+ [io.pedestal.app.render.push :as push-render]
+ [io.pedestal.app.render :as render]
+ [{{name}}.behavior :as behavior]
+ [{{name}}.rendering :as rendering]))
+
+;; In this namespace, the application is built and started.
+
+(defn create-app [render-config]
+ (let [;; Build the application described in the map
+ ;; 'behavior/example-app'. The application is a record which
+ ;; implements the Receiver protocol.
+ app (app/build behavior/example-app)
+ ;; Create the render function that will be used by this
+ ;; application. A renderer function takes two arguments: the
+ ;; application model deltas and the input queue.
+ ;;
+ ;; On the line below, we create a renderer that will help in
+ ;; mapping UI data to the DOM.
+ ;;
+ ;; The file, app/src/{{sanitized}}/rendering.cljs contains
+ ;; the code which does all of the rendering as well as the
+ ;; render-config which is used to map renderering data to
+ ;; specific functions.
+ render-fn (push-render/renderer "content" render-config)
+ ;; This application does not yet have services, but if it did,
+ ;; this would be a good place to create it.
+ ;; services-fn (fn [message input-queue] ...)
+
+ ;; Configure the application to send all rendering data to this
+ ;; renderer.
+ app-model (render/consume-app-model app render-fn)]
+ ;; If services existed, configure the application to send all
+ ;; output there.
+ ;; (app/consume-output app services-fn)
+ ;;
+ ;; Start the application
+ (app/begin app)
+ ;; Returning the app and app-model from the main function allows
+ ;; the tooling to add support for useful features like logging
+ ;; and recording.
+ {:app app :app-model app-model}))
+
+(defn ^:export main []
+ ;; config/config.clj refers to this namespace as a main namespace
+ ;; for several aspects. A main namespace must have a no argument
+ ;; main function. To tie into tooling, this function should return
+ ;; the newly created app.
+ (create-app (rendering/render-config)))
46 app-template/src/leiningen/new/pedestal_app/annotated/app/templates/application.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>{{name}}</title>
+
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Le styles -->
+ <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon">
+ <link href="/stylesheets/bootstrap.css" rel="stylesheet">
+ <link href="/stylesheets/pedestal.css" rel="stylesheet">
+ <link href="/{{name}}.css" rel="stylesheet">
+
+ <!-- Add xpath support to IE. Domina needs this -->
+ <!--[if IE]>
+ <script type="text/javascript" src="js/xpath.js"></script>
+ <![endif]-->
+
+ </head>
+
+ <body>
+
+ <div class="container">
+
+ <div id="content"></div>
+
+ <div id="options"></div>
+
+ <footer></footer>
+
+ </div> <!-- /container -->
+
+ <!-- Add External JavaScript libraries -->
+ <script src="/javascripts/jquery-min.js" type="text/javascript"></script>
+ <script src="/javascripts/bootstrap.js" type="text/javascript"></script>
+ <script src="/javascripts/pedestal/js/api.js" type="text/javascript"></script>
+
+ <script id="script-driver"></script>
+
+ </body>
+</html>
47 app-template/src/leiningen/new/pedestal_app/annotated/app/templates/project.html
@@ -0,0 +1,47 @@
+<!--
+ The Pedestal application development tools provide a very simple
+ system for composing documents. This partial will be included
+ "within" the application.html file. The div with id "content" in that
+ file will be replaced with the div with id "content" in this file.
+
+ This feature is only part of the tool. It has nothing to do with the
+ ClojureScript application that you are building.
+-->
+<_within file="application.html">
+
+ <div id="content">
+
+ <!--
+ In the markup below, a template named "hello" is
+ defined. This template has two fields: id and message.
+
+ In the file
+
+ app/src/{{sanitized}}/html_templates.clj
+
+ this template can be extracted by calling
+
+ (def template-fn (tfn (tnodes "{{name}}.html" "hello")))
+
+ template-fn is a function which, when called with a map of
+ values, will return a string of HTML with filled-in values.
+
+ (template-fn {:id 42 :message "Hello"})
+
+ The field attribute takes a comma delimited list of
+
+ html-element-attribute-name:map-key
+
+ content is a special case which means that the content
+ (innerHTML) of the element will be set to this value.
+ -->
+
+ <div template="hello" field="id:id">
+
+ <div field="content:message" class="message">A Message</div>
+
+ </div>
+
+ </div>
+
+</_within>
97 app-template/src/leiningen/new/pedestal_app/annotated/config/config.clj
@@ -0,0 +1,97 @@
+(ns config
+ (:require [net.cgrand.enlive-html :as html]
+ [io.pedestal.app-tools.compile :as compile]))
+
+;; The configuration below determines how an applicaiton is built,
+;; what is built and what features are available in the application
+;; development tool.
+
+(def configs
+ ;; One project can host multiple applications. The top-level of the
+ ;; config map contains one entry for each appliction.
+ {:{{name}}
+ {;; :build contains parameters which are passed to the build
+ :build {;; :watch-files contains a list of files to watch for
+ ;; changes. Each file had a tag associated with it, in
+ ;; this case :html.
+ :watch-files (compile/html-files-in "app/templates")
+ ;; When an HTML file changes, trigger the compilation of
+ ;; any files which use macros to read in templates. This
+ ;; will force recompilation of these files and update
+ ;; the templates.
+ :triggers {:html [#"{{sanitized}}/rendering.js"]}}
+ ;; General application level configuration
+ :application {;; The directory where all generated JavaScript for
+ ;; this application will be written.
+ :generated-javascript "generated-js"
+ ;; The default template to use when creating host
+ ;; pages for each aspect below. Override this in an
+ ;; aspect by adding a :template key.
+ :default-template "application.html"
+ ;; The root directory in which to put build
+ ;; output. Possible values are :public and
+ ;; :tools-public. Override this value in an aspect
+ ;; with :tools-output. :public maps to out/public
+ ;; and and :tools-public maps to tools/out/public.
+ :output-root :public}
+ ;; Add arbitrary links to the control panel
+ :control-panel {:design {:uri "/design.html"
+ :name "Design"
+ ;; The order that this item will appear
+ ;; in the context menu.
+ :order 0}}
+ ;; Enable built-in features of the application development
+ ;; tool. In the example below we enable the rendering view.
+ :built-in {:render {;; The directory where rendering scripts will
+ ;; are stored
+ :dir "{{name}}"
+ ;; The namespace which contains the renderer
+ ;; to use. This namespace must have a
+ ;; `render-config` function which returns a
+ ;; render configuration.
+ :renderer '{{sanitized}}.rendering
+ ;; Enable logging of rendering data when in
+ ;; this view.
+ :logging? true
+ :order 2}}
+ ;; Each aspect provides a unique way to view and interact with
+ ;; this application.
+ :aspects {;; Add an aspect that uses the data renderer
+ :data-ui {;; Provide the name of the host page that will
+ ;; be generated to host this application. This
+ ;; page will be generated from the template
+ ;; application.html
+ :uri "/{{name}}-data-ui.html"
+ ;; Provide the name that will appear in the
+ ;; control panel for this aspect.
+ :name "Data UI"
+ :order 1
+ :out-file "{{name}}-data-ui.js"
+ ;; The namespace which contains the `main`
+ ;; function to call to start the application.
+ :main '{{sanitized}}.simulated.start
+ ;; Allow render data recording. Use
+ ;; Alt-Shift-R to start and stop recording.
+ :recording? true
+ ;; Turn on logging
+ :logging? true
+ ;; build output goes to tools/out/public
+ :output-root :tools-public}
+ :development {:uri "/{{name}}-dev.html"
+ :name "Development"
+ :out-file "{{name}}-dev.js"
+ :main '{{sanitized}}.start
+ :logging? true
+ :order 3}
+ :fresh {:uri "/fresh.html"
+ :name "Fresh"
+ :out-file "fresh.js"
+ :main 'io.pedestal.app.net.repl_client
+ :order 4
+ :output-root :tools-public}
+ :production {:uri "/{{name}}.html"
+ :name "Production"
+ :optimizations :advanced
+ :out-file "{{name}}.js"
+ :main '{{sanitized}}.start
+ :order 5}}}})
50 app-template/src/leiningen/new/pedestal_app/annotated/config/logback.xml
@@ -0,0 +1,50 @@
+<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
+<configuration>
+
+ <!-- Simple file output -->
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <!-- rollover daily -->
+ <fileNamePattern>logs/{{name}}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <timeBasedFileNamingAndTriggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ <!-- or whenever the file size reaches 64 MB -->
+ <maxFileSize>64 MB</maxFileSize>
+ </timeBasedFileNamingAndTriggeringPolicy>
+ </rollingPolicy>
+
+ <!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
+ <prudent>true</prudent>
+ </appender>
+
+
+ <!-- Console output -->
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
+ <encoder>
+ <pattern>%-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ <!-- Only log level INFO and above -->
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>WARN</level>
+ </filter>
+ </appender>
+
+
+ <!-- Enable FILE and STDOUT appenders for all log messages.
+ By default, only log at level INFO and above. -->
+ <root level="INFO">
+ <appender-ref ref="FILE" />
+ <appender-ref ref="STDOUT" />
+ </root>
+
+
+ <!-- For loggers in the ".*" namespace, log at all levels. -->
+ <logger name="{{sanitized}}" level="INFO" />
+
+</configuration>
116 app-template/src/leiningen/new/pedestal_app/annotated/config/user.clj
@@ -0,0 +1,116 @@
+(ns user
+ (:use [cljs.repl :only [repl]]
+ [cljs.repl.browser :only [repl-env]])
+ (:require [io.pedestal.app-tools.server :as server]
+ [io.pedestal.app-tools.build :as build]
+ [io.pedestal.app-tools.compile.repl :as repl]
+ [config :as config]
+ [clojure.java.io :as io]))
+
+(defonce ^:private app-development-server nil)
+(defonce ^:private watcher nil)
+
+(defn cljs-repl
+ "Start a ClojureScript REPL. If the application development server
+ is running, go to the 'fresh' view to connect to this REPL. To use
+ this REPL from any part of an applicaiton, start the repl client
+ manually.
+
+ The namespace 'io.pedestal.app.net.repl-client' contains a 'repl'
+ function for starting the REPL client. Call this function from an
+ application or call it from the JavaScript console
+
+ io.pedestal.app.net.repl_client.repl();
+
+ to start the client."
+ []
+ (repl (repl-env)))
+
+(defn start
+ "Start the current application development server."
+ []
+ ((:start-fn app-development-server))
+ :ok)
+
+(defn stop
+ "Stop the current application development server."
+ []
+ ((:stop-fn app-development-server)))
+
+(defn init
+ "Create a new app development server and ensure that required
+ directories exist."
+ [port config-name]
+ (.mkdirs (io/file build/*tools-public*))
+ (.mkdirs (io/file build/*public*))
+ (assert (contains? config/configs config-name)
+ (str "Valid config names are " (pr-str (keys config/configs)) "."))
+ (alter-var-root #'app-development-server (constantly
+ (server/app-development-server
+ port (get config/configs config-name)))))
+
+(defn run
+ "Initialize and start an application development web server. The
+ server will serve one application at a time. The default port is
+ 3000. The default application is :{{name}}."
+ ([]
+ (run 3000 :{{name}}))
+ ([port config-name]
+ (init port config-name)
+ (start)))
+
+(def ^{:doc "Compile JavaScript for this project. Pass an applicaiton name to compile
+ all aspects of an application."}
+ compile-cljs (repl/project-compiler config/configs))
+
+(def ^{:doc "Delete generated JavaScript. Pass an application name to clean a
+ specific application. Application names must be keywrods."}
+ clean-cljs
+ (build/cleaner build/*public* config/configs))
+
+(defn watch
+ "Incrementally build this project when files change. This will only
+ build a single aspect at a time, where an aspect is something
+ like :development or :production. Aspect names are configured in
+ config/config.clj.
+
+ If this project contains more than one application, the default is
+ to build all of them. Pass a vector of config names as the first
+ argument to watch a specific group of applications.
+
+ Output of the build goes to out/public. This function is useful when
+ serving out/public from another server (for example the service
+ server) where on-demand build is not available."
+ ([aspect]
+ (watch (vec (keys config/configs)) aspect))
+ ([config-names aspect]
+ (assert (vector? config-names) "config-names must be a vector")
+ (println "watching" config-names "/" aspect)
+ (let [w (build/watcher (vals (select-keys config/configs config-names)) aspect)]
+ ((:start-fn w))
+ (alter-var-root #'watcher (constantly w))
+ :ok)))
+
+(defn unwatch
+ "Stop the currently running watcher."
+ []
+ (if watcher
+ (do ((:stop-fn watcher))
+ (alter-var-root #'watcher (constantly nil))
+ :ok)
+ (println "Oops! No watcher is running.")))
+
+(defn tools-help
+ "Show basic help for each function in this namespace."
+ []
+ (println)
+ (println "Start a new app development server with (run) or (run port config)")
+ (println "Type (cljs-repl) to start a ClojureScript REPL")
+ (println "----")
+ (println "Type (init port) or (init port config) to create a app development server")
+ (println "Type (start) to start the current server")
+ (println "Type (stop) to stop the current server")
+ (println "----")
+ (println "Type (watch aspect) to build a specific aspect when it changes")
+ (println "Type (unwatch) to stop the current watcher")
+ (println))
10 app-template/src/leiningen/new/pedestal_app/annotated/project.clj
@@ -0,0 +1,10 @@
+(defproject {{name}} "0.0.1-SNAPSHOT"
+ :description "FIXME: write description"
+ :dependencies [[org.clojure/clojure "1.5.0"]
+ [org.clojure/clojurescript "0.0-1586"]
+ [domina "1.0.1"]
+ [ch.qos.logback/logback-classic "1.0.6"]
+ [io.pedestal/pedestal.app "0.0.9-SNAPSHOT"]
+ [io.pedestal/pedestal.app-tools "0.0.9-SNAPSHOT"]]
+ :profiles {:dev {:source-paths ["config" "app/src" "app/templates"]}}
+ :aliases {"dumbrepl" ["trampoline" "run" "-m" "clojure.main/main"]})
39 app-template/src/leiningen/new/pedestal_app/annotated/test/behavior.clj
@@ -0,0 +1,39 @@
+(ns {{name}}.test.behavior
+ (:require [io.pedestal.app :as app]
+ [io.pedestal.app.protocols :as p]
+ [io.pedestal.app.tree :as tree]
+ [io.pedestal.app.messages :as msg]
+ [io.pedestal.app.render :as render]
+ [io.pedestal.app.util.test :as test])
+ (:use clojure.test
+ {{name}}.behavior
+ [io.pedestal.app.query :only [q]]))
+
+;; Test a model function
+
+(deftest test-example-model
+ (is (= (example-model {} {:value "x"})
+ "x")))
+
+;; Build an application, send a message to a model and check the model
+;; state
+
+(deftest test-app-state
+ (let [app (app/build example-app)]
+ (app/begin app)
+ (is (true? (test/run-sync! app [{msg/topic :example-model :value "x"}])))
+ (is (= (-> app :state deref :models :example-model) "x"))))
+
+;; Use io.pedestal.app.query to query the current application model
+
+(deftest test-query-ui
+ (let [app (app/build example-app)
+ app-model (render/consume-app-model app (constantly nil))]
+ (app/begin app)
+ (is (test/run-sync! app [{msg/topic :example-model :value "x"}]))
+ (is (= (q '[:find ?v
+ :where
+ [?n :t/path [:io.pedestal.app/view-example-model]]
+ [?n :t/value ?v]]
+ @app-model)
+ [["x"]]))))
26 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/404.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The page you were looking for doesn't exist (404)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <h1>The page you were looking for doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+</body>
+</html>
16 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/design.html
@@ -0,0 +1,16 @@
+<_within file="application.html">
+
+<div id="content" style="width:960px;margin: 0 auto;">
+ <div class="page-header">
+ <h1>Design! <small>User interface templates</small></h1>
+ </div>
+ <div class="section panel">
+ <h2>{{name}}</h2>
+ <ul>
+ <li><a href="/design/{{name}}.html">{{name}} Page</a></li>
+ </ul>
+
+ </div>
+</div>
+
+</_within>
BIN app-template/src/leiningen/new/pedestal_app/annotated/tools/public/favicon.ico
Binary file not shown.
63 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/index.html
@@ -0,0 +1,63 @@
+<_within file="application.html">
+
+<div id="content">
+ <div class="hero-unit">
+ <h1>{{name}}</h1>
+ <p>
+ Congratulations! You have created and run a new Pedestal
+ application.
+ </p>
+ <p class="small">
+ Hover over the lower right corner of each page to activate the
+ control panel. In each view, update source files and then reload
+ the page to build and see changes. The items that appear in the
+ control panel can be configured in <code>config/config.clj</code>.
+ </p>
+
+ <p class="small" style="font-weight:bold">
+ Start working on your application by writing its behavior in the
+ file <code>app/src/{{sanitized}}/behavior.clj</code>.
+ </p>
+
+ <h4>Design</h4>
+ <small>
+ View template files located
+ in <code>app/templates</code>. Update the design page by editing
+ the file <code>tools/public/design.html</code>.
+ </small>
+ <h4>Data UI</h4>
+ <small>
+ After creating application behavior, run the application in the
+ browser using the data renderer. The data renderer is setup in
+ the file <code>app/src/{{sanitized}}/simulated/start.clj</code>.
+ </small>
+ <h4>Render</h4>
+ <small>
+ The data renderer allows you to record the data which is sent to
+ a renderer. The Render view allows you to play back these
+ recordings. Configure the renderer to use
+ in <code>config/config.clj</code>.
+ </small>
+ <h4>Development</h4>
+ <small>
+ The development view allows you do run your application with a
+ real renderer and feeder. This application is created in
+ <code>app/src/{{sanitized}}/start.clj</code>. The application
+ will be compiled in development mode for easier debugging.
+ </small>
+ <h4>Fresh</h4>
+ <small>
+ Load a page with a ClojureScript REPL client and no application
+ code. Use this view to experiment from the REPL without running
+ your application. Before you go to this page,
+ run <code>(cljs-repl)</code> to start the server side of the
+ REPL connection.
+ </small>
+ <h4>Production</h4>
+ <small>
+ Run your application with advanced compilation.
+ </small>
+ </div>
+</div>
+
+</_within>
2,027 app-template/src/leiningen/new/pedestal_app/annotated/tools/public/javascripts/bootstrap.js
@@ -0,0 +1,2027 @@
+/* ===================================================
+ * bootstrap-transition.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#transitions
+ * ===================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function ($) {
+
+ $(function () {
+
+ "use strict"; // jshint ;_;
+
+
+ /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
+ * ======================================================= */
+
+ $.support.transition = (function () {
+
+ var transitionEnd = (function () {
+
+ var el = document.createElement('bootstrap')
+ , transEndEventNames = {
+ 'WebkitTransition' : 'webkitTransitionEnd'
+ , 'MozTransition' : 'transitionend'
+ , 'OTransition' : 'oTransitionEnd otransitionend'
+ , 'transition' : 'transitionend'
+ }
+ , name
+
+ for (name in transEndEventNames){
+ if (el.style[name] !== undefined) {
+ return transEndEventNames[name]
+ }
+ }
+
+ }())
+
+ return transitionEnd && {
+ end: transitionEnd
+ }
+
+ })()
+
+ })
+
+}(window.jQuery);/* ==========================================================
+ * bootstrap-alert.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
+ * ==========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* ALERT CLASS DEFINITION
+ * ====================== */
+
+ var dismiss = '[data-dismiss="alert"]'
+ , Alert = function (el) {
+ $(el).on('click', dismiss, this.close)
+ }
+
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ , selector = $this.attr('data-target')
+ , $parent
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ $parent = $(selector)
+
+ e && e.preventDefault()
+
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
+
+ $parent.trigger(e = $.Event('close'))
+
+ if (e.isDefaultPrevented()) return
+
+ $parent.removeClass('in')
+
+ function removeElement() {
+ $parent
+ .trigger('closed')
+ .remove()
+ }
+
+ $.support.transition && $parent.hasClass('fade') ?
+ $parent.on($.support.transition.end, removeElement) :
+ removeElement()
+ }
+
+
+ /* ALERT PLUGIN DEFINITION
+ * ======================= */
+
+ $.fn.alert = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('alert')
+ if (!data) $this.data('alert', (data = new Alert(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
+ }
+
+ $.fn.alert.Constructor = Alert
+
+
+ /* ALERT DATA-API
+ * ============== */
+
+ $(function () {
+ $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
+ })
+
+}(window.jQuery);/* ============================================================
+ * bootstrap-button.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#buttons
+ * ============================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============================================================ */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+
+
+ /* BUTTON PUBLIC CLASS DEFINITION
+ * ============================== */
+
+ var Button = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, $.fn.button.defaults, options)
+ }
+
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ , $el = this.$element
+ , data = $el.data()
+ , val = $el.is('input') ? 'val' : 'html'
+
+ state = state + 'Text'
+ data.resetText || $el.data('resetText', $el[val]())
+
+ $el[val](data[state] || this.options[state])
+
+ // push to event loop to allow forms to submit
+ setTimeout(function () {
+ state == 'loadingText' ?
+ $el.addClass(d).attr(d, d) :
+ $el.removeClass(d).removeAttr(d)
+ }, 0)
+ }
+
+ Button.prototype.toggle = function () {
+ var $parent = this.$element.closest('[data-toggle="buttons-radio"]')
+
+ $parent && $parent
+ .find('.active')
+ .removeClass('active')
+
+ this.$element.toggleClass('active')
+ }
+
+
+ /* BUTTON PLUGIN DEFINITION
+ * ======================== */
+
+ $.fn.button = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('button')
+ , options = typeof option == 'object' && option
+ if (!data) $this.data('button', (data = new Button(this, options)))
+ if (option == 'toggle') data.toggle()
+ else if (option) data.setState(option)
+ })
+ }
+
+ $.fn.button.defaults = {
+ loadingText: 'loading...'
+ }
+
+ $.fn.button.Constructor = Button
+
+
+ /* BUTTON DATA-API
+ * =============== */
+
+ $(function () {
+ $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
+ var $btn = $(e.target)
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
+ $btn.button('toggle')
+ })
+ })
+
+}(window.jQuery);/* ==========================================================
+ * bootstrap-carousel.js v2.1.1
+ * http://twitter.github.com/bootstrap/javascript.html#carousel
+ * ==========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function ($) {
+
+ "use strict"; // jshint ;_;
+