artfully_ose 1.1.0 → 1.2.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (719) hide show
  1. checksums.yaml +13 -5
  2. data/README.md +28 -0
  3. data/app/assets/fonts/FontAwesome.otf +0 -0
  4. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  5. data/app/assets/fonts/fontawesome-webfont.svg +472 -252
  6. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  7. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  8. data/app/assets/images/actions/do.png +0 -0
  9. data/app/assets/images/actions/do.psd +0 -0
  10. data/app/assets/images/actions/get.png +0 -0
  11. data/app/assets/images/actions/get.psd +0 -0
  12. data/app/assets/images/actions/give.png +0 -0
  13. data/app/assets/images/actions/give.psd +0 -0
  14. data/app/assets/images/actions/go.png +0 -0
  15. data/app/assets/images/actions/go.psd +0 -0
  16. data/app/assets/images/actions/hear.png +0 -0
  17. data/app/assets/images/actions/hear.psd +0 -0
  18. data/app/assets/images/actions/join.png +0 -0
  19. data/app/assets/images/actions/join.psd +0 -0
  20. data/app/assets/images/actions/say.png +0 -0
  21. data/app/assets/images/actions/say.psd +0 -0
  22. data/app/assets/images/business-default-avatar.png +0 -0
  23. data/app/assets/images/foundation-default-avatar.png +0 -0
  24. data/app/assets/images/glyphish/people/208-facebook.png +0 -0
  25. data/app/assets/images/glyphish/people/210-twitterbird.png +0 -0
  26. data/app/assets/images/glyphish/people/218-trash2-small.png +0 -0
  27. data/app/assets/images/glyphish/people/291-idcard.png +0 -0
  28. data/app/assets/images/glyphish/people/email.png +0 -0
  29. data/app/assets/images/glyphish/people/email.psd +0 -0
  30. data/app/assets/images/glyphish/people/linkedin.png +0 -0
  31. data/app/assets/images/glyphish/people/linkedin.psd +0 -0
  32. data/app/assets/images/glyphish/people/website.png +0 -0
  33. data/app/assets/images/glyphish/people/website.psd +0 -0
  34. data/app/assets/images/government-default-avatar.png +0 -0
  35. data/app/assets/images/household-default-avatar.png +0 -0
  36. data/app/assets/images/loading.gif +0 -0
  37. data/app/assets/images/nonprofit-default-avatar.png +0 -0
  38. data/app/assets/images/other-default-avatar.png +0 -0
  39. data/app/assets/images/person-default-avatar.png +0 -0
  40. data/app/assets/images/person-default-avatar.psd +0 -0
  41. data/app/assets/javascripts/angular-bootstrap-ui.js +1 -0
  42. data/app/assets/javascripts/angular-resource.js +546 -0
  43. data/app/assets/javascripts/angular.js +20311 -0
  44. data/app/assets/javascripts/application.js +340 -24
  45. data/app/assets/javascripts/bootstrap-wysihtml5.js +511 -0
  46. data/app/assets/javascripts/bootstrap.js +1005 -455
  47. data/app/assets/javascripts/boxoffice.js +558 -0
  48. data/app/assets/javascripts/change-membership.js +152 -0
  49. data/app/assets/javascripts/custom/door-list.js +14 -0
  50. data/app/assets/javascripts/custom/endless-scroll.js +25 -0
  51. data/app/assets/javascripts/custom/inline-people-search.js +51 -49
  52. data/app/assets/javascripts/custom/kits-config.js +33 -0
  53. data/app/assets/javascripts/custom/people.js +74 -9
  54. data/app/assets/javascripts/custom/prices.js +1 -0
  55. data/app/assets/javascripts/custom/show.js +116 -27
  56. data/app/assets/javascripts/households.js +59 -0
  57. data/app/assets/javascripts/jquery-lib/fullcalendar.js +5982 -0
  58. data/app/assets/javascripts/jquery-lib/jquery-ui-1.10.3.custom.min.js +7 -0
  59. data/app/assets/javascripts/jquery-lib/jquery-ui-timepicker-addon.js +1992 -949
  60. data/app/assets/javascripts/jquery-lib/jquery.mask-money.js +305 -294
  61. data/app/assets/javascripts/jquery-migrate-1.2.1.js +521 -0
  62. data/app/assets/javascripts/jquery-migrate-1.2.1.min.js +2 -0
  63. data/app/assets/javascripts/jquery.js +5318 -4987
  64. data/app/assets/javascripts/locationselector.js +107 -0
  65. data/app/assets/javascripts/relationships.js +63 -0
  66. data/app/assets/javascripts/sales-console.js +158 -0
  67. data/app/assets/javascripts/store/jquery.validate.additional-methods.js +476 -159
  68. data/app/assets/javascripts/store/jquery.validate.js +449 -406
  69. data/app/assets/javascripts/store/store.js +107 -349
  70. data/app/assets/javascripts/storefront.js +1 -0
  71. data/app/assets/javascripts/wysihtml5-0.3.0.min.js +261 -0
  72. data/app/assets/stylesheets/application.sass +414 -48
  73. data/app/assets/stylesheets/bootstrap-overrides.css +100 -26
  74. data/app/assets/stylesheets/bootstrap-wysihtml5.css +102 -0
  75. data/app/assets/stylesheets/bootstrap.css +6 -3607
  76. data/app/assets/stylesheets/boxoffice.css.scss +258 -0
  77. data/app/assets/stylesheets/font-awesome.css.scss +1566 -0
  78. data/app/assets/stylesheets/jquery/fullcalendar.css +223 -252
  79. data/app/assets/stylesheets/pages/bootstrap-responsive.css +1109 -0
  80. data/app/assets/stylesheets/sass/_event_list.sass +43 -0
  81. data/app/assets/stylesheets/sass/_tags.sass +24 -2
  82. data/app/assets/stylesheets/sass/box-office.sass +24 -4
  83. data/app/assets/stylesheets/sass/cart.sass +0 -6
  84. data/app/assets/stylesheets/sass/store.sass +274 -55
  85. data/app/assets/stylesheets/storefront.css +2 -1
  86. data/app/assets/stylesheets/wysiwyg-color.css +67 -0
  87. data/app/concerns/cart_finder.rb +50 -0
  88. data/app/concerns/immutable_action.rb +9 -0
  89. data/app/concerns/pdf_generation.rb +74 -0
  90. data/app/{models/orders → concerns}/unrefundable.rb +0 -0
  91. data/app/controllers/actions_controller.rb +29 -22
  92. data/app/controllers/addresses_controller.rb +3 -3
  93. data/app/controllers/artfully_ose_controller.rb +56 -7
  94. data/app/controllers/assignments_controller.rb +28 -0
  95. data/app/controllers/charts_controller.rb +1 -1
  96. data/app/controllers/console_sales_controller.rb +182 -0
  97. data/app/controllers/contributions_controller.rb +31 -6
  98. data/app/controllers/discounts_controller.rb +10 -3
  99. data/app/controllers/events_controller.rb +42 -33
  100. data/app/controllers/events_pass_types_controller.rb +87 -0
  101. data/app/controllers/exchanges_controller.rb +16 -8
  102. data/app/controllers/export_controller.rb +10 -2
  103. data/app/controllers/households_controller.rb +71 -0
  104. data/app/controllers/imports_controller.rb +46 -7
  105. data/app/controllers/index_controller.rb +6 -1
  106. data/app/controllers/member_cards_controller.rb +45 -0
  107. data/app/controllers/members/index_controller.rb +4 -0
  108. data/app/controllers/members/invitations_controller.rb +7 -0
  109. data/app/controllers/members/members_controller.rb +9 -0
  110. data/app/controllers/members/passwords_controller.rb +10 -0
  111. data/app/controllers/members/people_controller.rb +17 -0
  112. data/app/controllers/members/sessions_controller.rb +14 -0
  113. data/app/controllers/membership_cancellations_controller.rb +46 -0
  114. data/app/controllers/membership_changes_controller.rb +39 -0
  115. data/app/controllers/membership_comps_controller.rb +102 -0
  116. data/app/controllers/membership_kits_controller.rb +25 -0
  117. data/app/controllers/membership_types_controller.rb +57 -0
  118. data/app/controllers/memberships_controller.rb +18 -47
  119. data/app/controllers/merges_controller.rb +11 -5
  120. data/app/controllers/mobile/dashboard_controller.rb +17 -0
  121. data/app/controllers/mobile/events_controller.rb +16 -0
  122. data/app/controllers/mobile/orders_controller.rb +61 -0
  123. data/app/controllers/mobile/shows_controller.rb +39 -0
  124. data/app/controllers/mobile/tickets_controller.rb +114 -0
  125. data/app/controllers/mobile/users_controller.rb +30 -0
  126. data/app/controllers/notes_controller.rb +3 -3
  127. data/app/controllers/orders_controller.rb +87 -8
  128. data/app/controllers/organizations_controller.rb +3 -2
  129. data/app/controllers/pass_types_controller.rb +53 -0
  130. data/app/controllers/passes_controller.rb +52 -0
  131. data/app/controllers/passes_kits_controller.rb +25 -0
  132. data/app/controllers/passes_reports_controller.rb +5 -0
  133. data/app/controllers/people_controller.rb +83 -28
  134. data/app/controllers/refunds_controller.rb +7 -7
  135. data/app/controllers/regular_donation_kits_controller.rb +32 -0
  136. data/app/controllers/relationships_controller.rb +15 -0
  137. data/app/controllers/sales_controller.rb +95 -31
  138. data/app/controllers/searches_controller.rb +15 -7
  139. data/app/controllers/sections_controller.rb +3 -3
  140. data/app/controllers/segments_controller.rb +4 -4
  141. data/app/controllers/shows_controller.rb +119 -98
  142. data/app/controllers/slices_controller.rb +3 -2
  143. data/app/controllers/statements_controller.rb +1 -1
  144. data/app/controllers/store/checkouts_controller.rb +27 -8
  145. data/app/controllers/store/donations_controller.rb +22 -0
  146. data/app/controllers/store/events_controller.rb +19 -1
  147. data/app/controllers/store/memberships_controller.rb +16 -0
  148. data/app/controllers/store/orders_controller.rb +46 -77
  149. data/app/controllers/store/passes_controller.rb +13 -0
  150. data/app/controllers/store/retrievals_controller.rb +29 -0
  151. data/app/controllers/store/shows_controller.rb +6 -0
  152. data/app/controllers/store/store_controller.rb +21 -23
  153. data/app/controllers/ticket_types_controller.rb +41 -0
  154. data/app/controllers/tickets_controller.rb +16 -0
  155. data/app/controllers/user_memberships_controller.rb +57 -0
  156. data/app/controllers/users/sessions_controller.rb +3 -0
  157. data/app/helpers/artfully_ose_helper.rb +88 -37
  158. data/app/helpers/households_helper.rb +7 -0
  159. data/app/helpers/link_helper.rb +15 -1
  160. data/app/helpers/members_helper.rb +9 -0
  161. data/app/helpers/membership_types_helper.rb +22 -0
  162. data/app/helpers/people_helper.rb +55 -1
  163. data/app/helpers/relationships_helper.rb +26 -0
  164. data/app/helpers/sales_helper.rb +29 -0
  165. data/app/helpers/searches_helper.rb +13 -0
  166. data/app/helpers/suggested_households_helper.rb +5 -0
  167. data/app/mailers/order_mailer.rb +28 -1
  168. data/app/mailers/pass_mailer.rb +17 -0
  169. data/app/mailers/producer_mailer.rb +2 -2
  170. data/app/mailers/reports_mailer.rb +6 -5
  171. data/app/models/ability.rb +1 -0
  172. data/app/models/action.rb +48 -24
  173. data/app/models/actions/change_action.rb +13 -0
  174. data/app/models/actions/comp_action.rb +15 -0
  175. data/app/models/actions/do_action.rb +12 -0
  176. data/app/models/actions/exchange_action.rb +15 -0
  177. data/app/models/actions/get_action.rb +7 -1
  178. data/app/models/actions/give_action.rb +20 -4
  179. data/app/models/actions/go_action.rb +27 -8
  180. data/app/models/actions/hear_action.rb +14 -2
  181. data/app/models/actions/join_action.rb +4 -0
  182. data/app/models/actions/refund_action.rb +2 -1
  183. data/app/models/actions/say_action.rb +23 -0
  184. data/app/models/address.rb +39 -9
  185. data/app/models/cart.rb +254 -0
  186. data/app/models/chart.rb +30 -23
  187. data/app/models/checkout.rb +94 -38
  188. data/app/models/comp.rb +25 -17
  189. data/app/models/company.rb +18 -0
  190. data/app/models/console_sale.rb +30 -0
  191. data/app/models/contribution.rb +11 -9
  192. data/app/models/daily_donation_report.rb +11 -8
  193. data/app/models/daily_membership_report.rb +50 -0
  194. data/app/models/daily_pass_report.rb +48 -0
  195. data/app/models/daily_ticket_report.rb +34 -14
  196. data/app/models/database_views/item_view.rb +148 -0
  197. data/app/models/discount.rb +7 -7
  198. data/app/models/discounts/buy_one_get_one_free_discount_type.rb +6 -1
  199. data/app/models/discounts/discount_type.rb +5 -1
  200. data/app/models/discounts/dollars_off_tickets_discount_type.rb +8 -2
  201. data/app/models/donation.rb +10 -6
  202. data/app/models/donation_search.rb +1 -1
  203. data/app/models/door_list.rb +14 -9
  204. data/app/models/event.rb +81 -10
  205. data/app/models/events_pass_type.rb +18 -0
  206. data/app/models/exchange.rb +23 -15
  207. data/app/models/{ext/ext.rb → ext.rb} +16 -3
  208. data/app/models/ext/integrations.rb +47 -32
  209. data/app/models/ext/preprocessor.rb +7 -0
  210. data/app/models/extendable.rb +6 -0
  211. data/app/models/fee_calculator.rb +13 -0
  212. data/app/models/fee_strategy.rb +5 -0
  213. data/app/models/gateway_transaction.rb +3 -1
  214. data/app/models/household.rb +61 -0
  215. data/app/models/household_suggester.rb +58 -0
  216. data/app/models/import.rb +48 -15
  217. data/app/models/import_message.rb +6 -0
  218. data/app/models/imports/donations_import.rb +3 -22
  219. data/app/models/imports/events_import.rb +56 -57
  220. data/app/models/imports/memberships_import.rb +43 -0
  221. data/app/models/imports/people_import.rb +45 -17
  222. data/app/models/imports/rollback.rb +7 -2
  223. data/app/models/imports/status.rb +8 -0
  224. data/app/models/individual.rb +20 -0
  225. data/app/models/item.rb +65 -54
  226. data/app/models/job/checkout_processor.rb +46 -0
  227. data/app/models/job/cleanup_suggested_households_job.rb +17 -0
  228. data/app/models/job/daily_email_report_job.rb +28 -7
  229. data/app/models/job/destroy_show_job.rb +10 -0
  230. data/app/models/job/expire_ticket_job.rb +9 -0
  231. data/app/models/job/geocode_address_job.rb +11 -0
  232. data/app/models/job/mailchimp_sync_job.rb +1 -3
  233. data/app/models/job/order_mailer_job.rb +8 -0
  234. data/app/models/job/order_processor.rb +93 -0
  235. data/app/models/job/person_lifetime_value_job.rb +10 -0
  236. data/app/models/job/recall_import_job.rb +5 -0
  237. data/app/models/job/refund_order_processor.rb +16 -0
  238. data/app/models/job/show_creator.rb +39 -0
  239. data/app/models/kit.rb +2 -4
  240. data/app/models/kits/mailchimp_kit.rb +49 -22
  241. data/app/models/kits/membership_kit.rb +62 -0
  242. data/app/models/kits/passes_kit.rb +62 -0
  243. data/app/models/kits/regular_donation_kit.rb +38 -8
  244. data/app/models/kits/scannable_tickets_kit.rb +23 -0
  245. data/app/models/member.rb +190 -0
  246. data/app/models/member_card_generator.rb +63 -0
  247. data/app/models/member_number_generator.rb +8 -0
  248. data/app/models/member_walkup.rb +150 -0
  249. data/app/models/membership.rb +97 -7
  250. data/app/models/membership_cancellation.rb +80 -0
  251. data/app/models/membership_change.rb +187 -0
  252. data/app/models/membership_comp.rb +105 -0
  253. data/app/models/membership_comp_job.rb +32 -0
  254. data/app/models/membership_sale_search.rb +36 -0
  255. data/app/models/membership_type.rb +67 -0
  256. data/app/models/note.rb +1 -1
  257. data/app/models/{orders/order.rb → order.rb} +224 -28
  258. data/app/models/order_handler.rb +154 -0
  259. data/app/models/orders/comp_order.rb +4 -0
  260. data/app/models/orders/exchange_order.rb +16 -0
  261. data/app/models/orders/imported_order.rb +4 -0
  262. data/app/models/orders/refund_order.rb +8 -0
  263. data/app/models/organization.rb +68 -17
  264. data/app/models/organization_ability.rb +1 -0
  265. data/app/models/parsed_row.rb +103 -20
  266. data/app/models/pass.rb +196 -0
  267. data/app/models/pass_summary.rb +18 -0
  268. data/app/models/pass_type.rb +41 -0
  269. data/app/models/{payments/payment.rb → payment.rb} +29 -1
  270. data/app/models/payments/cash_payment.rb +3 -1
  271. data/app/models/payments/check_payment.rb +33 -0
  272. data/app/models/payments/comp_payment.rb +3 -1
  273. data/app/models/payments/credit_card_payment.rb +44 -23
  274. data/app/models/person.rb +270 -62
  275. data/app/models/phone.rb +0 -8
  276. data/app/models/refund.rb +28 -18
  277. data/app/models/relation.rb +27 -0
  278. data/app/models/relation_builder.rb +32 -0
  279. data/app/models/relationship.rb +55 -0
  280. data/app/models/relationship_builder.rb +12 -0
  281. data/app/models/relationship_validator.rb +46 -0
  282. data/app/models/relationships_kit.rb +31 -0
  283. data/app/models/rolling_membership_type.rb +11 -0
  284. data/app/models/sale.rb +28 -21
  285. data/app/models/sale_search.rb +1 -1
  286. data/app/models/search.rb +334 -45
  287. data/app/models/seasonal_membership_type.rb +3 -0
  288. data/app/models/section.rb +49 -17
  289. data/app/models/segment.rb +1 -1
  290. data/app/models/show.rb +93 -16
  291. data/app/models/slices.rb +26 -10
  292. data/app/models/statement.rb +38 -9
  293. data/app/models/suggested_household.rb +24 -0
  294. data/app/models/sundial.rb +12 -0
  295. data/app/models/ticket.rb +109 -15
  296. data/app/models/ticket/glance.rb +1 -2
  297. data/app/models/ticket/locker.rb +51 -0
  298. data/app/models/ticket/pricing.rb +30 -22
  299. data/app/models/ticket/qr_code.rb +21 -0
  300. data/app/models/ticket/reports.rb +16 -10
  301. data/app/models/ticket/sale_transitions.rb +4 -0
  302. data/app/models/ticket/template.rb +1 -0
  303. data/app/models/ticket/transfers.rb +12 -1
  304. data/app/models/ticket_summary.rb +7 -1
  305. data/app/models/ticket_type.rb +137 -0
  306. data/app/models/user.rb +22 -9
  307. data/app/models/user_membership.rb +28 -0
  308. data/app/models/valuation/lifetime_donations.rb +2 -2
  309. data/app/models/valuation/lifetime_fees.rb +40 -0
  310. data/app/models/valuation/lifetime_memberships.rb +24 -0
  311. data/app/models/valuation/lifetime_ticket_value.rb +30 -0
  312. data/app/models/valuation/lifetime_value.rb +3 -8
  313. data/app/models/venue.rb +25 -7
  314. data/app/presenters/event_presenter.rb +1 -1
  315. data/app/serializers/show_serializer.rb +15 -0
  316. data/app/views/actions/_action.html.haml +21 -0
  317. data/app/views/actions/_form.html.haml +47 -0
  318. data/app/views/actions/_inline.html.haml +1 -0
  319. data/app/views/actions/_modal.html.haml +5 -0
  320. data/app/views/actions/get/_show.html.haml +3 -0
  321. data/app/views/actions/give/_show.html.haml +8 -0
  322. data/app/views/actions/shared/_show.html.haml +5 -0
  323. data/app/views/addresses/_address.html.haml +7 -6
  324. data/app/views/assignments/new.html.haml +31 -0
  325. data/app/views/console_sales/_aloha.html.haml +26 -0
  326. data/app/views/console_sales/_cart.html.haml +60 -0
  327. data/app/views/console_sales/_payment.html.haml +111 -0
  328. data/app/views/console_sales/_shows.html.haml +24 -0
  329. data/app/views/console_sales/new.html.haml +143 -0
  330. data/app/views/contributions/_form.html.haml +3 -3
  331. data/app/views/contributions/find_person.html.haml +1 -1
  332. data/app/views/contributions/index.html.haml +8 -6
  333. data/app/views/contributions/new.html.haml +5 -9
  334. data/app/views/discounts/_discount_section_fields.html.haml +1 -1
  335. data/app/views/discounts/_form.html.haml +3 -3
  336. data/app/views/discounts/index.html.haml +1 -1
  337. data/app/views/events/_day_date_show.html.haml +2 -2
  338. data/app/views/events/_discount_section_fields.html.haml +1 -1
  339. data/app/views/events/_glance.html.haml +28 -37
  340. data/app/views/events/_header.html.haml +1 -0
  341. data/app/views/events/_list.html.haml +11 -5
  342. data/app/views/events/_menu.html.haml +25 -20
  343. data/app/views/events/_section_fields.html.haml +16 -46
  344. data/app/views/events/_share_and_sell.haml +9 -5
  345. data/app/views/events/_ticket_type_fields.html.haml +86 -0
  346. data/app/views/events/edit.html.haml +13 -3
  347. data/app/views/events/image.html.haml +4 -3
  348. data/app/views/events/index.html.haml +20 -3
  349. data/app/views/events/messages.html.haml +2 -2
  350. data/app/views/events/prices.html.haml +4 -12
  351. data/app/views/events/show.html.haml +3 -1
  352. data/app/views/events/storefront_link.html.haml +1 -1
  353. data/app/views/events/temp_discount_form.html.haml +1 -1
  354. data/app/views/events/temp_discounts_index.html.haml +1 -1
  355. data/app/views/events_pass_types/_form.html.haml +42 -0
  356. data/app/views/events_pass_types/edit.html.haml +22 -0
  357. data/app/views/events_pass_types/index.html.haml +47 -0
  358. data/app/views/events_pass_types/new.html.haml +22 -0
  359. data/app/views/exchanges/new.html.haml +58 -35
  360. data/app/views/households/_action.html.haml +24 -0
  361. data/app/views/households/_edit_modal.html.haml +143 -0
  362. data/app/views/households/_form.html.haml +26 -0
  363. data/app/views/households/_header.html.haml +25 -0
  364. data/app/views/households/_individual_fields.html.haml +8 -0
  365. data/app/views/households/_list.html.haml +10 -0
  366. data/app/views/households/_note.html.haml +33 -0
  367. data/app/views/households/edit.html.haml +1 -0
  368. data/app/views/households/index.html.haml +13 -0
  369. data/app/views/households/new.html.haml +14 -0
  370. data/app/views/households/show.html.haml +72 -0
  371. data/app/views/households/suggested.html.haml +38 -0
  372. data/app/views/imports/_export_links.html.haml +3 -0
  373. data/app/views/imports/donations/_new.html.haml +6 -0
  374. data/app/views/imports/donations/_pending.html.haml +6 -22
  375. data/app/views/imports/events/_new.html.haml +7 -1
  376. data/app/views/imports/events/_pending.html.haml +6 -17
  377. data/app/views/imports/index.html.haml +6 -3
  378. data/app/views/imports/people/_imported.html.haml +35 -5
  379. data/app/views/imports/people/_importing.html.haml +8 -0
  380. data/app/views/imports/people/_new.html.haml +61 -21
  381. data/app/views/imports/people/_pending.html.haml +26 -20
  382. data/app/views/imports/people/_recalled.html.haml +25 -0
  383. data/app/views/imports/people/_recalling.html.haml +15 -0
  384. data/app/views/imports/shared/_knowledge_base.haml +11 -2
  385. data/app/views/imports/shared/_sidebar.html.haml +1 -1
  386. data/app/views/index/_action.html.haml +7 -0
  387. data/app/views/index/_recent_activity.html.haml +11 -0
  388. data/app/views/index/_recent_activity.js.haml +5 -0
  389. data/app/views/index/dashboard.html.haml +40 -36
  390. data/app/views/index/recent_activity.js.haml +5 -0
  391. data/app/views/kits/_list.html.haml +9 -0
  392. data/app/views/layouts/_flash.html.haml +3 -3
  393. data/app/views/layouts/_google_analytics.html.haml +5 -2
  394. data/app/views/layouts/_menu.html.haml +10 -6
  395. data/app/views/layouts/application.html.haml +6 -3
  396. data/app/views/layouts/devise_layout.html.haml +2 -2
  397. data/app/views/layouts/mail.html.haml +20 -0
  398. data/app/views/layouts/members.html.haml +14 -0
  399. data/app/views/layouts/storefront.html.haml +39 -3
  400. data/app/views/members/index/index.html.haml +41 -0
  401. data/app/views/members/invitations/edit.html.haml +17 -0
  402. data/app/views/members/invitations/new.html.erb +14 -0
  403. data/app/views/members/mailer/_invitation_body.html.haml +18 -0
  404. data/app/views/members/mailer/invitation_instructions.html.haml +6 -0
  405. data/app/views/members/mailer/reset_password_instructions.html.erb +8 -0
  406. data/app/views/members/passwords/edit.html.haml +18 -0
  407. data/app/views/members/sessions/new.html.haml +19 -0
  408. data/app/views/membership_cancellations/_form.html.haml +39 -0
  409. data/app/views/membership_cancellations/_modal.html.haml +2 -0
  410. data/app/views/membership_cancellations/_processing.html.haml +12 -0
  411. data/app/views/membership_cancellations/create.js.erb +3 -0
  412. data/app/views/membership_cancellations/new.js.erb +3 -0
  413. data/app/views/membership_comps/confirm.html.haml +86 -0
  414. data/app/views/membership_comps/create.html.haml +20 -0
  415. data/app/views/membership_comps/new.html.haml +95 -0
  416. data/app/views/membership_kits/edit.html.haml +52 -0
  417. data/app/views/membership_mailer/cancellation_confirmation.html.haml +9 -0
  418. data/app/views/membership_mailer/cancellation_confirmation.text.haml +6 -0
  419. data/app/views/membership_mailer/refund_problem.html.haml +18 -0
  420. data/app/views/membership_mailer/refund_problem.text.haml +14 -0
  421. data/app/views/membership_types/_form.html.haml +89 -0
  422. data/app/views/membership_types/_membership_type_fees.html.haml +0 -0
  423. data/app/views/membership_types/_rolling_membership_type_form.html.haml +5 -0
  424. data/app/views/membership_types/_seasonal_membership_type_form.html.haml +8 -0
  425. data/app/views/membership_types/edit.html.haml +4 -0
  426. data/app/views/membership_types/index.html.haml +28 -0
  427. data/app/views/membership_types/new.html.haml +4 -0
  428. data/app/views/membership_types/type.html.haml +19 -0
  429. data/app/views/memberships/_membership_scripts.js.erb +15 -0
  430. data/app/views/memberships/index.html.haml +160 -0
  431. data/app/views/merges/_merge_preview_person.html.haml +11 -6
  432. data/app/views/merges/find_person.html.haml +5 -5
  433. data/app/views/merges/new.html.haml +7 -6
  434. data/app/views/notes/_note.html.haml +29 -0
  435. data/app/views/order_mailer/confirmation_for.html.haml +34 -22
  436. data/app/views/order_mailer/confirmation_for.text.haml +7 -4
  437. data/app/views/order_mailer/confirmation_for_exchange.html.haml +34 -0
  438. data/app/views/order_mailer/confirmation_for_exchange.text.haml +26 -0
  439. data/app/views/order_mailer/confirmation_for_refund.html.haml +36 -0
  440. data/app/views/order_mailer/confirmation_for_refund.text.haml +22 -0
  441. data/app/views/orders/_item_donations_table.html.haml +27 -0
  442. data/app/views/orders/_item_memberships_table.html.haml +16 -0
  443. data/app/views/orders/_item_table.haml +31 -13
  444. data/app/views/orders/_item_tickets_table.html.haml +27 -0
  445. data/app/views/orders/_order_sidebar.html.haml +40 -18
  446. data/app/views/orders/index.html.haml +2 -0
  447. data/app/views/orders/membership.html.haml +104 -0
  448. data/app/views/orders/sales.html.haml +15 -13
  449. data/app/views/orders/show.html.haml +3 -3
  450. data/app/views/organizations/_connection_form.html.haml +1 -1
  451. data/app/views/organizations/_form.html.haml +25 -20
  452. data/app/views/organizations/edit.html.haml +2 -2
  453. data/app/views/organizations/new.html.haml +1 -1
  454. data/app/views/organizations/show.html.haml +22 -16
  455. data/app/views/pass_mailer/pass_info_for.html.haml +21 -0
  456. data/app/views/pass_types/_form.html.haml +76 -0
  457. data/app/views/pass_types/_pass_type_fees.html.haml +0 -0
  458. data/app/views/pass_types/edit.html.haml +4 -0
  459. data/app/views/pass_types/index.html.haml +34 -0
  460. data/app/views/pass_types/new.html.haml +4 -0
  461. data/app/views/passes/index.html.haml +108 -0
  462. data/app/views/passes_kits/edit.html.haml +30 -0
  463. data/app/views/passes_reports/index.html.haml +2 -0
  464. data/app/views/pdfs/member.html.haml +66 -0
  465. data/app/views/pdfs/member_card_generator/blanks_usa_idc6.html.haml +109 -0
  466. data/app/views/pdfs/order.html.haml +84 -0
  467. data/app/views/people/_convert_to_company_modal.html.haml +42 -0
  468. data/app/views/people/_edit_modal.html.haml +186 -0
  469. data/app/views/people/_form.html.haml +23 -5
  470. data/app/views/people/_header.html.haml +50 -0
  471. data/app/views/people/_household_fields.html.haml +5 -0
  472. data/app/views/people/_phone_fields.html.haml +10 -0
  473. data/app/views/people/_relationship_fields.html.haml +14 -0
  474. data/app/views/people/_work_with_menu.html.haml +39 -0
  475. data/app/views/people/index.html.haml +18 -6
  476. data/app/views/people/new.html.haml +2 -2
  477. data/app/views/people/show.html.haml +149 -28
  478. data/app/views/people/show.js.haml +5 -0
  479. data/app/views/producer_mailer/donation_kit_notification.html.haml +8 -0
  480. data/app/views/producer_mailer/donation_kit_notification.text.erb +8 -0
  481. data/app/views/producer_mailer/mailchimp_kit_initial_sync_notification.html.haml +21 -0
  482. data/app/views/producer_mailer/ticket_offer_accepted.html.haml +7 -0
  483. data/app/views/producer_mailer/ticket_offer_accepted.text.erb +7 -0
  484. data/app/views/producer_mailer/ticket_offer_rejected.html.haml +11 -0
  485. data/app/views/producer_mailer/ticket_offer_rejected.text.erb +13 -0
  486. data/app/views/refunds/new.html.haml +45 -27
  487. data/app/views/regular_donation_kits/edit.html.haml +140 -0
  488. data/app/views/relationships/index.html.haml +32 -0
  489. data/app/views/reports_mailer/_fine_print.html.haml +0 -0
  490. data/app/views/reports_mailer/daily.html.haml +113 -51
  491. data/app/views/reports_mailer/daily.text.erb +5 -5
  492. data/app/views/sales/_boxoffice.html.haml +141 -0
  493. data/app/views/sales/_doorlist.html.haml +79 -0
  494. data/app/views/sales/new.html.haml +33 -125
  495. data/app/views/searches/_form.html.haml +180 -34
  496. data/app/views/searches/_household.html.haml +7 -0
  497. data/app/views/searches/_person.html.haml +5 -2
  498. data/app/views/searches/new.html.haml +1 -1
  499. data/app/views/searches/show.html.haml +29 -21
  500. data/app/views/sections/edit.html.haml +1 -1
  501. data/app/views/sections/new.html.haml +1 -1
  502. data/app/views/segments/show.html.haml +19 -15
  503. data/app/views/shared/_door_list_table.haml +19 -6
  504. data/app/views/shared/_error_messages.html.haml +1 -1
  505. data/app/views/shared/_event_image_icon.html.haml +1 -3
  506. data/app/views/shared/_save_save_and_next.html.haml +2 -0
  507. data/app/views/shared/_show_summary.html.haml +0 -6
  508. data/app/views/shared/_show_time_and_calendar.html.haml +21 -0
  509. data/app/views/shared/_submit_cancel.haml +1 -1
  510. data/app/views/shared/_tags.html.haml +5 -3
  511. data/app/views/shows/_controls.html.haml +5 -23
  512. data/app/views/shows/_glance.html.haml +3 -11
  513. data/app/views/shows/_sections_table.html.haml +89 -0
  514. data/app/views/shows/_ticket_table.html.haml +12 -88
  515. data/app/views/shows/_work_with.html.haml +23 -0
  516. data/app/views/shows/calendar.html.haml +18 -0
  517. data/app/views/shows/door_list.html.haml +2 -2
  518. data/app/views/shows/door_list.pdf.haml +29 -0
  519. data/app/views/shows/index.html.haml +88 -19
  520. data/app/views/shows/new.html.haml +13 -27
  521. data/app/views/shows/show.html.haml +11 -11
  522. data/app/views/slices/index.html.haml +2 -1
  523. data/app/views/statements/_discounts_table.html.haml +1 -1
  524. data/app/views/statements/_order_location_table.html.haml +1 -1
  525. data/app/views/statements/_passes_table.html.haml +22 -0
  526. data/app/views/statements/_payment_method_table.haml +1 -1
  527. data/app/views/statements/_ticket_type_table.haml +5 -2
  528. data/app/views/statements/show.html.haml +5 -2
  529. data/app/views/store/checkouts/_membership_info.html.haml +12 -0
  530. data/app/views/store/checkouts/thanks.html.haml +134 -0
  531. data/app/views/store/donations/index.html.haml +19 -0
  532. data/app/views/store/events/_calendar.html.haml +4 -5
  533. data/app/views/store/events/_venue.html.haml +9 -0
  534. data/app/views/store/events/calendar.html.haml +50 -0
  535. data/app/views/store/events/index.html.haml +23 -0
  536. data/app/views/store/events/show.html.haml +26 -185
  537. data/app/views/store/events/single_show.html.haml +45 -0
  538. data/app/views/store/memberships/index.html.haml +40 -0
  539. data/app/views/store/orders/show.html.haml +198 -0
  540. data/app/views/store/passes/index.html.haml +33 -0
  541. data/app/views/store/retrievals/index.html.haml +11 -0
  542. data/app/views/store/shared/_donate_form.html.haml +31 -0
  543. data/app/views/store/shared/_small_donate_form.html.haml +21 -0
  544. data/app/views/store/shows/_show.html.haml +50 -0
  545. data/app/views/store/shows/show.html.haml +1 -0
  546. data/app/views/ticket_types/edit.html.haml +12 -0
  547. data/app/views/ticket_types/new.html.haml +13 -0
  548. data/app/views/user_memberships/_list.html.haml +30 -0
  549. data/app/views/users/invitations/edit.html.haml +19 -9
  550. data/app/views/users/mailer/invitation_instructions.html.haml +14 -0
  551. data/app/views/users/passwords/edit.html.haml +2 -2
  552. data/app/views/users/registrations/edit.html.erb +3 -3
  553. data/app/views/users/sessions/new.html.haml +2 -2
  554. data/app/views/venues/edit.html.haml +6 -4
  555. data/config/initializers/devise.rb +2 -5
  556. data/config/initializers/paperclip.rb +69 -0
  557. data/config/locales/devise.en.yml +1 -1
  558. data/config/locales/devise_invitable.en.yml +1 -1
  559. data/config/locales/en.yml +16 -3
  560. data/config/routes.rb +178 -22
  561. data/db/migrate/20130311184839_rename_memberships.rb +5 -0
  562. data/db/migrate/20130329201707_clean_geographic_data.rb +230 -0
  563. data/db/migrate/20130411162346_add_country_zip_state_phone_number_discipline_to_organizations.rb +9 -0
  564. data/db/migrate/20130412145428_massage_action_subtypes.rb +15 -0
  565. data/db/migrate/20130412184415_add_first_name_and_last_name_to_users.rb +6 -0
  566. data/db/migrate/20130420232537_add_starred_to_note.rb +5 -0
  567. data/db/migrate/20130425153848_add_notes_to_orders.rb +5 -0
  568. data/db/migrate/20130506173918_add_token_to_cart.rb +6 -0
  569. data/db/migrate/20130508180421_ticket_types_ahoy.rb +17 -0
  570. data/db/migrate/20130508194552_add_members_to_section.rb +6 -0
  571. data/db/migrate/20130514153006_add_import_messages.rb +17 -0
  572. data/db/migrate/20130520190452_add_ticket_type_to_tickets.rb +6 -0
  573. data/db/migrate/20130521185848_add_sti_to_cart.rb +12 -0
  574. data/db/migrate/20130526021126_add_validated_to_ticket.rb +5 -0
  575. data/db/migrate/20130528193811_add_widget_requests.rb +12 -0
  576. data/db/migrate/20130530011409_add_ticket_types_to_discounts.rb +5 -0
  577. data/db/migrate/20130531160800_migrate_to_ticket_types.rb +59 -0
  578. data/db/migrate/20130531160801_drop_price_from_ticket.rb +5 -0
  579. data/db/migrate/20130531160802_remove_price_from_section.rb +5 -0
  580. data/db/migrate/20130531180955_add_defaults_to_people_types.rb +21 -0
  581. data/db/migrate/20130604161411_add_validated_action_to_ticket.rb +5 -0
  582. data/db/migrate/20130607180250_change_institution_to_company.rb +9 -0
  583. data/db/migrate/20130609233536_revenue_applies_at.rb +11 -0
  584. data/db/migrate/20130611175122_add_more_indexes.rb +8 -0
  585. data/db/migrate/20130612183117_add_types_to_searches.rb +6 -0
  586. data/db/migrate/20130712145416_add_middle_name_and_suffix_to_people.rb +6 -0
  587. data/db/migrate/20130722153731_add_autentication_token_to_users.rb +5 -0
  588. data/db/migrate/20130722182255_create_membership_types.rb +18 -0
  589. data/db/migrate/20130723182754_create_slugged_slugs.rb +20 -0
  590. data/db/migrate/20130723182811_add_cached_slug_to_organizations.rb +16 -0
  591. data/db/migrate/20130723212712_add_qr_code_to_tickets.rb +9 -0
  592. data/db/migrate/20130725012338_create_new_memberships.rb +28 -0
  593. data/db/migrate/20130725013145_devise_create_members.rb +41 -0
  594. data/db/migrate/20130729140618_convert_to_company.rb +5 -0
  595. data/db/migrate/20130731145336_last_member_number.rb +5 -0
  596. data/db/migrate/20130731153806_add_member_number.rb +5 -0
  597. data/db/migrate/20130801194634_make_events_public.rb +5 -0
  598. data/db/migrate/20130802235709_add_memberships_to_search.rb +9 -0
  599. data/db/migrate/20130808002742_add_lifetime_ticket_value_to_person.rb +9 -0
  600. data/db/migrate/20130808005856_add_members_only_to_events.rb +5 -0
  601. data/db/migrate/20130820011240_add_uuid_to_tickets.rb +13 -0
  602. data/db/migrate/20130820025134_make_ticket_uuid_not_null.rb +11 -0
  603. data/db/migrate/20130823191625_add_pdf_to_orders.rb +5 -0
  604. data/db/migrate/20130827190839_add_fee_to_tickets_and_donations.rb +8 -0
  605. data/db/migrate/20130829015011_migrate_fees_to_items.rb +5 -0
  606. data/db/migrate/20130916194547_add_relationships.rb +21 -0
  607. data/db/migrate/20130917165559_add_service_fee_to_memberships.rb +5 -0
  608. data/db/migrate/20131002191646_create_show_stats_view.rb +16 -0
  609. data/db/migrate/20131003134821_add_relationships_to_search.rb +7 -0
  610. data/db/migrate/20131003200508_add_starred_to_relationships.rb +5 -0
  611. data/db/migrate/20131007141421_add_counters_to_member.rb +7 -0
  612. data/db/migrate/20131007144456_remove_expires_at_from_membership.rb +6 -0
  613. data/db/migrate/20131011154027_add_purchased_to_searches.rb +5 -0
  614. data/db/migrate/20131013144010_add_type_to_membership_type.rb +5 -0
  615. data/db/migrate/20131013150230_add_duration_to_membership_type.rb +6 -0
  616. data/db/migrate/20131013192807_change_number_of_shows_to_tickets.rb +5 -0
  617. data/db/migrate/20131015151550_add_households.rb +18 -0
  618. data/db/migrate/20131022183913_add_search_output_options.rb +24 -0
  619. data/db/migrate/20131023200559_add_admin_to_user_memberships.rb +14 -0
  620. data/db/migrate/20131025162155_default_search_filter_values.rb +10 -0
  621. data/db/migrate/20131025180139_unique_household_names.rb +8 -0
  622. data/db/migrate/20131029173612_add_sales_start_to_membership_typ.rb +6 -0
  623. data/db/migrate/20131106191847_add_suggested_households.rb +13 -0
  624. data/db/migrate/20131127162818_add_buyer_id_index_to_tickets.rb +5 -0
  625. data/db/migrate/20131127164000_member_tickets.rb +9 -0
  626. data/db/migrate/20131204162642_add_shared_address.rb +9 -0
  627. data/db/migrate/20131206153323_add_membership_kit.rb +5 -0
  628. data/db/migrate/20131206175325_add_marketing_to_membership_type.rb +6 -0
  629. data/db/migrate/20131210212342_add_show_fee_to_memberhsip_type.rb +5 -0
  630. data/db/migrate/20131210222814_add_renewal_price_to_membership_type.rb +6 -0
  631. data/db/migrate/20131212164553_add_copy_to_individuals_option.rb +5 -0
  632. data/db/migrate/20131223215615_goodbye_order_view.rb +6 -0
  633. data/db/migrate/20140114011856_add_welcome_message_to_memberships.rb +5 -0
  634. data/db/migrate/20140114212127_add_send_email_to_memberships.rb +5 -0
  635. data/db/migrate/20140125183606_index_memberships_and_types.rb +6 -0
  636. data/db/migrate/20140128213101_add_pdf_to_members.rb +5 -0
  637. data/db/migrate/20140128223140_add_uuid_to_member.rb +6 -0
  638. data/db/migrate/20140128223948_add_qr_code_to_member.rb +9 -0
  639. data/db/migrate/20140207135731_update_items_view.rb +38 -0
  640. data/db/migrate/20140210154723_add_cached_stats.rb +5 -0
  641. data/db/migrate/20140218202726_cache_stats.rb +7 -0
  642. data/db/migrate/20140304171625_passes_ahoy.rb +52 -0
  643. data/db/migrate/20140304174807_add_passes_kit.rb +5 -0
  644. data/db/migrate/20140307144454_add_events_pass_types.rb +9 -0
  645. data/db/migrate/20140307193350_add_pass_id_to_cart.rb +7 -0
  646. data/db/migrate/20140314162422_add_total_paid_to_membership.rb +13 -0
  647. data/db/migrate/20140319191237_add_show_dates_to_advanced_search.rb +6 -0
  648. data/db/migrate/20140328172333_add_cols_to_events_pass_types.rb +6 -0
  649. data/db/migrate/20140328174217_add_deleted_at_to_ept.rb +9 -0
  650. data/db/migrate/20140328185432_add_active_to_ept.rb +5 -0
  651. data/db/migrate/20140328192612_add_pass_type_id_to_search.rb +5 -0
  652. data/db/migrate/20140415212841_add_min_max_start_dates_to_searches.artfully_ose_engine.rb +6 -0
  653. data/db/migrate/20140422193345_add_email_copy_to_pass_type.rb +5 -0
  654. data/db/migrate/20140423181639_add_min_max_end_dates_to_searches.artfully_ose_engine.rb +6 -0
  655. data/db/migrate/20140423185921_add_cached_stats_to_event.rb +9 -0
  656. data/db/migrate/20140424174423_add_lifetime_memberships_to_people.artfully_ose_engine.rb +5 -0
  657. data/db/migrate/20140506155241_add_lpt_to_membership_type.rb +5 -0
  658. data/db/migrate/20140507184646_add_bday_attributes_to_person.rb +7 -0
  659. data/db/migrate/20140507201048_add_check_number_to_orders.rb +5 -0
  660. data/db/migrate/20140515143651_remove_show_stats_view.rb +6 -0
  661. data/db/migrate/20140521195853_add_deleted_at_to_pass_type.rb +5 -0
  662. data/db/migrate/20140522205554_add_limit_to_events_pass_types.rb +5 -0
  663. data/db/migrate/20140523180444_remove_tickets_purchased_from_passes.rb +5 -0
  664. data/db/migrate/20140603200735_add_subtitle_to_events.rb +5 -0
  665. data/db/migrate/20140619194127_add_do_not_call_to_people.artfully_ose_engine.rb +5 -0
  666. data/db/migrate/20140623160543_add_index_to_items.rb +7 -0
  667. data/lib/artfully_ose.rb +7 -4
  668. data/lib/artfully_ose/common_abilities.rb +8 -2
  669. data/lib/artfully_ose/engine.rb +34 -10
  670. data/lib/artfully_ose/version.rb +1 -1
  671. data/spec/factories/action_factories.rb +19 -0
  672. data/spec/factories/address_factories.rb +11 -0
  673. data/spec/factories/cart_factories.rb +26 -0
  674. data/spec/factories/chart_factories.rb +52 -0
  675. data/spec/factories/discount_factories.rb +11 -0
  676. data/spec/factories/donation_factories.rb +14 -0
  677. data/spec/factories/event_factories.rb +29 -0
  678. data/spec/factories/household_factories.rb +8 -0
  679. data/spec/factories/import_factories.rb +61 -0
  680. data/spec/factories/item_factories.rb +51 -0
  681. data/spec/factories/kit_factories.rb +33 -0
  682. data/spec/factories/member_factories.rb +19 -0
  683. data/spec/factories/membership_factories.rb +9 -0
  684. data/spec/factories/membership_type_factories.rb +18 -0
  685. data/spec/factories/order_factories.rb +40 -0
  686. data/spec/factories/organization_factories.rb +48 -0
  687. data/spec/factories/pass_type_factories.rb +11 -0
  688. data/spec/factories/payments_factories.rb +97 -0
  689. data/spec/factories/person_factories.rb +47 -0
  690. data/spec/factories/phone_factories.rb +6 -0
  691. data/spec/factories/section_factories.rb +21 -0
  692. data/spec/factories/segment_factories.rb +6 -0
  693. data/spec/factories/show_factories.rb +33 -0
  694. data/spec/factories/ticket_factories.rb +57 -0
  695. data/spec/factories/ticket_offer_factories.rb +16 -0
  696. data/spec/factories/ticket_type_factories.rb +8 -0
  697. data/spec/factories/user_factories.rb +24 -0
  698. metadata +522 -49
  699. data/app/assets/javascripts/box-office.js +0 -244
  700. data/app/assets/javascripts/jquery-lib/fullcalendar.min.js +0 -113
  701. data/app/assets/javascripts/jquery-lib/jquery-ui-1.8.14.custom.min.js +0 -570
  702. data/app/assets/javascripts/jquery_ujs.js +0 -316
  703. data/app/assets/stylesheets/font-awesome.sass +0 -759
  704. data/app/models/adjustments.rb +0 -10
  705. data/app/models/carts/cart.rb +0 -171
  706. data/app/models/database_views/order_view.rb +0 -34
  707. data/app/views/actions/_list.html.haml +0 -25
  708. data/app/views/actions/edit.html.haml +0 -19
  709. data/app/views/actions/new.html.haml +0 -19
  710. data/app/views/memberships/_list.html.haml +0 -31
  711. data/app/views/notes/_list.html.haml +0 -30
  712. data/app/views/notes/edit.html.haml +0 -14
  713. data/app/views/notes/new.html.haml +0 -14
  714. data/app/views/orders/_grouped_form_help.haml +0 -4
  715. data/app/views/people/_person_summary_sidebar.html.haml +0 -86
  716. data/app/views/people/edit.html.haml +0 -10
  717. data/app/views/shared/_new_person_popup.html.haml +0 -21
  718. data/app/views/store/events/_show.html.haml +0 -43
  719. data/app/views/users/mailer/invitation_instructions.html.erb +0 -8
