diff --git a/.bowerrc b/.bowerrc index 8c48f3541136..7694ad7822ba 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,3 @@ { - "directory": "resources/assets/bower" + "directory": "./public/vendor" } \ No newline at end of file diff --git a/.gitignore b/.gitignore index f1594640bb7c..09e1dfee7b58 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ /public/build /public/packages /public/vendor -/resources/assets/bower /storage /bootstrap/compiled.php /bootstrap/environment.php diff --git a/CHANGELOG.md b/CHANGELOG.md index c71e47891557..6100d090e1ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed - Auto billing uses credits if they exist -- All assets (CSS, JS) are minfied now - - ## [2.6.4] - 2016-07-19 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c7bc7ddd7110..0c2d0bbb7327 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ Thanks for your contributions! * Make your changes and commit * Check if your branch is still in sync with the repositorys **`develop`** branch * _Read:_ [Syncing a fork](https://help.github.com/articles/syncing-a-fork/) - * _Also read:_ [How to rebase a pull request](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) + * _Also read:_ [How to rebase a pull request](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) * Push your branch and create a PR against the Invoice Ninja **`develop`** branch * Update the [Changelog](CHANGELOG.md) @@ -21,7 +21,7 @@ To make the contribution process nice and easy for anyone, please follow some ru to give a more detailed explanation. * Only one feature/bugfix per issue. If you want to submit more, create multiple issues. * Only one feature/bugfix per PR(pull request). Split more changes into multiple PRs. - + #### Coding Style Try to follow the [PSR-2 guidlines](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) @@ -29,7 +29,7 @@ _Example styling:_ ```php /** * Gets a preview of the email - * + * * @param TemplateService $templateService * * @return \Illuminate\Http\Response diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 000000000000..ce22ba6de51a --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,187 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + dump_dir: (function() { + var out = {}; + + grunt.file.expand({ filter: 'isDirectory'}, 'public/fonts/invoice-fonts/*').forEach(function(path) { + var fontName = /[^/]*$/.exec(path)[0], + files = {}, + license=''; + + // Add license text + grunt.file.expand({ filter: 'isFile'}, path+'/*.txt').forEach(function(path) { + var licenseText = grunt.file.read(path); + + // Fix anything that could escape from the comment + licenseText = licenseText.replace(/\*\//g,'*\\/'); + + license += "/*\n"+licenseText+"\n*/"; + }); + + // Create files list + files['public/js/vfs_fonts/'+fontName+'.js'] = [path+'/*.ttf']; + + out[fontName] = { + options: { + pre: license+'window.ninjaFontVfs=window.ninjaFontVfs||{};window.ninjaFontVfs.'+fontName+'=', + rootPath: path+'/' + }, + files: files + }; + }); + + // Return the computed object + return out; + }()), + concat: { + options: { + process: function(src, filepath) { + var basepath = filepath.substring(7, filepath.lastIndexOf('/') + 1); + // Fix relative paths for css files + if(filepath.indexOf('.css', filepath.length - 4) !== -1) { + return src.replace(/(url\s*[\("']+)\s*([^'"\)]+)(['"\)]+;?)/gi, function(match, start, url, end, offset, string) { + if(url.indexOf('data:') === 0) { + // Skip data urls + return match; + + } else if(url.indexOf('/') === 0) { + // Skip absolute urls + return match; + + } else { + return start + basepath + url + end; + } + }); + + // Fix source maps locations + } else if(filepath.indexOf('.js', filepath.length - 4) !== -1) { + return src.replace(/(\/[*\/][#@]\s*sourceMappingURL=)([^\s]+)/gi, function(match, start, url, offset, string) { + if(url.indexOf('/') === 0) { + // Skip absolute urls + return match; + + } else { + return start + basepath + url; + } + }); + + // Don't do anything for unknown file types + } else { + return src; + } + }, + }, + js: { + src: [ + 'public/vendor/jquery/dist/jquery.js', + 'public/vendor/jquery-ui/jquery-ui.min.js', + 'public/vendor/bootstrap/dist/js/bootstrap.min.js', + 'public/vendor/datatables/media/js/jquery.dataTables.js', + 'public/vendor/datatables-bootstrap3/BS3/assets/js/datatables.js', + 'public/vendor/knockout.js/knockout.js', + 'public/vendor/knockout-mapping/build/output/knockout.mapping-latest.js', + 'public/vendor/knockout-sortable/build/knockout-sortable.min.js', + 'public/vendor/underscore/underscore.js', + 'public/vendor/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.da.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.pt-BR.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.nl.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.fr.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.it.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.lt.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.no.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js', + 'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.sv.min.js', + 'public/vendor/dropzone/dist/min/dropzone.min.js', + 'public/vendor/typeahead.js/dist/typeahead.jquery.min.js', + 'public/vendor/accounting/accounting.min.js', + 'public/vendor/spectrum/spectrum.js', + 'public/vendor/jspdf/dist/jspdf.min.js', + 'public/vendor/moment/min/moment.min.js', + 'public/vendor/moment-timezone/builds/moment-timezone-with-data.min.js', + 'public/vendor/stacktrace-js/dist/stacktrace-with-polyfills.min.js', + 'public/vendor/fuse.js/src/fuse.min.js', + //'public/vendor/moment-duration-format/lib/moment-duration-format.js', + //'public/vendor/handsontable/dist/jquery.handsontable.full.min.js', + //'public/vendor/pdfmake/build/pdfmake.min.js', + //'public/vendor/pdfmake/build/vfs_fonts.js', + //'public/js/vfs_fonts.js', + 'public/js/bootstrap-combobox.js', + 'public/js/script.js', + 'public/js/pdf.pdfmake.js', + ], + dest: 'public/built.js', + nonull: true + }, + js_public: { + src: [ + /* + 'public/js/simpleexpand.js', + 'public/js/valign.js', + 'public/js/bootstrap.min.js', + 'public/js/simpleexpand.js', + */ + 'public/vendor/bootstrap/dist/js/bootstrap.min.js', + 'public/js/bootstrap-combobox.js', + + ], + dest: 'public/built.public.js', + nonull: true + }, + css: { + src: [ + 'public/vendor/bootstrap/dist/css/bootstrap.min.css', + 'public/vendor/datatables/media/css/jquery.dataTables.css', + 'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css', + 'public/vendor/font-awesome/css/font-awesome.min.css', + 'public/vendor/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css', + 'public/vendor/dropzone/dist/min/dropzone.min.css', + 'public/vendor/spectrum/spectrum.css', + 'public/css/bootstrap-combobox.css', + 'public/css/typeahead.js-bootstrap.css', + //'public/vendor/handsontable/dist/jquery.handsontable.full.css', + 'public/css/style.css', + ], + dest: 'public/css/built.css', + nonull: true, + options: { + process: false + } + }, + css_public: { + src: [ + 'public/vendor/bootstrap/dist/css/bootstrap.min.css', + 'public/vendor/font-awesome/css/font-awesome.min.css', + 'public/css/bootstrap-combobox.css', + 'public/vendor/datatables/media/css/jquery.dataTables.css', + 'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css', + 'public/css/public.style.css', + ], + dest: 'public/css/built.public.css', + nonull: true, + options: { + process: false + } + }, + js_pdf: { + src: [ + 'public/js/pdf_viewer.js', + 'public/js/compatibility.js', + 'public/js/pdfmake.min.js', + 'public/js/vfs.js', + ], + dest: 'public/pdf.built.js', + nonull: true + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-dump-dir'); + + grunt.registerTask('default', ['dump_dir', 'concat']); + +}; diff --git a/README.md b/README.md index f772df098023..e2bc81e2b63c 100644 --- a/README.md +++ b/README.md @@ -74,4 +74,4 @@ For information on how contribute to Invoice Ninja, please see our [contributing ## License Invoice Ninja is released under the Attribution Assurance License. -See [LICENSE](LICENSE) for details. +See [LICENSE](LICENSE) for details. \ No newline at end of file diff --git a/app/Commands/Command.php b/app/Commands/Command.php index e0be76979932..d6a8d61150ae 100644 --- a/app/Commands/Command.php +++ b/app/Commands/Command.php @@ -1,10 +1,5 @@ -client->public_id); - if ( ! $account) { - continue; - } $company = $account->company; if ( ! $company->plan || $company->plan == PLAN_FREE) { continue; diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index d2afce01cec5..567c6972489c 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -1,6 +1,4 @@ -info("=== Client:{$client->id} Balance:{$client->balance} Actual Balance:{$client->actual_balance} ==="); + $foundProblem = false; $lastBalance = 0; $lastAdjustment = 0; $lastCreatedAt = null; @@ -183,16 +182,8 @@ class CheckData extends Command { $activities = DB::table('activities') ->where('client_id', '=', $client->id) ->orderBy('activities.id') - ->get( - [ - 'activities.id', - 'activities.created_at', - 'activities.activity_type_id', - 'activities.adjustment', - 'activities.balance', - 'activities.invoice_id' - ] - ); + ->get(['activities.id', 'activities.created_at', 'activities.activity_type_id', 'activities.adjustment', 'activities.balance', 'activities.invoice_id']); + //$this->info(var_dump($activities)); foreach ($activities as $activity) { @@ -240,11 +231,13 @@ class CheckData extends Command { // **Fix for allowing converting a recurring invoice to a normal one without updating the balance** if ($noAdjustment && $invoice->invoice_type_id == INVOICE_TYPE_STANDARD && !$invoice->is_recurring) { $this->info("No adjustment for new invoice:{$activity->invoice_id} amount:{$invoice->amount} invoiceTypeId:{$invoice->invoice_type_id} isRecurring:{$invoice->is_recurring}"); + $foundProblem = true; $clientFix += $invoice->amount; $activityFix = $invoice->amount; // **Fix for updating balance when creating a quote or recurring invoice** } elseif ($activity->adjustment != 0 && ($invoice->invoice_type_id == INVOICE_TYPE_QUOTE || $invoice->is_recurring)) { $this->info("Incorrect adjustment for new invoice:{$activity->invoice_id} adjustment:{$activity->adjustment} invoiceTypeId:{$invoice->invoice_type_id} isRecurring:{$invoice->is_recurring}"); + $foundProblem = true; $clientFix -= $activity->adjustment; $activityFix = 0; } @@ -252,6 +245,7 @@ class CheckData extends Command { // **Fix for updating balance when deleting a recurring invoice** if ($activity->adjustment != 0 && $invoice->is_recurring) { $this->info("Incorrect adjustment for deleted invoice adjustment:{$activity->adjustment}"); + $foundProblem = true; if ($activity->balance != $lastBalance) { $clientFix -= $activity->adjustment; } @@ -261,6 +255,7 @@ class CheckData extends Command { // **Fix for updating balance when archiving an invoice** if ($activity->adjustment != 0 && !$invoice->is_recurring) { $this->info("Incorrect adjustment for archiving invoice adjustment:{$activity->adjustment}"); + $foundProblem = true; $activityFix = 0; $clientFix += $activity->adjustment; } @@ -268,10 +263,12 @@ class CheckData extends Command { // **Fix for updating balance when updating recurring invoice** if ($activity->adjustment != 0 && $invoice->is_recurring) { $this->info("Incorrect adjustment for updated recurring invoice adjustment:{$activity->adjustment}"); + $foundProblem = true; $clientFix -= $activity->adjustment; $activityFix = 0; } else if ((strtotime($activity->created_at) - strtotime($lastCreatedAt) <= 1) && $activity->adjustment > 0 && $activity->adjustment == $lastAdjustment) { $this->info("Duplicate adjustment for updated invoice adjustment:{$activity->adjustment}"); + $foundProblem = true; $clientFix -= $activity->adjustment; $activityFix = 0; } @@ -279,6 +276,7 @@ class CheckData extends Command { // **Fix for updating balance when updating a quote** if ($activity->balance != $lastBalance) { $this->info("Incorrect adjustment for updated quote adjustment:{$activity->adjustment}"); + $foundProblem = true; $clientFix += $lastBalance - $activity->balance; $activityFix = 0; } @@ -286,6 +284,7 @@ class CheckData extends Command { // **Fix for deleting payment after deleting invoice** if ($activity->adjustment != 0 && $invoice->is_deleted && $activity->created_at > $invoice->deleted_at) { $this->info("Incorrect adjustment for deleted payment adjustment:{$activity->adjustment}"); + $foundProblem = true; $activityFix = 0; $clientFix -= $activity->adjustment; } diff --git a/app/Console/Commands/CreateTestData.php b/app/Console/Commands/CreateTestData.php index f4364e5d0675..a75922635f75 100644 --- a/app/Console/Commands/CreateTestData.php +++ b/app/Console/Commands/CreateTestData.php @@ -1,8 +1,5 @@ - $invoice->id, @@ -171,9 +167,9 @@ class CreateTestData extends Command } /** - * @param Vendor $vendor + * @param $vendor */ - private function createExpense(Vendor $vendor) + private function createExpense($vendor) { for ($i=0; $i<$this->count; $i++) { $data = [ diff --git a/app/Console/Commands/GenerateResources.php b/app/Console/Commands/GenerateResources.php index 2766a906c1bd..9826f3c70b07 100644 --- a/app/Console/Commands/GenerateResources.php +++ b/app/Console/Commands/GenerateResources.php @@ -1,6 +1,4 @@ -comment(PHP_EOL . Inspiring::quote() . PHP_EOL); - } + /** + * The console command description. + * + * @var string + */ + protected $description = 'Display an inspiring quote'; + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); + } } diff --git a/app/Console/Commands/PruneData.php b/app/Console/Commands/PruneData.php index c7e3f834709a..1c04e1ab5fcf 100644 --- a/app/Console/Commands/PruneData.php +++ b/app/Console/Commands/PruneData.php @@ -1,6 +1,4 @@ -sendOutputTo($logFile) ->daily(); } - - // Reset the invoice schema counter at the turn of the year - $schedule - ->command('ninja:reset-invoice-schema-counter') - ->daily(); } } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 324b7796a959..0eecaba698cb 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -16,17 +16,17 @@ use Illuminate\Validation\ValidationException; class Handler extends ExceptionHandler { - /** - * A list of the exception types that should not be reported. - * - * @var array - */ - protected $dontReport = [ + /** + * A list of the exception types that should not be reported. + * + * @var array + */ + protected $dontReport = [ AuthorizationException::class, HttpException::class, ModelNotFoundException::class, ValidationException::class, - ]; + ]; /** * Report or log an exception. @@ -36,14 +36,14 @@ class Handler extends ExceptionHandler * @param \Exception $e * @return bool|void */ - public function report(Exception $e) - { + public function report(Exception $e) + { // don't show these errors in the logs if ($e instanceof HttpResponseException) { return false; } - - if (Utils::isNinja() && !Utils::isTravis()) { + + if (Utils::isNinja() && ! Utils::isTravis()) { Utils::logError(Utils::getErrorString($e)); return false; } else { @@ -51,16 +51,15 @@ class Handler extends ExceptionHandler } } - /** - * Render an exception into an HTTP response. - * - * @param \Illuminate\Http\Request $request - * @param \Exception $e - * - * @return \Illuminate\Http\Response - */ - public function render($request, Exception $e) - { + /** + * Render an exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @param \Exception $e + * @return \Illuminate\Http\Response + */ + public function render($request, Exception $e) + { if ($e instanceof ModelNotFoundException) { return Redirect::to('/'); } elseif ($e instanceof \Illuminate\Session\TokenMismatchException) { @@ -68,27 +67,26 @@ class Handler extends ExceptionHandler if ($request->path() != 'get_started') { // https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e return redirect() - ->back() - ->withInput($request->except('password', '_token')) - ->with([ - 'warning' => trans('texts.token_expired') - ]); + ->back() + ->withInput($request->except('password', '_token')) + ->with([ + 'warning' => trans('texts.token_expired') + ]); } } // In production, except for maintenance mode, we'll show a custom error screen if (Utils::isNinjaProd() && !Utils::isDownForMaintenance() - && !($e instanceof HttpResponseException) - ) { + && !($e instanceof HttpResponseException)) { $data = [ 'error' => get_class($e), 'hideHeader' => true, ]; - + return response()->view('error', $data); } else { return parent::render($request, $e); } - } + } } diff --git a/app/Handlers/InvoiceEventHandler.php b/app/Handlers/InvoiceEventHandler.php index 986cac7a08be..924a9590ee36 100644 --- a/app/Handlers/InvoiceEventHandler.php +++ b/app/Handlers/InvoiceEventHandler.php @@ -1,83 +1,51 @@ -userMailer = $userMailer; + $this->contactMailer = $contactMailer; + } - /** - * InvoiceEventHandler constructor. - * - * @param UserMailer $userMailer - * @param ContactMailer $contactMailer - */ - public function __construct(UserMailer $userMailer, ContactMailer $contactMailer) - { - $this->userMailer = $userMailer; - $this->contactMailer = $contactMailer; - } + public function subscribe($events) + { + $events->listen('invoice.sent', 'InvoiceEventHandler@onSent'); + $events->listen('invoice.viewed', 'InvoiceEventHandler@onViewed'); + $events->listen('invoice.paid', 'InvoiceEventHandler@onPaid'); + } - /** - * @param $events - */ - public function subscribe($events) - { - $events->listen('invoice.sent', 'InvoiceEventHandler@onSent'); - $events->listen('invoice.viewed', 'InvoiceEventHandler@onViewed'); - $events->listen('invoice.paid', 'InvoiceEventHandler@onPaid'); - } + public function onSent($invoice) + { + $this->sendNotifications($invoice, 'sent'); + } - /** - * @param Invoice $invoice - */ - public function onSent(Invoice $invoice) - { - $this->sendNotifications($invoice, 'sent'); - } + public function onViewed($invoice) + { + $this->sendNotifications($invoice, 'viewed'); + } - /** - * @param Invoice $invoice - */ - public function onViewed(Invoice $invoice) - { - $this->sendNotifications($invoice, 'viewed'); - } + public function onPaid($payment) + { + $this->contactMailer->sendPaymentConfirmation($payment); - /** - * @param Payment $payment - */ - public function onPaid(Payment $payment) - { - $this->contactMailer->sendPaymentConfirmation($payment); + $this->sendNotifications($payment->invoice, 'paid', $payment); + } - $this->sendNotifications($payment->invoice, 'paid', $payment); - } - - /** - * @param Invoice $invoice - * @param $type - * @param null $payment - */ - private function sendNotifications(Invoice $invoice, $type, $payment = null) - { - foreach ($invoice->account->users as $user) { - if ($user->{'notify_' . $type}) { + private function sendNotifications($invoice, $type, $payment = null) + { + foreach ($invoice->account->users as $user) + { + if ($user->{'notify_' . $type}) + { $this->userMailer->sendNotification($user, $invoice, $type, $payment); - } - } - } + } + } + } } \ No newline at end of file diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 34890a48e1e3..b1bc186d9f84 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -1461,6 +1461,7 @@ class AccountController extends BaseController return trans('texts.create_invoice_for_sample'); } + /** @var \App\Models\Account $account */ $account = Auth::user()->account; $invitation = $invoice->invitations->first(); diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index 5d432881d261..1a3db4b8d7cf 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -62,7 +62,7 @@ class CreditController extends BaseController 'method' => 'POST', 'url' => 'credits', 'title' => trans('texts.new_credit'), - 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), + 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ]; return View::make('credits.edit', $data); diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php index 4bb93432fa20..f25a027f8662 100644 --- a/app/Http/Controllers/DocumentController.php +++ b/app/Http/Controllers/DocumentController.php @@ -1,6 +1,5 @@ documentRepo->upload($request->all(), $doc_array); if(is_string($result)){ diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 7c4df9d3d6f6..3447e81f538d 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -1,13 +1,11 @@ -registered; } - /** - * @return bool - */ public static function isConfirmed() { return Auth::check() && Auth::user()->confirmed; } - /** - * @return bool - */ public static function isDatabaseSetup() { try { @@ -59,89 +44,59 @@ class Utils } } - /** - * @return bool - */ public static function isDownForMaintenance() { return file_exists(storage_path() . '/framework/down'); } - /** - * @return bool - */ public static function isCron() { return php_sapi_name() == 'cli'; } - /** - * @return bool - */ public static function isTravis() { return env('TRAVIS') == 'true'; } - /** - * @return bool - */ public static function isNinja() { return self::isNinjaProd() || self::isNinjaDev(); } - /** - * @return bool - */ public static function isNinjaProd() { - if (static::isReseller()) { + if (Utils::isReseller()) { return true; } return env('NINJA_PROD') == 'true'; } - /** - * @return bool - */ public static function isNinjaDev() { return env('NINJA_DEV') == 'true'; } - /** - * @return bool - */ public static function requireHTTPS() { - if (app('request')->root() === 'http://ninja.dev' || app('request')->root() === 'http://ninja.dev:8000') { + if (Request::root() === 'http://ninja.dev' || Request::root() === 'http://ninja.dev:8000') { return false; } - return static::isNinjaProd() || env('REQUIRE_HTTPS'); + return Utils::isNinjaProd() || (isset($_ENV['REQUIRE_HTTPS']) && $_ENV['REQUIRE_HTTPS'] == 'true'); } - /** - * @return bool - */ public static function isReseller() { - return self::getResellerType() ? true : false; + return Utils::getResllerType() ? true : false; } - /** - * @return array|bool - */ - public static function getResellerType() + public static function getResllerType() { return isset($_ENV['RESELLER_TYPE']) ? $_ENV['RESELLER_TYPE'] : false; } - /** - * @return bool - */ public static function isOAuthEnabled() { $providers = [ @@ -161,80 +116,46 @@ class Utils return false; } - /** - * @return bool - */ public static function allowNewAccounts() { - return static::isNinja() || Auth::check(); + return Utils::isNinja() || Auth::check(); } - /** - * @return bool - */ public static function isPro() { return Auth::check() && Auth::user()->isPro(); } - /** - * @param $feature - * - * @return bool - */ public static function hasFeature($feature) { return Auth::check() && Auth::user()->hasFeature($feature); } - /** - * @return bool - */ public static function isAdmin() { return Auth::check() && Auth::user()->is_admin; } - /** - * @param $permission - * @param bool $requireAll - * - * @return bool - */ public static function hasPermission($permission, $requireAll = false) { return Auth::check() && Auth::user()->hasPermission($permission, $requireAll); } - /** - * @param $permission - * - * @return bool - */ public static function hasAllPermissions($permission) { return Auth::check() && Auth::user()->hasPermission($permission); } - /** - * @return bool - */ public static function isTrial() { return Auth::check() && Auth::user()->isTrial(); } - /** - * @return bool - */ public static function isEnglish() { return App::getLocale() == 'en'; } - /** - * @return string - */ public static function getLocaleRegion() { $parts = explode('_', App::getLocale()); @@ -242,21 +163,15 @@ class Utils return count($parts) ? $parts[0] : 'en'; } - /** - * @return mixed - */ public static function getUserType() { - if (static::isNinja()) { + if (Utils::isNinja()) { return USER_TYPE_CLOUD_HOST; + } else { + return USER_TYPE_SELF_HOST; } - - return USER_TYPE_SELF_HOST; } - /** - * @return array|bool - */ public static function getDemoAccountId() { return isset($_ENV[DEMO_ACCOUNT_ID]) ? $_ENV[DEMO_ACCOUNT_ID] : false; @@ -265,7 +180,7 @@ class Utils public static function getNewsFeedResponse($userType = false) { if (!$userType) { - $userType = static::getUserType(); + $userType = Utils::getUserType(); } $response = new stdClass(); @@ -276,9 +191,6 @@ class Utils return $response; } - /** - * @return string - */ public static function getLastURL() { if (!count(Session::get(RECENTLY_VIEWED))) { @@ -289,31 +201,21 @@ class Utils $last = $history[0]; $penultimate = count($history) > 1 ? $history[1] : $last; - return app('request')->url() == $last->url ? $penultimate->url : $last->url; + return Request::url() == $last->url ? $penultimate->url : $last->url; } - /** - * @param $feature - * - * @return string - */ public static function getProLabel($feature) { if (Auth::check() && !Auth::user()->isPro() && $feature == ACCOUNT_ADVANCED_SETTINGS) { return ' PRO'; + } else { + return ''; } - - return ''; } - /** - * @param array $plan - * - * @return int - */ - public static function getPlanPrice(array $plan) + public static function getPlanPrice($plan) { $term = $plan['term']; $numUsers = $plan['num_users']; @@ -342,11 +244,6 @@ class Utils return $price; } - /** - * @param $max - * - * @return int - */ public static function getMinNumUsers($max) { if ($max <= 2) { @@ -358,19 +255,11 @@ class Utils } } - /** - * @return string - */ public static function basePath() { return substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') + 1); } - /** - * @param $input - * - * @return array - */ public static function trans($input) { $data = []; @@ -388,12 +277,6 @@ class Utils return $data; } - /** - * @param bool $message - * @param bool $exception - * - * @return $this - */ public static function fatalError($message = false, $exception = false) { if (!$message) { @@ -410,11 +293,6 @@ class Utils return View::make('error', $data)->with('error', $message); } - /** - * @param $exception - * - * @return string - */ public static function getErrorString($exception) { $class = get_class($exception); @@ -422,13 +300,6 @@ class Utils return "***{$class}*** [{$code}] : {$exception->getFile()} [Line {$exception->getLine()}] => {$exception->getMessage()}"; } - /** - * @param $error - * @param string $context - * @param bool $info - * - * @return string - */ public static function logError($error, $context = 'PHP', $info = false) { if ($error instanceof Exception) { @@ -446,10 +317,10 @@ class Utils 'user_id' => Auth::check() ? Auth::user()->id : 0, 'account_id' => Auth::check() ? Auth::user()->account_id : 0, 'user_name' => Auth::check() ? Auth::user()->getDisplayName() : '', - 'method' => app('request')->method(), - 'url' => Input::get('url', app('request')->url()), + 'method' => Request::method(), + 'url' => Input::get('url', Request::url()), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', - 'ip' => app('request')->getClientIp(), + 'ip' => Request::getClientIp(), 'count' => Session::get('error_count', 0), ]; @@ -458,13 +329,15 @@ class Utils } else { Log::error($error."\n", $data); } + + /* + Mail::queue('emails.error', ['message'=>$error.' '.json_encode($data)], function($message) + { + $message->to($email)->subject($subject); + }); + */ } - /** - * @param $value - * - * @return float - */ public static function parseFloat($value) { $value = preg_replace('/[^0-9\.\-]/', '', $value); @@ -472,11 +345,6 @@ class Utils return floatval($value); } - /** - * @param $value - * - * @return int - */ public static function parseInt($value) { $value = preg_replace('/[^0-9]/', '', $value); @@ -484,12 +352,6 @@ class Utils return intval($value); } - /** - * @param $id - * @param $type - * - * @return null - */ public static function getFromCache($id, $type) { $cache = Cache::get($type); @@ -498,19 +360,13 @@ class Utils return null; } - return $cache->filter(function($item) use ($id) { + $data = $cache->filter(function($item) use ($id) { return $item->id == $id; - })->first(); + }); + + return $data->first(); } - /** - * @param $value - * @param bool $currencyId - * @param bool $countryId - * @param bool $showCode - * - * @return string - */ public static function formatMoney($value, $currencyId = false, $countryId = false, $showCode = false) { if (!$value) { @@ -555,12 +411,6 @@ class Utils } } - /** - * @param $string - * @param $count - * - * @return mixed - */ public static function pluralize($string, $count) { $field = $count == 1 ? $string : $string.'s'; @@ -569,11 +419,6 @@ class Utils return $string; } - /** - * @param $type - * - * @return string - */ public static function pluralizeEntityType($type) { if ($type === ENTITY_EXPENSE_CATEGORY) { @@ -583,11 +428,6 @@ class Utils } } - /** - * @param $value - * - * @return string - */ public static function maskAccountNumber($value) { $length = strlen($value); @@ -599,13 +439,7 @@ class Utils return str_repeat('*', $length - 4) . $lastDigits; } - /** - * http://wephp.co/detect-credit-card-type-php/ - * - * @param $number - * - * @return string - */ + // http://wephp.co/detect-credit-card-type-php/ public static function getCardType($number) { $number = preg_replace('/[^\d]/', '', $number); @@ -622,92 +456,52 @@ class Utils return 'MasterCard'; } elseif (preg_match('/^4[0-9]{12}(?:[0-9]{3})?$/', $number)) { return 'Visa'; + } else { + return 'Unknown'; } - - return 'Unknown'; } - /** - * @param $data - * - * @return mixed - */ public static function toArray($data) { return json_decode(json_encode((array) $data), true); } - /** - * @param $string - * - * @return mixed - */ public static function toSpaceCase($string) { return preg_replace('/([a-z])([A-Z])/s', '$1 $2', $string); } - /** - * @param $string - * - * @return mixed - */ public static function toSnakeCase($string) { return preg_replace('/([a-z])([A-Z])/s', '$1_$2', $string); } - /** - * @param $string - * - * @return string - */ public static function toCamelCase($string) { return lcfirst(static::toClassCase($string)); } - /** - * @param $string - * - * @return mixed - */ public static function toClassCase($string) { return str_replace(' ', '', ucwords(str_replace('_', ' ', $string))); } - /** - * @param $timestamp - * - * @return string - */ public static function timestampToDateTimeString($timestamp) { $timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE); $format = Session::get(SESSION_DATETIME_FORMAT, DEFAULT_DATETIME_FORMAT); - return self::timestampToString($timestamp, $timezone, $format); + return Utils::timestampToString($timestamp, $timezone, $format); } - /** - * @param $timestamp - * - * @return string - */ public static function timestampToDateString($timestamp) { $timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE); $format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT); - return self::timestampToString($timestamp, $timezone, $format); + return Utils::timestampToString($timestamp, $timezone, $format); } - /** - * @param $date - * - * @return bool|string - */ public static function dateToString($date) { if (!$date) { @@ -723,16 +517,9 @@ class Utils $timestamp = $dateTime->getTimestamp(); $format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT); - return static::timestampToString($timestamp, false, $format); + return Utils::timestampToString($timestamp, false, $format); } - /** - * @param $timestamp - * @param bool $timezone - * @param $format - * - * @return string - */ public static function timestampToString($timestamp, $timezone = false, $format) { if (!$timestamp) { @@ -749,12 +536,6 @@ class Utils return $date->format($format); } - /** - * @param $date - * @param bool $formatResult - * - * @return DateTime|string|void - */ public static function toSqlDate($date, $formatResult = true) { if (!$date) { @@ -770,12 +551,6 @@ class Utils return $formatResult ? $dateTime->format('Y-m-d') : $dateTime; } - /** - * @param $date - * @param bool $formatResult - * - * @return DateTime|string - */ public static function fromSqlDate($date, $formatResult = true) { if (!$date || $date == '0000-00-00') { @@ -791,12 +566,6 @@ class Utils return $formatResult ? $dateTime->format($format) : $dateTime; } - /** - * @param $date - * @param bool $formatResult - * - * @return DateTime|string - */ public static function fromSqlDateTime($date, $formatResult = true) { if (!$date || $date == '0000-00-00 00:00:00') { @@ -812,23 +581,13 @@ class Utils return $formatResult ? $dateTime->format($format) : $dateTime; } - /** - * @param $time - * - * @return mixed - */ - public static function formatTime($time) + public static function formatTime($t) { // http://stackoverflow.com/a/3172665 $f = ':'; - return sprintf('%02d%s%02d%s%02d', floor($time/3600), $f, ($time/60)%60, $f, $time%60); + return sprintf('%02d%s%02d%s%02d', floor($t/3600), $f, ($t/60)%60, $f, $t%60); } - /** - * @param bool $formatResult - * - * @return mixed - */ public static function today($formatResult = true) { $timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE); @@ -843,15 +602,10 @@ class Utils } } - /** - * @param $name - * @param $type - * @param bool $url - */ public static function trackViewed($name, $type, $url = false) { if (!$url) { - $url = app('request')->url(); + $url = Request::url(); } $viewed = Session::get(RECENTLY_VIEWED); @@ -893,11 +647,6 @@ class Utils Session::put(RECENTLY_VIEWED, $data); } - /** - * @param $str - * - * @return mixed|string - */ public static function processVariables($str) { if (!$str) { @@ -926,7 +675,7 @@ class Utils $offset = intval($minArray[1]) * -1; } - $val = self::getDatePart($variable, $offset); + $val = Utils::getDatePart($variable, $offset); $str = str_replace($match, $val, $str); } } @@ -934,29 +683,18 @@ class Utils return $str; } - /** - * @param $part - * @param $offset - * - * @return int|string|\Symfony\Component\Translation\TranslatorInterface - */ private static function getDatePart($part, $offset) { $offset = intval($offset); if ($part == 'MONTH') { - return self::getMonth($offset); + return Utils::getMonth($offset); } elseif ($part == 'QUARTER') { - return self::getQuarter($offset); + return Utils::getQuarter($offset); } elseif ($part == 'YEAR') { - return self::getYear($offset); + return Utils::getYear($offset); } } - /** - * @param $offset - * - * @return string|\Symfony\Component\Translation\TranslatorInterface - */ private static function getMonth($offset) { $months = ['january', 'february', 'march', 'april', 'may', 'june', @@ -974,11 +712,6 @@ class Utils return trans('texts.' . $months[$month]); } - /** - * @param $offset - * - * @return string - */ private static function getQuarter($offset) { $month = intval(date('n')) - 1; @@ -992,11 +725,6 @@ class Utils return 'Q'.$quarter; } - /** - * @param $offset - * - * @return int - */ private static function getYear($offset) { $year = intval(date('Y')); @@ -1004,31 +732,16 @@ class Utils return $year + $offset; } - /** - * @param $entityType - * - * @return string - */ public static function getEntityClass($entityType) { return 'App\\Models\\' . static::getEntityName($entityType); } - /** - * @param $entityType - * - * @return string - */ public static function getEntityName($entityType) { - return ucwords(static::toCamelCase($entityType)); + return ucwords(Utils::toCamelCase($entityType)); } - /** - * @param $model - * - * @return string - */ public static function getClientDisplayName($model) { if ($model->client_name) { @@ -1040,31 +753,17 @@ class Utils } } - /** - * @param $model - * - * @return string - */ public static function getVendorDisplayName($model) { - if(is_null($model)) { + if(is_null($model)) return ''; - } - if($model->vendor_name) { + if($model->vendor_name) return $model->vendor_name; - } return 'No vendor name'; } - /** - * @param $firstName - * @param $lastName - * @param $email - * - * @return string - */ public static function getPersonDisplayName($firstName, $lastName, $email) { if ($firstName || $lastName) { @@ -1076,9 +775,6 @@ class Utils } } - /** - * @return mixed - */ public static function generateLicense() { $parts = []; @@ -1089,11 +785,6 @@ class Utils return implode('-', $parts); } - /** - * @param string $eventName - * - * @return bool - */ public static function lookupEventId($eventName) { if ($eventName == 'create_client') { @@ -1106,15 +797,11 @@ class Utils return EVENT_CREATE_PAYMENT; } elseif ($eventName == 'create_vendor') { return EVENT_CREATE_VENDOR; + } else { + return false; } - - return false; } - /** - * @param $subscription - * @param $data - */ public static function notifyZapier($subscription, $data) { $curl = curl_init(); @@ -1131,6 +818,7 @@ class Utils curl_setopt_array($curl, $opts); + $result = curl_exec($curl); $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); @@ -1140,57 +828,37 @@ class Utils } } - /** - * @param int $count - * - * @return array - */ public static function getApiHeaders($count = 0) { return [ 'Content-Type' => 'application/json', + //'Access-Control-Allow-Origin' => '*', + //'Access-Control-Allow-Methods' => 'GET', + //'Access-Control-Allow-Headers' => 'Origin, Content-Type, Accept, Authorization, X-Requested-With', + //'Access-Control-Allow-Credentials' => 'true', 'X-Total-Count' => $count, 'X-Ninja-Version' => NINJA_VERSION, + //'X-Rate-Limit-Limit' - The number of allowed requests in the current period + //'X-Rate-Limit-Remaining' - The number of remaining requests in the current period + //'X-Rate-Limit-Reset' - The number of seconds left in the current period, ]; } - /** - * @param $value - * - * @return bool - */ public static function isEmpty($value) { return !$value || $value == '0' || $value == '0.00' || $value == '0,00'; } - /** - * @param $haystack - * @param $needle - * - * @return bool - */ public static function startsWith($haystack, $needle) { return $needle === '' || strpos($haystack, $needle) === 0; } - /** - * @param $haystack - * @param $needle - * - * @return bool - */ public static function endsWith($haystack, $needle) { return $needle === '' || substr($haystack, -strlen($needle)) === $needle; } - /** - * @param $model - * - * @return string - */ public static function getEntityRowClass($model) { $str = ''; @@ -1210,11 +878,6 @@ class Utils return $str; } - /** - * @param $output - * @param $data - * @param bool $headers - */ public static function exportData($output, $data, $headers = false) { if ($headers) { @@ -1230,23 +893,26 @@ class Utils fwrite($output, "\n"); } - /** - * @param $values - * - * @return bool|mixed - */ public static function getFirst($values) { if (is_array($values)) { return count($values) ? $values[0] : false; + } else { + return $values; } - - return $values; } - /** - * @return string - */ + // nouns in German and French should be uppercase + // TODO remove this + public static function transFlowText($key) + { + $str = trans("texts.$key"); + if (!in_array(App::getLocale(), ['de', 'fr'])) { + $str = strtolower($str); + } + return $str; + } + public static function getSubdomainPlaceholder() { $parts = parse_url(SITE_URL); @@ -1260,9 +926,6 @@ class Utils return $subdomain; } - /** - * @return string - */ public static function getDomainPlaceholder() { $parts = parse_url(SITE_URL); @@ -1282,12 +945,6 @@ class Utils return $domain; } - /** - * @param string $domain - * @param $subdomain - * - * @return mixed - */ public static function replaceSubdomain($domain, $subdomain) { $parsedUrl = parse_url($domain); @@ -1299,11 +956,6 @@ class Utils return $domain; } - /** - * @param string $name - * - * @return array - */ public static function splitName($name) { $name = trim($name); @@ -1312,25 +964,12 @@ class Utils return [$firstName, $lastName]; } - /** - * @param string $string - * - * @return string - */ public static function decodePDF($string) { $string = str_replace('data:application/pdf;base64,', '', $string); return base64_decode($string); } - /** - * @param $city - * @param $state - * @param $postalCode - * @param $swap - * - * @return string - */ public static function cityStateZip($city, $state, $postalCode, $swap) { $str = $city; @@ -1344,16 +983,11 @@ class Utils if ($swap) { return $postalCode . ' ' . $str; + } else { + return $str . ' ' . $postalCode; } - - return $str . ' ' . $postalCode; } - /** - * @param $website - * - * @return string - */ public static function formatWebsite($website) { if (!$website) { @@ -1373,26 +1007,13 @@ class Utils return link_to($link, $title, ['target' => '_blank']); } - /** - * @param $adjustment - * @param $currencyId - * @param $countryId - * - * @return string - */ public static function wrapAdjustment($adjustment, $currencyId, $countryId) { $class = $adjustment <= 0 ? 'success' : 'default'; - $adjustment = self::formatMoney($adjustment, $currencyId, $countryId); + $adjustment = Utils::formatMoney($adjustment, $currencyId, $countryId); return "

