tui_editor-rails 1.0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (887) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +6 -0
  5. data/Gemfile.lock +20 -0
  6. data/README.md +69 -0
  7. data/Rakefile +2 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/example/.gitignore +30 -0
  11. data/example/.ruby-version +1 -0
  12. data/example/Gemfile +64 -0
  13. data/example/Gemfile.lock +224 -0
  14. data/example/README.md +67 -0
  15. data/example/Rakefile +6 -0
  16. data/example/app/assets/config/manifest.js +3 -0
  17. data/example/app/assets/images/.keep +0 -0
  18. data/example/app/assets/images/screen_capture.png +0 -0
  19. data/example/app/assets/javascripts/application.js +23 -0
  20. data/example/app/assets/javascripts/cable.js +13 -0
  21. data/example/app/assets/javascripts/channels/.keep +0 -0
  22. data/example/app/assets/javascripts/home.coffee +3 -0
  23. data/example/app/assets/javascripts/posts.coffee +3 -0
  24. data/example/app/assets/stylesheets/application.scss +4 -0
  25. data/example/app/assets/stylesheets/home.scss +3 -0
  26. data/example/app/assets/stylesheets/posts.scss +3 -0
  27. data/example/app/assets/stylesheets/scaffolds.scss +84 -0
  28. data/example/app/channels/application_cable/channel.rb +4 -0
  29. data/example/app/channels/application_cable/connection.rb +4 -0
  30. data/example/app/controllers/application_controller.rb +2 -0
  31. data/example/app/controllers/concerns/.keep +0 -0
  32. data/example/app/controllers/home_controller.rb +4 -0
  33. data/example/app/controllers/posts_controller.rb +74 -0
  34. data/example/app/helpers/application_helper.rb +2 -0
  35. data/example/app/helpers/home_helper.rb +2 -0
  36. data/example/app/helpers/posts_helper.rb +2 -0
  37. data/example/app/jobs/application_job.rb +2 -0
  38. data/example/app/mailers/application_mailer.rb +4 -0
  39. data/example/app/models/application_record.rb +3 -0
  40. data/example/app/models/concerns/.keep +0 -0
  41. data/example/app/models/post.rb +2 -0
  42. data/example/app/views/home/index.html.erb +11 -0
  43. data/example/app/views/layouts/application.html.erb +14 -0
  44. data/example/app/views/layouts/mailer.html.erb +13 -0
  45. data/example/app/views/layouts/mailer.text.erb +1 -0
  46. data/example/app/views/posts/_form.html.erb +27 -0
  47. data/example/app/views/posts/_post.json.jbuilder +2 -0
  48. data/example/app/views/posts/edit.html.erb +6 -0
  49. data/example/app/views/posts/index.html.erb +29 -0
  50. data/example/app/views/posts/index.json.jbuilder +1 -0
  51. data/example/app/views/posts/new.html.erb +5 -0
  52. data/example/app/views/posts/show.html.erb +14 -0
  53. data/example/app/views/posts/show.json.jbuilder +1 -0
  54. data/example/bin/bundle +3 -0
  55. data/example/bin/rails +9 -0
  56. data/example/bin/rake +9 -0
  57. data/example/bin/setup +36 -0
  58. data/example/bin/spring +17 -0
  59. data/example/bin/update +31 -0
  60. data/example/bin/yarn +11 -0
  61. data/example/config.ru +5 -0
  62. data/example/config/application.rb +19 -0
  63. data/example/config/boot.rb +4 -0
  64. data/example/config/cable.yml +10 -0
  65. data/example/config/credentials.yml.enc +1 -0
  66. data/example/config/database.yml +25 -0
  67. data/example/config/environment.rb +5 -0
  68. data/example/config/environments/development.rb +61 -0
  69. data/example/config/environments/production.rb +94 -0
  70. data/example/config/environments/test.rb +46 -0
  71. data/example/config/initializers/application_controller_renderer.rb +8 -0
  72. data/example/config/initializers/assets.rb +14 -0
  73. data/example/config/initializers/backtrace_silencers.rb +7 -0
  74. data/example/config/initializers/content_security_policy.rb +22 -0
  75. data/example/config/initializers/cookies_serializer.rb +5 -0
  76. data/example/config/initializers/filter_parameter_logging.rb +4 -0
  77. data/example/config/initializers/inflections.rb +16 -0
  78. data/example/config/initializers/mime_types.rb +4 -0
  79. data/example/config/initializers/wrap_parameters.rb +14 -0
  80. data/example/config/locales/en.yml +33 -0
  81. data/example/config/puma.rb +34 -0
  82. data/example/config/routes.rb +6 -0
  83. data/example/config/spring.rb +6 -0
  84. data/example/config/storage.yml +35 -0
  85. data/example/db/migrate/20180208210404_create_posts.rb +10 -0
  86. data/example/db/schema.rb +22 -0
  87. data/example/db/seeds.rb +7 -0
  88. data/example/lib/assets/.keep +0 -0
  89. data/example/lib/tasks/.keep +0 -0
  90. data/example/log/.keep +0 -0
  91. data/example/package.json +5 -0
  92. data/example/public/404.html +67 -0
  93. data/example/public/422.html +67 -0
  94. data/example/public/500.html +66 -0
  95. data/example/public/apple-touch-icon-precomposed.png +0 -0
  96. data/example/public/apple-touch-icon.png +0 -0
  97. data/example/public/favicon.ico +0 -0
  98. data/example/public/robots.txt +1 -0
  99. data/example/test/application_system_test_case.rb +5 -0
  100. data/example/test/controllers/.keep +0 -0
  101. data/example/test/controllers/home_controller_test.rb +9 -0
  102. data/example/test/controllers/posts_controller_test.rb +48 -0
  103. data/example/test/fixtures/.keep +0 -0
  104. data/example/test/fixtures/files/.keep +0 -0
  105. data/example/test/fixtures/posts.yml +9 -0
  106. data/example/test/helpers/.keep +0 -0
  107. data/example/test/integration/.keep +0 -0
  108. data/example/test/mailers/.keep +0 -0
  109. data/example/test/models/.keep +0 -0
  110. data/example/test/models/post_test.rb +7 -0
  111. data/example/test/system/.keep +0 -0
  112. data/example/test/system/posts_test.rb +45 -0
  113. data/example/test/test_helper.rb +10 -0
  114. data/example/tmp/.keep +0 -0
  115. data/example/vendor/.keep +0 -0
  116. data/lib/tui_editor/rails.rb +8 -0
  117. data/lib/tui_editor/rails/version.rb +5 -0
  118. data/tui_editor-rails.gemspec +34 -0
  119. data/vendor/assets/components/codemirror/.bower.json +31 -0
  120. data/vendor/assets/components/codemirror/AUTHORS +714 -0
  121. data/vendor/assets/components/codemirror/CHANGELOG.md +1316 -0
  122. data/vendor/assets/components/codemirror/CONTRIBUTING.md +92 -0
  123. data/vendor/assets/components/codemirror/LICENSE +21 -0
  124. data/vendor/assets/components/codemirror/README.md +35 -0
  125. data/vendor/assets/components/codemirror/addon/comment/comment.js +209 -0
  126. data/vendor/assets/components/codemirror/addon/comment/continuecomment.js +78 -0
  127. data/vendor/assets/components/codemirror/addon/dialog/dialog.css +32 -0
  128. data/vendor/assets/components/codemirror/addon/dialog/dialog.js +157 -0
  129. data/vendor/assets/components/codemirror/addon/display/autorefresh.js +47 -0
  130. data/vendor/assets/components/codemirror/addon/display/fullscreen.css +6 -0
  131. data/vendor/assets/components/codemirror/addon/display/fullscreen.js +41 -0
  132. data/vendor/assets/components/codemirror/addon/display/panel.js +123 -0
  133. data/vendor/assets/components/codemirror/addon/display/placeholder.js +63 -0
  134. data/vendor/assets/components/codemirror/addon/display/rulers.js +51 -0
  135. data/vendor/assets/components/codemirror/addon/edit/closebrackets.js +194 -0
  136. data/vendor/assets/components/codemirror/addon/edit/closetag.js +175 -0
  137. data/vendor/assets/components/codemirror/addon/edit/continuelist.js +89 -0
  138. data/vendor/assets/components/codemirror/addon/edit/matchbrackets.js +145 -0
  139. data/vendor/assets/components/codemirror/addon/edit/matchtags.js +66 -0
  140. data/vendor/assets/components/codemirror/addon/edit/trailingspace.js +27 -0
  141. data/vendor/assets/components/codemirror/addon/fold/brace-fold.js +105 -0
  142. data/vendor/assets/components/codemirror/addon/fold/comment-fold.js +59 -0
  143. data/vendor/assets/components/codemirror/addon/fold/foldcode.js +152 -0
  144. data/vendor/assets/components/codemirror/addon/fold/foldgutter.css +20 -0
  145. data/vendor/assets/components/codemirror/addon/fold/foldgutter.js +146 -0
  146. data/vendor/assets/components/codemirror/addon/fold/indent-fold.js +48 -0
  147. data/vendor/assets/components/codemirror/addon/fold/markdown-fold.js +49 -0
  148. data/vendor/assets/components/codemirror/addon/fold/xml-fold.js +182 -0
  149. data/vendor/assets/components/codemirror/addon/hint/anyword-hint.js +41 -0
  150. data/vendor/assets/components/codemirror/addon/hint/css-hint.js +60 -0
  151. data/vendor/assets/components/codemirror/addon/hint/html-hint.js +348 -0
  152. data/vendor/assets/components/codemirror/addon/hint/javascript-hint.js +155 -0
  153. data/vendor/assets/components/codemirror/addon/hint/show-hint.css +36 -0
  154. data/vendor/assets/components/codemirror/addon/hint/show-hint.js +432 -0
  155. data/vendor/assets/components/codemirror/addon/hint/sql-hint.js +286 -0
  156. data/vendor/assets/components/codemirror/addon/hint/xml-hint.js +110 -0
  157. data/vendor/assets/components/codemirror/addon/lint/coffeescript-lint.js +47 -0
  158. data/vendor/assets/components/codemirror/addon/lint/css-lint.js +40 -0
  159. data/vendor/assets/components/codemirror/addon/lint/html-lint.js +53 -0
  160. data/vendor/assets/components/codemirror/addon/lint/javascript-lint.js +63 -0
  161. data/vendor/assets/components/codemirror/addon/lint/json-lint.js +37 -0
  162. data/vendor/assets/components/codemirror/addon/lint/lint.css +73 -0
  163. data/vendor/assets/components/codemirror/addon/lint/lint.js +252 -0
  164. data/vendor/assets/components/codemirror/addon/lint/yaml-lint.js +41 -0
  165. data/vendor/assets/components/codemirror/addon/merge/merge.css +113 -0
  166. data/vendor/assets/components/codemirror/addon/merge/merge.js +1001 -0
  167. data/vendor/assets/components/codemirror/addon/mode/loadmode.js +64 -0
  168. data/vendor/assets/components/codemirror/addon/mode/multiplex.js +123 -0
  169. data/vendor/assets/components/codemirror/addon/mode/multiplex_test.js +33 -0
  170. data/vendor/assets/components/codemirror/addon/mode/overlay.js +90 -0
  171. data/vendor/assets/components/codemirror/addon/mode/simple.js +216 -0
  172. data/vendor/assets/components/codemirror/addon/runmode/colorize.js +40 -0
  173. data/vendor/assets/components/codemirror/addon/runmode/runmode-standalone.js +158 -0
  174. data/vendor/assets/components/codemirror/addon/runmode/runmode.js +72 -0
  175. data/vendor/assets/components/codemirror/addon/runmode/runmode.node.js +197 -0
  176. data/vendor/assets/components/codemirror/addon/scroll/annotatescrollbar.js +122 -0
  177. data/vendor/assets/components/codemirror/addon/scroll/scrollpastend.js +48 -0
  178. data/vendor/assets/components/codemirror/addon/scroll/simplescrollbars.css +66 -0
  179. data/vendor/assets/components/codemirror/addon/scroll/simplescrollbars.js +152 -0
  180. data/vendor/assets/components/codemirror/addon/search/jump-to-line.js +49 -0
  181. data/vendor/assets/components/codemirror/addon/search/match-highlighter.js +165 -0
  182. data/vendor/assets/components/codemirror/addon/search/matchesonscrollbar.css +8 -0
  183. data/vendor/assets/components/codemirror/addon/search/matchesonscrollbar.js +97 -0
  184. data/vendor/assets/components/codemirror/addon/search/search.js +252 -0
  185. data/vendor/assets/components/codemirror/addon/search/searchcursor.js +289 -0
  186. data/vendor/assets/components/codemirror/addon/selection/active-line.js +72 -0
  187. data/vendor/assets/components/codemirror/addon/selection/mark-selection.js +119 -0
  188. data/vendor/assets/components/codemirror/addon/selection/selection-pointer.js +98 -0
  189. data/vendor/assets/components/codemirror/addon/tern/tern.css +87 -0
  190. data/vendor/assets/components/codemirror/addon/tern/tern.js +718 -0
  191. data/vendor/assets/components/codemirror/addon/tern/worker.js +44 -0
  192. data/vendor/assets/components/codemirror/addon/wrap/hardwrap.js +144 -0
  193. data/vendor/assets/components/codemirror/bower.json +17 -0
  194. data/vendor/assets/components/codemirror/component-tools/bower.json +17 -0
  195. data/vendor/assets/components/codemirror/component-tools/build.sh +31 -0
  196. data/vendor/assets/components/codemirror/component-tools/update.py +38 -0
  197. data/vendor/assets/components/codemirror/keymap/emacs.js +416 -0
  198. data/vendor/assets/components/codemirror/keymap/sublime.js +685 -0
  199. data/vendor/assets/components/codemirror/keymap/vim.js +5219 -0
  200. data/vendor/assets/components/codemirror/lib/codemirror.css +346 -0
  201. data/vendor/assets/components/codemirror/lib/codemirror.js +9669 -0
  202. data/vendor/assets/components/codemirror/mode/apl/apl.js +174 -0
  203. data/vendor/assets/components/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
  204. data/vendor/assets/components/codemirror/mode/asn.1/asn.1.js +204 -0
  205. data/vendor/assets/components/codemirror/mode/asterisk/asterisk.js +196 -0
  206. data/vendor/assets/components/codemirror/mode/brainfuck/brainfuck.js +85 -0
  207. data/vendor/assets/components/codemirror/mode/clike/clike.js +817 -0
  208. data/vendor/assets/components/codemirror/mode/clojure/clojure.js +306 -0
  209. data/vendor/assets/components/codemirror/mode/cmake/cmake.js +97 -0
  210. data/vendor/assets/components/codemirror/mode/cobol/cobol.js +255 -0
  211. data/vendor/assets/components/codemirror/mode/coffeescript/coffeescript.js +359 -0
  212. data/vendor/assets/components/codemirror/mode/commonlisp/commonlisp.js +124 -0
  213. data/vendor/assets/components/codemirror/mode/crystal/crystal.js +433 -0
  214. data/vendor/assets/components/codemirror/mode/css/css.js +832 -0
  215. data/vendor/assets/components/codemirror/mode/cypher/cypher.js +150 -0
  216. data/vendor/assets/components/codemirror/mode/d/d.js +218 -0
  217. data/vendor/assets/components/codemirror/mode/dart/dart.js +157 -0
  218. data/vendor/assets/components/codemirror/mode/diff/diff.js +47 -0
  219. data/vendor/assets/components/codemirror/mode/django/django.js +356 -0
  220. data/vendor/assets/components/codemirror/mode/dockerfile/dockerfile.js +79 -0
  221. data/vendor/assets/components/codemirror/mode/dtd/dtd.js +142 -0
  222. data/vendor/assets/components/codemirror/mode/dylan/dylan.js +352 -0
  223. data/vendor/assets/components/codemirror/mode/ebnf/ebnf.js +195 -0
  224. data/vendor/assets/components/codemirror/mode/ecl/ecl.js +206 -0
  225. data/vendor/assets/components/codemirror/mode/eiffel/eiffel.js +160 -0
  226. data/vendor/assets/components/codemirror/mode/elm/elm.js +205 -0
  227. data/vendor/assets/components/codemirror/mode/erlang/erlang.js +619 -0
  228. data/vendor/assets/components/codemirror/mode/factor/factor.js +85 -0
  229. data/vendor/assets/components/codemirror/mode/fcl/fcl.js +173 -0
  230. data/vendor/assets/components/codemirror/mode/forth/forth.js +180 -0
  231. data/vendor/assets/components/codemirror/mode/fortran/fortran.js +188 -0
  232. data/vendor/assets/components/codemirror/mode/gas/gas.js +345 -0
  233. data/vendor/assets/components/codemirror/mode/gfm/gfm.js +129 -0
  234. data/vendor/assets/components/codemirror/mode/gherkin/gherkin.js +178 -0
  235. data/vendor/assets/components/codemirror/mode/go/go.js +187 -0
  236. data/vendor/assets/components/codemirror/mode/groovy/groovy.js +230 -0
  237. data/vendor/assets/components/codemirror/mode/haml/haml.js +161 -0
  238. data/vendor/assets/components/codemirror/mode/handlebars/handlebars.js +62 -0
  239. data/vendor/assets/components/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
  240. data/vendor/assets/components/codemirror/mode/haskell/haskell.js +267 -0
  241. data/vendor/assets/components/codemirror/mode/haxe/haxe.js +515 -0
  242. data/vendor/assets/components/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
  243. data/vendor/assets/components/codemirror/mode/htmlmixed/htmlmixed.js +152 -0
  244. data/vendor/assets/components/codemirror/mode/http/http.js +113 -0
  245. data/vendor/assets/components/codemirror/mode/idl/idl.js +290 -0
  246. data/vendor/assets/components/codemirror/mode/javascript/javascript.js +865 -0
  247. data/vendor/assets/components/codemirror/mode/jinja2/jinja2.js +142 -0
  248. data/vendor/assets/components/codemirror/mode/jsx/jsx.js +148 -0
  249. data/vendor/assets/components/codemirror/mode/julia/julia.js +418 -0
  250. data/vendor/assets/components/codemirror/mode/livescript/livescript.js +280 -0
  251. data/vendor/assets/components/codemirror/mode/lua/lua.js +159 -0
  252. data/vendor/assets/components/codemirror/mode/markdown/markdown.js +872 -0
  253. data/vendor/assets/components/codemirror/mode/mathematica/mathematica.js +176 -0
  254. data/vendor/assets/components/codemirror/mode/mbox/mbox.js +129 -0
  255. data/vendor/assets/components/codemirror/mode/meta.js +217 -0
  256. data/vendor/assets/components/codemirror/mode/mirc/mirc.js +193 -0
  257. data/vendor/assets/components/codemirror/mode/mllike/mllike.js +356 -0
  258. data/vendor/assets/components/codemirror/mode/modelica/modelica.js +245 -0
  259. data/vendor/assets/components/codemirror/mode/mscgen/mscgen.js +175 -0
  260. data/vendor/assets/components/codemirror/mode/mumps/mumps.js +148 -0
  261. data/vendor/assets/components/codemirror/mode/nginx/nginx.js +178 -0
  262. data/vendor/assets/components/codemirror/mode/nsis/nsis.js +95 -0
  263. data/vendor/assets/components/codemirror/mode/ntriples/ntriples.js +195 -0
  264. data/vendor/assets/components/codemirror/mode/octave/octave.js +139 -0
  265. data/vendor/assets/components/codemirror/mode/oz/oz.js +252 -0
  266. data/vendor/assets/components/codemirror/mode/pascal/pascal.js +109 -0
  267. data/vendor/assets/components/codemirror/mode/pegjs/pegjs.js +114 -0
  268. data/vendor/assets/components/codemirror/mode/perl/perl.js +837 -0
  269. data/vendor/assets/components/codemirror/mode/php/php.js +234 -0
  270. data/vendor/assets/components/codemirror/mode/pig/pig.js +178 -0
  271. data/vendor/assets/components/codemirror/mode/powershell/powershell.js +398 -0
  272. data/vendor/assets/components/codemirror/mode/properties/properties.js +78 -0
  273. data/vendor/assets/components/codemirror/mode/protobuf/protobuf.js +69 -0
  274. data/vendor/assets/components/codemirror/mode/pug/pug.js +591 -0
  275. data/vendor/assets/components/codemirror/mode/puppet/puppet.js +220 -0
  276. data/vendor/assets/components/codemirror/mode/python/python.js +334 -0
  277. data/vendor/assets/components/codemirror/mode/q/q.js +139 -0
  278. data/vendor/assets/components/codemirror/mode/r/r.js +183 -0
  279. data/vendor/assets/components/codemirror/mode/rpm/rpm.js +109 -0
  280. data/vendor/assets/components/codemirror/mode/rst/rst.js +557 -0
  281. data/vendor/assets/components/codemirror/mode/ruby/ruby.js +296 -0
  282. data/vendor/assets/components/codemirror/mode/rust/rust.js +72 -0
  283. data/vendor/assets/components/codemirror/mode/sas/sas.js +303 -0
  284. data/vendor/assets/components/codemirror/mode/sass/sass.js +454 -0
  285. data/vendor/assets/components/codemirror/mode/scheme/scheme.js +249 -0
  286. data/vendor/assets/components/codemirror/mode/shell/shell.js +151 -0
  287. data/vendor/assets/components/codemirror/mode/sieve/sieve.js +193 -0
  288. data/vendor/assets/components/codemirror/mode/slim/slim.js +575 -0
  289. data/vendor/assets/components/codemirror/mode/smalltalk/smalltalk.js +168 -0
  290. data/vendor/assets/components/codemirror/mode/smarty/smarty.js +225 -0
  291. data/vendor/assets/components/codemirror/mode/solr/solr.js +104 -0
  292. data/vendor/assets/components/codemirror/mode/soy/soy.js +354 -0
  293. data/vendor/assets/components/codemirror/mode/sparql/sparql.js +180 -0
  294. data/vendor/assets/components/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
  295. data/vendor/assets/components/codemirror/mode/sql/sql.js +488 -0
  296. data/vendor/assets/components/codemirror/mode/stex/stex.js +251 -0
  297. data/vendor/assets/components/codemirror/mode/stylus/stylus.js +771 -0
  298. data/vendor/assets/components/codemirror/mode/swift/swift.js +219 -0
  299. data/vendor/assets/components/codemirror/mode/tcl/tcl.js +139 -0
  300. data/vendor/assets/components/codemirror/mode/textile/textile.js +469 -0
  301. data/vendor/assets/components/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  302. data/vendor/assets/components/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
  303. data/vendor/assets/components/codemirror/mode/tiki/tiki.css +26 -0
  304. data/vendor/assets/components/codemirror/mode/tiki/tiki.js +312 -0
  305. data/vendor/assets/components/codemirror/mode/toml/toml.js +88 -0
  306. data/vendor/assets/components/codemirror/mode/tornado/tornado.js +68 -0
  307. data/vendor/assets/components/codemirror/mode/troff/troff.js +84 -0
  308. data/vendor/assets/components/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
  309. data/vendor/assets/components/codemirror/mode/ttcn/ttcn.js +283 -0
  310. data/vendor/assets/components/codemirror/mode/turtle/turtle.js +162 -0
  311. data/vendor/assets/components/codemirror/mode/twig/twig.js +141 -0
  312. data/vendor/assets/components/codemirror/mode/vb/vb.js +275 -0
  313. data/vendor/assets/components/codemirror/mode/vbscript/vbscript.js +350 -0
  314. data/vendor/assets/components/codemirror/mode/velocity/velocity.js +201 -0
  315. data/vendor/assets/components/codemirror/mode/verilog/verilog.js +675 -0
  316. data/vendor/assets/components/codemirror/mode/vhdl/vhdl.js +189 -0
  317. data/vendor/assets/components/codemirror/mode/vue/vue.js +77 -0
  318. data/vendor/assets/components/codemirror/mode/webidl/webidl.js +195 -0
  319. data/vendor/assets/components/codemirror/mode/xml/xml.js +401 -0
  320. data/vendor/assets/components/codemirror/mode/xquery/xquery.js +448 -0
  321. data/vendor/assets/components/codemirror/mode/yacas/yacas.js +204 -0
  322. data/vendor/assets/components/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +68 -0
  323. data/vendor/assets/components/codemirror/mode/yaml/yaml.js +118 -0
  324. data/vendor/assets/components/codemirror/mode/z80/z80.js +116 -0
  325. data/vendor/assets/components/codemirror/rollup.config.js +18 -0
  326. data/vendor/assets/components/codemirror/src/codemirror.js +3 -0
  327. data/vendor/assets/components/codemirror/src/display/Display.js +106 -0
  328. data/vendor/assets/components/codemirror/src/display/focus.js +47 -0
  329. data/vendor/assets/components/codemirror/src/display/gutters.js +34 -0
  330. data/vendor/assets/components/codemirror/src/display/highlight_worker.js +55 -0
  331. data/vendor/assets/components/codemirror/src/display/line_numbers.js +48 -0
  332. data/vendor/assets/components/codemirror/src/display/mode_state.js +22 -0
  333. data/vendor/assets/components/codemirror/src/display/operations.js +205 -0
  334. data/vendor/assets/components/codemirror/src/display/scroll_events.js +115 -0
  335. data/vendor/assets/components/codemirror/src/display/scrollbars.js +192 -0
  336. data/vendor/assets/components/codemirror/src/display/scrolling.js +184 -0
  337. data/vendor/assets/components/codemirror/src/display/selection.js +158 -0
  338. data/vendor/assets/components/codemirror/src/display/update_display.js +260 -0
  339. data/vendor/assets/components/codemirror/src/display/update_line.js +188 -0
  340. data/vendor/assets/components/codemirror/src/display/update_lines.js +64 -0
  341. data/vendor/assets/components/codemirror/src/display/view_tracking.js +153 -0
  342. data/vendor/assets/components/codemirror/src/edit/CodeMirror.js +214 -0
  343. data/vendor/assets/components/codemirror/src/edit/commands.js +178 -0
  344. data/vendor/assets/components/codemirror/src/edit/deleteNearSelection.js +30 -0
  345. data/vendor/assets/components/codemirror/src/edit/drop_events.js +119 -0
  346. data/vendor/assets/components/codemirror/src/edit/fromTextArea.js +61 -0
  347. data/vendor/assets/components/codemirror/src/edit/global_events.js +44 -0
  348. data/vendor/assets/components/codemirror/src/edit/key_events.js +159 -0
  349. data/vendor/assets/components/codemirror/src/edit/legacy.js +62 -0
  350. data/vendor/assets/components/codemirror/src/edit/main.js +69 -0
  351. data/vendor/assets/components/codemirror/src/edit/methods.js +539 -0
  352. data/vendor/assets/components/codemirror/src/edit/mouse_events.js +407 -0
  353. data/vendor/assets/components/codemirror/src/edit/options.js +191 -0
  354. data/vendor/assets/components/codemirror/src/edit/utils.js +7 -0
  355. data/vendor/assets/components/codemirror/src/input/ContentEditableInput.js +517 -0
  356. data/vendor/assets/components/codemirror/src/input/TextareaInput.js +350 -0
  357. data/vendor/assets/components/codemirror/src/input/indent.js +71 -0
  358. data/vendor/assets/components/codemirror/src/input/input.js +135 -0
  359. data/vendor/assets/components/codemirror/src/input/keymap.js +148 -0
  360. data/vendor/assets/components/codemirror/src/input/keynames.js +17 -0
  361. data/vendor/assets/components/codemirror/src/input/movement.js +110 -0
  362. data/vendor/assets/components/codemirror/src/line/highlight.js +284 -0
  363. data/vendor/assets/components/codemirror/src/line/line_data.js +337 -0
  364. data/vendor/assets/components/codemirror/src/line/pos.js +40 -0
  365. data/vendor/assets/components/codemirror/src/line/saw_special_spans.js +10 -0
  366. data/vendor/assets/components/codemirror/src/line/spans.js +372 -0
  367. data/vendor/assets/components/codemirror/src/line/utils_line.js +85 -0
  368. data/vendor/assets/components/codemirror/src/measurement/position_measurement.js +700 -0
  369. data/vendor/assets/components/codemirror/src/measurement/widgets.js +26 -0
  370. data/vendor/assets/components/codemirror/src/model/Doc.js +432 -0
  371. data/vendor/assets/components/codemirror/src/model/change_measurement.js +61 -0
  372. data/vendor/assets/components/codemirror/src/model/changes.js +330 -0
  373. data/vendor/assets/components/codemirror/src/model/chunk.js +167 -0
  374. data/vendor/assets/components/codemirror/src/model/document_data.js +111 -0
  375. data/vendor/assets/components/codemirror/src/model/history.js +228 -0
  376. data/vendor/assets/components/codemirror/src/model/line_widget.js +78 -0
  377. data/vendor/assets/components/codemirror/src/model/mark_text.js +292 -0
  378. data/vendor/assets/components/codemirror/src/model/selection.js +82 -0
  379. data/vendor/assets/components/codemirror/src/model/selection_updates.js +208 -0
  380. data/vendor/assets/components/codemirror/src/modes.js +96 -0
  381. data/vendor/assets/components/codemirror/src/util/StringStream.js +90 -0
  382. data/vendor/assets/components/codemirror/src/util/bidi.js +214 -0
  383. data/vendor/assets/components/codemirror/src/util/browser.js +33 -0
  384. data/vendor/assets/components/codemirror/src/util/dom.js +97 -0
  385. data/vendor/assets/components/codemirror/src/util/event.js +103 -0
  386. data/vendor/assets/components/codemirror/src/util/feature_detection.js +84 -0
  387. data/vendor/assets/components/codemirror/src/util/misc.js +150 -0
  388. data/vendor/assets/components/codemirror/src/util/operation_group.js +72 -0
  389. data/vendor/assets/components/codemirror/theme/3024-day.css +41 -0
  390. data/vendor/assets/components/codemirror/theme/3024-night.css +39 -0
  391. data/vendor/assets/components/codemirror/theme/abcdef.css +32 -0
  392. data/vendor/assets/components/codemirror/theme/ambiance-mobile.css +5 -0
  393. data/vendor/assets/components/codemirror/theme/ambiance.css +74 -0
  394. data/vendor/assets/components/codemirror/theme/base16-dark.css +38 -0
  395. data/vendor/assets/components/codemirror/theme/base16-light.css +38 -0
  396. data/vendor/assets/components/codemirror/theme/bespin.css +34 -0
  397. data/vendor/assets/components/codemirror/theme/blackboard.css +32 -0
  398. data/vendor/assets/components/codemirror/theme/cobalt.css +25 -0
  399. data/vendor/assets/components/codemirror/theme/colorforth.css +33 -0
  400. data/vendor/assets/components/codemirror/theme/dracula.css +40 -0
  401. data/vendor/assets/components/codemirror/theme/duotone-dark.css +35 -0
  402. data/vendor/assets/components/codemirror/theme/duotone-light.css +36 -0
  403. data/vendor/assets/components/codemirror/theme/eclipse.css +23 -0
  404. data/vendor/assets/components/codemirror/theme/elegant.css +13 -0
  405. data/vendor/assets/components/codemirror/theme/erlang-dark.css +34 -0
  406. data/vendor/assets/components/codemirror/theme/hopscotch.css +34 -0
  407. data/vendor/assets/components/codemirror/theme/icecoder.css +43 -0
  408. data/vendor/assets/components/codemirror/theme/isotope.css +34 -0
  409. data/vendor/assets/components/codemirror/theme/lesser-dark.css +47 -0
  410. data/vendor/assets/components/codemirror/theme/liquibyte.css +95 -0
  411. data/vendor/assets/components/codemirror/theme/material.css +53 -0
  412. data/vendor/assets/components/codemirror/theme/mbo.css +37 -0
  413. data/vendor/assets/components/codemirror/theme/mdn-like.css +46 -0
  414. data/vendor/assets/components/codemirror/theme/midnight.css +43 -0
  415. data/vendor/assets/components/codemirror/theme/monokai.css +36 -0
  416. data/vendor/assets/components/codemirror/theme/neat.css +12 -0
  417. data/vendor/assets/components/codemirror/theme/neo.css +43 -0
  418. data/vendor/assets/components/codemirror/theme/night.css +27 -0
  419. data/vendor/assets/components/codemirror/theme/oceanic-next.css +44 -0
  420. data/vendor/assets/components/codemirror/theme/panda-syntax.css +85 -0
  421. data/vendor/assets/components/codemirror/theme/paraiso-dark.css +38 -0
  422. data/vendor/assets/components/codemirror/theme/paraiso-light.css +38 -0
  423. data/vendor/assets/components/codemirror/theme/pastel-on-dark.css +52 -0
  424. data/vendor/assets/components/codemirror/theme/railscasts.css +34 -0
  425. data/vendor/assets/components/codemirror/theme/rubyblue.css +25 -0
  426. data/vendor/assets/components/codemirror/theme/seti.css +44 -0
  427. data/vendor/assets/components/codemirror/theme/shadowfox.css +52 -0
  428. data/vendor/assets/components/codemirror/theme/solarized.css +168 -0
  429. data/vendor/assets/components/codemirror/theme/the-matrix.css +30 -0
  430. data/vendor/assets/components/codemirror/theme/tomorrow-night-bright.css +35 -0
  431. data/vendor/assets/components/codemirror/theme/tomorrow-night-eighties.css +38 -0
  432. data/vendor/assets/components/codemirror/theme/ttcn.css +64 -0
  433. data/vendor/assets/components/codemirror/theme/twilight.css +32 -0
  434. data/vendor/assets/components/codemirror/theme/vibrant-ink.css +34 -0
  435. data/vendor/assets/components/codemirror/theme/xq-dark.css +53 -0
  436. data/vendor/assets/components/codemirror/theme/xq-light.css +43 -0
  437. data/vendor/assets/components/codemirror/theme/yeti.css +44 -0
  438. data/vendor/assets/components/codemirror/theme/zenburn.css +37 -0
  439. data/vendor/assets/components/eve/.bower.json +12 -0
  440. data/vendor/assets/components/eve/LICENSE +202 -0
  441. data/vendor/assets/components/eve/README.md +7 -0
  442. data/vendor/assets/components/eve/component.json +13 -0
  443. data/vendor/assets/components/eve/e.html +66 -0
  444. data/vendor/assets/components/eve/eve.js +371 -0
  445. data/vendor/assets/components/eve/package.json +18 -0
  446. data/vendor/assets/components/highlightjs/.bower.json +24 -0
  447. data/vendor/assets/components/highlightjs/LICENSE +24 -0
  448. data/vendor/assets/components/highlightjs/Makefile +21 -0
  449. data/vendor/assets/components/highlightjs/README.md +12 -0
  450. data/vendor/assets/components/highlightjs/bower.json +14 -0
  451. data/vendor/assets/components/highlightjs/component.json +12 -0
  452. data/vendor/assets/components/highlightjs/composer.json +26 -0
  453. data/vendor/assets/components/highlightjs/highlight.pack.js +16645 -0
  454. data/vendor/assets/components/highlightjs/highlight.pack.min.js +15 -0
  455. data/vendor/assets/components/highlightjs/package.json +8 -0
  456. data/vendor/assets/components/highlightjs/styles/agate.css +108 -0
  457. data/vendor/assets/components/highlightjs/styles/androidstudio.css +66 -0
  458. data/vendor/assets/components/highlightjs/styles/arduino-light.css +88 -0
  459. data/vendor/assets/components/highlightjs/styles/arta.css +73 -0
  460. data/vendor/assets/components/highlightjs/styles/ascetic.css +45 -0
  461. data/vendor/assets/components/highlightjs/styles/atelier-cave-dark.css +83 -0
  462. data/vendor/assets/components/highlightjs/styles/atelier-cave-light.css +85 -0
  463. data/vendor/assets/components/highlightjs/styles/atelier-cave.dark.css +113 -0
  464. data/vendor/assets/components/highlightjs/styles/atelier-cave.light.css +113 -0
  465. data/vendor/assets/components/highlightjs/styles/atelier-dune-dark.css +69 -0
  466. data/vendor/assets/components/highlightjs/styles/atelier-dune-light.css +69 -0
  467. data/vendor/assets/components/highlightjs/styles/atelier-dune.dark.css +94 -0
  468. data/vendor/assets/components/highlightjs/styles/atelier-dune.light.css +94 -0
  469. data/vendor/assets/components/highlightjs/styles/atelier-estuary-dark.css +84 -0
  470. data/vendor/assets/components/highlightjs/styles/atelier-estuary-light.css +84 -0
  471. data/vendor/assets/components/highlightjs/styles/atelier-estuary.dark.css +113 -0
  472. data/vendor/assets/components/highlightjs/styles/atelier-estuary.light.css +113 -0
  473. data/vendor/assets/components/highlightjs/styles/atelier-forest-dark.css +69 -0
  474. data/vendor/assets/components/highlightjs/styles/atelier-forest-light.css +69 -0
  475. data/vendor/assets/components/highlightjs/styles/atelier-forest.dark.css +94 -0
  476. data/vendor/assets/components/highlightjs/styles/atelier-forest.light.css +94 -0
  477. data/vendor/assets/components/highlightjs/styles/atelier-heath-dark.css +69 -0
  478. data/vendor/assets/components/highlightjs/styles/atelier-heath-light.css +69 -0
  479. data/vendor/assets/components/highlightjs/styles/atelier-heath.dark.css +94 -0
  480. data/vendor/assets/components/highlightjs/styles/atelier-heath.light.css +94 -0
  481. data/vendor/assets/components/highlightjs/styles/atelier-lakeside-dark.css +69 -0
  482. data/vendor/assets/components/highlightjs/styles/atelier-lakeside-light.css +69 -0
  483. data/vendor/assets/components/highlightjs/styles/atelier-lakeside.dark.css +94 -0
  484. data/vendor/assets/components/highlightjs/styles/atelier-lakeside.light.css +94 -0
  485. data/vendor/assets/components/highlightjs/styles/atelier-plateau-dark.css +84 -0
  486. data/vendor/assets/components/highlightjs/styles/atelier-plateau-light.css +84 -0
  487. data/vendor/assets/components/highlightjs/styles/atelier-plateau.dark.css +113 -0
  488. data/vendor/assets/components/highlightjs/styles/atelier-plateau.light.css +113 -0
  489. data/vendor/assets/components/highlightjs/styles/atelier-savanna-dark.css +84 -0
  490. data/vendor/assets/components/highlightjs/styles/atelier-savanna-light.css +84 -0
  491. data/vendor/assets/components/highlightjs/styles/atelier-savanna.dark.css +113 -0
  492. data/vendor/assets/components/highlightjs/styles/atelier-savanna.light.css +113 -0
  493. data/vendor/assets/components/highlightjs/styles/atelier-seaside-dark.css +69 -0
  494. data/vendor/assets/components/highlightjs/styles/atelier-seaside-light.css +69 -0
  495. data/vendor/assets/components/highlightjs/styles/atelier-seaside.dark.css +94 -0
  496. data/vendor/assets/components/highlightjs/styles/atelier-seaside.light.css +94 -0
  497. data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool-dark.css +69 -0
  498. data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool-light.css +69 -0
  499. data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool.dark.css +94 -0
  500. data/vendor/assets/components/highlightjs/styles/atelier-sulphurpool.light.css +94 -0
  501. data/vendor/assets/components/highlightjs/styles/atom-one-dark.css +96 -0
  502. data/vendor/assets/components/highlightjs/styles/atom-one-light.css +96 -0
  503. data/vendor/assets/components/highlightjs/styles/brown-paper.css +64 -0
  504. data/vendor/assets/components/highlightjs/styles/brown-papersq.png +0 -0
  505. data/vendor/assets/components/highlightjs/styles/brown_paper.css +103 -0
  506. data/vendor/assets/components/highlightjs/styles/brown_papersq.png +0 -0
  507. data/vendor/assets/components/highlightjs/styles/codepen-embed.css +60 -0
  508. data/vendor/assets/components/highlightjs/styles/color-brewer.css +71 -0
  509. data/vendor/assets/components/highlightjs/styles/darcula.css +77 -0
  510. data/vendor/assets/components/highlightjs/styles/dark.css +63 -0
  511. data/vendor/assets/components/highlightjs/styles/darkula.css +6 -0
  512. data/vendor/assets/components/highlightjs/styles/default.css +99 -0
  513. data/vendor/assets/components/highlightjs/styles/docco.css +97 -0
  514. data/vendor/assets/components/highlightjs/styles/dracula.css +76 -0
  515. data/vendor/assets/components/highlightjs/styles/far.css +71 -0
  516. data/vendor/assets/components/highlightjs/styles/foundation.css +88 -0
  517. data/vendor/assets/components/highlightjs/styles/github-gist.css +71 -0
  518. data/vendor/assets/components/highlightjs/styles/github.css +99 -0
  519. data/vendor/assets/components/highlightjs/styles/googlecode.css +89 -0
  520. data/vendor/assets/components/highlightjs/styles/grayscale.css +101 -0
  521. data/vendor/assets/components/highlightjs/styles/gruvbox-dark.css +108 -0
  522. data/vendor/assets/components/highlightjs/styles/gruvbox-light.css +108 -0
  523. data/vendor/assets/components/highlightjs/styles/hopscotch.css +83 -0
  524. data/vendor/assets/components/highlightjs/styles/hybrid.css +102 -0
  525. data/vendor/assets/components/highlightjs/styles/idea.css +97 -0
  526. data/vendor/assets/components/highlightjs/styles/ir-black.css +73 -0
  527. data/vendor/assets/components/highlightjs/styles/ir_black.css +106 -0
  528. data/vendor/assets/components/highlightjs/styles/kimbie.dark.css +74 -0
  529. data/vendor/assets/components/highlightjs/styles/kimbie.light.css +74 -0
  530. data/vendor/assets/components/highlightjs/styles/magula.css +70 -0
  531. data/vendor/assets/components/highlightjs/styles/mono-blue.css +59 -0
  532. data/vendor/assets/components/highlightjs/styles/monokai-sublime.css +83 -0
  533. data/vendor/assets/components/highlightjs/styles/monokai.css +70 -0
  534. data/vendor/assets/components/highlightjs/styles/monokai_sublime.css +154 -0
  535. data/vendor/assets/components/highlightjs/styles/obsidian.css +88 -0
  536. data/vendor/assets/components/highlightjs/styles/ocean.css +74 -0
  537. data/vendor/assets/components/highlightjs/styles/paraiso-dark.css +72 -0
  538. data/vendor/assets/components/highlightjs/styles/paraiso-light.css +72 -0
  539. data/vendor/assets/components/highlightjs/styles/paraiso.dark.css +96 -0
  540. data/vendor/assets/components/highlightjs/styles/paraiso.light.css +96 -0
  541. data/vendor/assets/components/highlightjs/styles/pojoaque.css +83 -0
  542. data/vendor/assets/components/highlightjs/styles/pojoaque.jpg +0 -0
  543. data/vendor/assets/components/highlightjs/styles/purebasic.css +96 -0
  544. data/vendor/assets/components/highlightjs/styles/qtcreator_dark.css +83 -0
  545. data/vendor/assets/components/highlightjs/styles/qtcreator_light.css +83 -0
  546. data/vendor/assets/components/highlightjs/styles/railscasts.css +106 -0
  547. data/vendor/assets/components/highlightjs/styles/rainbow.css +85 -0
  548. data/vendor/assets/components/highlightjs/styles/routeros.css +108 -0
  549. data/vendor/assets/components/highlightjs/styles/school-book.css +72 -0
  550. data/vendor/assets/components/highlightjs/styles/school-book.png +0 -0
  551. data/vendor/assets/components/highlightjs/styles/school_book.css +111 -0
  552. data/vendor/assets/components/highlightjs/styles/school_book.png +0 -0
  553. data/vendor/assets/components/highlightjs/styles/solarized-dark.css +84 -0
  554. data/vendor/assets/components/highlightjs/styles/solarized-light.css +84 -0
  555. data/vendor/assets/components/highlightjs/styles/solarized_dark.css +107 -0
  556. data/vendor/assets/components/highlightjs/styles/solarized_light.css +107 -0
  557. data/vendor/assets/components/highlightjs/styles/sunburst.css +102 -0
  558. data/vendor/assets/components/highlightjs/styles/tomorrow-night-blue.css +75 -0
  559. data/vendor/assets/components/highlightjs/styles/tomorrow-night-bright.css +74 -0
  560. data/vendor/assets/components/highlightjs/styles/tomorrow-night-eighties.css +74 -0
  561. data/vendor/assets/components/highlightjs/styles/tomorrow-night.css +75 -0
  562. data/vendor/assets/components/highlightjs/styles/tomorrow.css +72 -0
  563. data/vendor/assets/components/highlightjs/styles/vs.css +68 -0
  564. data/vendor/assets/components/highlightjs/styles/vs2015.css +115 -0
  565. data/vendor/assets/components/highlightjs/styles/xcode.css +93 -0
  566. data/vendor/assets/components/highlightjs/styles/xt256.css +92 -0
  567. data/vendor/assets/components/highlightjs/styles/zenburn.css +80 -0
  568. data/vendor/assets/components/jquery/.bower.json +25 -0
  569. data/vendor/assets/components/jquery/AUTHORS.txt +313 -0
  570. data/vendor/assets/components/jquery/LICENSE.txt +36 -0
  571. data/vendor/assets/components/jquery/README.md +67 -0
  572. data/vendor/assets/components/jquery/bower.json +14 -0
  573. data/vendor/assets/components/jquery/dist/core.js +399 -0
  574. data/vendor/assets/components/jquery/dist/jquery.js +10364 -0
  575. data/vendor/assets/components/jquery/dist/jquery.min.js +2 -0
  576. data/vendor/assets/components/jquery/dist/jquery.min.map +1 -0
  577. data/vendor/assets/components/jquery/dist/jquery.slim.js +8269 -0
  578. data/vendor/assets/components/jquery/dist/jquery.slim.min.js +2 -0
  579. data/vendor/assets/components/jquery/dist/jquery.slim.min.map +1 -0
  580. data/vendor/assets/components/jquery/external/sizzle/LICENSE.txt +36 -0
  581. data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.js +2272 -0
  582. data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  583. data/vendor/assets/components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  584. data/vendor/assets/components/jquery/src/.eslintrc.json +5 -0
  585. data/vendor/assets/components/jquery/src/ajax.js +856 -0
  586. data/vendor/assets/components/jquery/src/ajax/jsonp.js +103 -0
  587. data/vendor/assets/components/jquery/src/ajax/load.js +77 -0
  588. data/vendor/assets/components/jquery/src/ajax/parseXML.js +30 -0
  589. data/vendor/assets/components/jquery/src/ajax/script.js +77 -0
  590. data/vendor/assets/components/jquery/src/ajax/var/location.js +5 -0
  591. data/vendor/assets/components/jquery/src/ajax/var/nonce.js +5 -0
  592. data/vendor/assets/components/jquery/src/ajax/var/rquery.js +5 -0
  593. data/vendor/assets/components/jquery/src/ajax/xhr.js +170 -0
  594. data/vendor/assets/components/jquery/src/attributes.js +13 -0
  595. data/vendor/assets/components/jquery/src/attributes/attr.js +141 -0
  596. data/vendor/assets/components/jquery/src/attributes/classes.js +186 -0
  597. data/vendor/assets/components/jquery/src/attributes/prop.js +143 -0
  598. data/vendor/assets/components/jquery/src/attributes/support.js +33 -0
  599. data/vendor/assets/components/jquery/src/attributes/val.js +191 -0
  600. data/vendor/assets/components/jquery/src/callbacks.js +236 -0
  601. data/vendor/assets/components/jquery/src/core.js +399 -0
  602. data/vendor/assets/components/jquery/src/core/DOMEval.js +30 -0
  603. data/vendor/assets/components/jquery/src/core/access.js +72 -0
  604. data/vendor/assets/components/jquery/src/core/camelCase.js +23 -0
  605. data/vendor/assets/components/jquery/src/core/init.js +129 -0
  606. data/vendor/assets/components/jquery/src/core/nodeName.js +13 -0
  607. data/vendor/assets/components/jquery/src/core/parseHTML.js +65 -0
  608. data/vendor/assets/components/jquery/src/core/ready-no-deferred.js +97 -0
  609. data/vendor/assets/components/jquery/src/core/ready.js +86 -0
  610. data/vendor/assets/components/jquery/src/core/readyException.js +13 -0
  611. data/vendor/assets/components/jquery/src/core/stripAndCollapse.js +14 -0
  612. data/vendor/assets/components/jquery/src/core/support.js +20 -0
  613. data/vendor/assets/components/jquery/src/core/toType.js +20 -0
  614. data/vendor/assets/components/jquery/src/core/var/rsingleTag.js +6 -0
  615. data/vendor/assets/components/jquery/src/css.js +481 -0
  616. data/vendor/assets/components/jquery/src/css/addGetHookIf.js +26 -0
  617. data/vendor/assets/components/jquery/src/css/adjustCSS.js +73 -0
  618. data/vendor/assets/components/jquery/src/css/curCSS.js +65 -0
  619. data/vendor/assets/components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
  620. data/vendor/assets/components/jquery/src/css/showHide.js +105 -0
  621. data/vendor/assets/components/jquery/src/css/support.js +102 -0
  622. data/vendor/assets/components/jquery/src/css/var/cssExpand.js +5 -0
  623. data/vendor/assets/components/jquery/src/css/var/getStyles.js +17 -0
  624. data/vendor/assets/components/jquery/src/css/var/isHiddenWithinTree.js +34 -0
  625. data/vendor/assets/components/jquery/src/css/var/rboxStyle.js +7 -0
  626. data/vendor/assets/components/jquery/src/css/var/rnumnonpx.js +7 -0
  627. data/vendor/assets/components/jquery/src/css/var/swap.js +26 -0
  628. data/vendor/assets/components/jquery/src/data.js +180 -0
  629. data/vendor/assets/components/jquery/src/data/Data.js +162 -0
  630. data/vendor/assets/components/jquery/src/data/var/acceptData.js +19 -0
  631. data/vendor/assets/components/jquery/src/data/var/dataPriv.js +7 -0
  632. data/vendor/assets/components/jquery/src/data/var/dataUser.js +7 -0
  633. data/vendor/assets/components/jquery/src/deferred.js +399 -0
  634. data/vendor/assets/components/jquery/src/deferred/exceptionHook.js +21 -0
  635. data/vendor/assets/components/jquery/src/deprecated.js +98 -0
  636. data/vendor/assets/components/jquery/src/dimensions.js +57 -0
  637. data/vendor/assets/components/jquery/src/effects.js +702 -0
  638. data/vendor/assets/components/jquery/src/effects/Tween.js +123 -0
  639. data/vendor/assets/components/jquery/src/effects/animatedSelector.js +15 -0
  640. data/vendor/assets/components/jquery/src/event.js +748 -0
  641. data/vendor/assets/components/jquery/src/event/ajax.js +22 -0
  642. data/vendor/assets/components/jquery/src/event/alias.js +29 -0
  643. data/vendor/assets/components/jquery/src/event/focusin.js +55 -0
  644. data/vendor/assets/components/jquery/src/event/support.js +11 -0
  645. data/vendor/assets/components/jquery/src/event/trigger.js +199 -0
  646. data/vendor/assets/components/jquery/src/exports/amd.js +26 -0
  647. data/vendor/assets/components/jquery/src/exports/global.js +34 -0
  648. data/vendor/assets/components/jquery/src/jquery.js +40 -0
  649. data/vendor/assets/components/jquery/src/manipulation.js +486 -0
  650. data/vendor/assets/components/jquery/src/manipulation/_evalUrl.js +23 -0
  651. data/vendor/assets/components/jquery/src/manipulation/buildFragment.js +105 -0
  652. data/vendor/assets/components/jquery/src/manipulation/getAll.js +32 -0
  653. data/vendor/assets/components/jquery/src/manipulation/setGlobalEval.js +22 -0
  654. data/vendor/assets/components/jquery/src/manipulation/support.js +35 -0
  655. data/vendor/assets/components/jquery/src/manipulation/var/rcheckableType.js +5 -0
  656. data/vendor/assets/components/jquery/src/manipulation/var/rscriptType.js +5 -0
  657. data/vendor/assets/components/jquery/src/manipulation/var/rtagName.js +5 -0
  658. data/vendor/assets/components/jquery/src/manipulation/wrapMap.js +29 -0
  659. data/vendor/assets/components/jquery/src/offset.js +233 -0
  660. data/vendor/assets/components/jquery/src/queue.js +145 -0
  661. data/vendor/assets/components/jquery/src/queue/delay.js +24 -0
  662. data/vendor/assets/components/jquery/src/selector-native.js +237 -0
  663. data/vendor/assets/components/jquery/src/selector-sizzle.js +19 -0
  664. data/vendor/assets/components/jquery/src/selector.js +3 -0
  665. data/vendor/assets/components/jquery/src/serialize.js +132 -0
  666. data/vendor/assets/components/jquery/src/traversing.js +191 -0
  667. data/vendor/assets/components/jquery/src/traversing/findFilter.js +97 -0
  668. data/vendor/assets/components/jquery/src/traversing/var/dir.js +22 -0
  669. data/vendor/assets/components/jquery/src/traversing/var/rneedsContext.js +8 -0
  670. data/vendor/assets/components/jquery/src/traversing/var/siblings.js +17 -0
  671. data/vendor/assets/components/jquery/src/var/ObjectFunctionString.js +7 -0
  672. data/vendor/assets/components/jquery/src/var/arr.js +5 -0
  673. data/vendor/assets/components/jquery/src/var/class2type.js +6 -0
  674. data/vendor/assets/components/jquery/src/var/concat.js +7 -0
  675. data/vendor/assets/components/jquery/src/var/document.js +5 -0
  676. data/vendor/assets/components/jquery/src/var/documentElement.js +7 -0
  677. data/vendor/assets/components/jquery/src/var/fnToString.js +7 -0
  678. data/vendor/assets/components/jquery/src/var/getProto.js +5 -0
  679. data/vendor/assets/components/jquery/src/var/hasOwn.js +7 -0
  680. data/vendor/assets/components/jquery/src/var/indexOf.js +7 -0
  681. data/vendor/assets/components/jquery/src/var/isFunction.js +13 -0
  682. data/vendor/assets/components/jquery/src/var/isWindow.js +8 -0
  683. data/vendor/assets/components/jquery/src/var/pnum.js +5 -0
  684. data/vendor/assets/components/jquery/src/var/push.js +7 -0
  685. data/vendor/assets/components/jquery/src/var/rcssNum.js +9 -0
  686. data/vendor/assets/components/jquery/src/var/rnothtmlwhite.js +8 -0
  687. data/vendor/assets/components/jquery/src/var/slice.js +7 -0
  688. data/vendor/assets/components/jquery/src/var/support.js +6 -0
  689. data/vendor/assets/components/jquery/src/var/toString.js +7 -0
  690. data/vendor/assets/components/jquery/src/wrap.js +78 -0
  691. data/vendor/assets/components/markdown-it/.bower.json +38 -0
  692. data/vendor/assets/components/markdown-it/CHANGELOG.md +442 -0
  693. data/vendor/assets/components/markdown-it/CONTRIBUTING.md +15 -0
  694. data/vendor/assets/components/markdown-it/LICENSE +22 -0
  695. data/vendor/assets/components/markdown-it/Procfile +1 -0
  696. data/vendor/assets/components/markdown-it/README.md +294 -0
  697. data/vendor/assets/components/markdown-it/bin/markdown-it.js +113 -0
  698. data/vendor/assets/components/markdown-it/bower.json +28 -0
  699. data/vendor/assets/components/markdown-it/dist/markdown-it.js +7963 -0
  700. data/vendor/assets/components/markdown-it/dist/markdown-it.min.js +1 -0
  701. data/vendor/assets/components/markdown-it/package.json +64 -0
  702. data/vendor/assets/components/plantuml-encoder/.bower.json +29 -0
  703. data/vendor/assets/components/plantuml-encoder/LICENSE +19 -0
  704. data/vendor/assets/components/plantuml-encoder/README.md +38 -0
  705. data/vendor/assets/components/plantuml-encoder/bower.json +20 -0
  706. data/vendor/assets/components/plantuml-encoder/dist/plantuml-encoder.js +3994 -0
  707. data/vendor/assets/components/plantuml-encoder/dist/plantuml-encoder.min.js +1 -0
  708. data/vendor/assets/components/plantuml-encoder/package.json +33 -0
  709. data/vendor/assets/components/raphael/.bower.json +45 -0
  710. data/vendor/assets/components/raphael/bower.json +31 -0
  711. data/vendor/assets/components/raphael/dev/banner.txt +8 -0
  712. data/vendor/assets/components/raphael/dev/raphael.amd.js +14 -0
  713. data/vendor/assets/components/raphael/dev/raphael.core.js +5413 -0
  714. data/vendor/assets/components/raphael/dev/raphael.svg.js +1428 -0
  715. data/vendor/assets/components/raphael/dev/raphael.vml.js +1010 -0
  716. data/vendor/assets/components/raphael/dev/test/svg/dom.js +295 -0
  717. data/vendor/assets/components/raphael/dev/test/vml/dom.js +5 -0
  718. data/vendor/assets/components/raphael/license.txt +21 -0
  719. data/vendor/assets/components/raphael/raphael.js +8330 -0
  720. data/vendor/assets/components/raphael/raphael.min.js +3 -0
  721. data/vendor/assets/components/raphael/raphael.no-deps.js +7959 -0
  722. data/vendor/assets/components/raphael/raphael.no-deps.min.js +3 -0
  723. data/vendor/assets/components/raphael/webpack.config.js +62 -0
  724. data/vendor/assets/components/squire-rte/.bower.json +34 -0
  725. data/vendor/assets/components/squire-rte/Demo.html +143 -0
  726. data/vendor/assets/components/squire-rte/LICENSE +21 -0
  727. data/vendor/assets/components/squire-rte/Makefile +22 -0
  728. data/vendor/assets/components/squire-rte/README.md +473 -0
  729. data/vendor/assets/components/squire-rte/bower.json +24 -0
  730. data/vendor/assets/components/squire-rte/build/document.html +54 -0
  731. data/vendor/assets/components/squire-rte/build/squire-raw.js +4722 -0
  732. data/vendor/assets/components/squire-rte/build/squire.js +2 -0
  733. data/vendor/assets/components/squire-rte/package.json +31 -0
  734. data/vendor/assets/components/squire-rte/source/Clean.js +358 -0
  735. data/vendor/assets/components/squire-rte/source/Clipboard.js +331 -0
  736. data/vendor/assets/components/squire-rte/source/Constants.js +60 -0
  737. data/vendor/assets/components/squire-rte/source/Editor.js +2201 -0
  738. data/vendor/assets/components/squire-rte/source/KeyHandlers.js +502 -0
  739. data/vendor/assets/components/squire-rte/source/Node.js +553 -0
  740. data/vendor/assets/components/squire-rte/source/Range.js +540 -0
  741. data/vendor/assets/components/squire-rte/source/TreeWalker.js +118 -0
  742. data/vendor/assets/components/squire-rte/source/document.html +54 -0
  743. data/vendor/assets/components/squire-rte/source/exports.js +42 -0
  744. data/vendor/assets/components/squire-rte/source/intro.js +6 -0
  745. data/vendor/assets/components/squire-rte/source/outro.js +22 -0
  746. data/vendor/assets/components/to-mark/.bower.json +35 -0
  747. data/vendor/assets/components/to-mark/bower.json +22 -0
  748. data/vendor/assets/components/to-mark/demo/demo.html +24 -0
  749. data/vendor/assets/components/to-mark/demo/demo2.html +94 -0
  750. data/vendor/assets/components/to-mark/dist/to-mark.js +1283 -0
  751. data/vendor/assets/components/to-mark/dist/to-mark.min.js +1 -0
  752. data/vendor/assets/components/to-mark/gulpfile.js +112 -0
  753. data/vendor/assets/components/to-mark/karma.conf.js +260 -0
  754. data/vendor/assets/components/to-mark/package-lock.json +13061 -0
  755. data/vendor/assets/components/to-mark/package.json +53 -0
  756. data/vendor/assets/components/tui-chart/.bower.json +44 -0
  757. data/vendor/assets/components/tui-chart/CODE_OF_CONDUCT.md +73 -0
  758. data/vendor/assets/components/tui-chart/CONTRIBUTING.md +91 -0
  759. data/vendor/assets/components/tui-chart/LICENSE +21 -0
  760. data/vendor/assets/components/tui-chart/README.md +142 -0
  761. data/vendor/assets/components/tui-chart/bower.json +33 -0
  762. data/vendor/assets/components/tui-chart/dist/maps/china.js +10 -0
  763. data/vendor/assets/components/tui-chart/dist/maps/japan.js +10 -0
  764. data/vendor/assets/components/tui-chart/dist/maps/singapore.js +10 -0
  765. data/vendor/assets/components/tui-chart/dist/maps/south-korea.js +10 -0
  766. data/vendor/assets/components/tui-chart/dist/maps/taiwan.js +10 -0
  767. data/vendor/assets/components/tui-chart/dist/maps/thailand.js +10 -0
  768. data/vendor/assets/components/tui-chart/dist/maps/usa.js +10 -0
  769. data/vendor/assets/components/tui-chart/dist/maps/world.js +11 -0
  770. data/vendor/assets/components/tui-chart/dist/tui-chart.css +704 -0
  771. data/vendor/assets/components/tui-chart/dist/tui-chart.js +40567 -0
  772. data/vendor/assets/components/tui-chart/dist/tui-chart.min.css +10 -0
  773. data/vendor/assets/components/tui-chart/dist/tui-chart.min.js +20 -0
  774. data/vendor/assets/components/tui-chart/docs/COMMIT_MESSAGE_CONVENTION.md +49 -0
  775. data/vendor/assets/components/tui-chart/docs/ISSUE_TEMPLATE.md +24 -0
  776. data/vendor/assets/components/tui-chart/docs/PULL_REQUEST_TEMPLATE.md +42 -0
  777. data/vendor/assets/components/tui-chart/docs/README.md +11 -0
  778. data/vendor/assets/components/tui-chart/docs/wiki/README.md +27 -0
  779. data/vendor/assets/components/tui-chart/docs/wiki/_Sidebar.md +31 -0
  780. data/vendor/assets/components/tui-chart/docs/wiki/chart-export-menu.md +66 -0
  781. data/vendor/assets/components/tui-chart/docs/wiki/chart-type-radial.md +121 -0
  782. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-bar,column.md +312 -0
  783. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-bubble.md +63 -0
  784. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-column-line-combo.md +104 -0
  785. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-heatmap.md +39 -0
  786. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line,area.md +333 -0
  787. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line-area-combo.md +78 -0
  788. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-line-scatter-combo.md +101 -0
  789. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-map.md +153 -0
  790. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-pie-donut-combo.md +98 -0
  791. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-pie.md +186 -0
  792. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-scatter.md +58 -0
  793. data/vendor/assets/components/tui-chart/docs/wiki/chart-types-treemap.md +158 -0
  794. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-china-map.md +38 -0
  795. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-japan-map.md +51 -0
  796. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-singapore-map.md +9 -0
  797. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-south-korea-map.md +21 -0
  798. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-taiwan-map.md +26 -0
  799. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-thailand-map.md +82 -0
  800. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-usa-map.md +55 -0
  801. data/vendor/assets/components/tui-chart/docs/wiki/code-table-of-world-map.md +180 -0
  802. data/vendor/assets/components/tui-chart/docs/wiki/features-axes.md +209 -0
  803. data/vendor/assets/components/tui-chart/docs/wiki/features-chart.md +157 -0
  804. data/vendor/assets/components/tui-chart/docs/wiki/features-circle-legend.md +20 -0
  805. data/vendor/assets/components/tui-chart/docs/wiki/features-legend.md +89 -0
  806. data/vendor/assets/components/tui-chart/docs/wiki/features-plot.md +141 -0
  807. data/vendor/assets/components/tui-chart/docs/wiki/features-series.md +240 -0
  808. data/vendor/assets/components/tui-chart/docs/wiki/features-tooltip.md +223 -0
  809. data/vendor/assets/components/tui-chart/docs/wiki/getting-started.md +74 -0
  810. data/vendor/assets/components/tui-chart/docs/wiki/import-chart-data-from-existing-table-element.md +150 -0
  811. data/vendor/assets/components/tui-chart/docs/wiki/table-of-supported-options.md +344 -0
  812. data/vendor/assets/components/tui-chart/docs/wiki/theme.md +338 -0
  813. data/vendor/assets/components/tui-chart/package-lock.json +8881 -0
  814. data/vendor/assets/components/tui-code-snippet/.bower.json +31 -0
  815. data/vendor/assets/components/tui-code-snippet/LICENSE +21 -0
  816. data/vendor/assets/components/tui-code-snippet/README.md +109 -0
  817. data/vendor/assets/components/tui-code-snippet/bower.json +20 -0
  818. data/vendor/assets/components/tui-code-snippet/demo/postBridge/README.md +26 -0
  819. data/vendor/assets/components/tui-code-snippet/demo/postBridge/public/popup.html +27 -0
  820. data/vendor/assets/components/tui-code-snippet/demo/postBridge/public/postBridge.html +31 -0
  821. data/vendor/assets/components/tui-code-snippet/demo/postBridge/server.js +28 -0
  822. data/vendor/assets/components/tui-code-snippet/dist/tui-code-snippet.js +4228 -0
  823. data/vendor/assets/components/tui-code-snippet/dist/tui-code-snippet.min.js +7 -0
  824. data/vendor/assets/components/tui-code-snippet/package-lock.json +6038 -0
  825. data/vendor/assets/components/tui-color-picker/.bower.json +37 -0
  826. data/vendor/assets/components/tui-color-picker/ISSUE_TEMPLATE.md +26 -0
  827. data/vendor/assets/components/tui-color-picker/LICENSE +34 -0
  828. data/vendor/assets/components/tui-color-picker/README.md +69 -0
  829. data/vendor/assets/components/tui-color-picker/bower.json +26 -0
  830. data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.css +148 -0
  831. data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.js +3146 -0
  832. data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.min.css +7 -0
  833. data/vendor/assets/components/tui-color-picker/dist/tui-color-picker.min.js +9 -0
  834. data/vendor/assets/components/tui-color-picker/package-lock.json +8440 -0
  835. data/vendor/assets/components/tui-editor/.bower.json +71 -0
  836. data/vendor/assets/components/tui-editor/CODE_OF_CONDUCT.md +73 -0
  837. data/vendor/assets/components/tui-editor/CONTRIBUTING.md +92 -0
  838. data/vendor/assets/components/tui-editor/LICENSE +21 -0
  839. data/vendor/assets/components/tui-editor/README.md +204 -0
  840. data/vendor/assets/components/tui-editor/bower.json +59 -0
  841. data/vendor/assets/components/tui-editor/dist/tui-editor-Editor-all.js +36850 -0
  842. data/vendor/assets/components/tui-editor/dist/tui-editor-Editor-all.min.js +13 -0
  843. data/vendor/assets/components/tui-editor/dist/tui-editor-Editor.js +24646 -0
  844. data/vendor/assets/components/tui-editor/dist/tui-editor-Editor.min.js +7 -0
  845. data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer-all.js +14768 -0
  846. data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer-all.min.js +13 -0
  847. data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer.js +3686 -0
  848. data/vendor/assets/components/tui-editor/dist/tui-editor-Viewer.min.js +7 -0
  849. data/vendor/assets/components/tui-editor/dist/tui-editor-contents.css +239 -0
  850. data/vendor/assets/components/tui-editor/dist/tui-editor-contents.min.css +1 -0
  851. data/vendor/assets/components/tui-editor/dist/tui-editor-extChart.js +7040 -0
  852. data/vendor/assets/components/tui-editor/dist/tui-editor-extChart.min.js +13 -0
  853. data/vendor/assets/components/tui-editor/dist/tui-editor-extColorSyntax.js +472 -0
  854. data/vendor/assets/components/tui-editor/dist/tui-editor-extColorSyntax.min.js +7 -0
  855. data/vendor/assets/components/tui-editor/dist/tui-editor-extScrollSync.js +1241 -0
  856. data/vendor/assets/components/tui-editor/dist/tui-editor-extScrollSync.min.js +7 -0
  857. data/vendor/assets/components/tui-editor/dist/tui-editor-extTable.js +3930 -0
  858. data/vendor/assets/components/tui-editor/dist/tui-editor-extTable.min.js +7 -0
  859. data/vendor/assets/components/tui-editor/dist/tui-editor-extUML.js +212 -0
  860. data/vendor/assets/components/tui-editor/dist/tui-editor-extUML.min.js +7 -0
  861. data/vendor/assets/components/tui-editor/dist/tui-editor.css +1166 -0
  862. data/vendor/assets/components/tui-editor/dist/tui-editor.min.css +1 -0
  863. data/vendor/assets/components/tui-editor/docs/COMMIT_MESSAGE_CONVENTION.md +49 -0
  864. data/vendor/assets/components/tui-editor/docs/PULL_REQUEST_TEMPLATE.md +41 -0
  865. data/vendor/assets/components/tui-editor/docs/README.md +13 -0
  866. data/vendor/assets/components/tui-editor/docs/getting-started-with-bower.md +93 -0
  867. data/vendor/assets/components/tui-editor/docs/getting-started.md +76 -0
  868. data/vendor/assets/components/tui-editor/docs/using-extensions.md +91 -0
  869. data/vendor/assets/components/tui-editor/docs/writing-your-own-extension.md +167 -0
  870. data/vendor/assets/components/tui-editor/examples/example00-demo.html +85 -0
  871. data/vendor/assets/components/tui-editor/examples/example01-basic.html +37 -0
  872. data/vendor/assets/components/tui-editor/examples/example02-viewer-basic.html +68 -0
  873. data/vendor/assets/components/tui-editor/examples/example03-jquery.html +36 -0
  874. data/vendor/assets/components/tui-editor/examples/example04-viewer-jquery.html +67 -0
  875. data/vendor/assets/components/tui-editor/examples/example05-scrollsync.html +77 -0
  876. data/vendor/assets/components/tui-editor/examples/example06-colorsyntax.html +44 -0
  877. data/vendor/assets/components/tui-editor/examples/example07-table.html +48 -0
  878. data/vendor/assets/components/tui-editor/examples/example08-uml.html +69 -0
  879. data/vendor/assets/components/tui-editor/examples/example09-multiple-extensions.html +85 -0
  880. data/vendor/assets/components/tui-editor/examples/example10-viewer-multiple-extensions.html +86 -0
  881. data/vendor/assets/components/tui-editor/examples/example11-chart.html +60 -0
  882. data/vendor/assets/components/tui-editor/examples/example12-writing-extension.html +66 -0
  883. data/vendor/assets/components/tui-editor/examples/examples.json +41 -0
  884. data/vendor/assets/components/tui-editor/examples/explain.css +7 -0
  885. data/vendor/assets/components/tui-editor/package-lock.json +13289 -0
  886. data/vendor/assets/components/tui-editor/package.json +90 -0
  887. metadata +956 -0
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "tui-code-snippet",
3
+ "authors": [
4
+ "NHNent. FE Development Lab <dl_javascript@nhnent.com>"
5
+ ],
6
+ "main": "dist/tui-code-snippet.js",
7
+ "license": "MIT",
8
+ "ignore": [
9
+ "**/.*",
10
+ ".*",
11
+ "node_modules",
12
+ "bower_components",
13
+ "src",
14
+ "test",
15
+ "jsdoc.conf.json",
16
+ "karma.conf.js",
17
+ "webpack.config.js",
18
+ "package.json"
19
+ ],
20
+ "homepage": "https://github.com/nhnent/tui.code-snippet",
21
+ "version": "1.2.9",
22
+ "_release": "1.2.9",
23
+ "_resolution": {
24
+ "type": "version",
25
+ "tag": "v1.2.9",
26
+ "commit": "a325b8740ea54dabf0712bd9fc3f864f32fe909e"
27
+ },
28
+ "_source": "https://github.com/nhnent/tui.code-snippet.git",
29
+ "_target": "^1.2.9",
30
+ "_originalSource": "tui-code-snippet"
31
+ }
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017 NHN Entertainment Corp.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,109 @@
1
+ # Toast UI CodeSnippet
2
+
3
+ `tui-code-snippet` is group of utility methods to make ease with developing javascript applications.
4
+
5
+ It includes several features like `class simulation`, `browser detecting`, `type checking` and +30 more.
6
+
7
+ `tui-code-snippet` supports IE8+ and modern browsers and already has been used for [open source javascript components](http://github.com/nhnent/) and many commercial projects in [NHNEnt](http://www.nhnent.com/en/index.nhn) corporation.
8
+
9
+ ## Feature
10
+ * browser.js
11
+ * Browser detecting modules
12
+ * collection.js
13
+ * Modules to Process collecitons
14
+ * Support util methods for collecitons
15
+ * customEvent.js
16
+ * Custom event modules
17
+ * Add/Remove/fire custom events
18
+ * defineClass.js
19
+ * Defined classes module
20
+ * enum.js
21
+ * Const value modules
22
+ * Making immutability values but IE8 low
23
+ * func.js
24
+ * Function modules
25
+ * hashMap.js
26
+ * Hash map modules
27
+ * Managing data by key/value
28
+ * inheritance.js
29
+ * Simple inheritance modules (Nicholas C. Zakas, YUI Library)
30
+ * Call supur constructor of superclass
31
+ * Have to get inheritance before define child
32
+ * Using mixin and inner object
33
+ * object.js
34
+ * Object modules
35
+ * Support utils to control object
36
+ * string.js
37
+ * String processing modules
38
+ * Support utils such as decodeHTMLEntity, encodeHTMLEntity
39
+ * type.js
40
+ * Check data type
41
+ * window.js
42
+ * Window object modules
43
+ * You need 'postDataBridgeUrl' options to avoid IE11 popup form submit bug.
44
+ * Different domain have x-domain issue.
45
+ * defineNamespace.js
46
+ * Support utils to define namespace
47
+ * formatDate.js
48
+ * Formating date strings modules
49
+ * defineModule.js
50
+ * Support utils to define modules
51
+
52
+ ## Documentation
53
+ * API: [https://nhnent.github.io/tui.code-snippet/latest/](https://nhnent.github.io/tui.code-snippet/latest/)
54
+ * Tutorial: [https://github.com/nhnent/fe.javascript/wiki/Toast-UI-CodeSnippet](https://github.com/nhnent/fe.javascript/wiki/Toast-UI-CodeSnippet)
55
+
56
+ ## Tested Browsers
57
+ * browser:
58
+ * IE8 ~ IE11
59
+ * Edge
60
+ * Chrome
61
+ * Firefox
62
+ * Safari
63
+
64
+ ## Usage
65
+ ### Use `npm`
66
+
67
+ Install the latest version using `npm` command:
68
+
69
+ ```
70
+ $ npm install tui-code-snippet --save
71
+ ```
72
+
73
+ or want to install the each version:
74
+
75
+ ```
76
+ $ npm install tui-code-snippet@<version> --save
77
+ ```
78
+
79
+ To access as module format in your code:
80
+
81
+ ```javascript
82
+ var util = require('tui-code-snippet');
83
+ ```
84
+
85
+ ### Use `bower`
86
+ Install the latest version using `bower` command:
87
+
88
+ ```
89
+ $ bower install tui-code-snippet
90
+ ```
91
+
92
+ or want to install the each version:
93
+
94
+ ```
95
+ $ bower install tui-code-snippet#<tag>
96
+ ```
97
+
98
+ To access as namespace format in your code:
99
+
100
+ ```javascript
101
+ var util = tui.util;
102
+ ```
103
+
104
+ ### Download
105
+ * [Download bundle files from `dist` folder](https://github.com/nhnent/tui.code-snippet/tree/production/dist)
106
+ * [Download all sources for each version](https://github.com/nhnent/tui.code-snippet/releases)
107
+
108
+ ## License
109
+ [MIT LICENSE](https://github.com/nhnent/tui.code-snippet/blob/master/LICENSE)
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "tui-code-snippet",
3
+ "authors": [
4
+ "NHNent. FE Development Lab <dl_javascript@nhnent.com>"
5
+ ],
6
+ "main": "dist/tui-code-snippet.js",
7
+ "license": "MIT",
8
+ "ignore": [
9
+ "**/.*",
10
+ ".*",
11
+ "node_modules",
12
+ "bower_components",
13
+ "src",
14
+ "test",
15
+ "jsdoc.conf.json",
16
+ "karma.conf.js",
17
+ "webpack.config.js",
18
+ "package.json"
19
+ ]
20
+ }
@@ -0,0 +1,26 @@
1
+ # Avoid IE11 popup POST bugs
2
+
3
+ IE11 can't post form data to popup window. [related issues](http://answers.microsoft.com/en-us/ie/forum/ie11-iewindows8_1/ie11-cant-post-form-data-to-specific-frame-or/481ba8d7-64cf-414f-b366-be9c809d9297?auth=1)
4
+
5
+ You can avoid this problem with `tui-code-snippet` popup module. please check this demo (demo/postBridge)
6
+
7
+ ## How to execute the demo
8
+
9
+ 1. install node dependency modules in project root
10
+
11
+ ```
12
+ npm i
13
+ ```
14
+
15
+ 2. execute demo server
16
+
17
+ ```
18
+ node demo/postBridge/server.js
19
+ ```
20
+
21
+ 3. connect demo page by several browsers
22
+
23
+ http://localhost:3000/popup.html
24
+
25
+
26
+ You can see the popup open and receive posted data properly.
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+ <title>Popup</title>
6
+ </head>
7
+ <body>
8
+ <div>
9
+ <input type="button" id="open-popup" value="open" />
10
+ </div>
11
+ <script type="text/javascript" charset="utf-8" src="code-snippet.js"></script>
12
+ <script type="text/javascript" charset="utf-8">
13
+ (function() {
14
+
15
+ document.getElementById('open-popup').onclick = function() {
16
+ tui.util.popup.openPopup('target', {
17
+ postBridgeUrl: 'postBridge.html',
18
+ popupOptionStr: 'width=600,height=400',
19
+ method: 'POST',
20
+ param: { a: 'b' }
21
+ });
22
+ };
23
+
24
+ })();
25
+ </script>
26
+ </body>
27
+ </html>
@@ -0,0 +1,31 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+ <title>PostBridge Example</title>
6
+ <script type="text/javascript" charset="utf-8">
7
+ function redirect(url, data) {
8
+ var form = document.createElement('form'),
9
+ textarea;
10
+
11
+ form.style.display = 'none';
12
+ form.setAttribute('method', 'POST');
13
+ form.setAttribute('action', url);
14
+
15
+ for (key in data) {
16
+ if (data.hasOwnProperty(key)) {
17
+ textarea = document.createElement('textarea');
18
+ textarea.setAttribute('name', key);
19
+ textarea.value = data[key];
20
+ form.appendChild(textarea);
21
+ }
22
+ }
23
+
24
+ document.body.appendChild(form);
25
+ form.submit();
26
+ }
27
+ </script>
28
+ </head>
29
+ <body>
30
+ </body>
31
+ </html>
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require('fs');
4
+ var express = require('express');
5
+ var bodyParser = require('body-parser');
6
+ var serveStatic = require('serve-static');
7
+
8
+ var app = express();
9
+
10
+ app.use(bodyParser.urlencoded({ extended: false }))
11
+ app.use(bodyParser.json())
12
+
13
+ // serving script file
14
+ app.use(serveStatic(__dirname + '/public', {
15
+ maxAge: '1d'
16
+ }))
17
+
18
+ // serving script file
19
+ app.get('/code-snippet.js', function(req, res) {
20
+ fs.createReadStream('../../code-snippet.js').pipe(res);
21
+ });
22
+
23
+ // post target
24
+ app.post('/target', function(req, res) {
25
+ res.send('data received: ' + JSON.stringify(req.body));
26
+ });
27
+
28
+ app.listen(3000);
@@ -0,0 +1,4228 @@
1
+ /*!
2
+ * tui-code-snippet.js
3
+ * @version 1.2.9
4
+ * @author NHNEnt FE Development Lab <dl_javascript@nhnent.com>
5
+ * @license MIT
6
+ */
7
+ (function webpackUniversalModuleDefinition(root, factory) {
8
+ if(typeof exports === 'object' && typeof module === 'object')
9
+ module.exports = factory();
10
+ else if(typeof define === 'function' && define.amd)
11
+ define([], factory);
12
+ else if(typeof exports === 'object')
13
+ exports["util"] = factory();
14
+ else
15
+ root["tui"] = root["tui"] || {}, root["tui"]["util"] = factory();
16
+ })(this, function() {
17
+ return /******/ (function(modules) { // webpackBootstrap
18
+ /******/ // The module cache
19
+ /******/ var installedModules = {};
20
+
21
+ /******/ // The require function
22
+ /******/ function __webpack_require__(moduleId) {
23
+
24
+ /******/ // Check if module is in cache
25
+ /******/ if(installedModules[moduleId])
26
+ /******/ return installedModules[moduleId].exports;
27
+
28
+ /******/ // Create a new module (and put it into the cache)
29
+ /******/ var module = installedModules[moduleId] = {
30
+ /******/ exports: {},
31
+ /******/ id: moduleId,
32
+ /******/ loaded: false
33
+ /******/ };
34
+
35
+ /******/ // Execute the module function
36
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
37
+
38
+ /******/ // Flag the module as loaded
39
+ /******/ module.loaded = true;
40
+
41
+ /******/ // Return the exports of the module
42
+ /******/ return module.exports;
43
+ /******/ }
44
+
45
+
46
+ /******/ // expose the modules object (__webpack_modules__)
47
+ /******/ __webpack_require__.m = modules;
48
+
49
+ /******/ // expose the module cache
50
+ /******/ __webpack_require__.c = installedModules;
51
+
52
+ /******/ // __webpack_public_path__
53
+ /******/ __webpack_require__.p = "dist";
54
+
55
+ /******/ // Load entry module and return exports
56
+ /******/ return __webpack_require__(0);
57
+ /******/ })
58
+ /************************************************************************/
59
+ /******/ ([
60
+ /* 0 */
61
+ /***/ (function(module, exports, __webpack_require__) {
62
+
63
+ 'use strict';
64
+
65
+ /**
66
+ * @fileoverview
67
+ * @author NHN Ent.
68
+ * FE Development Lab <dl_javascript@nhnent.com>
69
+ * @namespace tui.util
70
+ * @example
71
+ * // node, commonjs
72
+ * var util = require('tui-code-snippet');
73
+ * @example
74
+ * // distribution file, script
75
+ * <script src='path-to/tui-code-snippt.js'></script>
76
+ * <script>
77
+ * var util = tui.util;
78
+ * <script>
79
+ */
80
+ var util = {};
81
+ var object = __webpack_require__(1);
82
+ var extend = object.extend;
83
+
84
+ extend(util, object);
85
+ extend(util, __webpack_require__(3));
86
+ extend(util, __webpack_require__(2));
87
+ extend(util, __webpack_require__(4));
88
+ extend(util, __webpack_require__(5));
89
+ extend(util, __webpack_require__(6));
90
+ extend(util, __webpack_require__(7));
91
+ extend(util, __webpack_require__(8));
92
+
93
+ util.browser = __webpack_require__(9);
94
+ util.popup = __webpack_require__(10);
95
+ util.formatDate = __webpack_require__(11);
96
+ util.defineClass = __webpack_require__(12);
97
+ util.defineModule = __webpack_require__(13);
98
+ util.defineNamespace = __webpack_require__(14);
99
+ util.CustomEvents = __webpack_require__(15);
100
+ util.Enum = __webpack_require__(16);
101
+ util.ExMap = __webpack_require__(17);
102
+ util.HashMap = __webpack_require__(19);
103
+ util.Map = __webpack_require__(18);
104
+
105
+ module.exports = util;
106
+
107
+
108
+ /***/ }),
109
+ /* 1 */
110
+ /***/ (function(module, exports, __webpack_require__) {
111
+
112
+ /**
113
+ * @fileoverview This module has some functions for handling a plain object, json.
114
+ * @author NHN Ent.
115
+ * FE Development Lab <dl_javascript@nhnent.com>
116
+ */
117
+
118
+ 'use strict';
119
+
120
+ var type = __webpack_require__(2);
121
+ var array = __webpack_require__(3);
122
+
123
+ /**
124
+ * The last id of stamp
125
+ * @type {number}
126
+ * @private
127
+ */
128
+ var lastId = 0;
129
+
130
+ /**
131
+ * Extend the target object from other objects.
132
+ * @param {object} target - Object that will be extended
133
+ * @param {...object} objects - Objects as sources
134
+ * @returns {object} Extended object
135
+ * @memberof tui.util
136
+ */
137
+ function extend(target, objects) { // eslint-disable-line no-unused-vars
138
+ var hasOwnProp = Object.prototype.hasOwnProperty;
139
+ var source, prop, i, len;
140
+
141
+ for (i = 1, len = arguments.length; i < len; i += 1) {
142
+ source = arguments[i];
143
+ for (prop in source) {
144
+ if (hasOwnProp.call(source, prop)) {
145
+ target[prop] = source[prop];
146
+ }
147
+ }
148
+ }
149
+
150
+ return target;
151
+ }
152
+
153
+ /**
154
+ * Assign a unique id to an object
155
+ * @param {object} obj - Object that will be assigned id.
156
+ * @returns {number} Stamped id
157
+ * @memberof tui.util
158
+ */
159
+ function stamp(obj) {
160
+ if (!obj.__fe_id) {
161
+ lastId += 1;
162
+ obj.__fe_id = lastId; // eslint-disable-line camelcase
163
+ }
164
+
165
+ return obj.__fe_id;
166
+ }
167
+
168
+ /**
169
+ * Verify whether an object has a stamped id or not.
170
+ * @param {object} obj - adjusted object
171
+ * @returns {boolean}
172
+ * @memberof tui.util
173
+ */
174
+ function hasStamp(obj) {
175
+ return type.isExisty(pick(obj, '__fe_id'));
176
+ }
177
+
178
+ /**
179
+ * Reset the last id of stamp
180
+ * @private
181
+ */
182
+ function resetLastId() {
183
+ lastId = 0;
184
+ }
185
+
186
+ /**
187
+ * Return a key-list(array) of a given object
188
+ * @param {object} obj - Object from which a key-list will be extracted
189
+ * @returns {Array} A key-list(array)
190
+ * @memberof tui.util
191
+ */
192
+ function keys(obj) {
193
+ var keyArray = [];
194
+ var key;
195
+
196
+ for (key in obj) {
197
+ if (obj.hasOwnProperty(key)) {
198
+ keyArray.push(key);
199
+ }
200
+ }
201
+
202
+ return keyArray;
203
+ }
204
+
205
+ /**
206
+ * Return the equality for multiple objects(jsonObjects).<br>
207
+ * See {@link http://stackoverflow.com/questions/1068834/object-comparison-in-javascript}
208
+ * @param {...object} object - Multiple objects for comparing.
209
+ * @returns {boolean} Equality
210
+ * @memberof tui.util
211
+ * @example
212
+ * //-- #1. Get Module --//
213
+ * var util = require('tui-code-snippet'); // node, commonjs
214
+ * var util = tui.util; // distribution file
215
+ *
216
+ * //-- #2. Use property --//
217
+ * var jsonObj1 = {name:'milk', price: 1000};
218
+ * var jsonObj2 = {name:'milk', price: 1000};
219
+ * var jsonObj3 = {name:'milk', price: 1000};
220
+ * util.compareJSON(jsonObj1, jsonObj2, jsonObj3); // true
221
+ *
222
+ * var jsonObj4 = {name:'milk', price: 1000};
223
+ * var jsonObj5 = {name:'beer', price: 3000};
224
+ * util.compareJSON(jsonObj4, jsonObj5); // false
225
+ */
226
+ function compareJSON(object) {
227
+ var argsLen = arguments.length;
228
+ var i = 1;
229
+
230
+ if (argsLen < 1) {
231
+ return true;
232
+ }
233
+
234
+ for (; i < argsLen; i += 1) {
235
+ if (!isSameObject(object, arguments[i])) {
236
+ return false;
237
+ }
238
+ }
239
+
240
+ return true;
241
+ }
242
+
243
+ /**
244
+ * @param {*} x - object to compare
245
+ * @param {*} y - object to compare
246
+ * @returns {boolean} - whether object x and y is same or not
247
+ * @private
248
+ */
249
+ function isSameObject(x, y) { // eslint-disable-line complexity
250
+ var leftChain = [];
251
+ var rightChain = [];
252
+ var p;
253
+
254
+ // remember that NaN === NaN returns false
255
+ // and isNaN(undefined) returns true
256
+ if (isNaN(x) &&
257
+ isNaN(y) &&
258
+ type.isNumber(x) &&
259
+ type.isNumber(y)) {
260
+ return true;
261
+ }
262
+
263
+ // Compare primitives and functions.
264
+ // Check if both arguments link to the same object.
265
+ // Especially useful on step when comparing prototypes
266
+ if (x === y) {
267
+ return true;
268
+ }
269
+
270
+ // Works in case when functions are created in constructor.
271
+ // Comparing dates is a common scenario. Another built-ins?
272
+ // We can even handle functions passed across iframes
273
+ if ((type.isFunction(x) && type.isFunction(y)) ||
274
+ (x instanceof Date && y instanceof Date) ||
275
+ (x instanceof RegExp && y instanceof RegExp) ||
276
+ (x instanceof String && y instanceof String) ||
277
+ (x instanceof Number && y instanceof Number)) {
278
+ return x.toString() === y.toString();
279
+ }
280
+
281
+ // At last checking prototypes as good a we can
282
+ if (!(x instanceof Object && y instanceof Object)) {
283
+ return false;
284
+ }
285
+
286
+ if (x.isPrototypeOf(y) ||
287
+ y.isPrototypeOf(x) ||
288
+ x.constructor !== y.constructor ||
289
+ x.prototype !== y.prototype) {
290
+ return false;
291
+ }
292
+
293
+ // check for infinitive linking loops
294
+ if (array.inArray(x, leftChain) > -1 ||
295
+ array.inArray(y, rightChain) > -1) {
296
+ return false;
297
+ }
298
+
299
+ // Quick checking of one object beeing a subset of another.
300
+ for (p in y) {
301
+ if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {
302
+ return false;
303
+ } else if (typeof y[p] !== typeof x[p]) {
304
+ return false;
305
+ }
306
+ }
307
+
308
+ // This for loop executes comparing with hasOwnProperty() and typeof for each property in 'x' object,
309
+ // and verifying equality for x[property] and y[property].
310
+ for (p in x) {
311
+ if (y.hasOwnProperty(p) !== x.hasOwnProperty(p)) {
312
+ return false;
313
+ } else if (typeof y[p] !== typeof x[p]) {
314
+ return false;
315
+ }
316
+
317
+ if (typeof (x[p]) === 'object' || typeof (x[p]) === 'function') {
318
+ leftChain.push(x);
319
+ rightChain.push(y);
320
+
321
+ if (!isSameObject(x[p], y[p])) {
322
+ return false;
323
+ }
324
+
325
+ leftChain.pop();
326
+ rightChain.pop();
327
+ } else if (x[p] !== y[p]) {
328
+ return false;
329
+ }
330
+ }
331
+
332
+ return true;
333
+ }
334
+ /* eslint-enable complexity */
335
+
336
+ /**
337
+ * Retrieve a nested item from the given object/array
338
+ * @param {object|Array} obj - Object for retrieving
339
+ * @param {...string|number} paths - Paths of property
340
+ * @returns {*} Value
341
+ * @memberof tui.util
342
+ * @example
343
+ * //-- #1. Get Module --//
344
+ * var util = require('tui-code-snippet'); // node, commonjs
345
+ * var util = tui.util; // distribution file
346
+ *
347
+ * //-- #2. Use property --//
348
+ * var obj = {
349
+ * 'key1': 1,
350
+ * 'nested' : {
351
+ * 'key1': 11,
352
+ * 'nested': {
353
+ * 'key1': 21
354
+ * }
355
+ * }
356
+ * };
357
+ * util.pick(obj, 'nested', 'nested', 'key1'); // 21
358
+ * util.pick(obj, 'nested', 'nested', 'key2'); // undefined
359
+ *
360
+ * var arr = ['a', 'b', 'c'];
361
+ * util.pick(arr, 1); // 'b'
362
+ */
363
+ function pick(obj, paths) { // eslint-disable-line no-unused-vars
364
+ var args = arguments;
365
+ var target = args[0];
366
+ var i = 1;
367
+ var length = args.length;
368
+
369
+ for (; i < length; i += 1) {
370
+ if (type.isUndefined(target) ||
371
+ type.isNull(target)) {
372
+ return;
373
+ }
374
+
375
+ target = target[args[i]];
376
+ }
377
+
378
+ return target; // eslint-disable-line consistent-return
379
+ }
380
+
381
+ module.exports = {
382
+ extend: extend,
383
+ stamp: stamp,
384
+ hasStamp: hasStamp,
385
+ resetLastId: resetLastId,
386
+ keys: Object.prototype.keys || keys,
387
+ compareJSON: compareJSON,
388
+ pick: pick
389
+ };
390
+
391
+
392
+ /***/ }),
393
+ /* 2 */
394
+ /***/ (function(module, exports) {
395
+
396
+ /**
397
+ * @fileoverview This module provides some functions to check the type of variable
398
+ * @author NHN Ent.
399
+ * FE Development Lab <dl_javascript@nhnent.com>
400
+ */
401
+
402
+ 'use strict';
403
+
404
+ var toString = Object.prototype.toString;
405
+
406
+ /**
407
+ * Check whether the given variable is existing or not.<br>
408
+ * If the given variable is not null and not undefined, returns true.
409
+ * @param {*} param - Target for checking
410
+ * @returns {boolean} Is existy?
411
+ * @memberof tui.util
412
+ * @example
413
+ * //-- #1. Get Module --//
414
+ * var util = require('tui-code-snippet'); // node, commonjs
415
+ * var util = tui.util; // distribution file
416
+ *
417
+ * //-- #2. Use property --//
418
+ * util.isExisty(''); //true
419
+ * util.isExisty(0); //true
420
+ * util.isExisty([]); //true
421
+ * util.isExisty({}); //true
422
+ * util.isExisty(null); //false
423
+ * util.isExisty(undefined); //false
424
+ */
425
+ function isExisty(param) {
426
+ return !isUndefined(param) && !isNull(param);
427
+ }
428
+
429
+ /**
430
+ * Check whether the given variable is undefined or not.<br>
431
+ * If the given variable is undefined, returns true.
432
+ * @param {*} obj - Target for checking
433
+ * @returns {boolean} Is undefined?
434
+ * @memberof tui.util
435
+ */
436
+ function isUndefined(obj) {
437
+ return obj === undefined; // eslint-disable-line no-undefined
438
+ }
439
+
440
+ /**
441
+ * Check whether the given variable is null or not.<br>
442
+ * If the given variable(arguments[0]) is null, returns true.
443
+ * @param {*} obj - Target for checking
444
+ * @returns {boolean} Is null?
445
+ * @memberof tui.util
446
+ */
447
+ function isNull(obj) {
448
+ return obj === null;
449
+ }
450
+
451
+ /**
452
+ * Check whether the given variable is truthy or not.<br>
453
+ * If the given variable is not null or not undefined or not false, returns true.<br>
454
+ * (It regards 0 as true)
455
+ * @param {*} obj - Target for checking
456
+ * @returns {boolean} Is truthy?
457
+ * @memberof tui.util
458
+ */
459
+ function isTruthy(obj) {
460
+ return isExisty(obj) && obj !== false;
461
+ }
462
+
463
+ /**
464
+ * Check whether the given variable is falsy or not.<br>
465
+ * If the given variable is null or undefined or false, returns true.
466
+ * @param {*} obj - Target for checking
467
+ * @returns {boolean} Is falsy?
468
+ * @memberof tui.util
469
+ */
470
+ function isFalsy(obj) {
471
+ return !isTruthy(obj);
472
+ }
473
+
474
+ /**
475
+ * Check whether the given variable is an arguments object or not.<br>
476
+ * If the given variable is an arguments object, return true.
477
+ * @param {*} obj - Target for checking
478
+ * @returns {boolean} Is arguments?
479
+ * @memberof tui.util
480
+ */
481
+ function isArguments(obj) {
482
+ var result = isExisty(obj) &&
483
+ ((toString.call(obj) === '[object Arguments]') || !!obj.callee);
484
+
485
+ return result;
486
+ }
487
+
488
+ /**
489
+ * Check whether the given variable is an instance of Array or not.<br>
490
+ * If the given variable is an instance of Array, return true.
491
+ * @param {*} obj - Target for checking
492
+ * @returns {boolean} Is array instance?
493
+ * @memberof tui.util
494
+ */
495
+ function isArray(obj) {
496
+ return obj instanceof Array;
497
+ }
498
+
499
+ /**
500
+ * Check whether the given variable is an object or not.<br>
501
+ * If the given variable is an object, return true.
502
+ * @param {*} obj - Target for checking
503
+ * @returns {boolean} Is object?
504
+ * @memberof tui.util
505
+ */
506
+ function isObject(obj) {
507
+ return obj === Object(obj);
508
+ }
509
+
510
+ /**
511
+ * Check whether the given variable is a function or not.<br>
512
+ * If the given variable is a function, return true.
513
+ * @param {*} obj - Target for checking
514
+ * @returns {boolean} Is function?
515
+ * @memberof tui.util
516
+ */
517
+ function isFunction(obj) {
518
+ return obj instanceof Function;
519
+ }
520
+
521
+ /**
522
+ * Check whether the given variable is a number or not.<br>
523
+ * If the given variable is a number, return true.
524
+ * @param {*} obj - Target for checking
525
+ * @returns {boolean} Is number?
526
+ * @memberof tui.util
527
+ */
528
+ function isNumber(obj) {
529
+ return typeof obj === 'number' || obj instanceof Number;
530
+ }
531
+
532
+ /**
533
+ * Check whether the given variable is a string or not.<br>
534
+ * If the given variable is a string, return true.
535
+ * @param {*} obj - Target for checking
536
+ * @returns {boolean} Is string?
537
+ * @memberof tui.util
538
+ */
539
+ function isString(obj) {
540
+ return typeof obj === 'string' || obj instanceof String;
541
+ }
542
+
543
+ /**
544
+ * Check whether the given variable is a boolean or not.<br>
545
+ * If the given variable is a boolean, return true.
546
+ * @param {*} obj - Target for checking
547
+ * @returns {boolean} Is boolean?
548
+ * @memberof tui.util
549
+ */
550
+ function isBoolean(obj) {
551
+ return typeof obj === 'boolean' || obj instanceof Boolean;
552
+ }
553
+
554
+ /**
555
+ * Check whether the given variable is an instance of Array or not.<br>
556
+ * If the given variable is an instance of Array, return true.<br>
557
+ * (It is used for multiple frame environments)
558
+ * @param {*} obj - Target for checking
559
+ * @returns {boolean} Is an instance of array?
560
+ * @memberof tui.util
561
+ */
562
+ function isArraySafe(obj) {
563
+ return toString.call(obj) === '[object Array]';
564
+ }
565
+
566
+ /**
567
+ * Check whether the given variable is a function or not.<br>
568
+ * If the given variable is a function, return true.<br>
569
+ * (It is used for multiple frame environments)
570
+ * @param {*} obj - Target for checking
571
+ * @returns {boolean} Is a function?
572
+ * @memberof tui.util
573
+ */
574
+ function isFunctionSafe(obj) {
575
+ return toString.call(obj) === '[object Function]';
576
+ }
577
+
578
+ /**
579
+ * Check whether the given variable is a number or not.<br>
580
+ * If the given variable is a number, return true.<br>
581
+ * (It is used for multiple frame environments)
582
+ * @param {*} obj - Target for checking
583
+ * @returns {boolean} Is a number?
584
+ * @memberof tui.util
585
+ */
586
+ function isNumberSafe(obj) {
587
+ return toString.call(obj) === '[object Number]';
588
+ }
589
+
590
+ /**
591
+ * Check whether the given variable is a string or not.<br>
592
+ * If the given variable is a string, return true.<br>
593
+ * (It is used for multiple frame environments)
594
+ * @param {*} obj - Target for checking
595
+ * @returns {boolean} Is a string?
596
+ * @memberof tui.util
597
+ */
598
+ function isStringSafe(obj) {
599
+ return toString.call(obj) === '[object String]';
600
+ }
601
+
602
+ /**
603
+ * Check whether the given variable is a boolean or not.<br>
604
+ * If the given variable is a boolean, return true.<br>
605
+ * (It is used for multiple frame environments)
606
+ * @param {*} obj - Target for checking
607
+ * @returns {boolean} Is a boolean?
608
+ * @memberof tui.util
609
+ */
610
+ function isBooleanSafe(obj) {
611
+ return toString.call(obj) === '[object Boolean]';
612
+ }
613
+
614
+ /**
615
+ * Check whether the given variable is a instance of HTMLNode or not.<br>
616
+ * If the given variables is a instance of HTMLNode, return true.
617
+ * @param {*} html - Target for checking
618
+ * @returns {boolean} Is HTMLNode ?
619
+ * @memberof tui.util
620
+ */
621
+ function isHTMLNode(html) {
622
+ if (typeof HTMLElement === 'object') {
623
+ return (html && (html instanceof HTMLElement || !!html.nodeType));
624
+ }
625
+
626
+ return !!(html && html.nodeType);
627
+ }
628
+
629
+ /**
630
+ * Check whether the given variable is a HTML tag or not.<br>
631
+ * If the given variables is a HTML tag, return true.
632
+ * @param {*} html - Target for checking
633
+ * @returns {Boolean} Is HTML tag?
634
+ * @memberof tui.util
635
+ */
636
+ function isHTMLTag(html) {
637
+ if (typeof HTMLElement === 'object') {
638
+ return (html && (html instanceof HTMLElement));
639
+ }
640
+
641
+ return !!(html && html.nodeType && html.nodeType === 1);
642
+ }
643
+
644
+ /**
645
+ * Check whether the given variable is empty(null, undefined, or empty array, empty object) or not.<br>
646
+ * If the given variables is empty, return true.
647
+ * @param {*} obj - Target for checking
648
+ * @returns {boolean} Is empty?
649
+ * @memberof tui.util
650
+ */
651
+ function isEmpty(obj) {
652
+ if (!isExisty(obj) || _isEmptyString(obj)) {
653
+ return true;
654
+ }
655
+
656
+ if (isArray(obj) || isArguments(obj)) {
657
+ return obj.length === 0;
658
+ }
659
+
660
+ if (isObject(obj) && !isFunction(obj)) {
661
+ return !_hasOwnProperty(obj);
662
+ }
663
+
664
+ return true;
665
+ }
666
+
667
+ /**
668
+ * Check whether given argument is empty string
669
+ * @param {*} obj - Target for checking
670
+ * @returns {boolean} whether given argument is empty string
671
+ * @memberof tui.util
672
+ * @private
673
+ */
674
+ function _isEmptyString(obj) {
675
+ return isString(obj) && obj === '';
676
+ }
677
+
678
+ /**
679
+ * Check whether given argument has own property
680
+ * @param {Object} obj - Target for checking
681
+ * @returns {boolean} - whether given argument has own property
682
+ * @memberof tui.util
683
+ * @private
684
+ */
685
+ function _hasOwnProperty(obj) {
686
+ var key;
687
+ for (key in obj) {
688
+ if (obj.hasOwnProperty(key)) {
689
+ return true;
690
+ }
691
+ }
692
+
693
+ return false;
694
+ }
695
+
696
+ /**
697
+ * Check whether the given variable is not empty
698
+ * (not null, not undefined, or not empty array, not empty object) or not.<br>
699
+ * If the given variables is not empty, return true.
700
+ * @param {*} obj - Target for checking
701
+ * @returns {boolean} Is not empty?
702
+ * @memberof tui.util
703
+ */
704
+ function isNotEmpty(obj) {
705
+ return !isEmpty(obj);
706
+ }
707
+
708
+ /**
709
+ * Check whether the given variable is an instance of Date or not.<br>
710
+ * If the given variables is an instance of Date, return true.
711
+ * @param {*} obj - Target for checking
712
+ * @returns {boolean} Is an instance of Date?
713
+ * @memberof tui.util
714
+ */
715
+ function isDate(obj) {
716
+ return obj instanceof Date;
717
+ }
718
+
719
+ /**
720
+ * Check whether the given variable is an instance of Date or not.<br>
721
+ * If the given variables is an instance of Date, return true.<br>
722
+ * (It is used for multiple frame environments)
723
+ * @param {*} obj - Target for checking
724
+ * @returns {boolean} Is an instance of Date?
725
+ * @memberof tui.util
726
+ */
727
+ function isDateSafe(obj) {
728
+ return toString.call(obj) === '[object Date]';
729
+ }
730
+
731
+ module.exports = {
732
+ isExisty: isExisty,
733
+ isUndefined: isUndefined,
734
+ isNull: isNull,
735
+ isTruthy: isTruthy,
736
+ isFalsy: isFalsy,
737
+ isArguments: isArguments,
738
+ isArray: isArray,
739
+ isArraySafe: isArraySafe,
740
+ isObject: isObject,
741
+ isFunction: isFunction,
742
+ isFunctionSafe: isFunctionSafe,
743
+ isNumber: isNumber,
744
+ isNumberSafe: isNumberSafe,
745
+ isDate: isDate,
746
+ isDateSafe: isDateSafe,
747
+ isString: isString,
748
+ isStringSafe: isStringSafe,
749
+ isBoolean: isBoolean,
750
+ isBooleanSafe: isBooleanSafe,
751
+ isHTMLNode: isHTMLNode,
752
+ isHTMLTag: isHTMLTag,
753
+ isEmpty: isEmpty,
754
+ isNotEmpty: isNotEmpty
755
+ };
756
+
757
+
758
+ /***/ }),
759
+ /* 3 */
760
+ /***/ (function(module, exports, __webpack_require__) {
761
+
762
+ /**
763
+ * @fileoverview This module has some functions for handling array.
764
+ * @author NHN Ent.
765
+ * FE Development Lab <dl_javascript@nhnent.com>
766
+ */
767
+
768
+ 'use strict';
769
+
770
+ var collection = __webpack_require__(4);
771
+ var type = __webpack_require__(2);
772
+
773
+ var aps = Array.prototype.slice;
774
+ var util;
775
+
776
+ /**
777
+ * Generate an integer Array containing an arithmetic progression.
778
+ * @param {number} start - start index
779
+ * @param {number} stop - stop index
780
+ * @param {number} step - next visit index = current index + step
781
+ * @returns {Array}
782
+ * @memberof tui.util
783
+ * @example
784
+ * //-- #1. Get Module --//
785
+ * var util = require('tui-code-snippet'); // node, commonjs
786
+ * var util = tui.util; // distribution file
787
+ *
788
+ * //-- #2. Use property --//
789
+ * util.range(5); // [0, 1, 2, 3, 4]
790
+ * util.range(1, 5); // [1,2,3,4]
791
+ * util.range(2, 10, 2); // [2,4,6,8]
792
+ * util.range(10, 2, -2); // [10,8,6,4]
793
+ */
794
+ var range = function(start, stop, step) {
795
+ var arr = [];
796
+ var flag;
797
+
798
+ if (type.isUndefined(stop)) {
799
+ stop = start || 0;
800
+ start = 0;
801
+ }
802
+
803
+ step = step || 1;
804
+ flag = step < 0 ? -1 : 1;
805
+ stop *= flag;
806
+
807
+ for (; start * flag < stop; start += step) {
808
+ arr.push(start);
809
+ }
810
+
811
+ return arr;
812
+ };
813
+
814
+ /* eslint-disable valid-jsdoc */
815
+ /**
816
+ * Zip together multiple lists into a single array
817
+ * @param {...Array}
818
+ * @returns {Array}
819
+ * @memberof tui.util
820
+ * @example
821
+ * //-- #1. Get Module --//
822
+ * var util = require('tui-code-snippet'); // node, commonjs
823
+ * var util = tui.util; // distribution file
824
+ *
825
+ * //-- #2. Use property --//
826
+ * var result = util.zip([1, 2, 3], ['a', 'b','c'], [true, false, true]);
827
+ * console.log(result[0]); // [1, 'a', true]
828
+ * console.log(result[1]); // [2, 'b', false]
829
+ * console.log(result[2]); // [3, 'c', true]
830
+ */
831
+ var zip = function() {/* eslint-enable valid-jsdoc */
832
+ var arr2d = aps.call(arguments);
833
+ var result = [];
834
+
835
+ collection.forEach(arr2d, function(arr) {
836
+ collection.forEach(arr, function(value, index) {
837
+ if (!result[index]) {
838
+ result[index] = [];
839
+ }
840
+ result[index].push(value);
841
+ });
842
+ });
843
+
844
+ return result;
845
+ };
846
+
847
+ /**
848
+ * Returns the first index at which a given element can be found in the array
849
+ * from start index(default 0), or -1 if it is not present.<br>
850
+ * It compares searchElement to elements of the Array using strict equality
851
+ * (the same method used by the ===, or triple-equals, operator).
852
+ * @param {*} searchElement Element to locate in the array
853
+ * @param {Array} array Array that will be traversed.
854
+ * @param {number} startIndex Start index in array for searching (default 0)
855
+ * @returns {number} the First index at which a given element, or -1 if it is not present
856
+ * @memberof tui.util
857
+ * @example
858
+ * //-- #1. Get Module --//
859
+ * var util = require('tui-code-snippet'); // node, commonjs
860
+ * var util = tui.util; // distribution file
861
+ *
862
+ * //-- #2. Use property --//
863
+ * var arr = ['one', 'two', 'three', 'four'];
864
+ * var idx1 = util.inArray('one', arr, 3); // -1
865
+ * var idx2 = util.inArray('one', arr); // 0
866
+ */
867
+ var inArray = function(searchElement, array, startIndex) {
868
+ var i;
869
+ var length;
870
+ startIndex = startIndex || 0;
871
+
872
+ if (!type.isArray(array)) {
873
+ return -1;
874
+ }
875
+
876
+ if (Array.prototype.indexOf) {
877
+ return Array.prototype.indexOf.call(array, searchElement, startIndex);
878
+ }
879
+
880
+ length = array.length;
881
+ for (i = startIndex; startIndex >= 0 && i < length; i += 1) {
882
+ if (array[i] === searchElement) {
883
+ return i;
884
+ }
885
+ }
886
+
887
+ return -1;
888
+ };
889
+
890
+ util = {
891
+ inArray: inArray,
892
+ range: range,
893
+ zip: zip
894
+ };
895
+
896
+ module.exports = util;
897
+
898
+
899
+ /***/ }),
900
+ /* 4 */
901
+ /***/ (function(module, exports, __webpack_require__) {
902
+
903
+ /**
904
+ * @fileoverview This module has some functions for handling object as collection.
905
+ * @author NHN Ent.
906
+ * FE Development Lab <dl_javascript@nhnent.com>
907
+ */
908
+
909
+ 'use strict';
910
+
911
+ var type = __webpack_require__(2);
912
+ var object = __webpack_require__(1);
913
+
914
+ /**
915
+ * Execute the provided callback once for each element present
916
+ * in the array(or Array-like object) in ascending order.<br>
917
+ * If the callback function returns false, the loop will be stopped.<br>
918
+ * Callback function(iteratee) is invoked with three arguments:
919
+ * - The value of the element
920
+ * - The index of the element
921
+ * - The array(or Array-like object) being traversed
922
+ * @param {Array} arr The array(or Array-like object) that will be traversed
923
+ * @param {function} iteratee Callback function
924
+ * @param {Object} [context] Context(this) of callback function
925
+ * @memberof tui.util
926
+ * //-- #1. Get Module --//
927
+ * var util = require('tui-code-snippet'); // node, commonjs
928
+ * var util = tui.util; // distribution file
929
+ *
930
+ * //-- #2. Use property --//
931
+ * var sum = 0;
932
+ *
933
+ * util.forEachArray([1,2,3], function(value){
934
+ * sum += value;
935
+ * });
936
+ * alert(sum); // 6
937
+ */
938
+ function forEachArray(arr, iteratee, context) {
939
+ var index = 0;
940
+ var len = arr.length;
941
+
942
+ context = context || null;
943
+
944
+ for (; index < len; index += 1) {
945
+ if (iteratee.call(context, arr[index], index, arr) === false) {
946
+ break;
947
+ }
948
+ }
949
+ }
950
+
951
+ /**
952
+ * Execute the provided callback once for each property of object which actually exist.<br>
953
+ * If the callback function returns false, the loop will be stopped.<br>
954
+ * Callback function(iteratee) is invoked with three arguments:
955
+ * - The value of the property
956
+ * - The name of the property
957
+ * - The object being traversed
958
+ * @param {Object} obj The object that will be traversed
959
+ * @param {function} iteratee Callback function
960
+ * @param {Object} [context] Context(this) of callback function
961
+ * @memberof tui.util
962
+ * @example
963
+ * //-- #1. Get Module --//
964
+ * var util = require('tui-code-snippet'); // node, commonjs
965
+ * var util = tui.util; // distribution file
966
+ *
967
+ * //-- #2. Use property --//
968
+ * var sum = 0;
969
+ *
970
+ * util.forEachOwnProperties({a:1,b:2,c:3}, function(value){
971
+ * sum += value;
972
+ * });
973
+ * alert(sum); // 6
974
+ **/
975
+ function forEachOwnProperties(obj, iteratee, context) {
976
+ var key;
977
+
978
+ context = context || null;
979
+
980
+ for (key in obj) {
981
+ if (obj.hasOwnProperty(key)) {
982
+ if (iteratee.call(context, obj[key], key, obj) === false) {
983
+ break;
984
+ }
985
+ }
986
+ }
987
+ }
988
+
989
+ /**
990
+ * Execute the provided callback once for each property of object(or element of array) which actually exist.<br>
991
+ * If the object is Array-like object(ex-arguments object), It needs to transform to Array.(see 'ex2' of example).<br>
992
+ * If the callback function returns false, the loop will be stopped.<br>
993
+ * Callback function(iteratee) is invoked with three arguments:
994
+ * - The value of the property(or The value of the element)
995
+ * - The name of the property(or The index of the element)
996
+ * - The object being traversed
997
+ * @param {Object} obj The object that will be traversed
998
+ * @param {function} iteratee Callback function
999
+ * @param {Object} [context] Context(this) of callback function
1000
+ * @memberof tui.util
1001
+ * //-- #1. Get Module --//
1002
+ * var util = require('tui-code-snippet'); // node, commonjs
1003
+ * var util = tui.util; // distribution file
1004
+ *
1005
+ * //-- #2. Use property --//
1006
+ * var sum = 0;
1007
+ *
1008
+ * util.forEach([1,2,3], function(value){
1009
+ * sum += value;
1010
+ * });
1011
+ * alert(sum); // 6
1012
+ *
1013
+ * // In case of Array-like object
1014
+ * var array = Array.prototype.slice.call(arrayLike); // change to array
1015
+ * util.forEach(array, function(value){
1016
+ * sum += value;
1017
+ * });
1018
+ */
1019
+ function forEach(obj, iteratee, context) {
1020
+ if (type.isArray(obj)) {
1021
+ forEachArray(obj, iteratee, context);
1022
+ } else {
1023
+ forEachOwnProperties(obj, iteratee, context);
1024
+ }
1025
+ }
1026
+
1027
+ /**
1028
+ * Execute the provided callback function once for each element in an array, in order,
1029
+ * and constructs a new array from the results.<br>
1030
+ * If the object is Array-like object(ex-arguments object),
1031
+ * It needs to transform to Array.(see 'ex2' of forEach example)<br>
1032
+ * Callback function(iteratee) is invoked with three arguments:
1033
+ * - The value of the property(or The value of the element)
1034
+ * - The name of the property(or The index of the element)
1035
+ * - The object being traversed
1036
+ * @param {Object} obj The object that will be traversed
1037
+ * @param {function} iteratee Callback function
1038
+ * @param {Object} [context] Context(this) of callback function
1039
+ * @returns {Array} A new array composed of returned values from callback function
1040
+ * @memberof tui.util
1041
+ * //-- #1. Get Module --//
1042
+ * var util = require('tui-code-snippet'); // node, commonjs
1043
+ * var util = tui.util; // distribution file
1044
+ *
1045
+ * //-- #2. Use property --//
1046
+ * var result = util.map([0,1,2,3], function(value) {
1047
+ * return value + 1;
1048
+ * });
1049
+ *
1050
+ * alert(result); // 1,2,3,4
1051
+ */
1052
+ function map(obj, iteratee, context) {
1053
+ var resultArray = [];
1054
+
1055
+ context = context || null;
1056
+
1057
+ forEach(obj, function() {
1058
+ resultArray.push(iteratee.apply(context, arguments));
1059
+ });
1060
+
1061
+ return resultArray;
1062
+ }
1063
+
1064
+ /**
1065
+ * Execute the callback function once for each element present in the array(or Array-like object or plain object).<br>
1066
+ * If the object is Array-like object(ex-arguments object),
1067
+ * It needs to transform to Array.(see 'ex2' of forEach example)<br>
1068
+ * Callback function(iteratee) is invoked with four arguments:
1069
+ * - The previousValue
1070
+ * - The currentValue
1071
+ * - The index
1072
+ * - The object being traversed
1073
+ * @param {Object} obj The object that will be traversed
1074
+ * @param {function} iteratee Callback function
1075
+ * @param {Object} [context] Context(this) of callback function
1076
+ * @returns {*} The result value
1077
+ * @memberof tui.util
1078
+ * @example
1079
+ * //-- #1. Get Module --//
1080
+ * var util = require('tui-code-snippet'); // node, commonjs
1081
+ * var util = tui.util; // distribution file
1082
+ *
1083
+ * //-- #2. Use property --//
1084
+ * var result = util.reduce([0,1,2,3], function(stored, value) {
1085
+ * return stored + value;
1086
+ * });
1087
+ *
1088
+ * alert(result); // 6
1089
+ */
1090
+ function reduce(obj, iteratee, context) {
1091
+ var index = 0;
1092
+ var keys, length, store;
1093
+
1094
+ context = context || null;
1095
+
1096
+ if (!type.isArray(obj)) {
1097
+ keys = object.keys(obj);
1098
+ length = keys.length;
1099
+ store = obj[keys[index += 1]];
1100
+ } else {
1101
+ length = obj.length;
1102
+ store = obj[index];
1103
+ }
1104
+
1105
+ index += 1;
1106
+ for (; index < length; index += 1) {
1107
+ store = iteratee.call(context, store, obj[keys ? keys[index] : index]);
1108
+ }
1109
+
1110
+ return store;
1111
+ }
1112
+
1113
+ /**
1114
+ * Transform the Array-like object to Array.<br>
1115
+ * In low IE (below 8), Array.prototype.slice.call is not perfect. So, try-catch statement is used.
1116
+ * @param {*} arrayLike Array-like object
1117
+ * @returns {Array} Array
1118
+ * @memberof tui.util
1119
+ * @example
1120
+ * //-- #1. Get Module --//
1121
+ * var util = require('tui-code-snippet'); // node, commonjs
1122
+ * var util = tui.util; // distribution file
1123
+ *
1124
+ * //-- #2. Use property --//
1125
+ * var arrayLike = {
1126
+ * 0: 'one',
1127
+ * 1: 'two',
1128
+ * 2: 'three',
1129
+ * 3: 'four',
1130
+ * length: 4
1131
+ * };
1132
+ * var result = util.toArray(arrayLike);
1133
+ *
1134
+ * alert(result instanceof Array); // true
1135
+ * alert(result); // one,two,three,four
1136
+ */
1137
+ function toArray(arrayLike) {
1138
+ var arr;
1139
+ try {
1140
+ arr = Array.prototype.slice.call(arrayLike);
1141
+ } catch (e) {
1142
+ arr = [];
1143
+ forEachArray(arrayLike, function(value) {
1144
+ arr.push(value);
1145
+ });
1146
+ }
1147
+
1148
+ return arr;
1149
+ }
1150
+
1151
+ /**
1152
+ * Create a new array or plain object with all elements(or properties)
1153
+ * that pass the test implemented by the provided function.<br>
1154
+ * Callback function(iteratee) is invoked with three arguments:
1155
+ * - The value of the property(or The value of the element)
1156
+ * - The name of the property(or The index of the element)
1157
+ * - The object being traversed
1158
+ * @param {Object} obj Object(plain object or Array) that will be traversed
1159
+ * @param {function} iteratee Callback function
1160
+ * @param {Object} [context] Context(this) of callback function
1161
+ * @returns {Object} plain object or Array
1162
+ * @memberof tui.util
1163
+ * @example
1164
+ * //-- #1. Get Module --//
1165
+ * var util = require('tui-code-snippet'); // node, commonjs
1166
+ * var util = tui.util; // distribution file
1167
+ *
1168
+ * //-- #2. Use property --//
1169
+ * var result1 = util.filter([0,1,2,3], function(value) {
1170
+ * return (value % 2 === 0);
1171
+ * });
1172
+ * alert(result1); // [0, 2]
1173
+ *
1174
+ * var result2 = util.filter({a : 1, b: 2, c: 3}, function(value) {
1175
+ * return (value % 2 !== 0);
1176
+ * });
1177
+ * alert(result2.a); // 1
1178
+ * alert(result2.b); // undefined
1179
+ * alert(result2.c); // 3
1180
+ */
1181
+ function filter(obj, iteratee, context) {
1182
+ var result, add;
1183
+
1184
+ context = context || null;
1185
+
1186
+ if (!type.isObject(obj) || !type.isFunction(iteratee)) {
1187
+ throw new Error('wrong parameter');
1188
+ }
1189
+
1190
+ if (type.isArray(obj)) {
1191
+ result = [];
1192
+ add = function(subResult, args) {
1193
+ subResult.push(args[0]);
1194
+ };
1195
+ } else {
1196
+ result = {};
1197
+ add = function(subResult, args) {
1198
+ subResult[args[1]] = args[0];
1199
+ };
1200
+ }
1201
+
1202
+ forEach(obj, function() {
1203
+ if (iteratee.apply(context, arguments)) {
1204
+ add(result, arguments);
1205
+ }
1206
+ }, context);
1207
+
1208
+ return result;
1209
+ }
1210
+
1211
+ /**
1212
+ * fetching a property
1213
+ * @param {Array} arr target collection
1214
+ * @param {String|Number} property property name
1215
+ * @returns {Array}
1216
+ * @memberof tui.util
1217
+ * @example
1218
+ * //-- #1. Get Module --//
1219
+ * var util = require('tui-code-snippet'); // node, commonjs
1220
+ * var util = tui.util; // distribution file
1221
+ *
1222
+ * //-- #2. Use property --//
1223
+ * var objArr = [
1224
+ * {'abc': 1, 'def': 2, 'ghi': 3},
1225
+ * {'abc': 4, 'def': 5, 'ghi': 6},
1226
+ * {'abc': 7, 'def': 8, 'ghi': 9}
1227
+ * ];
1228
+ * var arr2d = [
1229
+ * [1, 2, 3],
1230
+ * [4, 5, 6],
1231
+ * [7, 8, 9]
1232
+ * ];
1233
+ * util.pluck(objArr, 'abc'); // [1, 4, 7]
1234
+ * util.pluck(arr2d, 2); // [3, 6, 9]
1235
+ */
1236
+ function pluck(arr, property) {
1237
+ var result = map(arr, function(item) {
1238
+ return item[property];
1239
+ });
1240
+
1241
+ return result;
1242
+ }
1243
+
1244
+ module.exports = {
1245
+ forEachOwnProperties: forEachOwnProperties,
1246
+ forEachArray: forEachArray,
1247
+ forEach: forEach,
1248
+ toArray: toArray,
1249
+ map: map,
1250
+ reduce: reduce,
1251
+ filter: filter,
1252
+ pluck: pluck
1253
+ };
1254
+
1255
+
1256
+ /***/ }),
1257
+ /* 5 */
1258
+ /***/ (function(module, exports) {
1259
+
1260
+ /**
1261
+ * @fileoverview This module provides a bind() function for context binding.
1262
+ * @author NHN Ent.
1263
+ * FE Development Lab <dl_javascript@nhnent.com>
1264
+ */
1265
+
1266
+ 'use strict';
1267
+
1268
+ /**
1269
+ * Create a new function that, when called, has its this keyword set to the provided value.
1270
+ * @param {function} fn A original function before binding
1271
+ * @param {*} obj context of function in arguments[0]
1272
+ * @returns {function()} A new bound function with context that is in arguments[1]
1273
+ * @memberof tui.util
1274
+ */
1275
+ function bind(fn, obj) {
1276
+ var slice = Array.prototype.slice;
1277
+ var args;
1278
+
1279
+ if (fn.bind) {
1280
+ return fn.bind.apply(fn, slice.call(arguments, 1));
1281
+ }
1282
+
1283
+ /* istanbul ignore next */
1284
+ args = slice.call(arguments, 2);
1285
+
1286
+ /* istanbul ignore next */
1287
+ return function() {
1288
+ /* istanbul ignore next */
1289
+ return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);
1290
+ };
1291
+ }
1292
+
1293
+ module.exports = {
1294
+ bind: bind
1295
+ };
1296
+
1297
+
1298
+ /***/ }),
1299
+ /* 6 */
1300
+ /***/ (function(module, exports) {
1301
+
1302
+ /**
1303
+ * @fileoverview This module provides some simple function for inheritance.
1304
+ * @author NHN Ent.
1305
+ * FE Development Lab <dl_javascript@nhnent.com>
1306
+ */
1307
+
1308
+ 'use strict';
1309
+
1310
+ /**
1311
+ * Create a new object with the specified prototype object and properties.
1312
+ * @param {Object} obj This object will be a prototype of the newly-created object.
1313
+ * @returns {Object}
1314
+ * @memberof tui.util
1315
+ */
1316
+ function createObject(obj) {
1317
+ function F() {} // eslint-disable-line require-jsdoc
1318
+ F.prototype = obj;
1319
+
1320
+ return new F();
1321
+ }
1322
+
1323
+ /**
1324
+ * Provide a simple inheritance in prototype-oriented.<br>
1325
+ * Caution :
1326
+ * Don't overwrite the prototype of child constructor.
1327
+ *
1328
+ * @param {function} subType Child constructor
1329
+ * @param {function} superType Parent constructor
1330
+ * @memberof tui.util
1331
+ * @example
1332
+ * //-- #1. Get Module --//
1333
+ * var util = require('tui-code-snippet'); // node, commonjs
1334
+ * var util = tui.util; // distribution file
1335
+ *
1336
+ * //-- #2. Use property --//
1337
+ * // Parent constructor
1338
+ * function Animal(leg) {
1339
+ * this.leg = leg;
1340
+ * }
1341
+ * Animal.prototype.growl = function() {
1342
+ * // ...
1343
+ * };
1344
+ *
1345
+ * // Child constructor
1346
+ * function Person(name) {
1347
+ * this.name = name;
1348
+ * }
1349
+ *
1350
+ * // Inheritance
1351
+ * util.inherit(Person, Animal);
1352
+ *
1353
+ * // After this inheritance, please use only the extending of property.
1354
+ * // Do not overwrite prototype.
1355
+ * Person.prototype.walk = function(direction) {
1356
+ * // ...
1357
+ * };
1358
+ */
1359
+ function inherit(subType, superType) {
1360
+ var prototype = createObject(superType.prototype);
1361
+ prototype.constructor = subType;
1362
+ subType.prototype = prototype;
1363
+ }
1364
+
1365
+ module.exports = {
1366
+ createObject: createObject,
1367
+ inherit: inherit
1368
+ };
1369
+
1370
+
1371
+ /***/ }),
1372
+ /* 7 */
1373
+ /***/ (function(module, exports, __webpack_require__) {
1374
+
1375
+ /**
1376
+ * @fileoverview This module has some functions for handling the string.
1377
+ * @author NHN Ent.
1378
+ * FE Development Lab <dl_javascript@nhnent.com>
1379
+ */
1380
+
1381
+ 'use strict';
1382
+
1383
+ var collection = __webpack_require__(4);
1384
+ var object = __webpack_require__(1);
1385
+ /**
1386
+ * Transform the given HTML Entity string into plain string
1387
+ * @param {String} htmlEntity - HTML Entity type string
1388
+ * @returns {String} Plain string
1389
+ * @memberof tui.util
1390
+ * @example
1391
+ * //-- #1. Get Module --//
1392
+ * var util = require('tui-code-snippet'); // node, commonjs
1393
+ * var util = tui.util; // distribution file
1394
+ *
1395
+ * //-- #2. Use property --//
1396
+ * var htmlEntityString = "A &#39;quote&#39; is &lt;b&gt;bold&lt;/b&gt;"
1397
+ * var result = util.decodeHTMLEntity(htmlEntityString); //"A 'quote' is <b>bold</b>"
1398
+ */
1399
+ function decodeHTMLEntity(htmlEntity) {
1400
+ var entities = {
1401
+ '&quot;': '"',
1402
+ '&amp;': '&',
1403
+ '&lt;': '<',
1404
+ '&gt;': '>',
1405
+ '&#39;': '\'',
1406
+ '&nbsp;': ' '
1407
+ };
1408
+
1409
+ return htmlEntity.replace(/&amp;|&lt;|&gt;|&quot;|&#39;|&nbsp;/g, function(m0) {
1410
+ return entities[m0] ? entities[m0] : m0;
1411
+ });
1412
+ }
1413
+
1414
+ /**
1415
+ * Transform the given string into HTML Entity string
1416
+ * @param {String} html - String for encoding
1417
+ * @returns {String} HTML Entity
1418
+ * @memberof tui.util
1419
+ * @example
1420
+ * //-- #1. Get Module --//
1421
+ * var util = require('tui-code-snippet'); // node, commonjs
1422
+ * var util = tui.util; // distribution file
1423
+ *
1424
+ * //-- #2. Use property --//
1425
+ * var htmlEntityString = "<script> alert('test');</script><a href='test'>";
1426
+ * var result = util.encodeHTMLEntity(htmlEntityString);
1427
+ * //"&lt;script&gt; alert(&#39;test&#39;);&lt;/script&gt;&lt;a href=&#39;test&#39;&gt;"
1428
+ */
1429
+ function encodeHTMLEntity(html) {
1430
+ var entities = {
1431
+ '"': 'quot',
1432
+ '&': 'amp',
1433
+ '<': 'lt',
1434
+ '>': 'gt',
1435
+ '\'': '#39'
1436
+ };
1437
+
1438
+ return html.replace(/[<>&"']/g, function(m0) {
1439
+ return entities[m0] ? '&' + entities[m0] + ';' : m0;
1440
+ });
1441
+ }
1442
+
1443
+ /**
1444
+ * Return whether the string capable to transform into plain string is in the given string or not.
1445
+ * @param {String} string - test string
1446
+ * @memberof tui.util
1447
+ * @returns {boolean}
1448
+ */
1449
+ function hasEncodableString(string) {
1450
+ return (/[<>&"']/).test(string);
1451
+ }
1452
+
1453
+ /**
1454
+ * Return duplicate charters
1455
+ * @param {string} operandStr1 The operand string
1456
+ * @param {string} operandStr2 The operand string
1457
+ * @private
1458
+ * @memberof tui.util
1459
+ * @returns {string}
1460
+ * @example
1461
+ * //-- #1. Get Module --//
1462
+ * var util = require('tui-code-snippet'); // node, commonjs
1463
+ * var util = tui.util; // distribution file
1464
+ *
1465
+ * //-- #2. Use property --//
1466
+ * util.getDuplicatedChar('fe dev', 'nhn entertainment'); // 'e'
1467
+ * util.getDuplicatedChar('fdsa', 'asdf'); // 'asdf'
1468
+ */
1469
+ function getDuplicatedChar(operandStr1, operandStr2) {
1470
+ var i = 0;
1471
+ var len = operandStr1.length;
1472
+ var pool = {};
1473
+ var dupl, key;
1474
+
1475
+ for (; i < len; i += 1) {
1476
+ key = operandStr1.charAt(i);
1477
+ pool[key] = 1;
1478
+ }
1479
+
1480
+ for (i = 0, len = operandStr2.length; i < len; i += 1) {
1481
+ key = operandStr2.charAt(i);
1482
+ if (pool[key]) {
1483
+ pool[key] += 1;
1484
+ }
1485
+ }
1486
+
1487
+ pool = collection.filter(pool, function(item) {
1488
+ return item > 1;
1489
+ });
1490
+
1491
+ pool = object.keys(pool).sort();
1492
+ dupl = pool.join('');
1493
+
1494
+ return dupl;
1495
+ }
1496
+
1497
+ module.exports = {
1498
+ decodeHTMLEntity: decodeHTMLEntity,
1499
+ encodeHTMLEntity: encodeHTMLEntity,
1500
+ hasEncodableString: hasEncodableString,
1501
+ getDuplicatedChar: getDuplicatedChar
1502
+ };
1503
+
1504
+
1505
+ /***/ }),
1506
+ /* 8 */
1507
+ /***/ (function(module, exports) {
1508
+
1509
+ /**
1510
+ * @fileoverview collections of some technic methods.
1511
+ * @author NHN Ent. FE Development Lab <e0242.nhnent.com>
1512
+ */
1513
+
1514
+ 'use strict';
1515
+
1516
+ var tricks = {};
1517
+ var aps = Array.prototype.slice;
1518
+
1519
+ /**
1520
+ * Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed
1521
+ * since the last time the debouced function was invoked.
1522
+ * @param {function} fn The function to debounce.
1523
+ * @param {number} [delay=0] The number of milliseconds to delay
1524
+ * @memberof tui.util
1525
+ * @returns {function} debounced function.
1526
+ * @example
1527
+ * //-- #1. Get Module --//
1528
+ * var util = require('tui-code-snippet'); // node, commonjs
1529
+ * var util = tui.util; // distribution file
1530
+ *
1531
+ * //-- #2. Use property --//
1532
+ * function someMethodToInvokeDebounced() {}
1533
+ *
1534
+ * var debounced = util.debounce(someMethodToInvokeDebounced, 300);
1535
+ *
1536
+ * // invoke repeatedly
1537
+ * debounced();
1538
+ * debounced();
1539
+ * debounced();
1540
+ * debounced();
1541
+ * debounced();
1542
+ * debounced(); // last invoke of debounced()
1543
+ *
1544
+ * // invoke someMethodToInvokeDebounced() after 300 milliseconds.
1545
+ */
1546
+ function debounce(fn, delay) {
1547
+ var timer, args;
1548
+
1549
+ /* istanbul ignore next */
1550
+ delay = delay || 0;
1551
+
1552
+ function debounced() { // eslint-disable-line require-jsdoc
1553
+ args = aps.call(arguments);
1554
+
1555
+ window.clearTimeout(timer);
1556
+ timer = window.setTimeout(function() {
1557
+ fn.apply(null, args);
1558
+ }, delay);
1559
+ }
1560
+
1561
+ return debounced;
1562
+ }
1563
+
1564
+ /**
1565
+ * return timestamp
1566
+ * @memberof tui.util
1567
+ * @returns {number} The number of milliseconds from Jan. 1970 00:00:00 (GMT)
1568
+ */
1569
+ function timestamp() {
1570
+ return Number(new Date());
1571
+ }
1572
+
1573
+ /**
1574
+ * Creates a throttled function that only invokes fn at most once per every interval milliseconds.
1575
+ *
1576
+ * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...)
1577
+ *
1578
+ * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling.
1579
+ * @param {function} fn function to throttle
1580
+ * @param {number} [interval=0] the number of milliseconds to throttle invocations to.
1581
+ * @memberof tui.util
1582
+ * @returns {function} throttled function
1583
+ * @example
1584
+ * //-- #1. Get Module --//
1585
+ * var util = require('tui-code-snippet'); // node, commonjs
1586
+ * var util = tui.util; // distribution file
1587
+ *
1588
+ * //-- #2. Use property --//
1589
+ * function someMethodToInvokeThrottled() {}
1590
+ *
1591
+ * var throttled = util.throttle(someMethodToInvokeThrottled, 300);
1592
+ *
1593
+ * // invoke repeatedly
1594
+ * throttled(); // invoke (leading)
1595
+ * throttled();
1596
+ * throttled(); // invoke (near 300 milliseconds)
1597
+ * throttled();
1598
+ * throttled();
1599
+ * throttled(); // invoke (near 600 milliseconds)
1600
+ * // ...
1601
+ * // invoke (trailing)
1602
+ *
1603
+ * // if you need reuse throttled method. then invoke reset()
1604
+ * throttled.reset();
1605
+ */
1606
+ function throttle(fn, interval) {
1607
+ var base;
1608
+ var isLeading = true;
1609
+ var tick = function(_args) {
1610
+ fn.apply(null, _args);
1611
+ base = null;
1612
+ };
1613
+ var debounced, stamp, args;
1614
+
1615
+ /* istanbul ignore next */
1616
+ interval = interval || 0;
1617
+
1618
+ debounced = tricks.debounce(tick, interval);
1619
+
1620
+ function throttled() { // eslint-disable-line require-jsdoc
1621
+ args = aps.call(arguments);
1622
+
1623
+ if (isLeading) {
1624
+ tick(args);
1625
+ isLeading = false;
1626
+
1627
+ return;
1628
+ }
1629
+
1630
+ stamp = tricks.timestamp();
1631
+
1632
+ base = base || stamp;
1633
+
1634
+ // pass array directly because `debounce()`, `tick()` are already use
1635
+ // `apply()` method to invoke developer's `fn` handler.
1636
+ //
1637
+ // also, this `debounced` line invoked every time for implements
1638
+ // `trailing` features.
1639
+ debounced(args);
1640
+
1641
+ if ((stamp - base) >= interval) {
1642
+ tick(args);
1643
+ }
1644
+ }
1645
+
1646
+ function reset() { // eslint-disable-line require-jsdoc
1647
+ isLeading = true;
1648
+ base = null;
1649
+ }
1650
+
1651
+ throttled.reset = reset;
1652
+
1653
+ return throttled;
1654
+ }
1655
+
1656
+ tricks.timestamp = timestamp;
1657
+ tricks.debounce = debounce;
1658
+ tricks.throttle = throttle;
1659
+
1660
+ module.exports = tricks;
1661
+
1662
+
1663
+ /***/ }),
1664
+ /* 9 */
1665
+ /***/ (function(module, exports) {
1666
+
1667
+ /**
1668
+ * @fileoverview This module detects the kind of well-known browser and version.
1669
+ * @author NHN Ent.
1670
+ * FE Development Lab <dl_javascript@nhnent.com>
1671
+ */
1672
+
1673
+ 'use strict';
1674
+
1675
+ /**
1676
+ * This object has an information that indicate the kind of browser.<br>
1677
+ * The list below is a detectable browser list.
1678
+ * - ie8 ~ ie11
1679
+ * - chrome
1680
+ * - firefox
1681
+ * - safari
1682
+ * - edge
1683
+ * @memberof tui.util
1684
+ * @example
1685
+ * //-- #1. Get Module --//
1686
+ * var util = require('tui-code-snippet'); // node, commonjs
1687
+ * var util = tui.util; // distribution file
1688
+ *
1689
+ * //-- #2. Use property --//
1690
+ * util.browser.chrome === true; // chrome
1691
+ * util.browser.firefox === true; // firefox
1692
+ * util.browser.safari === true; // safari
1693
+ * util.browser.msie === true; // IE
1694
+ * util.browser.edge === true; // edge
1695
+ * util.browser.others === true; // other browser
1696
+ * util.browser.version; // browser version
1697
+ */
1698
+ var browser = {
1699
+ chrome: false,
1700
+ firefox: false,
1701
+ safari: false,
1702
+ msie: false,
1703
+ edge: false,
1704
+ others: false,
1705
+ version: 0
1706
+ };
1707
+
1708
+ var nav = window.navigator;
1709
+ var appName = nav.appName.replace(/\s/g, '_');
1710
+ var userAgent = nav.userAgent;
1711
+
1712
+ var rIE = /MSIE\s([0-9]+[.0-9]*)/;
1713
+ var rIE11 = /Trident.*rv:11\./;
1714
+ var rEdge = /Edge\/(\d+)\./;
1715
+ var versionRegex = {
1716
+ firefox: /Firefox\/(\d+)\./,
1717
+ chrome: /Chrome\/(\d+)\./,
1718
+ safari: /Version\/([\d.]+).*Safari\/(\d+)/
1719
+ };
1720
+
1721
+ var key, tmp;
1722
+
1723
+ var detector = {
1724
+ Microsoft_Internet_Explorer: function() { // eslint-disable-line camelcase
1725
+ var detectedVersion = userAgent.match(rIE);
1726
+
1727
+ if (detectedVersion) { // ie8 ~ ie10
1728
+ browser.msie = true;
1729
+ browser.version = parseFloat(detectedVersion[1]);
1730
+ } else { // no version information
1731
+ browser.others = true;
1732
+ }
1733
+ },
1734
+ Netscape: function() { // eslint-disable-line complexity
1735
+ var detected = false;
1736
+
1737
+ if (rIE11.exec(userAgent)) {
1738
+ browser.msie = true;
1739
+ browser.version = 11;
1740
+ detected = true;
1741
+ } else if (rEdge.exec(userAgent)) {
1742
+ browser.edge = true;
1743
+ browser.version = userAgent.match(rEdge)[1];
1744
+ detected = true;
1745
+ } else {
1746
+ for (key in versionRegex) {
1747
+ if (versionRegex.hasOwnProperty(key)) {
1748
+ tmp = userAgent.match(versionRegex[key]);
1749
+ if (tmp && tmp.length > 1) { // eslint-disable-line max-depth
1750
+ browser[key] = detected = true;
1751
+ browser.version = parseFloat(tmp[1] || 0);
1752
+ break;
1753
+ }
1754
+ }
1755
+ }
1756
+ }
1757
+ if (!detected) {
1758
+ browser.others = true;
1759
+ }
1760
+ }
1761
+ };
1762
+
1763
+ var fn = detector[appName];
1764
+
1765
+ if (fn) {
1766
+ detector[appName]();
1767
+ }
1768
+
1769
+ module.exports = browser;
1770
+
1771
+
1772
+ /***/ }),
1773
+ /* 10 */
1774
+ /***/ (function(module, exports, __webpack_require__) {
1775
+
1776
+ /**
1777
+ * @fileoverview This module has some methods for handling popup-window
1778
+ * @author NHN Ent.
1779
+ * FE Development Lab <dl_javascript@nhnent.com>
1780
+ */
1781
+
1782
+ 'use strict';
1783
+
1784
+ var collection = __webpack_require__(4);
1785
+ var type = __webpack_require__(2);
1786
+ var func = __webpack_require__(5);
1787
+ var browser = __webpack_require__(9);
1788
+ var object = __webpack_require__(1);
1789
+
1790
+ var popupId = 0;
1791
+
1792
+ /**
1793
+ * Popup management class
1794
+ * @constructor
1795
+ * @memberof tui.util
1796
+ * @example
1797
+ * // node, commonjs
1798
+ * var popup = require('tui-code-snippet').popup;
1799
+ * @example
1800
+ * // distribution file, script
1801
+ * <script src='path-to/tui-code-snippt.js'></script>
1802
+ * <script>
1803
+ * var popup = tui.util.popup;
1804
+ * <script>
1805
+ */
1806
+ function Popup() {
1807
+ /**
1808
+ * Caching the window-contexts of opened popups
1809
+ * @type {Object}
1810
+ */
1811
+ this.openedPopup = {};
1812
+
1813
+ /**
1814
+ * In IE7, an error occurs when the closeWithParent property attaches to window object.<br>
1815
+ * So, It is for saving the value of closeWithParent instead of attaching to window object.
1816
+ * @type {Object}
1817
+ */
1818
+ this.closeWithParentPopup = {};
1819
+
1820
+ /**
1821
+ * Post data bridge for IE11 popup
1822
+ * @type {string}
1823
+ */
1824
+ this.postBridgeUrl = '';
1825
+ }
1826
+
1827
+ /**********
1828
+ * public methods
1829
+ **********/
1830
+
1831
+ /**
1832
+ * Returns a popup-list administered by current window.
1833
+ * @param {string} [key] The key of popup.
1834
+ * @returns {Object} popup window list object
1835
+ */
1836
+ Popup.prototype.getPopupList = function(key) {
1837
+ var target;
1838
+ if (type.isExisty(key)) {
1839
+ target = this.openedPopup[key];
1840
+ } else {
1841
+ target = this.openedPopup;
1842
+ }
1843
+
1844
+ return target;
1845
+ };
1846
+
1847
+ /**
1848
+ * Open popup
1849
+ * Caution:
1850
+ * In IE11, when transfer data to popup by POST, must set the postBridgeUrl.
1851
+ *
1852
+ * @param {string} url - popup url
1853
+ * @param {Object} options - popup options
1854
+ * @param {string} [options.popupName] - Key of popup window.<br>
1855
+ * If the key is set, when you try to open by this key, the popup of this key is focused.<br>
1856
+ * Or else a new popup window having this key is opened.
1857
+ *
1858
+ * @param {string} [options.popupOptionStr=""] - Option string of popup window<br>
1859
+ * It is same with the third parameter of window.open() method.<br>
1860
+ * See {@link http://www.w3schools.com/jsref/met_win_open.asp}
1861
+ *
1862
+ * @param {boolean} [options.closeWithParent=true] - Is closed when parent window closed?
1863
+ *
1864
+ * @param {boolean} [options.useReload=false] - This property indicates whether reload the popup or not.<br>
1865
+ * If true, the popup will be reloaded when you try to re-open the popup that has been opened.<br>
1866
+ * When transmit the POST-data, some browsers alert a message for confirming whether retransmit or not.
1867
+ *
1868
+ * @param {string} [options.postBridgeUrl='']
1869
+ * Use this url to avoid a certain bug occuring when transmitting POST data to the popup in IE11.<br>
1870
+ * This specific buggy situation is known to happen because IE11 tries to open the requested url<br>
1871
+ * not in a new popup window as intended, but in a new tab.<br>
1872
+ * See {@link http://wiki.nhnent.com/pages/viewpage.action?pageId=240562844}
1873
+ *
1874
+ * @param {string} [options.method=get]
1875
+ * The method of transmission when the form-data is transmitted to popup-window.
1876
+ *
1877
+ * @param {Object} [options.param=null]
1878
+ * Using as parameters for transmission when the form-data is transmitted to popup-window.
1879
+ */
1880
+ Popup.prototype.openPopup = function(url, options) { // eslint-disable-line complexity
1881
+ var popup, formElement, useIEPostBridge;
1882
+
1883
+ options = object.extend({
1884
+ popupName: 'popup_' + popupId + '_' + Number(new Date()),
1885
+ popupOptionStr: '',
1886
+ useReload: true,
1887
+ closeWithParent: true,
1888
+ method: 'get',
1889
+ param: {}
1890
+ }, options || {});
1891
+
1892
+ options.method = options.method.toUpperCase();
1893
+
1894
+ this.postBridgeUrl = options.postBridgeUrl || this.postBridgeUrl;
1895
+
1896
+ useIEPostBridge = options.method === 'POST' && options.param &&
1897
+ browser.msie && browser.version === 11;
1898
+
1899
+ if (!type.isExisty(url)) {
1900
+ throw new Error('Popup#open() need popup url.');
1901
+ }
1902
+
1903
+ popupId += 1;
1904
+
1905
+ /*
1906
+ * In form-data transmission
1907
+ * 1. Create a form before opening a popup.
1908
+ * 2. Transmit the form-data.
1909
+ * 3. Remove the form after transmission.
1910
+ */
1911
+ if (options.param) {
1912
+ if (options.method === 'GET') {
1913
+ url = url + (/\?/.test(url) ? '&' : '?') + this._parameterize(options.param);
1914
+ } else if (options.method === 'POST') {
1915
+ if (!useIEPostBridge) {
1916
+ formElement = this.createForm(url, options.param, options.method, options.popupName);
1917
+ url = 'about:blank';
1918
+ }
1919
+ }
1920
+ }
1921
+
1922
+ popup = this.openedPopup[options.popupName];
1923
+
1924
+ if (!type.isExisty(popup)) {
1925
+ this.openedPopup[options.popupName] = popup = this._open(useIEPostBridge, options.param,
1926
+ url, options.popupName, options.popupOptionStr);
1927
+ } else if (popup.closed) {
1928
+ this.openedPopup[options.popupName] = popup = this._open(useIEPostBridge, options.param,
1929
+ url, options.popupName, options.popupOptionStr);
1930
+ } else {
1931
+ if (options.useReload) {
1932
+ popup.location.replace(url);
1933
+ }
1934
+ popup.focus();
1935
+ }
1936
+
1937
+ this.closeWithParentPopup[options.popupName] = options.closeWithParent;
1938
+
1939
+ if (!popup || popup.closed || type.isUndefined(popup.closed)) {
1940
+ alert('please enable popup windows for this website');
1941
+ }
1942
+
1943
+ if (options.param && options.method === 'POST' && !useIEPostBridge) {
1944
+ if (popup) {
1945
+ formElement.submit();
1946
+ }
1947
+ if (formElement.parentNode) {
1948
+ formElement.parentNode.removeChild(formElement);
1949
+ }
1950
+ }
1951
+
1952
+ window.onunload = func.bind(this.closeAllPopup, this);
1953
+ };
1954
+
1955
+ /**
1956
+ * Close the popup
1957
+ * @param {boolean} [skipBeforeUnload] - If true, the 'window.onunload' will be null and skip unload event.
1958
+ * @param {Window} [popup] - Window-context of popup for closing. If omit this, current window-context will be closed.
1959
+ */
1960
+ Popup.prototype.close = function(skipBeforeUnload, popup) {
1961
+ var target = popup || window;
1962
+ skipBeforeUnload = type.isExisty(skipBeforeUnload) ? skipBeforeUnload : false;
1963
+
1964
+ if (skipBeforeUnload) {
1965
+ window.onunload = null;
1966
+ }
1967
+
1968
+ if (!target.closed) {
1969
+ target.opener = window.location.href;
1970
+ target.close();
1971
+ }
1972
+ };
1973
+
1974
+ /**
1975
+ * Close all the popups in current window.
1976
+ * @param {boolean} closeWithParent - If true, popups having the closeWithParentPopup property as true will be closed.
1977
+ */
1978
+ Popup.prototype.closeAllPopup = function(closeWithParent) {
1979
+ var hasArg = type.isExisty(closeWithParent);
1980
+
1981
+ collection.forEachOwnProperties(this.openedPopup, function(popup, key) {
1982
+ if ((hasArg && this.closeWithParentPopup[key]) || !hasArg) {
1983
+ this.close(false, popup);
1984
+ }
1985
+ }, this);
1986
+ };
1987
+
1988
+ /**
1989
+ * Activate(or focus) the popup of the given name.
1990
+ * @param {string} popupName - Name of popup for activation
1991
+ */
1992
+ Popup.prototype.focus = function(popupName) {
1993
+ this.getPopupList(popupName).focus();
1994
+ };
1995
+
1996
+ /**
1997
+ * Return an object made of parsing the query string.
1998
+ * @returns {Object} An object having some information of the query string.
1999
+ * @private
2000
+ */
2001
+ Popup.prototype.parseQuery = function() {
2002
+ var param = {};
2003
+ var search, pair;
2004
+
2005
+ search = window.location.search.substr(1);
2006
+ collection.forEachArray(search.split('&'), function(part) {
2007
+ pair = part.split('=');
2008
+ param[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
2009
+ });
2010
+
2011
+ return param;
2012
+ };
2013
+
2014
+ /**
2015
+ * Create a hidden form from the given arguments and return this form.
2016
+ * @param {string} action - URL for form transmission
2017
+ * @param {Object} [data] - Data for form transmission
2018
+ * @param {string} [method] - Method of transmission
2019
+ * @param {string} [target] - Target of transmission
2020
+ * @param {HTMLElement} [container] - Container element of form.
2021
+ * @returns {HTMLElement} Form element
2022
+ */
2023
+ Popup.prototype.createForm = function(action, data, method, target, container) {
2024
+ var form = document.createElement('form'),
2025
+ input;
2026
+
2027
+ container = container || document.body;
2028
+
2029
+ form.method = method || 'POST';
2030
+ form.action = action || '';
2031
+ form.target = target || '';
2032
+ form.style.display = 'none';
2033
+
2034
+ collection.forEachOwnProperties(data, function(value, key) {
2035
+ input = document.createElement('input');
2036
+ input.name = key;
2037
+ input.type = 'hidden';
2038
+ input.value = value;
2039
+ form.appendChild(input);
2040
+ });
2041
+
2042
+ container.appendChild(form);
2043
+
2044
+ return form;
2045
+ };
2046
+
2047
+ /**********
2048
+ * private methods
2049
+ **********/
2050
+
2051
+ /**
2052
+ * Return an query string made by parsing the given object
2053
+ * @param {Object} obj - An object that has information for query string
2054
+ * @returns {string} - Query string
2055
+ * @private
2056
+ */
2057
+ Popup.prototype._parameterize = function(obj) {
2058
+ var query = [];
2059
+
2060
+ collection.forEachOwnProperties(obj, function(value, key) {
2061
+ query.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
2062
+ });
2063
+
2064
+ return query.join('&');
2065
+ };
2066
+
2067
+ /**
2068
+ * Open popup
2069
+ * @param {boolean} useIEPostBridge - A switch option whether to use alternative
2070
+ * of tossing POST data to the popup window in IE11
2071
+ * @param {Object} param - A data for tossing to popup
2072
+ * @param {string} url - Popup url
2073
+ * @param {string} popupName - Popup name
2074
+ * @param {string} optionStr - Setting for popup, ex) 'width=640,height=320,scrollbars=yes'
2075
+ * @returns {Window} Window context of popup
2076
+ * @private
2077
+ */
2078
+ Popup.prototype._open = function(useIEPostBridge, param, url, popupName, optionStr) {
2079
+ var popup;
2080
+
2081
+ if (useIEPostBridge) {
2082
+ popup = window.open(this.postBridgeUrl, popupName, optionStr);
2083
+ setTimeout(function() {
2084
+ popup.redirect(url, param);
2085
+ }, 100);
2086
+ } else {
2087
+ popup = window.open(url, popupName, optionStr);
2088
+ }
2089
+
2090
+ return popup;
2091
+ };
2092
+
2093
+ module.exports = new Popup();
2094
+
2095
+
2096
+ /***/ }),
2097
+ /* 11 */
2098
+ /***/ (function(module, exports, __webpack_require__) {
2099
+
2100
+ /**
2101
+ * @fileoverview This module has a function for date format.
2102
+ * @author NHN Ent.
2103
+ * FE Development Lab <dl_javascript@nhnent.com>
2104
+ */
2105
+
2106
+ 'use strict';
2107
+
2108
+ var type = __webpack_require__(2);
2109
+ var object = __webpack_require__(1);
2110
+
2111
+ var tokens = /[\\]*YYYY|[\\]*YY|[\\]*MMMM|[\\]*MMM|[\\]*MM|[\\]*M|[\\]*DD|[\\]*D|[\\]*HH|[\\]*H|[\\]*A/gi;
2112
+ var MONTH_STR = [
2113
+ 'Invalid month', 'January', 'February', 'March', 'April', 'May',
2114
+ 'June', 'July', 'August', 'September', 'October', 'November', 'December'
2115
+ ];
2116
+ var MONTH_DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2117
+ var replaceMap = {
2118
+ M: function(date) {
2119
+ return Number(date.month);
2120
+ },
2121
+ MM: function(date) {
2122
+ var month = date.month;
2123
+
2124
+ return (Number(month) < 10) ? '0' + month : month;
2125
+ },
2126
+ MMM: function(date) {
2127
+ return MONTH_STR[Number(date.month)].substr(0, 3);
2128
+ },
2129
+ MMMM: function(date) {
2130
+ return MONTH_STR[Number(date.month)];
2131
+ },
2132
+ D: function(date) {
2133
+ return Number(date.date);
2134
+ },
2135
+ d: function(date) {
2136
+ return replaceMap.D(date); // eslint-disable-line new-cap
2137
+ },
2138
+ DD: function(date) {
2139
+ var dayInMonth = date.date;
2140
+
2141
+ return (Number(dayInMonth) < 10) ? '0' + dayInMonth : dayInMonth;
2142
+ },
2143
+ dd: function(date) {
2144
+ return replaceMap.DD(date); // eslint-disable-line new-cap
2145
+ },
2146
+ YY: function(date) {
2147
+ return Number(date.year) % 100;
2148
+ },
2149
+ yy: function(date) {
2150
+ return replaceMap.YY(date); // eslint-disable-line new-cap
2151
+ },
2152
+ YYYY: function(date) {
2153
+ var prefix = '20',
2154
+ year = date.year;
2155
+ if (year > 69 && year < 100) {
2156
+ prefix = '19';
2157
+ }
2158
+
2159
+ return (Number(year) < 100) ? prefix + String(year) : year;
2160
+ },
2161
+ yyyy: function(date) {
2162
+ return replaceMap.YYYY(date); // eslint-disable-line new-cap
2163
+ },
2164
+ A: function(date) {
2165
+ return date.meridiem;
2166
+ },
2167
+ a: function(date) {
2168
+ return date.meridiem;
2169
+ },
2170
+ hh: function(date) {
2171
+ var hour = date.hour;
2172
+
2173
+ return (Number(hour) < 10) ? '0' + hour : hour;
2174
+ },
2175
+ HH: function(date) {
2176
+ return replaceMap.hh(date);
2177
+ },
2178
+ h: function(date) {
2179
+ return String(Number(date.hour));
2180
+ },
2181
+ H: function(date) {
2182
+ return replaceMap.h(date);
2183
+ },
2184
+ m: function(date) {
2185
+ return String(Number(date.minute));
2186
+ },
2187
+ mm: function(date) {
2188
+ var minute = date.minute;
2189
+
2190
+ return (Number(minute) < 10) ? '0' + minute : minute;
2191
+ }
2192
+ };
2193
+
2194
+ /**
2195
+ * Check whether the given variables are valid date or not.
2196
+ * @param {number} year - Year
2197
+ * @param {number} month - Month
2198
+ * @param {number} date - Day in month.
2199
+ * @returns {boolean} Is valid?
2200
+ * @private
2201
+ */
2202
+ function isValidDate(year, month, date) { // eslint-disable-line complexity
2203
+ var isValidYear, isValidMonth, isValid, lastDayInMonth;
2204
+
2205
+ year = Number(year);
2206
+ month = Number(month);
2207
+ date = Number(date);
2208
+
2209
+ isValidYear = (year > -1 && year < 100) || ((year > 1969) && (year < 2070));
2210
+ isValidMonth = (month > 0) && (month < 13);
2211
+
2212
+ if (!isValidYear || !isValidMonth) {
2213
+ return false;
2214
+ }
2215
+
2216
+ lastDayInMonth = MONTH_DAYS[month];
2217
+ if (month === 2 && year % 4 === 0) {
2218
+ if (year % 100 !== 0 || year % 400 === 0) {
2219
+ lastDayInMonth = 29;
2220
+ }
2221
+ }
2222
+
2223
+ isValid = (date > 0) && (date <= lastDayInMonth);
2224
+
2225
+ return isValid;
2226
+ }
2227
+
2228
+ /**
2229
+ * Return a string that transformed from the given form and date.
2230
+ * @param {string} form - Date form
2231
+ * @param {Date|Object} date - Date object
2232
+ * @param {{meridiemSet: {AM: string, PM: string}}} option - Option
2233
+ * @returns {boolean|string} A transformed string or false.
2234
+ * @memberof tui.util
2235
+ * @example
2236
+ * // key | Shorthand
2237
+ * // --------------- |-----------------------
2238
+ * // years | YY / YYYY / yy / yyyy
2239
+ * // months(n) | M / MM
2240
+ * // months(str) | MMM / MMMM
2241
+ * // days | D / DD / d / dd
2242
+ * // hours | H / HH / h / hh
2243
+ * // minutes | m / mm
2244
+ * // meridiem(AM,PM) | A / a
2245
+ *
2246
+ * //-- #1. Get Module --//
2247
+ * var util = require('tui-code-snippet'); // node, commonjs
2248
+ * var util = tui.util; // distribution file
2249
+ *
2250
+ * //-- #2. Use property --//
2251
+ * var dateStr1 = util.formatDate('yyyy-MM-dd', {
2252
+ * year: 2014,
2253
+ * month: 12,
2254
+ * date: 12
2255
+ * });
2256
+ * alert(dateStr1); // '2014-12-12'
2257
+ *
2258
+ * var dateStr2 = util.formatDate('MMM DD YYYY HH:mm', {
2259
+ * year: 1999,
2260
+ * month: 9,
2261
+ * date: 9,
2262
+ * hour: 0,
2263
+ * minute: 2
2264
+ * });
2265
+ * alert(dateStr2); // 'Sep 09 1999 00:02'
2266
+ *
2267
+ * var dt = new Date(2010, 2, 13),
2268
+ * dateStr3 = util.formatDate('yyyy년 M월 dd일', dt);
2269
+ * alert(dateStr3); // '2010년 3월 13일'
2270
+ *
2271
+ * var option4 = {
2272
+ * meridiemSet: {
2273
+ * AM: '오전',
2274
+ * PM: '오후'
2275
+ * }
2276
+ * };
2277
+ * var date4 = {year: 1999, month: 9, date: 9, hour: 13, minute: 2};
2278
+ * var dateStr4 = util.formatDate('yyyy-MM-dd A hh:mm', date4, option4));
2279
+ * alert(dateStr4); // '1999-09-09 오후 01:02'
2280
+ */
2281
+ function formatDate(form, date, option) { // eslint-disable-line complexity
2282
+ var am = object.pick(option, 'meridiemSet', 'AM') || 'AM';
2283
+ var pm = object.pick(option, 'meridiemSet', 'PM') || 'PM';
2284
+ var meridiem, nDate, resultStr;
2285
+
2286
+ if (type.isDate(date)) {
2287
+ nDate = {
2288
+ year: date.getFullYear(),
2289
+ month: date.getMonth() + 1,
2290
+ date: date.getDate(),
2291
+ hour: date.getHours(),
2292
+ minute: date.getMinutes()
2293
+ };
2294
+ } else {
2295
+ nDate = {
2296
+ year: date.year,
2297
+ month: date.month,
2298
+ date: date.date,
2299
+ hour: date.hour,
2300
+ minute: date.minute
2301
+ };
2302
+ }
2303
+
2304
+ if (!isValidDate(nDate.year, nDate.month, nDate.date)) {
2305
+ return false;
2306
+ }
2307
+
2308
+ nDate.meridiem = '';
2309
+ if (/([^\\]|^)[aA]\b/.test(form)) {
2310
+ meridiem = (nDate.hour > 11) ? pm : am;
2311
+ if (nDate.hour > 12) { // See the clock system: https://en.wikipedia.org/wiki/12-hour_clock
2312
+ nDate.hour %= 12;
2313
+ }
2314
+ if (nDate.hour === 0) {
2315
+ nDate.hour = 12;
2316
+ }
2317
+ nDate.meridiem = meridiem;
2318
+ }
2319
+
2320
+ resultStr = form.replace(tokens, function(key) {
2321
+ if (key.indexOf('\\') > -1) { // escape character
2322
+ return key.replace(/\\/, '');
2323
+ }
2324
+
2325
+ return replaceMap[key](nDate) || '';
2326
+ });
2327
+
2328
+ return resultStr;
2329
+ }
2330
+
2331
+ module.exports = formatDate;
2332
+
2333
+
2334
+ /***/ }),
2335
+ /* 12 */
2336
+ /***/ (function(module, exports, __webpack_require__) {
2337
+
2338
+ /**
2339
+ * @fileoverview
2340
+ * This module provides a function to make a constructor
2341
+ * that can inherit from the other constructors like the CLASS easily.
2342
+ * @author NHN Ent.
2343
+ * FE Development Lab <dl_javascript@nhnent.com>
2344
+ */
2345
+
2346
+ 'use strict';
2347
+
2348
+ var inherit = __webpack_require__(6).inherit;
2349
+ var extend = __webpack_require__(1).extend;
2350
+
2351
+ /**
2352
+ * Help a constructor to be defined and to inherit from the other constructors
2353
+ * @param {*} [parent] Parent constructor
2354
+ * @param {Object} props Members of constructor
2355
+ * @param {Function} props.init Initialization method
2356
+ * @param {Object} [props.static] Static members of constructor
2357
+ * @returns {*} Constructor
2358
+ * @memberof tui.util
2359
+ * @example
2360
+ * //-- #1. Get Module --//
2361
+ * var util = require('tui-code-snippet'); // node, commonjs
2362
+ * var util = tui.util; // distribution file
2363
+ *
2364
+ * //-- #2. Use property --//
2365
+ * var Parent = util.defineClass({
2366
+ * init: function() { // constuructor
2367
+ * this.name = 'made by def';
2368
+ * },
2369
+ * method: function() {
2370
+ * // ...
2371
+ * },
2372
+ * static: {
2373
+ * staticMethod: function() {
2374
+ * // ...
2375
+ * }
2376
+ * }
2377
+ * });
2378
+ *
2379
+ * var Child = util.defineClass(Parent, {
2380
+ * childMethod: function() {}
2381
+ * });
2382
+ *
2383
+ * Parent.staticMethod();
2384
+ *
2385
+ * var parentInstance = new Parent();
2386
+ * console.log(parentInstance.name); //made by def
2387
+ * parentInstance.staticMethod(); // Error
2388
+ *
2389
+ * var childInstance = new Child();
2390
+ * childInstance.method();
2391
+ * childInstance.childMethod();
2392
+ */
2393
+ function defineClass(parent, props) {
2394
+ var obj;
2395
+
2396
+ if (!props) {
2397
+ props = parent;
2398
+ parent = null;
2399
+ }
2400
+
2401
+ obj = props.init || function() {};
2402
+
2403
+ if (parent) {
2404
+ inherit(obj, parent);
2405
+ }
2406
+
2407
+ if (props.hasOwnProperty('static')) {
2408
+ extend(obj, props['static']);
2409
+ delete props['static'];
2410
+ }
2411
+
2412
+ extend(obj.prototype, props);
2413
+
2414
+ return obj;
2415
+ }
2416
+
2417
+ module.exports = defineClass;
2418
+
2419
+
2420
+ /***/ }),
2421
+ /* 13 */
2422
+ /***/ (function(module, exports, __webpack_require__) {
2423
+
2424
+ /**
2425
+ * @fileoverview Define module
2426
+ * @author NHN Ent.
2427
+ * FE Development Lab <dl_javscript@nhnent.com>
2428
+ * @dependency type.js, defineNamespace.js
2429
+ */
2430
+
2431
+ 'use strict';
2432
+
2433
+ var defineNamespace = __webpack_require__(14);
2434
+ var type = __webpack_require__(2);
2435
+
2436
+ var INITIALIZATION_METHOD_NAME = 'initialize';
2437
+
2438
+ /**
2439
+ * Define module
2440
+ * @param {string} namespace - Namespace of module
2441
+ * @param {Object} moduleDefinition - Object literal for module
2442
+ * @returns {Object} Defined module
2443
+ * @memberof tui.util
2444
+ * @example
2445
+ * //-- #1. Get Module --//
2446
+ * var util = require('tui-code-snippet'); // node, commonjs
2447
+ * var util = tui.util; // distribution file
2448
+ *
2449
+ * //-- #2. Use property --//
2450
+ * var myModule = util.defineModule('modules.myModule', {
2451
+ * name: 'john',
2452
+ * message: '',
2453
+ * initialize: function() {
2454
+ * this.message = 'hello world';
2455
+ * },
2456
+ * getMessage: function() {
2457
+ * return this.name + ': ' + this.message
2458
+ * }
2459
+ * });
2460
+ *
2461
+ * console.log(myModule.getMessage()); // 'john: hello world';
2462
+ */
2463
+ function defineModule(namespace, moduleDefinition) {
2464
+ var base = moduleDefinition || {};
2465
+
2466
+ if (type.isFunction(base[INITIALIZATION_METHOD_NAME])) {
2467
+ base[INITIALIZATION_METHOD_NAME]();
2468
+ }
2469
+
2470
+ return defineNamespace(namespace, base);
2471
+ }
2472
+
2473
+ module.exports = defineModule;
2474
+
2475
+
2476
+ /***/ }),
2477
+ /* 14 */
2478
+ /***/ (function(module, exports, __webpack_require__) {
2479
+
2480
+ /**
2481
+ * @fileoverview Define namespace
2482
+ * @author NHN Ent.
2483
+ * FE Development Lab <dl_javascript@nhnent.com>
2484
+ * @dependency object.js, collection.js
2485
+ */
2486
+
2487
+ 'use strict';
2488
+
2489
+ var collection = __webpack_require__(4);
2490
+ var object = __webpack_require__(1);
2491
+
2492
+ /**
2493
+ * Define namespace
2494
+ * @param {string} namespace - Namespace (ex- 'foo.bar.baz')
2495
+ * @param {(object|function)} props - A set of modules or one module
2496
+ * @param {boolean} [isOverride] - Override the props to the namespace.<br>
2497
+ * (It removes previous properties of this namespace)
2498
+ * @returns {(object|function)} Defined namespace
2499
+ * @memberof tui.util
2500
+ * @example
2501
+ * //-- #1. Get Module --//
2502
+ * var util = require('tui-code-snippet'); // node, commonjs
2503
+ * var util = tui.util; // distribution file
2504
+ *
2505
+ * //-- #2. Use property --//
2506
+ * var neComp = util.defineNamespace;
2507
+ * neComp.listMenu = defineClass({
2508
+ * init: function() {
2509
+ * // ...
2510
+ * }
2511
+ * });
2512
+ */
2513
+ function defineNamespace(namespace, props, isOverride) {
2514
+ var names, result, prevLast, last;
2515
+
2516
+ names = namespace.split('.');
2517
+ names.unshift(window);
2518
+
2519
+ result = collection.reduce(names, function(obj, name) {
2520
+ obj[name] = obj[name] || {};
2521
+
2522
+ return obj[name];
2523
+ });
2524
+
2525
+ if (isOverride) {
2526
+ last = names.pop();
2527
+ prevLast = object.pick.apply(null, names);
2528
+ result = prevLast[last] = props;
2529
+ } else {
2530
+ object.extend(result, props);
2531
+ }
2532
+
2533
+ return result;
2534
+ }
2535
+
2536
+ module.exports = defineNamespace;
2537
+
2538
+
2539
+ /***/ }),
2540
+ /* 15 */
2541
+ /***/ (function(module, exports, __webpack_require__) {
2542
+
2543
+ /**
2544
+ * @fileoverview
2545
+ * This module provides some functions for custom events.<br>
2546
+ * And it is implemented in the observer design pattern.
2547
+ * @author NHN Ent.
2548
+ * FE Development Lab <dl_javascript@nhnent.com>
2549
+ */
2550
+
2551
+ 'use strict';
2552
+
2553
+ var collection = __webpack_require__(4);
2554
+ var type = __webpack_require__(2);
2555
+ var object = __webpack_require__(1);
2556
+
2557
+ var R_EVENTNAME_SPLIT = /\s+/g;
2558
+
2559
+ /**
2560
+ * A unit of event handler item.
2561
+ * @ignore
2562
+ * @typedef {object} HandlerItem
2563
+ * @property {function} fn - event handler
2564
+ * @property {object} ctx - context of event handler
2565
+ */
2566
+
2567
+ /**
2568
+ * @class
2569
+ * @memberof tui.util
2570
+ * @example
2571
+ * // node, commonjs
2572
+ * var CustomEvents = require('tui-code-snippet').CustomEvents;
2573
+ * @example
2574
+ * // distribution file, script
2575
+ * <script src='path-to/tui-code-snippt.js'></script>
2576
+ * <script>
2577
+ * var CustomEvents = tui.util.CustomEvents;
2578
+ * </script>
2579
+ */
2580
+ function CustomEvents() {
2581
+ /**
2582
+ * @type {HandlerItem[]}
2583
+ */
2584
+ this.events = null;
2585
+
2586
+ /**
2587
+ * only for checking specific context event was binded
2588
+ * @type {object[]}
2589
+ */
2590
+ this.contexts = null;
2591
+ }
2592
+
2593
+ /**
2594
+ * Mixin custom events feature to specific constructor
2595
+ * @param {function} func - constructor
2596
+ * @example
2597
+ * //-- #1. Get Module --//
2598
+ * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs
2599
+ * var CustomEvents = tui.util.CustomEvents; // distribution file
2600
+ *
2601
+ * //-- #2. Use property --//
2602
+ * var model;
2603
+ * function Model() {
2604
+ * this.name = '';
2605
+ * }
2606
+ * CustomEvents.mixin(Model);
2607
+ *
2608
+ * model = new Model();
2609
+ * model.on('change', function() { this.name = 'model'; }, this);
2610
+ * model.fire('change');
2611
+ * alert(model.name); // 'model';
2612
+ */
2613
+ CustomEvents.mixin = function(func) {
2614
+ object.extend(func.prototype, CustomEvents.prototype);
2615
+ };
2616
+
2617
+ /**
2618
+ * Get HandlerItem object
2619
+ * @param {function} handler - handler function
2620
+ * @param {object} [context] - context for handler
2621
+ * @returns {HandlerItem} HandlerItem object
2622
+ * @private
2623
+ */
2624
+ CustomEvents.prototype._getHandlerItem = function(handler, context) {
2625
+ var item = {handler: handler};
2626
+
2627
+ if (context) {
2628
+ item.context = context;
2629
+ }
2630
+
2631
+ return item;
2632
+ };
2633
+
2634
+ /**
2635
+ * Get event object safely
2636
+ * @param {string} [eventName] - create sub event map if not exist.
2637
+ * @returns {(object|array)} event object. if you supplied `eventName`
2638
+ * parameter then make new array and return it
2639
+ * @private
2640
+ */
2641
+ CustomEvents.prototype._safeEvent = function(eventName) {
2642
+ var events = this.events;
2643
+ var byName;
2644
+
2645
+ if (!events) {
2646
+ events = this.events = {};
2647
+ }
2648
+
2649
+ if (eventName) {
2650
+ byName = events[eventName];
2651
+
2652
+ if (!byName) {
2653
+ byName = [];
2654
+ events[eventName] = byName;
2655
+ }
2656
+
2657
+ events = byName;
2658
+ }
2659
+
2660
+ return events;
2661
+ };
2662
+
2663
+ /**
2664
+ * Get context array safely
2665
+ * @returns {array} context array
2666
+ * @private
2667
+ */
2668
+ CustomEvents.prototype._safeContext = function() {
2669
+ var context = this.contexts;
2670
+
2671
+ if (!context) {
2672
+ context = this.contexts = [];
2673
+ }
2674
+
2675
+ return context;
2676
+ };
2677
+
2678
+ /**
2679
+ * Get index of context
2680
+ * @param {object} ctx - context that used for bind custom event
2681
+ * @returns {number} index of context
2682
+ * @private
2683
+ */
2684
+ CustomEvents.prototype._indexOfContext = function(ctx) {
2685
+ var context = this._safeContext();
2686
+ var index = 0;
2687
+
2688
+ while (context[index]) {
2689
+ if (ctx === context[index][0]) {
2690
+ return index;
2691
+ }
2692
+
2693
+ index += 1;
2694
+ }
2695
+
2696
+ return -1;
2697
+ };
2698
+
2699
+ /**
2700
+ * Memorize supplied context for recognize supplied object is context or
2701
+ * name: handler pair object when off()
2702
+ * @param {object} ctx - context object to memorize
2703
+ * @private
2704
+ */
2705
+ CustomEvents.prototype._memorizeContext = function(ctx) {
2706
+ var context, index;
2707
+
2708
+ if (!type.isExisty(ctx)) {
2709
+ return;
2710
+ }
2711
+
2712
+ context = this._safeContext();
2713
+ index = this._indexOfContext(ctx);
2714
+
2715
+ if (index > -1) {
2716
+ context[index][1] += 1;
2717
+ } else {
2718
+ context.push([ctx, 1]);
2719
+ }
2720
+ };
2721
+
2722
+ /**
2723
+ * Forget supplied context object
2724
+ * @param {object} ctx - context object to forget
2725
+ * @private
2726
+ */
2727
+ CustomEvents.prototype._forgetContext = function(ctx) {
2728
+ var context, contextIndex;
2729
+
2730
+ if (!type.isExisty(ctx)) {
2731
+ return;
2732
+ }
2733
+
2734
+ context = this._safeContext();
2735
+ contextIndex = this._indexOfContext(ctx);
2736
+
2737
+ if (contextIndex > -1) {
2738
+ context[contextIndex][1] -= 1;
2739
+
2740
+ if (context[contextIndex][1] <= 0) {
2741
+ context.splice(contextIndex, 1);
2742
+ }
2743
+ }
2744
+ };
2745
+
2746
+ /**
2747
+ * Bind event handler
2748
+ * @param {(string|{name:string, handler:function})} eventName - custom
2749
+ * event name or an object {eventName: handler}
2750
+ * @param {(function|object)} [handler] - handler function or context
2751
+ * @param {object} [context] - context for binding
2752
+ * @private
2753
+ */
2754
+ CustomEvents.prototype._bindEvent = function(eventName, handler, context) {
2755
+ var events = this._safeEvent(eventName);
2756
+ this._memorizeContext(context);
2757
+ events.push(this._getHandlerItem(handler, context));
2758
+ };
2759
+
2760
+ /**
2761
+ * Bind event handlers
2762
+ * @param {(string|{name:string, handler:function})} eventName - custom
2763
+ * event name or an object {eventName: handler}
2764
+ * @param {(function|object)} [handler] - handler function or context
2765
+ * @param {object} [context] - context for binding
2766
+ * //-- #1. Get Module --//
2767
+ * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs
2768
+ * var CustomEvents = tui.util.CustomEvents; // distribution file
2769
+ *
2770
+ * //-- #2. Use property --//
2771
+ * // # 2.1 Basic Usage
2772
+ * CustomEvents.on('onload', handler);
2773
+ *
2774
+ * // # 2.2 With context
2775
+ * CustomEvents.on('onload', handler, myObj);
2776
+ *
2777
+ * // # 2.3 Bind by object that name, handler pairs
2778
+ * CustomEvents.on({
2779
+ * 'play': handler,
2780
+ * 'pause': handler2
2781
+ * });
2782
+ *
2783
+ * // # 2.4 Bind by object that name, handler pairs with context object
2784
+ * CustomEvents.on({
2785
+ * 'play': handler
2786
+ * }, myObj);
2787
+ */
2788
+ CustomEvents.prototype.on = function(eventName, handler, context) {
2789
+ var self = this;
2790
+
2791
+ if (type.isString(eventName)) {
2792
+ // [syntax 1, 2]
2793
+ eventName = eventName.split(R_EVENTNAME_SPLIT);
2794
+ collection.forEach(eventName, function(name) {
2795
+ self._bindEvent(name, handler, context);
2796
+ });
2797
+ } else if (type.isObject(eventName)) {
2798
+ // [syntax 3, 4]
2799
+ context = handler;
2800
+ collection.forEach(eventName, function(func, name) {
2801
+ self.on(name, func, context);
2802
+ });
2803
+ }
2804
+ };
2805
+
2806
+ /**
2807
+ * Bind one-shot event handlers
2808
+ * @param {(string|{name:string,handler:function})} eventName - custom
2809
+ * event name or an object {eventName: handler}
2810
+ * @param {function|object} [handler] - handler function or context
2811
+ * @param {object} [context] - context for binding
2812
+ */
2813
+ CustomEvents.prototype.once = function(eventName, handler, context) {
2814
+ var self = this;
2815
+
2816
+ if (type.isObject(eventName)) {
2817
+ context = handler;
2818
+ collection.forEach(eventName, function(func, name) {
2819
+ self.once(name, func, context);
2820
+ });
2821
+
2822
+ return;
2823
+ }
2824
+
2825
+ function onceHandler() { // eslint-disable-line require-jsdoc
2826
+ handler.apply(context, arguments);
2827
+ self.off(eventName, onceHandler, context);
2828
+ }
2829
+
2830
+ this.on(eventName, onceHandler, context);
2831
+ };
2832
+
2833
+ /**
2834
+ * Splice supplied array by callback result
2835
+ * @param {array} arr - array to splice
2836
+ * @param {function} predicate - function return boolean
2837
+ * @private
2838
+ */
2839
+ CustomEvents.prototype._spliceMatches = function(arr, predicate) {
2840
+ var i = 0;
2841
+ var len;
2842
+
2843
+ if (!type.isArray(arr)) {
2844
+ return;
2845
+ }
2846
+
2847
+ for (len = arr.length; i < len; i += 1) {
2848
+ if (predicate(arr[i]) === true) {
2849
+ arr.splice(i, 1);
2850
+ len -= 1;
2851
+ i -= 1;
2852
+ }
2853
+ }
2854
+ };
2855
+
2856
+ /**
2857
+ * Get matcher for unbind specific handler events
2858
+ * @param {function} handler - handler function
2859
+ * @returns {function} handler matcher
2860
+ * @private
2861
+ */
2862
+ CustomEvents.prototype._matchHandler = function(handler) {
2863
+ var self = this;
2864
+
2865
+ return function(item) {
2866
+ var needRemove = handler === item.handler;
2867
+
2868
+ if (needRemove) {
2869
+ self._forgetContext(item.context);
2870
+ }
2871
+
2872
+ return needRemove;
2873
+ };
2874
+ };
2875
+
2876
+ /**
2877
+ * Get matcher for unbind specific context events
2878
+ * @param {object} context - context
2879
+ * @returns {function} object matcher
2880
+ * @private
2881
+ */
2882
+ CustomEvents.prototype._matchContext = function(context) {
2883
+ var self = this;
2884
+
2885
+ return function(item) {
2886
+ var needRemove = context === item.context;
2887
+
2888
+ if (needRemove) {
2889
+ self._forgetContext(item.context);
2890
+ }
2891
+
2892
+ return needRemove;
2893
+ };
2894
+ };
2895
+
2896
+ /**
2897
+ * Get matcher for unbind specific hander, context pair events
2898
+ * @param {function} handler - handler function
2899
+ * @param {object} context - context
2900
+ * @returns {function} handler, context matcher
2901
+ * @private
2902
+ */
2903
+ CustomEvents.prototype._matchHandlerAndContext = function(handler, context) {
2904
+ var self = this;
2905
+
2906
+ return function(item) {
2907
+ var matchHandler = (handler === item.handler);
2908
+ var matchContext = (context === item.context);
2909
+ var needRemove = (matchHandler && matchContext);
2910
+
2911
+ if (needRemove) {
2912
+ self._forgetContext(item.context);
2913
+ }
2914
+
2915
+ return needRemove;
2916
+ };
2917
+ };
2918
+
2919
+ /**
2920
+ * Unbind event by event name
2921
+ * @param {string} eventName - custom event name to unbind
2922
+ * @param {function} [handler] - handler function
2923
+ * @private
2924
+ */
2925
+ CustomEvents.prototype._offByEventName = function(eventName, handler) {
2926
+ var self = this;
2927
+ var forEach = collection.forEachArray;
2928
+ var andByHandler = type.isFunction(handler);
2929
+ var matchHandler = self._matchHandler(handler);
2930
+
2931
+ eventName = eventName.split(R_EVENTNAME_SPLIT);
2932
+
2933
+ forEach(eventName, function(name) {
2934
+ var handlerItems = self._safeEvent(name);
2935
+
2936
+ if (andByHandler) {
2937
+ self._spliceMatches(handlerItems, matchHandler);
2938
+ } else {
2939
+ forEach(handlerItems, function(item) {
2940
+ self._forgetContext(item.context);
2941
+ });
2942
+
2943
+ self.events[name] = [];
2944
+ }
2945
+ });
2946
+ };
2947
+
2948
+ /**
2949
+ * Unbind event by handler function
2950
+ * @param {function} handler - handler function
2951
+ * @private
2952
+ */
2953
+ CustomEvents.prototype._offByHandler = function(handler) {
2954
+ var self = this;
2955
+ var matchHandler = this._matchHandler(handler);
2956
+
2957
+ collection.forEach(this._safeEvent(), function(handlerItems) {
2958
+ self._spliceMatches(handlerItems, matchHandler);
2959
+ });
2960
+ };
2961
+
2962
+ /**
2963
+ * Unbind event by object(name: handler pair object or context object)
2964
+ * @param {object} obj - context or {name: handler} pair object
2965
+ * @param {function} handler - handler function
2966
+ * @private
2967
+ */
2968
+ CustomEvents.prototype._offByObject = function(obj, handler) {
2969
+ var self = this;
2970
+ var matchFunc;
2971
+
2972
+ if (this._indexOfContext(obj) < 0) {
2973
+ collection.forEach(obj, function(func, name) {
2974
+ self.off(name, func);
2975
+ });
2976
+ } else if (type.isString(handler)) {
2977
+ matchFunc = this._matchContext(obj);
2978
+
2979
+ self._spliceMatches(this._safeEvent(handler), matchFunc);
2980
+ } else if (type.isFunction(handler)) {
2981
+ matchFunc = this._matchHandlerAndContext(handler, obj);
2982
+
2983
+ collection.forEach(this._safeEvent(), function(handlerItems) {
2984
+ self._spliceMatches(handlerItems, matchFunc);
2985
+ });
2986
+ } else {
2987
+ matchFunc = this._matchContext(obj);
2988
+
2989
+ collection.forEach(this._safeEvent(), function(handlerItems) {
2990
+ self._spliceMatches(handlerItems, matchFunc);
2991
+ });
2992
+ }
2993
+ };
2994
+
2995
+ /**
2996
+ * Unbind custom events
2997
+ * @param {(string|object|function)} eventName - event name or context or
2998
+ * {name: handler} pair object or handler function
2999
+ * @param {(function)} handler - handler function
3000
+ * @example
3001
+ * //-- #1. Get Module --//
3002
+ * var CustomEvents = require('tui-code-snippet').CustomEvents; // node, commonjs
3003
+ * var CustomEvents = tui.util.CustomEvents; // distribution file
3004
+ *
3005
+ * //-- #2. Use property --//
3006
+ * // # 2.1 off by event name
3007
+ * CustomEvents.off('onload');
3008
+ *
3009
+ * // # 2.2 off by event name and handler
3010
+ * CustomEvents.off('play', handler);
3011
+ *
3012
+ * // # 2.3 off by handler
3013
+ * CustomEvents.off(handler);
3014
+ *
3015
+ * // # 2.4 off by context
3016
+ * CustomEvents.off(myObj);
3017
+ *
3018
+ * // # 2.5 off by context and handler
3019
+ * CustomEvents.off(myObj, handler);
3020
+ *
3021
+ * // # 2.6 off by context and event name
3022
+ * CustomEvents.off(myObj, 'onload');
3023
+ *
3024
+ * // # 2.7 off by an Object.<string, function> that is {eventName: handler}
3025
+ * CustomEvents.off({
3026
+ * 'play': handler,
3027
+ * 'pause': handler2
3028
+ * });
3029
+ *
3030
+ * // # 2.8 off the all events
3031
+ * CustomEvents.off();
3032
+ */
3033
+ CustomEvents.prototype.off = function(eventName, handler) {
3034
+ if (type.isString(eventName)) {
3035
+ // [syntax 1, 2]
3036
+ this._offByEventName(eventName, handler);
3037
+ } else if (!arguments.length) {
3038
+ // [syntax 8]
3039
+ this.events = {};
3040
+ this.contexts = [];
3041
+ } else if (type.isFunction(eventName)) {
3042
+ // [syntax 3]
3043
+ this._offByHandler(eventName);
3044
+ } else if (type.isObject(eventName)) {
3045
+ // [syntax 4, 5, 6]
3046
+ this._offByObject(eventName, handler);
3047
+ }
3048
+ };
3049
+
3050
+ /**
3051
+ * Fire custom event
3052
+ * @param {string} eventName - name of custom event
3053
+ */
3054
+ CustomEvents.prototype.fire = function(eventName) { // eslint-disable-line
3055
+ this.invoke.apply(this, arguments);
3056
+ };
3057
+
3058
+ /**
3059
+ * Fire a event and returns the result of operation 'boolean AND' with all
3060
+ * listener's results.
3061
+ *
3062
+ * So, It is different from {@link CustomEvents#fire}.
3063
+ *
3064
+ * In service code, use this as a before event in component level usually
3065
+ * for notifying that the event is cancelable.
3066
+ * @param {string} eventName - Custom event name
3067
+ * @param {...*} data - Data for event
3068
+ * @returns {boolean} The result of operation 'boolean AND'
3069
+ * @example
3070
+ * var map = new Map();
3071
+ * map.on({
3072
+ * 'beforeZoom': function() {
3073
+ * // It should cancel the 'zoom' event by some conditions.
3074
+ * if (that.disabled && this.getState()) {
3075
+ * return false;
3076
+ * }
3077
+ * return true;
3078
+ * }
3079
+ * });
3080
+ *
3081
+ * if (this.invoke('beforeZoom')) { // check the result of 'beforeZoom'
3082
+ * // if true,
3083
+ * // doSomething
3084
+ * }
3085
+ */
3086
+ CustomEvents.prototype.invoke = function(eventName) {
3087
+ var events, args, index, item;
3088
+
3089
+ if (!this.hasListener(eventName)) {
3090
+ return true;
3091
+ }
3092
+
3093
+ events = this._safeEvent(eventName);
3094
+ args = Array.prototype.slice.call(arguments, 1);
3095
+ index = 0;
3096
+
3097
+ while (events[index]) {
3098
+ item = events[index];
3099
+
3100
+ if (item.handler.apply(item.context, args) === false) {
3101
+ return false;
3102
+ }
3103
+
3104
+ index += 1;
3105
+ }
3106
+
3107
+ return true;
3108
+ };
3109
+
3110
+ /**
3111
+ * Return whether at least one of the handlers is registered in the given
3112
+ * event name.
3113
+ * @param {string} eventName - Custom event name
3114
+ * @returns {boolean} Is there at least one handler in event name?
3115
+ */
3116
+ CustomEvents.prototype.hasListener = function(eventName) {
3117
+ return this.getListenerLength(eventName) > 0;
3118
+ };
3119
+
3120
+ /**
3121
+ * Return a count of events registered.
3122
+ * @param {string} eventName - Custom event name
3123
+ * @returns {number} number of event
3124
+ */
3125
+ CustomEvents.prototype.getListenerLength = function(eventName) {
3126
+ var events = this._safeEvent(eventName);
3127
+
3128
+ return events.length;
3129
+ };
3130
+
3131
+ module.exports = CustomEvents;
3132
+
3133
+
3134
+ /***/ }),
3135
+ /* 16 */
3136
+ /***/ (function(module, exports, __webpack_require__) {
3137
+
3138
+ /**
3139
+ * @fileoverview This module provides a Enum Constructor.
3140
+ * @author NHN Ent.
3141
+ * FE Development Lab <dl_javascript@nhnent.com>
3142
+ * @example
3143
+ * // node, commonjs
3144
+ * var Enum = require('tui-code-snippet').Enum;
3145
+ * @example
3146
+ * // distribution file, script
3147
+ * <script src='path-to/tui-code-snippt.js'></script>
3148
+ * <script>
3149
+ * var Enum = tui.util.Enum;
3150
+ * <script>
3151
+ */
3152
+
3153
+ 'use strict';
3154
+
3155
+ var collection = __webpack_require__(4);
3156
+ var type = __webpack_require__(2);
3157
+
3158
+ /**
3159
+ * Check whether the defineProperty() method is supported.
3160
+ * @type {boolean}
3161
+ * @ignore
3162
+ */
3163
+ var isSupportDefinedProperty = (function() {
3164
+ try {
3165
+ Object.defineProperty({}, 'x', {});
3166
+
3167
+ return true;
3168
+ } catch (e) {
3169
+ return false;
3170
+ }
3171
+ })();
3172
+
3173
+ /**
3174
+ * A unique value of a constant.
3175
+ * @type {number}
3176
+ * @ignore
3177
+ */
3178
+ var enumValue = 0;
3179
+
3180
+ /**
3181
+ * Make a constant-list that has unique values.<br>
3182
+ * In modern browsers (except IE8 and lower),<br>
3183
+ * a value defined once can not be changed.
3184
+ *
3185
+ * @param {...string|string[]} itemList Constant-list (An array of string is available)
3186
+ * @class
3187
+ * @memberof tui.util
3188
+ * @example
3189
+ * //-- #1. Get Module --//
3190
+ * var Enum = require('tui-code-snippet').Enum; // node, commonjs
3191
+ * var Enum = tui.util.Enum; // distribution file
3192
+ *
3193
+ * //-- #2. Use property --//
3194
+ * var MYENUM = new Enum('TYPE1', 'TYPE2');
3195
+ * var MYENUM2 = new Enum(['TYPE1', 'TYPE2']);
3196
+ *
3197
+ * //usage
3198
+ * if (value === MYENUM.TYPE1) {
3199
+ * ....
3200
+ * }
3201
+ *
3202
+ * //add (If a duplicate name is inputted, will be disregarded.)
3203
+ * MYENUM.set('TYPE3', 'TYPE4');
3204
+ *
3205
+ * //get name of a constant by a value
3206
+ * MYENUM.getName(MYENUM.TYPE1); // 'TYPE1'
3207
+ *
3208
+ * // In modern browsers (except IE8 and lower), a value can not be changed in constants.
3209
+ * var originalValue = MYENUM.TYPE1;
3210
+ * MYENUM.TYPE1 = 1234; // maybe TypeError
3211
+ * MYENUM.TYPE1 === originalValue; // true
3212
+ **/
3213
+ function Enum(itemList) {
3214
+ if (itemList) {
3215
+ this.set.apply(this, arguments);
3216
+ }
3217
+ }
3218
+
3219
+ /**
3220
+ * Define a constants-list
3221
+ * @param {...string|string[]} itemList Constant-list (An array of string is available)
3222
+ */
3223
+ Enum.prototype.set = function(itemList) {
3224
+ var self = this;
3225
+
3226
+ if (!type.isArray(itemList)) {
3227
+ itemList = collection.toArray(arguments);
3228
+ }
3229
+
3230
+ collection.forEach(itemList, function itemListIteratee(item) {
3231
+ self._addItem(item);
3232
+ });
3233
+ };
3234
+
3235
+ /**
3236
+ * Return a key of the constant.
3237
+ * @param {number} value A value of the constant.
3238
+ * @returns {string|undefined} Key of the constant.
3239
+ */
3240
+ Enum.prototype.getName = function(value) {
3241
+ var self = this;
3242
+ var foundedKey;
3243
+
3244
+ collection.forEach(this, function(itemValue, key) { // eslint-disable-line consistent-return
3245
+ if (self._isEnumItem(key) && value === itemValue) {
3246
+ foundedKey = key;
3247
+
3248
+ return false;
3249
+ }
3250
+ });
3251
+
3252
+ return foundedKey;
3253
+ };
3254
+
3255
+ /**
3256
+ * Create a constant.
3257
+ * @private
3258
+ * @param {string} name Constant name. (It will be a key of a constant)
3259
+ */
3260
+ Enum.prototype._addItem = function(name) {
3261
+ var value;
3262
+
3263
+ if (!this.hasOwnProperty(name)) {
3264
+ value = this._makeEnumValue();
3265
+
3266
+ if (isSupportDefinedProperty) {
3267
+ Object.defineProperty(this, name, {
3268
+ enumerable: true,
3269
+ configurable: false,
3270
+ writable: false,
3271
+ value: value
3272
+ });
3273
+ } else {
3274
+ this[name] = value;
3275
+ }
3276
+ }
3277
+ };
3278
+
3279
+ /**
3280
+ * Return a unique value for assigning to a constant.
3281
+ * @private
3282
+ * @returns {number} A unique value
3283
+ */
3284
+ Enum.prototype._makeEnumValue = function() {
3285
+ var value;
3286
+
3287
+ value = enumValue;
3288
+ enumValue += 1;
3289
+
3290
+ return value;
3291
+ };
3292
+
3293
+ /**
3294
+ * Return whether a constant from the given key is in instance or not.
3295
+ * @param {string} key - A constant key
3296
+ * @returns {boolean} Result
3297
+ * @private
3298
+ */
3299
+ Enum.prototype._isEnumItem = function(key) {
3300
+ return type.isNumber(this[key]);
3301
+ };
3302
+
3303
+ module.exports = Enum;
3304
+
3305
+
3306
+ /***/ }),
3307
+ /* 17 */
3308
+ /***/ (function(module, exports, __webpack_require__) {
3309
+
3310
+ /**
3311
+ * @fileoverview
3312
+ * Implements the ExMap (Extended Map) object.
3313
+ * @author NHN Ent.
3314
+ * FE Development Lab <dl_javascript@nhnent.com>
3315
+ */
3316
+
3317
+ 'use strict';
3318
+
3319
+ var collection = __webpack_require__(4);
3320
+ var Map = __webpack_require__(18);
3321
+
3322
+ // Caching tui.util for performance enhancing
3323
+ var mapAPIsForRead = ['get', 'has', 'forEach', 'keys', 'values', 'entries'];
3324
+ var mapAPIsForDelete = ['delete', 'clear'];
3325
+
3326
+ /**
3327
+ * The ExMap object is Extended Version of the tui.util.Map object.<br>
3328
+ * and added some useful feature to make it easy to manage the Map object.
3329
+ * @constructor
3330
+ * @param {Array} initData - Array of key-value pairs (2-element Arrays).
3331
+ * Each key-value pair will be added to the new Map
3332
+ * @memberof tui.util
3333
+ * @example
3334
+ * // node, commonjs
3335
+ * var ExMap = require('tui-code-snippet').ExMap;
3336
+ * @example
3337
+ * // distribution file, script
3338
+ * <script src='path-to/tui-code-snippt.js'></script>
3339
+ * <script>
3340
+ * var ExMap = tui.util.ExMap;
3341
+ * <script>
3342
+ */
3343
+ function ExMap(initData) {
3344
+ this._map = new Map(initData);
3345
+ this.size = this._map.size;
3346
+ }
3347
+
3348
+ collection.forEachArray(mapAPIsForRead, function(name) {
3349
+ ExMap.prototype[name] = function() {
3350
+ return this._map[name].apply(this._map, arguments);
3351
+ };
3352
+ });
3353
+
3354
+ collection.forEachArray(mapAPIsForDelete, function(name) {
3355
+ ExMap.prototype[name] = function() {
3356
+ var result = this._map[name].apply(this._map, arguments);
3357
+ this.size = this._map.size;
3358
+
3359
+ return result;
3360
+ };
3361
+ });
3362
+
3363
+ ExMap.prototype.set = function() {
3364
+ this._map.set.apply(this._map, arguments);
3365
+ this.size = this._map.size;
3366
+
3367
+ return this;
3368
+ };
3369
+
3370
+ /**
3371
+ * Sets all of the key-value pairs in the specified object to the Map object.
3372
+ * @param {Object} object - Plain object that has a key-value pair
3373
+ */
3374
+ ExMap.prototype.setObject = function(object) {
3375
+ collection.forEachOwnProperties(object, function(value, key) {
3376
+ this.set(key, value);
3377
+ }, this);
3378
+ };
3379
+
3380
+ /**
3381
+ * Removes the elements associated with keys in the specified array.
3382
+ * @param {Array} keys - Array that contains keys of the element to remove
3383
+ */
3384
+ ExMap.prototype.deleteByKeys = function(keys) {
3385
+ collection.forEachArray(keys, function(key) {
3386
+ this['delete'](key);
3387
+ }, this);
3388
+ };
3389
+
3390
+ /**
3391
+ * Sets all of the key-value pairs in the specified Map object to this Map object.
3392
+ * @param {Map} map - Map object to be merged into this Map object
3393
+ */
3394
+ ExMap.prototype.merge = function(map) {
3395
+ map.forEach(function(value, key) {
3396
+ this.set(key, value);
3397
+ }, this);
3398
+ };
3399
+
3400
+ /**
3401
+ * Looks through each key-value pair in the map and returns the new ExMap object of
3402
+ * all key-value pairs that pass a truth test implemented by the provided function.
3403
+ * @param {function} predicate - Function to test each key-value pair of the Map object.<br>
3404
+ * Invoked with arguments (value, key). Return true to keep the element, false otherwise.
3405
+ * @returns {ExMap} A new ExMap object
3406
+ */
3407
+ ExMap.prototype.filter = function(predicate) {
3408
+ var filtered = new ExMap();
3409
+
3410
+ this.forEach(function(value, key) {
3411
+ if (predicate(value, key)) {
3412
+ filtered.set(key, value);
3413
+ }
3414
+ });
3415
+
3416
+ return filtered;
3417
+ };
3418
+
3419
+ module.exports = ExMap;
3420
+
3421
+
3422
+ /***/ }),
3423
+ /* 18 */
3424
+ /***/ (function(module, exports, __webpack_require__) {
3425
+
3426
+
3427
+ /**
3428
+ * @fileoverview
3429
+ * Implements the Map object.
3430
+ * @author NHN Ent.
3431
+ * FE Development Lab <dl_javascript@nhnent.com>
3432
+ */
3433
+
3434
+ 'use strict';
3435
+
3436
+ var collection = __webpack_require__(4);
3437
+ var type = __webpack_require__(2);
3438
+ var array = __webpack_require__(3);
3439
+ var browser = __webpack_require__(9);
3440
+ var func = __webpack_require__(5);
3441
+
3442
+ /**
3443
+ * Using undefined for a key can be ambiguous if there's deleted item in the array,<br>
3444
+ * which is also undefined when accessed by index.<br>
3445
+ * So use this unique object as an undefined key to distinguish it from deleted keys.
3446
+ * @private
3447
+ * @constant
3448
+ */
3449
+ var _KEY_FOR_UNDEFINED = {};
3450
+
3451
+ /**
3452
+ * For using NaN as a key, use this unique object as a NaN key.<br>
3453
+ * This makes it easier and faster to compare an object with each keys in the array<br>
3454
+ * through no exceptional comapring for NaN.
3455
+ * @private
3456
+ * @constant
3457
+ */
3458
+ var _KEY_FOR_NAN = {};
3459
+
3460
+ /**
3461
+ * Constructor of MapIterator<br>
3462
+ * Creates iterator object with new keyword.
3463
+ * @constructor
3464
+ * @param {Array} keys - The array of keys in the map
3465
+ * @param {function} valueGetter - Function that returns certain value,
3466
+ * taking key and keyIndex as arguments.
3467
+ * @ignore
3468
+ */
3469
+ function MapIterator(keys, valueGetter) {
3470
+ this._keys = keys;
3471
+ this._valueGetter = valueGetter;
3472
+ this._length = this._keys.length;
3473
+ this._index = -1;
3474
+ this._done = false;
3475
+ }
3476
+
3477
+ /**
3478
+ * Implementation of Iterator protocol.
3479
+ * @returns {{done: boolean, value: *}} Object that contains done(boolean) and value.
3480
+ */
3481
+ MapIterator.prototype.next = function() {
3482
+ var data = {};
3483
+ do {
3484
+ this._index += 1;
3485
+ } while (type.isUndefined(this._keys[this._index]) && this._index < this._length);
3486
+
3487
+ if (this._index >= this._length) {
3488
+ data.done = true;
3489
+ } else {
3490
+ data.done = false;
3491
+ data.value = this._valueGetter(this._keys[this._index], this._index);
3492
+ }
3493
+
3494
+ return data;
3495
+ };
3496
+
3497
+ /**
3498
+ * The Map object implements the ES6 Map specification as closely as possible.<br>
3499
+ * For using objects and primitive values as keys, this object uses array internally.<br>
3500
+ * So if the key is not a string, get(), set(), has(), delete() will operates in O(n),<br>
3501
+ * and it can cause performance issues with a large dataset.
3502
+ *
3503
+ * Features listed below are not supported. (can't be implented without native support)
3504
+ * - Map object is iterable<br>
3505
+ * - Iterable object can be used as an argument of constructor
3506
+ *
3507
+ * If the browser supports full implementation of ES6 Map specification, native Map obejct
3508
+ * will be used internally.
3509
+ * @class
3510
+ * @param {Array} initData - Array of key-value pairs (2-element Arrays).
3511
+ * Each key-value pair will be added to the new Map
3512
+ * @memberof tui.util
3513
+ * @example
3514
+ * // node, commonjs
3515
+ * var Map = require('tui-code-snippet').Map;
3516
+ * @example
3517
+ * // distribution file, script
3518
+ * <script src='path-to/tui-code-snippt.js'></script>
3519
+ * <script>
3520
+ * var Map = tui.util.Map;
3521
+ * <script>
3522
+ */
3523
+ function Map(initData) {
3524
+ this._valuesForString = {};
3525
+ this._valuesForIndex = {};
3526
+ this._keys = [];
3527
+
3528
+ if (initData) {
3529
+ this._setInitData(initData);
3530
+ }
3531
+
3532
+ this.size = 0;
3533
+ }
3534
+
3535
+ /* eslint-disable no-extend-native */
3536
+ /**
3537
+ * Add all elements in the initData to the Map object.
3538
+ * @private
3539
+ * @param {Array} initData - Array of key-value pairs to add to the Map object
3540
+ */
3541
+ Map.prototype._setInitData = function(initData) {
3542
+ if (!type.isArray(initData)) {
3543
+ throw new Error('Only Array is supported.');
3544
+ }
3545
+ collection.forEachArray(initData, function(pair) {
3546
+ this.set(pair[0], pair[1]);
3547
+ }, this);
3548
+ };
3549
+
3550
+ /**
3551
+ * Returns true if the specified value is NaN.<br>
3552
+ * For unsing NaN as a key, use this method to test equality of NaN<br>
3553
+ * because === operator doesn't work for NaN.
3554
+ * @private
3555
+ * @param {*} value - Any object to be tested
3556
+ * @returns {boolean} True if value is NaN, false otherwise.
3557
+ */
3558
+ Map.prototype._isNaN = function(value) {
3559
+ return typeof value === 'number' && value !== value; // eslint-disable-line no-self-compare
3560
+ };
3561
+
3562
+ /**
3563
+ * Returns the index of the specified key.
3564
+ * @private
3565
+ * @param {*} key - The key object to search for.
3566
+ * @returns {number} The index of the specified key
3567
+ */
3568
+ Map.prototype._getKeyIndex = function(key) {
3569
+ var result = -1;
3570
+ var value;
3571
+
3572
+ if (type.isString(key)) {
3573
+ value = this._valuesForString[key];
3574
+ if (value) {
3575
+ result = value.keyIndex;
3576
+ }
3577
+ } else {
3578
+ result = array.inArray(key, this._keys);
3579
+ }
3580
+
3581
+ return result;
3582
+ };
3583
+
3584
+ /**
3585
+ * Returns the original key of the specified key.
3586
+ * @private
3587
+ * @param {*} key - key
3588
+ * @returns {*} Original key
3589
+ */
3590
+ Map.prototype._getOriginKey = function(key) {
3591
+ var originKey = key;
3592
+ if (key === _KEY_FOR_UNDEFINED) {
3593
+ originKey = undefined; // eslint-disable-line no-undefined
3594
+ } else if (key === _KEY_FOR_NAN) {
3595
+ originKey = NaN;
3596
+ }
3597
+
3598
+ return originKey;
3599
+ };
3600
+
3601
+ /**
3602
+ * Returns the unique key of the specified key.
3603
+ * @private
3604
+ * @param {*} key - key
3605
+ * @returns {*} Unique key
3606
+ */
3607
+ Map.prototype._getUniqueKey = function(key) {
3608
+ var uniqueKey = key;
3609
+ if (type.isUndefined(key)) {
3610
+ uniqueKey = _KEY_FOR_UNDEFINED;
3611
+ } else if (this._isNaN(key)) {
3612
+ uniqueKey = _KEY_FOR_NAN;
3613
+ }
3614
+
3615
+ return uniqueKey;
3616
+ };
3617
+
3618
+ /**
3619
+ * Returns the value object of the specified key.
3620
+ * @private
3621
+ * @param {*} key - The key of the value object to be returned
3622
+ * @param {number} keyIndex - The index of the key
3623
+ * @returns {{keyIndex: number, origin: *}} Value object
3624
+ */
3625
+ Map.prototype._getValueObject = function(key, keyIndex) { // eslint-disable-line consistent-return
3626
+ if (type.isString(key)) {
3627
+ return this._valuesForString[key];
3628
+ }
3629
+
3630
+ if (type.isUndefined(keyIndex)) {
3631
+ keyIndex = this._getKeyIndex(key);
3632
+ }
3633
+ if (keyIndex >= 0) {
3634
+ return this._valuesForIndex[keyIndex];
3635
+ }
3636
+ };
3637
+
3638
+ /**
3639
+ * Returns the original value of the specified key.
3640
+ * @private
3641
+ * @param {*} key - The key of the value object to be returned
3642
+ * @param {number} keyIndex - The index of the key
3643
+ * @returns {*} Original value
3644
+ */
3645
+ Map.prototype._getOriginValue = function(key, keyIndex) {
3646
+ return this._getValueObject(key, keyIndex).origin;
3647
+ };
3648
+
3649
+ /**
3650
+ * Returns key-value pair of the specified key.
3651
+ * @private
3652
+ * @param {*} key - The key of the value object to be returned
3653
+ * @param {number} keyIndex - The index of the key
3654
+ * @returns {Array} Key-value Pair
3655
+ */
3656
+ Map.prototype._getKeyValuePair = function(key, keyIndex) {
3657
+ return [this._getOriginKey(key), this._getOriginValue(key, keyIndex)];
3658
+ };
3659
+
3660
+ /**
3661
+ * Creates the wrapper object of original value that contains a key index
3662
+ * and returns it.
3663
+ * @private
3664
+ * @param {type} origin - Original value
3665
+ * @param {type} keyIndex - Index of the key
3666
+ * @returns {{keyIndex: number, origin: *}} Value object
3667
+ */
3668
+ Map.prototype._createValueObject = function(origin, keyIndex) {
3669
+ return {
3670
+ keyIndex: keyIndex,
3671
+ origin: origin
3672
+ };
3673
+ };
3674
+
3675
+ /**
3676
+ * Sets the value for the key in the Map object.
3677
+ * @param {*} key - The key of the element to add to the Map object
3678
+ * @param {*} value - The value of the element to add to the Map object
3679
+ * @returns {Map} The Map object
3680
+ */
3681
+ Map.prototype.set = function(key, value) {
3682
+ var uniqueKey = this._getUniqueKey(key);
3683
+ var keyIndex = this._getKeyIndex(uniqueKey);
3684
+ var valueObject;
3685
+
3686
+ if (keyIndex < 0) {
3687
+ keyIndex = this._keys.push(uniqueKey) - 1;
3688
+ this.size += 1;
3689
+ }
3690
+ valueObject = this._createValueObject(value, keyIndex);
3691
+
3692
+ if (type.isString(key)) {
3693
+ this._valuesForString[key] = valueObject;
3694
+ } else {
3695
+ this._valuesForIndex[keyIndex] = valueObject;
3696
+ }
3697
+
3698
+ return this;
3699
+ };
3700
+
3701
+ /**
3702
+ * Returns the value associated to the key, or undefined if there is none.
3703
+ * @param {*} key - The key of the element to return
3704
+ * @returns {*} Element associated with the specified key
3705
+ */
3706
+ Map.prototype.get = function(key) {
3707
+ var uniqueKey = this._getUniqueKey(key);
3708
+ var value = this._getValueObject(uniqueKey);
3709
+
3710
+ return value && value.origin;
3711
+ };
3712
+
3713
+ /**
3714
+ * Returns a new Iterator object that contains the keys for each element
3715
+ * in the Map object in insertion order.
3716
+ * @returns {Iterator} A new Iterator object
3717
+ */
3718
+ Map.prototype.keys = function() {
3719
+ return new MapIterator(this._keys, func.bind(this._getOriginKey, this));
3720
+ };
3721
+
3722
+ /**
3723
+ * Returns a new Iterator object that contains the values for each element
3724
+ * in the Map object in insertion order.
3725
+ * @returns {Iterator} A new Iterator object
3726
+ */
3727
+ Map.prototype.values = function() {
3728
+ return new MapIterator(this._keys, func.bind(this._getOriginValue, this));
3729
+ };
3730
+
3731
+ /**
3732
+ * Returns a new Iterator object that contains the [key, value] pairs
3733
+ * for each element in the Map object in insertion order.
3734
+ * @returns {Iterator} A new Iterator object
3735
+ */
3736
+ Map.prototype.entries = function() {
3737
+ return new MapIterator(this._keys, func.bind(this._getKeyValuePair, this));
3738
+ };
3739
+
3740
+ /**
3741
+ * Returns a boolean asserting whether a value has been associated to the key
3742
+ * in the Map object or not.
3743
+ * @param {*} key - The key of the element to test for presence
3744
+ * @returns {boolean} True if an element with the specified key exists;
3745
+ * Otherwise false
3746
+ */
3747
+ Map.prototype.has = function(key) {
3748
+ return !!this._getValueObject(key);
3749
+ };
3750
+
3751
+ /**
3752
+ * Removes the specified element from a Map object.
3753
+ * @param {*} key - The key of the element to remove
3754
+ * @function delete
3755
+ * @memberof tui.util.Map.prototype
3756
+ */
3757
+ // cannot use reserved keyword as a property name in IE8 and under.
3758
+ Map.prototype['delete'] = function(key) {
3759
+ var keyIndex;
3760
+
3761
+ if (type.isString(key)) {
3762
+ if (this._valuesForString[key]) {
3763
+ keyIndex = this._valuesForString[key].keyIndex;
3764
+ delete this._valuesForString[key];
3765
+ }
3766
+ } else {
3767
+ keyIndex = this._getKeyIndex(key);
3768
+ if (keyIndex >= 0) {
3769
+ delete this._valuesForIndex[keyIndex];
3770
+ }
3771
+ }
3772
+
3773
+ if (keyIndex >= 0) {
3774
+ delete this._keys[keyIndex];
3775
+ this.size -= 1;
3776
+ }
3777
+ };
3778
+
3779
+ /**
3780
+ * Executes a provided function once per each key/value pair in the Map object,
3781
+ * in insertion order.
3782
+ * @param {function} callback - Function to execute for each element
3783
+ * @param {thisArg} thisArg - Value to use as this when executing callback
3784
+ */
3785
+ Map.prototype.forEach = function(callback, thisArg) {
3786
+ thisArg = thisArg || this;
3787
+ collection.forEachArray(this._keys, function(key) {
3788
+ if (!type.isUndefined(key)) {
3789
+ callback.call(thisArg, this._getValueObject(key).origin, key, this);
3790
+ }
3791
+ }, this);
3792
+ };
3793
+
3794
+ /**
3795
+ * Removes all elements from a Map object.
3796
+ */
3797
+ Map.prototype.clear = function() {
3798
+ Map.call(this);
3799
+ };
3800
+ /* eslint-enable no-extend-native */
3801
+
3802
+ // Use native Map object if exists.
3803
+ // But only latest versions of Chrome and Firefox support full implementation.
3804
+ (function() {
3805
+ if (window.Map && (
3806
+ (browser.firefox && browser.version >= 37) ||
3807
+ (browser.chrome && browser.version >= 42)
3808
+ )
3809
+ ) {
3810
+ Map = window.Map; // eslint-disable-line no-func-assign
3811
+ }
3812
+ })();
3813
+
3814
+ module.exports = Map;
3815
+
3816
+
3817
+ /***/ }),
3818
+ /* 19 */
3819
+ /***/ (function(module, exports, __webpack_require__) {
3820
+
3821
+ /**
3822
+ * @fileoverview This module provides the HashMap constructor.
3823
+ * @author NHN Ent.
3824
+ * FE Development Lab <dl_javascript@nhnent.com>
3825
+ */
3826
+
3827
+ 'use strict';
3828
+
3829
+ var collection = __webpack_require__(4);
3830
+ var type = __webpack_require__(2);
3831
+ /**
3832
+ * All the data in hashMap begin with _MAPDATAPREFIX;
3833
+ * @type {string}
3834
+ * @private
3835
+ */
3836
+ var _MAPDATAPREFIX = 'å';
3837
+
3838
+ /**
3839
+ * HashMap can handle the key-value pairs.<br>
3840
+ * Caution:<br>
3841
+ * HashMap instance has a length property but is not an instance of Array.
3842
+ * @param {Object} [obj] A initial data for creation.
3843
+ * @constructor
3844
+ * @memberof tui.util
3845
+ * @deprecated since version 1.3.0
3846
+ * @example
3847
+ * // node, commonjs
3848
+ * var HashMap = require('tui-code-snippet').HashMap;
3849
+ * var hm = new tui.util.HashMap({
3850
+ 'mydata': {
3851
+ 'hello': 'imfine'
3852
+ },
3853
+ 'what': 'time'
3854
+ });
3855
+ * @example
3856
+ * // distribution file, script
3857
+ * <script src='path-to/tui-code-snippt.js'></script>
3858
+ * <script>
3859
+ * var HashMap = tui.util.HashMap;
3860
+ * <script>
3861
+ * var hm = new tui.util.HashMap({
3862
+ 'mydata': {
3863
+ 'hello': 'imfine'
3864
+ },
3865
+ 'what': 'time'
3866
+ });
3867
+ */
3868
+ function HashMap(obj) {
3869
+ /**
3870
+ * size
3871
+ * @type {number}
3872
+ */
3873
+ this.length = 0;
3874
+
3875
+ if (obj) {
3876
+ this.setObject(obj);
3877
+ }
3878
+ }
3879
+
3880
+ /**
3881
+ * Set a data from the given key with value or the given object.
3882
+ * @param {string|Object} key A string or object for key
3883
+ * @param {*} [value] A data
3884
+ * @example
3885
+ * //-- #1. Get Module --//
3886
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
3887
+ * var HashMap = tui.util.HashMap; // distribution file
3888
+ *
3889
+ * //-- #2. Use property --//
3890
+ * var hm = new HashMap();
3891
+ * hm.set('key', 'value');
3892
+ * hm.set({
3893
+ * 'key1': 'data1',
3894
+ * 'key2': 'data2'
3895
+ * });
3896
+ */
3897
+ HashMap.prototype.set = function(key, value) {
3898
+ if (arguments.length === 2) {
3899
+ this.setKeyValue(key, value);
3900
+ } else {
3901
+ this.setObject(key);
3902
+ }
3903
+ };
3904
+
3905
+ /**
3906
+ * Set a data from the given key with value.
3907
+ * @param {string} key A string for key
3908
+ * @param {*} value A data
3909
+ * @example
3910
+ * //-- #1. Get Module --//
3911
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
3912
+ * var HashMap = tui.util.HashMap; // distribution file
3913
+ *
3914
+ * //-- #2. Use property --//
3915
+ * var hm = new HashMap();
3916
+ * hm.setKeyValue('key', 'value');
3917
+ */
3918
+ HashMap.prototype.setKeyValue = function(key, value) {
3919
+ if (!this.has(key)) {
3920
+ this.length += 1;
3921
+ }
3922
+ this[this.encodeKey(key)] = value;
3923
+ };
3924
+
3925
+ /**
3926
+ * Set a data from the given object.
3927
+ * @param {Object} obj A object for data
3928
+ * @example
3929
+ * //-- #1. Get Module --//
3930
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
3931
+ * var HashMap = tui.util.HashMap; // distribution file
3932
+ *
3933
+ * //-- #2. Use property --//
3934
+ * var hm = new HashMap();
3935
+ * hm.setObject({
3936
+ * 'key1': 'data1',
3937
+ * 'key2': 'data2'
3938
+ * });
3939
+ */
3940
+ HashMap.prototype.setObject = function(obj) {
3941
+ var self = this;
3942
+
3943
+ collection.forEachOwnProperties(obj, function(value, key) {
3944
+ self.setKeyValue(key, value);
3945
+ });
3946
+ };
3947
+
3948
+ /**
3949
+ * Merge with the given another hashMap.
3950
+ * @param {HashMap} hashMap Another hashMap instance
3951
+ */
3952
+ HashMap.prototype.merge = function(hashMap) {
3953
+ var self = this;
3954
+
3955
+ hashMap.each(function(value, key) {
3956
+ self.setKeyValue(key, value);
3957
+ });
3958
+ };
3959
+
3960
+ /**
3961
+ * Encode the given key for hashMap.
3962
+ * @param {string} key A string for key
3963
+ * @returns {string} A encoded key
3964
+ * @private
3965
+ */
3966
+ HashMap.prototype.encodeKey = function(key) {
3967
+ return _MAPDATAPREFIX + key;
3968
+ };
3969
+
3970
+ /**
3971
+ * Decode the given key in hashMap.
3972
+ * @param {string} key A string for key
3973
+ * @returns {string} A decoded key
3974
+ * @private
3975
+ */
3976
+ HashMap.prototype.decodeKey = function(key) {
3977
+ var decodedKey = key.split(_MAPDATAPREFIX);
3978
+
3979
+ return decodedKey[decodedKey.length - 1];
3980
+ };
3981
+
3982
+ /**
3983
+ * Return the value from the given key.
3984
+ * @param {string} key A string for key
3985
+ * @returns {*} The value from a key
3986
+ * @example
3987
+ * //-- #1. Get Module --//
3988
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
3989
+ * var HashMap = tui.util.HashMap; // distribution file
3990
+ *
3991
+ * //-- #2. Use property --//
3992
+ * var hm = new HashMap();
3993
+ * hm.set('key', 'value');
3994
+ * hm.get('key') // value
3995
+ */
3996
+ HashMap.prototype.get = function(key) {
3997
+ return this[this.encodeKey(key)];
3998
+ };
3999
+
4000
+ /**
4001
+ * Check the existence of a value from the key.
4002
+ * @param {string} key A string for key
4003
+ * @returns {boolean} Indicating whether a value exists or not.
4004
+ * @example
4005
+ * //-- #1. Get Module --//
4006
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
4007
+ * var HashMap = tui.util.HashMap; // distribution file
4008
+ *
4009
+ * //-- #2. Use property --//
4010
+ * var hm = new HashMap();
4011
+ * hm.set('key', 'value');
4012
+ * hm.has('key') // true
4013
+ */
4014
+ HashMap.prototype.has = function(key) {
4015
+ return this.hasOwnProperty(this.encodeKey(key));
4016
+ };
4017
+
4018
+ /**
4019
+ * Remove a data(key-value pairs) from the given key or the given key-list.
4020
+ * @param {...string|string[]} key A string for key
4021
+ * @returns {string|string[]} A removed data
4022
+ * @example
4023
+ * //-- #1. Get Module --//
4024
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
4025
+ * var HashMap = tui.util.HashMap; // distribution file
4026
+ *
4027
+ * //-- #2. Use property --//
4028
+ * var hm = new HashMap();
4029
+ * hm.set('key', 'value');
4030
+ * hm.set('key2', 'value');
4031
+ *
4032
+ * hm.remove('key');
4033
+ * hm.remove('key', 'key2');
4034
+ * hm.remove(['key', 'key2']);
4035
+ */
4036
+ HashMap.prototype.remove = function(key) {
4037
+ if (arguments.length > 1) {
4038
+ key = collection.toArray(arguments);
4039
+ }
4040
+
4041
+ return type.isArray(key) ? this.removeByKeyArray(key) : this.removeByKey(key);
4042
+ };
4043
+
4044
+ /**
4045
+ * Remove data(key-value pair) from the given key.
4046
+ * @param {string} key A string for key
4047
+ * @returns {*|null} A removed data
4048
+ * @example
4049
+ * //-- #1. Get Module --//
4050
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
4051
+ * var HashMap = tui.util.HashMap; // distribution file
4052
+ *
4053
+ * //-- #2. Use property --//
4054
+ * var hm = new HashMap();
4055
+ * hm.set('key', 'value');
4056
+ * hm.removeByKey('key')
4057
+ */
4058
+ HashMap.prototype.removeByKey = function(key) {
4059
+ var data = this.has(key) ? this.get(key) : null;
4060
+
4061
+ if (data !== null) {
4062
+ delete this[this.encodeKey(key)];
4063
+ this.length -= 1;
4064
+ }
4065
+
4066
+ return data;
4067
+ };
4068
+
4069
+ /**
4070
+ * Remove a data(key-value pairs) from the given key-list.
4071
+ * @param {string[]} keyArray An array of keys
4072
+ * @returns {string[]} A removed data
4073
+ * @example
4074
+ * //-- #1. Get Module --//
4075
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
4076
+ * var HashMap = tui.util.HashMap; // distribution file
4077
+ *
4078
+ * //-- #2. Use property --//
4079
+ * var hm = new HashMap();
4080
+ * hm.set('key', 'value');
4081
+ * hm.set('key2', 'value');
4082
+ * hm.removeByKeyArray(['key', 'key2']);
4083
+ */
4084
+ HashMap.prototype.removeByKeyArray = function(keyArray) {
4085
+ var data = [];
4086
+ var self = this;
4087
+
4088
+ collection.forEach(keyArray, function(key) {
4089
+ data.push(self.removeByKey(key));
4090
+ });
4091
+
4092
+ return data;
4093
+ };
4094
+
4095
+ /**
4096
+ * Remove all the data
4097
+ */
4098
+ HashMap.prototype.removeAll = function() {
4099
+ var self = this;
4100
+
4101
+ this.each(function(value, key) {
4102
+ self.remove(key);
4103
+ });
4104
+ };
4105
+
4106
+ /**
4107
+ * Execute the provided callback once for each all the data.
4108
+ * @param {Function} iteratee Callback function
4109
+ * @example
4110
+ * //-- #1. Get Module --//
4111
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
4112
+ * var HashMap = tui.util.HashMap; // distribution file
4113
+ *
4114
+ * //-- #2. Use property --//
4115
+ * var hm = new HashMap();
4116
+ * hm.set('key', 'value');
4117
+ * hm.set('key2', 'value');
4118
+ *
4119
+ * hm.each(function(value, key) {
4120
+ * //do something...
4121
+ * });
4122
+ */
4123
+ HashMap.prototype.each = function(iteratee) {
4124
+ var self = this;
4125
+ var flag;
4126
+
4127
+ collection.forEachOwnProperties(this, function(value, key) { // eslint-disable-line consistent-return
4128
+ if (key.charAt(0) === _MAPDATAPREFIX) {
4129
+ flag = iteratee(value, self.decodeKey(key));
4130
+ }
4131
+
4132
+ if (flag === false) {
4133
+ return flag;
4134
+ }
4135
+ });
4136
+ };
4137
+
4138
+ /**
4139
+ * Return the key-list stored.
4140
+ * @returns {Array} A key-list
4141
+ * @example
4142
+ * //-- #1. Get Module --//
4143
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
4144
+ * var HashMap = tui.util.HashMap; // distribution file
4145
+ *
4146
+ * //-- #2. Use property --//
4147
+ * var hm = new HashMap();
4148
+ * hm.set('key', 'value');
4149
+ * hm.set('key2', 'value');
4150
+ * hm.keys(); //['key', 'key2');
4151
+ */
4152
+ HashMap.prototype.keys = function() {
4153
+ var keys = [];
4154
+ var self = this;
4155
+
4156
+ this.each(function(value, key) {
4157
+ keys.push(self.decodeKey(key));
4158
+ });
4159
+
4160
+ return keys;
4161
+ };
4162
+
4163
+ /**
4164
+ * Work similarly to Array.prototype.map().<br>
4165
+ * It executes the provided callback that checks conditions once for each element of hashMap,<br>
4166
+ * and returns a new array having elements satisfying the conditions
4167
+ * @param {Function} condition A function that checks conditions
4168
+ * @returns {Array} A new array having elements satisfying the conditions
4169
+ * @example
4170
+ * //-- #1. Get Module --//
4171
+ * var HashMap = require('tui-code-snippet').HashMap; // node, commonjs
4172
+ * var HashMap = tui.util.HashMap; // distribution file
4173
+ *
4174
+ * //-- #2. Use property --//
4175
+ * var hm1 = new HashMap();
4176
+ * hm1.set('key', 'value');
4177
+ * hm1.set('key2', 'value');
4178
+ *
4179
+ * hm1.find(function(value, key) {
4180
+ * return key === 'key2';
4181
+ * }); // ['value']
4182
+ *
4183
+ * var hm2 = new HashMap({
4184
+ * 'myobj1': {
4185
+ * visible: true
4186
+ * },
4187
+ * 'mybobj2': {
4188
+ * visible: false
4189
+ * }
4190
+ * });
4191
+ *
4192
+ * hm2.find(function(obj, key) {
4193
+ * return obj.visible === true;
4194
+ * }); // [{visible: true}];
4195
+ */
4196
+ HashMap.prototype.find = function(condition) {
4197
+ var founds = [];
4198
+
4199
+ this.each(function(value, key) {
4200
+ if (condition(value, key)) {
4201
+ founds.push(value);
4202
+ }
4203
+ });
4204
+
4205
+ return founds;
4206
+ };
4207
+
4208
+ /**
4209
+ * Return a new Array having all values.
4210
+ * @returns {Array} A new array having all values
4211
+ */
4212
+ HashMap.prototype.toArray = function() {
4213
+ var result = [];
4214
+
4215
+ this.each(function(v) {
4216
+ result.push(v);
4217
+ });
4218
+
4219
+ return result;
4220
+ };
4221
+
4222
+ module.exports = HashMap;
4223
+
4224
+
4225
+ /***/ })
4226
+ /******/ ])
4227
+ });
4228
+ ;