@@ -0,0 +1,7 @@
1
+ /*! jQuery UI - v1.10.3 - 2013-05-24
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
4
+ * Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
5
+
6
+ (function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var s,a,n=e(this[0]);n.length&&n[0]!==document;){if(s=n.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(a=parseInt(n.css("zIndex"),10),!isNaN(a)&&0!==a))return a;n=n.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})},removeUniqueId:function(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var s=e.attr(t,"tabindex"),a=isNaN(s);return(a||s>=0)&&i(t,!a)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,s){function a(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===s?["Left","Right"]:["Top","Bottom"],r=s.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+s]=function(i){return i===t?o["inner"+s].call(this):this.each(function(){e(this).css(r,a(this,i)+"px")})},e.fn["outer"+s]=function(t,i){return"number"!=typeof t?o["outer"+s].call(this,t):this.each(function(){e(this).css(r,a(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i){var s,a=e.plugins[t];if(a&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(s=0;a.length>s;s++)e.options[a[s][0]]&&a[s][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)}})})(jQuery);(function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(a){}n(t)},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i}}(),t):(l[i]=n,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(n in r[o])a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);return i},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++)a[n[r]]=a[n[r]]||{},a=a[n[r]];if(i=n.pop(),s===t)return a[i]===t?null:a[i];a[i]=s}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}})})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return s._mouseMove(e)},this._mouseUpDelegate=function(e){return s._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function s(e,i){return parseInt(t.css(e,i),10)||0}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(a!==e)return a;var i,s,n=t("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=n.children()[0];return t("body").append(n),i=o.offsetWidth,n.css("overflow","scroll"),s=o.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),a=i-s},getScrollInfo:function(e){var i=e.isWindow?"":e.element.css("overflow-x"),s=e.isWindow?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,a="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:a?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]);return{element:i,isWindow:s,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var a,p,m,g,v,b,_=t(e.of),y=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(y),x=(e.collision||"flip").split(" "),k={};return b=n(_),_[0].preventDefault&&(e.at="left top"),p=b.width,m=b.height,g=b.offset,v=t.extend({},g),t.each(["my","at"],function(){var t,i,s=(e[this]||"").split(" ");1===s.length&&(s=l.test(s[0])?s.concat(["center"]):c.test(s[0])?["center"].concat(s):["center","center"]),s[0]=l.test(s[0])?s[0]:"center",s[1]=c.test(s[1])?s[1]:"center",t=u.exec(s[0]),i=u.exec(s[1]),k[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(s[0])[0],d.exec(s[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=m:"center"===e.at[1]&&(v.top+=m/2),a=i(k.at,p,m),v.left+=a[0],v.top+=a[1],this.each(function(){var n,l,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=s(this,"marginLeft"),b=s(this,"marginTop"),D=u+f+s(this,"marginRight")+w.width,T=d+b+s(this,"marginBottom")+w.height,C=t.extend({},v),M=i(k.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?C.left-=u:"center"===e.my[0]&&(C.left-=u/2),"bottom"===e.my[1]?C.top-=d:"center"===e.my[1]&&(C.top-=d/2),C.left+=M[0],C.top+=M[1],t.support.offsetFractions||(C.left=h(C.left),C.top=h(C.top)),n={marginLeft:f,marginTop:b},t.each(["left","top"],function(i,s){t.ui.position[x[i]]&&t.ui.position[x[i]][s](C,{targetWidth:p,targetHeight:m,elemWidth:u,elemHeight:d,collisionPosition:n,collisionWidth:D,collisionHeight:T,offset:[a[0]+M[0],a[1]+M[1]],my:e.my,at:e.at,within:y,elem:c})}),e.using&&(l=function(t){var i=g.left-C.left,s=i+p-u,n=g.top-C.top,a=n+m-d,h={target:{element:_,left:g.left,top:g.top,width:p,height:m},element:{element:c,left:C.left,top:C.top,width:u,height:d},horizontal:0>s?"left":i>0?"right":"center",vertical:0>a?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(h.horizontal="center"),d>m&&m>r(n+a)&&(h.vertical="middle"),h.important=o(r(i),r(s))>o(r(n),r(a))?"horizontal":"vertical",e.using.call(this,t,h)}),c.offset(t.extend(C,{using:l}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-o-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-o-a,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-o-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-o-a,t.top+p+f+m>c&&(0>s||r(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,t.top+p+f+m>u&&(i>0||u>r(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,a,o=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(o?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in s)e.style[a]=s[a];e.appendChild(r),i=o||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(t){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=t.pageX,l=t.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var s=e(this).data("ui-draggable"),n=s.options,a=e.extend({},i,{item:s.element});s.sortables=[],e(n.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a))})},stop:function(t,i){var s=e(this).data("ui-draggable"),n=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,n))})},drag:function(t,i){var s=e(this).data("ui-draggable"),n=this;e.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._opacity&&e(i.helper).css("opacity",s._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-t.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-e(document).scrollTop()<s.scrollSensitivity?n=e(document).scrollTop(e(document).scrollTop()-s.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<s.scrollSensitivity&&(n=e(document).scrollTop(e(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-e(document).scrollLeft()<s.scrollSensitivity?n=e(document).scrollLeft(e(document).scrollLeft()-s.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<s.scrollSensitivity&&(n=e(document).scrollLeft(e(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(i,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),i=t.options;t.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=e(this),s=i.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left})})},drag:function(t,i){var s,n,a,o,r,h,l,u,c,d,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,v=g+p.helperProportions.width,b=i.offset.top,y=b+p.helperProportions.height;for(c=p.snapElements.length-1;c>=0;c--)r=p.snapElements[c].left,h=r+p.snapElements[c].width,l=p.snapElements[c].top,u=l+p.snapElements[c].height,r-m>v||g>h+m||l-m>y||b>u+m||!e.contains(p.snapElements[c].item.ownerDocument,p.snapElements[c].item)?(p.snapElements[c].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(s=m>=Math.abs(l-y),n=m>=Math.abs(u-b),a=m>=Math.abs(r-v),o=m>=Math.abs(h-g),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||a||o,"outer"!==f.snapMode&&(s=m>=Math.abs(l-b),n=m>=Math.abs(u-y),a=m>=Math.abs(r-g),o=m>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[c].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=s||n||a||o||d)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,s=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});s.length&&(t=parseInt(e(s[0]).css("zIndex"),10)||0,e(s).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+s.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._zIndex&&e(i.helper).css("zIndex",s._zIndex)}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,i=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(i)?i:function(e){return e.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];i.length>t;t++)i[t]===this&&i.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===s.options.scope&&t.accept.call(t.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(n=!0,!1):undefined}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,i,s){if(!i.offset)return!1;var n,a,o=(e.positionAbs||e.position.absolute).left,r=o+e.helperProportions.width,h=(e.positionAbs||e.position.absolute).top,l=h+e.helperProportions.height,u=i.offset.left,c=u+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(s){case"fit":return o>=u&&c>=r&&h>=d&&p>=l;case"intersect":return o+e.helperProportions.width/2>u&&c>r-e.helperProportions.width/2&&h+e.helperProportions.height/2>d&&p>l-e.helperProportions.height/2;case"pointer":return n=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,a=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(a,d,i.proportions.height)&&t(n,u,i.proportions.width);case"touch":return(h>=d&&p>=h||l>=d&&p>=l||d>h&&l>p)&&(o>=u&&c>=o||r>=u&&c>=r||u>o&&r>c);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions.height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions={width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight})}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===n}),a.length&&(s=e.data(a[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}})(jQuery);(function(e){function t(e){return parseInt(e,10)||0}function i(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(i){var s,n,a,o=this.options,r=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),s=t(this.helper.css("left")),n=t(this.helper.css("top")),o.containment&&(s+=e(o.containment).scrollLeft()||0,n+=e(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:n},this.size=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:n},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,a=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===a?this.axis+"-resize":a),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(t){var i,s=this.helper,n={},a=this.originalMousePosition,o=this.axis,r=this.position.top,h=this.position.left,l=this.size.width,u=this.size.height,c=t.pageX-a.left||0,d=t.pageY-a.top||0,p=this._change[o];return p?(i=p.apply(this,[t,c,d]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==r&&(n.top=this.position.top+"px"),this.position.left!==h&&(n.left=this.position.left+"px"),this.size.width!==l&&(n.width=this.size.width+"px"),this.size.height!==u&&(n.height=this.size.height+"px"),s.css(n),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(n)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&e.ui.hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t,s,n,a,o,r=this.options;o={minWidth:i(r.minWidth)?r.minWidth:0,maxWidth:i(r.maxWidth)?r.maxWidth:1/0,minHeight:i(r.minHeight)?r.minHeight:0,maxHeight:i(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||e)&&(t=o.minHeight*this.aspectRatio,n=o.minWidth/this.aspectRatio,s=o.maxHeight*this.aspectRatio,a=o.maxWidth/this.aspectRatio,t>o.minWidth&&(o.minWidth=t),n>o.minHeight&&(o.minHeight=n),o.maxWidth>s&&(o.maxWidth=s),o.maxHeight>a&&(o.maxHeight=a)),this._vBoundaries=o},_updateCache:function(e){this.offset=this.helper.offset(),i(e.left)&&(this.position.left=e.left),i(e.top)&&(this.position.top=e.top),i(e.height)&&(this.size.height=e.height),i(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,s=this.size,n=this.axis;return i(e.height)?e.width=e.height*this.aspectRatio:i(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===n&&(e.left=t.left+(s.width-e.width),e.top=null),"nw"===n&&(e.top=t.top+(s.height-e.height),e.left=t.left+(s.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,s=this.axis,n=i(e.width)&&t.maxWidth&&t.maxWidth<e.width,a=i(e.height)&&t.maxHeight&&t.maxHeight<e.height,o=i(e.width)&&t.minWidth&&t.minWidth>e.width,r=i(e.height)&&t.minHeight&&t.minHeight>e.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,u=/sw|nw|w/.test(s),c=/nw|ne|n/.test(s);return o&&(e.width=t.minWidth),r&&(e.height=t.minHeight),n&&(e.width=t.maxWidth),a&&(e.height=t.maxHeight),o&&u&&(e.left=h-t.minWidth),n&&u&&(e.left=h-t.maxWidth),r&&c&&(e.top=l-t.minHeight),a&&c&&(e.top=l-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,i,s,n,a=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(n=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],s=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")],t=0;i.length>t;t++)this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(s[t],10)||0);n.css({height:a.height()-this.borderDif[0]-this.borderDif[2]||0,width:a.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).data("ui-resizable"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&e.ui.hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var i,s,n,a,o,r,h,l=e(this).data("ui-resizable"),u=l.options,c=l.element,d=u.containment,p=d instanceof e?d.get(0):/parent/.test(d)?c.parent().get(0):d;p&&(l.containerElement=e(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(i=e(p),s=[],e(["Top","Right","Left","Bottom"]).each(function(e,n){s[e]=t(i.css("padding"+n))}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=l.containerOffset,a=l.containerSize.height,o=l.containerSize.width,r=e.ui.hasScroll(p,"left")?p.scrollWidth:o,h=e.ui.hasScroll(p)?p.scrollHeight:a,l.parentData={element:p,left:n.left,top:n.top,width:r,height:h}))},resize:function(t){var i,s,n,a,o=e(this).data("ui-resizable"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,c={top:0,left:0},d=o.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(c=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-c.left),u&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?h.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,i=Math.abs((o._helper?o.offset.left-c.left:o.offset.left-c.left)+o.sizeDiff.width),s=Math.abs((o._helper?o.offset.top-c.top:o.offset.top-h.top)+o.sizeDiff.height),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a&&(i-=o.parentData.left),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).data("ui-resizable"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function(t,s){e(t).each(function(){var t=e(this),n=e(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(n[t]||0)+(r[t]||0);i&&i>=0&&(a[t]=i||null)}),t.css(a)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):e.each(n.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size,n=t.originalSize,a=t.originalPosition,o=t.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,u=Math.round((s.width-n.width)/h)*h,c=Math.round((s.height-n.height)/l)*l,d=n.width+u,p=n.height+c,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,g&&(d+=h),v&&(p+=l),f&&(d-=h),m&&(p-=l),/^(se|s|e)$/.test(o)?(t.size.width=d,t.size.height=p):/^(ne)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.top=a.top-c):/^(sw)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.left=a.left-u):(t.size.width=d,t.size.height=p,t.position.top=a.top-c,t.position.left=a.left-u)}})})(jQuery);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):undefined}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,a.widgetName+"-item")===a?(s=t(this),!1):undefined}),t.data(e.target,a.widgetName+"-item")===a&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=t("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:e.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:e.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(e.pageY-t(document).scrollTop()<o.scrollSensitivity?r=t(document).scrollTop(t(document).scrollTop()-o.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<o.scrollSensitivity&&(r=t(document).scrollTop(t(document).scrollTop()+o.scrollSpeed)),e.pageX-t(document).scrollLeft()<o.scrollSensitivity?r=t(document).scrollLeft(t(document).scrollLeft()-o.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<o.scrollSensitivity&&(r=t(document).scrollLeft(t(document).scrollLeft()+o.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=t.left,o=a+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>a&&o>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),s="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),n=i&&s,a=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return n?this.floating?o&&"right"===o||"down"===a?2:1:a&&("down"===a?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),s=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&s||"left"===a&&!s:n&&("down"===n&&i||"up"===n&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,s,n,a,o=[],r=[],h=this._connectWith();if(h&&e)for(i=h.length-1;i>=0;i--)for(n=t(h[i]),s=n.length-1;s>=0;s--)a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&r.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(r.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--)r[i][0].each(function(){o.push(this)});return t(o)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i]),s=n.length-1;s>=0;s--)a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(u.push([t.isFunction(a.options.items)?a.options.items.call(a.element[0],e,{item:this.currentItem}):t(a.options.items,a.element),a]),this.containers.push(a));for(i=u.length-1;i>=0;i--)for(o=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",o),c.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?e.currentItem.children().each(function(){t("<td>&#160;</td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_contactContainers:function(s){var n,a,o,r,h,l,c,u,d,p,f=null,m=null;for(n=this.containers.length-1;n>=0;n--)if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(f&&t.contains(this.containers[n].element[0],f.element[0]))continue;f=this.containers[n],m=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",s,this._uiHash(this)),this.containers[n].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(o=1e4,r=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",c=this.positionAbs[h]+this.offset.click[h],a=this.items.length-1;a>=0;a--)t.contains(this.containers[m].element[0],this.items[a].item[0])&&this.items[a].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[a].top,this.items[a].height))&&(u=this.items[a].item.offset()[h],d=!1,Math.abs(u-c)>Math.abs(u+this.items[a][l]-c)&&(d=!0,u+=this.items[a][l]),o>Math.abs(u-c)&&(o=Math.abs(u-c),r=this.items[a],this.direction=d?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;r?this._rearrange(s,r,null,!0):this._rearrange(s,null,this.containers[m].element,!0),this._trigger("change",s,this._uiHash()),this.containers[m]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,a=e.pageX,o=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||s.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})})(jQuery);(function(t){var e=0,i={},s={};i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="hide",s.height=s.paddingTop=s.paddingBottom=s.borderTopWidth=s.borderBottomWidth="show",t.widget("ui.accordion",{version:"1.10.3",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t(),content:this.active.length?this.active.next():t()}},_createIcons:function(){var e=this.options.icons;e&&(t("<span>").addClass("ui-accordion-header-icon ui-icon "+e.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(e.header).addClass(e.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),undefined):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),"disabled"===t&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!e),undefined)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),a=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(t(e.target).attr("tabIndex",-1),t(a).attr("tabIndex",0),a.focus(),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().focus()},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var i,s=this.options,n=s.heightStyle,a=this.element.parent(),o=this.accordionId="ui-accordion-"+(this.element.attr("id")||++e);this.active=this._findActive(s.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(e){var i=t(this),s=i.attr("id"),n=i.next(),a=n.attr("id");s||(s=o+"-header-"+e,i.attr("id",s)),a||(a=o+"-panel-"+e,n.attr("id",a)),i.attr("aria-controls",a),n.attr("aria-labelledby",s)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(s.event),"fill"===n?(i=a.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.headers.each(function(){i-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===n&&(i=0,this.headers.next().each(function(){i=Math.max(i,t(this).css("height","").height())}).height(i))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?t():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?t():n,newPanel:r};e.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",e,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?t():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-expanded":"false","aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr("tabIndex",-1):i.length&&this.headers.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(t,e,n){var a,o,r,h=this,l=0,c=t.length&&(!e.length||t.index()<e.index()),u=this.options.animate||{},d=c&&u.down||u,p=function(){h._toggleComplete(n)};return"number"==typeof d&&(r=d),"string"==typeof d&&(o=d),o=o||d.easing||u.easing,r=r||d.duration||u.duration,e.length?t.length?(a=t.show().outerHeight(),e.animate(i,{duration:r,easing:o,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(s,{duration:r,easing:o,complete:p,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?l+=i.now:"content"!==h.options.heightStyle&&(i.now=Math.round(a-e.outerHeight()-l),l=0)}}),undefined):e.animate(i,r,o,p):t.animate(s,r,o,p)},_toggleComplete:function(t){var e=t.oldPanel;e.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}})})(jQuery);(function(t){var e=0;t.widget("ui.autocomplete",{version:"1.10.3",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,undefined;e=!1,s=!1,i=!1;var a=t.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:e=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case a.UP:e=!0,this._keyEvent("previous",n);break;case a.DOWN:e=!0,this._keyEvent("next",n);break;case a.ENTER:case a.NUMPAD_ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),undefined;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),undefined):(this._searchTimeout(t),undefined)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,undefined):(clearTimeout(this.searching),this.close(t),this._change(t),undefined)}}),this._initSource(),this.menu=t("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().data("ui-menu"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];t(e.target).closest(".ui-menu-item").length||this._delay(function(){var e=this;this.document.one("mousedown",function(s){s.target===e.element[0]||s.target===i||t.contains(i,s.target)||e.close()})})},menufocus:function(e,i){if(this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type)))return this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),undefined;var s=i.item.data("ui-autocomplete-item");!1!==this._trigger("focus",e,{item:s})?e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(s.value):this.liveRegion.text(s.value)},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=t("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertBefore(this.element),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e||(e=this.element.closest(".ui-front")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):undefined},_search:function(t){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var t=this,i=++e;return function(s){i===e&&t.__response(s),t.pending--,t.pending||t.element.removeClass("ui-autocomplete-loading")}},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({label:e.label||e.value,value:e.value||e.label},e)})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<a>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this._value(this.term),this.menu.blur(),undefined):(this.menu[t](e),undefined):(this.search(null,e),undefined)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.text(e))}})})(jQuery);(function(t){var e,i,s,n,a="ui-button ui-widget ui-state-default ui-corner-all",o="ui-state-hover ui-state-active ",r="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",h=function(){var e=t(this);setTimeout(function(){e.find(":ui-button").button("refresh")},1)},l=function(e){var i=e.name,s=e.form,n=t([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?t(s).find("[name='"+i+"']"):t("[name='"+i+"']",e.ownerDocument).filter(function(){return!this.form})),n};t.widget("ui.button",{version:"1.10.3",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,h),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var o=this,r=this.options,c="checkbox"===this.type||"radio"===this.type,u=c?"":"ui-state-active",d="ui-state-focus";null===r.label&&(r.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(a).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){r.disabled||this===e&&t(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){r.disabled||t(this).removeClass(u)}).bind("click"+this.eventNamespace,function(t){r.disabled&&(t.preventDefault(),t.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){o.buttonElement.addClass(d)}).bind("blur"+this.eventNamespace,function(){o.buttonElement.removeClass(d)}),c&&(this.element.bind("change"+this.eventNamespace,function(){n||o.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(t){r.disabled||(n=!1,i=t.pageX,s=t.pageY)}).bind("mouseup"+this.eventNamespace,function(t){r.disabled||(i!==t.pageX||s!==t.pageY)&&(n=!0)})),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return r.disabled||n?!1:undefined}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(r.disabled||n)return!1;t(this).addClass("ui-state-active"),o.buttonElement.attr("aria-pressed","true");var e=o.element[0];l(e).not(e).map(function(){return t(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return r.disabled?!1:(t(this).addClass("ui-state-active"),e=this,o.document.one("mouseup",function(){e=null}),undefined)}).bind("mouseup"+this.eventNamespace,function(){return r.disabled?!1:(t(this).removeClass("ui-state-active"),undefined)}).bind("keydown"+this.eventNamespace,function(e){return r.disabled?!1:((e.keyCode===t.ui.keyCode.SPACE||e.keyCode===t.ui.keyCode.ENTER)&&t(this).addClass("ui-state-active"),undefined)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){t(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===t.ui.keyCode.SPACE&&t(this).click()})),this._setOption("disabled",r.disabled),this._resetButton()},_determineButtonType:function(){var t,e,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(t=this.element.parents().last(),e="label[for='"+this.element.attr("id")+"']",this.buttonElement=t.find(e),this.buttonElement.length||(t=t.length?t.siblings():this.element.siblings(),this.buttonElement=t.filter(e),this.buttonElement.length||(this.buttonElement=t.find(e))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(a+" "+o+" "+r).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(t,e){return this._super(t,e),"disabled"===t?(e?this.element.prop("disabled",!0):this.element.prop("disabled",!1),undefined):(this._resetButton(),undefined)},refresh:function(){var e=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");e!==this.options.disabled&&this._setOption("disabled",e),"radio"===this.type?l(this.element[0]).each(function(){t(this).is(":checked")?t(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):t(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),undefined;var e=this.buttonElement.removeClass(r),i=t("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(e.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&e.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&e.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||e.attr("title",t.trim(i)))):a.push("ui-button-text-only"),e.addClass(a.join(" "))}}),t.widget("ui.buttonset",{version:"1.10.3",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(t,e){"disabled"===t&&this.buttons.button("option",t,e),this._super(t,e)},refresh:function(){var e="rtl"===this.element.css("direction");this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(e?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(e?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return t(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(jQuery);(function(t,e){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.dpDiv=s(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function s(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){t.datepicker._isDisabledDatepicker(a.inline?e.parent()[0]:a.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))})}function n(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.extend(t.ui,{datepicker:{version:"1.10.3"}});var a,r="datepicker";t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return n(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,a;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),a=this._newInst(t(e),n),a.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,a):n&&this._inlineDatepicker(e,a)},_newInst:function(e,i){var n=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?s(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,r,i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,a,r=this._get(i,"appendText"),o=this._get(i,"isRTL");i.append&&i.append.remove(),r&&(i.append=t("<span class='"+this._appendClass+"'>"+r+"</span>"),e[o?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(a?t("<img/>").attr({src:a,alt:n,title:n}):n)),e[o?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,a=new Date(2009,11,20),r=this._get(t,"dateFormat");r.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},a.setMonth(e(this._get(t,r.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(e(this._get(t,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),t.input.attr("size",this._formatDate(t,a).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,r,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,a,o){var h,l,c,u,d,p=this._dialogInst;return p||(this.uuid+=1,h="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+h+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},t.data(this._dialogInput[0],r,p)),n(p.settings,a||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(l=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+u,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],r,p),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,r);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,r),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())},_enableDatepicker:function(e){var i,s,n=t(e),a=t.data(e,r);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),a=t.data(e,r);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,r)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,s,a){var r,o,h,l,c=this._getInst(i);return 2===arguments.length&&"string"==typeof s?"defaults"===s?t.extend({},t.datepicker._defaults):c?"all"===s?t.extend({},c.settings):this._get(c,s):null:(r=s||{},"string"==typeof s&&(r={},r[s]=a),c&&(this._curInst===c&&this._hideDatepicker(),o=this._getDateDatepicker(i,!0),h=this._getMinMaxDate(c,"min"),l=this._getMinMaxDate(c,"max"),n(c.settings,r),null!==h&&r.dateFormat!==e&&r.minDate===e&&(c.settings.minDate=this._formatDate(c,h)),null!==l&&r.dateFormat!==e&&r.maxDate===e&&(c.settings.maxDate=this._formatDate(c,l)),"disabled"in r&&(r.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(t(i),c),this._autoSize(c),this._setDate(c,o),this._updateAlternate(c),this._updateDatepicker(c)),e)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,a=t.datepicker._getInst(e.target),r=!0,o=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),r=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",a.dpDiv),n[0]&&t.datepicker._selectDay(e.target,a.selectedMonth,a.selectedYear,n[0]),i=t.datepicker._get(a,"onSelect"),i?(s=t.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(a,"stepBigMonths"):-t.datepicker._get(a,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(a,"stepBigMonths"):+t.datepicker._get(a,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),r=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),r=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,o?1:-1,"D"),r=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(a,"stepBigMonths"):-t.datepicker._get(a,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),r=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,o?-1:1,"D"),r=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(a,"stepBigMonths"):+t.datepicker._get(a,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),r=e.ctrlKey||e.metaKey;break;default:r=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):r=!1;r&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(i){var s,n,a=t.datepicker._getInst(i.target);return t.datepicker._get(a,"constrainInput")?(s=t.datepicker._possibleChars(t.datepicker._get(a,"dateFormat")),n=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">n||!s||s.indexOf(n)>-1):e},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,s,a,r,o,h,l;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),s=t.datepicker._get(i,"beforeShow"),a=s?s.apply(e,[e,i]):{},a!==!1&&(n(i.settings,a),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),o={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),o=t.datepicker._checkOffset(i,o,r),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:o.left+"px",top:o.top+"px"}),i.inline||(h=t.datepicker._get(i,"showAnim"),l=t.datepicker._get(i,"duration"),i.dpDiv.zIndex(t(e).zIndex()+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?i.dpDiv.show(h,t.datepicker._get(i,"showOptions"),l):i.dpDiv[h||"show"](h?l:null),t.datepicker._shouldFocusInput(i)&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,a=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,s=this._getNumberOfMonths(e),n=s[1],r=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",r*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),a=e.dpDiv.outerHeight(),r=e.input?e.input.outerWidth():0,o=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-r:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+o?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+o):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,a,o=this._curInst;!o||e&&o!==t.data(e,r)||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){t.datepicker._tidyDialog(o)},t.effects&&(t.effects.effect[i]||t.effects[i])?o.dpDiv.hide(i,t.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(e,i,s,n){var a,r=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(r[0])||(a=this._getInst(r[0]),a.selectedDay=a.currentDay=t("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(e,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,a=this._get(e,"altField");a&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(a).each(function(){t(this).val(n)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(i,s,n){if(null==i||null==s)throw"Invalid arguments";if(s="object"==typeof s?""+s:s+"",""===s)return null;var a,r,o,h,l=0,c=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,p=(n?n.dayNames:null)||this._defaults.dayNames,f=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,m=(n?n.monthNames:null)||this._defaults.monthNames,g=-1,v=-1,_=-1,b=-1,y=!1,x=function(t){var e=i.length>a+1&&i.charAt(a+1)===t;return e&&a++,e},k=function(t){var e=x(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n=RegExp("^\\d{1,"+i+"}"),a=s.substring(l).match(n);if(!a)throw"Missing number at position "+l;return l+=a[0].length,parseInt(a[0],10)},w=function(i,n,a){var r=-1,o=t.map(x(i)?a:n,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(o,function(t,i){var n=i[1];return s.substr(l,n.length).toLowerCase()===n.toLowerCase()?(r=i[0],l+=n.length,!1):e}),-1!==r)return r+1;throw"Unknown name at position "+l},D=function(){if(s.charAt(l)!==i.charAt(a))throw"Unexpected literal at position "+l;l++};for(a=0;i.length>a;a++)if(y)"'"!==i.charAt(a)||x("'")?D():y=!1;else switch(i.charAt(a)){case"d":_=k("d");break;case"D":w("D",d,p);break;case"o":b=k("o");break;case"m":v=k("m");break;case"M":v=w("M",f,m);break;case"y":g=k("y");break;case"@":h=new Date(k("@")),g=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"!":h=new Date((k("!")-this._ticksTo1970)/1e4),g=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"'":x("'")?D():y=!0;break;default:D()}if(s.length>l&&(o=s.substr(l),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=g?0:-100)),b>-1)for(v=1,_=b;;){if(r=this._getDaysInMonth(g,v-1),r>=_)break;v++,_-=r}if(h=this._daylightSavingAdjust(new Date(g,v-1,_)),h.getFullYear()!==g||h.getMonth()+1!==v||h.getDate()!==_)throw"Invalid date";return h},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,r=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,o=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,a);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),r,o);break;case"y":u+=h("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,i){return t.settings[i]!==e?t.settings[i]:this._defaults[i]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),a=n,r=this._getFormatConfig(t);try{a=this.parseDate(i,s,r)||n}catch(o){s=e?"":s}t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),t.currentDay=s?a.getDate():0,t.currentMonth=s?a.getMonth():0,t.currentYear=s?a.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},a=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,a=n.getFullYear(),r=n.getMonth(),o=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":o+=parseInt(l[1],10);break;case"w":case"W":o+=7*parseInt(l[1],10);break;case"m":case"M":r+=parseInt(l[1],10),o=Math.min(o,t.datepicker._getDaysInMonth(a,r));break;case"y":case"Y":a+=parseInt(l[1],10),o=Math.min(o,t.datepicker._getDaysInMonth(a,r))}l=h.exec(i)}return new Date(a,r,o)},r=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return r=r&&"Invalid Date"==""+r?s:r,r&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,a=t.selectedYear,r=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=r.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=r.getMonth(),t.drawYear=t.selectedYear=t.currentYear=r.getFullYear(),n===t.selectedMonth&&a===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,a,r,o,h,l,c,u,d,p,f,m,g,v,_,b,y,x,k,w,D,T,C,M,S,N,I,P,A,z,H,E,F,O,W,j,R=new Date,L=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),B=this._get(t,"showButtonPanel"),J=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),Q=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),U=this._get(t,"stepMonths"),q=1!==Q[0]||1!==Q[1],X=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(t,"min"),$=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),$)for(e=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-Q[0]*Q[1]+1,$.getDate())),e=G&&G>e?G:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-U,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+U,1)),this._getFormatConfig(t)):n,a=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",r=this._get(t,"currentText"),o=this._get(t,"gotoCurrent")&&t.currentDay?X:L,r=K?this.formatDate(r,o,this._getFormatConfig(t)):r,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,o)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+r+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),m=this._get(t,"monthNamesShort"),g=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),_=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;Q[0]>k;k++){for(w="",this.maxRows=4,D=0;Q[1]>D;D++){if(T=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),C=" ui-corner-all",M="",q){if(M+="<div class='ui-datepicker-group",Q[1]>1)switch(D){case 0:M+=" ui-datepicker-group-first",C=" ui-corner-"+(Y?"right":"left");break;case Q[1]-1:M+=" ui-datepicker-group-last",C=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",C=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+C+"'>"+(/all|left/.test(C)&&0===k?Y?a:s:"")+(/all|right/.test(C)&&0===k?Y?s:a:"")+this._generateMonthYearHeader(t,Z,te,G,$,k>0||D>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",S=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+c)%7,S+="<th"+((x+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[N]+"'>"+p[N]+"</span></th>";for(M+=S+"</tr></thead><tbody>",I=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,I)),P=(this._getFirstDayOfMonth(te,Z)-c+7)%7,A=Math.ceil((P+I)/7),z=q?this.maxRows>A?this.maxRows:A:A,this.maxRows=z,H=this._daylightSavingAdjust(new Date(te,Z,1-P)),E=0;z>E;E++){for(M+="<tr>",F=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(H)+"</td>":"",x=0;7>x;x++)O=g?g.apply(t.input?t.input[0]:null,[H]):[!0,""],W=H.getMonth()!==Z,j=W&&!_||!O[0]||G&&G>H||$&&H>$,F+="<td class='"+((x+c+6)%7>=5?" ui-datepicker-week-end":"")+(W?" ui-datepicker-other-month":"")+(H.getTime()===T.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===H.getTime()&&b.getTime()===T.getTime()?" "+this._dayOverClass:"")+(j?" "+this._unselectableClass+" ui-state-disabled":"")+(W&&!v?"":" "+O[1]+(H.getTime()===X.getTime()?" "+this._currentClass:"")+(H.getTime()===L.getTime()?" ui-datepicker-today":""))+"'"+(W&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"&#39;")+"'")+(j?"":" data-handler='selectDay' data-event='click' data-month='"+H.getMonth()+"' data-year='"+H.getFullYear()+"'")+">"+(W&&!v?"&#xa0;":j?"<span class='ui-state-default'>"+H.getDate()+"</span>":"<a class='ui-state-default"+(H.getTime()===L.getTime()?" ui-state-highlight":"")+(H.getTime()===X.getTime()?" ui-state-active":"")+(W?" ui-priority-secondary":"")+"' href='#'>"+H.getDate()+"</a>")+"</td>",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);M+=F+"</tr>"}Z++,Z>11&&(Z=0,te++),M+="</tbody></table>"+(q?"</div>"+(Q[0]>0&&D===Q[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),w+=M}y+=w}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,a,r,o){var h,l,c,u,d,p,f,m,g=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),_=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(a||!g)y+="<span class='ui-datepicker-month'>"+r[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+o[c]+"</option>");y+="</select>"}if(_||(b+=y+(!a&&g&&v?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);
7
+ return isNaN(e)?d:e},f=p(u[0]),m=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),_&&(b+=(!a&&g&&v?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.drawYear+("Y"===i?e:0),n=t.drawMonth+("M"===i?e:0),a=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),r=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,a)));t.selectedDay=r.getDate(),t.drawMonth=t.selectedMonth=r.getMonth(),t.drawYear=t.selectedYear=r.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),a=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(t,a)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),a=this._getMinMaxDate(t,"max"),r=null,o=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),r=parseInt(i[0],10),o=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(r+=s),i[1].match(/[+\-].*/)&&(o+=s)),(!n||e.getTime()>=n.getTime())&&(!a||e.getTime()<=a.getTime())&&(!r||e.getFullYear()>=r)&&(!o||o>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.10.3"})(jQuery);(function(t){var e={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};t.widget("ui.dialog",{version:"1.10.3",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._destroyOverlay(),this.opener.filter(":focusable").focus().length||t(this.document[0].activeElement).blur(),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!!this.uiDialog.nextAll(":visible").insertBefore(this.uiDialog).length;return i&&!e&&this._trigger("focus",t),i},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),undefined):(this._isOpen=!0,this.opener=t(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._trigger("open"),undefined)},_focusTabbable:function(){var t=this.element.find("[autofocus]");t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).focus()},_keepFocus:function(e){function i(){var e=this.document[0].activeElement,i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),undefined;if(e.keyCode===t.ui.keyCode.TAB){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(n.focus(1),e.preventDefault()):(s.focus(1),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=t("<button></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(e),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title||t.html("&#160;"),t.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),undefined):(t.each(i,function(i,s){var n,a;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(e.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,t("<button></button>",s).button(a).appendTo(e.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),undefined)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){t(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,a){s.position=[a.position.left-i.document.scrollLeft(),a.position.top-i.document.scrollTop()],t(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(a))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){t(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,a){s.height=t(this).height(),s.width=t(this).width(),t(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(a))}}).css("position",a)},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(s){var n=this,a=!1,o={};t.each(s,function(t,s){n._setOption(t,s),t in e&&(a=!0),t in i&&(o[t]=s)}),a&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",o)},_setOption:function(t,e){var i,s,n=this.uiDialog;"dialogClass"===t&&n.removeClass(this.options.dialogClass).addClass(e),"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:""+e}),"draggable"===t&&(i=n.is(":data(ui-draggable)"),i&&!e&&n.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&(s=n.is(":data(ui-resizable)"),s&&!e&&n.resizable("destroy"),s&&"string"==typeof e&&n.resizable("option","handles",e),s||e===!1||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=this,i=this.widgetFullName;t.ui.dialog.overlayInstances||this._delay(function(){t.ui.dialog.overlayInstances&&this.document.bind("focusin.dialog",function(s){e._allowInteraction(s)||(s.preventDefault(),t(".ui-dialog:visible:last .ui-dialog-content").data(i)._focusTabbable())})}),this.overlay=t("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),t.ui.dialog.overlayInstances++}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(t.ui.dialog.overlayInstances--,t.ui.dialog.overlayInstances||this.document.unbind("focusin.dialog"),this.overlay.remove(),this.overlay=null)}}),t.ui.dialog.overlayInstances=0,t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{_position:function(){var e,i=this.options.position,s=[],n=[0,0];i?(("string"==typeof i||"object"==typeof i&&"0"in i)&&(s=i.split?i.split(" "):[i[0],i[1]],1===s.length&&(s[1]=s[0]),t.each(["left","top"],function(t,e){+s[t]===s[t]&&(n[t]=s[t],s[t]=e)}),i={my:s[0]+(0>n[0]?n[0]:"+"+n[0])+" "+s[1]+(0>n[1]?n[1]:"+"+n[1]),at:s.join(" ")}),i=t.extend({},t.ui.dialog.prototype.options.position,i)):i=t.ui.dialog.prototype.options.position,e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.position(i),e||this.uiDialog.hide()}})})(jQuery);(function(t){t.widget("ui.menu",{version:"1.10.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,t.proxy(function(t){this.options.disabled&&t.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(t){t.preventDefault()},"click .ui-state-disabled > a":function(t){t.preventDefault()},"click .ui-menu-item:has(a)":function(e){var i=t(e.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(e),i.has(".ui-menu").length?this.expand(e):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){var i=t(e.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(e,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.children(".ui-menu-item").eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){t(e.target).closest(".ui-menu").length||this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var e=t(this);e.data("ui-menu-submenu-carat")&&e.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(e){function i(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,n,a,o,r,h=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:h=!1,n=this.previousFilter||"",a=String.fromCharCode(e.keyCode),o=!1,clearTimeout(this.filterTimer),a===n?o=!0:a=n+a,r=RegExp("^"+i(a),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())}),s=o&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(a=String.fromCharCode(e.keyCode),r=RegExp("^"+i(a),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())})),s.length?(this.focus(e,s),s.length>1?(this.previousFilter=a,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i=this.options.icons.submenu,s=this.element.find(this.options.menus);s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),s=e.prev("a"),n=t("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);s.attr("aria-haspopup","true").prepend(n),e.attr("aria-labelledby",s.attr("id"))}),e=s.add(this.element),e.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),e.children(":not(.ui-menu-item)").each(function(){var e=t(this);/[^\-\u2014\u2013\s]/.test(e.text())||e.addClass("ui-widget-content ui-menu-divider")}),e.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),this._super(t,e)},focus:function(t,e){var i,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=e.height(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",t,{item:this.active}))},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.children(".ui-menu-item")[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(e),undefined)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(e),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)}})})(jQuery);(function(t,e){t.widget("ui.progressbar",{version:"1.10.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=t("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(t){return t===e?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),e)},_constrainedValue:function(t){return t===e&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}})})(jQuery);(function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)o.push(a);this.handles=n.add(t(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):this.range=t([])},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,a,o,r,h,l,u=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-u.values(e));(n>i||n===i&&(e===u._lastChangedValue||u.values(e)===c.min))&&(n=i,a=t(this),o=e)}),r=this._start(e,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-a.width()/2,top:e.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,a;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>s||1===e&&s>i)&&(i=s),i!==this.values(e)&&(n=this.values(),n[e]=i,a=this._trigger("slide",t,{handle:this.handles[e],value:i,values:n}),s=this.values(e?0:1),a!==!1&&this.values(e,i,!0))):i!==this.value()&&(a=this._trigger("slide",t,{handle:this.handles[e],value:i}),a!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),undefined):this._value()},values:function(e,i){var s,n,a;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),undefined;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(i){var s,n,a,o,r=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),s=this._start(i,r),s===!1))return}switch(o=this.options.step,n=a=this.options.values&&this.options.values.length?this.values(r):this.value(),i.keyCode){case t.ui.keyCode.HOME:a=this._valueMin();break;case t.ui.keyCode.END:a=this._valueMax();break;case t.ui.keyCode.PAGE_UP:a=this._trimAlignValue(n+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:a=this._trimAlignValue(n-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(n===this._valueMax())return;a=this._trimAlignValue(n+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(n===this._valueMin())return;a=this._trimAlignValue(n-o)}this._slide(i,r,a)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})})(jQuery);(function(t){function e(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.widget("ui.spinner",{version:"1.10.3",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e={},i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);void 0!==n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var t=this.element[0]===this.document[0].activeElement;t||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var t=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=t.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*t.height())&&t.height()>0&&t.height(t.height()),this.options.disabled&&this.disable()},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){if("culture"===t||"numberFormat"===t){var i=this._parse(this.element.val());return this.options[t]=e,this.element.val(this._format(i)),void 0}("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(e.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(e.down)),this._super(t,e),"disabled"===t&&(e?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:e(function(t){this._super(t),this._value(this.element.val())}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:e(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:e(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:e(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:e(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(e(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}})})(jQuery);(function(t,e){function i(){return++n}function s(t){return t.hash.length>1&&decodeURIComponent(t.href.replace(a,""))===decodeURIComponent(location.href.replace(a,""))}var n=0,a=/#.*$/;t.widget("ui.tabs",{version:"1.10.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var e=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var i=this.options.active,s=this.options.collapsible,n=location.hash.substring(1);return null===i&&(n&&this.tabs.each(function(s,a){return t(a).attr("aria-controls")===n?(i=s,!1):e}),null===i&&(i=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===i||-1===i)&&(i=this.tabs.length?0:!1)),i!==!1&&(i=this.tabs.index(this.tabs.eq(i)),-1===i&&(i=s?!1:0)),!s&&i===!1&&this.anchors.length&&(i=0),i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(i){var s=t(this.document[0].activeElement).closest("li"),n=this.tabs.index(s),a=!0;if(!this._handlePageNav(i)){switch(i.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:n++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:a=!1,n--;break;case t.ui.keyCode.END:n=this.anchors.length-1;break;case t.ui.keyCode.HOME:n=0;break;case t.ui.keyCode.SPACE:return i.preventDefault(),clearTimeout(this.activating),this._activate(n),e;case t.ui.keyCode.ENTER:return i.preventDefault(),clearTimeout(this.activating),this._activate(n===this.options.active?!1:n),e;default:return}i.preventDefault(),clearTimeout(this.activating),n=this._focusNextTab(n,a),i.ctrlKey||(s.attr("aria-selected","false"),this.tabs.eq(n).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",n)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.focus())},_handlePageNav:function(i){return i.altKey&&i.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):i.altKey&&i.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):e},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).focus(),t},_setOption:function(t,i){return"active"===t?(this._activate(i),e):"disabled"===t?(this._setupDisabled(i),e):(this._super(t,i),"collapsible"===t&&(this.element.toggleClass("ui-tabs-collapsible",i),i||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(i),"heightStyle"===t&&this._setupHeightStyle(i),e)},_tabId:function(t){return t.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=t(),this.anchors.each(function(i,n){var a,o,r,h=t(n).uniqueId().attr("id"),l=t(n).closest("li"),u=l.attr("aria-controls");s(n)?(a=n.hash,o=e.element.find(e._sanitizeSelector(a))):(r=e._tabId(l),a="#"+r,o=e.element.find(a),o.length||(o=e._createPanel(r),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),u&&l.data("ui-tabs-aria-controls",u),l.attr({"aria-controls":a.substring(1),"aria-labelledby":h}),o.attr("aria-labelledby",h)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(e){t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1);for(var i,s=0;i=this.tabs[s];s++)e===!0||-1!==t.inArray(s,e)?t(i).addClass("ui-state-disabled").attr("aria-disabled","true"):t(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=e},_setupEvents:function(e){var i={click:function(t){t.preventDefault()}};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?t():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):t(),u={oldTab:s,oldPanel:l,newTab:r?t():a,newPanel:h};e.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",e,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?t():a,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),e),this._toggle(e,u))},_toggle:function(e,i){function s(){a.running=!1,a._trigger("activate",e,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr({"aria-expanded":"false","aria-hidden":"true"}),i.oldTab.attr("aria-selected","false"),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr({"aria-expanded":"true","aria-hidden":"false"}),i.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(t){return"string"==typeof t&&(t=this.anchors.index(this.anchors.filter("[href$='"+t+"']"))),t},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var s=this.options.disabled;s!==!1&&(i===e?s=!1:(i=this._getIndex(i),s=t.isArray(s)?t.map(s,function(t){return t!==i?t:null}):t.map(this.tabs,function(t,e){return e!==i?e:null})),this._setupDisabled(s))},disable:function(i){var s=this.options.disabled;if(s!==!0){if(i===e)s=!0;else{if(i=this._getIndex(i),-1!==t.inArray(i,s))return;s=t.isArray(s)?t.merge([i],s).sort():[i]}this._setupDisabled(s)}},load:function(e,i){e=this._getIndex(e);var n=this,a=this.tabs.eq(e),o=a.find(".ui-tabs-anchor"),r=this._getPanelForTab(a),h={tab:a,panel:r};s(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,h)),this.xhr&&"canceled"!==this.xhr.statusText&&(a.addClass("ui-tabs-loading"),r.attr("aria-busy","true"),this.xhr.success(function(t){setTimeout(function(){r.html(t),n._trigger("load",i,h)},1)}).complete(function(t,e){setTimeout(function(){"abort"===e&&n.panels.stop(!1,!0),a.removeClass("ui-tabs-loading"),r.removeAttr("aria-busy"),t===n.xhr&&delete n.xhr},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href"),beforeSend:function(e,a){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:a},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})})(jQuery);(function(t){function e(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))}function i(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")}var s=0;t.widget("ui.tooltip",{version:"1.10.3",options:{content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(e,i){var s=this;return"disabled"===e?(this[i?"_disable":"_enable"](),this.options[e]=i,void 0):(this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e)}),void 0)},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.is("[title]")&&e.data("ui-tooltip-title",e.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))})},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,a=e?e.type:null;return"string"==typeof s?this._open(e,t,s):(i=s.call(t[0],function(i){t.data("ui-tooltip-open")&&n._delay(function(){e&&(e.type=a),this._open(e,t,i)})}),i&&this._open(e,t,i),void 0)},_open:function(i,s,n){function a(t){l.of=t,o.is(":hidden")||o.position(l)}var o,r,h,l=t.extend({},this.options.position);if(n){if(o=this._find(s),o.length)return o.find(".ui-tooltip-content").html(n),void 0;s.is("[title]")&&(i&&"mouseover"===i.type?s.attr("title",""):s.removeAttr("title")),o=this._tooltip(s),e(s,o.attr("id")),o.find(".ui-tooltip-content").html(n),this.options.track&&i&&/^mouse/.test(i.type)?(this._on(this.document,{mousemove:a}),a(i)):o.position(t.extend({of:s},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){o.is(":visible")&&(a(l.of),clearInterval(h))},t.fx.interval)),this._trigger("open",i,{tooltip:o}),r={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var i=t.Event(e);i.currentTarget=s[0],this.close(i,!0)}},remove:function(){this._removeTooltip(o)}},i&&"mouseover"!==i.type||(r.mouseleave="close"),i&&"focusin"!==i.type||(r.focusout="close"),this._on(!0,s,r)}},close:function(e){var s=this,n=t(e?e.currentTarget:this.element),a=this._find(n);this.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&n.attr("title",n.data("ui-tooltip-title")),i(n),a.stop(!0),this._hide(a,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),this.closing=!0,this._trigger("close",e,{tooltip:a}),this.closing=!1)},_tooltip:function(e){var i="ui-tooltip-"+s++,n=t("<div>").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("<div>").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery);
@@ -1,1060 +1,2103 @@
1
1
  /*
2
- * jQuery timepicker addon
3
- * By: Trent Richardson [http://trentrichardson.com]
4
- * Version 0.9.6
5
- * Last Modified: 07/20/2011
6
- *
7
- * Copyright 2011 Trent Richardson
8
- * Dual licensed under the MIT and GPL licenses.
9
- * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10
- * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11
- *
12
- * HERES THE CSS:
13
- * .ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; }
14
- * .ui-timepicker-div dl{ text-align: left; }
15
- * .ui-timepicker-div dl dt{ height: 25px; }
16
- * .ui-timepicker-div dl dd{ margin: -25px 10px 10px 65px; }
17
- * .ui-timepicker-div td { font-size: 90%; }
18
- */
2
+ * jQuery timepicker addon
3
+ * By: Trent Richardson [http://trentrichardson.com]
4
+ * Version 1.3
5
+ * Last Modified: 05/05/2013
6
+ *
7
+ * Copyright 2013 Trent Richardson
8
+ * You may use this project under MIT or GPL licenses.
9
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11
+ */
12
+
13
+ /*jslint evil: true, white: false, undef: false, nomen: false */
19
14
 
20
15
  (function($) {
21
16
 
22
- $.extend($.ui, { timepicker: { version: "0.9.6" } });
23
-
24
- /* Time picker manager.
25
- Use the singleton instance of this class, $.timepicker, to interact with the time picker.
26
- Settings for (groups of) time pickers are maintained in an instance object,
27
- allowing multiple different settings on the same page. */
28
-
29
- function Timepicker() {
30
- this.regional = []; // Available regional settings, indexed by language code
31
- this.regional[''] = { // Default regional settings
32
- currentText: 'Now',
33
- closeText: 'Done',
34
- ampm: false,
35
- timeFormat: 'hh:mm tt',
36
- timeSuffix: '',
37
- timeOnlyTitle: 'Choose Time',
38
- timeText: 'Time',
39
- hourText: 'Hour',
40
- minuteText: 'Minute',
41
- secondText: 'Second',
42
- timezoneText: 'Time Zone'
17
+ /*
18
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
19
+ */
20
+ $.ui.timepicker = $.ui.timepicker || {};
21
+ if ($.ui.timepicker.version) {
22
+ return;
23
+ }
24
+
25
+ /*
26
+ * Extend jQueryUI, get it started with our version number
27
+ */
28
+ $.extend($.ui, {
29
+ timepicker: {
30
+ version: "1.3"
31
+ }
32
+ });
33
+
34
+ /*
35
+ * Timepicker manager.
36
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
37
+ * Settings for (groups of) time pickers are maintained in an instance object,
38
+ * allowing multiple different settings on the same page.
39
+ */
40
+ var Timepicker = function() {
41
+ this.regional = []; // Available regional settings, indexed by language code
42
+ this.regional[''] = { // Default regional settings
43
+ currentText: 'Now',
44
+ closeText: 'Done',
45
+ amNames: ['AM', 'A'],
46
+ pmNames: ['PM', 'P'],
47
+ timeFormat: 'HH:mm',
48
+ timeSuffix: '',
49
+ timeOnlyTitle: 'Choose Time',
50
+ timeText: 'Time',
51
+ hourText: 'Hour',
52
+ minuteText: 'Minute',
53
+ secondText: 'Second',
54
+ millisecText: 'Millisecond',
55
+ microsecText: 'Microsecond',
56
+ timezoneText: 'Time Zone',
57
+ isRTL: false
58
+ };
59
+ this._defaults = { // Global defaults for all the datetime picker instances
60
+ showButtonPanel: true,
61
+ timeOnly: false,
62
+ showHour: null,
63
+ showMinute: null,
64
+ showSecond: null,
65
+ showMillisec: null,
66
+ showMicrosec: null,
67
+ showTimezone: null,
68
+ showTime: true,
69
+ stepHour: 1,
70
+ stepMinute: 1,
71
+ stepSecond: 1,
72
+ stepMillisec: 1,
73
+ stepMicrosec: 1,
74
+ hour: 0,
75
+ minute: 0,
76
+ second: 0,
77
+ millisec: 0,
78
+ microsec: 0,
79
+ timezone: null,
80
+ hourMin: 0,
81
+ minuteMin: 0,
82
+ secondMin: 0,
83
+ millisecMin: 0,
84
+ microsecMin: 0,
85
+ hourMax: 23,
86
+ minuteMax: 59,
87
+ secondMax: 59,
88
+ millisecMax: 999,
89
+ microsecMax: 999,
90
+ minDateTime: null,
91
+ maxDateTime: null,
92
+ onSelect: null,
93
+ hourGrid: 0,
94
+ minuteGrid: 0,
95
+ secondGrid: 0,
96
+ millisecGrid: 0,
97
+ microsecGrid: 0,
98
+ alwaysSetTime: true,
99
+ separator: ' ',
100
+ altFieldTimeOnly: true,
101
+ altTimeFormat: null,
102
+ altSeparator: null,
103
+ altTimeSuffix: null,
104
+ pickerTimeFormat: null,
105
+ pickerTimeSuffix: null,
106
+ showTimepicker: true,
107
+ timezoneList: null,
108
+ addSliderAccess: false,
109
+ sliderAccessArgs: null,
110
+ controlType: 'slider',
111
+ defaultValue: null,
112
+ parse: 'strict'
113
+ };
114
+ $.extend(this._defaults, this.regional['']);
43
115
  };
44
- this._defaults = { // Global defaults for all the datetime picker instances
45
- showButtonPanel: true,
46
- timeOnly: false,
47
- showHour: true,
48
- showMinute: true,
49
- showSecond: false,
50
- showTimezone: false,
51
- showTime: true,
52
- stepHour: 0.05,
53
- stepMinute: 0.05,
54
- stepSecond: 0.05,
116
+
117
+ $.extend(Timepicker.prototype, {
118
+ $input: null,
119
+ $altInput: null,
120
+ $timeObj: null,
121
+ inst: null,
122
+ hour_slider: null,
123
+ minute_slider: null,
124
+ second_slider: null,
125
+ millisec_slider: null,
126
+ microsec_slider: null,
127
+ timezone_select: null,
55
128
  hour: 0,
56
129
  minute: 0,
57
130
  second: 0,
58
- timezone: '+0000',
59
- hourMin: 0,
60
- minuteMin: 0,
61
- secondMin: 0,
62
- hourMax: 23,
63
- minuteMax: 59,
64
- secondMax: 59,
65
- minDateTime: null,
66
- maxDateTime: null,
67
- hourGrid: 0,
68
- minuteGrid: 0,
69
- secondGrid: 0,
70
- alwaysSetTime: true,
71
- separator: ' ',
72
- altFieldTimeOnly: true,
73
- showTimepicker: true,
74
- timezoneList: ["-1100", "-1000", "-0900", "-0800", "-0700", "-0600",
75
- "-0500", "-0400", "-0300", "-0200", "-0100", "+0000",
76
- "+0100", "+0200", "+0300", "+0400", "+0500", "+0600",
77
- "+0700", "+0800", "+0900", "+1000", "+1100", "+1200"]
78
- };
79
- $.extend(this._defaults, this.regional['']);
80
- }
81
-
82
- $.extend(Timepicker.prototype, {
83
- $input: null,
84
- $altInput: null,
85
- $timeObj: null,
86
- inst: null,
87
- hour_slider: null,
88
- minute_slider: null,
89
- second_slider: null,
90
- timezone_select: null,
91
- hour: 0,
92
- minute: 0,
93
- second: 0,
94
- timezone: '+0000',
95
- hourMinOriginal: null,
96
- minuteMinOriginal: null,
97
- secondMinOriginal: null,
98
- hourMaxOriginal: null,
99
- minuteMaxOriginal: null,
100
- secondMaxOriginal: null,
101
- ampm: '',
102
- formattedDate: '',
103
- formattedTime: '',
104
- formattedDateTime: '',
105
- timezoneList: ["-1100", "-1000", "-0900", "-0800", "-0700", "-0600",
106
- "-0500", "-0400", "-0300", "-0200", "-0100", "+0000",
107
- "+0100", "+0200", "+0300", "+0400", "+0500", "+0600",
108
- "+0700", "+0800", "+0900", "+1000", "+1100", "+1200"],
109
-
110
- /* Override the default settings for all instances of the time picker.
111
- @param settings object - the new settings to use as defaults (anonymous object)
112
- @return the manager object */
113
- setDefaults: function(settings) {
114
- extendRemove(this._defaults, settings || {});
115
- return this;
116
- },
117
-
118
- //########################################################################
119
- // Create a new Timepicker instance
120
- //########################################################################
121
- _newInst: function($input, o) {
122
- var tp_inst = new Timepicker(),
123
- inlineSettings = {};
124
-
125
- for (var attrName in this._defaults) {
126
- var attrValue = $input.attr('time:' + attrName);
127
- if (attrValue) {
131
+ millisec: 0,
132
+ microsec: 0,
133
+ timezone: null,
134
+ hourMinOriginal: null,
135
+ minuteMinOriginal: null,
136
+ secondMinOriginal: null,
137
+ millisecMinOriginal: null,
138
+ microsecMinOriginal: null,
139
+ hourMaxOriginal: null,
140
+ minuteMaxOriginal: null,
141
+ secondMaxOriginal: null,
142
+ millisecMaxOriginal: null,
143
+ microsecMaxOriginal: null,
144
+ ampm: '',
145
+ formattedDate: '',
146
+ formattedTime: '',
147
+ formattedDateTime: '',
148
+ timezoneList: null,
149
+ units: ['hour','minute','second','millisec', 'microsec'],
150
+ support: {},
151
+ control: null,
152
+
153
+ /*
154
+ * Override the default settings for all instances of the time picker.
155
+ * @param settings object - the new settings to use as defaults (anonymous object)
156
+ * @return the manager object
157
+ */
158
+ setDefaults: function(settings) {
159
+ extendRemove(this._defaults, settings || {});
160
+ return this;
161
+ },
162
+
163
+ /*
164
+ * Create a new Timepicker instance
165
+ */
166
+ _newInst: function($input, o) {
167
+ var tp_inst = new Timepicker(),
168
+ inlineSettings = {},
169
+ fns = {},
170
+ overrides, i;
171
+
172
+ for (var attrName in this._defaults) {
173
+ if(this._defaults.hasOwnProperty(attrName)){
174
+ var attrValue = $input.attr('time:' + attrName);
175
+ if (attrValue) {
176
+ try {
177
+ inlineSettings[attrName] = eval(attrValue);
178
+ } catch (err) {
179
+ inlineSettings[attrName] = attrValue;
180
+ }
181
+ }
182
+ }
183
+ }
184
+
185
+ overrides = {
186
+ beforeShow: function (input, dp_inst) {
187
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
188
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
189
+ }
190
+ },
191
+ onChangeMonthYear: function (year, month, dp_inst) {
192
+ // Update the time as well : this prevents the time from disappearing from the $input field.
193
+ tp_inst._updateDateTime(dp_inst);
194
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
195
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
196
+ }
197
+ },
198
+ onClose: function (dateText, dp_inst) {
199
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
200
+ tp_inst._updateDateTime(dp_inst);
201
+ }
202
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
203
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
204
+ }
205
+ }
206
+ };
207
+ for (i in overrides) {
208
+ if (overrides.hasOwnProperty(i)) {
209
+ fns[i] = o[i] || null;
210
+ }
211
+ }
212
+
213
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, {
214
+ evnts:fns,
215
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
216
+ });
217
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) {
218
+ return val.toUpperCase();
219
+ });
220
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) {
221
+ return val.toUpperCase();
222
+ });
223
+
224
+ // detect which units are supported
225
+ tp_inst.support = detectSupport(
226
+ tp_inst._defaults.timeFormat +
227
+ (tp_inst._defaults.pickerTimeFormat? tp_inst._defaults.pickerTimeFormat:'') +
228
+ (tp_inst._defaults.altTimeFormat? tp_inst._defaults.altTimeFormat:''));
229
+
230
+ // controlType is string - key to our this._controls
231
+ if(typeof(tp_inst._defaults.controlType) === 'string'){
232
+ if(tp_inst._defaults.controlType == 'slider' && typeof(jQuery.ui.slider) === 'undefined'){
233
+ tp_inst._defaults.controlType = 'select';
234
+ }
235
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
236
+ }
237
+ // controlType is an object and must implement create, options, value methods
238
+ else{
239
+ tp_inst.control = tp_inst._defaults.controlType;
240
+ }
241
+
242
+ // prep the timezone options
243
+ var timezoneList = [-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,
244
+ 0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];
245
+ if (tp_inst._defaults.timezoneList !== null) {
246
+ timezoneList = tp_inst._defaults.timezoneList;
247
+ }
248
+ var tzl=timezoneList.length,tzi=0,tzv=null;
249
+ if (tzl > 0 && typeof timezoneList[0] !== 'object') {
250
+ for(; tzi<tzl; tzi++){
251
+ tzv = timezoneList[tzi];
252
+ timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
253
+ }
254
+ }
255
+ tp_inst._defaults.timezoneList = timezoneList;
256
+
257
+ // set the default units
258
+ tp_inst.timezone = tp_inst._defaults.timezone !== null? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
259
+ ((new Date()).getTimezoneOffset()*-1);
260
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin :
261
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
262
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin :
263
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
264
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin :
265
+ tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second;
266
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin :
267
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
268
+ tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin? tp_inst._defaults.microsecMin :
269
+ tp_inst._defaults.microsec > tp_inst._defaults.microsecMax? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
270
+ tp_inst.ampm = '';
271
+ tp_inst.$input = $input;
272
+
273
+ if (o.altField) {
274
+ tp_inst.$altInput = $(o.altField).css({
275
+ cursor: 'pointer'
276
+ }).focus(function() {
277
+ $input.trigger("focus");
278
+ });
279
+ }
280
+
281
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
282
+ tp_inst._defaults.minDate = new Date();
283
+ }
284
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
285
+ tp_inst._defaults.maxDate = new Date();
286
+ }
287
+
288
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
289
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
290
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
291
+ }
292
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
293
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
294
+ }
295
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
296
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
297
+ }
298
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
299
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
300
+ }
301
+ tp_inst.$input.bind('focus', function() {
302
+ tp_inst._onFocus();
303
+ });
304
+
305
+ return tp_inst;
306
+ },
307
+
308
+ /*
309
+ * add our sliders to the calendar
310
+ */
311
+ _addTimePicker: function(dp_inst) {
312
+ var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
313
+
314
+ this.timeDefined = this._parseTime(currDT);
315
+ this._limitMinMaxDateTime(dp_inst, false);
316
+ this._injectTimePicker();
317
+ },
318
+
319
+ /*
320
+ * parse the time string from input value or _setTime
321
+ */
322
+ _parseTime: function(timeString, withDate) {
323
+ if (!this.inst) {
324
+ this.inst = $.datepicker._getInst(this.$input[0]);
325
+ }
326
+
327
+ if (withDate || !this._defaults.timeOnly) {
328
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
128
329
  try {
129
- inlineSettings[attrName] = eval(attrValue);
330
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
331
+ if (!parseRes.timeObj) {
332
+ return false;
333
+ }
334
+ $.extend(this, parseRes.timeObj);
130
335
  } catch (err) {
131
- inlineSettings[attrName] = attrValue;
336
+ $.timepicker.log("Error parsing the date/time string: " + err +
337
+ "\ndate/time string = " + timeString +
338
+ "\ntimeFormat = " + this._defaults.timeFormat +
339
+ "\ndateFormat = " + dp_dateFormat);
340
+ return false;
132
341
  }
342
+ return true;
343
+ } else {
344
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
345
+ if (!timeObj) {
346
+ return false;
347
+ }
348
+ $.extend(this, timeObj);
349
+ return true;
133
350
  }
134
- }
135
- tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
136
- beforeShow: function(input, dp_inst) {
137
- if ($.isFunction(o.beforeShow))
138
- o.beforeShow(input, dp_inst, tp_inst);
139
- },
140
- onChangeMonthYear: function(year, month, dp_inst) {
141
- // Update the time as well : this prevents the time from disappearing from the $input field.
142
- tp_inst._updateDateTime(dp_inst);
143
- if ($.isFunction(o.onChangeMonthYear))
144
- o.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
145
- },
146
- onClose: function(dateText, dp_inst) {
147
- if (tp_inst.timeDefined === true && $input.val() != '')
148
- tp_inst._updateDateTime(dp_inst);
149
- if ($.isFunction(o.onClose))
150
- o.onClose.call($input[0], dateText, dp_inst, tp_inst);
151
- },
152
- timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
153
- });
351
+ },
352
+
353
+ /*
354
+ * generate and inject html for timepicker into ui datepicker
355
+ */
356
+ _injectTimePicker: function() {
357
+ var $dp = this.inst.dpDiv,
358
+ o = this.inst.settings,
359
+ tp_inst = this,
360
+ litem = '',
361
+ uitem = '',
362
+ show = null,
363
+ max = {},
364
+ gridSize = {},
365
+ size = null,
366
+ i=0,
367
+ l=0;
368
+
369
+ // Prevent displaying twice
370
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
371
+ var noDisplay = ' style="display:none;"',
372
+ html = '<div class="ui-timepicker-div'+ (o.isRTL? ' ui-timepicker-rtl' : '') +'"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
373
+ '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
374
+
375
+ // Create the markup
376
+ for(i=0,l=this.units.length; i<l; i++){
377
+ litem = this.units[i];
378
+ uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
379
+ show = o['show'+uitem] !== null? o['show'+uitem] : this.support[litem];
380
+
381
+ // Added by Peter Medeiros:
382
+ // - Figure out what the hour/minute/second max should be based on the step values.
383
+ // - Example: if stepMinute is 15, then minMax is 45.
384
+ max[litem] = parseInt((o[litem+'Max'] - ((o[litem+'Max'] - o[litem+'Min']) % o['step'+uitem])), 10);
385
+ gridSize[litem] = 0;
386
+
387
+ html += '<dt class="ui_tpicker_'+ litem +'_label"' + (show ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' +
388
+ '<dd class="ui_tpicker_'+ litem +'"><div class="ui_tpicker_'+ litem +'_slider"' + (show ? '' : noDisplay) + '></div>';
389
+
390
+ if (show && o[litem+'Grid'] > 0) {
391
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
392
+
393
+ if(litem == 'hour'){
394
+ for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) {
395
+ gridSize[litem]++;
396
+ var tmph = $.datepicker.formatTime(this.support.ampm? 'hht':'HH', {hour:h}, o);
397
+ html += '<td data-for="'+litem+'">' + tmph + '</td>';
398
+ }
399
+ }
400
+ else{
401
+ for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) {
402
+ gridSize[litem]++;
403
+ html += '<td data-for="'+litem+'">' + ((m < 10) ? '0' : '') + m + '</td>';
404
+ }
405
+ }
154
406
 
155
- tp_inst.hour = tp_inst._defaults.hour;
156
- tp_inst.minute = tp_inst._defaults.minute;
157
- tp_inst.second = tp_inst._defaults.second;
158
- tp_inst.ampm = '';
159
- tp_inst.$input = $input;
160
-
161
- if (o.altField)
162
- tp_inst.$altInput = $(o.altField)
163
- .css({ cursor: 'pointer' })
164
- .focus(function(){ $input.trigger("focus"); });
165
-
166
- // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
167
- if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
168
- tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
169
- if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date)
170
- tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
171
- if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date)
172
- tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
173
- if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date)
174
- tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
175
-
176
- return tp_inst;
177
- },
178
-
179
- //########################################################################
180
- // add our sliders to the calendar
181
- //########################################################################
182
- _addTimePicker: function(dp_inst) {
183
- var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ?
184
- this.$input.val() + ' ' + this.$altInput.val() :
185
- this.$input.val();
186
-
187
- this.timeDefined = this._parseTime(currDT);
188
- this._limitMinMaxDateTime(dp_inst, false);
189
- this._injectTimePicker();
190
- },
191
-
192
- //########################################################################
193
- // parse the time string from input value or _setTime
194
- //########################################################################
195
- _parseTime: function(timeString, withDate) {
196
- var regstr = this._defaults.timeFormat.toString()
197
- .replace(/h{1,2}/ig, '(\\d?\\d)')
198
- .replace(/m{1,2}/ig, '(\\d?\\d)')
199
- .replace(/s{1,2}/ig, '(\\d?\\d)')
200
- .replace(/t{1,2}/ig, '(am|pm|a|p)?')
201
- .replace(/z{1}/ig, '((\\+|-)\\d\\d\\d\\d)?')
202
- .replace(/\s/g, '\\s?') + this._defaults.timeSuffix + '$',
203
- order = this._getFormatPositions(),
204
- treg;
205
-
206
- if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
207
-
208
- if (withDate || !this._defaults.timeOnly) {
209
- // the time should come after x number of characters and a space.
210
- // x = at least the length of text specified by the date format
211
- var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
212
- // escape special regex characters in the seperator
213
- var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g");
214
- regstr = '.{' + dp_dateFormat.length + ',}' + this._defaults.separator.replace(specials, "\\$&") + regstr;
215
- }
216
-
217
- treg = timeString.match(new RegExp(regstr, 'i'));
218
-
219
- if (treg) {
220
- if (order.t !== -1)
221
- this.ampm = ((treg[order.t] === undefined || treg[order.t].length === 0) ?
222
- '' :
223
- (treg[order.t].charAt(0).toUpperCase() == 'A') ? 'AM' : 'PM').toUpperCase();
224
-
225
- if (order.h !== -1) {
226
- if (this.ampm == 'AM' && treg[order.h] == '12')
227
- this.hour = 0; // 12am = 0 hour
228
- else if (this.ampm == 'PM' && treg[order.h] != '12')
229
- this.hour = (parseFloat(treg[order.h]) + 12).toFixed(0); // 12pm = 12 hour, any other pm = hour + 12
230
- else this.hour = Number(treg[order.h]);
231
- }
407
+ html += '</tr></table></div>';
408
+ }
409
+ html += '</dd>';
410
+ }
411
+
412
+ // Timezone
413
+ var showTz = o.showTimezone !== null? o.showTimezone : this.support.timezone;
414
+ html += '<dt class="ui_tpicker_timezone_label"' + (showTz ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
415
+ html += '<dd class="ui_tpicker_timezone" ' + (showTz ? '' : noDisplay) + '></dd>';
232
416
 
233
- if (order.m !== -1) this.minute = Number(treg[order.m]);
234
- if (order.s !== -1) this.second = Number(treg[order.s]);
235
- if (order.z !== -1) this.timezone = treg[order.z];
236
-
237
- return true;
417
+ // Create the elements from string
418
+ html += '</dl></div>';
419
+ var $tp = $(html);
238
420
 
239
- }
240
- return false;
241
- },
242
-
243
- //########################################################################
244
- // figure out position of time elements.. cause js cant do named captures
245
- //########################################################################
246
- _getFormatPositions: function() {
247
- var finds = this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|t{1,2}|z)/g),
248
- orders = { h: -1, m: -1, s: -1, t: -1, z: -1 };
249
-
250
- if (finds)
251
- for (var i = 0; i < finds.length; i++)
252
- if (orders[finds[i].toString().charAt(0)] == -1)
253
- orders[finds[i].toString().charAt(0)] = i + 1;
254
-
255
- return orders;
256
- },
257
-
258
- //########################################################################
259
- // generate and inject html for timepicker into ui datepicker
260
- //########################################################################
261
- _injectTimePicker: function() {
262
- var $dp = this.inst.dpDiv,
263
- o = this._defaults,
264
- tp_inst = this,
265
- // Added by Peter Medeiros:
266
- // - Figure out what the hour/minute/second max should be based on the step values.
267
- // - Example: if stepMinute is 15, then minMax is 45.
268
- hourMax = (o.hourMax - (o.hourMax % o.stepHour)).toFixed(0),
269
- minMax = (o.minuteMax - (o.minuteMax % o.stepMinute)).toFixed(0),
270
- secMax = (o.secondMax - (o.secondMax % o.stepSecond)).toFixed(0),
271
- dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
272
-
273
- // Prevent displaying twice
274
- //if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) {
275
- if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) {
276
- var noDisplay = ' style="display:none;"',
277
- html = '<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' +
278
- '<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' +
279
- ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
280
- '<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' +
281
- ((o.showTime) ? '' : noDisplay) + '></dd>' +
282
- '<dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_' + dp_id + '"' +
283
- ((o.showHour) ? '' : noDisplay) + '>' + o.hourText + '</dt>',
284
- hourGridSize = 0,
285
- minuteGridSize = 0,
286
- secondGridSize = 0,
287
- size;
288
-
289
- if (o.showHour && o.hourGrid > 0) {
290
- html += '<dd class="ui_tpicker_hour">' +
291
- '<div id="ui_tpicker_hour_' + dp_id + '"' + ((o.showHour) ? '' : noDisplay) + '></div>' +
292
- '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
293
-
294
- for (var h = o.hourMin; h <= hourMax; h += o.hourGrid) {
295
- hourGridSize++;
296
- var tmph = (o.ampm && h > 12) ? h-12 : h;
297
- if (tmph < 10) tmph = '0' + tmph;
298
- if (o.ampm) {
299
- if (h == 0) tmph = 12 +'a';
300
- else if (h < 12) tmph += 'a';
301
- else tmph += 'p';
421
+ // if we only want time picker...
422
+ if (o.timeOnly === true) {
423
+ $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
424
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
425
+ }
426
+
427
+ // add sliders, adjust grids, add events
428
+ for(i=0,l=tp_inst.units.length; i<l; i++){
429
+ litem = tp_inst.units[i];
430
+ uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
431
+ show = o['show'+uitem] !== null? o['show'+uitem] : this.support[litem];
432
+
433
+ // add the slider
434
+ tp_inst[litem+'_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_'+litem+'_slider'), litem, tp_inst[litem], o[litem+'Min'], max[litem], o['step'+uitem]);
435
+
436
+ // adjust the grid and add click event
437
+ if (show && o[litem+'Grid'] > 0) {
438
+ size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']);
439
+ $tp.find('.ui_tpicker_'+litem+' table').css({
440
+ width: size + "%",
441
+ marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"),
442
+ marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0',
443
+ borderCollapse: 'collapse'
444
+ }).find("td").click(function(e){
445
+ var $t = $(this),
446
+ h = $t.html(),
447
+ n = parseInt(h.replace(/[^0-9]/g),10),
448
+ ap = h.replace(/[^apm]/ig),
449
+ f = $t.data('for'); // loses scope, so we use data-for
450
+
451
+ if(f == 'hour'){
452
+ if(ap.indexOf('p') !== -1 && n < 12){
453
+ n += 12;
454
+ }
455
+ else{
456
+ if(ap.indexOf('a') !== -1 && n === 12){
457
+ n = 0;
458
+ }
459
+ }
460
+ }
461
+
462
+ tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n);
463
+
464
+ tp_inst._onTimeChange();
465
+ tp_inst._onSelectHandler();
466
+ }).css({
467
+ cursor: 'pointer',
468
+ width: (100 / gridSize[litem]) + '%',
469
+ textAlign: 'center',
470
+ overflow: 'hidden'
471
+ });
472
+ } // end if grid > 0
473
+ } // end for loop
474
+
475
+ // Add timezone options
476
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
477
+ $.fn.append.apply(this.timezone_select,
478
+ $.map(o.timezoneList, function(val, idx) {
479
+ return $("<option />").val(typeof val == "object" ? val.value : val).text(typeof val == "object" ? val.label : val);
480
+ }));
481
+ if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
482
+ var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset()*-1;
483
+ if (local_timezone == this.timezone) {
484
+ selectLocalTimezone(tp_inst);
485
+ } else {
486
+ this.timezone_select.val(this.timezone);
487
+ }
488
+ } else {
489
+ if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
490
+ this.timezone_select.val(o.timezone);
491
+ } else {
492
+ selectLocalTimezone(tp_inst);
302
493
  }
303
- html += '<td>' + tmph + '</td>';
494
+ }
495
+ this.timezone_select.change(function() {
496
+ tp_inst._onTimeChange();
497
+ tp_inst._onSelectHandler();
498
+ });
499
+ // End timezone options
500
+
501
+ // inject timepicker into datepicker
502
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
503
+ if ($buttonPanel.length) {
504
+ $buttonPanel.before($tp);
505
+ } else {
506
+ $dp.append($tp);
304
507
  }