$adjustment

"; } - /** - * @param $entity1 - * @param $entity2 - * - * @return mixed - */ public static function copyContext($entity1, $entity2) { if (!$entity2) { @@ -1407,6 +1028,7 @@ class Utils 'invitation_id' ]; + $fields1 = $entity1->getAttributes(); $fields2 = $entity2->getAttributes(); foreach ($fields as $field) { @@ -1418,11 +1040,6 @@ class Utils return $entity1; } - /** - * @param string $url - * - * @return string - */ public static function addHttp($url) { if (!preg_match('~^(?:f|ht)tps?://~i', $url)) { @@ -1432,12 +1049,7 @@ class Utils return $url; } - /** - * @param AccountGateway|null $accountGateway - * - * @return WePay - */ - public static function setupWePay(AccountGateway $accountGateway = null) + public static function setupWePay($accountGateway = null) { if (WePay::getEnvironment() == 'none') { if (WEPAY_ENVIRONMENT == WEPAY_STAGE) { @@ -1449,9 +1061,9 @@ class Utils if ($accountGateway) { return new WePay($accountGateway->getConfig()->accessToken); + } else { + return new WePay(null); } - - return new WePay(null); } /** diff --git a/app/Listeners/AnalyticsListener.php b/app/Listeners/AnalyticsListener.php index 7015b087cce7..7234e1a52c90 100644 --- a/app/Listeners/AnalyticsListener.php +++ b/app/Listeners/AnalyticsListener.php @@ -56,4 +56,4 @@ class AnalyticsListener curl_setopt_array($curl, $opts); curl_close($curl); } -} +} \ No newline at end of file diff --git a/app/Models/Client.php b/app/Models/Client.php index 0949d4948f11..6d6dd0b4bc34 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -49,13 +49,6 @@ class Client extends EntityModel 'website', ]; - /** - * @var array - */ - protected $appends = [ - 'display_name', - ]; - /** * @var string */ @@ -338,17 +331,6 @@ class Client extends EntityModel return $contact->getDisplayName(); } - /** - * Making the virtual property display_name accessible - * via an accessor - * - * @return mixed|string - */ - public function getDisplayNameAttribute() - { - return $this->getDisplayName(); - } - /** * @return string */ diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 95a0cfaa5674..432e811bff6a 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -140,9 +140,7 @@ class Invoice extends EntityModel implements BalanceAffecting */ public function getDisplayName() { - return $this->is_recurring - ? trans('texts.recurring') - : $this->invoice_number.' ('.$this->client->display_name.')'; + return $this->is_recurring ? trans('texts.recurring') : $this->invoice_number; } /** diff --git a/app/Ninja/Datatables/AccountGatewayDatatable.php b/app/Ninja/Datatables/AccountGatewayDatatable.php index b56a40311328..09c701873462 100644 --- a/app/Ninja/Datatables/AccountGatewayDatatable.php +++ b/app/Ninja/Datatables/AccountGatewayDatatable.php @@ -1,20 +1,12 @@ -public_id}"); }, - function () { + function ($model) { return Auth::user()->can('create', ENTITY_TASK); } ], @@ -94,7 +83,7 @@ class ClientDatatable extends EntityDatatable function ($model) { return URL::to("invoices/create/{$model->public_id}"); }, - function () { + function ($model) { return Auth::user()->can('create', ENTITY_INVOICE); } ], @@ -103,13 +92,13 @@ class ClientDatatable extends EntityDatatable function ($model) { return URL::to("quotes/create/{$model->public_id}"); }, - function () { + function ($model) { return Auth::user()->hasFeature(FEATURE_QUOTES) && Auth::user()->can('create', ENTITY_INVOICE); } ], [ '--divider--', function(){return false;}, - function () { + function ($model) { $user = Auth::user(); return ($user->can('create', ENTITY_TASK) || $user->can('create', ENTITY_INVOICE)) && ($user->can('create', ENTITY_PAYMENT) || $user->can('create', ENTITY_CREDIT) || $user->can('create', ENTITY_EXPENSE)); } @@ -119,7 +108,7 @@ class ClientDatatable extends EntityDatatable function ($model) { return URL::to("payments/create/{$model->public_id}"); }, - function () { + function ($model) { return Auth::user()->can('create', ENTITY_PAYMENT); } ], @@ -128,7 +117,7 @@ class ClientDatatable extends EntityDatatable function ($model) { return URL::to("credits/create/{$model->public_id}"); }, - function () { + function ($model) { return Auth::user()->can('create', ENTITY_CREDIT); } ], @@ -137,7 +126,7 @@ class ClientDatatable extends EntityDatatable function ($model) { return URL::to("expenses/create/0/{$model->public_id}"); }, - function () { + function ($model) { return Auth::user()->can('create', ENTITY_EXPENSE); } ] diff --git a/app/Ninja/Datatables/CreditDatatable.php b/app/Ninja/Datatables/CreditDatatable.php index 931dfd23fd17..7f258e377d1d 100644 --- a/app/Ninja/Datatables/CreditDatatable.php +++ b/app/Ninja/Datatables/CreditDatatable.php @@ -1,21 +1,13 @@ -client_public_id}") . '?paymentTypeId=1'; }, - function () { + function ($model) { return Auth::user()->can('create', ENTITY_PAYMENT); } ] diff --git a/app/Ninja/Datatables/EntityDatatable.php b/app/Ninja/Datatables/EntityDatatable.php index d5dabbff95ad..085645ff2069 100644 --- a/app/Ninja/Datatables/EntityDatatable.php +++ b/app/Ninja/Datatables/EntityDatatable.php @@ -1,47 +1,22 @@ -isBulkEdit = $isBulkEdit; $this->hideClient = $hideClient; } - /** - * @return array - */ public function columns() { return []; } - /** - * @return array - */ public function actions() { return []; diff --git a/app/Ninja/Datatables/ExpenseCategoryDatatable.php b/app/Ninja/Datatables/ExpenseCategoryDatatable.php index 55a37cbb18cc..7ef850b0a49c 100644 --- a/app/Ninja/Datatables/ExpenseCategoryDatatable.php +++ b/app/Ninja/Datatables/ExpenseCategoryDatatable.php @@ -1,20 +1,13 @@ -
$label
"; } + } diff --git a/app/Ninja/Datatables/InvoiceDatatable.php b/app/Ninja/Datatables/InvoiceDatatable.php index 01428f29e2b0..b9fa70aa0a43 100644 --- a/app/Ninja/Datatables/InvoiceDatatable.php +++ b/app/Ninja/Datatables/InvoiceDatatable.php @@ -1,21 +1,13 @@ -entityType; @@ -80,9 +72,6 @@ class InvoiceDatatable extends EntityDatatable ]; } - /** - * @return array - */ public function actions() { $entityType = $this->entityType; @@ -102,7 +91,7 @@ class InvoiceDatatable extends EntityDatatable function ($model) use ($entityType) { return URL::to("{$entityType}s/{$model->public_id}/clone"); }, - function () { + function ($model) { return Auth::user()->can('create', ENTITY_INVOICE); } ], @@ -166,11 +155,6 @@ class InvoiceDatatable extends EntityDatatable ]; } - /** - * @param $model - * - * @return string - */ private function getStatusLabel($model) { $entityType = $this->entityType; @@ -205,4 +189,5 @@ class InvoiceDatatable extends EntityDatatable return "

$label

"; } + } diff --git a/app/Ninja/Datatables/PaymentDatatable.php b/app/Ninja/Datatables/PaymentDatatable.php index c8175e4a924f..20f2cd025892 100644 --- a/app/Ninja/Datatables/PaymentDatatable.php +++ b/app/Ninja/Datatables/PaymentDatatable.php @@ -1,32 +1,20 @@ -payment_status_name)); $class = 'default'; diff --git a/app/Ninja/Datatables/ProductDatatable.php b/app/Ninja/Datatables/ProductDatatable.php index f412e84788cd..a5b3cbfc218d 100644 --- a/app/Ninja/Datatables/ProductDatatable.php +++ b/app/Ninja/Datatables/ProductDatatable.php @@ -1,22 +1,14 @@ -invoice_number) { diff --git a/app/Ninja/Datatables/TaxRateDatatable.php b/app/Ninja/Datatables/TaxRateDatatable.php index 88fe2e0dd16c..3e16aba9ee19 100644 --- a/app/Ninja/Datatables/TaxRateDatatable.php +++ b/app/Ninja/Datatables/TaxRateDatatable.php @@ -1,19 +1,11 @@ -accountGateway = $accountGateway; $this->invitation = $invitation; @@ -91,9 +54,6 @@ class BasePaymentDriver } } - /** - * @return array - */ public function gatewayTypes() { return [ @@ -106,74 +66,44 @@ class BasePaymentDriver return in_array($type, $this->gatewayTypes()); } - /** - * When set to true we won't pass the card details with the form - * - * @return bool - */ + // when set to true we won't pass the card details with the form public function tokenize() { return false; } - /** - * Set payment method as pending until confirmed - * - * @return bool - */ + // set payment method as pending until confirmed public function isTwoStep() { return false; } - /** - * @return string - */ public function providerName() { return strtolower($this->accountGateway->gateway->provider); } - /** - * @return mixed - */ protected function invoice() { return $this->invitation->invoice; } - /** - * @return mixed - */ protected function contact() { return $this->invitation->contact; } - /** - * @return mixed - */ protected function client() { return $this->invoice()->client; } - /** - * @return mixed - */ protected function account() { return $this->client()->account; } - /** - * @param array $input - * @param bool $sourceId - * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View - * @throws Exception - */ - public function startPurchase(array $input = null, $sourceId = false) + public function startPurchase($input = false, $sourceId = false) { $this->input = $input; $this->sourceId = $sourceId; @@ -220,11 +150,7 @@ class BasePaymentDriver return view($this->paymentView(), $data); } - /** - * Check if a custom view exists for this provider - * - * @return mixed - */ + // check if a custom view exists for this provider protected function paymentView() { $file = sprintf('%s/views/payments/%s/%s.blade.php', resource_path(), $this->providerName(), $this->gatewayType); @@ -236,11 +162,7 @@ class BasePaymentDriver } } - /** - * Check if a custom partial exists for this provider - * - * @return bool - */ + // check if a custom partial exists for this provider public function partialView() { $file = sprintf('%s/views/payments/%s/partial.blade.php', resource_path(), $this->providerName()); @@ -252,9 +174,6 @@ class BasePaymentDriver } } - /** - * @return array - */ public function rules() { $rules = []; @@ -290,9 +209,6 @@ class BasePaymentDriver return $rules; } - /** - * @return mixed - */ protected function gateway() { if ($this->gateway) { @@ -305,14 +221,7 @@ class BasePaymentDriver return $this->gateway; } - /** - * @param bool $input - * @param PaymentMethod $paymentMethod - * - * @return Payment|mixed|void - * @throws Exception - */ - public function completeOnsitePurchase($input = false, PaymentMethod $paymentMethod = null) + public function completeOnsitePurchase($input = false, $paymentMethod = false) { $this->input = count($input) ? $input : false; $gateway = $this->gateway(); @@ -406,12 +315,7 @@ class BasePaymentDriver $client->save(); } - /** - * @param PaymentMethod $paymentMethod - * - * @return array - */ - protected function paymentDetails(PaymentMethod $paymentMethod = null) + protected function paymentDetails($paymentMethod = false) { $invoice = $this->invoice(); $completeUrl = url('complete/' . $this->invitation->invitation_key . '/' . $this->gatewayType); @@ -441,13 +345,9 @@ class BasePaymentDriver return $data; } - /** - * @param array $input - * - * @return array - */ - private function paymentDetailsFromInput(array $input) + private function paymentDetailsFromInput($input) { + $invoice = $this->invoice(); $client = $this->client(); $data = [ @@ -488,11 +388,9 @@ class BasePaymentDriver return $data; } - /** - * @return array - */ public function paymentDetailsFromClient() { + $invoice = $this->invoice(); $client = $this->client(); $contact = $this->invitation->contact ?: $client->contacts()->first(); @@ -518,9 +416,6 @@ class BasePaymentDriver ]; } - /** - * @return bool - */ protected function shouldCreateToken() { if ($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER)) { @@ -538,11 +433,19 @@ class BasePaymentDriver return boolval(array_get($this->input, 'token_billing')); } - /** - * @param bool $clientId - * - * @return null - */ + /* + protected function tokenDetails() + { + $details = []; + + if ($customer = $this->customer()) { + $details['customerReference'] = $customer->token; + } + + return $details; + } + */ + public function customer($clientId = false) { if ($this->customer) { @@ -564,51 +467,27 @@ class BasePaymentDriver return $this->customer; } - /** - * @param $customer - * - * @return bool - */ protected function checkCustomerExists($customer) { return true; } - /** - * @param $client - * @param $publicId - * @param $amount1 - * @param $amount2 - * - * @throws Exception - */ public function verifyBankAccount($client, $publicId, $amount1, $amount2) { throw new Exception('verifyBankAccount not implemented'); } - /** - * @param PaymentMethod $paymentMethod - * @throws Exception - */ - public function removePaymentMethod(PaymentMethod $paymentMethod) + public function removePaymentMethod($paymentMethod) { $paymentMethod->delete(); } - /** - * Some gateways (ie, Checkout.com and Braintree) require generating a token before paying for the invoice - * - * @return null - */ + // Some gateways (ie, Checkout.com and Braintree) require generating a token before paying for the invoice public function createTransactionToken() { return null; } - /** - * @return PaymentMethod - */ public function createToken() { $account = $this->account(); @@ -623,6 +502,17 @@ class BasePaymentDriver $customer->save(); } + /* + // archive the old payment method + $paymentMethod = PaymentMethod::clientId($this->client()->id) + ->isBankAccount($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER)) + ->first(); + + if ($paymentMethod) { + $paymentMethod->delete(); + } + */ + $paymentMethod = $this->createPaymentMethod($customer); if ($paymentMethod && ! $customer->default_payment_method_id) { @@ -633,24 +523,13 @@ class BasePaymentDriver return $paymentMethod; } - /** - * @param $customer - * - * @return mixed - */ protected function creatingCustomer($customer) { return $customer; } - /** - * @param $customer - * - * @return PaymentMethod - */ public function createPaymentMethod($customer) { - /** @var PaymentMethod $paymentMethod */ $paymentMethod = PaymentMethod::createNew($this->invitation); $paymentMethod->contact_id = $this->contact()->id; $paymentMethod->ip = Request::ip(); @@ -665,12 +544,7 @@ class BasePaymentDriver return $paymentMethod; } - /** - * @param PaymentMethod $paymentMethod - * - * @return PaymentMethod - */ - protected function creatingPaymentMethod(PaymentMethod $paymentMethod) + protected function creatingPaymentMethod($paymentMethod) { return $paymentMethod; } @@ -680,13 +554,7 @@ class BasePaymentDriver } - /** - * @param bool $ref - * @param PaymentMethod|null $paymentMethod - * - * @return Payment|mixed - */ - public function createPayment($ref = false, PaymentMethod $paymentMethod = null) + public function createPayment($ref = false, $paymentMethod = null) { $invitation = $this->invitation; $invoice = $this->invoice(); @@ -773,24 +641,12 @@ class BasePaymentDriver return $payment; } - /** - * @param Payment $payment - * @param $paymentMethod - * - * @return Payment - */ - protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod) + protected function creatingPayment($payment, $paymentMethod) { return $payment; } - /** - * @param Payment $payment - * @param int $amount - * - * @return bool - */ - public function refundPayment(Payment $payment, $amount = 0) + public function refundPayment($payment, $amount = 0) { if ($amount) { $amount = min($amount, $payment->getCompletedAmount()); @@ -822,13 +678,7 @@ class BasePaymentDriver return false; } - /** - * @param Payment $payment - * @param $amount - * - * @return array - */ - protected function refundDetails(Payment $payment, $amount) + protected function refundDetails($payment, $amount) { return [ 'amount' => $amount, @@ -836,14 +686,7 @@ class BasePaymentDriver ]; } - /** - * @param $response - * @param Payment $payment - * @param $amount - * - * @return bool - */ - protected function attemptVoidPayment($response, Payment $payment, $amount) + protected function attemptVoidPayment($response, $payment, $amount) { // Partial refund not allowed for unsettled transactions return $amount == $payment->amount; @@ -854,13 +697,7 @@ class BasePaymentDriver return $payment; } - /** - * @param $input - * - * @return bool|mixed - * @throws Exception - */ - public function completeOffsitePurchase(array $input) + public function completeOffsitePurchase($input) { $this->input = $input; $ref = array_get($this->input, 'token') ?: $this->invitation->transaction_reference; @@ -893,9 +730,6 @@ class BasePaymentDriver return $this->createPayment($ref); } - /** - * @return array - */ public function tokenLinks() { if ( ! $this->customer()) { @@ -933,9 +767,6 @@ class BasePaymentDriver return $links; } - /** - * @return array - */ public function paymentLinks() { $links = []; @@ -954,11 +785,6 @@ class BasePaymentDriver return $links; } - /** - * @param $gatewayType - * - * @return string - */ protected function paymentUrl($gatewayType) { $account = $this->account(); @@ -976,11 +802,6 @@ class BasePaymentDriver return $url; } - /** - * @param $cardName - * - * @return mixed - */ protected function parseCardType($cardName) { $cardTypes = [ 'visa' => PAYMENT_TYPE_VISA, @@ -1013,11 +834,6 @@ class BasePaymentDriver } } - /** - * @param $input - * - * @throws Exception - */ public function handleWebHook($input) { throw new Exception('Unsupported gateway'); diff --git a/app/Ninja/PaymentDrivers/BitPayPaymentDriver.php b/app/Ninja/PaymentDrivers/BitPayPaymentDriver.php index 97fbde394869..df1821acdb96 100644 --- a/app/Ninja/PaymentDrivers/BitPayPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BitPayPaymentDriver.php @@ -1,19 +1,12 @@ -isGatewayType(GATEWAY_TYPE_PAYPAL)) { + /* + if ( ! $sourceId || empty($input['device_data'])) { + throw new Exception(); + } + + Session::put($this->invitation->id . 'device_data', $input['device_data']); + */ + $data['details'] = ! empty($input['device_data']) ? json_decode($input['device_data']) : false; } return $data; } - /** - * @param $customer - * - * @return bool - */ protected function checkCustomerExists($customer) { if ( ! parent::checkCustomerExists($customer)) { @@ -83,12 +60,7 @@ class BraintreePaymentDriver extends BasePaymentDriver return ($customer instanceof Customer); } - /** - * @param PaymentMethod $paymentMethod - * - * @return array - */ - protected function paymentDetails(PaymentMethod $paymentMethod = null) + protected function paymentDetails($paymentMethod = false) { $data = parent::paymentDetails($paymentMethod); @@ -109,9 +81,6 @@ class BraintreePaymentDriver extends BasePaymentDriver return $data; } - /** - * @return PaymentMethod|bool - */ public function createToken() { if ($customer = $this->customer()) { @@ -144,9 +113,6 @@ class BraintreePaymentDriver extends BasePaymentDriver return parent::createToken(); } - /** - * @return array - */ private function customerData() { return [ @@ -159,11 +125,6 @@ class BraintreePaymentDriver extends BasePaymentDriver ]; } - /** - * @param $customer - * - * @return mixed - */ public function creatingCustomer($customer) { $customer->token = $this->tokenResponse->customerId; @@ -171,12 +132,7 @@ class BraintreePaymentDriver extends BasePaymentDriver return $customer; } - /** - * @param PaymentMethod $paymentMethod - * - * @return PaymentMethod|null - */ - protected function creatingPaymentMethod(PaymentMethod $paymentMethod) + protected function creatingPaymentMethod($paymentMethod) { $response = $this->tokenResponse; @@ -196,13 +152,7 @@ class BraintreePaymentDriver extends BasePaymentDriver return $paymentMethod; } - /** - * @param PaymentMethod $paymentMethod - * - * @return bool - * @throws Exception - */ - public function removePaymentMethod(PaymentMethod $paymentMethod) + public function removePaymentMethod($paymentMethod) { parent::removePaymentMethod($paymentMethod); @@ -217,14 +167,7 @@ class BraintreePaymentDriver extends BasePaymentDriver } } - /** - * @param $response - * @param Payment $payment - * @param $amount - * - * @return bool - */ - protected function attemptVoidPayment($response, Payment $payment, $amount) + protected function attemptVoidPayment($response, $payment, $amount) { if ( ! parent::attemptVoidPayment($response, $payment, $amount)) { return false; @@ -242,9 +185,6 @@ class BraintreePaymentDriver extends BasePaymentDriver return false; } - /** - * @return mixed - */ public function createTransactionToken() { return $this->gateway() diff --git a/app/Ninja/PaymentDrivers/CheckoutComPaymentDriver.php b/app/Ninja/PaymentDrivers/CheckoutComPaymentDriver.php index c1d9c63fbbbb..ede0b678234b 100644 --- a/app/Ninja/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/CheckoutComPaymentDriver.php @@ -1,17 +1,7 @@ -gateway()->purchase([ @@ -31,12 +21,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver return false; } - /** - * @param PaymentMethod $paymentMethod - * - * @return array - */ - protected function paymentDetails(PaymentMethod $paymentMethod = null) + protected function paymentDetails($paymentMethod = false) { $data = parent::paymentDetails(); diff --git a/app/Ninja/PaymentDrivers/CybersourcePaymentDriver.php b/app/Ninja/PaymentDrivers/CybersourcePaymentDriver.php index 64e49ae74c9b..29299eb94fb2 100644 --- a/app/Ninja/PaymentDrivers/CybersourcePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/CybersourcePaymentDriver.php @@ -1,24 +1,10 @@ -createPayment($input['bill_trans_ref_no']); diff --git a/app/Ninja/PaymentDrivers/DwollaPaymentDriver.php b/app/Ninja/PaymentDrivers/DwollaPaymentDriver.php index d372d159cccc..26f5626c8c3d 100644 --- a/app/Ninja/PaymentDrivers/DwollaPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/DwollaPaymentDriver.php @@ -1,23 +1,12 @@ -paymentDetails(); diff --git a/app/Ninja/PaymentDrivers/PayFastPaymentDriver.php b/app/Ninja/PaymentDrivers/PayFastPaymentDriver.php index b1d8caf4891c..79b49b23499e 100644 --- a/app/Ninja/PaymentDrivers/PayFastPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/PayFastPaymentDriver.php @@ -1,18 +1,10 @@ -isGateway(GATEWAY_PAYFAST) && Request::has('pt')) { $token = Request::query('pt'); diff --git a/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php index fc8672564507..ad11a8c1287b 100644 --- a/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -1,18 +1,8 @@ -payer_id = $this->input['PayerID']; diff --git a/app/Ninja/PaymentDrivers/PayPalProPaymentDriver.php b/app/Ninja/PaymentDrivers/PayPalProPaymentDriver.php index 2e5a2789d036..0c8344cb5705 100644 --- a/app/Ninja/PaymentDrivers/PayPalProPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/PayPalProPaymentDriver.php @@ -1,17 +1,7 @@ -accountGateway->getPublishableStripeKey(); } - /** - * @return array - */ public function rules() { $rules = parent::rules(); @@ -56,11 +39,6 @@ class StripePaymentDriver extends BasePaymentDriver return $rules; } - /** - * @param $customer - * - * @return bool - */ protected function checkCustomerExists($customer) { $response = $this->gateway() @@ -85,20 +63,12 @@ class StripePaymentDriver extends BasePaymentDriver return true; } - /** - * @return bool - */ public function isTwoStep() { return $this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER) && empty($this->input['plaidPublicToken']); } - /** - * @param PaymentMethod $paymentMethod - * - * @return array - */ - protected function paymentDetails(PaymentMethod $paymentMethod = null) + protected function paymentDetails($paymentMethod = false) { $data = parent::paymentDetails($paymentMethod); @@ -123,10 +93,6 @@ class StripePaymentDriver extends BasePaymentDriver return $data; } - /** - * @return PaymentMethod - * @throws Exception - */ public function createToken() { $invoice = $this->invitation->invoice; @@ -160,11 +126,6 @@ class StripePaymentDriver extends BasePaymentDriver } } - /** - * @param $customer - * - * @return mixed - */ public function creatingCustomer($customer) { $customer->token = $this->tokenResponse['id']; @@ -172,12 +133,7 @@ class StripePaymentDriver extends BasePaymentDriver return $customer; } - /** - * @param PaymentMethod $paymentMethod - * - * @return PaymentMethod|bool - */ - protected function creatingPaymentMethod(PaymentMethod $paymentMethod) + protected function creatingPaymentMethod($paymentMethod) { $data = $this->tokenResponse; @@ -219,30 +175,16 @@ class StripePaymentDriver extends BasePaymentDriver return $paymentMethod; } - /** - * @param Payment $payment - * @param PaymentMethod $paymentMethod - * - * @return Payment - */ - protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod) + protected function creatingPayment($payment, $paymentMethod) { if ($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER, $paymentMethod)) { - $payment->payment_status_id = $this->purchaseResponse['status'] == 'succeeded' - ? PAYMENT_STATUS_COMPLETED - : PAYMENT_STATUS_PENDING; + $payment->payment_status_id = $this->purchaseResponse['status'] == 'succeeded' ? PAYMENT_STATUS_COMPLETED : PAYMENT_STATUS_PENDING; } return $payment; } - /** - * @param PaymentMethod $paymentMethod - * - * @return bool - * @throws Exception - */ - public function removePaymentMethod(PaymentMethod $paymentMethod) + public function removePaymentMethod($paymentMethod) { parent::removePaymentMethod($paymentMethod); @@ -262,13 +204,6 @@ class StripePaymentDriver extends BasePaymentDriver } } - /** - * @param $publicToken - * @param $accountId - * - * @return mixed - * @throws Exception - */ private function getPlaidToken($publicToken, $accountId) { $clientId = $this->accountGateway->getPlaidClientId(); @@ -311,14 +246,6 @@ class StripePaymentDriver extends BasePaymentDriver } } - /** - * @param $client - * @param $publicId - * @param $amount1 - * @param $amount2 - * - * @return bool|mixed|string - */ public function verifyBankAccount($client, $publicId, $amount1, $amount2) { $customer = $this->customer($client->id); @@ -349,13 +276,6 @@ class StripePaymentDriver extends BasePaymentDriver return true; } - /** - * @param $method - * @param $url - * @param null $body - * - * @return mixed|string - */ public function makeStripeCall($method, $url, $body = null) { $apiKey = $this->accountGateway->getConfig()->apiKey; @@ -392,12 +312,6 @@ class StripePaymentDriver extends BasePaymentDriver } } - /** - * @param $input - * - * @return array|string - * @throws Exception - */ public function handleWebHook($input) { $eventId = array_get($input, 'id'); diff --git a/app/Ninja/PaymentDrivers/TwoCheckoutPaymentDriver.php b/app/Ninja/PaymentDrivers/TwoCheckoutPaymentDriver.php index f94df7f04493..005611d4a034 100644 --- a/app/Ninja/PaymentDrivers/TwoCheckoutPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/TwoCheckoutPaymentDriver.php @@ -1,24 +1,11 @@ -createPayment($input['order_number']); } diff --git a/app/Ninja/PaymentDrivers/WePayPaymentDriver.php b/app/Ninja/PaymentDrivers/WePayPaymentDriver.php index aaef30a27c9b..74f2f05d3bf0 100644 --- a/app/Ninja/PaymentDrivers/WePayPaymentDriver.php +++ b/app/Ninja/PaymentDrivers/WePayPaymentDriver.php @@ -1,21 +1,12 @@ -accountGateway); @@ -105,6 +77,22 @@ class WePayPaymentDriver extends BasePaymentDriver 'payment_bank_id' => $token, ]); } else { + // Authorize credit card + $tokenResponse = $wepay->request('credit_card/authorize', [ + 'client_id' => WEPAY_CLIENT_ID, + 'client_secret' => WEPAY_CLIENT_SECRET, + 'credit_card_id' => $token, + ]); + + // Update the callback uri and get the card details + $tokenResponse = $wepay->request('credit_card/modify', [ + 'client_id' => WEPAY_CLIENT_ID, + 'client_secret' => WEPAY_CLIENT_SECRET, + 'credit_card_id' => $token, + 'auto_update' => WEPAY_AUTO_UPDATE, + 'callback_uri' => $this->accountGateway->getWebhookUrl(), + ]); + $this->tokenResponse = $wepay->request('credit_card', [ 'client_id' => WEPAY_CLIENT_ID, 'client_secret' => WEPAY_CLIENT_SECRET, @@ -115,12 +103,23 @@ class WePayPaymentDriver extends BasePaymentDriver return parent::createToken(); } - /** - * @param PaymentMethod $paymentMethod - * - * @return PaymentMethod - */ - protected function creatingPaymentMethod(PaymentMethod $paymentMethod) + /* + public function creatingCustomer($customer) + { + if ($gatewayResponse instanceof \Omnipay\WePay\Message\CustomCheckoutResponse) { + $wepay = \Utils::setupWePay($accountGateway); + $paymentMethodType = $gatewayResponse->getData()['payment_method']['type']; + + $gatewayResponse = $wepay->request($paymentMethodType, array( + 'client_id' => WEPAY_CLIENT_ID, + 'client_secret' => WEPAY_CLIENT_SECRET, + $paymentMethodType.'_id' => $gatewayResponse->getData()['payment_method'][$paymentMethodType]['id'], + )); + } + } + */ + + protected function creatingPaymentMethod($paymentMethod) { $source = $this->tokenResponse; @@ -149,13 +148,7 @@ class WePayPaymentDriver extends BasePaymentDriver return $paymentMethod; } - /** - * @param PaymentMethod $paymentMethod - * - * @return bool - * @throws Exception - */ - public function removePaymentMethod(PaymentMethod $paymentMethod) + public function removePaymentMethod($paymentMethod) { parent::removePaymentMethod($paymentMethod); @@ -173,13 +166,7 @@ class WePayPaymentDriver extends BasePaymentDriver } } - /** - * @param Payment $payment - * @param $amount - * - * @return array - */ - protected function refundDetails(Payment $payment, $amount) + protected function refundDetails($payment, $amount) { $data = parent::refundDetails($payment, $amount); @@ -195,7 +182,7 @@ class WePayPaymentDriver extends BasePaymentDriver return $data; } - protected function attemptVoidPayment($response, Payment $payment, $amount) + protected function attemptVoidPayment($response, $payment, $amount) { if ( ! parent::attemptVoidPayment($response, $payment, $amount)) { return false; @@ -237,6 +224,8 @@ class WePayPaymentDriver extends BasePaymentDriver if ($source->state == 'deleted') { $paymentMethod->delete(); + } else { + //$this->paymentService->convertPaymentMethodFromWePay($source, null, $paymentMethod)->save(); } return 'Processed successfully'; diff --git a/app/Ninja/Repositories/AccountGatewayRepository.php b/app/Ninja/Repositories/AccountGatewayRepository.php index 91f7b5c0216a..c59b0d77abab 100644 --- a/app/Ninja/Repositories/AccountGatewayRepository.php +++ b/app/Ninja/Repositories/AccountGatewayRepository.php @@ -1,27 +1,14 @@ -users as $user) { if ($userAccount = self::findUserAccounts($user->id)) { $userAccount->removeUserId($user->id); @@ -689,11 +681,7 @@ class AccountRepository return $code; } - /** - * @param User $user - * @param $name - */ - public function createTokens(User $user, $name) + public function createTokens($user, $name) { $name = trim($name) ?: 'TOKEN'; $users = $this->findUsers($user); @@ -710,12 +698,7 @@ class AccountRepository } } - /** - * @param Account $account - * - * @return bool|mixed - */ - public function getUserAccountId(Account $account) + public function getUserAccountId($account) { $user = $account->users()->first(); $userAccount = $this->findUserAccounts($user->id); @@ -723,11 +706,7 @@ class AccountRepository return $userAccount ? $userAccount->id : false; } - /** - * @param $data - * @param Account $account - */ - public function save($data, Account $account) + public function save($data, $account) { $account->fill($data); $account->save(); diff --git a/app/Ninja/Repositories/ActivityRepository.php b/app/Ninja/Repositories/ActivityRepository.php index 41606547406b..7ea2616b62f2 100644 --- a/app/Ninja/Repositories/ActivityRepository.php +++ b/app/Ninja/Repositories/ActivityRepository.php @@ -1,6 +1,4 @@ -get(); } - /** - * @param null $filter - * @param bool $userId - * - * @return $this - */ public function find($filter = null, $userId = false) { $query = DB::table('clients') @@ -84,13 +68,7 @@ class ClientRepository extends BaseRepository return $query; } - /** - * @param $data - * @param Client|null $client - * - * @return Client|mixed - */ - public function save($data, Client $client = null) + public function save($data, $client = null) { $publicId = isset($data['public_id']) ? $data['public_id'] : false; @@ -117,6 +95,12 @@ class ClientRepository extends BaseRepository $client->fill($data); $client->save(); + /* + if ( ! isset($data['contact']) && ! isset($data['contacts'])) { + return $client; + } + */ + $first = true; $contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts']; $contactIds = []; diff --git a/app/Ninja/Repositories/ContactRepository.php b/app/Ninja/Repositories/ContactRepository.php index 2b26485cbd3f..6f157c1c40b8 100644 --- a/app/Ninja/Repositories/ContactRepository.php +++ b/app/Ninja/Repositories/ContactRepository.php @@ -1,19 +1,9 @@ -get(); } - /** - * @return $this - */ public function find() { $accountid = \Auth::user()->account_id; @@ -63,12 +50,6 @@ class DocumentRepository extends BaseRepository return $query; } - /** - * @param $data - * @param null $doc_array - * - * @return mixed - */ public function upload($data, &$doc_array=null) { $uploaded = $data['file']; @@ -196,14 +177,6 @@ class DocumentRepository extends BaseRepository return $document; } - /** - * @param $contactId - * @param $entityType - * @param $search - * - * @return \Illuminate\Http\JsonResponse - * @throws \Exception - */ public function getClientDatatable($contactId, $entityType, $search) { diff --git a/app/Ninja/Repositories/ExpenseCategoryRepository.php b/app/Ninja/Repositories/ExpenseCategoryRepository.php index c2ceebdab74a..90edbd2d7412 100644 --- a/app/Ninja/Repositories/ExpenseCategoryRepository.php +++ b/app/Ninja/Repositories/ExpenseCategoryRepository.php @@ -1,26 +1,17 @@ -documentRepo = $documentRepo; } - /** - * @return mixed - */ public function all() { return Expense::scope() @@ -49,11 +31,6 @@ class ExpenseRepository extends BaseRepository ->get(); } - /** - * @param $vendorPublicId - * - * @return mixed - */ public function findVendor($vendorPublicId) { $vendorId = Vendor::getPrivateId($vendorPublicId); @@ -63,11 +40,6 @@ class ExpenseRepository extends BaseRepository return $query; } - /** - * @param null $filter - * - * @return $this - */ public function find($filter = null) { $accountid = \Auth::user()->account_id; @@ -138,13 +110,7 @@ class ExpenseRepository extends BaseRepository return $query; } - /** - * @param array $input - * @param Expense|null $expense - * - * @return Expense|mixed - */ - public function save(array $input, Expense $expense = null) + public function save($input, $expense = null) { $publicId = isset($input['public_id']) ? $input['public_id'] : false; @@ -208,12 +174,6 @@ class ExpenseRepository extends BaseRepository return $expense; } - /** - * @param $ids - * @param $action - * - * @return int - */ public function bulk($ids, $action) { $expenses = Expense::withTrashed()->scope($ids)->get(); @@ -234,6 +194,6 @@ class ExpenseRepository extends BaseRepository } } - return $expenses->count(); + return count($tasks); } } diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index bfc3e270c48e..0249f764b625 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -748,7 +748,6 @@ class InvoiceRepository extends BaseRepository /** * @param Invoice $recurInvoice - * * @return mixed */ public function createRecurringInvoice(Invoice $recurInvoice) @@ -840,7 +839,6 @@ class InvoiceRepository extends BaseRepository /** * @param Account $account - * * @return mixed */ public function findNeedingReminding(Account $account) diff --git a/app/Ninja/Repositories/NinjaRepository.php b/app/Ninja/Repositories/NinjaRepository.php index e16e20a80c16..d1dc7abede6e 100644 --- a/app/Ninja/Repositories/NinjaRepository.php +++ b/app/Ninja/Repositories/NinjaRepository.php @@ -1,20 +1,10 @@ -first(); @@ -22,7 +12,6 @@ class NinjaRepository return; } - /** @var Company $company */ $company = $account->company; $company->plan = !empty($data['plan']) && $data['plan'] != PLAN_FREE?$data['plan']:null; $company->plan_term = !empty($data['plan_term'])?$data['plan_term']:null; diff --git a/app/Ninja/Repositories/PaymentRepository.php b/app/Ninja/Repositories/PaymentRepository.php index 582085df17c4..f75f9a186755 100644 --- a/app/Ninja/Repositories/PaymentRepository.php +++ b/app/Ninja/Repositories/PaymentRepository.php @@ -1,31 +1,18 @@ -invoice->is_deleted) { @@ -240,11 +210,6 @@ class PaymentRepository extends BaseRepository parent::delete($payment); } - /** - * @param $payment - * - * @return bool - */ public function restore($payment) { if ($payment->invoice->is_deleted) { diff --git a/app/Ninja/Repositories/PaymentTermRepository.php b/app/Ninja/Repositories/PaymentTermRepository.php index 3eea4b3b771f..bde31c20a81d 100644 --- a/app/Ninja/Repositories/PaymentTermRepository.php +++ b/app/Ninja/Repositories/PaymentTermRepository.php @@ -1,27 +1,18 @@ -where('payment_terms.account_id', '=', $accountId) ->where('payment_terms.deleted_at', '=', null) ->select('payment_terms.public_id', 'payment_terms.name', 'payment_terms.num_days', 'payment_terms.deleted_at'); } diff --git a/app/Ninja/Repositories/ProductRepository.php b/app/Ninja/Repositories/ProductRepository.php index 3f2053f9603b..61cee1eec7d7 100644 --- a/app/Ninja/Repositories/ProductRepository.php +++ b/app/Ninja/Repositories/ProductRepository.php @@ -1,26 +1,15 @@ -get(); } - /** - * @param $accountId - * - * @return $this - */ public function find($accountId) { return DB::table('products') @@ -53,13 +37,7 @@ class ProductRepository extends BaseRepository ); } - /** - * @param array $data - * @param Product|null $product - * - * @return Product|mixed - */ - public function save(array $data, Product $product = null) + public function save($data, $product = null) { $publicId = isset($data['public_id']) ? $data['public_id'] : false; diff --git a/app/Ninja/Repositories/ReferralRepository.php b/app/Ninja/Repositories/ReferralRepository.php index 813059840fdf..ca12f960fd35 100644 --- a/app/Ninja/Repositories/ReferralRepository.php +++ b/app/Ninja/Repositories/ReferralRepository.php @@ -1,19 +1,9 @@ -get(); diff --git a/app/Ninja/Repositories/TaskRepository.php b/app/Ninja/Repositories/TaskRepository.php index 4ac8bad94d55..db78cba3bf38 100644 --- a/app/Ninja/Repositories/TaskRepository.php +++ b/app/Ninja/Repositories/TaskRepository.php @@ -1,23 +1,12 @@ -scope($ids)->get(); diff --git a/app/Ninja/Repositories/TaxRateRepository.php b/app/Ninja/Repositories/TaxRateRepository.php index b28a66d35dc3..f737256e85bf 100644 --- a/app/Ninja/Repositories/TaxRateRepository.php +++ b/app/Ninja/Repositories/TaxRateRepository.php @@ -1,28 +1,16 @@ -select('tax_rates.public_id', 'tax_rates.name', 'tax_rates.rate', 'tax_rates.deleted_at'); } - /** - * @param array $data - * @param TaxRate|null $taxRate - * - * @return TaxRate|mixed - */ - public function save(array $data, TaxRate $taxRate = null) + public function save($data, $taxRate = null) { if ($taxRate) { // do nothing @@ -53,4 +35,41 @@ class TaxRateRepository extends BaseRepository return $taxRate; } + + /* + public function save($taxRates) + { + $taxRateIds = []; + + foreach ($taxRates as $record) { + if (!isset($record->rate) || (isset($record->is_deleted) && $record->is_deleted)) { + continue; + } + + if (!isset($record->name) || !trim($record->name)) { + continue; + } + + if ($record->public_id) { + $taxRate = TaxRate::scope($record->public_id)->firstOrFail(); + } else { + $taxRate = TaxRate::createNew(); + } + + $taxRate->rate = Utils::parseFloat($record->rate); + $taxRate->name = trim($record->name); + $taxRate->save(); + + $taxRateIds[] = $taxRate->public_id; + } + + $taxRates = TaxRate::scope()->get(); + + foreach ($taxRates as $taxRate) { + if (!in_array($taxRate->public_id, $taxRateIds)) { + $taxRate->delete(); + } + } + } + */ } diff --git a/app/Ninja/Repositories/TokenRepository.php b/app/Ninja/Repositories/TokenRepository.php index 083deef2a015..16fa02f800f8 100644 --- a/app/Ninja/Repositories/TokenRepository.php +++ b/app/Ninja/Repositories/TokenRepository.php @@ -1,29 +1,16 @@ -fill($data); $user->save(); diff --git a/app/Ninja/Repositories/VendorContactRepository.php b/app/Ninja/Repositories/VendorContactRepository.php index 6d6d9100eeac..a348f05977f3 100644 --- a/app/Ninja/Repositories/VendorContactRepository.php +++ b/app/Ninja/Repositories/VendorContactRepository.php @@ -1,25 +1,18 @@ -send_invoice = true; $contact->vendor_id = $data['vendor_id']; $contact->is_primary = VendorContact::scope()->where('vendor_id', '=', $contact->vendor_id)->count() == 0; } else { diff --git a/app/Ninja/Repositories/VendorRepository.php b/app/Ninja/Repositories/VendorRepository.php index 5668b48de7ad..1f848e0a0b9a 100644 --- a/app/Ninja/Repositories/VendorRepository.php +++ b/app/Ninja/Repositories/VendorRepository.php @@ -1,26 +1,16 @@ -get(); } - /** - * @param null $filter - * - * @return $this - */ public function find($filter = null) { $query = DB::table('vendors') @@ -75,13 +60,7 @@ class VendorRepository extends BaseRepository return $query; } - /** - * @param array $data - * @param Vendor|null $vendor - * - * @return Vendor|mixed - */ - public function save(array $data, Vendor $vendor = null) + public function save($data, $vendor = null) { $publicId = isset($data['public_id']) ? $data['public_id'] : false; @@ -96,7 +75,15 @@ class VendorRepository extends BaseRepository $vendor->fill($data); $vendor->save(); - + + $first = true; + $vendorcontacts = isset($data['vendor_contact']) ? [$data['vendor_contact']] : $data['vendor_contacts']; + + foreach ($vendorcontacts as $vendorcontact) { + $vendorcontact = $vendor->addVendorContact($vendorcontact, $first); + $first = false; + } + return $vendor; } } diff --git a/app/Ninja/Transformers/UserTransformer.php b/app/Ninja/Transformers/UserTransformer.php index 905fc669f343..a22308f096da 100644 --- a/app/Ninja/Transformers/UserTransformer.php +++ b/app/Ninja/Transformers/UserTransformer.php @@ -29,4 +29,4 @@ class UserTransformer extends EntityTransformer 'permissions' => (int) $user->getOriginal('permissions'), ]; } -} +} \ No newline at end of file diff --git a/app/Policies/ClientPolicy.php b/app/Policies/ClientPolicy.php index 81e64a73e02a..4610c139fbfa 100644 --- a/app/Policies/ClientPolicy.php +++ b/app/Policies/ClientPolicy.php @@ -2,10 +2,4 @@ namespace App\Policies; -/** - * Class ClientPolicy - */ -class ClientPolicy extends EntityPolicy -{ - -} \ No newline at end of file +class ClientPolicy extends EntityPolicy {} \ No newline at end of file diff --git a/app/Policies/CreditPolicy.php b/app/Policies/CreditPolicy.php index c0d1ca2660ac..539bc7e51889 100644 --- a/app/Policies/CreditPolicy.php +++ b/app/Policies/CreditPolicy.php @@ -2,10 +2,4 @@ namespace App\Policies; -/** - * Class CreditPolicy - */ -class CreditPolicy extends EntityPolicy -{ - -} \ No newline at end of file +class CreditPolicy extends EntityPolicy {} \ No newline at end of file diff --git a/app/Policies/DocumentPolicy.php b/app/Policies/DocumentPolicy.php index 8ebadcb2e0c9..0af6e80a2af6 100644 --- a/app/Policies/DocumentPolicy.php +++ b/app/Policies/DocumentPolicy.php @@ -2,7 +2,6 @@ namespace App\Policies; -use App\Models\Document; use App\Models\User; /** @@ -12,7 +11,6 @@ class DocumentPolicy extends EntityPolicy { /** * @param User $user - * * @return bool */ public static function create(User $user) @@ -22,11 +20,10 @@ class DocumentPolicy extends EntityPolicy /** * @param User $user - * @param $item - * + * @param Document $document * @return bool */ - public static function view(User $user, $item) + public static function view(User $user, $document) { if ($user->hasPermission('view_all')) { return true; diff --git a/app/Policies/ExpensePolicy.php b/app/Policies/ExpensePolicy.php index 97dce5cad343..d281d2f407c2 100644 --- a/app/Policies/ExpensePolicy.php +++ b/app/Policies/ExpensePolicy.php @@ -4,9 +4,6 @@ namespace App\Policies; use App\Models\User; -/** - * Class ExpensePolicy - */ class ExpensePolicy extends EntityPolicy { /** diff --git a/app/Policies/InvoicePolicy.php b/app/Policies/InvoicePolicy.php index 5a7f7ebfc465..aa72b4c0533c 100644 --- a/app/Policies/InvoicePolicy.php +++ b/app/Policies/InvoicePolicy.php @@ -2,10 +2,4 @@ namespace App\Policies; -/** - * Class InvoicePolicy - */ -class InvoicePolicy extends EntityPolicy -{ - -} +class InvoicePolicy extends EntityPolicy {} diff --git a/app/Policies/PaymentPolicy.php b/app/Policies/PaymentPolicy.php index eaf3c7d85877..e9c3fc582a3f 100644 --- a/app/Policies/PaymentPolicy.php +++ b/app/Policies/PaymentPolicy.php @@ -2,10 +2,4 @@ namespace App\Policies; -/** - * Class PaymentPolicy - */ -class PaymentPolicy extends EntityPolicy -{ - -} \ No newline at end of file +class PaymentPolicy extends EntityPolicy {} \ No newline at end of file diff --git a/app/Policies/TokenPolicy.php b/app/Policies/TokenPolicy.php index a26805d66865..36e37e313a69 100644 --- a/app/Policies/TokenPolicy.php +++ b/app/Policies/TokenPolicy.php @@ -2,28 +2,12 @@ namespace App\Policies; -use App\Models\User; - -/** - * Class TokenPolicy - */ class TokenPolicy extends EntityPolicy { - /** - * @param User $user - * @param $item - * - * @return bool - */ - public static function edit(User $user, $item) { + public static function edit($user, $item) { return $user->hasPermission('admin'); } - /** - * @param User $user - * - * @return bool - */ - public static function create(User $user) { + public static function create($user) { return $user->hasPermission('admin'); } } \ No newline at end of file diff --git a/app/Policies/VendorPolicy.php b/app/Policies/VendorPolicy.php index 9e2d4a8a6403..8c388193251d 100644 --- a/app/Policies/VendorPolicy.php +++ b/app/Policies/VendorPolicy.php @@ -4,14 +4,10 @@ namespace App\Policies; use App\Models\User; -/** - * Class VendorPolicy - */ class VendorPolicy extends EntityPolicy { /** * @param User $user - * * @return bool */ public static function create(User $user) { diff --git a/app/Providers/ComposerServiceProvider.php b/app/Providers/ComposerServiceProvider.php index 91d11043b398..0bd4f0b57c2e 100644 --- a/app/Providers/ComposerServiceProvider.php +++ b/app/Providers/ComposerServiceProvider.php @@ -17,11 +17,6 @@ class ComposerServiceProvider extends ServiceProvider ['accounts.details', 'clients.edit', 'payments.edit', 'invoices.edit', 'accounts.localization'], 'App\Http\ViewComposers\TranslationComposer' ); - - view()->composer( - ['header', 'tasks.edit'], - 'App\Http\ViewComposers\AppLanguageComposer' - ); } /** diff --git a/app/Services/PushService.php b/app/Services/PushService.php index 533563fed356..017426814bd8 100644 --- a/app/Services/PushService.php +++ b/app/Services/PushService.php @@ -154,4 +154,4 @@ class PushService else return trans('texts.notification_invoice_viewed_subject', ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]); } -} +} \ No newline at end of file diff --git a/bower.json b/bower.json index 7c22de8d42a4..5d4c3a6c1026 100644 --- a/bower.json +++ b/bower.json @@ -3,10 +3,8 @@ "version": "0.9.0", "dependencies": { "jquery": "1.11.3", - "jquery-ui": "1.11.2", "bootstrap": "3.3.1", - "bootstrap-combobox": "1.1.7", - "bootstrap-datepicker": "1.4.0", + "jquery-ui": "1.11.2", "datatables": "1.10.4", "datatables-bootstrap3": "*", "knockout.js": "3.1.0", @@ -15,13 +13,13 @@ "font-awesome": "~4.*", "underscore": "1.7.0", "jspdf": "1.0.272", - "jsPDF-plugins": "*", + "bootstrap-datepicker": "1.4.0", "typeahead.js": "0.11.1", "accounting": "0.3.2", "spectrum": "1.3.4", "d3": "3.4.11", "handsontable": "*", - "pdfmake": "0.1.17", + "pdfmake": "*", "moment": "*", "jsoneditor": "*", "moment-timezone": "~0.4.0", @@ -29,8 +27,7 @@ "datetimepicker": "~2.4.5", "stacktrace-js": "~1.0.1", "fuse.js": "~2.0.2", - "dropzone": "~4.3.0", - "lightbox2": "~2.8.2" + "dropzone": "~4.3.0" }, "resolutions": { "jquery": "~1.11" diff --git a/composer.json b/composer.json index 1f0b868f4d03..d7870aee98ad 100644 --- a/composer.json +++ b/composer.json @@ -13,17 +13,13 @@ } ], "require": { - "php": ">=5.5.9", - "ext-mcrypt": "*", - "ext-gmp": "*", - "ext-gd": "*", "turbo124/laravel-push-notification": "dev-laravel5", "omnipay/mollie": "dev-master#22956c1a62a9662afa5f5d119723b413770ac525", "omnipay/2checkout": "dev-master#e9c079c2dde0d7ba461903b3b7bd5caf6dee1248", "omnipay/gocardless": "dev-master", "omnipay/stripe": "dev-master", "doctrine/dbal": "2.5.x", - "laravelcollective/bus": "5.2.*", + "laravelcollective/bus": "5.2.*", "laravel/framework": "5.2.*", "laravelcollective/html": "5.2.*", "symfony/css-selector": "~3.0", diff --git a/composer.lock b/composer.lock index 4d5f61e096ee..d91a366996a2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5221e980b2241bf56d9393aac82dfa1f", - "content-hash": "da4f765b1dd362a4f4690cff06e20afc", + "hash": "96184bcd2d0fb39c87a98b223efc5c1c", + "content-hash": "361daf07da39682d74bdc2bfead14fb9", "packages": [ { "name": "agmscode/omnipay-agms", @@ -323,20 +323,20 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.18.31", + "version": "3.18.27", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "dad0b7db5fa8f3c7a3805efb2a1e86a50f11fe8b" + "reference": "8cc3d3231d9fb9da528205f3b905097a37ac3df3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/dad0b7db5fa8f3c7a3805efb2a1e86a50f11fe8b", - "reference": "dad0b7db5fa8f3c7a3805efb2a1e86a50f11fe8b", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8cc3d3231d9fb9da528205f3b905097a37ac3df3", + "reference": "8cc3d3231d9fb9da528205f3b905097a37ac3df3", "shasum": "" }, "require": { - "guzzlehttp/guzzle": "^5.3.1|^6.2.1", + "guzzlehttp/guzzle": "~5.3|~6.0.1|~6.1", "guzzlehttp/promises": "~1.0", "guzzlehttp/psr7": "~1.3.1", "mtdowling/jmespath.php": "~2.2", @@ -399,7 +399,7 @@ "s3", "sdk" ], - "time": "2016-07-19 17:25:45" + "time": "2016-07-07 23:09:15" }, { "name": "barracudanetworks/archivestream-php", @@ -443,16 +443,16 @@ }, { "name": "braintree/braintree_php", - "version": "3.15.0", + "version": "3.14.0", "source": { "type": "git", "url": "https://github.com/braintree/braintree_php.git", - "reference": "1026b6cca5f2dd5dfdd5447843b920cc74d2b8ca" + "reference": "0c13b6235bc99c287d18e8cfc02359e66abaa3fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/braintree/braintree_php/zipball/1026b6cca5f2dd5dfdd5447843b920cc74d2b8ca", - "reference": "1026b6cca5f2dd5dfdd5447843b920cc74d2b8ca", + "url": "https://api.github.com/repos/braintree/braintree_php/zipball/0c13b6235bc99c287d18e8cfc02359e66abaa3fb", + "reference": "0c13b6235bc99c287d18e8cfc02359e66abaa3fb", "shasum": "" }, "require": { @@ -486,7 +486,7 @@ } ], "description": "Braintree PHP Client Library", - "time": "2016-07-18 21:55:50" + "time": "2016-06-23 15:36:49" }, { "name": "cardgate/omnipay-cardgate", @@ -1745,16 +1745,16 @@ }, { "name": "ezyang/htmlpurifier", - "version": "v4.8.0", + "version": "v4.7.0", "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2" + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2", - "reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40", + "reference": "ae1828d955112356f7677c465f94f7deb7d27a40", "shasum": "" }, "require": { @@ -1785,7 +1785,7 @@ "keywords": [ "html" ], - "time": "2016-07-16 12:58:58" + "time": "2015-08-05 01:03:42" }, { "name": "fotografde/omnipay-checkoutcom", @@ -2048,27 +2048,27 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.2.1", + "version": "6.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + "reference": "d094e337976dff9d8e2424e8485872194e768662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", - "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662", + "reference": "d094e337976dff9d8e2424e8485872194e768662", "shasum": "" }, "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", - "php": ">=5.5" + "guzzlehttp/promises": "~1.0", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.5.0" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", - "psr/log": "^1.0" + "phpunit/phpunit": "~4.0", + "psr/log": "~1.0" }, "type": "library", "extra": { @@ -2106,7 +2106,7 @@ "rest", "web service" ], - "time": "2016-07-15 17:22:37" + "time": "2016-03-21 20:02:09" }, { "name": "guzzlehttp/promises", @@ -2765,16 +2765,16 @@ }, { "name": "laravel/framework", - "version": "v5.2.40", + "version": "v5.2.39", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "6195211140ed0881e89d79a296f893abc56987be" + "reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/6195211140ed0881e89d79a296f893abc56987be", - "reference": "6195211140ed0881e89d79a296f893abc56987be", + "url": "https://api.github.com/repos/laravel/framework/zipball/c2a77050269b4e03bd9a735a9f24e573a7598b8a", + "reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a", "shasum": "" }, "require": { @@ -2831,8 +2831,7 @@ "illuminate/support": "self.version", "illuminate/translation": "self.version", "illuminate/validation": "self.version", - "illuminate/view": "self.version", - "tightenco/collect": "self.version" + "illuminate/view": "self.version" }, "require-dev": { "aws/aws-sdk-php": "~3.0", @@ -2891,7 +2890,7 @@ "framework", "laravel" ], - "time": "2016-07-19 19:46:25" + "time": "2016-06-17 19:25:12" }, { "name": "laravel/socialite", @@ -3048,16 +3047,16 @@ }, { "name": "league/flysystem", - "version": "1.0.25", + "version": "1.0.24", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "a76afa4035931be0c78ca8efc6abf3902362f437" + "reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a76afa4035931be0c78ca8efc6abf3902362f437", - "reference": "a76afa4035931be0c78ca8efc6abf3902362f437", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9aca859a303fdca30370f42b8c611d9cf0dedf4b", + "reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b", "shasum": "" }, "require": { @@ -3070,7 +3069,7 @@ "ext-fileinfo": "*", "mockery/mockery": "~0.9", "phpspec/phpspec": "^2.2", - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.8 || ~5.0" }, "suggest": { "ext-fileinfo": "Required for MimeType", @@ -3127,7 +3126,7 @@ "sftp", "storage" ], - "time": "2016-07-18 12:22:57" + "time": "2016-06-03 19:11:39" }, { "name": "league/flysystem-aws-s3-v3", @@ -3455,16 +3454,16 @@ }, { "name": "maatwebsite/excel", - "version": "v2.1.3", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/Maatwebsite/Laravel-Excel.git", - "reference": "c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9" + "reference": "aae17dbd6f39606cf8f588359a7a79438ab5aa53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9", - "reference": "c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9", + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/aae17dbd6f39606cf8f588359a7a79438ab5aa53", + "reference": "aae17dbd6f39606cf8f588359a7a79438ab5aa53", "shasum": "" }, "require": { @@ -3492,7 +3491,8 @@ "type": "library", "autoload": { "classmap": [ - "src/Maatwebsite/Excel" + "src/Maatwebsite/Excel", + "tests/TestCase.php" ], "psr-0": { "Maatwebsite\\Excel\\": "src/" @@ -3518,7 +3518,7 @@ "import", "laravel" ], - "time": "2016-07-09 09:40:10" + "time": "2016-03-01 17:45:44" }, { "name": "meebio/omnipay-creditcall", @@ -4054,16 +4054,16 @@ }, { "name": "omnipay/authorizenet", - "version": "2.4.2", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/omnipay-authorizenet.git", - "reference": "6e1990f5d22f0f8e4dfe363b89c9776d0d803c34" + "reference": "439bb6e649a4c57cddc24d6d704301a8ee5c3c3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/omnipay-authorizenet/zipball/6e1990f5d22f0f8e4dfe363b89c9776d0d803c34", - "reference": "6e1990f5d22f0f8e4dfe363b89c9776d0d803c34", + "url": "https://api.github.com/repos/thephpleague/omnipay-authorizenet/zipball/439bb6e649a4c57cddc24d6d704301a8ee5c3c3f", + "reference": "439bb6e649a4c57cddc24d6d704301a8ee5c3c3f", "shasum": "" }, "require": { @@ -4109,7 +4109,7 @@ "pay", "payment" ], - "time": "2016-07-16 21:00:00" + "time": "2016-06-16 10:06:24" }, { "name": "omnipay/bitpay", @@ -8734,16 +8734,16 @@ }, { "name": "codeception/c3", - "version": "2.0.7", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/Codeception/c3.git", - "reference": "51eec2c3a8e093deb621f58004f0393dc0871983" + "reference": "dc4d39b36d585c2eda58129407e78855ea67b1ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/c3/zipball/51eec2c3a8e093deb621f58004f0393dc0871983", - "reference": "51eec2c3a8e093deb621f58004f0393dc0871983", + "url": "https://api.github.com/repos/Codeception/c3/zipball/dc4d39b36d585c2eda58129407e78855ea67b1ca", + "reference": "dc4d39b36d585c2eda58129407e78855ea67b1ca", "shasum": "" }, "require": { @@ -8780,7 +8780,7 @@ "code coverage", "codecoverage" ], - "time": "2016-06-27 16:49:12" + "time": "2016-02-09 23:31:08" }, { "name": "codeception/codeception", @@ -9262,16 +9262,16 @@ }, { "name": "phpspec/phpspec", - "version": "2.5.1", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/phpspec/phpspec.git", - "reference": "531d00ee76e9ae98279ed4dbb2419e5e0f7fb82d" + "reference": "385ecb015e97c13818074f1517928b24d4a26067" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/phpspec/zipball/531d00ee76e9ae98279ed4dbb2419e5e0f7fb82d", - "reference": "531d00ee76e9ae98279ed4dbb2419e5e0f7fb82d", + "url": "https://api.github.com/repos/phpspec/phpspec/zipball/385ecb015e97c13818074f1517928b24d4a26067", + "reference": "385ecb015e97c13818074f1517928b24d4a26067", "shasum": "" }, "require": { @@ -9289,7 +9289,7 @@ }, "require-dev": { "behat/behat": "^3.0.11", - "ciaranmcnulty/versionbasedtestskipper": "^0.2.1", + "bossa/phpspec2-expect": "~1.0", "phpunit/phpunit": "~4.4", "symfony/filesystem": "~2.1|~3.0" }, @@ -9302,7 +9302,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -9336,7 +9336,7 @@ "testing", "tests" ], - "time": "2016-07-16 08:34:07" + "time": "2016-03-20 20:34:32" }, { "name": "phpspec/prophecy", @@ -10444,11 +10444,6 @@ }, "prefer-stable": false, "prefer-lowest": false, - "platform": { - "php": ">=5.5.9", - "ext-mcrypt": "*", - "ext-gmp": "*", - "ext-gd": "*" - }, + "platform": [], "platform-dev": [] } diff --git a/gulpfile.js b/gulpfile.js index d9a390c8104b..7cf626734fa3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,140 +1,16 @@ var elixir = require('laravel-elixir'); -/** - * Configure Elixir to explicitly generate source maps - * - * @type {boolean} +/* + |-------------------------------------------------------------------------- + | Elixir Asset Management + |-------------------------------------------------------------------------- + | + | Elixir provides a clean, fluent API for defining some basic Gulp tasks + | for your Laravel application. By default, we are compiling the Less + | file for our application, as well as publishing vendor resources. + | */ -elixir.config.sourcemaps = true; - -/** - * Directory for JS assets that are not handled by Bower - * - * @type {string} - */ -var resourcesJsDirectory = './resources/assets/js/'; - -/** - * Directory for CSS assets that are not handled by Bower - * - * @type {string} - */ -var resourcesCssDirectory = './resources/assets/css/'; - -/** - * Directory for JS source files that are handled by Bower. - * Bower source file directory. - * - * @type {string} - */ -var bowerDirectoy = './resources/assets/bower/'; elixir(function(mix) { - - // Built built.css - mix.styles([ - bowerDirectoy + 'bootstrap/dist/css/bootstrap.css', - bowerDirectoy + 'bootstrap-combobox/css/bootstrap-combobox.css', - bowerDirectoy + 'bootstrap-datepicker/dist/css/bootstrap-datepicker3.css', - bowerDirectoy + 'datatables/media/css/jquery.dataTables.css', - bowerDirectoy + 'datatables-bootstrap3/BS3/assets/css/datatables.css', - bowerDirectoy + 'font-awesome/css/font-awesome.css', - bowerDirectoy + 'dropzone/dist/dropzone.css', - bowerDirectoy + 'spectrum/spectrum.css', - resourcesCssDirectory + 'typeahead.js-bootstrap.css', - resourcesCssDirectory + 'style.css' - ], 'public/css/built.min.css'); - - // Built built.public.css - mix.styles([ - bowerDirectoy + 'bootstrap/dist/css/bootstrap.css', - bowerDirectoy + 'bootstrap-combobox/css/bootstrap-combobox.css', - bowerDirectoy + 'font-awesome/css/font-awesome.css', - bowerDirectoy + 'datatables/media/css/jquery.dataTables.css', - bowerDirectoy + 'datatables-bootstrap3/BS3/assets/css/datatables.css', - resourcesCssDirectory + 'public.style.css' - ], 'public/css/built.public.min.css'); - - mix.copy(resourcesCssDirectory + 'themes', 'public/css/themes'); - - // Copy other CSS files to public - mix.styles(bowerDirectoy + 'quill/dist/quill.snow.css', 'public/css/quill.snow.min.css') - .styles(bowerDirectoy + 'lightbox2/dist/css/lightbox.css', 'public/css/lightbox.min.css') - .styles(bowerDirectoy + 'datetimepicker/jquery.datetimepicker.css', 'public/css/jquery.datetimepicker.min.css') - .styles(bowerDirectoy + 'jsoneditor/dist/jsoneditor.css', 'public/css/jsoneditor.min.css') - .styles(bowerDirectoy + 'bootstrap/dist/css/bootstrap.css', 'public/css/bootstrap.min.css') - .styles(resourcesCssDirectory + 'app.css', 'public/css/app.min.css') - .styles(resourcesCssDirectory + 'customCss.css', 'public/css/customCss.min.css') - .styles(resourcesCssDirectory + 'style.css', 'public/css/style.min.css') - .styles(resourcesCssDirectory + 'public.style.css', 'public/public.style.min.css'); - - - // Built built.js - mix.scripts([ - bowerDirectoy + 'jquery/dist/jquery.js', - bowerDirectoy + 'jquery-ui/jquery-ui.js', - bowerDirectoy + 'bootstrap/dist/js/bootstrap.js', - bowerDirectoy + 'bootstrap-datepicker/dist/js/bootstrap-datepicker.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.da.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.pt-BR.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.nl.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.fr.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.it.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.lt.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.no.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js', - bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.sv.min.js', - bowerDirectoy + 'datatables/media/js/jquery.dataTables.js', - bowerDirectoy + 'datatables-bootstrap3/BS3/assets/js/datatables.js', - bowerDirectoy + 'knockout.js/knockout.js', - bowerDirectoy + 'knockout-mapping/build/output/knockout.mapping-latest.js', - bowerDirectoy + 'knockout-sortable/build/knockout-sortable.min.js', - bowerDirectoy + 'underscore/underscore.js', - bowerDirectoy + 'dropzone/dist/dropzone.js', - bowerDirectoy + 'typeahead.js/dist/typeahead.jquery.js', - bowerDirectoy + 'accounting/accounting.js', - bowerDirectoy + 'spectrum/spectrum.js', - bowerDirectoy + 'jspdf/dist/jspdf.min.js', - bowerDirectoy + 'jsPDF-plugins/plugins/split_text_to_size.js', - bowerDirectoy + 'moment/moment.js', - bowerDirectoy + 'moment-timezone/builds/moment-timezone-with-data.js', - bowerDirectoy + 'stacktrace-js/dist/stacktrace-with-promises-and-json-polyfills.min.js', - bowerDirectoy + 'fuse.js/src/fuse.js', - bowerDirectoy + 'bootstrap-combobox/js/bootstrap-combobox.js', - resourcesJsDirectory + 'script.js', - resourcesJsDirectory + 'pdfmake-ninja.js' - ], 'public/built.js'); - - // Built built.public.js - mix.scripts([ - bowerDirectoy + 'bootstrap/dist/js/bootstrap.js', - bowerDirectoy + 'bootstrap-combobox/js/bootstrap-combobox.js' - ], 'public/built.public.js'); - - // Built pdf.built.js - mix.scripts([ - resourcesJsDirectory + 'compatibility.js', - resourcesJsDirectory + 'pdf_viewer.js', - bowerDirectoy + 'pdfmake/build/pdfmake.js', - resourcesJsDirectory + 'vfs.js' - ], 'public/pdf.built.js'); - - // Copy VFS Fonts to public directory - mix.copy(resourcesJsDirectory + 'vfs_fonts', 'public/js/vfs_fonts'); - - // Copy SVG file for Jsoneditor to public directory - mix.copy(bowerDirectoy + 'jsoneditor/dist/img', 'public/css/img'); - - // Copy other JS files to public - mix.scripts(resourcesJsDirectory + 'Chart.js', 'public/js/Chart.min.js') - .scripts(bowerDirectoy + 'datetimepicker/build/jquery.datetimepicker.full.js', 'public/js/jquery.datetimepicker.min.js') - .scripts(bowerDirectoy + 'd3/d3.js', 'public/js/d3.min.js') - .scripts(bowerDirectoy + 'quill/dist/quill.js', 'public/js/quill.min.js') - .scripts(bowerDirectoy + 'lightbox2/dist/js/lightbox.js', 'public/js/lightbox.min.js') - .scripts(bowerDirectoy + 'bootstrap-combobox/js/bootstrap-combobox.js', 'public/js/bootstrap-combobox.min.js') - .scripts(bowerDirectoy + 'jsoneditor/dist/jsoneditor.js', 'public/js/jsoneditor.min.js') - .scripts(resourcesJsDirectory + 'pdf.js', 'public/js/pdf.min.js') - .scripts(resourcesJsDirectory + 'pdf_viewer.worker.js', 'public/js/pdf_viewer.worker.js') - .scripts(resourcesJsDirectory + 'script.js', 'public/js/script.js'); + mix.less('app.less'); }); diff --git a/public/built.js b/public/built.js index ef53508f2cd8..313d756a9f89 100644 --- a/public/built.js +++ b/public/built.js @@ -1,31 +1,31868 @@ -function generatePDF(t,e,n,i){if(t&&e){if(!n)return refreshTimer&&clearTimeout(refreshTimer),void(refreshTimer=setTimeout(function(){generatePDF(t,e,!0,i)},500));refreshTimer=null,t=calculateAmounts(t);var o=GetPdfMake(t,e,i);return i&&o.getDataUrl(i),o}}function copyObject(t){return!!t&&JSON.parse(JSON.stringify(t))}function processVariables(t){if(!t)return"";for(var e=["MONTH","QUARTER","YEAR"],n=0;n1?c=a.split("+")[1]:a.split("-").length>1&&(c=parseInt(a.split("-")[1])*-1),t=t.replace(a,getDatePart(i,c))}}return t}function getDatePart(t,e){return e=parseInt(e),e||(e=0),"MONTH"==t?getMonth(e):"QUARTER"==t?getQuarter(e):"YEAR"==t?getYear(e):void 0}function getMonth(t){var e=new Date,n=["January","February","March","April","May","June","July","August","September","October","November","December"],i=e.getMonth();return i=parseInt(i)+t,i%=12,i<0&&(i+=12),n[i]}function getYear(t){var e=new Date,n=e.getFullYear();return parseInt(n)+t}function getQuarter(t){var e=new Date,n=Math.floor((e.getMonth()+3)/3);return n+=t,n%=4,0==n&&(n=4),"Q"+n}function isStorageSupported(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}}function isValidEmailAddress(t){var e=new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);return e.test(t)}function enableHoverClick(t,e,n){}function setAsLink(t,e){e?(t.css("text-decoration","underline"),t.css("cursor","pointer")):(t.css("text-decoration","none"),t.css("cursor","text"))}function setComboboxValue(t,e,n){t.find("input").val(e),t.find("input.form-control").val(n),e&&n?(t.find("select").combobox("setSelected"),t.find(".combobox-container").addClass("combobox-selected")):t.find(".combobox-container").removeClass("combobox-selected")}function convertDataURIToBinary(t){var e=t.indexOf(BASE64_MARKER)+BASE64_MARKER.length,n=t.substring(e);return base64DecToArr(n)}function getContactDisplayName(t){return t.first_name||t.last_name?(t.first_name||"")+" "+(t.last_name||""):t.email}function getClientDisplayName(t){var e=!!t.contacts&&t.contacts[0];return t.name?t.name:e?getContactDisplayName(e):""}function populateInvoiceComboboxes(t,e){for(var n={},i={},o={},r=$("select#client"),s=0;s1?t+=", ":n64&&t<91?t-65:t>96&&t<123?t-71:t>47&&t<58?t+4:43===t?62:47===t?63:0}function base64DecToArr(t,e){for(var n,i,o=t.replace(/[^A-Za-z0-9\+\/]/g,""),r=o.length,s=e?Math.ceil((3*r+1>>2)/e)*e:3*r+1>>2,a=new Uint8Array(s),c=0,l=0,u=0;u>>(16>>>n&24)&255;c=0}return a}function uint6ToB64(t){return t<26?t+65:t<52?t+71:t<62?t-4:62===t?43:63===t?47:65}function base64EncArr(t){for(var e=2,n="",i=t.length,o=0,r=0;r0&&4*r/3%76===0&&(n+="\r\n"),o|=t[r]<<(16>>>e&24),2!==e&&t.length-r!==1||(n+=String.fromCharCode(uint6ToB64(o>>>18&63),uint6ToB64(o>>>12&63),uint6ToB64(o>>>6&63),uint6ToB64(63&o)),o=0);return n.substr(0,n.length-2+e)+(2===e?"":1===e?"=":"==")}function UTF8ArrToStr(t){for(var e,n="",i=t.length,o=0;o251&&e<254&&o+5247&&e<252&&o+4239&&e<248&&o+3223&&e<240&&o+2191&&e<224&&o+1>>6),e[s++]=128+(63&n)):n<65536?(e[s++]=224+(n>>>12),e[s++]=128+(n>>>6&63),e[s++]=128+(63&n)):n<2097152?(e[s++]=240+(n>>>18),e[s++]=128+(n>>>12&63),e[s++]=128+(n>>>6&63),e[s++]=128+(63&n)):n<67108864?(e[s++]=248+(n>>>24),e[s++]=128+(n>>>18&63),e[s++]=128+(n>>>12&63),e[s++]=128+(n>>>6&63),e[s++]=128+(63&n)):(e[s++]=252+n/1073741824,e[s++]=128+(n>>>24&63),e[s++]=128+(n>>>18&63),e[s++]=128+(n>>>12&63),e[s++]=128+(n>>>6&63),e[s++]=128+(63&n));return e}function hexToR(t){return parseInt(cutHex(t).substring(0,2),16)}function hexToG(t){return parseInt(cutHex(t).substring(2,4),16)}function hexToB(t){return parseInt(cutHex(t).substring(4,6),16)}function cutHex(t){return"#"==t.charAt(0)?t.substring(1,7):t}function setDocHexColor(t,e){var n=hexToR(e),i=hexToG(e),o=hexToB(e);return t.setTextColor(n,i,o)}function setDocHexFill(t,e){var n=hexToR(e),i=hexToG(e),o=hexToB(e);return t.setFillColor(n,i,o)}function setDocHexDraw(t,e){var n=hexToR(e),i=hexToG(e),o=hexToB(e);return t.setDrawColor(n,i,o)}function toggleDatePicker(t){$("#"+t).datepicker("show")}function roundToTwo(t,e){var n=+(Math.round(t+"e+2")+"e-2");return e?n.toFixed(2):n||0}function roundToFour(t,e){var n=+(Math.round(t+"e+4")+"e-4");return e?n.toFixed(4):n||0}function truncate(t,e){return t&&t.length>e?t.substr(0,e-1)+"...":t}function endsWith(t,e){return t.indexOf(e,t.length-e.length)!==-1}function secondsToTime(t){t=Math.round(t);var e=Math.floor(t/3600),n=t%3600,i=Math.floor(n/60),o=n%60,r=Math.ceil(o),s={h:e,m:i,s:r};return s}function twoDigits(t){return t<10?"0"+t:t}function toSnakeCase(t){return t?t.replace(/([A-Z])/g,function(t){return"_"+t.toLowerCase()}):""}function snakeToCamel(t){return t.replace(/_([a-z])/g,function(t){return t[1].toUpperCase()})}function getDescendantProp(t,e){for(var n=e.split(".");n.length&&(t=t[n.shift()]););return t}function doubleDollarSign(t){return t?t.replace?t.replace(/\$/g,"$$$"):t:""}function truncate(t,e){return t.length>e?t.substring(0,e)+"...":t}function actionListHandler(){$("tbody tr .tr-action").closest("tr").mouseover(function(){$(this).closest("tr").find(".tr-action").show(),$(this).closest("tr").find(".tr-status").hide()}).mouseout(function(){$dropdown=$(this).closest("tr").find(".tr-action"),$dropdown.hasClass("open")||($dropdown.hide(),$(this).closest("tr").find(".tr-status").show())})}function loadImages(t){$(t+" img").each(function(t,e){var n=$(e).attr("data-src");$(e).attr("src",n),$(e).attr("data-src",n)})}function prettyJson(t){return"string"!=typeof t&&(t=JSON.stringify(t,void 0,2)),t=t.replace(/&/g,"&").replace(//g,">"),t.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,function(t){var e="number";return/^"/.test(t)?e=/:$/.test(t)?"key":"string":/true|false/.test(t)?e="boolean":/null/.test(t)&&(e="null"),t=snakeToCamel(t),''+t+""})}function searchData(t,e,n){return function(i,o){var r;if(n){var s={keys:[e]},a=new Fuse(t,s);r=a.search(i)}else r=[],substrRegex=new RegExp(escapeRegExp(i),"i"),$.each(t,function(t,n){substrRegex.test(n[e])&&r.push(n)});o(r)}}function escapeRegExp(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function GetPdfMake(t,e,n){function i(e,n){if("string"==typeof n){if(0===n.indexOf("$firstAndLast")){var i=n.split(":");return function(t,e){return 0===t||t===e.table.body.length?parseFloat(i[1]):0}}if(0===n.indexOf("$none"))return function(t,e){return 0};if(0===n.indexOf("$notFirstAndLastColumn")){var i=n.split(":");return function(t,e){return 0===t||t===e.table.widths.length?0:parseFloat(i[1])}}if(0===n.indexOf("$notFirst")){var i=n.split(":");return function(t,e){return 0===t?0:parseFloat(i[1])}}if(0===n.indexOf("$amount")){var i=n.split(":");return function(t,e){return parseFloat(i[1])}}if(0===n.indexOf("$primaryColor")){var i=n.split(":");return NINJA.primaryColor||i[1]}if(0===n.indexOf("$secondaryColor")){var i=n.split(":");return NINJA.secondaryColor||i[1]}}if(t.features.customize_invoice_design){if("header"===e)return function(e,i){return 1===e||"1"==t.account.all_pages_header?n:""};if("footer"===e)return function(e,i){return e===i||"1"==t.account.all_pages_footer?n:""}}return"text"===e&&(n=NINJA.parseMarkdownText(n,!0)),n}function o(t){window.ninjaFontVfs[t.folder]&&(folder="fonts/"+t.folder,pdfMake.fonts[t.name]={normal:folder+"/"+t.normal,italics:folder+"/"+t.italics,bold:folder+"/"+t.bold,bolditalics:folder+"/"+t.bolditalics})}e=NINJA.decodeJavascript(t,e);var r=JSON.parse(e,i);t.invoice_design_id;if(!t.features.remove_created_by&&!isEdge){var s="function"==typeof r.footer?r.footer():r.footer;if(s)if(s.hasOwnProperty("columns"))s.columns.push({image:logoImages.imageLogo1,alignment:"right",width:130,margin:[0,0,0,0]});else{for(var a,c=0;c0&&e-1 in t))}function i(t,e,n){if(ot.isFunction(e))return ot.grep(t,function(t,i){return!!e.call(t,i,t)!==n});if(e.nodeType)return ot.grep(t,function(t){return t===e!==n});if("string"==typeof e){if(dt.test(e))return ot.filter(e,t,n);e=ot.filter(e,t)}return ot.grep(t,function(t){return ot.inArray(t,e)>=0!==n})}function o(t,e){do t=t[e];while(t&&1!==t.nodeType);return t}function r(t){var e=yt[t]={};return ot.each(t.match(Mt)||[],function(t,n){e[n]=!0}),e}function s(){ft.addEventListener?(ft.removeEventListener("DOMContentLoaded",a,!1),t.removeEventListener("load",a,!1)):(ft.detachEvent("onreadystatechange",a),t.detachEvent("onload",a))}function a(){(ft.addEventListener||"load"===event.type||"complete"===ft.readyState)&&(s(),ot.ready())}function c(t,e,n){if(void 0===n&&1===t.nodeType){var i="data-"+e.replace(Tt,"-$1").toLowerCase();if(n=t.getAttribute(i),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:zt.test(n)?ot.parseJSON(n):n)}catch(o){}ot.data(t,e,n)}else n=void 0}return n}function l(t){var e;for(e in t)if(("data"!==e||!ot.isEmptyObject(t[e]))&&"toJSON"!==e)return!1;return!0}function u(t,e,n,i){if(ot.acceptData(t)){var o,r,s=ot.expando,a=t.nodeType,c=a?ot.cache:t,l=a?t[s]:t[s]&&s;if(l&&c[l]&&(i||c[l].data)||void 0!==n||"string"!=typeof e)return l||(l=a?t[s]=V.pop()||ot.guid++:s),c[l]||(c[l]=a?{}:{toJSON:ot.noop}),"object"!=typeof e&&"function"!=typeof e||(i?c[l]=ot.extend(c[l],e):c[l].data=ot.extend(c[l].data,e)),r=c[l],i||(r.data||(r.data={}),r=r.data),void 0!==n&&(r[ot.camelCase(e)]=n),"string"==typeof e?(o=r[e],null==o&&(o=r[ot.camelCase(e)])):o=r,o}}function h(t,e,n){if(ot.acceptData(t)){var i,o,r=t.nodeType,s=r?ot.cache:t,a=r?t[ot.expando]:ot.expando;if(s[a]){if(e&&(i=n?s[a]:s[a].data)){ot.isArray(e)?e=e.concat(ot.map(e,ot.camelCase)):e in i?e=[e]:(e=ot.camelCase(e),e=e in i?[e]:e.split(" ")),o=e.length;for(;o--;)delete i[e[o]];if(n?!l(i):!ot.isEmptyObject(i))return}(n||(delete s[a].data,l(s[a])))&&(r?ot.cleanData([t],!0):nt.deleteExpando||s!=s.window?delete s[a]:s[a]=null)}}}function d(){return!0}function p(){return!1}function f(){try{return ft.activeElement}catch(t){}}function g(t){var e=Et.split("|"),n=t.createDocumentFragment();if(n.createElement)for(;e.length;)n.createElement(e.pop());return n}function m(t,e){var n,i,o=0,r=typeof t.getElementsByTagName!==_t?t.getElementsByTagName(e||"*"):typeof t.querySelectorAll!==_t?t.querySelectorAll(e||"*"):void 0;if(!r)for(r=[],n=t.childNodes||t;null!=(i=n[o]);o++)!e||ot.nodeName(i,e)?r.push(i):ot.merge(r,m(i,e));return void 0===e||e&&ot.nodeName(t,e)?ot.merge([t],r):r}function b(t){Nt.test(t.type)&&(t.defaultChecked=t.checked)}function v(t,e){return ot.nodeName(t,"table")&&ot.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function M(t){return t.type=(null!==ot.find.attr(t,"type"))+"/"+t.type,t}function y(t){var e=Yt.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function A(t,e){for(var n,i=0;null!=(n=t[i]);i++)ot._data(n,"globalEval",!e||ot._data(e[i],"globalEval"))}function w(t,e){if(1===e.nodeType&&ot.hasData(t)){var n,i,o,r=ot._data(t),s=ot._data(e,r),a=r.events;if(a){delete s.handle,s.events={};for(n in a)for(i=0,o=a[n].length;i")).appendTo(e.documentElement),e=(Qt[0].contentWindow||Qt[0].contentDocument).document,e.write(),e.close(),n=z(t,e),Qt.detach()),Zt[t]=n),n}function x(t,e){return{get:function(){var n=t();if(null!=n)return n?void delete this.get:(this.get=e).apply(this,arguments)}}}function C(t,e){if(e in t)return e;for(var n=e.charAt(0).toUpperCase()+e.slice(1),i=e,o=de.length;o--;)if(e=de[o]+n,e in t)return e;return i}function O(t,e){for(var n,i,o,r=[],s=0,a=t.length;s=0&&n=0},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},isPlainObject:function(t){var e;if(!t||"object"!==ot.type(t)||t.nodeType||ot.isWindow(t))return!1;try{if(t.constructor&&!et.call(t,"constructor")&&!et.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(nt.ownLast)for(e in t)return et.call(t,e);for(e in t);return void 0===e||et.call(t,e)},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?Z[tt.call(t)]||"object":typeof t},globalEval:function(e){e&&ot.trim(e)&&(t.execScript||function(e){t.eval.call(t,e)})(e)},camelCase:function(t){return t.replace(st,"ms-").replace(at,ct)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e,i){var o,r=0,s=t.length,a=n(t);if(i){if(a)for(;rw.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function i(t){return t[R]=!0,t}function o(t){var e=D.createElement("div");try{return!!t(e)}catch(n){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function r(t,e){for(var n=t.split("|"),i=t.length;i--;)w.attrHandle[n[i]]=e}function s(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||Y)-(~t.sourceIndex||Y);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function a(t){return function(e){var n=e.nodeName.toLowerCase();return"input"===n&&e.type===t}}function c(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t; -}}function l(t){return i(function(e){return e=+e,i(function(n,i){for(var o,r=t([],n.length,e),s=r.length;s--;)n[o=r[s]]&&(n[o]=!(i[o]=n[o]))})})}function u(t){return t&&"undefined"!=typeof t.getElementsByTagName&&t}function h(){}function d(t){for(var e=0,n=t.length,i="";e1?function(e,n,i){for(var o=t.length;o--;)if(!t[o](e,n,i))return!1;return!0}:t[0]}function g(t,n,i){for(var o=0,r=n.length;o-1&&(i[l]=!(s[l]=h))}}else M=m(M===s?M.splice(f,M.length):M),r?r(null,s,M,c):Q.apply(s,M)})}function v(t){for(var e,n,i,o=t.length,r=w.relative[t[0].type],s=r||w.relative[" "],a=r?1:0,c=p(function(t){return t===e},s,!0),l=p(function(t){return tt(e,t)>-1},s,!0),u=[function(t,n,i){var o=!r&&(i||n!==O)||((e=n).nodeType?c(t,n,i):l(t,n,i));return e=null,o}];a1&&f(u),a>1&&d(t.slice(0,a-1).concat({value:" "===t[a-2].type?"*":""})).replace(ct,"$1"),n,a0,r=t.length>0,s=function(i,s,a,c,l){var u,h,d,p=0,f="0",g=i&&[],b=[],v=O,M=i||r&&w.find.TAG("*",l),y=X+=null==v?1:Math.random()||.1,A=M.length;for(l&&(O=s!==D&&s);f!==A&&null!=(u=M[f]);f++){if(r&&u){for(h=0;d=t[h++];)if(d(u,s,a)){c.push(u);break}l&&(X=y)}o&&((u=!d&&u)&&p--,i&&g.push(u))}if(p+=f,o&&f!==p){for(h=0;d=n[h++];)d(g,b,s,a);if(i){if(p>0)for(;f--;)g[f]||b[f]||(b[f]=G.call(c));b=m(b)}Q.apply(c,b),l&&!i&&b.length>0&&p+n.length>1&&e.uniqueSort(c)}return l&&(X=y,O=v),g};return o?i(s):s}var y,A,w,_,z,T,x,C,O,S,N,L,D,k,q,W,E,B,I,R="sizzle"+1*new Date,P=t.document,X=0,F=0,H=n(),j=n(),U=n(),$=function(t,e){return t===e&&(N=!0),0},Y=1<<31,V={}.hasOwnProperty,J=[],G=J.pop,K=J.push,Q=J.push,Z=J.slice,tt=function(t,e){for(var n=0,i=t.length;n+~]|"+nt+")"+nt+"*"),ht=new RegExp("="+nt+"*([^\\]'\"]*?)"+nt+"*\\]","g"),dt=new RegExp(st),pt=new RegExp("^"+ot+"$"),ft={ID:new RegExp("^#("+it+")"),CLASS:new RegExp("^\\.("+it+")"),TAG:new RegExp("^("+it.replace("w","w*")+")"),ATTR:new RegExp("^"+rt),PSEUDO:new RegExp("^"+st),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+nt+"*(even|odd|(([+-]|)(\\d*)n|)"+nt+"*(?:([+-]|)"+nt+"*(\\d+)|))"+nt+"*\\)|)","i"),bool:new RegExp("^(?:"+et+")$","i"),needsContext:new RegExp("^"+nt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+nt+"*((?:-\\d)?\\d*)"+nt+"*\\)|)(?=[^-]|$)","i")},gt=/^(?:input|select|textarea|button)$/i,mt=/^h\d$/i,bt=/^[^{]+\{\s*\[native \w/,vt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Mt=/[+~]/,yt=/'|\\/g,At=new RegExp("\\\\([\\da-f]{1,6}"+nt+"?|("+nt+")|.)","ig"),wt=function(t,e,n){var i="0x"+e-65536;return i!==i||n?e:i<0?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)},_t=function(){L()};try{Q.apply(J=Z.call(P.childNodes),P.childNodes),J[P.childNodes.length].nodeType}catch(zt){Q={apply:J.length?function(t,e){K.apply(t,Z.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}A=e.support={},z=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return!!e&&"HTML"!==e.nodeName},L=e.setDocument=function(t){var e,n,i=t?t.ownerDocument||t:P;return i!==D&&9===i.nodeType&&i.documentElement?(D=i,k=i.documentElement,n=i.defaultView,n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",_t,!1):n.attachEvent&&n.attachEvent("onunload",_t)),q=!z(i),A.attributes=o(function(t){return t.className="i",!t.getAttribute("className")}),A.getElementsByTagName=o(function(t){return t.appendChild(i.createComment("")),!t.getElementsByTagName("*").length}),A.getElementsByClassName=bt.test(i.getElementsByClassName),A.getById=o(function(t){return k.appendChild(t).id=R,!i.getElementsByName||!i.getElementsByName(R).length}),A.getById?(w.find.ID=function(t,e){if("undefined"!=typeof e.getElementById&&q){var n=e.getElementById(t);return n&&n.parentNode?[n]:[]}},w.filter.ID=function(t){var e=t.replace(At,wt);return function(t){return t.getAttribute("id")===e}}):(delete w.find.ID,w.filter.ID=function(t){var e=t.replace(At,wt);return function(t){var n="undefined"!=typeof t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}}),w.find.TAG=A.getElementsByTagName?function(t,e){return"undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t):A.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,i=[],o=0,r=e.getElementsByTagName(t);if("*"===t){for(;n=r[o++];)1===n.nodeType&&i.push(n);return i}return r},w.find.CLASS=A.getElementsByClassName&&function(t,e){if(q)return e.getElementsByClassName(t)},E=[],W=[],(A.qsa=bt.test(i.querySelectorAll))&&(o(function(t){k.appendChild(t).innerHTML="",t.querySelectorAll("[msallowcapture^='']").length&&W.push("[*^$]="+nt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||W.push("\\["+nt+"*(?:value|"+et+")"),t.querySelectorAll("[id~="+R+"-]").length||W.push("~="),t.querySelectorAll(":checked").length||W.push(":checked"),t.querySelectorAll("a#"+R+"+*").length||W.push(".#.+[+~]")}),o(function(t){var e=i.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&W.push("name"+nt+"*[*^$|!~]?="),t.querySelectorAll(":enabled").length||W.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),W.push(",.*:")})),(A.matchesSelector=bt.test(B=k.matches||k.webkitMatchesSelector||k.mozMatchesSelector||k.oMatchesSelector||k.msMatchesSelector))&&o(function(t){A.disconnectedMatch=B.call(t,"div"),B.call(t,"[s!='']:x"),E.push("!=",st)}),W=W.length&&new RegExp(W.join("|")),E=E.length&&new RegExp(E.join("|")),e=bt.test(k.compareDocumentPosition),I=e||bt.test(k.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},$=e?function(t,e){if(t===e)return N=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n?n:(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&n||!A.sortDetached&&e.compareDocumentPosition(t)===n?t===i||t.ownerDocument===P&&I(P,t)?-1:e===i||e.ownerDocument===P&&I(P,e)?1:S?tt(S,t)-tt(S,e):0:4&n?-1:1)}:function(t,e){if(t===e)return N=!0,0;var n,o=0,r=t.parentNode,a=e.parentNode,c=[t],l=[e];if(!r||!a)return t===i?-1:e===i?1:r?-1:a?1:S?tt(S,t)-tt(S,e):0;if(r===a)return s(t,e);for(n=t;n=n.parentNode;)c.unshift(n);for(n=e;n=n.parentNode;)l.unshift(n);for(;c[o]===l[o];)o++;return o?s(c[o],l[o]):c[o]===P?-1:l[o]===P?1:0},i):D},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==D&&L(t),n=n.replace(ht,"='$1']"),A.matchesSelector&&q&&(!E||!E.test(n))&&(!W||!W.test(n)))try{var i=B.call(t,n);if(i||A.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(o){}return e(n,D,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==D&&L(t),I(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==D&&L(t);var n=w.attrHandle[e.toLowerCase()],i=n&&V.call(w.attrHandle,e.toLowerCase())?n(t,e,!q):void 0;return void 0!==i?i:A.attributes||!q?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],i=0,o=0;if(N=!A.detectDuplicates,S=!A.sortStable&&t.slice(0),t.sort($),N){for(;e=t[o++];)e===t[o]&&(i=n.push(o));for(;i--;)t.splice(n[i],1)}return S=null,t},_=e.getText=function(t){var e,n="",i=0,o=t.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=_(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[i++];)n+=_(e);return n},w=e.selectors={cacheLength:50,createPseudo:i,match:ft,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(At,wt),t[3]=(t[3]||t[4]||t[5]||"").replace(At,wt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return ft.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&dt.test(n)&&(e=T(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(At,wt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=H[t+" "];return e||(e=new RegExp("(^|"+nt+")"+t+"("+nt+"|$)"))&&H(t,function(t){return e.test("string"==typeof t.className&&t.className||"undefined"!=typeof t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,i){return function(o){var r=e.attr(o,t);return null==r?"!="===n:!n||(r+="","="===n?r===i:"!="===n?r!==i:"^="===n?i&&0===r.indexOf(i):"*="===n?i&&r.indexOf(i)>-1:"$="===n?i&&r.slice(-i.length)===i:"~="===n?(" "+r.replace(at," ")+" ").indexOf(i)>-1:"|="===n&&(r===i||r.slice(0,i.length+1)===i+"-"))}},CHILD:function(t,e,n,i,o){var r="nth"!==t.slice(0,3),s="last"!==t.slice(-4),a="of-type"===e;return 1===i&&0===o?function(t){return!!t.parentNode}:function(e,n,c){var l,u,h,d,p,f,g=r!==s?"nextSibling":"previousSibling",m=e.parentNode,b=a&&e.nodeName.toLowerCase(),v=!c&&!a;if(m){if(r){for(;g;){for(h=e;h=h[g];)if(a?h.nodeName.toLowerCase()===b:1===h.nodeType)return!1;f=g="only"===t&&!f&&"nextSibling"}return!0}if(f=[s?m.firstChild:m.lastChild],s&&v){for(u=m[R]||(m[R]={}),l=u[t]||[],p=l[0]===X&&l[1],d=l[0]===X&&l[2],h=p&&m.childNodes[p];h=++p&&h&&h[g]||(d=p=0)||f.pop();)if(1===h.nodeType&&++d&&h===e){u[t]=[X,p,d];break}}else if(v&&(l=(e[R]||(e[R]={}))[t])&&l[0]===X)d=l[1];else for(;(h=++p&&h&&h[g]||(d=p=0)||f.pop())&&((a?h.nodeName.toLowerCase()!==b:1!==h.nodeType)||!++d||(v&&((h[R]||(h[R]={}))[t]=[X,d]),h!==e)););return d-=o,d===i||d%i===0&&d/i>=0}}},PSEUDO:function(t,n){var o,r=w.pseudos[t]||w.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return r[R]?r(n):r.length>1?(o=[t,t,"",n],w.setFilters.hasOwnProperty(t.toLowerCase())?i(function(t,e){for(var i,o=r(t,n),s=o.length;s--;)i=tt(t,o[s]),t[i]=!(e[i]=o[s])}):function(t){return r(t,0,o)}):r}},pseudos:{not:i(function(t){var e=[],n=[],o=x(t.replace(ct,"$1"));return o[R]?i(function(t,e,n,i){for(var r,s=o(t,null,i,[]),a=t.length;a--;)(r=s[a])&&(t[a]=!(e[a]=r))}):function(t,i,r){return e[0]=t,o(e,null,r,n),e[0]=null,!n.pop()}}),has:i(function(t){return function(n){return e(t,n).length>0}}),contains:i(function(t){return t=t.replace(At,wt),function(e){return(e.textContent||e.innerText||_(e)).indexOf(t)>-1}}),lang:i(function(t){return pt.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(At,wt).toLowerCase(),function(e){var n;do if(n=q?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return n=n.toLowerCase(),n===t||0===n.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===k},focus:function(t){return t===D.activeElement&&(!D.hasFocus||D.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,t.selected===!0},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!w.pseudos.empty(t)},header:function(t){return mt.test(t.nodeName)},input:function(t){return gt.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:l(function(){return[0]}),last:l(function(t,e){return[e-1]}),eq:l(function(t,e,n){return[n<0?n+e:n]}),even:l(function(t,e){for(var n=0;n=0;)t.push(i);return t}),gt:l(function(t,e,n){for(var i=n<0?n+e:n;++i2&&"ID"===(s=r[0]).type&&A.getById&&9===e.nodeType&&q&&w.relative[r[1].type]){if(e=(w.find.ID(s.matches[0].replace(At,wt),e)||[])[0],!e)return n;l&&(e=e.parentNode),t=t.slice(r.shift().value.length)}for(o=ft.needsContext.test(t)?0:r.length;o--&&(s=r[o],!w.relative[a=s.type]);)if((c=w.find[a])&&(i=c(s.matches[0].replace(At,wt),Mt.test(r[0].type)&&u(e.parentNode)||e))){if(r.splice(o,1),t=i.length&&d(r),!t)return Q.apply(n,i),n;break}}return(l||x(t,h))(i,e,!q,n,Mt.test(t)&&u(e.parentNode)||e),n},A.sortStable=R.split("").sort($).join("")===R,A.detectDuplicates=!!N,L(),A.sortDetached=o(function(t){return 1&t.compareDocumentPosition(D.createElement("div"))}),o(function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")})||r("type|href|height|width",function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),A.attributes&&o(function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||r("value",function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),o(function(t){return null==t.getAttribute("disabled")})||r(et,function(t,e,n){var i;if(!n)return t[e]===!0?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null}),e}(t);ot.find=lt,ot.expr=lt.selectors,ot.expr[":"]=ot.expr.pseudos,ot.unique=lt.uniqueSort,ot.text=lt.getText,ot.isXMLDoc=lt.isXML,ot.contains=lt.contains;var ut=ot.expr.match.needsContext,ht=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,dt=/^.[^:#\[\.,]*$/;ot.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?ot.find.matchesSelector(i,t)?[i]:[]:ot.find.matches(t,ot.grep(e,function(t){return 1===t.nodeType}))},ot.fn.extend({find:function(t){var e,n=[],i=this,o=i.length;if("string"!=typeof t)return this.pushStack(ot(t).filter(function(){for(e=0;e1?ot.unique(n):n),n.selector=this.selector?this.selector+" "+t:t,n},filter:function(t){return this.pushStack(i(this,t||[],!1))},not:function(t){return this.pushStack(i(this,t||[],!0))},is:function(t){return!!i(this,"string"==typeof t&&ut.test(t)?ot(t):t||[],!1).length}});var pt,ft=t.document,gt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,mt=ot.fn.init=function(t,e){var n,i;if(!t)return this;if("string"==typeof t){if(n="<"===t.charAt(0)&&">"===t.charAt(t.length-1)&&t.length>=3?[null,t,null]:gt.exec(t),!n||!n[1]&&e)return!e||e.jquery?(e||pt).find(t):this.constructor(e).find(t);if(n[1]){if(e=e instanceof ot?e[0]:e,ot.merge(this,ot.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:ft,!0)),ht.test(n[1])&&ot.isPlainObject(e))for(n in e)ot.isFunction(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}if(i=ft.getElementById(n[2]),i&&i.parentNode){if(i.id!==n[2])return pt.find(t);this.length=1,this[0]=i}return this.context=ft,this.selector=t,this}return t.nodeType?(this.context=this[0]=t,this.length=1,this):ot.isFunction(t)?"undefined"!=typeof pt.ready?pt.ready(t):t(ot):(void 0!==t.selector&&(this.selector=t.selector,this.context=t.context),ot.makeArray(t,this))};mt.prototype=ot.fn,pt=ot(ft);var bt=/^(?:parents|prev(?:Until|All))/,vt={children:!0,contents:!0,next:!0,prev:!0};ot.extend({dir:function(t,e,n){for(var i=[],o=t[e];o&&9!==o.nodeType&&(void 0===n||1!==o.nodeType||!ot(o).is(n));)1===o.nodeType&&i.push(o),o=o[e];return i},sibling:function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n}}),ot.fn.extend({has:function(t){var e,n=ot(t,this),i=n.length;return this.filter(function(){for(e=0;e-1:1===n.nodeType&&ot.find.matchesSelector(n,t))){r.push(n);break}return this.pushStack(r.length>1?ot.unique(r):r)},index:function(t){return t?"string"==typeof t?ot.inArray(this[0],ot(t)):ot.inArray(t.jquery?t[0]:t,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(ot.unique(ot.merge(this.get(),ot(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),ot.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return ot.dir(t,"parentNode")},parentsUntil:function(t,e,n){return ot.dir(t,"parentNode",n)},next:function(t){return o(t,"nextSibling")},prev:function(t){return o(t,"previousSibling")},nextAll:function(t){return ot.dir(t,"nextSibling")},prevAll:function(t){return ot.dir(t,"previousSibling")},nextUntil:function(t,e,n){return ot.dir(t,"nextSibling",n)},prevUntil:function(t,e,n){return ot.dir(t,"previousSibling",n)},siblings:function(t){return ot.sibling((t.parentNode||{}).firstChild,t)},children:function(t){return ot.sibling(t.firstChild)},contents:function(t){return ot.nodeName(t,"iframe")?t.contentDocument||t.contentWindow.document:ot.merge([],t.childNodes)}},function(t,e){ot.fn[t]=function(n,i){var o=ot.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(o=ot.filter(i,o)),this.length>1&&(vt[t]||(o=ot.unique(o)),bt.test(t)&&(o=o.reverse())),this.pushStack(o)}});var Mt=/\S+/g,yt={};ot.Callbacks=function(t){t="string"==typeof t?yt[t]||r(t):ot.extend({},t);var e,n,i,o,s,a,c=[],l=!t.once&&[],u=function(r){for(n=t.memory&&r,i=!0,s=a||0,a=0,o=c.length,e=!0;c&&s-1;)c.splice(i,1),e&&(i<=o&&o--,i<=s&&s--)}),this},has:function(t){return t?ot.inArray(t,c)>-1:!(!c||!c.length)},empty:function(){return c=[],o=0,this},disable:function(){return c=l=n=void 0,this},disabled:function(){return!c},lock:function(){return l=void 0,n||h.disable(),this},locked:function(){return!l},fireWith:function(t,n){return!c||i&&!l||(n=n||[],n=[t,n.slice?n.slice():n],e?l.push(n):u(n)),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!i}};return h},ot.extend({Deferred:function(t){var e=[["resolve","done",ot.Callbacks("once memory"),"resolved"],["reject","fail",ot.Callbacks("once memory"),"rejected"],["notify","progress",ot.Callbacks("memory")]],n="pending",i={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var t=arguments;return ot.Deferred(function(n){ot.each(e,function(e,r){var s=ot.isFunction(t[e])&&t[e];o[r[1]](function(){var t=s&&s.apply(this,arguments);t&&ot.isFunction(t.promise)?t.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[r[0]+"With"](this===i?n.promise():this,s?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?ot.extend(t,i):i}},o={};return i.pipe=i.then,ot.each(e,function(t,r){var s=r[2],a=r[3];i[r[1]]=s.add,a&&s.add(function(){n=a},e[1^t][2].disable,e[2][2].lock),o[r[0]]=function(){return o[r[0]+"With"](this===o?i:this,arguments),this},o[r[0]+"With"]=s.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(t){var e,n,i,o=0,r=J.call(arguments),s=r.length,a=1!==s||t&&ot.isFunction(t.promise)?s:0,c=1===a?t:ot.Deferred(),l=function(t,n,i){return function(o){n[t]=this,i[t]=arguments.length>1?J.call(arguments):o,i===e?c.notifyWith(n,i):--a||c.resolveWith(n,i)}};if(s>1)for(e=new Array(s),n=new Array(s),i=new Array(s);o0||(At.resolveWith(ft,[ot]),ot.fn.triggerHandler&&(ot(ft).triggerHandler("ready"),ot(ft).off("ready")))}}}),ot.ready.promise=function(e){if(!At)if(At=ot.Deferred(),"complete"===ft.readyState)setTimeout(ot.ready);else if(ft.addEventListener)ft.addEventListener("DOMContentLoaded",a,!1),t.addEventListener("load",a,!1);else{ft.attachEvent("onreadystatechange",a),t.attachEvent("onload",a);var n=!1;try{n=null==t.frameElement&&ft.documentElement}catch(i){}n&&n.doScroll&&!function o(){if(!ot.isReady){try{n.doScroll("left")}catch(t){return setTimeout(o,50)}s(),ot.ready()}}()}return At.promise(e)};var wt,_t="undefined";for(wt in ot(nt))break;nt.ownLast="0"!==wt,nt.inlineBlockNeedsLayout=!1,ot(function(){var t,e,n,i;n=ft.getElementsByTagName("body")[0],n&&n.style&&(e=ft.createElement("div"),i=ft.createElement("div"),i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(i).appendChild(e),typeof e.style.zoom!==_t&&(e.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",nt.inlineBlockNeedsLayout=t=3===e.offsetWidth,t&&(n.style.zoom=1)),n.removeChild(i))}),function(){var t=ft.createElement("div");if(null==nt.deleteExpando){nt.deleteExpando=!0;try{delete t.test}catch(e){nt.deleteExpando=!1}}t=null}(),ot.acceptData=function(t){var e=ot.noData[(t.nodeName+" ").toLowerCase()],n=+t.nodeType||1;return(1===n||9===n)&&(!e||e!==!0&&t.getAttribute("classid")===e)};var zt=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Tt=/([A-Z])/g;ot.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(t){return t=t.nodeType?ot.cache[t[ot.expando]]:t[ot.expando],!!t&&!l(t)},data:function(t,e,n){return u(t,e,n)},removeData:function(t,e){return h(t,e)},_data:function(t,e,n){return u(t,e,n,!0)},_removeData:function(t,e){return h(t,e,!0)}}),ot.fn.extend({data:function(t,e){var n,i,o,r=this[0],s=r&&r.attributes;if(void 0===t){if(this.length&&(o=ot.data(r),1===r.nodeType&&!ot._data(r,"parsedAttrs"))){for(n=s.length;n--;)s[n]&&(i=s[n].name,0===i.indexOf("data-")&&(i=ot.camelCase(i.slice(5)),c(r,i,o[i])));ot._data(r,"parsedAttrs",!0)}return o}return"object"==typeof t?this.each(function(){ot.data(this,t)}):arguments.length>1?this.each(function(){ot.data(this,t,e)}):r?c(r,t,ot.data(r,t)):void 0},removeData:function(t){return this.each(function(){ot.removeData(this,t)})}}),ot.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=ot._data(t,e),n&&(!i||ot.isArray(n)?i=ot._data(t,e,ot.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=ot.queue(t,e),i=n.length,o=n.shift(),r=ot._queueHooks(t,e),s=function(){ot.dequeue(t,e)};"inprogress"===o&&(o=n.shift(),i--),o&&("fx"===e&&n.unshift("inprogress"),delete r.stop,o.call(t,s,r)),!i&&r&&r.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return ot._data(t,n)||ot._data(t,n,{empty:ot.Callbacks("once memory").add(function(){ot._removeData(t,e+"queue"),ot._removeData(t,n)})})}}),ot.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length
a",nt.leadingWhitespace=3===e.firstChild.nodeType,nt.tbody=!e.getElementsByTagName("tbody").length,nt.htmlSerialize=!!e.getElementsByTagName("link").length,nt.html5Clone="<:nav>"!==ft.createElement("nav").cloneNode(!0).outerHTML,t.type="checkbox",t.checked=!0,n.appendChild(t),nt.appendChecked=t.checked,e.innerHTML="",nt.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,n.appendChild(e),e.innerHTML="",nt.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,nt.noCloneEvent=!0,e.attachEvent&&(e.attachEvent("onclick",function(){nt.noCloneEvent=!1}),e.cloneNode(!0).click()),null==nt.deleteExpando){nt.deleteExpando=!0;try{delete e.test}catch(i){nt.deleteExpando=!1}}}(),function(){var e,n,i=ft.createElement("div");for(e in{submit:!0,change:!0,focusin:!0})n="on"+e,(nt[e+"Bubbles"]=n in t)||(i.setAttribute(n,"t"),nt[e+"Bubbles"]=i.attributes[n].expando===!1);i=null}();var Lt=/^(?:input|select|textarea)$/i,Dt=/^key/,kt=/^(?:mouse|pointer|contextmenu)|click/,qt=/^(?:focusinfocus|focusoutblur)$/,Wt=/^([^.]*)(?:\.(.+)|)$/;ot.event={global:{},add:function(t,e,n,i,o){var r,s,a,c,l,u,h,d,p,f,g,m=ot._data(t);if(m){for(n.handler&&(c=n,n=c.handler,o=c.selector),n.guid||(n.guid=ot.guid++),(s=m.events)||(s=m.events={}),(u=m.handle)||(u=m.handle=function(t){return typeof ot===_t||t&&ot.event.triggered===t.type?void 0:ot.event.dispatch.apply(u.elem,arguments)},u.elem=t),e=(e||"").match(Mt)||[""],a=e.length;a--;)r=Wt.exec(e[a])||[],p=g=r[1],f=(r[2]||"").split(".").sort(),p&&(l=ot.event.special[p]||{},p=(o?l.delegateType:l.bindType)||p,l=ot.event.special[p]||{},h=ot.extend({type:p,origType:g,data:i,handler:n,guid:n.guid,selector:o,needsContext:o&&ot.expr.match.needsContext.test(o),namespace:f.join(".")},c),(d=s[p])||(d=s[p]=[],d.delegateCount=0,l.setup&&l.setup.call(t,i,f,u)!==!1||(t.addEventListener?t.addEventListener(p,u,!1):t.attachEvent&&t.attachEvent("on"+p,u))),l.add&&(l.add.call(t,h),h.handler.guid||(h.handler.guid=n.guid)),o?d.splice(d.delegateCount++,0,h):d.push(h),ot.event.global[p]=!0);t=null}},remove:function(t,e,n,i,o){var r,s,a,c,l,u,h,d,p,f,g,m=ot.hasData(t)&&ot._data(t);if(m&&(u=m.events)){for(e=(e||"").match(Mt)||[""],l=e.length;l--;)if(a=Wt.exec(e[l])||[],p=g=a[1],f=(a[2]||"").split(".").sort(),p){for(h=ot.event.special[p]||{},p=(i?h.delegateType:h.bindType)||p,d=u[p]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),c=r=d.length;r--;)s=d[r],!o&&g!==s.origType||n&&n.guid!==s.guid||a&&!a.test(s.namespace)||i&&i!==s.selector&&("**"!==i||!s.selector)||(d.splice(r,1),s.selector&&d.delegateCount--,h.remove&&h.remove.call(t,s));c&&!d.length&&(h.teardown&&h.teardown.call(t,f,m.handle)!==!1||ot.removeEvent(t,p,m.handle),delete u[p])}else for(p in u)ot.event.remove(t,p+e[l],n,i,!0);ot.isEmptyObject(u)&&(delete m.handle,ot._removeData(t,"events"))}},trigger:function(e,n,i,o){var r,s,a,c,l,u,h,d=[i||ft],p=et.call(e,"type")?e.type:e,f=et.call(e,"namespace")?e.namespace.split("."):[];if(a=u=i=i||ft,3!==i.nodeType&&8!==i.nodeType&&!qt.test(p+ot.event.triggered)&&(p.indexOf(".")>=0&&(f=p.split("."),p=f.shift(),f.sort()),s=p.indexOf(":")<0&&"on"+p,e=e[ot.expando]?e:new ot.Event(p,"object"==typeof e&&e),e.isTrigger=o?2:3,e.namespace=f.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),n=null==n?[e]:ot.makeArray(n,[e]),l=ot.event.special[p]||{},o||!l.trigger||l.trigger.apply(i,n)!==!1)){if(!o&&!l.noBubble&&!ot.isWindow(i)){for(c=l.delegateType||p,qt.test(c+p)||(a=a.parentNode);a;a=a.parentNode)d.push(a),u=a;u===(i.ownerDocument||ft)&&d.push(u.defaultView||u.parentWindow||t)}for(h=0;(a=d[h++])&&!e.isPropagationStopped();)e.type=h>1?c:l.bindType||p,r=(ot._data(a,"events")||{})[e.type]&&ot._data(a,"handle"),r&&r.apply(a,n),r=s&&a[s],r&&r.apply&&ot.acceptData(a)&&(e.result=r.apply(a,n),e.result===!1&&e.preventDefault());if(e.type=p,!o&&!e.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&ot.acceptData(i)&&s&&i[p]&&!ot.isWindow(i)){u=i[s],u&&(i[s]=null),ot.event.triggered=p;try{i[p]()}catch(g){}ot.event.triggered=void 0, -u&&(i[s]=u)}return e.result}},dispatch:function(t){t=ot.event.fix(t);var e,n,i,o,r,s=[],a=J.call(arguments),c=(ot._data(this,"events")||{})[t.type]||[],l=ot.event.special[t.type]||{};if(a[0]=t,t.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,t)!==!1){for(s=ot.event.handlers.call(this,t,c),e=0;(o=s[e++])&&!t.isPropagationStopped();)for(t.currentTarget=o.elem,r=0;(i=o.handlers[r++])&&!t.isImmediatePropagationStopped();)t.namespace_re&&!t.namespace_re.test(i.namespace)||(t.handleObj=i,t.data=i.data,n=((ot.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,a),void 0!==n&&(t.result=n)===!1&&(t.preventDefault(),t.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,t),t.result}},handlers:function(t,e){var n,i,o,r,s=[],a=e.delegateCount,c=t.target;if(a&&c.nodeType&&(!t.button||"click"!==t.type))for(;c!=this;c=c.parentNode||this)if(1===c.nodeType&&(c.disabled!==!0||"click"!==t.type)){for(o=[],r=0;r=0:ot.find(n,this,null,[c]).length),o[n]&&o.push(i);o.length&&s.push({elem:c,handlers:o})}return a]","i"),Rt=/^\s+/,Pt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Xt=/<([\w:]+)/,Ft=/\s*$/g,Jt={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:nt.htmlSerialize?[0,"",""]:[1,"X
","
"]},Gt=g(ft),Kt=Gt.appendChild(ft.createElement("div"));Jt.optgroup=Jt.option,Jt.tbody=Jt.tfoot=Jt.colgroup=Jt.caption=Jt.thead,Jt.th=Jt.td,ot.extend({clone:function(t,e,n){var i,o,r,s,a,c=ot.contains(t.ownerDocument,t);if(nt.html5Clone||ot.isXMLDoc(t)||!It.test("<"+t.nodeName+">")?r=t.cloneNode(!0):(Kt.innerHTML=t.outerHTML,Kt.removeChild(r=Kt.firstChild)),!(nt.noCloneEvent&&nt.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||ot.isXMLDoc(t)))for(i=m(r),a=m(t),s=0;null!=(o=a[s]);++s)i[s]&&_(o,i[s]);if(e)if(n)for(a=a||m(t),i=i||m(r),s=0;null!=(o=a[s]);s++)w(o,i[s]);else w(t,r);return i=m(r,"script"),i.length>0&&A(i,!c&&m(t,"script")),i=a=o=null,r},buildFragment:function(t,e,n,i){for(var o,r,s,a,c,l,u,h=t.length,d=g(e),p=[],f=0;f")+u[2],o=u[0];o--;)a=a.lastChild;if(!nt.leadingWhitespace&&Rt.test(r)&&p.push(e.createTextNode(Rt.exec(r)[0])),!nt.tbody)for(r="table"!==c||Ft.test(r)?""!==u[1]||Ft.test(r)?0:a:a.firstChild,o=r&&r.childNodes.length;o--;)ot.nodeName(l=r.childNodes[o],"tbody")&&!l.childNodes.length&&r.removeChild(l);for(ot.merge(p,a.childNodes),a.textContent="";a.firstChild;)a.removeChild(a.firstChild);a=d.lastChild}else p.push(e.createTextNode(r));for(a&&d.removeChild(a),nt.appendChecked||ot.grep(m(p,"input"),b),f=0;r=p[f++];)if((!i||ot.inArray(r,i)===-1)&&(s=ot.contains(r.ownerDocument,r),a=m(d.appendChild(r),"script"),s&&A(a),n))for(o=0;r=a[o++];)$t.test(r.type||"")&&n.push(r);return a=null,d},cleanData:function(t,e){for(var n,i,o,r,s=0,a=ot.expando,c=ot.cache,l=nt.deleteExpando,u=ot.event.special;null!=(n=t[s]);s++)if((e||ot.acceptData(n))&&(o=n[a],r=o&&c[o])){if(r.events)for(i in r.events)u[i]?ot.event.remove(n,i):ot.removeEvent(n,i,r.handle);c[o]&&(delete c[o],l?delete n[a]:typeof n.removeAttribute!==_t?n.removeAttribute(a):n[a]=null,V.push(o))}}}),ot.fn.extend({text:function(t){return St(this,function(t){return void 0===t?ot.text(this):this.empty().append((this[0]&&this[0].ownerDocument||ft).createTextNode(t))},null,t,arguments.length)},append:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=v(this,t);e.appendChild(t)}})},prepend:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=v(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},remove:function(t,e){for(var n,i=t?ot.filter(t,this):this,o=0;null!=(n=i[o]);o++)e||1!==n.nodeType||ot.cleanData(m(n)),n.parentNode&&(e&&ot.contains(n.ownerDocument,n)&&A(m(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++){for(1===t.nodeType&&ot.cleanData(m(t,!1));t.firstChild;)t.removeChild(t.firstChild);t.options&&ot.nodeName(t,"select")&&(t.options.length=0)}return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return ot.clone(this,t,e)})},html:function(t){return St(this,function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t)return 1===e.nodeType?e.innerHTML.replace(Bt,""):void 0;if("string"==typeof t&&!jt.test(t)&&(nt.htmlSerialize||!It.test(t))&&(nt.leadingWhitespace||!Rt.test(t))&&!Jt[(Xt.exec(t)||["",""])[1].toLowerCase()]){t=t.replace(Pt,"<$1>");try{for(;n1&&"string"==typeof d&&!nt.checkClone&&Ut.test(d))return this.each(function(n){var i=u.eq(n);p&&(t[0]=d.call(this,n,i.html())),i.domManip(t,e)});if(l&&(a=ot.buildFragment(t,this[0].ownerDocument,!1,this),n=a.firstChild,1===a.childNodes.length&&(a=n),n)){for(r=ot.map(m(a,"script"),M),o=r.length;c
t
",o=e.getElementsByTagName("td"),o[0].style.cssText="margin:0;border:0;padding:0;display:none",a=0===o[0].offsetHeight,a&&(o[0].style.display="",o[1].style.display="none",a=0===o[0].offsetHeight),n.removeChild(i))}var n,i,o,r,s,a,c;n=ft.createElement("div"),n.innerHTML="
a",o=n.getElementsByTagName("a")[0],i=o&&o.style,i&&(i.cssText="float:left;opacity:.5",nt.opacity="0.5"===i.opacity,nt.cssFloat=!!i.cssFloat,n.style.backgroundClip="content-box",n.cloneNode(!0).style.backgroundClip="",nt.clearCloneStyle="content-box"===n.style.backgroundClip,nt.boxSizing=""===i.boxSizing||""===i.MozBoxSizing||""===i.WebkitBoxSizing,ot.extend(nt,{reliableHiddenOffsets:function(){return null==a&&e(),a},boxSizingReliable:function(){return null==s&&e(),s},pixelPosition:function(){return null==r&&e(),r},reliableMarginRight:function(){return null==c&&e(),c}}))}(),ot.swap=function(t,e,n,i){var o,r,s={};for(r in e)s[r]=t.style[r],t.style[r]=e[r];o=n.apply(t,i||[]);for(r in e)t.style[r]=s[r];return o};var re=/alpha\([^)]*\)/i,se=/opacity\s*=\s*([^)]*)/,ae=/^(none|table(?!-c[ea]).+)/,ce=new RegExp("^("+xt+")(.*)$","i"),le=new RegExp("^([+-])=("+xt+")","i"),ue={position:"absolute",visibility:"hidden",display:"block"},he={letterSpacing:"0",fontWeight:"400"},de=["Webkit","O","Moz","ms"];ot.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=ee(t,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":nt.cssFloat?"cssFloat":"styleFloat"},style:function(t,e,n,i){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var o,r,s,a=ot.camelCase(e),c=t.style;if(e=ot.cssProps[a]||(ot.cssProps[a]=C(c,a)),s=ot.cssHooks[e]||ot.cssHooks[a],void 0===n)return s&&"get"in s&&void 0!==(o=s.get(t,!1,i))?o:c[e];if(r=typeof n,"string"===r&&(o=le.exec(n))&&(n=(o[1]+1)*o[2]+parseFloat(ot.css(t,e)),r="number"),null!=n&&n===n&&("number"!==r||ot.cssNumber[a]||(n+="px"),nt.clearCloneStyle||""!==n||0!==e.indexOf("background")||(c[e]="inherit"),!(s&&"set"in s&&void 0===(n=s.set(t,n,i)))))try{c[e]=n}catch(l){}}},css:function(t,e,n,i){var o,r,s,a=ot.camelCase(e);return e=ot.cssProps[a]||(ot.cssProps[a]=C(t.style,a)),s=ot.cssHooks[e]||ot.cssHooks[a],s&&"get"in s&&(r=s.get(t,!0,n)),void 0===r&&(r=ee(t,e,i)),"normal"===r&&e in he&&(r=he[e]),""===n||n?(o=parseFloat(r),n===!0||ot.isNumeric(o)?o||0:r):r}}),ot.each(["height","width"],function(t,e){ot.cssHooks[e]={get:function(t,n,i){if(n)return ae.test(ot.css(t,"display"))&&0===t.offsetWidth?ot.swap(t,ue,function(){return L(t,e,i)}):L(t,e,i)},set:function(t,n,i){var o=i&&te(t);return S(t,n,i?N(t,e,i,nt.boxSizing&&"border-box"===ot.css(t,"boxSizing",!1,o),o):0)}}}),nt.opacity||(ot.cssHooks.opacity={get:function(t,e){return se.test((e&&t.currentStyle?t.currentStyle.filter:t.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":e?"1":""},set:function(t,e){var n=t.style,i=t.currentStyle,o=ot.isNumeric(e)?"alpha(opacity="+100*e+")":"",r=i&&i.filter||n.filter||"";n.zoom=1,(e>=1||""===e)&&""===ot.trim(r.replace(re,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===e||i&&!i.filter)||(n.filter=re.test(r)?r.replace(re,o):r+" "+o)}}),ot.cssHooks.marginRight=x(nt.reliableMarginRight,function(t,e){if(e)return ot.swap(t,{display:"inline-block"},ee,[t,"marginRight"])}),ot.each({margin:"",padding:"",border:"Width"},function(t,e){ot.cssHooks[t+e]={expand:function(n){for(var i=0,o={},r="string"==typeof n?n.split(" "):[n];i<4;i++)o[t+Ct[i]+e]=r[i]||r[i-2]||r[0];return o}},ne.test(t)||(ot.cssHooks[t+e].set=S)}),ot.fn.extend({css:function(t,e){return St(this,function(t,e,n){var i,o,r={},s=0;if(ot.isArray(e)){for(i=te(t),o=e.length;s1)},show:function(){return O(this,!0)},hide:function(){return O(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Ot(this)?ot(this).show():ot(this).hide()})}}),ot.Tween=D,D.prototype={constructor:D,init:function(t,e,n,i,o,r){this.elem=t,this.prop=n,this.easing=o||"swing",this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=r||(ot.cssNumber[n]?"":"px")},cur:function(){var t=D.propHooks[this.prop];return t&&t.get?t.get(this):D.propHooks._default.get(this)},run:function(t){var e,n=D.propHooks[this.prop];return this.options.duration?this.pos=e=ot.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):D.propHooks._default.set(this),this}},D.prototype.init.prototype=D.prototype,D.propHooks={_default:{get:function(t){var e;return null==t.elem[t.prop]||t.elem.style&&null!=t.elem.style[t.prop]?(e=ot.css(t.elem,t.prop,""),e&&"auto"!==e?e:0):t.elem[t.prop]},set:function(t){ot.fx.step[t.prop]?ot.fx.step[t.prop](t):t.elem.style&&(null!=t.elem.style[ot.cssProps[t.prop]]||ot.cssHooks[t.prop])?ot.style(t.elem,t.prop,t.now+t.unit):t.elem[t.prop]=t.now}}},D.propHooks.scrollTop=D.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},ot.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2}},ot.fx=D.prototype.init,ot.fx.step={};var pe,fe,ge=/^(?:toggle|show|hide)$/,me=new RegExp("^(?:([+-])=|)("+xt+")([a-z%]*)$","i"),be=/queueHooks$/,ve=[E],Me={"*":[function(t,e){var n=this.createTween(t,e),i=n.cur(),o=me.exec(e),r=o&&o[3]||(ot.cssNumber[t]?"":"px"),s=(ot.cssNumber[t]||"px"!==r&&+i)&&me.exec(ot.css(n.elem,t)),a=1,c=20;if(s&&s[3]!==r){r=r||s[3],o=o||[],s=+i||1;do a=a||".5",s/=a,ot.style(n.elem,t,s+r);while(a!==(a=n.cur()/i)&&1!==a&&--c)}return o&&(s=n.start=+s||+i||0,n.unit=r,n.end=o[1]?s+(o[1]+1)*o[2]:+o[2]),n}]};ot.Animation=ot.extend(I,{tweener:function(t,e){ot.isFunction(t)?(e=t,t=["*"]):t=t.split(" ");for(var n,i=0,o=t.length;i
a",i=e.getElementsByTagName("a")[0],n=ft.createElement("select"),o=n.appendChild(ft.createElement("option")),t=e.getElementsByTagName("input")[0],i.style.cssText="top:1px",nt.getSetAttribute="t"!==e.className,nt.style=/top/.test(i.getAttribute("style")),nt.hrefNormalized="/a"===i.getAttribute("href"),nt.checkOn=!!t.value,nt.optSelected=o.selected,nt.enctype=!!ft.createElement("form").enctype,n.disabled=!0,nt.optDisabled=!o.disabled,t=ft.createElement("input"),t.setAttribute("value",""),nt.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),nt.radioValue="t"===t.value}();var ye=/\r/g;ot.fn.extend({val:function(t){var e,n,i,o=this[0];{if(arguments.length)return i=ot.isFunction(t),this.each(function(n){var o;1===this.nodeType&&(o=i?t.call(this,n,ot(this).val()):t,null==o?o="":"number"==typeof o?o+="":ot.isArray(o)&&(o=ot.map(o,function(t){return null==t?"":t+""})),e=ot.valHooks[this.type]||ot.valHooks[this.nodeName.toLowerCase()],e&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))});if(o)return e=ot.valHooks[o.type]||ot.valHooks[o.nodeName.toLowerCase()],e&&"get"in e&&void 0!==(n=e.get(o,"value"))?n:(n=o.value,"string"==typeof n?n.replace(ye,""):null==n?"":n)}}}),ot.extend({valHooks:{option:{get:function(t){var e=ot.find.attr(t,"value");return null!=e?e:ot.trim(ot.text(t))}},select:{get:function(t){for(var e,n,i=t.options,o=t.selectedIndex,r="select-one"===t.type||o<0,s=r?null:[],a=r?o+1:i.length,c=o<0?a:r?o:0;c=0)try{i.selected=n=!0}catch(a){i.scrollHeight}else i.selected=!1;return n||(t.selectedIndex=-1),o}}}}),ot.each(["radio","checkbox"],function(){ot.valHooks[this]={set:function(t,e){if(ot.isArray(e))return t.checked=ot.inArray(ot(t).val(),e)>=0}},nt.checkOn||(ot.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var Ae,we,_e=ot.expr.attrHandle,ze=/^(?:checked|selected)$/i,Te=nt.getSetAttribute,xe=nt.input;ot.fn.extend({attr:function(t,e){return St(this,ot.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){ot.removeAttr(this,t)})}}),ot.extend({attr:function(t,e,n){var i,o,r=t.nodeType;if(t&&3!==r&&8!==r&&2!==r)return typeof t.getAttribute===_t?ot.prop(t,e,n):(1===r&&ot.isXMLDoc(t)||(e=e.toLowerCase(),i=ot.attrHooks[e]||(ot.expr.match.bool.test(e)?we:Ae)),void 0===n?i&&"get"in i&&null!==(o=i.get(t,e))?o:(o=ot.find.attr(t,e),null==o?void 0:o):null!==n?i&&"set"in i&&void 0!==(o=i.set(t,n,e))?o:(t.setAttribute(e,n+""),n):void ot.removeAttr(t,e))},removeAttr:function(t,e){var n,i,o=0,r=e&&e.match(Mt);if(r&&1===t.nodeType)for(;n=r[o++];)i=ot.propFix[n]||n,ot.expr.match.bool.test(n)?xe&&Te||!ze.test(n)?t[i]=!1:t[ot.camelCase("default-"+n)]=t[i]=!1:ot.attr(t,n,""),t.removeAttribute(Te?n:i)},attrHooks:{type:{set:function(t,e){if(!nt.radioValue&&"radio"===e&&ot.nodeName(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}}}),we={set:function(t,e,n){return e===!1?ot.removeAttr(t,n):xe&&Te||!ze.test(n)?t.setAttribute(!Te&&ot.propFix[n]||n,n):t[ot.camelCase("default-"+n)]=t[n]=!0,n}},ot.each(ot.expr.match.bool.source.match(/\w+/g),function(t,e){var n=_e[e]||ot.find.attr;_e[e]=xe&&Te||!ze.test(e)?function(t,e,i){var o,r;return i||(r=_e[e],_e[e]=o,o=null!=n(t,e,i)?e.toLowerCase():null,_e[e]=r),o}:function(t,e,n){if(!n)return t[ot.camelCase("default-"+e)]?e.toLowerCase():null}}),xe&&Te||(ot.attrHooks.value={set:function(t,e,n){return ot.nodeName(t,"input")?void(t.defaultValue=e):Ae&&Ae.set(t,e,n)}}),Te||(Ae={set:function(t,e,n){var i=t.getAttributeNode(n);if(i||t.setAttributeNode(i=t.ownerDocument.createAttribute(n)),i.value=e+="","value"===n||e===t.getAttribute(n))return e}},_e.id=_e.name=_e.coords=function(t,e,n){var i;if(!n)return(i=t.getAttributeNode(e))&&""!==i.value?i.value:null},ot.valHooks.button={get:function(t,e){var n=t.getAttributeNode(e);if(n&&n.specified)return n.value},set:Ae.set},ot.attrHooks.contenteditable={set:function(t,e,n){Ae.set(t,""!==e&&e,n)}},ot.each(["width","height"],function(t,e){ot.attrHooks[e]={set:function(t,n){if(""===n)return t.setAttribute(e,"auto"),n}}})),nt.style||(ot.attrHooks.style={get:function(t){return t.style.cssText||void 0},set:function(t,e){return t.style.cssText=e+""}});var Ce=/^(?:input|select|textarea|button|object)$/i,Oe=/^(?:a|area)$/i;ot.fn.extend({prop:function(t,e){return St(this,ot.prop,t,e,arguments.length>1)},removeProp:function(t){return t=ot.propFix[t]||t,this.each(function(){try{this[t]=void 0,delete this[t]}catch(e){}})}}),ot.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(t,e,n){var i,o,r,s=t.nodeType;if(t&&3!==s&&8!==s&&2!==s)return r=1!==s||!ot.isXMLDoc(t),r&&(e=ot.propFix[e]||e,o=ot.propHooks[e]),void 0!==n?o&&"set"in o&&void 0!==(i=o.set(t,n,e))?i:t[e]=n:o&&"get"in o&&null!==(i=o.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=ot.find.attr(t,"tabindex");return e?parseInt(e,10):Ce.test(t.nodeName)||Oe.test(t.nodeName)&&t.href?0:-1}}}}),nt.hrefNormalized||ot.each(["href","src"],function(t,e){ot.propHooks[e]={get:function(t){return t.getAttribute(e,4)}}}),nt.optSelected||(ot.propHooks.selected={get:function(t){var e=t.parentNode;return e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex),null}}),ot.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ot.propFix[this.toLowerCase()]=this}),nt.enctype||(ot.propFix.enctype="encoding");var Se=/[\t\r\n\f]/g;ot.fn.extend({addClass:function(t){var e,n,i,o,r,s,a=0,c=this.length,l="string"==typeof t&&t;if(ot.isFunction(t))return this.each(function(e){ot(this).addClass(t.call(this,e,this.className))});if(l)for(e=(t||"").match(Mt)||[];a=0;)i=i.replace(" "+o+" "," ");s=t?ot.trim(i):"",n.className!==s&&(n.className=s)}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):ot.isFunction(t)?this.each(function(n){ -ot(this).toggleClass(t.call(this,n,this.className,e),e)}):this.each(function(){if("string"===n)for(var e,i=0,o=ot(this),r=t.match(Mt)||[];e=r[i++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else n!==_t&&"boolean"!==n||(this.className&&ot._data(this,"__className__",this.className),this.className=this.className||t===!1?"":ot._data(this,"__className__")||"")})},hasClass:function(t){for(var e=" "+t+" ",n=0,i=this.length;n=0)return!0;return!1}}),ot.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){ot.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}),ot.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)},bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,i){return this.on(e,t,n,i)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)}});var Ne=ot.now(),Le=/\?/,De=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;ot.parseJSON=function(e){if(t.JSON&&t.JSON.parse)return t.JSON.parse(e+"");var n,i=null,o=ot.trim(e+"");return o&&!ot.trim(o.replace(De,function(t,e,o,r){return n&&e&&(i=0),0===i?t:(n=o||e,i+=!r-!o,"")}))?Function("return "+o)():ot.error("Invalid JSON: "+e)},ot.parseXML=function(e){var n,i;if(!e||"string"!=typeof e)return null;try{t.DOMParser?(i=new DOMParser,n=i.parseFromString(e,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(e))}catch(o){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||ot.error("Invalid XML: "+e),n};var ke,qe,We=/#.*$/,Ee=/([?&])_=[^&]*/,Be=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ie=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Re=/^(?:GET|HEAD)$/,Pe=/^\/\//,Xe=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Fe={},He={},je="*/".concat("*");try{qe=location.href}catch(Ue){qe=ft.createElement("a"),qe.href="",qe=qe.href}ke=Xe.exec(qe.toLowerCase())||[],ot.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qe,type:"GET",isLocal:Ie.test(ke[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":je,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":ot.parseJSON,"text xml":ot.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?X(X(t,ot.ajaxSettings),e):X(ot.ajaxSettings,t)},ajaxPrefilter:R(Fe),ajaxTransport:R(He),ajax:function(t,e){function n(t,e,n,i){var o,u,b,v,y,w=e;2!==M&&(M=2,a&&clearTimeout(a),l=void 0,s=i||"",A.readyState=t>0?4:0,o=t>=200&&t<300||304===t,n&&(v=F(h,A,n)),v=H(h,v,A,o),o?(h.ifModified&&(y=A.getResponseHeader("Last-Modified"),y&&(ot.lastModified[r]=y),y=A.getResponseHeader("etag"),y&&(ot.etag[r]=y)),204===t||"HEAD"===h.type?w="nocontent":304===t?w="notmodified":(w=v.state,u=v.data,b=v.error,o=!b)):(b=w,!t&&w||(w="error",t<0&&(t=0))),A.status=t,A.statusText=(e||w)+"",o?f.resolveWith(d,[u,w,A]):f.rejectWith(d,[A,w,b]),A.statusCode(m),m=void 0,c&&p.trigger(o?"ajaxSuccess":"ajaxError",[A,h,o?u:b]),g.fireWith(d,[A,w]),c&&(p.trigger("ajaxComplete",[A,h]),--ot.active||ot.event.trigger("ajaxStop")))}"object"==typeof t&&(e=t,t=void 0),e=e||{};var i,o,r,s,a,c,l,u,h=ot.ajaxSetup({},e),d=h.context||h,p=h.context&&(d.nodeType||d.jquery)?ot(d):ot.event,f=ot.Deferred(),g=ot.Callbacks("once memory"),m=h.statusCode||{},b={},v={},M=0,y="canceled",A={readyState:0,getResponseHeader:function(t){var e;if(2===M){if(!u)for(u={};e=Be.exec(s);)u[e[1].toLowerCase()]=e[2];e=u[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===M?s:null},setRequestHeader:function(t,e){var n=t.toLowerCase();return M||(t=v[n]=v[n]||t,b[t]=e),this},overrideMimeType:function(t){return M||(h.mimeType=t),this},statusCode:function(t){var e;if(t)if(M<2)for(e in t)m[e]=[m[e],t[e]];else A.always(t[A.status]);return this},abort:function(t){var e=t||y;return l&&l.abort(e),n(0,e),this}};if(f.promise(A).complete=g.add,A.success=A.done,A.error=A.fail,h.url=((t||h.url||qe)+"").replace(We,"").replace(Pe,ke[1]+"//"),h.type=e.method||e.type||h.method||h.type,h.dataTypes=ot.trim(h.dataType||"*").toLowerCase().match(Mt)||[""],null==h.crossDomain&&(i=Xe.exec(h.url.toLowerCase()),h.crossDomain=!(!i||i[1]===ke[1]&&i[2]===ke[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(ke[3]||("http:"===ke[1]?"80":"443")))),h.data&&h.processData&&"string"!=typeof h.data&&(h.data=ot.param(h.data,h.traditional)),P(Fe,h,e,A),2===M)return A;c=ot.event&&h.global,c&&0===ot.active++&&ot.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Re.test(h.type),r=h.url,h.hasContent||(h.data&&(r=h.url+=(Le.test(r)?"&":"?")+h.data,delete h.data),h.cache===!1&&(h.url=Ee.test(r)?r.replace(Ee,"$1_="+Ne++):r+(Le.test(r)?"&":"?")+"_="+Ne++)),h.ifModified&&(ot.lastModified[r]&&A.setRequestHeader("If-Modified-Since",ot.lastModified[r]),ot.etag[r]&&A.setRequestHeader("If-None-Match",ot.etag[r])),(h.data&&h.hasContent&&h.contentType!==!1||e.contentType)&&A.setRequestHeader("Content-Type",h.contentType),A.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+je+"; q=0.01":""):h.accepts["*"]);for(o in h.headers)A.setRequestHeader(o,h.headers[o]);if(h.beforeSend&&(h.beforeSend.call(d,A,h)===!1||2===M))return A.abort();y="abort";for(o in{success:1,error:1,complete:1})A[o](h[o]);if(l=P(He,h,e,A)){A.readyState=1,c&&p.trigger("ajaxSend",[A,h]),h.async&&h.timeout>0&&(a=setTimeout(function(){A.abort("timeout")},h.timeout));try{M=1,l.send(b,n)}catch(w){if(!(M<2))throw w;n(-1,w)}}else n(-1,"No Transport");return A},getJSON:function(t,e,n){return ot.get(t,e,n,"json")},getScript:function(t,e){return ot.get(t,void 0,e,"script")}}),ot.each(["get","post"],function(t,e){ot[e]=function(t,n,i,o){return ot.isFunction(n)&&(o=o||i,i=n,n=void 0),ot.ajax({url:t,type:e,dataType:o,data:n,success:i})}}),ot._evalUrl=function(t){return ot.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},ot.fn.extend({wrapAll:function(t){if(ot.isFunction(t))return this.each(function(e){ot(this).wrapAll(t.call(this,e))});if(this[0]){var e=ot(t,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstChild&&1===t.firstChild.nodeType;)t=t.firstChild;return t}).append(this)}return this},wrapInner:function(t){return ot.isFunction(t)?this.each(function(e){ot(this).wrapInner(t.call(this,e))}):this.each(function(){var e=ot(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=ot.isFunction(t);return this.each(function(n){ot(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(){return this.parent().each(function(){ot.nodeName(this,"body")||ot(this).replaceWith(this.childNodes)}).end()}}),ot.expr.filters.hidden=function(t){return t.offsetWidth<=0&&t.offsetHeight<=0||!nt.reliableHiddenOffsets()&&"none"===(t.style&&t.style.display||ot.css(t,"display"))},ot.expr.filters.visible=function(t){return!ot.expr.filters.hidden(t)};var $e=/%20/g,Ye=/\[\]$/,Ve=/\r?\n/g,Je=/^(?:submit|button|image|reset|file)$/i,Ge=/^(?:input|select|textarea|keygen)/i;ot.param=function(t,e){var n,i=[],o=function(t,e){e=ot.isFunction(e)?e():null==e?"":e,i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(void 0===e&&(e=ot.ajaxSettings&&ot.ajaxSettings.traditional),ot.isArray(t)||t.jquery&&!ot.isPlainObject(t))ot.each(t,function(){o(this.name,this.value)});else for(n in t)j(n,t[n],e,o);return i.join("&").replace($e,"+")},ot.fn.extend({serialize:function(){return ot.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=ot.prop(this,"elements");return t?ot.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!ot(this).is(":disabled")&&Ge.test(this.nodeName)&&!Je.test(t)&&(this.checked||!Nt.test(t))}).map(function(t,e){var n=ot(this).val();return null==n?null:ot.isArray(n)?ot.map(n,function(t){return{name:e.name,value:t.replace(Ve,"\r\n")}}):{name:e.name,value:n.replace(Ve,"\r\n")}}).get()}}),ot.ajaxSettings.xhr=void 0!==t.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&U()||$()}:U;var Ke=0,Qe={},Ze=ot.ajaxSettings.xhr();t.attachEvent&&t.attachEvent("onunload",function(){for(var t in Qe)Qe[t](void 0,!0)}),nt.cors=!!Ze&&"withCredentials"in Ze,Ze=nt.ajax=!!Ze,Ze&&ot.ajaxTransport(function(t){if(!t.crossDomain||nt.cors){var e;return{send:function(n,i){var o,r=t.xhr(),s=++Ke;if(r.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)r[o]=t.xhrFields[o];t.mimeType&&r.overrideMimeType&&r.overrideMimeType(t.mimeType),t.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(o in n)void 0!==n[o]&&r.setRequestHeader(o,n[o]+"");r.send(t.hasContent&&t.data||null),e=function(n,o){var a,c,l;if(e&&(o||4===r.readyState))if(delete Qe[s],e=void 0,r.onreadystatechange=ot.noop,o)4!==r.readyState&&r.abort();else{l={},a=r.status,"string"==typeof r.responseText&&(l.text=r.responseText);try{c=r.statusText}catch(u){c=""}a||!t.isLocal||t.crossDomain?1223===a&&(a=204):a=l.text?200:404}l&&i(a,c,l,r.getAllResponseHeaders())},t.async?4===r.readyState?setTimeout(e):r.onreadystatechange=Qe[s]=e:e()},abort:function(){e&&e(void 0,!0)}}}}),ot.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(t){return ot.globalEval(t),t}}}),ot.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET",t.global=!1)}),ot.ajaxTransport("script",function(t){if(t.crossDomain){var e,n=ft.head||ot("head")[0]||ft.documentElement;return{send:function(i,o){e=ft.createElement("script"),e.async=!0,t.scriptCharset&&(e.charset=t.scriptCharset),e.src=t.url,e.onload=e.onreadystatechange=function(t,n){(n||!e.readyState||/loaded|complete/.test(e.readyState))&&(e.onload=e.onreadystatechange=null,e.parentNode&&e.parentNode.removeChild(e),e=null,n||o(200,"success"))},n.insertBefore(e,n.firstChild)},abort:function(){e&&e.onload(void 0,!0)}}}});var tn=[],en=/(=)\?(?=&|$)|\?\?/;ot.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=tn.pop()||ot.expando+"_"+Ne++;return this[t]=!0,t}}),ot.ajaxPrefilter("json jsonp",function(e,n,i){var o,r,s,a=e.jsonp!==!1&&(en.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&en.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return o=e.jsonpCallback=ot.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(en,"$1"+o):e.jsonp!==!1&&(e.url+=(Le.test(e.url)?"&":"?")+e.jsonp+"="+o),e.converters["script json"]=function(){return s||ot.error(o+" was not called"),s[0]},e.dataTypes[0]="json",r=t[o],t[o]=function(){s=arguments},i.always(function(){t[o]=r,e[o]&&(e.jsonpCallback=n.jsonpCallback,tn.push(o)),s&&ot.isFunction(r)&&r(s[0]),s=r=void 0}),"script"}),ot.parseHTML=function(t,e,n){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(n=e,e=!1),e=e||ft;var i=ht.exec(t),o=!n&&[];return i?[e.createElement(i[1])]:(i=ot.buildFragment([t],e,o),o&&o.length&&ot(o).remove(),ot.merge([],i.childNodes))};var nn=ot.fn.load;ot.fn.load=function(t,e,n){if("string"!=typeof t&&nn)return nn.apply(this,arguments);var i,o,r,s=this,a=t.indexOf(" ");return a>=0&&(i=ot.trim(t.slice(a,t.length)),t=t.slice(0,a)),ot.isFunction(e)?(n=e,e=void 0):e&&"object"==typeof e&&(r="POST"),s.length>0&&ot.ajax({url:t,type:r,dataType:"html",data:e}).done(function(t){o=arguments,s.html(i?ot("
").append(ot.parseHTML(t)).find(i):t)}).complete(n&&function(t,e){s.each(n,o||[t.responseText,e,t])}),this},ot.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){ot.fn[e]=function(t){return this.on(e,t)}}),ot.expr.filters.animated=function(t){return ot.grep(ot.timers,function(e){return t===e.elem}).length};var on=t.document.documentElement;ot.offset={setOffset:function(t,e,n){var i,o,r,s,a,c,l,u=ot.css(t,"position"),h=ot(t),d={};"static"===u&&(t.style.position="relative"),a=h.offset(),r=ot.css(t,"top"),c=ot.css(t,"left"),l=("absolute"===u||"fixed"===u)&&ot.inArray("auto",[r,c])>-1,l?(i=h.position(),s=i.top,o=i.left):(s=parseFloat(r)||0,o=parseFloat(c)||0),ot.isFunction(e)&&(e=e.call(t,n,a)),null!=e.top&&(d.top=e.top-a.top+s),null!=e.left&&(d.left=e.left-a.left+o),"using"in e?e.using.call(t,d):h.css(d)}},ot.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ot.offset.setOffset(this,t,e)});var e,n,i={top:0,left:0},o=this[0],r=o&&o.ownerDocument;if(r)return e=r.documentElement,ot.contains(e,o)?(typeof o.getBoundingClientRect!==_t&&(i=o.getBoundingClientRect()),n=Y(r),{top:i.top+(n.pageYOffset||e.scrollTop)-(e.clientTop||0),left:i.left+(n.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}):i},position:function(){if(this[0]){var t,e,n={top:0,left:0},i=this[0];return"fixed"===ot.css(i,"position")?e=i.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),ot.nodeName(t[0],"html")||(n=t.offset()),n.top+=ot.css(t[0],"borderTopWidth",!0),n.left+=ot.css(t[0],"borderLeftWidth",!0)),{top:e.top-n.top-ot.css(i,"marginTop",!0),left:e.left-n.left-ot.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||on;t&&!ot.nodeName(t,"html")&&"static"===ot.css(t,"position");)t=t.offsetParent;return t||on})}}),ot.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var n=/Y/.test(e);ot.fn[t]=function(i){return St(this,function(t,i,o){var r=Y(t);return void 0===o?r?e in r?r[e]:r.document.documentElement[i]:t[i]:void(r?r.scrollTo(n?ot(r).scrollLeft():o,n?o:ot(r).scrollTop()):t[i]=o)},t,i,arguments.length,null)}}),ot.each(["top","left"],function(t,e){ot.cssHooks[e]=x(nt.pixelPosition,function(t,n){if(n)return n=ee(t,e),ie.test(n)?ot(t).position()[e]+"px":n})}),ot.each({Height:"height",Width:"width"},function(t,e){ot.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,i){ot.fn[i]=function(i,o){var r=arguments.length&&(n||"boolean"!=typeof i),s=n||(i===!0||o===!0?"margin":"border");return St(this,function(e,n,i){var o;return ot.isWindow(e)?e.document.documentElement["client"+t]:9===e.nodeType?(o=e.documentElement,Math.max(e.body["scroll"+t],o["scroll"+t],e.body["offset"+t],o["offset"+t],o["client"+t])):void 0===i?ot.css(e,n,s):ot.style(e,n,i,s)},e,r?i:void 0,r,null)}})}),ot.fn.size=function(){return this.length},ot.fn.andSelf=ot.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return ot});var rn=t.jQuery,sn=t.$;return ot.noConflict=function(e){return t.$===ot&&(t.$=sn),e&&t.jQuery===ot&&(t.jQuery=rn),ot},typeof e===_t&&(t.jQuery=t.$=ot),ot}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(e,i){var o,r,s,a=e.nodeName.toLowerCase();return"area"===a?(o=e.parentNode,r=o.name,!(!e.href||!r||"map"!==o.nodeName.toLowerCase())&&(s=t("img[usemap='#"+r+"']")[0],!!s&&n(s))):(/input|select|textarea|button|object/.test(a)?!e.disabled:"a"===a?e.href||i:i)&&n(e)}function n(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}function i(t){for(var e,n;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(n=parseInt(t.css("zIndex"),10),!isNaN(n)&&0!==n))return n;t=t.parent()}return 0}function o(){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.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=r(t("
"))}function r(e){var n="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(n,"mouseout",function(){t(this).removeClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!==-1&&t(this).removeClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!==-1&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(n,"mouseover",s)}function s(){t.datepicker._isDisabledDatepicker(b.inline?b.dpDiv.parent()[0]:b.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!==-1&&t(this).addClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!==-1&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,n){t.extend(e,n);for(var i in n)null==n[i]&&(e[i]=n[i]);return e}function c(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.extend(t.ui,{version:"1.11.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({scrollParent:function(e){var n=this.css("position"),i="absolute"===n,o=e?/(auto|scroll|hidden)/:/(auto|scroll)/,r=this.parents().filter(function(){var e=t(this);return(!i||"static"!==e.css("position"))&&o.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==n&&r.length?r:t(this[0].ownerDocument||document)},uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(n){return!!t.data(n,e)}}):function(e,n,i){return!!t.data(e,i[3])},focusable:function(n){return e(n,!isNaN(t.attr(n,"tabindex")))},tabbable:function(n){var i=t.attr(n,"tabindex"),o=isNaN(i);return(o||i>=0)&&e(n,!o)}}),t("").outerWidth(1).jquery||t.each(["Width","Height"],function(e,n){function i(e,n,i,r){return t.each(o,function(){n-=parseFloat(t.css(e,"padding"+this))||0,i&&(n-=parseFloat(t.css(e,"border"+this+"Width"))||0),r&&(n-=parseFloat(t.css(e,"margin"+this))||0)}),n}var o="Width"===n?["Left","Right"]:["Top","Bottom"],r=n.toLowerCase(),s={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+n]=function(e){return void 0===e?s["inner"+n].call(this):this.each(function(){t(this).css(r,i(this,e)+"px")})},t.fn["outer"+n]=function(e,o){return"number"!=typeof e?s["outer"+n].call(this,e):this.each(function(){t(this).css(r,i(this,e,!0,o)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(n){return arguments.length?e.call(this,t.camelCase(n)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.fn.extend({focus:function(e){return function(n,i){return"number"==typeof n?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),i&&i.call(e)},n)}):e.apply(this,arguments)}}(t.fn.focus),disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(e){if(void 0!==e)return this.css("zIndex",e);if(this.length)for(var n,i,o=t(this[0]);o.length&&o[0]!==document;){if(n=o.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(i=parseInt(o.css("zIndex"),10),!isNaN(i)&&0!==i))return i;o=o.parent()}return 0}}),t.ui.plugin={add:function(e,n,i){var o,r=t.ui[e].prototype;for(o in i)r.plugins[o]=r.plugins[o]||[],r.plugins[o].push([n,i[o]])},call:function(t,e,n,i){var o,r=t.plugins[e];if(r&&(i||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o",options:{disabled:!1,create:null},_createWidget:function(e,n){n=t(n||this.defaultElement||this)[0],this.element=t(n),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),n!==this&&(t.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===n&&this.destroy()}}),this.document=t(n.style?n.ownerDocument:n.document||n),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(t.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:t.noop,widget:function(){return this.element},option:function(e,n){var i,o,r,s=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(s={},i=e.split("."),e=i.shift(),i.length){for(o=s[e]=t.widget.extend({},this.options[e]),r=0;r=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}});!function(){function e(t,e,n){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?n/100:1)]}function n(e,n){return parseInt(t.css(e,n),10)||0}function i(e){var n=e[0];return 9===n.nodeType?{width:e.width(), -height:e.height(),offset:{top:0,left:0}}:t.isWindow(n)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var o,r,s=Math.max,a=Math.abs,c=Math.round,l=/left|center|right/,u=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==o)return o;var e,n,i=t("
"),r=i.children()[0];return t("body").append(i),e=r.offsetWidth,i.css("overflow","scroll"),n=r.offsetWidth,e===n&&(n=i[0].clientWidth),i.remove(),o=e-n},getScrollInfo:function(e){var n=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),i=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),o="scroll"===n||"auto"===n&&e.width0?"right":"center",vertical:r<0?"top":i>0?"bottom":"middle"};gs(a(i),a(r))?c.important="horizontal":c.important="vertical",o.using.call(this,t,c)}),u.offset(t.extend(C,{using:l}))})},t.ui.position={fit:{left:function(t,e){var n,i=e.within,o=i.isWindow?i.scrollLeft:i.offset.left,r=i.width,a=t.left-e.collisionPosition.marginLeft,c=o-a,l=a+e.collisionWidth-r-o;e.collisionWidth>r?c>0&&l<=0?(n=t.left+c+e.collisionWidth-r-o,t.left+=c-n):l>0&&c<=0?t.left=o:c>l?t.left=o+r-e.collisionWidth:t.left=o:c>0?t.left+=c:l>0?t.left-=l:t.left=s(t.left-a,t.left)},top:function(t,e){var n,i=e.within,o=i.isWindow?i.scrollTop:i.offset.top,r=e.within.height,a=t.top-e.collisionPosition.marginTop,c=o-a,l=a+e.collisionHeight-r-o;e.collisionHeight>r?c>0&&l<=0?(n=t.top+c+e.collisionHeight-r-o,t.top+=c-n):l>0&&c<=0?t.top=o:c>l?t.top=o+r-e.collisionHeight:t.top=o:c>0?t.top+=c:l>0?t.top-=l:t.top=s(t.top-a,t.top)}},flip:{left:function(t,e){var n,i,o=e.within,r=o.offset.left+o.scrollLeft,s=o.width,c=o.isWindow?o.scrollLeft:o.offset.left,l=t.left-e.collisionPosition.marginLeft,u=l-c,h=l+e.collisionWidth-s-c,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];u<0?(n=t.left+d+p+f+e.collisionWidth-s-r,(n<0||n0&&(i=t.left-e.collisionPosition.marginLeft+d+p+f-c,(i>0||a(i)u&&(i<0||i0&&(n=t.top-e.collisionPosition.marginTop+p+f+g-c,t.top+p+f+g>h&&(n>0||a(n)10&&o<11,e.innerHTML="",n.removeChild(e)}()}();t.ui.position,t.widget("ui.accordion",{version:"1.11.2",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},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_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(),e.active<0&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e=this.options.icons;e&&(t("").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-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?void this._activate(e):("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()),void("disabled"===t&&(this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!e))))},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var n=t.ui.keyCode,i=this.headers.length,o=this.headers.index(e.target),r=!1;switch(e.keyCode){case n.RIGHT:case n.DOWN:r=this.headers[(o+1)%i];break;case n.LEFT:case n.UP:r=this.headers[(o-1+i)%i];break;case n.SPACE:case n.ENTER:this._eventHandler(e);break;case n.HOME:r=this.headers[0];break;case n.END:r=this.headers[i-1]}r&&(t(e.target).attr("tabIndex",-1),t(r).attr("tabIndex",0),r.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(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,n=this.options,i=n.heightStyle,o=this.element.parent();this.active=this._findActive(n.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(){var e=t(this),n=e.uniqueId().attr("id"),i=e.next(),o=i.uniqueId().attr("id");e.attr("aria-controls",o),i.attr("aria-labelledby",n)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(n.event),"fill"===i?(e=o.height(),this.element.siblings(":visible").each(function(){var n=t(this),i=n.css("position");"absolute"!==i&&"fixed"!==i&&(e-=n.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===i&&(e=0,this.headers.next().each(function(){e=Math.max(e,t(this).css("height","").height())}).height(e))},_activate:function(e){var n=this._findActive(e)[0];n!==this.active[0]&&(n=n||this.active[0],this._eventHandler({target:n,currentTarget:n,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var n={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){n[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,n),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var n=this.options,i=this.active,o=t(e.currentTarget),r=o[0]===i[0],s=r&&n.collapsible,a=s?t():o.next(),c=i.next(),l={oldHeader:i,oldPanel:c,newHeader:s?t():o,newPanel:a};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,l)===!1||(n.active=!s&&this.headers.index(o),this.active=r?t():o,this._toggle(l),i.removeClass("ui-accordion-header-active ui-state-active"),n.icons&&i.children(".ui-accordion-header-icon").removeClass(n.icons.activeHeader).addClass(n.icons.header),r||(o.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),n.icons&&o.children(".ui-accordion-header-icon").removeClass(n.icons.header).addClass(n.icons.activeHeader),o.next().addClass("ui-accordion-content-active")))},_toggle:function(e){var n=e.newPanel,i=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=n,this.prevHide=i,this.options.animate?this._animate(n,i,e):(i.hide(),n.show(),this._toggleComplete(e)),i.attr({"aria-hidden":"true"}),i.prev().attr("aria-selected","false"),n.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):n.length&&this.headers.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),n.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(t,e,n){var i,o,r,s=this,a=0,c=t.length&&(!e.length||t.index()",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 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").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var n=t(e.target);!this.mouseHandled&&n.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),n.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&t(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var n=t(e.currentTarget);n.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(e,n)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var n=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,n)},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(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").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").removeUniqueId().removeClass("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){var n,i,o,r,s=!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:s=!1,i=this.previousFilter||"",o=String.fromCharCode(e.keyCode),r=!1,clearTimeout(this.filterTimer),o===i?r=!0:o=i+o,n=this._filterMenuItems(o),n=r&&n.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):n,n.length||(o=String.fromCharCode(e.keyCode),n=this._filterMenuItems(o)),n.length?(this.focus(e,n),this.previousFilter=o,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}s&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(t):this.select(t))},refresh:function(){var e,n,i=this,o=this.options.icons.submenu,r=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),r.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),n=e.parent(),i=t("").addClass("ui-menu-icon ui-icon "+o).data("ui-menu-submenu-carat",!0);n.attr("aria-haspopup","true").prepend(i),e.attr("aria-labelledby",n.attr("id"))}),e=r.add(this.element),n=e.find(this.options.items),n.not(".ui-menu-item").each(function(){var e=t(this);i._isDivider(e)&&e.addClass("ui-widget-content ui-menu-divider")}),n.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),n.filter(".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),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!e).attr("aria-disabled",e),this._super(t,e)},focus:function(t,e){var n,i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),n=e.children(".ui-menu"),n.length&&t&&/^mouse/.test(t.type)&&this._startOpening(n),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var n,i,o,r,s,a;this._hasScroll()&&(n=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,i=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,o=e.offset().top-this.activeMenu.offset().top-n-i,r=this.activeMenu.scrollTop(),s=this.activeMenu.height(),a=e.outerHeight(),o<0?this.activeMenu.scrollTop(r+o):o+a>s&&this.activeMenu.scrollTop(r+o-s+a))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.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 n=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(n)},collapseAll:function(e,n){clearTimeout(this.timer),this.timer=this._delay(function(){var i=n?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));i.length||(i=this.element),this._close(i),this.blur(e),this.activeMenu=i},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(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},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 ").find(this.options.items).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,n){var i;this.active&&(i="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),i&&i.length&&this.active||(i=this.activeMenu.find(this.options.items)[e]()),this.focus(n,i)},nextPage:function(e){var n,i,o;return this.active?void(this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,o=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return n=t(this),n.offset().top-i-o<0}),this.focus(e,n)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]()))):void this.next(e)},previousPage:function(e){var n,i,o;return this.active?void(this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,o=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return n=t(this),n.offset().top-i+o>0}),this.focus(e,n)):this.focus(e,this.activeMenu.find(this.options.items).first()))):void this.next(e)},_hasScroll:function(){return this.element.outerHeight()",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},requestIndex:0,pending:0,_create:function(){var e,n,i,o=this.element[0].nodeName.toLowerCase(),r="textarea"===o,s="input"===o;this.isMultiLine=!!r||!s&&this.element.prop("isContentEditable"),this.valueMethod=this.element[r||s?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(o){if(this.element.prop("readOnly"))return e=!0,i=!0,void(n=!0);e=!1,i=!1,n=!1;var r=t.ui.keyCode;switch(o.keyCode){case r.PAGE_UP:e=!0,this._move("previousPage",o);break;case r.PAGE_DOWN:e=!0,this._move("nextPage",o);break;case r.UP:e=!0,this._keyEvent("previous",o);break;case r.DOWN:e=!0,this._keyEvent("next",o);break;case r.ENTER:this.menu.active&&(e=!0,o.preventDefault(),this.menu.select(o));break;case r.TAB:this.menu.active&&this.menu.select(o);break;case r.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(o),o.preventDefault());break;default:n=!0,this._searchTimeout(o)}},keypress:function(i){if(e)return e=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||i.preventDefault());if(!n){var o=t.ui.keyCode;switch(i.keyCode){case o.PAGE_UP:this._move("previousPage",i);break;case o.PAGE_DOWN:this._move("nextPage",i);break;case o.UP:this._keyEvent("previous",i);break;case o.DOWN:this._keyEvent("next",i)}}},input:function(t){return i?(i=!1,void t.preventDefault()):void this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?void delete this.cancelBlur:(clearTimeout(this.searching),this.close(t),void this._change(t))}}),this._initSource(),this.menu=t("
");var a=t("a",n),c=a[0],l=a[1],u=a[2],h=a[3];e.oApi._fnBindAction(c,{action:"first"},s),e.oApi._fnBindAction(l,{action:"previous"},s),e.oApi._fnBindAction(u,{action:"next"},s),e.oApi._fnBindAction(h,{action:"last"},s),e.aanFeatures.p||(n.id=e.sTableId+"_paginate",c.id=e.sTableId+"_first",l.id=e.sTableId+"_previous",u.id=e.sTableId+"_next",h.id=e.sTableId+"_last")},fnUpdate:function(e,n){if(e.aanFeatures.p){var i,o,r,s,a,c=e.oInstance.fnPagingInfo(),l=t.fn.dataTableExt.oPagination.iFullNumbersShowPages,u=Math.floor(l/2),h=Math.ceil(e.fnRecordsDisplay()/e._iDisplayLength),d=Math.ceil(e._iDisplayStart/e._iDisplayLength)+1,p="",f=(e.oClasses,e.aanFeatures.p);for(e._iDisplayLength===-1?(i=1,o=1,d=1):h=h-u?(i=h-l+1,o=h):(i=d-Math.ceil(l/2)+1,o=i+l-1),r=i;r<=o;r++)p+=d!==r?'
  • '+e.fnFormatNumber(r)+"
  • ":'
  • '+e.fnFormatNumber(r)+"
  • ";for(r=0,s=f.length;r",o[0];);return 4h.a.l(e,t[n])&&e.push(t[n]);return e},ya:function(t,e){t=t||[];for(var n=[],i=0,o=t.length;ii?n&&t.push(e):n||t.splice(i,1)},na:l,extend:a,ra:c,sa:l?c:a,A:s,Oa:function(t,e){if(!t)return t;var n,i={};for(n in t)t.hasOwnProperty(n)&&(i[n]=e(t[n],n,t));return i},Fa:function(t){for(;t.firstChild;)h.removeNode(t.firstChild)},ec:function(t){t=h.a.R(t);for(var e=n.createElement("div"),i=0,o=t.length;if?t.setAttribute("selected",e):t.selected=e},ta:function(e){return null===e||e===t?"":e.trim?e.trim():e.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},oc:function(t,e){for(var n=[],i=(t||"").split(e),o=0,r=i.length;ot.length)&&t.substring(0,e.length)===e},Sb:function(t,e){if(t===e)return!0;if(11===t.nodeType)return!1;if(e.contains)return e.contains(3===t.nodeType?t.parentNode:t);if(e.compareDocumentPosition)return 16==(16&e.compareDocumentPosition(t));for(;t&&t!=e;)t=t.parentNode;return!!t},Ea:function(t){return h.a.Sb(t,t.ownerDocument.documentElement)},eb:function(t){return!!h.a.hb(t,h.a.Ea)},B:function(t){return t&&t.tagName&&t.tagName.toLowerCase()},q:function(t,e,n){var i=f&&p[e];if(!i&&o)o(t).bind(e,n);else if(i||"function"!=typeof t.addEventListener){if("undefined"==typeof t.attachEvent)throw Error("Browser doesn't support addEventListener or attachEvent");var r=function(e){n.call(t,e)},s="on"+e;t.attachEvent(s,r),h.a.u.ja(t,function(){t.detachEvent(s,r)})}else t.addEventListener(e,n,!1)},ha:function(t,i){if(!t||!t.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var r;if("input"===h.a.B(t)&&t.type&&"click"==i.toLowerCase()?(r=t.type,r="checkbox"==r||"radio"==r):r=!1,o&&!r)o(t).trigger(i);else if("function"==typeof n.createEvent){if("function"!=typeof t.dispatchEvent)throw Error("The supplied element doesn't support dispatchEvent");r=n.createEvent(d[i]||"HTMLEvents"),r.initEvent(i,!0,!0,e,0,0,0,0,0,!1,!1,!1,!1,0,t),t.dispatchEvent(r)}else if(r&&t.click)t.click();else{if("undefined"==typeof t.fireEvent)throw Error("Browser doesn't support triggering events");t.fireEvent("on"+i)}},c:function(t){return h.v(t)?t():t},Sa:function(t){return h.v(t)?t.o():t},ua:function(t,e,n){if(e){var i=/\S+/g,o=t.className.match(i)||[];h.a.r(e.match(i),function(t){h.a.Y(o,t,n)}),t.className=o.join(" ")}},Xa:function(e,n){var i=h.a.c(n);null!==i&&i!==t||(i="");var o=h.e.firstChild(e);!o||3!=o.nodeType||h.e.nextSibling(o)?h.e.U(e,[e.ownerDocument.createTextNode(i)]):o.data=i, -h.a.Vb(e)},Cb:function(t,e){if(t.name=e,7>=f)try{t.mergeAttributes(n.createElement(""),!1)}catch(i){}},Vb:function(t){9<=f&&(t=1==t.nodeType?t:t.parentNode,t.style&&(t.style.zoom=t.style.zoom))},Tb:function(t){if(f){var e=t.style.width;t.style.width=0,t.style.width=e}},ic:function(t,e){t=h.a.c(t),e=h.a.c(e);for(var n=[],i=t;i<=e;i++)n.push(i);return n},R:function(t){for(var e=[],n=0,i=t.length;n",""]||!r.indexOf("",""]||(!r.indexOf("",""]||[0,"",""],t="ignored
    "+r[1]+t+r[2]+"
    ","function"==typeof e.innerShiv?i.appendChild(e.innerShiv(t)):i.innerHTML=t;r[0]--;)i=i.lastChild;i=h.a.R(i.lastChild.childNodes)}return i},h.a.Va=function(e,n){if(h.a.Fa(e),n=h.a.c(n),null!==n&&n!==t)if("string"!=typeof n&&(n=n.toString()),o)o(e).html(n);else for(var i=h.a.Qa(n),r=0;r"},Hb:function(e,i){var o=n[e];if(o===t)throw Error("Couldn't find any memo with ID "+e+". Perhaps it's already been unmemoized.");try{return o.apply(null,i||[]),!0}finally{delete n[e]}},Ib:function(t,n){var i=[];e(t,i);for(var o=0,r=i.length;or[0]?c+r[0]:r[0]),c);for(var c=1===l?c:Math.min(e+(r[1]||0),c),l=e+l-2,u=Math.max(c,l),d=[],p=[],f=2;ee;e++)t=t();return t})},h.toJSON=function(t,e,n){return t=h.Gb(t),h.a.Ya(t,e,n)},i.prototype={save:function(t,e){var n=h.a.l(this.keys,t);0<=n?this.ab[n]=e:(this.keys.push(t),this.ab.push(e))},get:function(e){return e=h.a.l(this.keys,e),0<=e?this.ab[e]:t}}}(),h.b("toJS",h.Gb),h.b("toJSON",h.toJSON),function(){h.i={p:function(e){switch(h.a.B(e)){case"option":return!0===e.__ko__hasDomDataOptionValue__?h.a.f.get(e,h.d.options.Pa):7>=h.a.oa?e.getAttributeNode("value")&&e.getAttributeNode("value").specified?e.value:e.text:e.value;case"select":return 0<=e.selectedIndex?h.i.p(e.options[e.selectedIndex]):t;default:return e.value}},X:function(e,n,i){switch(h.a.B(e)){case"option":switch(typeof n){case"string":h.a.f.set(e,h.d.options.Pa,t),"__ko__hasDomDataOptionValue__"in e&&delete e.__ko__hasDomDataOptionValue__,e.value=n;break;default:h.a.f.set(e,h.d.options.Pa,n),e.__ko__hasDomDataOptionValue__=!0,e.value="number"==typeof n?n:""}break;case"select":""!==n&&null!==n||(n=t);for(var o,r=-1,s=0,a=e.options.length;s=c){e&&s.push(n?{key:e,value:n.join("")}:{unknown:e}),e=n=c=0;continue}}else if(58===d){if(!n)continue}else if(47===d&&u&&1"===n.createComment("test").text,s=r?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,a=r?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,c={ul:!0,ol:!0};h.e={Q:{},childNodes:function(e){return t(e)?i(e):e.childNodes},da:function(e){if(t(e)){e=h.e.childNodes(e);for(var n=0,i=e.length;n=h.a.oa&&n in m?(n=m[n],o?e.removeAttribute(n):e[n]=i):o||e.setAttribute(n,i.toString()),"name"===n&&h.a.Cb(e,o?"":i.toString())})}},function(){h.d.checked={after:["value","attr"],init:function(e,n,i){function o(){return i.has("checkedValue")?h.a.c(i.get("checkedValue")):e.value}function r(){var t=e.checked,r=d?o():t;if(!h.ca.pa()&&(!c||t)){var s=h.k.t(n);l?u!==r?(t&&(h.a.Y(s,r,!0),h.a.Y(s,u,!1)),u=r):h.a.Y(s,r,t):h.g.va(s,i,"checked",r,!0)}}function s(){var t=h.a.c(n());e.checked=l?0<=h.a.l(t,o()):a?t:o()===t}var a="checkbox"==e.type,c="radio"==e.type;if(a||c){var l=a&&h.a.c(n())instanceof Array,u=l?o():t,d=c||l;c&&!e.name&&h.d.uniqueName.init(e,function(){return!0}),h.ba(r,null,{G:e}),h.a.q(e,"click",r),h.ba(s,null,{G:e})}}},h.g.W.checked=!0,h.d.checkedValue={update:function(t,e){t.value=h.a.c(e())}}}(),h.d.css={update:function(t,e){var n=h.a.c(e());"object"==typeof n?h.a.A(n,function(e,n){n=h.a.c(n),h.a.ua(t,e,n)}):(n=String(n||""),h.a.ua(t,t.__ko__cssValue,!1),t.__ko__cssValue=n,h.a.ua(t,n,!0))}},h.d.enable={update:function(t,e){var n=h.a.c(e());n&&t.disabled?t.removeAttribute("disabled"):n||t.disabled||(t.disabled=!0)}},h.d.disable={update:function(t,e){h.d.enable.update(t,function(){return!h.a.c(e())})}},h.d.event={init:function(t,e,n,i,o){var r=e()||{};h.a.A(r,function(r){"string"==typeof r&&h.a.q(t,r,function(t){var s,a=e()[r];if(a){try{var c=h.a.R(arguments);i=o.$data,c.unshift(i),s=a.apply(i,c)}finally{!0!==s&&(t.preventDefault?t.preventDefault():t.returnValue=!1)}!1===n.get(r+"Bubble")&&(t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation())}})})}},h.d.foreach={vb:function(t){return function(){var e=t(),n=h.a.Sa(e);return n&&"number"!=typeof n.length?(h.a.c(e),{foreach:n.data,as:n.as,includeDestroyed:n.includeDestroyed,afterAdd:n.afterAdd,beforeRemove:n.beforeRemove,afterRender:n.afterRender,beforeMove:n.beforeMove,afterMove:n.afterMove,templateEngine:h.K.Ja}):{foreach:e,templateEngine:h.K.Ja}}},init:function(t,e){return h.d.template.init(t,h.d.foreach.vb(e))},update:function(t,e,n,i,o){return h.d.template.update(t,h.d.foreach.vb(e),n,i,o)}},h.g.aa.foreach=!1,h.e.Q.foreach=!0,h.d.hasfocus={init:function(t,e,n){function i(i){t.__ko_hasfocusUpdating=!0;var o=t.ownerDocument;if("activeElement"in o){var r;try{r=o.activeElement}catch(s){r=o.body}i=r===t}o=e(),h.g.va(o,n,"hasfocus",i,!0),t.__ko_hasfocusLastValue=i,t.__ko_hasfocusUpdating=!1}var o=i.bind(null,!0),r=i.bind(null,!1);h.a.q(t,"focus",o),h.a.q(t,"focusin",o),h.a.q(t,"blur",r),h.a.q(t,"focusout",r)},update:function(t,e){var n=!!h.a.c(e());t.__ko_hasfocusUpdating||t.__ko_hasfocusLastValue===n||(n?t.focus():t.blur(),h.k.t(h.a.ha,null,[t,n?"focusin":"focusout"]))}},h.g.W.hasfocus=!0,h.d.hasFocus=h.d.hasfocus,h.g.W.hasFocus=!0,h.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(t,e){h.a.Va(t,e())}},u("if"),u("ifnot",!1,!0),u("with",!0,!1,function(t,e){return t.createChildContext(e)});var b={};h.d.options={init:function(t){if("select"!==h.a.B(t))throw Error("options binding applies only to SELECT elements");for(;0","#comment",o)})},Mb:function(t,e){return h.w.Na(function(n,i){var o=n.nextSibling;o&&o.nodeName.toLowerCase()===e&&h.xa(o,t,i)})}}}(),h.b("__tr_ambtns",h.Za.Mb),function(){h.n={},h.n.j=function(t){this.j=t},h.n.j.prototype.text=function(){var t=h.a.B(this.j),t="script"===t?"text":"textarea"===t?"value":"innerHTML";if(0==arguments.length)return this.j[t];var e=arguments[0];"innerHTML"===t?h.a.Va(this.j,e):this.j[t]=e};var e=h.a.f.L()+"_";h.n.j.prototype.data=function(t){return 1===arguments.length?h.a.f.get(this.j,e+t):void h.a.f.set(this.j,e+t,arguments[1])};var n=h.a.f.L();h.n.Z=function(t){this.j=t},h.n.Z.prototype=new h.n.j,h.n.Z.prototype.text=function(){if(0==arguments.length){var e=h.a.f.get(this.j,n)||{};return e.$a===t&&e.Ba&&(e.$a=e.Ba.innerHTML),e.$a}h.a.f.set(this.j,n,{$a:arguments[0]})},h.n.j.prototype.nodes=function(){return 0==arguments.length?(h.a.f.get(this.j,n)||{}).Ba:void h.a.f.set(this.j,n,{Ba:arguments[0]})},h.b("templateSources",h.n),h.b("templateSources.domElement",h.n.j),h.b("templateSources.anonymousTemplate",h.n.Z)}(),function(){function e(t,e,n){var i;for(e=h.e.nextSibling(e);t&&(i=t)!==e;)t=h.e.nextSibling(i),n(i,t)}function n(t,n){if(t.length){var i=t[0],o=t[t.length-1],r=i.parentNode,s=h.J.instance,a=s.preprocessNode;if(a){if(e(i,o,function(t,e){var n=t.previousSibling,r=a.call(s,t);r&&(t===i&&(i=r[0]||e),t===o&&(o=r[r.length-1]||n))}),t.length=0,!i)return;i===o?t.push(i):(t.push(i,o),h.a.ea(t,r))}e(i,o,function(t){1!==t.nodeType&&8!==t.nodeType||h.fb(n,t)}),e(i,o,function(t){1!==t.nodeType&&8!==t.nodeType||h.w.Ib(t,[n])}),h.a.ea(t,r)}}function i(t){return t.nodeType?t:0h.a.oa?0:t.nodes)?t.nodes():null;return e?h.a.R(e.cloneNode(!0).childNodes):(t=t.text(),h.a.Qa(t))},h.K.Ja=new h.K,h.Wa(h.K.Ja),h.b("nativeTemplateEngine",h.K),function(){h.La=function(){var t=this.ac=function(){if(!o||!o.tmpl)return 0;try{if(0<=o.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(t){}return 1}();this.renderTemplateSource=function(e,i,r){if(r=r||{},2>t)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var s=e.data("precompiled");return s||(s=e.text()||"",s=o.template(null,"{{ko_with $item.koBindingContext}}"+s+"{{/ko_with}}"),e.data("precompiled",s)),e=[i.$data],i=o.extend({koBindingContext:i},r.templateOptions),i=o.tmpl(s,e,i),i.appendTo(n.createElement("div")),o.fragments={},i},this.createJavaScriptEvaluatorBlock=function(t){return"{{ko_code ((function() { return "+t+" })()) }}"},this.addTemplate=function(t,e){n.write("")},0i;i++)n[i]&&a(n[i]._destroy)&&t++;return t},g=function(n,i){var o,r;i?(r=document.getElementById(i),r&&(o=new t.templateSources.domElement(r),o.text(e.trim(o.text())))):e(n).contents().each(function(){this&&1!==this.nodeType&&n.removeChild(this)})};t.bindingHandlers.sortable={init:function(u,d,m,b,v){var M,y,A=e(u),w=a(d())||{},_=p(d,"foreach"),z={};g(u,_.name),e.extend(!0,z,t.bindingHandlers.sortable),w.options&&z.options&&(t.utils.extend(z.options,w.options),delete w.options),t.utils.extend(z,w),z.connectClass&&(t.isObservable(z.allowDrop)||"function"==typeof z.allowDrop)?t.computed({read:function(){var e=a(z.allowDrop),n="function"==typeof e?e.call(this,_.foreach):e;t.utils.toggleDomNodeCssClass(u,z.connectClass,n)},disposeWhenNodeIsRemoved:u},this):t.utils.toggleDomNodeCssClass(u,z.connectClass,z.allowDrop),t.bindingHandlers.template.init(u,function(){return _},m,b,v),M=z.options.start,y=z.options.update;var T=setTimeout(function(){var d;A.sortable(t.utils.extend(z.options,{start:function(e,n){var o=n.item[0];l(o,i,t.utils.arrayIndexOf(n.item.parent().children(),o)),n.item.find("input:focus").change(),M&&M.apply(this,arguments)},receive:function(t,e){d=c(e.item[0],s),d&&(d.clone&&(d=d.clone()),z.dragged&&(d=z.dragged.call(this,d,t,e)||d))},update:function(s,a){var u,p,g,m,b,v=a.item[0],M=a.item.parent()[0],A=c(v,n)||d;if(d=null,A&&this===M||!h&&e.contains(this,M)){if(u=c(v,r),g=c(v,i),p=c(v.parentNode,o),m=t.utils.arrayIndexOf(a.item.parent().children(),v),_.includeDestroyed||(g=f(g,u),m=f(m,p)),(z.beforeMove||z.afterMove)&&(b={item:A,sourceParent:u,sourceParentNode:u&&a.sender||v.parentNode,sourceIndex:g,targetParent:p,targetIndex:m,cancelDrop:!1},z.beforeMove&&z.beforeMove.call(this,b,s,a)),u?e(u===p?this:a.sender||this).sortable("cancel"):e(v).remove(),b&&b.cancelDrop)return;m>=0&&(u&&(u.splice(g,1),t.processAllDeferredBindingUpdates&&t.processAllDeferredBindingUpdates()),p.splice(m,0,A)),l(v,n,null),t.processAllDeferredBindingUpdates&&t.processAllDeferredBindingUpdates(),z.afterMove&&z.afterMove.call(this,b,s,a)}y&&y.apply(this,arguments)},connectWith:!!z.connectClass&&"."+z.connectClass})),void 0!==z.isEnabled&&t.computed({read:function(){A.sortable(a(z.isEnabled)?"enable":"disable")},disposeWhenNodeIsRemoved:u})},0);return t.utils.domNodeDisposal.addDisposeCallback(u,function(){(A.data("ui-sortable")||A.data("sortable"))&&A.sortable("destroy"),clearTimeout(T)}),{controlsDescendantBindings:!0}},update:function(e,n,i,r,s){var a=p(n,"foreach");l(e,o,a.foreach),t.bindingHandlers.template.update(e,function(){return a},i,r,s)},connectClass:"ko_container",allowDrop:!0,afterMove:null,beforeMove:null,options:{}},t.bindingHandlers.draggable={init:function(n,i,o,r,c){var u=a(i())||{},h=u.options||{},d=t.utils.extend({},t.bindingHandlers.draggable.options),f=p(i,"data"),g=u.connectClass||t.bindingHandlers.draggable.connectClass,m=void 0!==u.isEnabled?u.isEnabled:t.bindingHandlers.draggable.isEnabled;return u="data"in u?u.data:u,l(n,s,u),t.utils.extend(d,h),d.connectToSortable=!!g&&"."+g,e(n).draggable(d),void 0!==m&&t.computed({read:function(){e(n).draggable(a(m)?"enable":"disable")},disposeWhenNodeIsRemoved:n}),t.bindingHandlers.template.init(n,function(){return f},o,r,c)},update:function(e,n,i,o,r){var s=p(n,"data");return t.bindingHandlers.template.update(e,function(){return s},i,o,r)},connectClass:t.bindingHandlers.sortable.connectClass,options:{helper:"clone"}}}),function(){var t=this,e=t._,n=Array.prototype,i=Object.prototype,o=Function.prototype,r=n.push,s=n.slice,a=n.concat,c=i.toString,l=i.hasOwnProperty,u=Array.isArray,h=Object.keys,d=o.bind,p=function(t){return t instanceof p?t:this instanceof p?void(this._wrapped=t):new p(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=p),exports._=p):t._=p,p.VERSION="1.7.0";var f=function(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,o){return t.call(e,n,i,o)};case 4:return function(n,i,o,r){return t.call(e,n,i,o,r)}}return function(){return t.apply(e,arguments)}};p.iteratee=function(t,e,n){return null==t?p.identity:p.isFunction(t)?f(t,e,n):p.isObject(t)?p.matches(t):p.property(t)},p.each=p.forEach=function(t,e,n){if(null==t)return t;e=f(e,n);var i,o=t.length;if(o===+o)for(i=0;i=0)},p.invoke=function(t,e){var n=s.call(arguments,2),i=p.isFunction(e);return p.map(t,function(t){return(i?e:t[e]).apply(t,n)})},p.pluck=function(t,e){return p.map(t,p.property(e))},p.where=function(t,e){return p.filter(t,p.matches(e))},p.findWhere=function(t,e){return p.find(t,p.matches(e))},p.max=function(t,e,n){var i,o,r=-(1/0),s=-(1/0);if(null==e&&null!=t){t=t.length===+t.length?t:p.values(t);for(var a=0,c=t.length;ar&&(r=i)}else e=p.iteratee(e,n),p.each(t,function(t,n,i){o=e(t,n,i),(o>s||o===-(1/0)&&r===-(1/0))&&(r=t,s=o)});return r},p.min=function(t,e,n){var i,o,r=1/0,s=1/0;if(null==e&&null!=t){t=t.length===+t.length?t:p.values(t);for(var a=0,c=t.length;ai||void 0===n)return 1;if(n>>1;n(t[a])=0;)if(t[i]===e)return i;return-1},p.range=function(t,e,n){arguments.length<=1&&(e=t||0,t=0),n=n||1;for(var i=Math.max(Math.ceil((e-t)/n),0),o=Array(i),r=0;re?(clearTimeout(s),s=null,a=l,r=t.apply(i,o),s||(i=o=null)):s||n.trailing===!1||(s=setTimeout(c,u)),r}},p.debounce=function(t,e,n){var i,o,r,s,a,c=function(){var l=p.now()-s;l0?i=setTimeout(c,e-l):(i=null,n||(a=t.apply(r,o),i||(r=o=null)))};return function(){r=this,o=arguments,s=p.now();var l=n&&!i;return i||(i=setTimeout(c,e)),l&&(a=t.apply(r,o),r=o=null),a}},p.wrap=function(t,e){return p.partial(e,t)},p.negate=function(t){return function(){return!t.apply(this,arguments)}},p.compose=function(){var t=arguments,e=t.length-1;return function(){for(var n=e,i=t[e].apply(this,arguments);n--;)i=t[n].call(this,i);return i}},p.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}}, -p.before=function(t,e){var n;return function(){return--t>0?n=e.apply(this,arguments):e=null,n}},p.once=p.partial(p.before,2),p.keys=function(t){if(!p.isObject(t))return[];if(h)return h(t);var e=[];for(var n in t)p.has(t,n)&&e.push(n);return e},p.values=function(t){for(var e=p.keys(t),n=e.length,i=Array(n),o=0;o":">",'"':""","'":"'","`":"`"},A=p.invert(y),w=function(t){var e=function(e){return t[e]},n="(?:"+p.keys(t).join("|")+")",i=RegExp(n),o=RegExp(n,"g");return function(t){return t=null==t?"":""+t,i.test(t)?t.replace(o,e):t}};p.escape=w(y),p.unescape=w(A),p.result=function(t,e){if(null!=t){var n=t[e];return p.isFunction(n)?t[e]():n}};var _=0;p.uniqueId=function(t){var e=++_+"";return t?t+e:e},p.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var z=/(.)^/,T={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},x=/\\|'|\r|\n|\u2028|\u2029/g,C=function(t){return"\\"+T[t]};p.template=function(t,e,n){!e&&n&&(e=n),e=p.defaults({},e,p.templateSettings);var i=RegExp([(e.escape||z).source,(e.interpolate||z).source,(e.evaluate||z).source].join("|")+"|$","g"),o=0,r="__p+='";t.replace(i,function(e,n,i,s,a){return r+=t.slice(o,a).replace(x,C),o=a+e.length,n?r+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":i?r+="'+\n((__t=("+i+"))==null?'':__t)+\n'":s&&(r+="';\n"+s+"\n__p+='"),e}),r+="';\n",e.variable||(r="with(obj||{}){\n"+r+"}\n"),r="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+r+"return __p;\n";try{var s=new Function(e.variable||"obj","_",r)}catch(a){throw a.source=r,a}var c=function(t){return s.call(this,t,p)},l=e.variable||"obj";return c.source="function("+l+"){\n"+r+"}",c},p.chain=function(t){var e=p(t);return e._chain=!0,e};var O=function(t){return this._chain?p(t).chain():t};p.mixin=function(t){p.each(p.functions(t),function(e){var n=p[e]=t[e];p.prototype[e]=function(){var t=[this._wrapped];return r.apply(t,arguments),O.call(this,n.apply(p,t))}})},p.mixin(p),p.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=n[t];p.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],O.call(this,n)}}),p.each(["concat","join","slice"],function(t){var e=n[t];p.prototype[t]=function(){return O.call(this,e.apply(this._wrapped,arguments))}}),p.prototype.value=function(){return this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return p})}.call(this),function(){var t,e,n,i,o,r,s,a,c=[].slice,l={}.hasOwnProperty,u=function(t,e){function n(){this.constructor=t}for(var i in e)l.call(e,i)&&(t[i]=e[i]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};s=function(){},e=function(){function t(){}return t.prototype.addEventListener=t.prototype.on,t.prototype.on=function(t,e){return this._callbacks=this._callbacks||{},this._callbacks[t]||(this._callbacks[t]=[]),this._callbacks[t].push(e),this},t.prototype.emit=function(){var t,e,n,i,o,r;if(i=arguments[0],t=2<=arguments.length?c.call(arguments,1):[],this._callbacks=this._callbacks||{},n=this._callbacks[i])for(o=0,r=n.length;o
    '),this.element.appendChild(e)),i=e.getElementsByTagName("span")[0],i&&(null!=i.textContent?i.textContent=this.options.dictFallbackMessage:null!=i.innerText&&(i.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(t){var e,n,i;return e={srcX:0,srcY:0,srcWidth:t.width,srcHeight:t.height},n=t.width/t.height,e.optWidth=this.options.thumbnailWidth,e.optHeight=this.options.thumbnailHeight,null==e.optWidth&&null==e.optHeight?(e.optWidth=e.srcWidth,e.optHeight=e.srcHeight):null==e.optWidth?e.optWidth=n*e.optHeight:null==e.optHeight&&(e.optHeight=1/n*e.optWidth),i=e.optWidth/e.optHeight,t.heighti?(e.srcHeight=t.height,e.srcWidth=e.srcHeight*i):(e.srcWidth=t.width,e.srcHeight=e.srcWidth/i),e.srcX=(t.width-e.srcWidth)/2,e.srcY=(t.height-e.srcHeight)/2,e},drop:function(t){return this.element.classList.remove("dz-drag-hover")},dragstart:s,dragend:function(t){return this.element.classList.remove("dz-drag-hover")},dragenter:function(t){return this.element.classList.add("dz-drag-hover")},dragover:function(t){return this.element.classList.add("dz-drag-hover")},dragleave:function(t){return this.element.classList.remove("dz-drag-hover")},paste:s,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(t){var e,i,o,r,s,a,c,l,u,h,d,p,f;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(t.previewElement=n.createElement(this.options.previewTemplate.trim()),t.previewTemplate=t.previewElement,this.previewsContainer.appendChild(t.previewElement),h=t.previewElement.querySelectorAll("[data-dz-name]"),r=0,c=h.length;r'+this.options.dictRemoveFile+""),t.previewElement.appendChild(t._removeLink)),i=function(e){return function(i){return i.preventDefault(),i.stopPropagation(),t.status===n.UPLOADING?n.confirm(e.options.dictCancelUploadConfirmation,function(){return e.removeFile(t)}):e.options.dictRemoveFileConfirmation?n.confirm(e.options.dictRemoveFileConfirmation,function(){return e.removeFile(t)}):e.removeFile(t)}}(this),p=t.previewElement.querySelectorAll("[data-dz-remove]"),f=[],a=0,u=p.length;a\n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n Check\n \n \n \n \n \n
    \n
    \n \n Error\n \n \n \n \n \n \n \n
    \n'},i=function(){var t,e,n,i,o,r,s;for(i=arguments[0],n=2<=arguments.length?c.call(arguments,1):[],r=0,s=n.length;r'+this.options.dictDefaultMessage+"")),this.clickableElements.length&&(i=function(t){return function(){return t.hiddenFileInput&&t.hiddenFileInput.parentNode.removeChild(t.hiddenFileInput),t.hiddenFileInput=document.createElement("input"),t.hiddenFileInput.setAttribute("type","file"),(null==t.options.maxFiles||t.options.maxFiles>1)&&t.hiddenFileInput.setAttribute("multiple","multiple"),t.hiddenFileInput.className="dz-hidden-input",null!=t.options.acceptedFiles&&t.hiddenFileInput.setAttribute("accept",t.options.acceptedFiles),null!=t.options.capture&&t.hiddenFileInput.setAttribute("capture",t.options.capture),t.hiddenFileInput.style.visibility="hidden",t.hiddenFileInput.style.position="absolute",t.hiddenFileInput.style.top="0",t.hiddenFileInput.style.left="0",t.hiddenFileInput.style.height="0",t.hiddenFileInput.style.width="0",document.querySelector(t.options.hiddenInputContainer).appendChild(t.hiddenFileInput),t.hiddenFileInput.addEventListener("change",function(){var e,n,o,r;if(n=t.hiddenFileInput.files,n.length)for(o=0,r=n.length;o',this.options.dictFallbackText&&(i+="

    "+this.options.dictFallbackText+"

    "),i+='',e=n.createElement(i),"FORM"!==this.element.tagName?(o=n.createElement('
    '),o.appendChild(e)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=o?o:e)},n.prototype.getExistingFallback=function(){var t,e,n,i,o,r;for(e=function(t){var e,n,i;for(n=0,i=t.length;n0){for(s=["TB","GB","MB","KB","b"],n=a=0,c=s.length;a=e){i=t/Math.pow(this.options.filesizeBase,4-n),o=r;break}i=Math.round(10*i)/10}return""+i+" "+o},n.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},n.prototype.drop=function(t){var e,n;t.dataTransfer&&(this.emit("drop",t),e=t.dataTransfer.files,this.emit("addedfiles",e),e.length&&(n=t.dataTransfer.items,n&&n.length&&null!=n[0].webkitGetAsEntry?this._addFilesFromItems(n):this.handleFiles(e)))},n.prototype.paste=function(t){var e,n;if(null!=(null!=t&&null!=(n=t.clipboardData)?n.items:void 0))return this.emit("paste",t),e=t.clipboardData.items,e.length?this._addFilesFromItems(e):void 0},n.prototype.handleFiles=function(t){var e,n,i,o;for(o=[],n=0,i=t.length;n0){for(r=0,s=n.length;r1024*this.options.maxFilesize*1024?e(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(t.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):n.isValidFile(t,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(e(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",t)):this.options.accept.call(this,t,e):e(this.options.dictInvalidFileType)},n.prototype.addFile=function(t){return t.upload={progress:0,total:t.size,bytesSent:0},this.files.push(t),t.status=n.ADDED,this.emit("addedfile",t),this._enqueueThumbnail(t),this.accept(t,function(e){return function(n){return n?(t.accepted=!1,e._errorProcessing([t],n)):(t.accepted=!0,e.options.autoQueue&&e.enqueueFile(t)),e._updateMaxFilesReachedClass()}}(this))},n.prototype.enqueueFiles=function(t){var e,n,i;for(n=0,i=t.length;n=e)&&(i=this.getQueuedFiles(),i.length>0)){if(this.options.uploadMultiple)return this.processFiles(i.slice(0,e-n));for(;t=B;u=0<=B?++L:--L)r.append(this._getParamName(u),t[u],this._renameFilename(t[u].name));return this.submitRequest(w,r,t)},n.prototype.submitRequest=function(t,e,n){return t.send(e)},n.prototype._finished=function(t,e,i){var o,r,s;for(r=0,s=t.length;ru;)e=o[4*(c-1)+3],0===e?r=c:u=c,c=r+u>>1;return l=c/s,0===l?1:l},r=function(t,e,n,i,r,s,a,c,l,u){var h;return h=o(e),t.drawImage(e,n,i,r,s,a,c,l,u/h)},i=function(t,e){var n,i,o,r,s,a,c,l,u;if(o=!1,u=!0,i=t.document,l=i.documentElement,n=i.addEventListener?"addEventListener":"attachEvent",c=i.addEventListener?"removeEventListener":"detachEvent",a=i.addEventListener?"":"on",r=function(n){if("readystatechange"!==n.type||"complete"===i.readyState)return("load"===n.type?t:i)[c](a+n.type,r,!1),!o&&(o=!0)?e.call(t,n.type||n):void 0},s=function(){var t;try{l.doScroll("left")}catch(e){return t=e,void setTimeout(s,50)}return r("poll")},"complete"!==i.readyState){if(i.createEventObject&&l.doScroll){try{u=!t.frameElement}catch(h){}u&&s()}return i[n](a+"DOMContentLoaded",r,!1),i[n](a+"readystatechange",r,!1),t[n](a+"load",r,!1)}},t._autoDiscoverFunction=function(){if(t.autoDiscover)return t.discover()},i(window,t._autoDiscoverFunction)}.call(this),function(t,e){"function"==typeof define&&define.amd?define("typeahead.js",["jquery"],function(t){return e(t)}):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(this,function(t){var e=function(){"use strict";return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]},isBlankString:function(t){return!t||/^\s*$/.test(t)},escapeRegExChars:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isArray:t.isArray,isFunction:t.isFunction,isObject:t.isPlainObject,isUndefined:function(t){return"undefined"==typeof t},isElement:function(t){return!(!t||1!==t.nodeType)},isJQuery:function(e){return e instanceof t},toStr:function(t){return e.isUndefined(t)||null===t?"":t+""},bind:t.proxy,each:function(e,n){function i(t,e){return n(e,t)}t.each(e,i)},map:t.map,filter:t.grep,every:function(e,n){var i=!0;return e?(t.each(e,function(t,o){if(!(i=n.call(null,o,t,e)))return!1}),!!i):i},some:function(e,n){var i=!1;return e?(t.each(e,function(t,o){if(i=n.call(null,o,t,e))return!1}),!!i):i},mixin:t.extend,identity:function(t){return t},clone:function(e){return t.extend(!0,{},e)},getIdGenerator:function(){var t=0;return function(){return t++}},templatify:function(e){function n(){return String(e)}return t.isFunction(e)?e:n},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i,o;return function(){var r,s,a=this,c=arguments;return r=function(){i=null,n||(o=t.apply(a,c))},s=n&&!i,clearTimeout(i),i=setTimeout(r,e),s&&(o=t.apply(a,c)),o}},throttle:function(t,e){var n,i,o,r,s,a;return s=0,a=function(){s=new Date,o=null,r=t.apply(n,i)},function(){var c=new Date,l=e-(c-s);return n=this,i=arguments,l<=0?(clearTimeout(o),o=null,s=c,r=t.apply(n,i)):o||(o=setTimeout(a,l)),r}},stringify:function(t){return e.isString(t)?t:JSON.stringify(t)},noop:function(){}}}(),n=function(){"use strict";function t(t){var s,a;return a=e.mixin({},r,t),s={css:o(),classes:a,html:n(a),selectors:i(a)},{css:s.css,html:s.html,classes:s.classes,selectors:s.selectors,mixin:function(t){e.mixin(t,s)}}}function n(t){return{wrapper:'',menu:'
    '}}function i(t){var n={};return e.each(t,function(t,e){n[e]="."+t}),n}function o(){var t={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},menu:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return e.isMsie()&&e.mixin(t.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),t}var r={wrapper:"twitter-typeahead",input:"tt-input",hint:"tt-hint",menu:"tt-menu",dataset:"tt-dataset",suggestion:"tt-suggestion",selectable:"tt-selectable",empty:"tt-empty",open:"tt-open",cursor:"tt-cursor",highlight:"tt-highlight"};return t}(),i=function(){"use strict";function n(e){e&&e.el||t.error("EventBus initialized without el"),this.$el=t(e.el)}var i,o;return i="typeahead:",o={render:"rendered",cursorchange:"cursorchanged",select:"selected",autocomplete:"autocompleted"},e.mixin(n.prototype,{_trigger:function(e,n){var o;return o=t.Event(i+e),(n=n||[]).unshift(o),this.$el.trigger.apply(this.$el,n),o},before:function(t){var e,n;return e=[].slice.call(arguments,1),n=this._trigger("before"+t,e),n.isDefaultPrevented()},trigger:function(t){var e;this._trigger(t,[].slice.call(arguments,1)),(e=o[t])&&this._trigger(e,[].slice.call(arguments,1))}}),n}(),o=function(){"use strict";function t(t,e,n,i){var o;if(!n)return this;for(e=e.split(c),n=i?a(n,i):n,this._callbacks=this._callbacks||{};o=e.shift();)this._callbacks[o]=this._callbacks[o]||{sync:[],async:[]},this._callbacks[o][t].push(n);return this}function e(e,n,i){return t.call(this,"async",e,n,i)}function n(e,n,i){return t.call(this,"sync",e,n,i)}function i(t){var e;if(!this._callbacks)return this;for(t=t.split(c);e=t.shift();)delete this._callbacks[e];return this}function o(t){var e,n,i,o,s;if(!this._callbacks)return this;for(t=t.split(c),i=[].slice.call(arguments,1);(e=t.shift())&&(n=this._callbacks[e]);)o=r(n.sync,this,[e].concat(i)),s=r(n.async,this,[e].concat(i)),o()&&l(s);return this}function r(t,e,n){function i(){for(var i,o=0,r=t.length;!i&&o