305
508
 
306
- html += '</tr></table></div>' +
307
- '</dd>';
308
- } else html += '<dd class="ui_tpicker_hour" id="ui_tpicker_hour_' + dp_id + '"' +
309
- ((o.showHour) ? '' : noDisplay) + '></dd>';
509
+ this.$timeObj = $tp.find('.ui_tpicker_time');
310
510
 
311
- html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
312
- ((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>';
511
+ if (this.inst !== null) {
512
+ var timeDefined = this.timeDefined;
513
+ this._onTimeChange();
514
+ this.timeDefined = timeDefined;
515
+ }
313
516
 
314
- if (o.showMinute && o.minuteGrid > 0) {
315
- html += '<dd class="ui_tpicker_minute ui_tpicker_minute_' + o.minuteGrid + '">' +
316
- '<div id="ui_tpicker_minute_' + dp_id + '"' +
317
- ((o.showMinute) ? '' : noDisplay) + '></div>' +
318
- '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
517
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
518
+ if (this._defaults.addSliderAccess) {
519
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
520
+ rtl = this._defaults.isRTL;
521
+ sliderAccessArgs.isRTL = rtl;
522
+
523
+ setTimeout(function() { // fix for inline mode
524
+ if ($tp.find('.ui-slider-access').length === 0) {
525
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
526
+
527
+ // fix any grids since sliders are shorter
528
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
529
+ if (sliderAccessWidth) {
530
+ $tp.find('table:visible').each(function() {
531
+ var $g = $(this),
532
+ oldWidth = $g.outerWidth(),
533
+ oldMarginLeft = $g.css(rtl? 'marginRight':'marginLeft').toString().replace('%', ''),
534
+ newWidth = oldWidth - sliderAccessWidth,
535
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
536
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
537
+ css[rtl? 'marginRight':'marginLeft'] = newMarginLeft;
538
+ $g.css(css);
539
+ });
540
+ }
541
+ }
542
+ }, 10);
543
+ }
544
+ // end slideAccess integration
319
545
 
320
- for (var m = o.minuteMin; m <= minMax; m += o.minuteGrid) {
321
- minuteGridSize++;
322
- html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
546
+ }
547
+ },
548
+
549
+ /*
550
+ * This function tries to limit the ability to go outside the
551
+ * min/max date range
552
+ */
553
+ _limitMinMaxDateTime: function(dp_inst, adjustSliders) {
554
+ var o = this._defaults,
555
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
556
+
557
+ if (!this._defaults.showTimepicker) {
558
+ return;
559
+ } // No time so nothing to check here
560
+
561
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
562
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
563
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
564
+
565
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
566
+ this.hourMinOriginal = o.hourMin;
567
+ this.minuteMinOriginal = o.minuteMin;
568
+ this.secondMinOriginal = o.secondMin;
569
+ this.millisecMinOriginal = o.millisecMin;
570
+ this.microsecMinOriginal = o.microsecMin;
323
571
  }
324
572
 
325
- html += '</tr></table></div>' +
326
- '</dd>';
327
- } else html += '<dd class="ui_tpicker_minute" id="ui_tpicker_minute_' + dp_id + '"' +
328
- ((o.showMinute) ? '' : noDisplay) + '></dd>';
573
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
574
+ this._defaults.hourMin = minDateTime.getHours();
575
+ if (this.hour <= this._defaults.hourMin) {
576
+ this.hour = this._defaults.hourMin;
577
+ this._defaults.minuteMin = minDateTime.getMinutes();
578
+ if (this.minute <= this._defaults.minuteMin) {
579
+ this.minute = this._defaults.minuteMin;
580
+ this._defaults.secondMin = minDateTime.getSeconds();
581
+ if (this.second <= this._defaults.secondMin) {
582
+ this.second = this._defaults.secondMin;
583
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
584
+ if(this.millisec <= this._defaults.millisecMin) {
585
+ this.millisec = this._defaults.millisecMin;
586
+ this._defaults.microsecMin = minDateTime.getMicroseconds();
587
+ } else {
588
+ if (this.microsec < this._defaults.microsecMin) {
589
+ this.microsec = this._defaults.microsecMin;
590
+ }
591
+ this._defaults.microsecMin = this.microsecMinOriginal;
592
+ }
593
+ } else {
594
+ this._defaults.millisecMin = this.millisecMinOriginal;
595
+ this._defaults.microsecMin = this.microsecMinOriginal;
596
+ }
597
+ } else {
598
+ this._defaults.secondMin = this.secondMinOriginal;
599
+ this._defaults.millisecMin = this.millisecMinOriginal;
600
+ this._defaults.microsecMin = this.microsecMinOriginal;
601
+ }
602
+ } else {
603
+ this._defaults.minuteMin = this.minuteMinOriginal;
604
+ this._defaults.secondMin = this.secondMinOriginal;
605
+ this._defaults.millisecMin = this.millisecMinOriginal;
606
+ this._defaults.microsecMin = this.microsecMinOriginal;
607
+ }
608
+ } else {
609
+ this._defaults.hourMin = this.hourMinOriginal;
610
+ this._defaults.minuteMin = this.minuteMinOriginal;
611
+ this._defaults.secondMin = this.secondMinOriginal;
612
+ this._defaults.millisecMin = this.millisecMinOriginal;
613
+ this._defaults.microsecMin = this.microsecMinOriginal;
614
+ }
615
+ }
329
616
 
330
- html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
331
- ((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>';
617
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
618
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
619
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
332
620
 
333
- if (o.showSecond && o.secondGrid > 0) {
334
- html += '<dd class="ui_tpicker_second ui_tpicker_second_' + o.secondGrid + '">' +
335
- '<div id="ui_tpicker_second_' + dp_id + '"' +
336
- ((o.showSecond) ? '' : noDisplay) + '></div>' +
337
- '<div style="padding-left: 1px"><table><tr>';
621
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
622
+ this.hourMaxOriginal = o.hourMax;
623
+ this.minuteMaxOriginal = o.minuteMax;
624
+ this.secondMaxOriginal = o.secondMax;
625
+ this.millisecMaxOriginal = o.millisecMax;
626
+ this.microsecMaxOriginal = o.microsecMax;
627
+ }
338
628
 
339
- for (var s = o.secondMin; s <= secMax; s += o.secondGrid) {
340
- secondGridSize++;
341
- html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
629
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()) {
630
+ this._defaults.hourMax = maxDateTime.getHours();
631
+ if (this.hour >= this._defaults.hourMax) {
632
+ this.hour = this._defaults.hourMax;
633
+ this._defaults.minuteMax = maxDateTime.getMinutes();
634
+ if (this.minute >= this._defaults.minuteMax) {
635
+ this.minute = this._defaults.minuteMax;
636
+ this._defaults.secondMax = maxDateTime.getSeconds();
637
+ if (this.second >= this._defaults.secondMax) {
638
+ this.second = this._defaults.secondMax;
639
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
640
+ if (this.millisec >= this._defaults.millisecMax) {
641
+ this.millisec = this._defaults.millisecMax;
642
+ this._defaults.microsecMax = maxDateTime.getMicroseconds();
643
+ } else {
644
+ if (this.microsec > this._defaults.microsecMax) {
645
+ this.microsec = this._defaults.microsecMax;
646
+ }
647
+ this._defaults.microsecMax = this.microsecMaxOriginal;
648
+ }
649
+ } else {
650
+ this._defaults.millisecMax = this.millisecMaxOriginal;
651
+ this._defaults.microsecMax = this.microsecMaxOriginal;
652
+ }
653
+ } else {
654
+ this._defaults.secondMax = this.secondMaxOriginal;
655
+ this._defaults.millisecMax = this.millisecMaxOriginal;
656
+ this._defaults.microsecMax = this.microsecMaxOriginal;
657
+ }
658
+ } else {
659
+ this._defaults.minuteMax = this.minuteMaxOriginal;
660
+ this._defaults.secondMax = this.secondMaxOriginal;
661
+ this._defaults.millisecMax = this.millisecMaxOriginal;
662
+ this._defaults.microsecMax = this.microsecMaxOriginal;
663
+ }
664
+ } else {
665
+ this._defaults.hourMax = this.hourMaxOriginal;
666
+ this._defaults.minuteMax = this.minuteMaxOriginal;
667
+ this._defaults.secondMax = this.secondMaxOriginal;
668
+ this._defaults.millisecMax = this.millisecMaxOriginal;
669
+ this._defaults.microsecMax = this.microsecMaxOriginal;
342
670
  }
671
+ }
343
672
 
344
- html += '</tr></table></div>' +
345
- '</dd>';
346
- } else html += '<dd class="ui_tpicker_second" id="ui_tpicker_second_' + dp_id + '"' +
347
- ((o.showSecond) ? '' : noDisplay) + '></dd>';
348
-
349
- html += '<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_' + dp_id + '"' +
350
- ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
351
- html += '<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_' + dp_id + '"' +
352
- ((o.showTimezone) ? '' : noDisplay) + '></dd>';
673
+ if (adjustSliders !== undefined && adjustSliders === true) {
674
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
675
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
676
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
677
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10);
678
+ microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
353
679
 
354
- html += '</dl></div>';
355
- $tp = $(html);
680
+ if (this.hour_slider) {
681
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
682
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
683
+ }
684
+ if (this.minute_slider) {
685
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
686
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
687
+ }
688
+ if (this.second_slider) {
689
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
690
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
691
+ }
692
+ if (this.millisec_slider) {
693
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
694
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
695
+ }
696
+ if (this.microsec_slider) {
697
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax });
698
+ this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
699
+ }
700
+ }
356
701
 
357
- // if we only want time picker...
358
- if (o.timeOnly === true) {
359
- $tp.prepend(
360
- '<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' +
361
- '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' +
362
- '</div>');
363
- $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
702
+ },
703
+
704
+ /*
705
+ * when a slider moves, set the internal time...
706
+ * on time change is also called when the time is updated in the text field
707
+ */
708
+ _onTimeChange: function() {
709
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
710
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
711
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
712
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
713
+ microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
714
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
715
+ o = this._defaults,
716
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
717
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
718
+
719
+ if (typeof(hour) == 'object') {
720
+ hour = false;
721
+ }
722
+ if (typeof(minute) == 'object') {
723
+ minute = false;
724
+ }
725
+ if (typeof(second) == 'object') {
726
+ second = false;
727
+ }
728
+ if (typeof(millisec) == 'object') {
729
+ millisec = false;
730
+ }
731
+ if (typeof(microsec) == 'object') {
732
+ microsec = false;
733
+ }
734
+ if (typeof(timezone) == 'object') {
735
+ timezone = false;
364
736
  }
365
737
 
366
- this.hour_slider = $tp.find('#ui_tpicker_hour_'+ dp_id).slider({
367
- orientation: "horizontal",
368
- value: this.hour,
369
- min: o.hourMin,
370
- max: hourMax,
371
- step: o.stepHour,
372
- slide: function(event, ui) {
373
- tp_inst.hour_slider.slider( "option", "value", ui.value);
374
- tp_inst._onTimeChange();
738
+ if (hour !== false) {
739
+ hour = parseInt(hour, 10);
740
+ }
741
+ if (minute !== false) {
742
+ minute = parseInt(minute, 10);
743
+ }
744
+ if (second !== false) {
745
+ second = parseInt(second, 10);
746
+ }
747
+ if (millisec !== false) {
748
+ millisec = parseInt(millisec, 10);
749
+ }
750
+ if (microsec !== false) {
751
+ microsec = parseInt(microsec, 10);
752
+ }
753
+
754
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
755
+
756
+ // If the update was done in the input field, the input field should not be updated.
757
+ // If the update was done using the sliders, update the input field.
758
+ var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec || microsec != this.microsec
759
+ || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
760
+ || (this.timezone !== null && timezone != this.timezone));
761
+
762
+ if (hasChanged) {
763
+
764
+ if (hour !== false) {
765
+ this.hour = hour;
766
+ }
767
+ if (minute !== false) {
768
+ this.minute = minute;
769
+ }
770
+ if (second !== false) {
771
+ this.second = second;
772
+ }
773
+ if (millisec !== false) {
774
+ this.millisec = millisec;
775
+ }
776
+ if (microsec !== false) {
777
+ this.microsec = microsec;
778
+ }
779
+ if (timezone !== false) {
780
+ this.timezone = timezone;
375
781
  }
376
- });
377
782
 
378
- // Updated by Peter Medeiros:
379
- // - Pass in Event and UI instance into slide function
380
- this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({
381
- orientation: "horizontal",
382
- value: this.minute,
383
- min: o.minuteMin,
384
- max: minMax,
385
- step: o.stepMinute,
386
- slide: function(event, ui) {
387
- // update the global minute slider instance value with the current slider value
388
- tp_inst.minute_slider.slider( "option", "value", ui.value);
389
- tp_inst._onTimeChange();
783
+ if (!this.inst) {
784
+ this.inst = $.datepicker._getInst(this.$input[0]);
390
785
  }
391
- });
392
786
 
393
- this.second_slider = $tp.find('#ui_tpicker_second_'+ dp_id).slider({
394
- orientation: "horizontal",
395
- value: this.second,
396
- min: o.secondMin,
397
- max: secMax,
398
- step: o.stepSecond,
399
- slide: function(event, ui) {
400
- tp_inst.second_slider.slider( "option", "value", ui.value);
401
- tp_inst._onTimeChange();
787
+ this._limitMinMaxDateTime(this.inst, true);
788
+ }
789
+ if (this.support.ampm) {
790
+ this.ampm = ampm;
791
+ }
792
+
793
+ // Updates the time within the timepicker
794
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
795
+ if (this.$timeObj) {
796
+ if(pickerTimeFormat === o.timeFormat){
797
+ this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
402
798
  }
403
- });
404
-
799
+ else{
800
+ this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
801
+ }
802
+ }
803
+
804
+ this.timeDefined = true;
805
+ if (hasChanged) {
806
+ this._updateDateTime();
807
+ }
808
+ },
809
+
810
+ /*
811
+ * call custom onSelect.
812
+ * bind to sliders slidestop, and grid click.
813
+ */
814
+ _onSelectHandler: function() {
815
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
816
+ var inputEl = this.$input ? this.$input[0] : null;
817
+ if (onSelect && inputEl) {
818
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
819
+ }
820
+ },
821
+
822
+ /*
823
+ * update our input with the new date time..
824
+ */
825
+ _updateDateTime: function(dp_inst) {
826
+ dp_inst = this.inst || dp_inst;
827
+ var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
828
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
829
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
830
+ timeAvailable = dt !== null && this.timeDefined;
831
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
832
+ var formattedDateTime = this.formattedDate;
405
833
 
406
- this.timezone_select = $tp.find('#ui_tpicker_timezone_'+ dp_id).append('<select></select>').find("select");
407
- $.fn.append.apply(this.timezone_select,
408
- $.map(o.timezoneList, function(val, idx) {
409
- return $("<option />")
410
- .val(typeof val == "object" ? val.value : val)
411
- .text(typeof val == "object" ? val.label : val);
412
- })
413
- );
414
- this.timezone_select.val((typeof this.timezone != "undefined" && this.timezone != null && this.timezone != "") ? this.timezone : o.timezone);
415
- this.timezone_select.change(function() {
416
- tp_inst._onTimeChange();
417
- });
834
+ // if a slider was changed but datepicker doesn't have a value yet, set it
835
+ if(dp_inst.lastVal===""){
836
+ dp_inst.currentYear=dp_inst.selectedYear;
837
+ dp_inst.currentMonth=dp_inst.selectedMonth;
838
+ dp_inst.currentDay=dp_inst.selectedDay;
839
+ }
840
+
841
+ /*
842
+ * remove following lines to force every changes in date picker to change the input value
843
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
844
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
845
+ */
846
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
847
+ // return;
848
+ //}
849
+
850
+ if (this._defaults.timeOnly === true) {
851
+ formattedDateTime = this.formattedTime;
852
+ } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
853
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
854
+ }
855
+
856
+ this.formattedDateTime = formattedDateTime;
857
+
858
+ if (!this._defaults.showTimepicker) {
859
+ this.$input.val(this.formattedDate);
860
+ } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
861
+ this.$altInput.val(this.formattedTime);
862
+ this.$input.val(this.formattedDate);
863
+ } else if (this.$altInput) {
864
+ this.$input.val(formattedDateTime);
865
+ var altFormattedDateTime = '',
866
+ altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
867
+ altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
868
+
869
+ if(!this._defaults.timeOnly){
870
+ if (this._defaults.altFormat){
871
+ altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
872
+ }
873
+ else{
874
+ altFormattedDateTime = this.formattedDate;
875
+ }
876
+
877
+ if (altFormattedDateTime){
878
+ altFormattedDateTime += altSeparator;
879
+ }
880
+ }
881
+
882
+ if(this._defaults.altTimeFormat){
883
+ altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
884
+ }
885
+ else{
886
+ altFormattedDateTime += this.formattedTime + altTimeSuffix;
887
+ }
888
+ this.$altInput.val(altFormattedDateTime);
889
+ } else {
890
+ this.$input.val(formattedDateTime);
891
+ }
418
892
 
419
- // Add grid functionality
420
- if (o.showHour && o.hourGrid > 0) {
421
- size = 100 * hourGridSize * o.hourGrid / (hourMax - o.hourMin);
422
-
423
- $tp.find(".ui_tpicker_hour table").css({
424
- width: size + "%",
425
- marginLeft: (size / (-2 * hourGridSize)) + "%",
426
- borderCollapse: 'collapse'
427
- }).find("td").each( function(index) {
428
- $(this).click(function() {
429
- var h = $(this).html();
430
- if(o.ampm) {
431
- var ap = h.substring(2).toLowerCase(),
432
- aph = parseInt(h.substring(0,2), 10);
433
- if (ap == 'a') {
434
- if (aph == 12) h = 0;
435
- else h = aph;
436
- } else if (aph == 12) h = 12;
437
- else h = aph + 12;
893
+ this.$input.trigger("change");
894
+ },
895
+
896
+ _onFocus: function() {
897
+ if (!this.$input.val() && this._defaults.defaultValue) {
898
+ this.$input.val(this._defaults.defaultValue);
899
+ var inst = $.datepicker._getInst(this.$input.get(0)),
900
+ tp_inst = $.datepicker._get(inst, 'timepicker');
901
+ if (tp_inst) {
902
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
903
+ try {
904
+ $.datepicker._updateDatepicker(inst);
905
+ } catch (err) {
906
+ $.timepicker.log(err);
438
907
  }
439
- tp_inst.hour_slider.slider("option", "value", h);
440
- tp_inst._onTimeChange();
441
- tp_inst._onSelectHandler();
442
- }).css({
443
- cursor: 'pointer',
444
- width: (100 / hourGridSize) + '%',
445
- textAlign: 'center',
446
- overflow: 'hidden'
447
- });
448
- });
908
+ }
909
+ }
449
910
  }
911
+ },
912
+
913
+ /*
914
+ * Small abstraction to control types
915
+ * We can add more, just be sure to follow the pattern: create, options, value
916
+ */
917
+ _controls: {
918
+ // slider methods
919
+ slider: {
920
+ create: function(tp_inst, obj, unit, val, min, max, step){
921
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
922
+ return obj.prop('slide', null).slider({
923
+ orientation: "horizontal",
924
+ value: rtl? val*-1 : val,
925
+ min: rtl? max*-1 : min,
926
+ max: rtl? min*-1 : max,
927
+ step: step,
928
+ slide: function(event, ui) {
929
+ tp_inst.control.value(tp_inst, $(this), unit, rtl? ui.value*-1:ui.value);
930
+ tp_inst._onTimeChange();
931
+ },
932
+ stop: function(event, ui) {
933
+ tp_inst._onSelectHandler();
934
+ }
935
+ });
936
+ },
937
+ options: function(tp_inst, obj, unit, opts, val){
938
+ if(tp_inst._defaults.isRTL){
939
+ if(typeof(opts) == 'string'){
940
+ if(opts == 'min' || opts == 'max'){
941
+ if(val !== undefined){
942
+ return obj.slider(opts, val*-1);
943
+ }
944
+ return Math.abs(obj.slider(opts));
945
+ }
946
+ return obj.slider(opts);
947
+ }
948
+ var min = opts.min,
949
+ max = opts.max;
950
+ opts.min = opts.max = null;
951
+ if(min !== undefined){
952
+ opts.max = min * -1;
953
+ }
954
+ if(max !== undefined){
955
+ opts.min = max * -1;
956
+ }
957
+ return obj.slider(opts);
958
+ }
959
+ if(typeof(opts) == 'string' && val !== undefined){
960
+ return obj.slider(opts, val);
961
+ }
962
+ return obj.slider(opts);
963
+ },
964
+ value: function(tp_inst, obj, unit, val){
965
+ if(tp_inst._defaults.isRTL){
966
+ if(val !== undefined){
967
+ return obj.slider('value', val*-1);
968
+ }
969
+ return Math.abs(obj.slider('value'));
970
+ }
971
+ if(val !== undefined){
972
+ return obj.slider('value', val);
973
+ }
974
+ return obj.slider('value');
975
+ }
976
+ },
977
+ // select methods
978
+ select: {
979
+ create: function(tp_inst, obj, unit, val, min, max, step){
980
+ var sel = '<select class="ui-timepicker-select" data-unit="'+ unit +'" data-min="'+ min +'" data-max="'+ max +'" data-step="'+ step +'">',
981
+ format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
982
+
983
+ for(var i=min; i<=max; i+=step){
984
+ sel += '<option value="'+ i +'"'+ (i==val? ' selected':'') +'>';
985
+ if(unit == 'hour'){
986
+ sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig,'')), {hour:i}, tp_inst._defaults);
987
+ }
988
+ else if(unit == 'millisec' || unit == 'microsec' || i >= 10){ sel += i; }
989
+ else {sel += '0'+ i.toString(); }
990
+ sel += '</option>';
991
+ }
992
+ sel += '</select>';
450
993
 
451
- if (o.showMinute && o.minuteGrid > 0) {
452
- size = 100 * minuteGridSize * o.minuteGrid / (minMax - o.minuteMin);
453
- $tp.find(".ui_tpicker_minute table").css({
454
- width: size + "%",
455
- marginLeft: (size / (-2 * minuteGridSize)) + "%",
456
- borderCollapse: 'collapse'
457
- }).find("td").each(function(index) {
458
- $(this).click(function() {
459
- tp_inst.minute_slider.slider("option", "value", $(this).html());
994
+ obj.children('select').remove();
995
+
996
+ $(sel).appendTo(obj).change(function(e){
460
997
  tp_inst._onTimeChange();
461
998
  tp_inst._onSelectHandler();
462
- }).css({
463
- cursor: 'pointer',
464
- width: (100 / minuteGridSize) + '%',
465
- textAlign: 'center',
466
- overflow: 'hidden'
467
999
  });
1000
+
1001
+ return obj;
1002
+ },
1003
+ options: function(tp_inst, obj, unit, opts, val){
1004
+ var o = {},
1005
+ $t = obj.children('select');
1006
+ if(typeof(opts) == 'string'){
1007
+ if(val === undefined){
1008
+ return $t.data(opts);
1009
+ }
1010
+ o[opts] = val;
1011
+ }
1012
+ else{ o = opts; }
1013
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
1014
+ },
1015
+ value: function(tp_inst, obj, unit, val){
1016
+ var $t = obj.children('select');
1017
+ if(val !== undefined){
1018
+ return $t.val(val);
1019
+ }
1020
+ return $t.val();
1021
+ }
1022
+ }
1023
+ } // end _controls
1024
+
1025
+ });
1026
+
1027
+ $.fn.extend({
1028
+ /*
1029
+ * shorthand just to use timepicker..
1030
+ */
1031
+ timepicker: function(o) {
1032
+ o = o || {};
1033
+ var tmp_args = Array.prototype.slice.call(arguments);
1034
+
1035
+ if (typeof o == 'object') {
1036
+ tmp_args[0] = $.extend(o, {
1037
+ timeOnly: true
468
1038
  });
469
1039
  }
470
1040
 
471
- if (o.showSecond && o.secondGrid > 0) {
472
- $tp.find(".ui_tpicker_second table").css({
473
- width: size + "%",
474
- marginLeft: (size / (-2 * secondGridSize)) + "%",
475
- borderCollapse: 'collapse'
476
- }).find("td").each(function(index) {
477
- $(this).click(function() {
478
- tp_inst.second_slider.slider("option", "value", $(this).html());
479
- tp_inst._onTimeChange();
480
- tp_inst._onSelectHandler();
481
- }).css({
482
- cursor: 'pointer',
483
- width: (100 / secondGridSize) + '%',
484
- textAlign: 'center',
485
- overflow: 'hidden'
1041
+ return $(this).each(function() {
1042
+ $.fn.datetimepicker.apply($(this), tmp_args);
1043
+ });
1044
+ },
1045
+
1046
+ /*
1047
+ * extend timepicker to datepicker
1048
+ */
1049
+ datetimepicker: function(o) {
1050
+ o = o || {};
1051
+ var tmp_args = arguments;
1052
+
1053
+ if (typeof(o) == 'string') {
1054
+ if (o == 'getDate') {
1055
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
1056
+ } else {
1057
+ return this.each(function() {
1058
+ var $t = $(this);
1059
+ $t.datepicker.apply($t, tmp_args);
486
1060
  });
1061
+ }
1062
+ } else {
1063
+ return this.each(function() {
1064
+ var $t = $(this);
1065
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
487
1066
  });
488
1067
  }
1068
+ }
1069
+ });
1070
+
1071
+ /*
1072
+ * Public Utility to parse date and time
1073
+ */
1074
+ $.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1075
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
1076
+ if (parseRes.timeObj) {
1077
+ var t = parseRes.timeObj;
1078
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1079
+ parseRex.date.setMicroseconds(t.microsec);
1080
+ }
489
1081
 
490
- var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
491
- if ($buttonPanel.length) $buttonPanel.before($tp);
492
- else $dp.append($tp);
1082
+ return parseRes.date;
1083
+ };
493
1084
 
494
- this.$timeObj = $tp.find('#ui_tpicker_time_'+ dp_id);
1085
+ /*
1086
+ * Public utility to parse time
1087
+ */
1088
+ $.datepicker.parseTime = function(timeFormat, timeString, options) {
1089
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
1090
+ iso8601 = (timeFormat.replace(/\'.*?\'/g,'').indexOf('Z') !== -1);
1091
+
1092
+ // Strict parse requires the timeString to match the timeFormat exactly
1093
+ var strictParse = function(f, s, o){
1094
+
1095
+ // pattern for standard and localized AM/PM markers
1096
+ var getPatternAmpm = function(amNames, pmNames) {
1097
+ var markers = [];
1098
+ if (amNames) {
1099
+ $.merge(markers, amNames);
1100
+ }
1101
+ if (pmNames) {
1102
+ $.merge(markers, pmNames);
1103
+ }
1104
+ markers = $.map(markers, function(val) {
1105
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1106
+ });
1107
+ return '(' + markers.join('|') + ')?';
1108
+ };
495
1109
 
496
- if (this.inst !== null) {
497
- var timeDefined = this.timeDefined;
498
- this._onTimeChange();
499
- this.timeDefined = timeDefined;
500
- }
1110
+ // figure out position of time elements.. cause js cant do named captures
1111
+ var getFormatPositions = function(timeFormat) {
1112
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
1113
+ orders = {
1114
+ h: -1,
1115
+ m: -1,
1116
+ s: -1,
1117
+ l: -1,
1118
+ c: -1,
1119
+ t: -1,
1120
+ z: -1
1121
+ };
1122
+
1123
+ if (finds) {
1124
+ for (var i = 0; i < finds.length; i++) {
1125
+ if (orders[finds[i].toString().charAt(0)] == -1) {
1126
+ orders[finds[i].toString().charAt(0)] = i + 1;
1127
+ }
1128
+ }
1129
+ }
1130
+ return orders;
1131
+ };
501
1132
 
502
- //Emulate datepicker onSelect behavior. Call on slidestop.
503
- var onSelectDelegate = function() {
504
- tp_inst._onSelectHandler();
1133
+ var regstr = '^' + f.toString()
1134
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1135
+ var ml = match.length;
1136
+ switch (match.charAt(0).toLowerCase()) {
1137
+ case 'h': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1138
+ case 'm': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1139
+ case 's': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1140
+ case 'l': return '(\\d?\\d?\\d)';
1141
+ case 'c': return '(\\d?\\d?\\d)';
1142
+ case 'z': return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1143
+ case 't': return getPatternAmpm(o.amNames, o.pmNames);
1144
+ default: // literal escaped in quotes
1145
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1146
+ }
1147
+ })
1148
+ .replace(/\s/g, '\\s?') +
1149
+ o.timeSuffix + '$',
1150
+ order = getFormatPositions(f),
1151
+ ampm = '',
1152
+ treg;
1153
+
1154
+ treg = s.match(new RegExp(regstr, 'i'));
1155
+
1156
+ var resTime = {
1157
+ hour: 0,
1158
+ minute: 0,
1159
+ second: 0,
1160
+ millisec: 0,
1161
+ microsec: 0
505
1162
  };
506
- this.hour_slider.bind('slidestop',onSelectDelegate);
507
- this.minute_slider.bind('slidestop',onSelectDelegate);
508
- this.second_slider.bind('slidestop',onSelectDelegate);
509
- }
510
- },
511
-
512
- //########################################################################
513
- // This function tries to limit the ability to go outside the
514
- // min/max date range
515
- //########################################################################
516
- _limitMinMaxDateTime: function(dp_inst, adjustSliders){
517
- var o = this._defaults,
518
- dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
519
-
520
- if(!this._defaults.showTimepicker) return; // No time so nothing to check here
521
-
522
- if($.datepicker._get(dp_inst, 'minDateTime') !== null && dp_date){
523
- var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
524
- minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
525
-
526
- if(this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null){
527
- this.hourMinOriginal = o.hourMin;
528
- this.minuteMinOriginal = o.minuteMin;
529
- this.secondMinOriginal = o.secondMin;
530
- }
531
1163
 
532
- if(dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
533
- this._defaults.hourMin = minDateTime.getHours();
534
- if (this.hour <= this._defaults.hourMin) {
535
- this.hour = this._defaults.hourMin;
536
- this._defaults.minuteMin = minDateTime.getMinutes();
537
- if (this.minute <= this._defaults.minuteMin) {
538
- this.minute = this._defaults.minuteMin;
539
- this._defaults.secondMin = minDateTime.getSeconds();
1164
+ if (treg) {
1165
+ if (order.t !== -1) {
1166
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
1167
+ ampm = '';
1168
+ resTime.ampm = '';
540
1169
  } else {
541
- if(this.second < this._defaults.secondMin) this.second = this._defaults.secondMin;
542
- this._defaults.secondMin = this.secondMinOriginal;
1170
+ ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';
1171
+ resTime.ampm = o[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
543
1172
  }
544
- } else {
545
- this._defaults.minuteMin = this.minuteMinOriginal;
546
- this._defaults.secondMin = this.secondMinOriginal;
547
1173
  }
548
- }else{
549
- this._defaults.hourMin = this.hourMinOriginal;
550
- this._defaults.minuteMin = this.minuteMinOriginal;
551
- this._defaults.secondMin = this.secondMinOriginal;
1174
+
1175
+ if (order.h !== -1) {
1176
+ if (ampm == 'AM' && treg[order.h] == '12') {
1177
+ resTime.hour = 0; // 12am = 0 hour
1178
+ } else {
1179
+ if (ampm == 'PM' && treg[order.h] != '12') {
1180
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1181
+ } else {
1182
+ resTime.hour = Number(treg[order.h]);
1183
+ }
1184
+ }
1185
+ }
1186
+
1187
+ if (order.m !== -1) {
1188
+ resTime.minute = Number(treg[order.m]);
1189
+ }
1190
+ if (order.s !== -1) {
1191
+ resTime.second = Number(treg[order.s]);
1192
+ }
1193
+ if (order.l !== -1) {
1194
+ resTime.millisec = Number(treg[order.l]);
1195
+ }
1196
+ if (order.c !== -1) {
1197
+ resTime.microsec = Number(treg[order.c]);
1198
+ }
1199
+ if (order.z !== -1 && treg[order.z] !== undefined) {
1200
+ resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
1201
+ }
1202
+
1203
+
1204
+ return resTime;
1205
+ }
1206
+ return false;
1207
+ };// end strictParse
1208
+
1209
+ // First try JS Date, if that fails, use strictParse
1210
+ var looseParse = function(f,s,o){
1211
+ try{
1212
+ var d = new Date('2012-01-01 '+ s);
1213
+ if(isNaN(d.getTime())){
1214
+ d = new Date('2012-01-01T'+ s);
1215
+ if(isNaN(d.getTime())){
1216
+ d = new Date('01/01/2012 '+ s);
1217
+ if(isNaN(d.getTime())){
1218
+ throw "Unable to parse time with native Date: "+ s;
1219
+ }
1220
+ }
1221
+ }
1222
+
1223
+ return {
1224
+ hour: d.getHours(),
1225
+ minute: d.getMinutes(),
1226
+ second: d.getSeconds(),
1227
+ millisec: d.getMilliseconds(),
1228
+ microsec: d.getMicroseconds(),
1229
+ timezone: d.getTimezoneOffset()*-1
1230
+ };
1231
+ }
1232
+ catch(err){
1233
+ try{
1234
+ return strictParse(f,s,o);
1235
+ }
1236
+ catch(err2){
1237
+ $.timepicker.log("Unable to parse \ntimeString: "+ s +"\ntimeFormat: "+ f);
1238
+ }
552
1239
  }
1240
+ return false;
1241
+ }; // end looseParse
1242
+
1243
+ if(typeof o.parse === "function"){
1244
+ return o.parse(timeFormat, timeString, o);
553
1245
  }
1246
+ if(o.parse === 'loose'){
1247
+ return looseParse(timeFormat, timeString, o);
1248
+ }
1249
+ return strictParse(timeFormat, timeString, o);
1250
+ };
554
1251
 
555
- if($.datepicker._get(dp_inst, 'maxDateTime') !== null && dp_date){
556
- var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
557
- maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
558
-
559
- if(this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null){
560
- this.hourMaxOriginal = o.hourMax;
561
- this.minuteMaxOriginal = o.minuteMax;
562
- this.secondMaxOriginal = o.secondMax;
1252
+ /*
1253
+ * Public utility to format the time
1254
+ * format = string format of the time
1255
+ * time = a {}, not a Date() for timezones
1256
+ * options = essentially the regional[].. amNames, pmNames, ampm
1257
+ */
1258
+ $.datepicker.formatTime = function(format, time, options) {
1259
+ options = options || {};
1260
+ options = $.extend({}, $.timepicker._defaults, options);
1261
+ time = $.extend({
1262
+ hour: 0,
1263
+ minute: 0,
1264
+ second: 0,
1265
+ millisec: 0,
1266
+ timezone: 0
1267
+ }, time);
1268
+
1269
+ var tmptime = format,
1270
+ ampmName = options.amNames[0],
1271
+ hour = parseInt(time.hour, 10);
1272
+
1273
+ if (hour > 11) {
1274
+ ampmName = options.pmNames[0];
1275
+ }
1276
+
1277
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|('.*?'|".*?"))/g, function(match) {
1278
+ switch (match) {
1279
+ case 'HH':
1280
+ return ('0' + hour).slice(-2);
1281
+ case 'H':
1282
+ return hour;
1283
+ case 'hh':
1284
+ return ('0' + convert24to12(hour)).slice(-2);
1285
+ case 'h':
1286
+ return convert24to12(hour);
1287
+ case 'mm':
1288
+ return ('0' + time.minute).slice(-2);
1289
+ case 'm':
1290
+ return time.minute;
1291
+ case 'ss':
1292
+ return ('0' + time.second).slice(-2);
1293
+ case 's':
1294
+ return time.second;
1295
+ case 'l':
1296
+ return ('00' + time.millisec).slice(-3);
1297
+ case 'c':
1298
+ return ('00' + time.microsec).slice(-3);
1299
+ case 'z':
1300
+ return $.timepicker.timezoneOffsetString(time.timezone === null? options.timezone : time.timezone, false);
1301
+ case 'Z':
1302
+ return $.timepicker.timezoneOffsetString(time.timezone === null? options.timezone : time.timezone, true);
1303
+ case 'T':
1304
+ return ampmName.charAt(0).toUpperCase();
1305
+ case 'TT':
1306
+ return ampmName.toUpperCase();
1307
+ case 't':
1308
+ return ampmName.charAt(0).toLowerCase();
1309
+ case 'tt':
1310
+ return ampmName.toLowerCase();
1311
+ default:
1312
+ return match.replace(/\'/g, "") || "'";
563
1313
  }
1314
+ });
564
1315
 
565
- if(dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()){
566
- this._defaults.hourMax = maxDateTime.getHours();
567
- if (this.hour >= this._defaults.hourMax) {
568
- this.hour = this._defaults.hourMax;
569
- this._defaults.minuteMax = maxDateTime.getMinutes();
570
- if (this.minute >= this._defaults.minuteMax) {
571
- this.minute = this._defaults.minuteMax;
572
- this._defaults.secondMax = maxDateTime.getSeconds();
573
- } else {
574
- if(this.second > this._defaults.secondMax) this.second = this._defaults.secondMax;
575
- this._defaults.secondMax = this.secondMaxOriginal;
1316
+ tmptime = $.trim(tmptime);
1317
+ return tmptime;
1318
+ };
1319
+
1320
+ /*
1321
+ * the bad hack :/ override datepicker so it doesnt close on select
1322
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1323
+ */
1324
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
1325
+ $.datepicker._selectDate = function(id, dateStr) {
1326
+ var inst = this._getInst($(id)[0]),
1327
+ tp_inst = this._get(inst, 'timepicker');
1328
+
1329
+ if (tp_inst) {
1330
+ tp_inst._limitMinMaxDateTime(inst, true);
1331
+ inst.inline = inst.stay_open = true;
1332
+ //This way the onSelect handler called from calendarpicker get the full dateTime
1333
+ this._base_selectDate(id, dateStr);
1334
+ inst.inline = inst.stay_open = false;
1335
+ this._notifyChange(inst);
1336
+ this._updateDatepicker(inst);
1337
+ } else {
1338
+ this._base_selectDate(id, dateStr);
1339
+ }
1340
+ };
1341
+
1342
+ /*
1343
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
1344
+ * and does not redraw the datepicker on every selectDate event
1345
+ */
1346
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1347
+ $.datepicker._updateDatepicker = function(inst) {
1348
+
1349
+ // don't popup the datepicker if there is another instance already opened
1350
+ var input = inst.input[0];
1351
+ if ($.datepicker._curInst && $.datepicker._curInst != inst && $.datepicker._datepickerShowing && $.datepicker._lastInput != input) {
1352
+ return;
1353
+ }
1354
+
1355
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1356
+
1357
+ this._base_updateDatepicker(inst);
1358
+
1359
+ // Reload the time control when changing something in the input text field.
1360
+ var tp_inst = this._get(inst, 'timepicker');
1361
+ if (tp_inst) {
1362
+ tp_inst._addTimePicker(inst);
1363
+ }
1364
+ }
1365
+ };
1366
+
1367
+ /*
1368
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1369
+ */
1370
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1371
+ $.datepicker._doKeyPress = function(event) {
1372
+ var inst = $.datepicker._getInst(event.target),
1373
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1374
+
1375
+ if (tp_inst) {
1376
+ if ($.datepicker._get(inst, 'constrainInput')) {
1377
+ var ampm = tp_inst.support.ampm,
1378
+ tz = tp_inst._defaults.showTimezone !== null? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
1379
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1380
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
1381
+ .replace(/[hms]/g, '')
1382
+ .replace(/TT/g, ampm ? 'APM' : '')
1383
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1384
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
1385
+ .replace(/T/g, ampm ? 'AP' : '')
1386
+ .replace(/tt/g, ampm ? 'apm' : '')
1387
+ .replace(/t/g, ampm ? 'ap' : '') +
1388
+ " " + tp_inst._defaults.separator +
1389
+ tp_inst._defaults.timeSuffix +
1390
+ (tz ? tp_inst._defaults.timezoneList.join('') : '') +
1391
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1392
+ dateChars,
1393
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1394
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1395
+ }
1396
+ }
1397
+
1398
+ return $.datepicker._base_doKeyPress(event);
1399
+ };
1400
+
1401
+ /*
1402
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1403
+ */
1404
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1405
+ /* Update any alternate field to synchronise with the main field. */
1406
+ $.datepicker._updateAlternate = function(inst) {
1407
+ var tp_inst = this._get(inst, 'timepicker');
1408
+ if(tp_inst){
1409
+ var altField = tp_inst._defaults.altField;
1410
+ if (altField) { // update alternate field too
1411
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1412
+ date = this._getDate(inst),
1413
+ formatCfg = $.datepicker._getFormatConfig(inst),
1414
+ altFormattedDateTime = '',
1415
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1416
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1417
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1418
+
1419
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1420
+ if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null){
1421
+ if(tp_inst._defaults.altFormat){
1422
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1423
+ }
1424
+ else{
1425
+ altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
576
1426
  }
577
- } else {
578
- this._defaults.minuteMax = this.minuteMaxOriginal;
579
- this._defaults.secondMax = this.secondMaxOriginal;
580
1427
  }
581
- }else{
582
- this._defaults.hourMax = this.hourMaxOriginal;
583
- this._defaults.minuteMax = this.minuteMaxOriginal;
584
- this._defaults.secondMax = this.secondMaxOriginal;
1428
+ $(altField).val(altFormattedDateTime);
585
1429
  }
586
1430
  }
1431
+ else{
1432
+ $.datepicker._base_updateAlternate(inst);
1433
+ }
1434
+ };
1435
+
1436
+ /*
1437
+ * Override key up event to sync manual input changes.
1438
+ */
1439
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1440
+ $.datepicker._doKeyUp = function(event) {
1441
+ var inst = $.datepicker._getInst(event.target),
1442
+ tp_inst = $.datepicker._get(inst, 'timepicker');
587
1443
 
588
- if(adjustSliders !== undefined && adjustSliders === true){
589
- var hourMax = (this._defaults.hourMax - (this._defaults.hourMax % this._defaults.stepHour)).toFixed(0),
590
- minMax = (this._defaults.minuteMax - (this._defaults.minuteMax % this._defaults.stepMinute)).toFixed(0),
591
- secMax = (this._defaults.secondMax - (this._defaults.secondMax % this._defaults.stepSecond)).toFixed(0);
592
-
593
- if(this.hour_slider)
594
- this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
595
- if(this.minute_slider)
596
- this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
597
- if(this.second_slider)
598
- this.second_slider.slider("option", { min: this._defaults.secondMin, max: secMax }).slider('value', this.second);
1444
+ if (tp_inst) {
1445
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
1446
+ try {
1447
+ $.datepicker._updateDatepicker(inst);
1448
+ } catch (err) {
1449
+ $.timepicker.log(err);
1450
+ }
1451
+ }
599
1452
  }
600
1453
 
601
- },
1454
+ return $.datepicker._base_doKeyUp(event);
1455
+ };
602
1456
 
603
-
604
- //########################################################################
605
- // when a slider moves, set the internal time...
606
- // on time change is also called when the time is updated in the text field
607
- //########################################################################
608
- _onTimeChange: function() {
609
- var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false,
610
- minute = (this.minute_slider) ? this.minute_slider.slider('value') : false,
611
- second = (this.second_slider) ? this.second_slider.slider('value') : false,
612
- timezone = (this.timezone_select) ? this.timezone_select.val() : false;
613
-
614
- if (typeof(hour) == 'object') hour = false;
615
- if (typeof(minute) == 'object') minute = false;
616
- if (typeof(second) == 'object') second = false;
617
- if (typeof(timezone) == 'object') timezone = false;
618
-
619
- if (hour !== false) hour = parseInt(hour,10);
620
- if (minute !== false) minute = parseInt(minute,10);
621
- if (second !== false) second = parseInt(second,10);
622
-
623
- var ampm = (hour < 12) ? 'AM' : 'PM';
624
-
625
- // If the update was done in the input field, the input field should not be updated.
626
- // If the update was done using the sliders, update the input field.
627
- var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || (this.ampm.length > 0 && this.ampm != ampm) || timezone != this.timezone);
628
-
629
- if (hasChanged) {
1457
+ /*
1458
+ * override "Today" button to also grab the time.
1459
+ */
1460
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1461
+ $.datepicker._gotoToday = function(id) {
1462
+ var inst = this._getInst($(id)[0]),
1463
+ $dp = inst.dpDiv;
1464
+ this._base_gotoToday(id);
1465
+ var tp_inst = this._get(inst, 'timepicker');
1466
+ selectLocalTimezone(tp_inst);
1467
+ var now = new Date();
1468
+ this._setTime(inst, now);
1469
+ $('.ui-datepicker-today', $dp).click();
1470
+ };
630
1471
 
631
- if (hour !== false)this.hour = hour;
632
- if (minute !== false) this.minute = minute;
633
- if (second !== false) this.second = second;
634
- if (timezone !== false) this.timezone = timezone;
635
-
636
- if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
637
-
638
- this._limitMinMaxDateTime(this.inst, true);
1472
+ /*
1473
+ * Disable & enable the Time in the datetimepicker
1474
+ */
1475
+ $.datepicker._disableTimepickerDatepicker = function(target) {
1476
+ var inst = this._getInst(target);
1477
+ if (!inst) {
1478
+ return;
639
1479
  }
640
- if (this._defaults.ampm) this.ampm = ampm;
641
-
642
- this._formatTime();
643
- if (this.$timeObj) this.$timeObj.text(this.formattedTime + this._defaults.timeSuffix);
644
- this.timeDefined = true;
645
- if (hasChanged) this._updateDateTime();
646
- },
647
-
648
- //########################################################################
649
- // call custom onSelect.
650
- // bind to sliders slidestop, and grid click.
651
- //########################################################################
652
- _onSelectHandler: function() {
653
- var onSelect = this._defaults['onSelect'];
654
- var inputEl = this.$input ? this.$input[0] : null;
655
- if (onSelect && inputEl) {
656
- onSelect.apply(inputEl, [this.formattedDateTime, this]);
1480
+
1481
+ var tp_inst = this._get(inst, 'timepicker');
1482
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1483
+ if (tp_inst) {
1484
+ tp_inst._defaults.showTimepicker = false;
1485
+ tp_inst._updateDateTime(inst);
657
1486
  }
658
- },
659
-
660
- //########################################################################
661
- // format the time all pretty...
662
- //########################################################################
663
- _formatTime: function(time, format, ampm) {
664
- if (ampm == undefined) ampm = this._defaults.ampm;
665
- time = time || { hour: this.hour, minute: this.minute, second: this.second, ampm: this.ampm, timezone: this.timezone };
666
- var tmptime = format || this._defaults.timeFormat.toString();
667
-
668
- if (ampm) {
669
- var hour12 = ((time.ampm == 'AM') ? (time.hour) : (time.hour % 12));
670
- hour12 = (Number(hour12) === 0) ? 12 : hour12;
671
- tmptime = tmptime.toString()
672
- .replace(/hh/g, ((hour12 < 10) ? '0' : '') + hour12)
673
- .replace(/h/g, hour12)
674
- .replace(/mm/g, ((time.minute < 10) ? '0' : '') + time.minute)
675
- .replace(/m/g, time.minute)
676
- .replace(/ss/g, ((time.second < 10) ? '0' : '') + time.second)
677
- .replace(/s/g, time.second)
678
- .replace(/TT/g, time.ampm.toUpperCase())
679
- .replace(/Tt/g, time.ampm.toUpperCase())
680
- .replace(/tT/g, time.ampm.toLowerCase())
681
- .replace(/tt/g, time.ampm.toLowerCase())
682
- .replace(/T/g, time.ampm.charAt(0).toUpperCase())
683
- .replace(/t/g, time.ampm.charAt(0).toLowerCase())
684
- .replace(/z/g, time.timezone);
685
- } else {
686
- tmptime = tmptime.toString()
687
- .replace(/hh/g, ((time.hour < 10) ? '0' : '') + time.hour)
688
- .replace(/h/g, time.hour)
689
- .replace(/mm/g, ((time.minute < 10) ? '0' : '') + time.minute)
690
- .replace(/m/g, time.minute)
691
- .replace(/ss/g, ((time.second < 10) ? '0' : '') + time.second)
692
- .replace(/s/g, time.second)
693
- .replace(/z/g, time.timezone);
694
- tmptime = $.trim(tmptime.replace(/t/gi, ''));
1487
+ };
1488
+
1489
+ $.datepicker._enableTimepickerDatepicker = function(target) {
1490
+ var inst = this._getInst(target);
1491
+ if (!inst) {
1492
+ return;
1493
+ }
1494
+
1495
+ var tp_inst = this._get(inst, 'timepicker');
1496
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1497
+ if (tp_inst) {
1498
+ tp_inst._defaults.showTimepicker = true;
1499
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
1500
+ tp_inst._updateDateTime(inst);
1501
+ }
1502
+ };
1503
+
1504
+ /*
1505
+ * Create our own set time function
1506
+ */
1507
+ $.datepicker._setTime = function(inst, date) {
1508
+ var tp_inst = this._get(inst, 'timepicker');
1509
+ if (tp_inst) {
1510
+ var defaults = tp_inst._defaults;
1511
+
1512
+ // calling _setTime with no date sets time to defaults
1513
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
1514
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1515
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
1516
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1517
+ tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
1518
+
1519
+ //check if within min/max times..
1520
+ tp_inst._limitMinMaxDateTime(inst, true);
1521
+
1522
+ tp_inst._onTimeChange();
1523
+ tp_inst._updateDateTime(inst);
695
1524
  }
1525
+ };
696
1526
 
697
- if (arguments.length) return tmptime;
698
- else this.formattedTime = tmptime;
699
- },
700
-
701
- //########################################################################
702
- // update our input with the new date time..
703
- //########################################################################
704
- _updateDateTime: function(dp_inst) {
705
- dp_inst = this.inst || dp_inst,
706
- dt = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay),
707
- dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
708
- formatCfg = $.datepicker._getFormatConfig(dp_inst),
709
- timeAvailable = dt !== null && this.timeDefined;
710
- this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
711
- var formattedDateTime = this.formattedDate;
712
- if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
1527
+ /*
1528
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
1529
+ */
1530
+ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
1531
+ var inst = this._getInst(target);
1532
+ if (!inst) {
713
1533
  return;
1534
+ }
1535
+
1536
+ var tp_inst = this._get(inst, 'timepicker');
714
1537
 
715
- if (this._defaults.timeOnly === true) {
716
- formattedDateTime = this.formattedTime;
717
- } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
718
- formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
1538
+ if (tp_inst) {
1539
+ this._setDateFromField(inst);
1540
+ var tp_date;
1541
+ if (date) {
1542
+ if (typeof date == "string") {
1543
+ tp_inst._parseTime(date, withDate);
1544
+ tp_date = new Date();
1545
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1546
+ tp_date.setMicroseconds(tp_inst.microsec);
1547
+ } else {
1548
+ tp_date = new Date(date.getTime());
1549
+ }
1550
+ if (tp_date.toString() == 'Invalid Date') {
1551
+ tp_date = undefined;
1552
+ }
1553
+ this._setTime(inst, tp_date);
1554
+ }
719
1555
  }
720
1556
 
721
- this.formattedDateTime = formattedDateTime;
1557
+ };
722
1558
 
723
- if(!this._defaults.showTimepicker) {
724
- this.$input.val(this.formattedDate);
725
- } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
726
- this.$altInput.val(this.formattedTime);
727
- this.$input.val(this.formattedDate);
728
- } else if(this.$altInput) {
729
- this.$altInput.val(formattedDateTime);
730
- this.$input.val(formattedDateTime);
731
- } else {
732
- this.$input.val(formattedDateTime);
1559
+ /*
1560
+ * override setDate() to allow setting time too within Date object
1561
+ */
1562
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1563
+ $.datepicker._setDateDatepicker = function(target, date) {
1564
+ var inst = this._getInst(target);
1565
+ if (!inst) {
1566
+ return;
733
1567
  }
1568
+
1569
+ var tp_inst = this._get(inst, 'timepicker'),
1570
+ tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
734
1571
 
735
- this.$input.trigger("change");
736
- }
1572
+ // This is important if you are using the timezone option, javascript's Date
1573
+ // object will only return the timezone offset for the current locale, so we
1574
+ // adjust it accordingly. If not using timezone option this won't matter..
1575
+ // If a timezone is different in tp, keep the timezone as is
1576
+ if(tp_inst && tp_inst.timezone != null){
1577
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1578
+ tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone);
1579
+ }
737
1580
 
738
- });
1581
+ this._updateDatepicker(inst);
1582
+ this._base_setDateDatepicker.apply(this, arguments);
1583
+ this._setTimeDatepicker(target, tp_date, true);
1584
+ };
739
1585
 
740
- $.fn.extend({
741
- //########################################################################
742
- // shorthand just to use timepicker..
743
- //########################################################################
744
- timepicker: function(o) {
745
- o = o || {};
746
- var tmp_args = arguments;
1586
+ /*
1587
+ * override getDate() to allow getting time too within Date object
1588
+ */
1589
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1590
+ $.datepicker._getDateDatepicker = function(target, noDefault) {
1591
+ var inst = this._getInst(target);
1592
+ if (!inst) {
1593
+ return;
1594
+ }
747
1595
 
748
- if (typeof o == 'object') tmp_args[0] = $.extend(o, { timeOnly: true });
1596
+ var tp_inst = this._get(inst, 'timepicker');
749
1597
 
750
- return $(this).each(function() {
751
- $.fn.datetimepicker.apply($(this), tmp_args);
752
- });
753
- },
754
-
755
- //########################################################################
756
- // extend timepicker to datepicker
757
- //########################################################################
758
- datetimepicker: function(o) {
759
- o = o || {};
760
- var $input = this,
761
- tmp_args = arguments;
762
-
763
- if (typeof(o) == 'string'){
764
- if(o == 'getDate')
765
- return $.fn.datepicker.apply($(this[0]), tmp_args);
766
- else
767
- return this.each(function() {
768
- var $t = $(this);
769
- $t.datepicker.apply($t, tmp_args);
770
- });
1598
+ if (tp_inst) {
1599
+ // if it hasn't yet been defined, grab from field
1600
+ if(inst.lastVal === undefined){
1601
+ this._setDateFromField(inst, noDefault);
1602
+ }
1603
+
1604
+ var date = this._getDate(inst);
1605
+ if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
1606
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1607
+ date.setMicroseconds(tp_inst.microsec);
1608
+
1609
+ // This is important if you are using the timezone option, javascript's Date
1610
+ // object will only return the timezone offset for the current locale, so we
1611
+ // adjust it accordingly. If not using timezone option this won't matter..
1612
+ if(tp_inst.timezone != null){
1613
+ date = $.timepicker.timezoneAdjust(date, tp_inst.timezone);
1614
+ }
1615
+ }
1616
+ return date;
771
1617
  }
772
- else
773
- return this.each(function() {
774
- var $t = $(this);
775
- $t.datepicker($.timepicker._newInst($t, o)._defaults);
776
- });
777
- }
778
- });
779
-
780
- //########################################################################
781
- // the bad hack :/ override datepicker so it doesnt close on select
782
- // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
783
- //########################################################################
784
- $.datepicker._base_selectDate = $.datepicker._selectDate;
785
- $.datepicker._selectDate = function (id, dateStr) {
786
- var inst = this._getInst($(id)[0]),
787
- tp_inst = this._get(inst, 'timepicker');
788
-
789
- if (tp_inst) {
790
- tp_inst._limitMinMaxDateTime(inst, true);
791
- inst.inline = inst.stay_open = true;
792
- //This way the onSelect handler called from calendarpicker get the full dateTime
793
- this._base_selectDate(id, dateStr + tp_inst._defaults.separator + tp_inst.formattedTime + tp_inst._defaults.timeSuffix);
794
- inst.inline = inst.stay_open = false;
795
- this._notifyChange(inst);
796
- this._updateDatepicker(inst);
797
- }
798
- else this._base_selectDate(id, dateStr);
799
- };
800
-
801
- //#############################################################################################
802
- // second bad hack :/ override datepicker so it triggers an event when changing the input field
803
- // and does not redraw the datepicker on every selectDate event
804
- //#############################################################################################
805
- $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
806
- $.datepicker._updateDatepicker = function(inst) {
807
-
808
- // don't popup the datepicker if there is another instance already opened
809
- var input = inst.input[0];
810
- if($.datepicker._curInst &&
811
- $.datepicker._curInst != inst &&
812
- $.datepicker._datepickerShowing &&
813
- $.datepicker._lastInput != input) {
814
- return;
815
- }
1618
+ return this._base_getDateDatepicker(target, noDefault);
1619
+ };
816
1620
 
817
- if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
818
-
819
- this._base_updateDatepicker(inst);
820
-
821
- // Reload the time control when changing something in the input text field.
1621
+ /*
1622
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1623
+ * An option in datapicker to ignore extra format characters would be nicer.
1624
+ */
1625
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1626
+ $.datepicker.parseDate = function(format, value, settings) {
1627
+ var date;
1628
+ try {
1629
+ date = this._base_parseDate(format, value, settings);
1630
+ } catch (err) {
1631
+ // Hack! The error message ends with a colon, a space, and
1632
+ // the "extra" characters. We rely on that instead of
1633
+ // attempting to perfectly reproduce the parsing algorithm.
1634
+ if (err.indexOf(":") >= 0) {
1635
+ date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1636
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1637
+ } else {
1638
+ throw err;
1639
+ }
1640
+ }
1641
+ return date;
1642
+ };
1643
+
1644
+ /*
1645
+ * override formatDate to set date with time to the input
1646
+ */
1647
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1648
+ $.datepicker._formatDate = function(inst, day, month, year) {
822
1649
  var tp_inst = this._get(inst, 'timepicker');
823
- if(tp_inst) tp_inst._addTimePicker(inst);
824
- }
825
- };
826
-
827
- //#######################################################################################
828
- // third bad hack :/ override datepicker so it allows spaces and colon in the input field
829
- //#######################################################################################
830
- $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
831
- $.datepicker._doKeyPress = function(event) {
832
- var inst = $.datepicker._getInst(event.target),
833
- tp_inst = $.datepicker._get(inst, 'timepicker');
834
-
835
- if (tp_inst) {
836
- if ($.datepicker._get(inst, 'constrainInput')) {
837
- var ampm = tp_inst._defaults.ampm,
838
- dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
839
- datetimeChars = tp_inst._defaults.timeFormat.toString()
840
- .replace(/[hms]/g, '')
841
- .replace(/TT/g, ampm ? 'APM' : '')
842
- .replace(/Tt/g, ampm ? 'AaPpMm' : '')
843
- .replace(/tT/g, ampm ? 'AaPpMm' : '')
844
- .replace(/T/g, ampm ? 'AP' : '')
845
- .replace(/tt/g, ampm ? 'apm' : '')
846
- .replace(/t/g, ampm ? 'ap' : '') +
847
- " " +
848
- tp_inst._defaults.separator +
849
- tp_inst._defaults.timeSuffix +
850
- (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
851
- dateChars,
852
- chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
853
- return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1650
+ if (tp_inst) {
1651
+ tp_inst._updateDateTime(inst);
1652
+ return tp_inst.$input.val();
854
1653
  }
855
- }
1654
+ return this._base_formatDate(inst);
1655
+ };
1656
+
1657
+ /*
1658
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1659
+ */
1660
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1661
+ $.datepicker._optionDatepicker = function(target, name, value) {
1662
+ var inst = this._getInst(target),
1663
+ name_clone;
1664
+ if (!inst) {
1665
+ return null;
1666
+ }
1667
+
1668
+ var tp_inst = this._get(inst, 'timepicker');
1669
+ if (tp_inst) {
1670
+ var min = null,
1671
+ max = null,
1672
+ onselect = null,
1673
+ overrides = tp_inst._defaults.evnts,
1674
+ fns = {},
1675
+ prop;
1676
+ if (typeof name == 'string') { // if min/max was set with the string
1677
+ if (name === 'minDate' || name === 'minDateTime') {
1678
+ min = value;
1679
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
1680
+ max = value;
1681
+ } else if (name === 'onSelect') {
1682
+ onselect = value;
1683
+ } else if (overrides.hasOwnProperty(name)) {
1684
+ if (typeof (value) === 'undefined') {
1685
+ return overrides[name];
1686
+ }
1687
+ fns[name] = value;
1688
+ name_clone = {}; //empty results in exiting function after overrides updated
1689
+ }
1690
+ } else if (typeof name == 'object') { //if min/max was set with the JSON
1691
+ if (name.minDate) {
1692
+ min = name.minDate;
1693
+ } else if (name.minDateTime) {
1694
+ min = name.minDateTime;
1695
+ } else if (name.maxDate) {
1696
+ max = name.maxDate;
1697
+ } else if (name.maxDateTime) {
1698
+ max = name.maxDateTime;
1699
+ }
1700
+ for (prop in overrides) {
1701
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
1702
+ fns[prop] = name[prop];
1703
+ }
1704
+ }
1705
+ }
1706
+ for (prop in fns) {
1707
+ if (fns.hasOwnProperty(prop)) {
1708
+ overrides[prop] = fns[prop];
1709
+ if (!name_clone) { name_clone = $.extend({}, name);}
1710
+ delete name_clone[prop];
1711
+ }
1712
+ }
1713
+ if (name_clone && isEmptyObject(name_clone)) { return; }
1714
+ if (min) { //if min was set
1715
+ if (min === 0) {
1716
+ min = new Date();
1717
+ } else {
1718
+ min = new Date(min);
1719
+ }
1720
+ tp_inst._defaults.minDate = min;
1721
+ tp_inst._defaults.minDateTime = min;
1722
+ } else if (max) { //if max was set
1723
+ if (max === 0) {
1724
+ max = new Date();
1725
+ } else {
1726
+ max = new Date(max);
1727
+ }
1728
+ tp_inst._defaults.maxDate = max;
1729
+ tp_inst._defaults.maxDateTime = max;
1730
+ } else if (onselect) {
1731
+ tp_inst._defaults.onSelect = onselect;
1732
+ }
1733
+ }
1734
+ if (value === undefined) {
1735
+ return this._base_optionDatepicker.call($.datepicker, target, name);
1736
+ }
1737
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1738
+ };
856
1739
 
857
- return $.datepicker._base_doKeyPress(event);
858
- };
859
-
860
- //#######################################################################################
861
- // Override key up event to sync manual input changes.
862
- //#######################################################################################
863
- $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
864
- $.datepicker._doKeyUp = function (event) {
865
- var inst = $.datepicker._getInst(event.target),
866
- tp_inst = $.datepicker._get(inst, 'timepicker');
867
-
868
- if (tp_inst) {
869
- if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
870
- try {
871
- $.datepicker._updateDatepicker(inst);
1740
+ /*
1741
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1742
+ * it will return false for all objects
1743
+ */
1744
+ var isEmptyObject = function(obj) {
1745
+ var prop;
1746
+ for (prop in obj) {
1747
+ if (obj.hasOwnProperty(obj)) {
1748
+ return false;
872
1749
  }
873
- catch (err) {
874
- $.datepicker.log(err);
1750
+ }
1751
+ return true;
1752
+ };
1753
+
1754
+ /*
1755
+ * jQuery extend now ignores nulls!
1756
+ */
1757
+ var extendRemove = function(target, props) {
1758
+ $.extend(target, props);
1759
+ for (var name in props) {
1760
+ if (props[name] === null || props[name] === undefined) {
1761
+ target[name] = props[name];
875
1762
  }
876
1763
  }
877
- }
1764
+ return target;
1765
+ };
878
1766
 
879
- return $.datepicker._base_doKeyUp(event);
880
- };
881
-
882
- //#######################################################################################
883
- // override "Today" button to also grab the time.
884
- //#######################################################################################
885
- $.datepicker._base_gotoToday = $.datepicker._gotoToday;
886
- $.datepicker._gotoToday = function(id) {
887
- this._base_gotoToday(id);
888
- this._setTime(this._getInst($(id)[0]), new Date());
889
- };
890
-
891
- //#######################################################################################
892
- // Disable & enable the Time in the datetimepicker
893
- //#######################################################################################
894
- $.datepicker._disableTimepickerDatepicker = function(target, date, withDate) {
895
- var inst = this._getInst(target),
896
- tp_inst = this._get(inst, 'timepicker');
897
- $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
898
- if (tp_inst) {
899
- tp_inst._defaults.showTimepicker = false;
900
- tp_inst._updateDateTime(inst);
901
- }
902
- };
903
-
904
- $.datepicker._enableTimepickerDatepicker = function(target, date, withDate) {
905
- var inst = this._getInst(target),
906
- tp_inst = this._get(inst, 'timepicker');
907
- $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
908
- if (tp_inst) {
909
- tp_inst._defaults.showTimepicker = true;
910
- tp_inst._addTimePicker(inst); // Could be disabled on page load
911
- tp_inst._updateDateTime(inst);
912
- }
913
- };
914
-
915
- //#######################################################################################
916
- // Create our own set time function
917
- //#######################################################################################
918
- $.datepicker._setTime = function(inst, date) {
919
- var tp_inst = this._get(inst, 'timepicker');
920
- if (tp_inst) {
921
- var defaults = tp_inst._defaults,
922
- // calling _setTime with no date sets time to defaults
923
- hour = date ? date.getHours() : defaults.hour,
924
- minute = date ? date.getMinutes() : defaults.minute,
925
- second = date ? date.getSeconds() : defaults.second;
926
-
927
- //check if within min/max times..
928
- if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax)) {
929
- hour = defaults.hourMin;
930
- minute = defaults.minuteMin;
931
- second = defaults.secondMin;
1767
+ /*
1768
+ * Determine by the time format which units are supported
1769
+ * Returns an object of booleans for each unit
1770
+ */
1771
+ var detectSupport = function(timeFormat){
1772
+ var tf = timeFormat.replace(/\'.*?\'/g,'').toLowerCase(), // removes literals
1773
+ isIn = function(f, t){ // does the format contain the token?
1774
+ return f.indexOf(t) !== -1? true:false;
1775
+ };
1776
+ return {
1777
+ hour: isIn(tf,'h'),
1778
+ minute: isIn(tf,'m'),
1779
+ second: isIn(tf,'s'),
1780
+ millisec: isIn(tf,'l'),
1781
+ microsec: isIn(tf,'c'),
1782
+ timezone: isIn(tf,'z'),
1783
+ ampm: isIn('t') && isIn(timeFormat,'h'),
1784
+ iso8601: isIn(timeFormat, 'Z')
1785
+ };
1786
+ };
1787
+
1788
+ /*
1789
+ * Converts 24 hour format into 12 hour
1790
+ * Returns 12 hour without leading 0
1791
+ */
1792
+ var convert24to12 = function(hour) {
1793
+ if (hour > 12) {
1794
+ hour = hour - 12;
932
1795
  }
933
1796
 
934
- tp_inst.hour = hour;
935
- tp_inst.minute = minute;
936
- tp_inst.second = second;
1797
+ if (hour === 0) {
1798
+ hour = 12;
1799
+ }
937
1800
 
938
- if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour);
939
- if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute);
940
- if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second);
1801
+ return String(hour);
1802
+ };
941
1803
 
942
- tp_inst._onTimeChange();
943
- tp_inst._updateDateTime(inst);
944
- }
945
- };
946
-
947
- //#######################################################################################
948
- // Create new public method to set only time, callable as $().datepicker('setTime', date)
949
- //#######################################################################################
950
- $.datepicker._setTimeDatepicker = function(target, date, withDate) {
951
- var inst = this._getInst(target),
952
- tp_inst = this._get(inst, 'timepicker');
953
-
954
- if (tp_inst) {
955
- this._setDateFromField(inst);
956
- var tp_date;
957
- if (date) {
958
- if (typeof date == "string") {
959
- tp_inst._parseTime(date, withDate);
960
- tp_date = new Date();
961
- tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second);
1804
+ /*
1805
+ * Splits datetime string into date ans time substrings.
1806
+ * Throws exception when date can't be parsed
1807
+ * Returns [dateString, timeString]
1808
+ */
1809
+ var splitDateTime = function(dateFormat, dateTimeString, dateSettings, timeSettings) {
1810
+ try {
1811
+ // The idea is to get the number separator occurances in datetime and the time format requested (since time has
1812
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1813
+ var separator = timeSettings && timeSettings.separator ? timeSettings.separator : $.timepicker._defaults.separator,
1814
+ format = timeSettings && timeSettings.timeFormat ? timeSettings.timeFormat : $.timepicker._defaults.timeFormat,
1815
+ timeParts = format.split(separator), // how many occurances of separator may be in our format?
1816
+ timePartsLen = timeParts.length,
1817
+ allParts = dateTimeString.split(separator),
1818
+ allPartsLen = allParts.length;
1819
+
1820
+ if (allPartsLen > 1) {
1821
+ return [
1822
+ allParts.splice(0,allPartsLen-timePartsLen).join(separator),
1823
+ allParts.splice(0,timePartsLen).join(separator)
1824
+ ];
1825
+ }
1826
+
1827
+ } catch (err) {
1828
+ $.timepicker.log('Could not split the date from the time. Please check the following datetimepicker options' +
1829
+ "\nthrown error: " + err +
1830
+ "\ndateTimeString" + dateTimeString +
1831
+ "\ndateFormat = " + dateFormat +
1832
+ "\nseparator = " + timeSettings.separator +
1833
+ "\ntimeFormat = " + timeSettings.timeFormat);
1834
+
1835
+ if (err.indexOf(":") >= 0) {
1836
+ // Hack! The error message ends with a colon, a space, and
1837
+ // the "extra" characters. We rely on that instead of
1838
+ // attempting to perfectly reproduce the parsing algorithm.
1839
+ var dateStringLength = dateTimeString.length - (err.length - err.indexOf(':') - 2),
1840
+ timeString = dateTimeString.substring(dateStringLength);
1841
+
1842
+ return [$.trim(dateTimeString.substring(0, dateStringLength)), $.trim(dateTimeString.substring(dateStringLength))];
1843
+
1844
+ } else {
1845
+ throw err;
962
1846
  }
963
- else tp_date = new Date(date.getTime());
964
- if (tp_date.toString() == 'Invalid Date') tp_date = undefined;
965
- this._setTime(inst, tp_date);
966
1847
  }
967
- }
1848
+ return [dateTimeString, ''];
1849
+ };
968
1850
 
969
- };
970
-
971
- //#######################################################################################
972
- // override setDate() to allow setting time too within Date object
973
- //#######################################################################################
974
- $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
975
- $.datepicker._setDateDatepicker = function(target, date) {
976
- var inst = this._getInst(target),
977
- tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
978
-
979
- this._updateDatepicker(inst);
980
- this._base_setDateDatepicker.apply(this, arguments);
981
- this._setTimeDatepicker(target, tp_date, true);
982
- };
983
-
984
- //#######################################################################################
985
- // override getDate() to allow getting time too within Date object
986
- //#######################################################################################
987
- $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
988
- $.datepicker._getDateDatepicker = function(target, noDefault) {
989
- var inst = this._getInst(target),
990
- tp_inst = this._get(inst, 'timepicker');
991
-
992
- if (tp_inst) {
993
- this._setDateFromField(inst, noDefault);
994
- var date = this._getDate(inst);
995
- if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second);
1851
+ /*
1852
+ * Internal function to parse datetime interval
1853
+ * Returns: {date: Date, timeObj: Object}, where
1854
+ * date - parsed date without time (type Date)
1855
+ * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
1856
+ */
1857
+ var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1858
+ var date;
1859
+ var splitRes = splitDateTime(dateFormat, dateTimeString, dateSettings, timeSettings);
1860
+ date = $.datepicker._base_parseDate(dateFormat, splitRes[0], dateSettings);
1861
+ if (splitRes[1] !== '') {
1862
+ var timeString = splitRes[1],
1863
+ parsedTime = $.datepicker.parseTime(timeFormat, timeString, timeSettings);
1864
+
1865
+ if (parsedTime === null) {
1866
+ throw 'Wrong time format';
1867
+ }
1868
+ return {
1869
+ date: date,
1870
+ timeObj: parsedTime
1871
+ };
1872
+ } else {
1873
+ return {
1874
+ date: date
1875
+ };
1876
+ }
1877
+ };
1878
+
1879
+ /*
1880
+ * Internal function to set timezone_select to the local timezone
1881
+ */
1882
+ var selectLocalTimezone = function(tp_inst, date) {
1883
+ if (tp_inst && tp_inst.timezone_select) {
1884
+ var now = typeof date !== 'undefined' ? date : new Date();
1885
+ tp_inst.timezone_select.val(now.getTimezoneOffset()*-1);
1886
+ }
1887
+ };
1888
+
1889
+ /*
1890
+ * Create a Singleton Insance
1891
+ */
1892
+ $.timepicker = new Timepicker();
1893
+
1894
+ /**
1895
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
1896
+ * @param number if not a number this value is returned
1897
+ * @param boolean if true formats in accordance to iso8601 "+12:45"
1898
+ * @return string
1899
+ */
1900
+ $.timepicker.timezoneOffsetString = function(tzMinutes, iso8601) {
1901
+ if(isNaN(tzMinutes) || tzMinutes > 840){
1902
+ return tzMinutes;
1903
+ }
1904
+
1905
+ var off = tzMinutes,
1906
+ minutes = off % 60,
1907
+ hours = (off - minutes) / 60,
1908
+ iso = iso8601? ':':'',
1909
+ tz = (off >= 0 ? '+' : '-') + ('0' + (hours * 101).toString()).slice(-2) + iso + ('0' + (minutes * 101).toString()).slice(-2);
1910
+
1911
+ if(tz == '+00:00'){
1912
+ return 'Z';
1913
+ }
1914
+ return tz;
1915
+ };
1916
+
1917
+ /**
1918
+ * Get the number in minutes that represents a timezone string
1919
+ * @param string formated like "+0500", "-1245"
1920
+ * @return number
1921
+ */
1922
+ $.timepicker.timezoneOffsetNumber = function(tzString) {
1923
+ tzString = tzString.toString().replace(':',''); // excuse any iso8601, end up with "+1245"
1924
+
1925
+ if(tzString.toUpperCase() === 'Z'){ // if iso8601 with Z, its 0 minute offset
1926
+ return 0;
1927
+ }
1928
+
1929
+ if(!/^(\-|\+)\d{4}$/.test(tzString)){ // possibly a user defined tz, so just give it back
1930
+ return tzString;
1931
+ }
1932
+
1933
+ return ((tzString.substr(0,1) =='-'? -1 : 1) * // plus or minus
1934
+ ((parseInt(tzString.substr(1,2),10)*60) + // hours (converted to minutes)
1935
+ parseInt(tzString.substr(3,2),10))); // minutes
1936
+ };
1937
+
1938
+ /**
1939
+ * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
1940
+ * @param date
1941
+ * @param string formated like "+0500", "-1245"
1942
+ * @return date
1943
+ */
1944
+ $.timepicker.timezoneAdjust = function(date, toTimezone) {
1945
+ var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
1946
+ if(!isNaN(toTz)){
1947
+ var currTz = date.getTimezoneOffset()*-1,
1948
+ diff = currTz - toTz; // difference in minutes
1949
+
1950
+ date.setMinutes(date.getMinutes()+diff);
1951
+ }
996
1952
  return date;
997
- }
998
- return this._base_getDateDatepicker(target, noDefault);
999
- };
1000
-
1001
- //#######################################################################################
1002
- // override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1003
- // An option in datapicker to ignore extra format characters would be nicer.
1004
- //#######################################################################################
1005
- $.datepicker._base_parseDate = $.datepicker.parseDate;
1006
- $.datepicker.parseDate = function(format, value, settings) {
1007
- var date;
1008
- try {
1009
- date = this._base_parseDate(format, value, settings);
1010
- } catch (err) {
1011
- // Hack! The error message ends with a colon, a space, and
1012
- // the "extra" characters. We rely on that instead of
1013
- // attempting to perfectly reproduce the parsing algorithm.
1014
- date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1015
- }
1016
- return date;
1017
- };
1018
-
1019
- //#######################################################################################
1020
- // override options setter to add time to maxDate(Time) and minDate(Time)
1021
- //#######################################################################################
1022
- $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1023
- $.datepicker._optionDatepicker = function(target, name, value) {
1024
- this._base_optionDatepicker(target, name, value);
1025
- var inst = this._getInst(target),
1026
- tp_inst = this._get(inst, 'timepicker');
1027
- if (tp_inst) {
1028
- //Set minimum and maximum date values if we have timepicker
1029
- if(name==='minDate') {
1030
- if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
1031
- tp_inst._defaults.minDateTime = new Date(value);
1032
- if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date)
1033
- tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
1034
- tp_inst._limitMinMaxDateTime(inst,true);
1953
+ };
1954
+
1955
+ /**
1956
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
1957
+ * enforce date range limits.
1958
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
1959
+ * @param Element startTime
1960
+ * @param Element endTime
1961
+ * @param obj options Options for the timepicker() call
1962
+ * @return jQuery
1963
+ */
1964
+ $.timepicker.timeRange = function(startTime, endTime, options) {
1965
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
1966
+ };
1967
+
1968
+ /**
1969
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
1970
+ * enforce date range limits.
1971
+ * @param Element startTime
1972
+ * @param Element endTime
1973
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1974
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1975
+ * @param string method Can be used to specify the type of picker to be added
1976
+ * @return jQuery
1977
+ */
1978
+ $.timepicker.datetimeRange = function(startTime, endTime, options) {
1979
+ $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
1980
+ };
1981
+
1982
+ /**
1983
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1984
+ * enforce date range limits.
1985
+ * @param Element startTime
1986
+ * @param Element endTime
1987
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1988
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1989
+ * @return jQuery
1990
+ */
1991
+ $.timepicker.dateRange = function(startTime, endTime, options) {
1992
+ $.timepicker.handleRange('datepicker', startTime, endTime, options);
1993
+ };
1994
+
1995
+ /**
1996
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1997
+ * enforce date range limits.
1998
+ * @param string method Can be used to specify the type of picker to be added
1999
+ * @param Element startTime
2000
+ * @param Element endTime
2001
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
2002
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
2003
+ * @return jQuery
2004
+ */
2005
+ $.timepicker.handleRange = function(method, startTime, endTime, options) {
2006
+ options = $.extend({}, {
2007
+ minInterval: 0, // min allowed interval in milliseconds
2008
+ maxInterval: 0, // max allowed interval in milliseconds
2009
+ start: {}, // options for start picker
2010
+ end: {} // options for end picker
2011
+ }, options);
2012
+
2013
+ $.fn[method].call(startTime, $.extend({
2014
+ onClose: function(dateText, inst) {
2015
+ checkDates($(this), endTime);
2016
+ },
2017
+ onSelect: function(selectedDateTime) {
2018
+ selected($(this), endTime, 'minDate');
2019
+ }
2020
+ }, options, options.start));
2021
+ $.fn[method].call(endTime, $.extend({
2022
+ onClose: function(dateText, inst) {
2023
+ checkDates($(this), startTime);
2024
+ },
2025
+ onSelect: function(selectedDateTime) {
2026
+ selected($(this), startTime, 'maxDate');
2027
+ }
2028
+ }, options, options.end));
2029
+
2030
+ checkDates(startTime, endTime);
2031
+ selected(startTime, endTime, 'minDate');
2032
+ selected(endTime, startTime, 'maxDate');
2033
+
2034
+ function checkDates(changed, other) {
2035
+ var startdt = startTime[method]('getDate'),
2036
+ enddt = endTime[method]('getDate'),
2037
+ changeddt = changed[method]('getDate');
2038
+
2039
+ if(startdt !== null){
2040
+ var minDate = new Date(startdt.getTime()),
2041
+ maxDate = new Date(startdt.getTime());
2042
+
2043
+ minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2044
+ maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2045
+
2046
+ if(options.minInterval > 0 && minDate > enddt){ // minInterval check
2047
+ endTime[method]('setDate',minDate);
2048
+ }
2049
+ else if(options.maxInterval > 0 && maxDate < enddt){ // max interval check
2050
+ endTime[method]('setDate',maxDate);
2051
+ }
2052
+ else if (startdt > enddt) {
2053
+ other[method]('setDate',changeddt);
2054
+ }
2055
+ }
1035
2056
  }
1036
- if(name==='maxDate') {
1037
- if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date)
1038
- tp_inst._defaults.maxDateTime = new Date(value);
1039
- if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date)
1040
- tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
1041
- tp_inst._limitMinMaxDateTime(inst,true);
2057
+
2058
+ function selected(changed, other, option) {
2059
+ if (!changed.val()) {
2060
+ return;
2061
+ }
2062
+ var date = changed[method].call(changed, 'getDate');
2063
+ if(date !== null && options.minInterval > 0){
2064
+ if(option == 'minDate'){
2065
+ date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2066
+ }
2067
+ if(option == 'maxDate'){
2068
+ date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2069
+ }
2070
+ }
2071
+ if (date.getTime) {
2072
+ other[method].call(other, 'option', option, date);
2073
+ }
1042
2074
  }
2075
+ return $([startTime.get(0), endTime.get(0)]);
2076
+ };
2077
+
2078
+ /**
2079
+ * Log error or data to the console during error or debugging
2080
+ * @param Object err pass any type object to log to the console during error or debugging
2081
+ * @return void
2082
+ */
2083
+ $.timepicker.log = function(err){
2084
+ if(window.console){
2085
+ console.log(err);
2086
+ }
2087
+ };
2088
+
2089
+ /*
2090
+ * Rough microsecond support
2091
+ */
2092
+ if(!Date.prototype.getMicroseconds){
2093
+ Date.microseconds = 0;
2094
+ Date.prototype.getMicroseconds = function(){ return this.microseconds; };
2095
+ Date.prototype.setMicroseconds = function(m){ this.microseconds = m; return this; };
1043
2096
  }
1044
- };
1045
-
1046
- //#######################################################################################
1047
- // jQuery extend now ignores nulls!
1048
- //#######################################################################################
1049
- function extendRemove(target, props) {
1050
- $.extend(target, props);
1051
- for (var name in props)
1052
- if (props[name] === null || props[name] === undefined)
1053
- target[name] = props[name];
1054
- return target;
1055
- }
1056
-
1057
- $.timepicker = new Timepicker(); // singleton instance
1058
- $.timepicker.version = "0.9.6";
2097
+
2098
+ /*
2099
+ * Keep up with the version
2100
+ */
2101
+ $.timepicker.version = "1.3";
1059
2102
 
1060
2103
  })(jQuery);