diff --git a/api/paymentmethods/response.php b/api/paymentmethods/response.php index fc8b69e5..a61da41d 100644 --- a/api/paymentmethods/response.php +++ b/api/paymentmethods/response.php @@ -17,6 +17,7 @@ require_once dirname(__FILE__) . '/../../library/logger.php'; require_once dirname(__FILE__) . '/../abstract.php'; require_once _PS_ROOT_DIR_ . '/modules/buckaroo3/vendor/autoload.php'; + use Buckaroo\BuckarooClient; use Buckaroo\Handlers\Reply\ReplyHandler; use Buckaroo\Transaction\Response\TransactionResponse; @@ -27,15 +28,11 @@ abstract class Response extends BuckarooAbstract { - // false if not received response private $received = false; - // true if validated and securety checked private $validated = false; - // request is test? private $test = true; private $signature; private $isPush; - // payment key public $payment; public $payment_method; public $statuscode; @@ -53,53 +50,41 @@ abstract class Response extends BuckarooAbstract public $brq_transaction_type; public $brq_relatedtransaction_partialpayment; public $brq_relatedtransaction_refund; - // transaction key public $transactions; - // if is errors, othervise = null public $parameterError; - protected ?TransactionResponse $response = null; + protected $logger; public function __construct(TransactionResponse $response = null) { + $this->logger = new Logger(Logger::INFO, 'response'); + $this->logger->logInfo("\n\n\n\n***************** Response start ***********************"); + if ($response) { $this->response = $response; + $this->logger->logInfo('Response object provided directly'); } else { $this->isPush = $this->isPushRequest(); $this->received = true; + $this->logger->logInfo('Response determined to be a push request'); $this->parsePushRequest(); } } - /** - * Get code required for payment - * - * @param string $configCode - * - * @return string - */ protected function getPaymentCode(string $configCode): string { - if ($configCode === 'Capayable') { - return 'in3'; - } - - return $configCode; + return $configCode === 'Capayable' ? 'in3' : $configCode; } private function parsePushRequest() { if (!$this->isPushRequest()) { + $this->logger->logInfo('Not a push request'); return false; } $this->payment = $this->setPostVariable('brq_payment'); - if (Tools::getValue('brq_payment_method')) { - $this->payment_method = $this->getPaymentCode(Tools::getValue('brq_payment_method')); - } elseif (Tools::getValue('brq_transaction_method')) { - $this->payment_method = $this->getPaymentCode(Tools::getValue('brq_transaction_method')); - } - + $this->payment_method = $this->getPaymentCode($this->setPostVariable('brq_payment_method') ?? $this->setPostVariable('brq_transaction_method')); $this->statuscode = $this->setPostVariable('brq_statuscode'); $this->statusmessage = $this->setPostVariable('brq_statusmessage'); $this->statuscode_detail = $this->setPostVariable('brq_statuscode_detail'); @@ -109,87 +94,66 @@ private function parsePushRequest() $this->invoice = $this->setPostVariable('brq_invoicenumber'); $this->invoicenumber = $this->setPostVariable('brq_invoicenumber'); $this->amount = $this->setPostVariable('brq_amount'); - if (Tools::getValue('brq_amount_credit')) { - $this->amount_credit = Tools::getValue('brq_amount_credit'); - } - + $this->amount_credit = $this->setPostVariable('brq_amount_credit'); $this->currency = $this->setPostVariable('brq_currency'); $this->test = $this->setPostVariable('brq_test'); $this->timestamp = $this->setPostVariable('brq_timestamp'); $this->transactions = $this->setPostVariable('brq_transactions'); $this->signature = $this->setPostVariable('brq_signature'); + $this->logger->logInfo('Parsed push request', [ + 'statuscode' => $this->statuscode, + 'statusmessage' => $this->statusmessage, + 'amount' => $this->amount, + 'currency' => $this->currency, + 'timestamp' => $this->timestamp + ]); + if (!empty($this->statuscode)) { - $responseArray = $this->responseCodes[(int) $this->statuscode]; + $responseArray = $this->responseCodes[(int)$this->statuscode]; $this->status = $responseArray['status']; $this->message = $responseArray['message']; } } - /** - * @return bool - */ public function isSuccess(): bool { return $this->response->isSuccess(); } - /** - * @return bool - */ public function isFailed(): bool { return $this->response->isFailed(); } - /** - * @return bool - */ public function isCanceled(): bool { return $this->response->isCanceled(); } - /** - * @return bool - */ public function isAwaitingConsumer(): bool { return $this->response->isAwaitingConsumer(); } - /** - * @return bool - */ public function isPendingProcessing(): bool { return $this->response->isPendingProcessing(); } - /** - * @return bool - */ public function isWaitingOnUserInput(): bool { return $this->response->isWaitingOnUserInput(); } - /** - * @return bool - */ public function isRejected(): bool { return $this->response->isRejected(); } - // Determine if is buckaroo response or push - private function isPushRequest() + private function isPushRequest(): bool { - if (Tools::getValue('brq_statuscode')) { - return true; - } - - return false; + return (bool)Tools::getValue('brq_statuscode'); } public function getServiceParameters() @@ -197,7 +161,27 @@ public function getServiceParameters() return $this->response->getServiceParameters(); } - public function hasSomeError() + public function getStatuscode() + { + return $this->response->statuscode; + } + + public function getStatusmessage() + { + return $this->response->statusmessage; + } + + public function getAmount() + { + return $this->response->amount; + } + + public function getBrqRelatedtransactionPartialpayment() + { + return $this->brq_relatedtransaction_partialpayment; + } + + public function hasSomeError(): bool { return $this->response->hasSomeError(); } @@ -207,12 +191,12 @@ public function getSomeError() return $this->response->getSomeError(); } - public function isTest() + public function isTest(): bool { return $this->response->get('IsTest') === true; } - public function isValid() + public function isValid(): bool { if (!$this->validated) { if ($this->isPush) { @@ -220,58 +204,60 @@ public function isValid() try { $reply_handler = new ReplyHandler($buckaroo->client()->config(), $_POST); $reply_handler->validate(); - - return $this->validated = $reply_handler->isValid(); + $this->validated = $reply_handler->isValid(); + $this->logger->logInfo('Push request validated successfully'); } catch (Exception $e) { + $this->logger->logError('Push request validation failed', ['exception' => $e->getMessage()]); } } elseif ($this->response) { - $this->validated = (!$this->response->isValidationFailure()); + $this->validated = !$this->response->isValidationFailure(); + $this->logger->logInfo('Response validation status', ['validated' => $this->validated]); } } return $this->validated; } - public function hasSucceeded() + public function hasSucceeded(): bool { if (isset($this->response)) { try { if ($this->isValid()) { if ($this->isPendingProcessing() || $this->isAwaitingConsumer() || $this->isWaitingOnUserInput() || $this->isSuccess()) { + $this->logger->logInfo('Response has succeeded'); return true; } } } catch (Exception $e) { + $this->logger->logError('Exception while checking success', ['exception' => $e->getMessage()]); } } elseif (in_array($this->status, [self::BUCKAROO_PENDING_PAYMENT, self::BUCKAROO_SUCCESS])) { + $this->logger->logInfo('Response status indicates success'); return true; } + $this->logger->logInfo('Response has not succeeded'); return false; } - public function isRedirectRequired() + public function isRedirectRequired(): bool { return $this->response->hasRedirect(); } - public function getRedirectUrl() + public function getRedirectUrl(): string { return $this->response->getRedirectUrl(); } - public function getResponse() + public function getResponse(): ?TransactionResponse { return $this->response; } private function setPostVariable($key) { - if (Tools::getValue($key)) { - return Tools::getValue($key); - } else { - return null; - } + return Tools::getValue($key) ?? null; } public function getCartIdAndReferenceId($show = false) @@ -283,14 +269,10 @@ public function getCartIdAndReferenceId($show = false) $cartId = 0; $reference = $this->invoicenumber; } - if ($show == 'cartId') { - return (int) $cartId; - } - - return $reference; + return $show == 'cartId' ? (int)$cartId : $reference; } - public function getCartId() + public function getCartId(): int { return $this->getCartIdAndReferenceId('cartId'); } @@ -299,4 +281,35 @@ public function getReferenceId() { return $this->getCartIdAndReferenceId('reference'); } + + public function isPartialPayment(): bool + { + return !empty($this->getGroupTransaction()); + } + + public function getRemainingAmount(): float + { + return $this->response->remaining_amount ?? 0; + } + + public function getGroupTransaction() + { + $data = $this->response->data(); + if (isset($data['RequiredAction']['PayRemainderDetails']['GroupTransaction'])) { + return $data['RequiredAction']['PayRemainderDetails']['GroupTransaction']; + } + return null; + } + + public function getRemainderAmount() + { + $data = $this->response->data(); + if (!isset($data['RequiredAction']['PayRemainderDetails']['RemainderAmount']) || + !is_scalar($data['RequiredAction']['PayRemainderDetails']['RemainderAmount']) + ) { + return 0; + } + return (float) $data['RequiredAction']['PayRemainderDetails']['RemainderAmount']; + } + } diff --git a/buckaroo3.php b/buckaroo3.php index 1af022ac..a02945c2 100644 --- a/buckaroo3.php +++ b/buckaroo3.php @@ -449,6 +449,7 @@ public function hookPaymentOptions($params) 'methodsWithFinancialWarning' => $buckarooPaymentService->paymentMethodsWithFinancialWarning(), 'creditcardIssuers' => $buckarooConfigService->getActiveCreditCards(), 'creditCardDisplayMode' => $buckarooConfigService->getConfigValue('creditcard', 'display_type'), + 'giftCardDisplayMode' => $buckarooConfigService->getConfigValue('giftcard', 'display_in_checkout'), 'in3Method' => $this->get('buckaroo.classes.issuers.capayableIn3')->getMethod(), 'showIdealIssuers' => $buckarooConfigService->getConfigValue('ideal', 'show_issuers') ?? true, 'buckaroo_idin_test' => $buckarooConfigService->getConfigValue('idin', 'mode'), diff --git a/controllers/front/common.php b/controllers/front/common.php index 94ca17eb..8b3d2fd0 100644 --- a/controllers/front/common.php +++ b/controllers/front/common.php @@ -23,6 +23,10 @@ class BuckarooCommonController extends ModuleFrontController { + public function __construct() + { + parent::__construct(); + } private $id_order; protected function displayConfirmationTransfer($response) @@ -86,4 +90,12 @@ protected function displayError($invoicenumber = null, $error_message = null) $this->setTemplate('module:buckaroo3/views/templates/front/error.tpl'); } + + /** + * Method to initialize content, should be overridden in child classes + */ + public function initContent() + { + parent::initContent(); + } } diff --git a/controllers/front/request.php b/controllers/front/request.php index 487ac2dc..2252fb5d 100644 --- a/controllers/front/request.php +++ b/controllers/front/request.php @@ -28,84 +28,111 @@ class Buckaroo3RequestModuleFrontController extends BuckarooCommonController { - /* @var $checkout Checkout */ public $checkout; public $display_column_left = false; - /** @var bool */ public $display_column_right = false; + protected $logger; + + public function __construct() + { + parent::__construct(); + $this->logger = new Logger(Logger::INFO, 'request'); + } - /** - * @throws Exception - * - * @see FrontController::postProcess() - */ public function postProcess() { - $logger = new \Logger(CoreLogger::INFO, ''); - $logger->logInfo("\n\n\n\n***************** Request start ***********************"); + $this->logger->logInfo("\n\n\n\n***************** Request start ***********************"); + + if (!$this->context || !$this->context->cart) { + $this->logger->logError('Context or cart is not properly initialized.'); + Tools::redirect('index.php?controller=order&step=1'); + return; + } $cart = $this->context->cart; - $logger->logDebug('Get cart', $cart->id); if (!$this->isValidCart($cart)) { - $this->handleInvalidCart($logger, $cart); + $this->handleInvalidCart($cart); return; } - if (!$this->isValidConfiguration($logger)) { + if (!$this->isValidConfiguration()) { return; } - if (!$this->isAuthorized($logger)) { + if (!$this->isAuthorized()) { return; } $customer = new Customer($cart->id_customer); - if (!$this->isValidCustomer($logger, $customer)) { + if (!$this->isValidCustomer($customer)) { return; } $currency = $this->context->currency; + if (!$currency) { + $this->logger->logError('Currency is not set in context.'); + Tools::redirect('index.php?controller=order&step=1'); + return; + } + $total = (float)$cart->getOrderTotal(true, Cart::BOTH); $payment_method = Tools::getValue('method'); if (empty($payment_method)) { - $logger->logError('Load a method', 'Failed to load the method'); + $this->logger->logError('Load a method', 'Failed to load the method'); Tools::redirect('index.php?controller=order&step=1'); return; } $total = $this->applyBuckarooFee($payment_method, $total); - if (!$this->isValidService($logger)) { + if (!$this->isValidService()) { return; } $debug = 'Currency: ' . $currency->name . "\nTotal Amount: " . $total . "\nPayment Method: " . $payment_method; - $logger->logInfo('Checkout info', $debug); + $this->logger->logInfo('Checkout info', $debug); - $this->initializeCheckout($logger, $cart, $payment_method, $currency, $total, $customer); + $this->initializeCheckout($cart, $payment_method, $currency, $total, $customer); if ($this->checkout->isRequestSucceeded()) { - $this->handleSuccessfulRequest($logger, $cart->id, $customer); + $this->handleSuccessfulRequest($cart->id, $customer); } else { - $this->handleFailedRequest($logger, $cart->id); + $this->handleFailedRequest($cart->id); } } private function isValidCart($cart) { - return $cart->id_customer != 0 && $cart->id_address_delivery != 0 && $cart->id_address_invoice != 0 && $this->module->active; + if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { + return false; + } + + if (Order::getOrderByCartId($cart->id)) { + $oldCart = new Cart($cart->id); + $duplication = $oldCart->duplicate(); + if ($duplication && Validate::isLoadedObject($duplication['cart']) && $duplication['success']) { + $this->context->cookie->id_cart = $duplication['cart']->id; + $this->context->cart = $duplication['cart']; + $this->context->cookie->write(); + return true; + } else { + return false; + } + } + + return true; } - private function handleInvalidCart($logger, $cart) + private function handleInvalidCart($cart) { $debug = 'Customer Id: ' . $cart->id_customer . "\nDelivery Address ID: " . $cart->id_address_delivery . 'Invoice Address ID: ' . $cart->id_address_invoice . "\nModule Active: " . $this->module->active; - $logger->logError('Validation Error', $debug); + $this->logger->logError('Validation Error', $debug); Tools::redirect('index.php?controller=order&step=1'); } - private function isValidConfiguration($logger) + private function isValidConfiguration() { $merchantKey = Configuration::get('BUCKAROO_MERCHANT_KEY'); $secretKey = Configuration::get('BUCKAROO_SECRET_KEY'); @@ -117,21 +144,21 @@ private function isValidConfiguration($logger) return true; } - private function isAuthorized($logger) + private function isAuthorized() { foreach (PaymentModule::getInstalledPaymentModules() as $module) { if ($module['name'] == 'buckaroo3') { return true; } } - $logger->logError('Authorization Error', 'This payment method is not available.'); + $this->logger->logError('Authorization Error', 'This payment method is not available.'); exit($this->module->l('This payment method is not available.', 'validation')); } - private function isValidCustomer($logger, $customer) + private function isValidCustomer($customer) { if (!Validate::isLoadedObject($customer)) { - $logger->logError('Load a customer', 'Failed to load the customer with ID: ' . $cart->id_customer); + $this->logger->logError('Load a customer', 'Failed to load the customer with ID: ' . $customer->id); Tools::redirect('index.php?controller=order&step=1'); return false; } @@ -150,62 +177,70 @@ private function applyBuckarooFee($payment_method, $total) return $total; } - private function isValidService($logger) + private function isValidService() { if (Tools::getValue('service') && Tools::getValue('service') != 'digi' && Tools::getValue('service') != 'sepa') { - $logger->logError('Load a method', 'Failed to load the method'); + $this->logger->logError('Load a method', 'Failed to load the method'); Tools::redirect('index.php?controller=order&step=1'); return false; } return true; } - private function initializeCheckout($logger, $cart, $payment_method, $currency, $total, $customer) + private function initializeCheckout($cart, $payment_method, $currency, $total, $customer) { try { $this->checkout = Checkout::getInstance($payment_method, $cart, $this->context); $this->setCheckoutProperties(); $this->setCheckoutUrls(); } catch (Exception $e) { - $logger->logError('Set checkout info: ', $e->getMessage()); + $this->logger->logError('Set checkout info: ', $e->getMessage()); $this->displayError(null, $e->getMessage()); return; } - $logger->logDebug('Get checkout class: '); $pending = Configuration::get('BUCKAROO_ORDER_STATE_DEFAULT'); $payment_method_tr = (new RawPaymentMethodRepository())->getPaymentMethodsLabel($payment_method); - if (!$this->checkout->isVerifyRequired()) { - $this->module->validateOrder( - (int) $cart->id, - $pending, - (float) $total, - $payment_method_tr, - null, - null, - (int) $currency->id, - false, - $customer->secure_key - ); + $id_order_cart = Order::getIdByCartId($cart->id); + if (!$id_order_cart) { + if (!$this->checkout->isVerifyRequired()) { + try { + $this->module->validateOrder( + (int) $cart->id, + $pending, + (float) $total, + $payment_method_tr, + null, + null, + (int) $currency->id, + false, + $customer->secure_key + ); + } catch (Exception $e) { + $this->logger->logError('Order validation failed: ', $e->getMessage()); + $this->displayError(null, $e->getMessage()); + return; + } + } + } else { + $this->module->currentOrder = $id_order_cart; } - $id_order_cart = Order::getIdByCartId($cart->id); - $order = new Order($id_order_cart); + $order = new Order($this->module->currentOrder); $this->checkout->setReference($order->reference); try { $this->checkout->setCheckout(); - $logger->logDebug('Set checkout info: '); if ($this->checkout->isVerifyRequired()) { - $logger->logInfo('Start verify process'); + $this->logger->logInfo('Start verify process'); $this->checkout->startVerify(['cid' => $cart->id_customer]); } else { - $logger->logInfo('Start the payment process'); + $this->logger->logInfo('Start the payment process'); $this->checkout->startPayment(); } } catch (Exception $e) { - $logger->logError('Set checkout info: ', $e->getMessage()); + $this->logger->logError('Set checkout info: ', $e->getMessage()); $this->displayError(null, $e->getMessage()); return; } @@ -222,34 +257,32 @@ private function setCheckoutProperties() private function setCheckoutUrls() { - $this->checkout->returnUrl = 'http' . ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . __PS_BASE_URI__ . 'index.php?fc=module&module=buckaroo3&controller=userreturn'; // phpcs:ignore + $this->checkout->returnUrl = 'http' . ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . __PS_BASE_URI__ . 'index.php?fc=module&module=buckaroo3&controller=userreturn'; $this->checkout->pushUrl = 'http' . ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . __PS_BASE_URI__ . 'index.php?fc=module&module=buckaroo3&controller=return'; } - private function handleSuccessfulRequest($logger, $cartId, $customer) + private function handleSuccessfulRequest($cartId, $customer) { $response = $this->checkout->getResponse(); - $logger->logInfo('Request succeeded'); + $this->logger->logInfo('Request succeeded'); if ($this->checkout->isRedirectRequired()) { $this->setCartCookie($cartId); - $logger->logInfo('Redirecting ... '); + $this->logger->logInfo('Redirecting ... '); $this->checkout->doRedirect(); exit; } - $logger->logDebug('Checkout response', $response); - if ($response->hasSucceeded()) { - $this->processSuccessfulPayment($logger, $cartId, $customer, $response); + $this->processSuccessfulPayment($cartId, $customer, $response); } else { - $this->processFailedPayment($logger, $cartId, $response); + $this->processFailedPayment($cartId, $response); } } - private function processSuccessfulPayment($logger, $cartId, $customer, $response) + private function processSuccessfulPayment($cartId, $customer, $response) { - $logger->logInfo('Payment request succeeded. Wait push message!'); + $this->logger->logInfo('Payment request succeeded. Wait push message!'); $id_order = $this->module->currentOrder; $responseData = $response->getResponse(); @@ -263,9 +296,14 @@ private function processSuccessfulPayment($logger, $cartId, $customer, $response $this->context->cookie->__set('HtmlText', $response->consumerMessage['HtmlText']); } - Tools::redirect( - 'index.php?controller=order-confirmation&id_cart=' . $cartId . '&id_module=' . $this->module->id . '&id_order=' . $id_order . '&key=' . $customer->secure_key . '&success=true&response_received=' . $response->payment_method // phpcs:ignore - ); + Tools::redirect($this->context->link->getPageLink('order-confirmation', true, null, [ + 'id_cart' => $cartId, + 'id_module' => $this->module->id, + 'id_order' => $id_order, + 'key' => $customer->secure_key, + 'success' => 'true', + 'response_received' => $response->payment_method + ])); } private function processSepaDirectDebit($id_order, $responseData) @@ -279,15 +317,15 @@ private function processSepaDirectDebit($id_order, $responseData) } } - private function processFailedPayment($logger, $cartId, $response) + private function processFailedPayment($cartId, $response) { - $logger->logInfo('Payment request failed/canceled'); + $this->logger->logInfo('Payment request failed/canceled'); $this->setCartCookie($cartId); if ($response->isValid()) { - $this->updateOrderHistory($logger, $response); + $this->updateOrderHistory($response); } else { - $logger->logInfo('Payment request not valid'); + $this->logger->logInfo('Payment request not valid'); } $error = null; @@ -297,21 +335,21 @@ private function processFailedPayment($logger, $cartId, $response) $this->displayError(null, $error); } - private function updateOrderHistory($logger, $response) + private function updateOrderHistory($response) { - $logger->logInfo('Payment request valid'); + $this->logger->logInfo('Payment request valid'); $id_order = Order::getOrderByCartId($response->getCartId()); if ($id_order) { - $this->updateOrderStatus($logger, $response, $id_order); + $this->updateOrderStatus($response, $id_order); } else { - $logger->logInfo('Find order by cart ID', 'Order not found.'); + $this->logger->logInfo('Find order by cart ID', 'Order not found.'); } } - private function updateOrderStatus($logger, $response, $id_order) + private function updateOrderStatus($response, $id_order) { - $logger->logInfo('Find order by cart ID', 'Order found. ID: ' . $id_order); - $logger->logInfo('Update order history with status: ' . Buckaroo3::resolveStatusCode($response->status)); + $this->logger->logInfo('Find order by cart ID', 'Order found. ID: ' . $id_order); + $this->logger->logInfo('Update order history with status: ' . Buckaroo3::resolveStatusCode($response->status)); $order = new Order($id_order); $new_status_code = Buckaroo3::resolveStatusCode($response->status); @@ -327,10 +365,10 @@ private function updateOrderStatus($logger, $response, $id_order) } } - private function handleFailedRequest($logger, $cartId) + private function handleFailedRequest($cartId) { $response = $this->checkout->getResponse(); - $logger->logInfo('Request not succeeded'); + $this->logger->logInfo('Request not succeeded'); $this->setCartCookie($cartId); @@ -361,6 +399,8 @@ private function setCartCookie($cartId) if ($duplication && Validate::isLoadedObject($duplication['cart']) && $duplication['success']) { $this->context->cookie->id_cart = $duplication['cart']->id; $this->context->cookie->write(); + } else { + $this->logger->logError('Cart duplication failed'); } } -} +} \ No newline at end of file diff --git a/controllers/front/return.php b/controllers/front/return.php index 3851b00a..516aff37 100644 --- a/controllers/front/return.php +++ b/controllers/front/return.php @@ -28,13 +28,14 @@ class Buckaroo3ReturnModuleFrontController extends BuckarooCommonController { public $ssl = true; - private $symContainer; + protected $logger; public function __construct() { parent::__construct(); $this->setContainer(); + $this->logger = new Logger(Logger::INFO, 'return'); } /** @@ -44,8 +45,7 @@ public function initContent() { $this->display_column_left = false; $this->display_column_right = false; - $logger = new Logger(Logger::INFO, 'return'); - $logger->logInfo("\n\n\n\n***************** Return start ***********************"); + $this->logger->logInfo("\n\n\n\n***************** Return start ***********************"); parent::initContent(); @@ -54,11 +54,12 @@ public function initContent() foreach ($tmp as $stat) { $statuses[$stat['id_order_state']] = $stat['name']; } + $response = ResponseFactory::getResponse(); - $logger->logInfo('Parse response', $response); + $this->logger->logInfo('Parse response', $response); if ($response->isValid()) { - $logger->logInfo('Response valid'); + $this->logger->logInfo('Response valid'); if (!empty($response->payment_method) && ($response->payment_method == 'paypal') && !empty($response->statuscode) @@ -75,9 +76,11 @@ public function initContent() $row = get_object_vars($order); $references[] = $row['reference']; } - $logger->logInfo('Get order by cart id', 'Order ID: ' . $id_order); + + $this->logger->logInfo('Get order by cart id', 'Order ID: ' . $id_order); + if ($response->brq_relatedtransaction_partialpayment != null) { - $logger->logInfo('PUSH', 'Partial payment PUSH received ' . $response->status); + $this->logger->logInfo('PUSH', 'Partial payment PUSH received ' . $response->status); if ($id_order && $response->hasSucceeded()) { $order = new Order($id_order); $order->setInvoice(false); @@ -87,26 +90,19 @@ public function initContent() $payment->transaction_id = $response->transactions; $payment->amount = urldecode($response->amount); $payment->payment_method = $response->payment_method; - if ($payment->id_currency == $order->id_currency) { - $order->total_paid_real += $response->amount; - } else { - $order->total_paid_real += Tools::ps_round( - Tools::convertPrice($response->amount, $payment->id_currency, false), - 2 - ); - } + $order->total_paid_real += $response->amount; $order->save(); $payment->conversion_rate = 1; $payment->save(); Db::getInstance()->execute( ' - INSERT INTO `' . _DB_PREFIX_ . 'order_invoice_payment` - VALUES(' . (int) $order->invoice_number . ', ' . (int) $payment->id . ', ' . (int) $order->id . ')' + INSERT INTO `' . _DB_PREFIX_ . 'order_invoice_payment` + VALUES(' . (int)$order->invoice_number . ', ' . (int)$payment->id . ', ' . (int)$order->id . ')' ); $message = new Message(); $message->id_order = $id_order; - $message->message = 'Buckaroo partial payment message (' . $response->transactions . '): ' . $response->statusmessage; // phpcs:ignore + $message->message = 'Buckaroo partial payment message (' . $response->transactions . '): ' . $response->statusmessage; $message->add(); } exit; @@ -122,42 +118,43 @@ public function initContent() 'Buckaroo refund message (' . $response->transactions . '): ' . $response->statusmessage ); } catch (\Throwable $th) { - $logger->logInfo('PUSH', (string) $th); + $this->logger->logInfo('PUSH', (string)$th); } exit; } + if (!$id_order) { header('HTTP/1.1 503 Service Unavailable'); - echo 'Order do not exists'; - $logger->logInfo('PUSH', 'Order do not exists'); + echo 'Order does not exist'; + $this->logger->logError('PUSH', 'Order does not exist'); exit; } else { - $logger->logInfo('Update the order', 'Order ID: ' . $id_order); + $this->logger->logInfo('Update the order', 'Order ID: ' . $id_order); $new_status_code = Buckaroo3::resolveStatusCode($response->status, $id_order); - $order = new Order($id_order); if (!in_array($order->reference, $references)) { header('HTTP/1.1 503 Service Unavailable'); - $logger->logInfo('Order not in reference ' . $order->reference); + $this->logger->logError('Order not in reference ' . $order->reference); echo 'Order not in reference: ' . $order->reference; exit; } - $logger->logInfo( - 'Old order status code: ' . $order->getCurrentState( - ) . '; new order status code: ' . $new_status_code + $this->logger->logInfo( + 'Old order status code: ' . $order->getCurrentState() . '; new order status code: ' . $new_status_code ); + $pending = Configuration::get('BUCKAROO_ORDER_STATE_DEFAULT'); $canceled = Configuration::get('BUCKAROO_ORDER_STATE_FAILED'); $error = Configuration::get('PS_OS_ERROR'); $outofstock_unpaid = Configuration::get('PS_OS_OUTOFSTOCK_UNPAID'); + if ($new_status_code != $order->getCurrentState() - && ($pending == $order->getCurrentState() || $canceled == $order->getCurrentState( - ) || $error == $order->getCurrentState() || $outofstock_unpaid == $order->getCurrentState()) + && ($pending == $order->getCurrentState() || $canceled == $order->getCurrentState() + || $error == $order->getCurrentState() || $outofstock_unpaid == $order->getCurrentState()) ) { - $logger->logInfo('Update order status'); + $this->logger->logInfo('Update order status'); $history = new OrderHistory(); $history->id_order = $id_order; $history->date_add = date('Y-m-d H:i:s'); @@ -171,23 +168,25 @@ public function initContent() $payment->amount = 0; $payment->update(); } - /* @var $payment OrderPaymentCore */ if ($payment->amount == $response->amount && $payment->transaction_id == '') { $payment->transaction_id = $response->transactions; $payment->update(); } } } else { - $logger->logInfo('Order status not updated'); + $this->logger->logInfo('Order status not updated'); } + $statusCodeName = $new_status_code; if (!empty($statuses[$new_status_code])) { $statusCodeName = $statuses[$new_status_code]; } + $message = new Message(); $message->id_order = $id_order; - $message->message = 'Push message recieved. Buckaroo status: ' . $statusCodeName . '. Transaction key: ' . $response->transactions; // phpcs:ignore + $message->message = 'Push message received. Buckaroo status: ' . $statusCodeName . '. Transaction key: ' . $response->transactions; $message->add(); + if ($response->statusmessage) { $message = new Message(); $message->id_order = $id_order; @@ -197,7 +196,7 @@ public function initContent() } } else { header('HTTP/1.1 503 Service Unavailable'); - $logger->logError('Payment response not valid', $response); + $this->logger->logError('Payment response not valid', $response); echo 'Payment response not valid'; exit; } @@ -233,4 +232,4 @@ private function setContainer() } $this->symContainer = $kernel->getContainer(); } -} +} \ No newline at end of file diff --git a/controllers/front/userreturn.php b/controllers/front/userreturn.php index 535d9850..e25ebd90 100644 --- a/controllers/front/userreturn.php +++ b/controllers/front/userreturn.php @@ -25,6 +25,13 @@ class Buckaroo3UserreturnModuleFrontController extends BuckarooCommonController { public $ssl = true; + protected $logger; + + public function __construct() + { + parent::__construct(); + $this->logger = new Logger(Logger::INFO, 'userreturn'); + } /** * @see FrontController::initContent() @@ -32,12 +39,12 @@ class Buckaroo3UserreturnModuleFrontController extends BuckarooCommonController public function initContent() { $cookie = new Cookie('ps'); - $logger = new Logger(Logger::INFO, 'return'); + $this->logger->logInfo("\n\n\n\n***************** User return start ***********************"); $response = ResponseFactory::getResponse(); - $logger->logDebug('Checkout response', $response); + if ($response->isValid()) { - $logger->logInfo('Payment request succeeded'); + $this->logger->logInfo('Payment request succeeded'); if (!empty($response->payment_method) && ($response->payment_method == 'paypal') @@ -49,12 +56,14 @@ public function initContent() } $id_order = Order::getOrderByCartId($response->getCartId()); - $logger->logInfo('Update the order', 'Order ID: ' . $id_order); + $this->logger->logInfo('Update the order', 'Order ID: ' . $id_order); + if ($response->hasSucceeded()) { $cart = new Cart($response->getCartId()); $customer = new Customer($cart->id_customer); + if (!Validate::isLoadedObject($customer)) { - $logger->logError('Load a customer', 'Failed to load the customer with ID: ' . $cart->id_customer); + $this->logger->logError('Load a customer', 'Failed to load the customer with ID: ' . $cart->id_customer); Tools::redirect('index.php?controller=order&step=1'); exit; } @@ -67,19 +76,22 @@ public function initContent() 'key' => $customer->secure_key, 'success' => 'true', ]); + $this->logger->logInfo('Redirecting to order confirmation', ['url' => $redirectUrl]); Tools::redirect($redirectUrl); } else { $cookie->statusMessage = ''; if (($response->payment_method == 'afterpayacceptgiro' - || $response->payment_method == 'afterpaydigiaccept') + || $response->payment_method == 'afterpaydigiaccept') && $response->statusmessage) { $cookie->statusMessage = $response->statusmessage; } + $this->logger->logError('Payment failed', ['statusMessage' => $cookie->statusMessage]); Tools::redirect('index.php?fc=module&module=buckaroo3&controller=error'); exit; } } else { $cookie->statusMessage = 'Not valid response'; + $this->logger->logError('Invalid payment response'); Tools::redirect('index.php?fc=module&module=buckaroo3&controller=error'); } exit; diff --git a/dev/src/components/payments/GiftcardPaymentConfig.vue b/dev/src/components/payments/GiftcardPaymentConfig.vue index 48b43911..2b9e4a3b 100644 --- a/dev/src/components/payments/GiftcardPaymentConfig.vue +++ b/dev/src/components/payments/GiftcardPaymentConfig.vue @@ -37,8 +37,7 @@ export default { const { t } = useI18n(); const displayOptions = [ - { text: t('Grouped'), value: 'grouped' }, - { text: t('Separate'), value: 'separate' } + { text: t('Grouped'), value: 'grouped' } ]; const config = inject('config') diff --git a/library/checkout/in3checkout.php b/library/checkout/in3checkout.php index b9591344..e70a4bf3 100644 --- a/library/checkout/in3checkout.php +++ b/library/checkout/in3checkout.php @@ -107,7 +107,7 @@ public function getArticles() 'vatPercentage' => $item['rate'], ]; - $total += round($item['price_wt'], 2); + $total += round($item['price_wt'] * $item['quantity'], 2); } $wrapping = $this->cart->getOrderTotal(true, CartCore::ONLY_WRAPPING); @@ -143,12 +143,13 @@ public function getArticles() $total += round($shipping, 2); } - if (abs($this->payment_request->amountDebit - $total) >= 0.01) { + $difference = round($this->payment_request->amountDebit - $total, 2); + if (abs($difference) >= 0.01) { $products[] = [ 'description' => 'Other fee/discount', 'identifier' => 'OFees', 'quantity' => 1, - 'price' => round($this->payment_request->amountDebit - $total, 2), + 'price' => $difference, ]; } diff --git a/library/checkout/in3oldcheckout.php b/library/checkout/in3oldcheckout.php index e792fe5e..5304393a 100644 --- a/library/checkout/in3oldcheckout.php +++ b/library/checkout/in3oldcheckout.php @@ -166,7 +166,7 @@ public function getArticles() 'price' => round($item['price_wt'], 2), ]; - $total += round($item['price_wt'], 2); + $total += round($item['price_wt'] * $item['quantity'], 2); } $wrapping = $this->cart->getOrderTotal(true, CartCore::ONLY_WRAPPING); @@ -202,12 +202,13 @@ public function getArticles() $total += round($shipping, 2); } - if (abs($this->payment_request->amountDebit - $total) >= 0.01) { + $difference = round($this->payment_request->amountDebit - $total, 2); + if (abs($difference) >= 0.01) { $products[] = [ 'description' => 'Other fee/discount', 'identifier' => 'OFees', 'quantity' => 1, - 'price' => round($this->payment_request->amountDebit - $total, 2), + 'price' => $difference, ]; } diff --git a/src/Service/BuckarooPaymentService.php b/src/Service/BuckarooPaymentService.php index f72d3f8b..c79059ed 100644 --- a/src/Service/BuckarooPaymentService.php +++ b/src/Service/BuckarooPaymentService.php @@ -185,6 +185,7 @@ private function getIndividualGiftCard($method, $details, $cardCode, $configArra } if (!empty($details->getTemplate())) { + $this->context->smarty->assign('cardCode', $cardCode); $newOption->setForm($this->context->smarty->fetch('module:buckaroo3/views/templates/hook/' . $details->getTemplate())); } else { $newOption->setInputs($this->buckarooFeeService->getBuckarooFeeInputs($method)); @@ -194,7 +195,6 @@ private function getIndividualGiftCard($method, $details, $cardCode, $configArra ->setAction($this->context->link->getModuleLink('buckaroo3', 'request', ['method' => $method, 'cardCode' => $cardCode])) ->setModuleName($method); - $newOption->setInputs($this->buckarooFeeService->getBuckarooFeeInputs($method)); $logoPath = '/modules/buckaroo3/views/img/buckaroo/' . $this->getGiftCardLogoPath($cardData); diff --git a/views/js/buckaroo.vue.js b/views/js/buckaroo.vue.js index 9c3c0790..fe6a2751 100644 --- a/views/js/buckaroo.vue.js +++ b/views/js/buckaroo.vue.js @@ -114,7 +114,7 @@ Für genaue Kostendetails wenden Sie sich bitte direkt an =0&&b0&&h-1 in u}function L(u,h){return u.nodeName&&u.nodeName.toLowerCase()===h.toLowerCase()}var W=r.pop,ce=r.sort,re=r.splice,J="[\\x20\\t\\r\\n\\f]",xe=new RegExp("^"+J+"+|((?:^|[^\\\\])(?:\\\\.)*)"+J+"+$","g");m.contains=function(u,h){var b=h&&h.parentNode;return u===b||!!(b&&b.nodeType===1&&(u.contains?u.contains(b):u.compareDocumentPosition&&u.compareDocumentPosition(b)&16))};var Me=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function he(u,h){return h?u==="\0"?"�":u.slice(0,-1)+"\\"+u.charCodeAt(u.length-1).toString(16)+" ":"\\"+u}m.escapeSelector=function(u){return(u+"").replace(Me,he)};var Te=R,Ae=c;(function(){var u,h,b,x,C,I=Ae,N,q,K,le,Ee,Se=m.expando,me=0,Fe=0,ze=Ki(),Tt=Ki(),wt=Ki(),qn=Ki(),Ln=function(G,oe){return G===oe&&(C=!0),0},vs="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",_s="(?:\\\\[\\da-fA-F]{1,6}"+J+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",jt="\\["+J+"*("+_s+")(?:"+J+"*([*^$|!~]?=)"+J+`*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(`+_s+"))|)"+J+"*\\]",so=":("+_s+`)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|`+jt+")*)|.*)\\)|)",Vt=new RegExp(J+"+","g"),mn=new RegExp("^"+J+"*,"+J+"*"),Vi=new RegExp("^"+J+"*([>+~]|"+J+")"+J+"*"),Ua=new RegExp(J+"|>"),ss=new RegExp(so),Eo=new RegExp("^"+_s+"$"),Hr={ID:new RegExp("^#("+_s+")"),CLASS:new RegExp("^\\.("+_s+")"),TAG:new RegExp("^("+_s+"|[*])"),ATTR:new RegExp("^"+jt),PSEUDO:new RegExp("^"+so),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+J+"*(even|odd|(([+-]|)(\\d*)n|)"+J+"*(?:([+-]|)"+J+"*(\\d+)|))"+J+"*\\)|)","i"),bool:new RegExp("^(?:"+vs+")$","i"),needsContext:new RegExp("^"+J+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+J+"*((?:-\\d)?\\d*)"+J+"*\\)|)(?=[^-]|$)","i")},Bs=/^(?:input|select|textarea|button)$/i,oo=/^h\d$/i,vr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Wi=/[+~]/,Us=new RegExp("\\\\[\\da-fA-F]{1,6}"+J+"?|\\\\([^\\r\\n\\f])","g"),xs=function(G,oe){var ge="0x"+G.slice(1)-65536;return oe||(ge<0?String.fromCharCode(ge+65536):String.fromCharCode(ge>>10|55296,ge&1023|56320))},Or=function(){io()},Yl=So(function(G){return G.disabled===!0&&L(G,"fieldset")},{dir:"parentNode",next:"legend"});function Gi(){try{return N.activeElement}catch{}}try{I.apply(r=a.call(Te.childNodes),Te.childNodes),r[Te.childNodes.length].nodeType}catch{I={apply:function(oe,ge){Ae.apply(oe,a.call(ge))},call:function(oe){Ae.apply(oe,a.call(arguments,1))}}}function cn(G,oe,ge,ve){var H,te,Q,Ce,Pe,Ye,qe,We=oe&&oe.ownerDocument,Nt=oe?oe.nodeType:9;if(ge=ge||[],typeof G!="string"||!G||Nt!==1&&Nt!==9&&Nt!==11)return ge;if(!ve&&(io(oe),oe=oe||N,K)){if(Nt!==11&&(Pe=vr.exec(G)))if(H=Pe[1]){if(Nt===9)if(Q=oe.getElementById(H)){if(Q.id===H)return I.call(ge,Q),ge}else return ge;else if(We&&(Q=We.getElementById(H))&&cn.contains(oe,Q)&&Q.id===H)return I.call(ge,Q),ge}else{if(Pe[2])return I.apply(ge,oe.getElementsByTagName(G)),ge;if((H=Pe[3])&&oe.getElementsByClassName)return I.apply(ge,oe.getElementsByClassName(H)),ge}if(!qn[G+" "]&&(!le||!le.test(G))){if(qe=G,We=oe,Nt===1&&(Ua.test(G)||Vi.test(G))){for(We=Wi.test(G)&&Xl(oe.parentNode)||oe,(We!=oe||!w.scope)&&((Ce=oe.getAttribute("id"))?Ce=m.escapeSelector(Ce):oe.setAttribute("id",Ce=Se)),Ye=ri(G),te=Ye.length;te--;)Ye[te]=(Ce?"#"+Ce:":scope")+" "+is(Ye[te]);qe=Ye.join(",")}try{return I.apply(ge,We.querySelectorAll(qe)),ge}catch{qn(G,!0)}finally{Ce===Se&&oe.removeAttribute("id")}}}return Yu(G.replace(xe,"$1"),oe,ge,ve)}function Ki(){var G=[];function oe(ge,ve){return G.push(ge+" ")>h.cacheLength&&delete oe[G.shift()],oe[ge+" "]=ve}return oe}function os(G){return G[Se]=!0,G}function ni(G){var oe=N.createElement("fieldset");try{return!!G(oe)}catch{return!1}finally{oe.parentNode&&oe.parentNode.removeChild(oe),oe=null}}function Xp(G){return function(oe){return L(oe,"input")&&oe.type===G}}function qp(G){return function(oe){return(L(oe,"input")||L(oe,"button"))&&oe.type===G}}function Ku(G){return function(oe){return"form"in oe?oe.parentNode&&oe.disabled===!1?"label"in oe?"label"in oe.parentNode?oe.parentNode.disabled===G:oe.disabled===G:oe.isDisabled===G||oe.isDisabled!==!G&&Yl(oe)===G:oe.disabled===G:"label"in oe?oe.disabled===G:!1}}function jr(G){return os(function(oe){return oe=+oe,os(function(ge,ve){for(var H,te=G([],ge.length,oe),Q=te.length;Q--;)ge[H=te[Q]]&&(ge[H]=!(ve[H]=ge[H]))})})}function Xl(G){return G&&typeof G.getElementsByTagName<"u"&&G}function io(G){var oe,ge=G?G.ownerDocument||G:Te;return ge==N||ge.nodeType!==9||!ge.documentElement||(N=ge,q=N.documentElement,K=!m.isXMLDoc(N),Ee=q.matches||q.webkitMatchesSelector||q.msMatchesSelector,q.msMatchesSelector&&Te!=N&&(oe=N.defaultView)&&oe.top!==oe&&oe.addEventListener("unload",Or),w.getById=ni(function(ve){return q.appendChild(ve).id=m.expando,!N.getElementsByName||!N.getElementsByName(m.expando).length}),w.disconnectedMatch=ni(function(ve){return Ee.call(ve,"*")}),w.scope=ni(function(){return N.querySelectorAll(":scope")}),w.cssHas=ni(function(){try{return N.querySelector(":has(*,:jqfake)"),!1}catch{return!0}}),w.getById?(h.filter.ID=function(ve){var H=ve.replace(Us,xs);return function(te){return te.getAttribute("id")===H}},h.find.ID=function(ve,H){if(typeof H.getElementById<"u"&&K){var te=H.getElementById(ve);return te?[te]:[]}}):(h.filter.ID=function(ve){var H=ve.replace(Us,xs);return function(te){var Q=typeof te.getAttributeNode<"u"&&te.getAttributeNode("id");return Q&&Q.value===H}},h.find.ID=function(ve,H){if(typeof H.getElementById<"u"&&K){var te,Q,Ce,Pe=H.getElementById(ve);if(Pe){if(te=Pe.getAttributeNode("id"),te&&te.value===ve)return[Pe];for(Ce=H.getElementsByName(ve),Q=0;Pe=Ce[Q++];)if(te=Pe.getAttributeNode("id"),te&&te.value===ve)return[Pe]}return[]}}),h.find.TAG=function(ve,H){return typeof H.getElementsByTagName<"u"?H.getElementsByTagName(ve):H.querySelectorAll(ve)},h.find.CLASS=function(ve,H){if(typeof H.getElementsByClassName<"u"&&K)return H.getElementsByClassName(ve)},le=[],ni(function(ve){var H;q.appendChild(ve).innerHTML="",ve.querySelectorAll("[selected]").length||le.push("\\["+J+"*(?:value|"+vs+")"),ve.querySelectorAll("[id~="+Se+"-]").length||le.push("~="),ve.querySelectorAll("a#"+Se+"+*").length||le.push(".#.+[+~]"),ve.querySelectorAll(":checked").length||le.push(":checked"),H=N.createElement("input"),H.setAttribute("type","hidden"),ve.appendChild(H).setAttribute("name","D"),q.appendChild(ve).disabled=!0,ve.querySelectorAll(":disabled").length!==2&&le.push(":enabled",":disabled"),H=N.createElement("input"),H.setAttribute("name",""),ve.appendChild(H),ve.querySelectorAll("[name='']").length||le.push("\\["+J+"*name"+J+"*="+J+`*(?:''|"")`)}),w.cssHas||le.push(":has"),le=le.length&&new RegExp(le.join("|")),Ln=function(ve,H){if(ve===H)return C=!0,0;var te=!ve.compareDocumentPosition-!H.compareDocumentPosition;return te||(te=(ve.ownerDocument||ve)==(H.ownerDocument||H)?ve.compareDocumentPosition(H):1,te&1||!w.sortDetached&&H.compareDocumentPosition(ve)===te?ve===N||ve.ownerDocument==Te&&cn.contains(Te,ve)?-1:H===N||H.ownerDocument==Te&&cn.contains(Te,H)?1:x?d.call(x,ve)-d.call(x,H):0:te&4?-1:1)}),N}cn.matches=function(G,oe){return cn(G,null,null,oe)},cn.matchesSelector=function(G,oe){if(io(G),K&&!qn[oe+" "]&&(!le||!le.test(oe)))try{var ge=Ee.call(G,oe);if(ge||w.disconnectedMatch||G.document&&G.document.nodeType!==11)return ge}catch{qn(oe,!0)}return cn(oe,N,null,[G]).length>0},cn.contains=function(G,oe){return(G.ownerDocument||G)!=N&&io(G),m.contains(G,oe)},cn.attr=function(G,oe){(G.ownerDocument||G)!=N&&io(G);var ge=h.attrHandle[oe.toLowerCase()],ve=ge&&g.call(h.attrHandle,oe.toLowerCase())?ge(G,oe,!K):void 0;return ve!==void 0?ve:G.getAttribute(oe)},cn.error=function(G){throw new Error("Syntax error, unrecognized expression: "+G)},m.uniqueSort=function(G){var oe,ge=[],ve=0,H=0;if(C=!w.sortStable,x=!w.sortStable&&a.call(G,0),ce.call(G,Ln),C){for(;oe=G[H++];)oe===G[H]&&(ve=ge.push(H));for(;ve--;)re.call(G,ge[ve],1)}return x=null,G},m.fn.uniqueSort=function(){return this.pushStack(m.uniqueSort(a.apply(this)))},h=m.expr={cacheLength:50,createPseudo:os,match:Hr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(G){return G[1]=G[1].replace(Us,xs),G[3]=(G[3]||G[4]||G[5]||"").replace(Us,xs),G[2]==="~="&&(G[3]=" "+G[3]+" "),G.slice(0,4)},CHILD:function(G){return G[1]=G[1].toLowerCase(),G[1].slice(0,3)==="nth"?(G[3]||cn.error(G[0]),G[4]=+(G[4]?G[5]+(G[6]||1):2*(G[3]==="even"||G[3]==="odd")),G[5]=+(G[7]+G[8]||G[3]==="odd")):G[3]&&cn.error(G[0]),G},PSEUDO:function(G){var oe,ge=!G[6]&&G[2];return Hr.CHILD.test(G[0])?null:(G[3]?G[2]=G[4]||G[5]||"":ge&&ss.test(ge)&&(oe=ri(ge,!0))&&(oe=ge.indexOf(")",ge.length-oe)-ge.length)&&(G[0]=G[0].slice(0,oe),G[2]=ge.slice(0,oe)),G.slice(0,3))}},filter:{TAG:function(G){var oe=G.replace(Us,xs).toLowerCase();return G==="*"?function(){return!0}:function(ge){return L(ge,oe)}},CLASS:function(G){var oe=ze[G+" "];return oe||(oe=new RegExp("(^|"+J+")"+G+"("+J+"|$)"))&&ze(G,function(ge){return oe.test(typeof ge.className=="string"&&ge.className||typeof ge.getAttribute<"u"&&ge.getAttribute("class")||"")})},ATTR:function(G,oe,ge){return function(ve){var H=cn.attr(ve,G);return H==null?oe==="!=":oe?(H+="",oe==="="?H===ge:oe==="!="?H!==ge:oe==="^="?ge&&H.indexOf(ge)===0:oe==="*="?ge&&H.indexOf(ge)>-1:oe==="$="?ge&&H.slice(-ge.length)===ge:oe==="~="?(" "+H.replace(Vt," ")+" ").indexOf(ge)>-1:oe==="|="?H===ge||H.slice(0,ge.length+1)===ge+"-":!1):!0}},CHILD:function(G,oe,ge,ve,H){var te=G.slice(0,3)!=="nth",Q=G.slice(-4)!=="last",Ce=oe==="of-type";return ve===1&&H===0?function(Pe){return!!Pe.parentNode}:function(Pe,Ye,qe){var We,Nt,lt,Ut,Jn,ar=te!==Q?"nextSibling":"previousSibling",Zn=Pe.parentNode,kr=Ce&&Pe.nodeName.toLowerCase(),Hs=!qe&&!Ce,_t=!1;if(Zn){if(te){for(;ar;){for(lt=Pe;lt=lt[ar];)if(Ce?L(lt,kr):lt.nodeType===1)return!1;Jn=ar=G==="only"&&!Jn&&"nextSibling"}return!0}if(Jn=[Q?Zn.firstChild:Zn.lastChild],Q&&Hs){for(Nt=Zn[Se]||(Zn[Se]={}),We=Nt[G]||[],Ut=We[0]===me&&We[1],_t=Ut&&We[2],lt=Ut&&Zn.childNodes[Ut];lt=++Ut&<&<[ar]||(_t=Ut=0)||Jn.pop();)if(lt.nodeType===1&&++_t&<===Pe){Nt[G]=[me,Ut,_t];break}}else if(Hs&&(Nt=Pe[Se]||(Pe[Se]={}),We=Nt[G]||[],Ut=We[0]===me&&We[1],_t=Ut),_t===!1)for(;(lt=++Ut&<&<[ar]||(_t=Ut=0)||Jn.pop())&&!((Ce?L(lt,kr):lt.nodeType===1)&&++_t&&(Hs&&(Nt=lt[Se]||(lt[Se]={}),Nt[G]=[me,_t]),lt===Pe)););return _t-=H,_t===ve||_t%ve===0&&_t/ve>=0}}},PSEUDO:function(G,oe){var ge,ve=h.pseudos[G]||h.setFilters[G.toLowerCase()]||cn.error("unsupported pseudo: "+G);return ve[Se]?ve(oe):ve.length>1?(ge=[G,G,"",oe],h.setFilters.hasOwnProperty(G.toLowerCase())?os(function(H,te){for(var Q,Ce=ve(H,oe),Pe=Ce.length;Pe--;)Q=d.call(H,Ce[Pe]),H[Q]=!(te[Q]=Ce[Pe])}):function(H){return ve(H,0,ge)}):ve}},pseudos:{not:os(function(G){var oe=[],ge=[],ve=Jl(G.replace(xe,"$1"));return ve[Se]?os(function(H,te,Q,Ce){for(var Pe,Ye=ve(H,null,Ce,[]),qe=H.length;qe--;)(Pe=Ye[qe])&&(H[qe]=!(te[qe]=Pe))}):function(H,te,Q){return oe[0]=H,ve(oe,null,Q,ge),oe[0]=null,!ge.pop()}}),has:os(function(G){return function(oe){return cn(G,oe).length>0}}),contains:os(function(G){return G=G.replace(Us,xs),function(oe){return(oe.textContent||m.text(oe)).indexOf(G)>-1}}),lang:os(function(G){return Eo.test(G||"")||cn.error("unsupported lang: "+G),G=G.replace(Us,xs).toLowerCase(),function(oe){var ge;do if(ge=K?oe.lang:oe.getAttribute("xml:lang")||oe.getAttribute("lang"))return ge=ge.toLowerCase(),ge===G||ge.indexOf(G+"-")===0;while((oe=oe.parentNode)&&oe.nodeType===1);return!1}}),target:function(G){var oe=t.location&&t.location.hash;return oe&&oe.slice(1)===G.id},root:function(G){return G===q},focus:function(G){return G===Gi()&&N.hasFocus()&&!!(G.type||G.href||~G.tabIndex)},enabled:Ku(!1),disabled:Ku(!0),checked:function(G){return L(G,"input")&&!!G.checked||L(G,"option")&&!!G.selected},selected:function(G){return G.parentNode&&G.parentNode.selectedIndex,G.selected===!0},empty:function(G){for(G=G.firstChild;G;G=G.nextSibling)if(G.nodeType<6)return!1;return!0},parent:function(G){return!h.pseudos.empty(G)},header:function(G){return oo.test(G.nodeName)},input:function(G){return Bs.test(G.nodeName)},button:function(G){return L(G,"input")&&G.type==="button"||L(G,"button")},text:function(G){var oe;return L(G,"input")&&G.type==="text"&&((oe=G.getAttribute("type"))==null||oe.toLowerCase()==="text")},first:jr(function(){return[0]}),last:jr(function(G,oe){return[oe-1]}),eq:jr(function(G,oe,ge){return[ge<0?ge+oe:ge]}),even:jr(function(G,oe){for(var ge=0;geoe?ve=oe:ve=ge;--ve>=0;)G.push(ve);return G}),gt:jr(function(G,oe,ge){for(var ve=ge<0?ge+oe:ge;++ve1?function(oe,ge,ve){for(var H=G.length;H--;)if(!G[H](oe,ge,ve))return!1;return!0}:G[0]}function Jp(G,oe,ge){for(var ve=0,H=oe.length;ve-1&&(Q[qe]=!(Ce[qe]=Nt))}}else lt=ja(lt===Ce?lt.splice(ar,lt.length):lt),H?H(null,Ce,lt,Ye):I.apply(Ce,lt)})}function Ar(G){for(var oe,ge,ve,H=G.length,te=h.relative[G[0].type],Q=te||h.relative[" "],Ce=te?1:0,Pe=So(function(We){return We===oe},Q,!0),Ye=So(function(We){return d.call(oe,We)>-1},Q,!0),qe=[function(We,Nt,lt){var Ut=!te&&(lt||Nt!=b)||((oe=Nt).nodeType?Pe(We,Nt,lt):Ye(We,Nt,lt));return oe=null,Ut}];Ce1&&ql(qe),Ce>1&&is(G.slice(0,Ce-1).concat({value:G[Ce-2].type===" "?"*":""})).replace(xe,"$1"),ge,Ce0,ve=G.length>0,H=function(te,Q,Ce,Pe,Ye){var qe,We,Nt,lt=0,Ut="0",Jn=te&&[],ar=[],Zn=b,kr=te||ve&&h.find.TAG("*",Ye),Hs=me+=Zn==null?1:Math.random()||.1,_t=kr.length;for(Ye&&(b=Q==N||Q||Ye);Ut!==_t&&(qe=kr[Ut])!=null;Ut++){if(ve&&qe){for(We=0,!Q&&qe.ownerDocument!=N&&(io(qe),Ce=!K);Nt=G[We++];)if(Nt(qe,Q||N,Ce)){I.call(Pe,qe);break}Ye&&(me=Hs)}ge&&((qe=!Nt&&qe)&<--,te&&Jn.push(qe))}if(lt+=Ut,ge&&Ut!==lt){for(We=0;Nt=oe[We++];)Nt(Jn,ar,Q,Ce);if(te){if(lt>0)for(;Ut--;)Jn[Ut]||ar[Ut]||(ar[Ut]=W.call(Pe));ar=ja(ar)}I.apply(Pe,ar),Ye&&!te&&ar.length>0&<+oe.length>1&&m.uniqueSort(Pe)}return Ye&&(me=Hs,b=Zn),Jn};return ge?os(H):H}function Jl(G,oe){var ge,ve=[],H=[],te=wt[G+" "];if(!te){for(oe||(oe=ri(G)),ge=oe.length;ge--;)te=Ar(oe[ge]),te[Se]?ve.push(te):H.push(te);te=wt(G,zu(H,ve)),te.selector=G}return te}function Yu(G,oe,ge,ve){var H,te,Q,Ce,Pe,Ye=typeof G=="function"&&G,qe=!ve&&ri(G=Ye.selector||G);if(ge=ge||[],qe.length===1){if(te=qe[0]=qe[0].slice(0),te.length>2&&(Q=te[0]).type==="ID"&&oe.nodeType===9&&K&&h.relative[te[1].type]){if(oe=(h.find.ID(Q.matches[0].replace(Us,xs),oe)||[])[0],oe)Ye&&(oe=oe.parentNode);else return ge;G=G.slice(te.shift().value.length)}for(H=Hr.needsContext.test(G)?0:te.length;H--&&(Q=te[H],!h.relative[Ce=Q.type]);)if((Pe=h.find[Ce])&&(ve=Pe(Q.matches[0].replace(Us,xs),Wi.test(te[0].type)&&Xl(oe.parentNode)||oe))){if(te.splice(H,1),G=ve.length&&is(te),!G)return I.apply(ge,ve),ge;break}}return(Ye||Jl(G,qe))(ve,oe,!K,ge,!oe||Wi.test(G)&&Xl(oe.parentNode)||oe),ge}w.sortStable=Se.split("").sort(Ln).join("")===Se,io(),w.sortDetached=ni(function(G){return G.compareDocumentPosition(N.createElement("fieldset"))&1}),m.find=cn,m.expr[":"]=m.expr.pseudos,m.unique=m.uniqueSort,cn.compile=Jl,cn.select=Yu,cn.setDocument=io,cn.tokenize=ri,cn.escape=m.escapeSelector,cn.getText=m.text,cn.isXML=m.isXMLDoc,cn.selectors=m.expr,cn.support=m.support,cn.uniqueSort=m.uniqueSort})();var rt=function(u,h,b){for(var x=[],C=b!==void 0;(u=u[h])&&u.nodeType!==9;)if(u.nodeType===1){if(C&&m(u).is(b))break;x.push(u)}return x},St=function(u,h){for(var b=[];u;u=u.nextSibling)u.nodeType===1&&u!==h&&b.push(u);return b},et=m.expr.match.needsContext,bt=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function Xt(u,h,b){return T(h)?m.grep(u,function(x,C){return!!h.call(x,C,x)!==b}):h.nodeType?m.grep(u,function(x){return x===h!==b}):typeof h!="string"?m.grep(u,function(x){return d.call(h,x)>-1!==b}):m.filter(h,u,b)}m.filter=function(u,h,b){var x=h[0];return b&&(u=":not("+u+")"),h.length===1&&x.nodeType===1?m.find.matchesSelector(x,u)?[x]:[]:m.find.matches(u,m.grep(h,function(C){return C.nodeType===1}))},m.fn.extend({find:function(u){var h,b,x=this.length,C=this;if(typeof u!="string")return this.pushStack(m(u).filter(function(){for(h=0;h1?m.uniqueSort(b):b},filter:function(u){return this.pushStack(Xt(this,u||[],!1))},not:function(u){return this.pushStack(Xt(this,u||[],!0))},is:function(u){return!!Xt(this,typeof u=="string"&&et.test(u)?m(u):u||[],!1).length}});var tn,Ft=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,ht=m.fn.init=function(u,h,b){var x,C;if(!u)return this;if(b=b||tn,typeof u=="string")if(u[0]==="<"&&u[u.length-1]===">"&&u.length>=3?x=[null,u,null]:x=Ft.exec(u),x&&(x[1]||!h))if(x[1]){if(h=h instanceof m?h[0]:h,m.merge(this,m.parseHTML(x[1],h&&h.nodeType?h.ownerDocument||h:R,!0)),bt.test(x[1])&&m.isPlainObject(h))for(x in h)T(this[x])?this[x](h[x]):this.attr(x,h[x]);return this}else return C=R.getElementById(x[2]),C&&(this[0]=C,this.length=1),this;else return!h||h.jquery?(h||b).find(u):this.constructor(h).find(u);else{if(u.nodeType)return this[0]=u,this.length=1,this;if(T(u))return b.ready!==void 0?b.ready(u):u(m)}return m.makeArray(u,this)};ht.prototype=m.fn,tn=m(R);var Bt=/^(?:parents|prev(?:Until|All))/,on={children:!0,contents:!0,next:!0,prev:!0};m.fn.extend({has:function(u){var h=m(u,this),b=h.length;return this.filter(function(){for(var x=0;x-1:b.nodeType===1&&m.find.matchesSelector(b,u))){I.push(b);break}}return this.pushStack(I.length>1?m.uniqueSort(I):I)},index:function(u){return u?typeof u=="string"?d.call(m(u),this[0]):d.call(this,u.jquery?u[0]:u):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(u,h){return this.pushStack(m.uniqueSort(m.merge(this.get(),m(u,h))))},addBack:function(u){return this.add(u==null?this.prevObject:this.prevObject.filter(u))}});function Zt(u,h){for(;(u=u[h])&&u.nodeType!==1;);return u}m.each({parent:function(u){var h=u.parentNode;return h&&h.nodeType!==11?h:null},parents:function(u){return rt(u,"parentNode")},parentsUntil:function(u,h,b){return rt(u,"parentNode",b)},next:function(u){return Zt(u,"nextSibling")},prev:function(u){return Zt(u,"previousSibling")},nextAll:function(u){return rt(u,"nextSibling")},prevAll:function(u){return rt(u,"previousSibling")},nextUntil:function(u,h,b){return rt(u,"nextSibling",b)},prevUntil:function(u,h,b){return rt(u,"previousSibling",b)},siblings:function(u){return St((u.parentNode||{}).firstChild,u)},children:function(u){return St(u.firstChild)},contents:function(u){return u.contentDocument!=null&&i(u.contentDocument)?u.contentDocument:(L(u,"template")&&(u=u.content||u),m.merge([],u.childNodes))}},function(u,h){m.fn[u]=function(b,x){var C=m.map(this,h,b);return u.slice(-5)!=="Until"&&(x=b),x&&typeof x=="string"&&(C=m.filter(x,C)),this.length>1&&(on[u]||m.uniqueSort(C),Bt.test(u)&&C.reverse()),this.pushStack(C)}});var Kt=/[^\x20\t\r\n\f]+/g;function xn(u){var h={};return m.each(u.match(Kt)||[],function(b,x){h[x]=!0}),h}m.Callbacks=function(u){u=typeof u=="string"?xn(u):m.extend({},u);var h,b,x,C,I=[],N=[],q=-1,K=function(){for(C=C||u.once,x=h=!0;N.length;q=-1)for(b=N.shift();++q-1;)I.splice(me,1),me<=q&&q--}),this},has:function(Ee){return Ee?m.inArray(Ee,I)>-1:I.length>0},empty:function(){return I&&(I=[]),this},disable:function(){return C=N=[],I=b="",this},disabled:function(){return!I},lock:function(){return C=N=[],!b&&!h&&(I=b=""),this},locked:function(){return!!C},fireWith:function(Ee,Se){return C||(Se=Se||[],Se=[Ee,Se.slice?Se.slice():Se],N.push(Se),h||K()),this},fire:function(){return le.fireWith(this,arguments),this},fired:function(){return!!x}};return le};function ln(u){return u}function z(u){throw u}function j(u,h,b,x){var C;try{u&&T(C=u.promise)?C.call(u).done(h).fail(b):u&&T(C=u.then)?C.call(u,h,b):h.apply(void 0,[u].slice(x))}catch(I){b.apply(void 0,[I])}}m.extend({Deferred:function(u){var h=[["notify","progress",m.Callbacks("memory"),m.Callbacks("memory"),2],["resolve","done",m.Callbacks("once memory"),m.Callbacks("once memory"),0,"resolved"],["reject","fail",m.Callbacks("once memory"),m.Callbacks("once memory"),1,"rejected"]],b="pending",x={state:function(){return b},always:function(){return C.done(arguments).fail(arguments),this},catch:function(I){return x.then(null,I)},pipe:function(){var I=arguments;return m.Deferred(function(N){m.each(h,function(q,K){var le=T(I[K[4]])&&I[K[4]];C[K[1]](function(){var Ee=le&&le.apply(this,arguments);Ee&&T(Ee.promise)?Ee.promise().progress(N.notify).done(N.resolve).fail(N.reject):N[K[0]+"With"](this,le?[Ee]:arguments)})}),I=null}).promise()},then:function(I,N,q){var K=0;function le(Ee,Se,me,Fe){return function(){var ze=this,Tt=arguments,wt=function(){var Ln,vs;if(!(Ee=K&&(me!==z&&(ze=void 0,Tt=[Ln]),Se.rejectWith(ze,Tt))}};Ee?qn():(m.Deferred.getErrorHook?qn.error=m.Deferred.getErrorHook():m.Deferred.getStackHook&&(qn.error=m.Deferred.getStackHook()),t.setTimeout(qn))}}return m.Deferred(function(Ee){h[0][3].add(le(0,Ee,T(q)?q:ln,Ee.notifyWith)),h[1][3].add(le(0,Ee,T(I)?I:ln)),h[2][3].add(le(0,Ee,T(N)?N:z))}).promise()},promise:function(I){return I!=null?m.extend(I,x):x}},C={};return m.each(h,function(I,N){var q=N[2],K=N[5];x[N[1]]=q.add,K&&q.add(function(){b=K},h[3-I][2].disable,h[3-I][3].disable,h[0][2].lock,h[0][3].lock),q.add(N[3].fire),C[N[0]]=function(){return C[N[0]+"With"](this===C?void 0:this,arguments),this},C[N[0]+"With"]=q.fireWith}),x.promise(C),u&&u.call(C,C),C},when:function(u){var h=arguments.length,b=h,x=Array(b),C=a.call(arguments),I=m.Deferred(),N=function(q){return function(K){x[q]=this,C[q]=arguments.length>1?a.call(arguments):K,--h||I.resolveWith(x,C)}};if(h<=1&&(j(u,I.done(N(b)).resolve,I.reject,!h),I.state()==="pending"||T(C[b]&&C[b].then)))return I.then();for(;b--;)j(C[b],N(b),I.reject);return I.promise()}});var de=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;m.Deferred.exceptionHook=function(u,h){t.console&&t.console.warn&&u&&de.test(u.name)&&t.console.warn("jQuery.Deferred exception: "+u.message,u.stack,h)},m.readyException=function(u){t.setTimeout(function(){throw u})};var Ie=m.Deferred();m.fn.ready=function(u){return Ie.then(u).catch(function(h){m.readyException(h)}),this},m.extend({isReady:!1,readyWait:1,ready:function(u){(u===!0?--m.readyWait:m.isReady)||(m.isReady=!0,!(u!==!0&&--m.readyWait>0)&&Ie.resolveWith(R,[m]))}}),m.ready.then=Ie.then;function pe(){R.removeEventListener("DOMContentLoaded",pe),t.removeEventListener("load",pe),m.ready()}R.readyState==="complete"||R.readyState!=="loading"&&!R.documentElement.doScroll?t.setTimeout(m.ready):(R.addEventListener("DOMContentLoaded",pe),t.addEventListener("load",pe));var De=function(u,h,b,x,C,I,N){var q=0,K=u.length,le=b==null;if(k(b)==="object"){C=!0;for(q in b)De(u,h,q,b[q],!0,I,N)}else if(x!==void 0&&(C=!0,T(x)||(N=!0),le&&(N?(h.call(u,x),h=null):(le=h,h=function(Ee,Se,me){return le.call(m(Ee),me)})),h))for(;q1,null,!0)},removeData:function(u){return this.each(function(){ie.remove(this,u)})}}),m.extend({queue:function(u,h,b){var x;if(u)return h=(h||"fx")+"queue",x=fe.get(u,h),b&&(!x||Array.isArray(b)?x=fe.access(u,h,m.makeArray(b)):x.push(b)),x||[]},dequeue:function(u,h){h=h||"fx";var b=m.queue(u,h),x=b.length,C=b.shift(),I=m._queueHooks(u,h),N=function(){m.dequeue(u,h)};C==="inprogress"&&(C=b.shift(),x--),C&&(h==="fx"&&b.unshift("inprogress"),delete I.stop,C.call(u,N,I)),!x&&I&&I.empty.fire()},_queueHooks:function(u,h){var b=h+"queueHooks";return fe.get(u,b)||fe.access(u,b,{empty:m.Callbacks("once memory").add(function(){fe.remove(u,[h+"queue",b])})})}}),m.fn.extend({queue:function(u,h){var b=2;return typeof u!="string"&&(h=u,u="fx",b--),arguments.length\x20\t\r\n\f]*)/i,Xo=/^$|^module$|\/(?:java|ecma)script/i;(function(){var u=R.createDocumentFragment(),h=u.appendChild(R.createElement("div")),b=R.createElement("input");b.setAttribute("type","radio"),b.setAttribute("checked","checked"),b.setAttribute("name","t"),h.appendChild(b),w.checkClone=h.cloneNode(!0).cloneNode(!0).lastChild.checked,h.innerHTML="",w.noCloneChecked=!!h.cloneNode(!0).lastChild.defaultValue,h.innerHTML="",w.option=!!h.lastChild})();var br={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};br.tbody=br.tfoot=br.colgroup=br.caption=br.thead,br.th=br.td,w.option||(br.optgroup=br.option=[1,""]);function jn(u,h){var b;return typeof u.getElementsByTagName<"u"?b=u.getElementsByTagName(h||"*"):typeof u.querySelectorAll<"u"?b=u.querySelectorAll(h||"*"):b=[],h===void 0||h&&L(u,h)?m.merge([u],b):b}function Na(u,h){for(var b=0,x=u.length;b-1){C&&C.push(I);continue}if(le=ot(I),N=jn(Se.appendChild(I),"script"),le&&Na(N),b)for(Ee=0;I=N[Ee++];)Xo.test(I.type||"")&&b.push(I)}return Se}var Eu=/^([^.]*)(?:\.(.+)|)/;function to(){return!0}function qo(){return!1}function Ui(u,h,b,x,C,I){var N,q;if(typeof h=="object"){typeof b!="string"&&(x=x||b,b=void 0);for(q in h)Ui(u,q,b,x,h[q],I);return u}if(x==null&&C==null?(C=b,x=b=void 0):C==null&&(typeof b=="string"?(C=x,x=void 0):(C=x,x=b,b=void 0)),C===!1)C=qo;else if(!C)return u;return I===1&&(N=C,C=function(K){return m().off(K),N.apply(this,arguments)},C.guid=N.guid||(N.guid=m.guid++)),u.each(function(){m.event.add(this,h,C,x,b)})}m.event={global:{},add:function(u,h,b,x,C){var I,N,q,K,le,Ee,Se,me,Fe,ze,Tt,wt=fe.get(u);if(we(u))for(b.handler&&(I=b,b=I.handler,C=I.selector),C&&m.find.matchesSelector(Je,C),b.guid||(b.guid=m.guid++),(K=wt.events)||(K=wt.events=Object.create(null)),(N=wt.handle)||(N=wt.handle=function(qn){return typeof m<"u"&&m.event.triggered!==qn.type?m.event.dispatch.apply(u,arguments):void 0}),h=(h||"").match(Kt)||[""],le=h.length;le--;)q=Eu.exec(h[le])||[],Fe=Tt=q[1],ze=(q[2]||"").split(".").sort(),Fe&&(Se=m.event.special[Fe]||{},Fe=(C?Se.delegateType:Se.bindType)||Fe,Se=m.event.special[Fe]||{},Ee=m.extend({type:Fe,origType:Tt,data:x,handler:b,guid:b.guid,selector:C,needsContext:C&&m.expr.match.needsContext.test(C),namespace:ze.join(".")},I),(me=K[Fe])||(me=K[Fe]=[],me.delegateCount=0,(!Se.setup||Se.setup.call(u,x,ze,N)===!1)&&u.addEventListener&&u.addEventListener(Fe,N)),Se.add&&(Se.add.call(u,Ee),Ee.handler.guid||(Ee.handler.guid=b.guid)),C?me.splice(me.delegateCount++,0,Ee):me.push(Ee),m.event.global[Fe]=!0)},remove:function(u,h,b,x,C){var I,N,q,K,le,Ee,Se,me,Fe,ze,Tt,wt=fe.hasData(u)&&fe.get(u);if(!(!wt||!(K=wt.events))){for(h=(h||"").match(Kt)||[""],le=h.length;le--;){if(q=Eu.exec(h[le])||[],Fe=Tt=q[1],ze=(q[2]||"").split(".").sort(),!Fe){for(Fe in K)m.event.remove(u,Fe+h[le],b,x,!0);continue}for(Se=m.event.special[Fe]||{},Fe=(x?Se.delegateType:Se.bindType)||Fe,me=K[Fe]||[],q=q[2]&&new RegExp("(^|\\.)"+ze.join("\\.(?:.*\\.|)")+"(\\.|$)"),N=I=me.length;I--;)Ee=me[I],(C||Tt===Ee.origType)&&(!b||b.guid===Ee.guid)&&(!q||q.test(Ee.namespace))&&(!x||x===Ee.selector||x==="**"&&Ee.selector)&&(me.splice(I,1),Ee.selector&&me.delegateCount--,Se.remove&&Se.remove.call(u,Ee));N&&!me.length&&((!Se.teardown||Se.teardown.call(u,ze,wt.handle)===!1)&&m.removeEvent(u,Fe,wt.handle),delete K[Fe])}m.isEmptyObject(K)&&fe.remove(u,"handle events")}},dispatch:function(u){var h,b,x,C,I,N,q=new Array(arguments.length),K=m.event.fix(u),le=(fe.get(this,"events")||Object.create(null))[K.type]||[],Ee=m.event.special[K.type]||{};for(q[0]=K,h=1;h=1)){for(;le!==this;le=le.parentNode||this)if(le.nodeType===1&&!(u.type==="click"&&le.disabled===!0)){for(I=[],N={},b=0;b-1:m.find(C,this,null,[le]).length),N[C]&&I.push(x);I.length&&q.push({elem:le,handlers:I})}}return le=this,K\s*$/g;function Su(u,h){return L(u,"table")&&L(h.nodeType!==11?h:h.firstChild,"tr")&&m(u).children("tbody")[0]||u}function Rp(u){return u.type=(u.getAttribute("type")!==null)+"/"+u.type,u}function Dp(u){return(u.type||"").slice(0,5)==="true/"?u.type=u.type.slice(5):u.removeAttribute("type"),u}function Tu(u,h){var b,x,C,I,N,q,K;if(h.nodeType===1){if(fe.hasData(u)&&(I=fe.get(u),K=I.events,K)){fe.remove(h,"handle events");for(C in K)for(b=0,x=K[C].length;b1&&typeof Fe=="string"&&!w.checkClone&&Np.test(Fe))return u.each(function(Tt){var wt=u.eq(Tt);ze&&(h[0]=Fe.call(this,Tt,wt.html())),Jo(wt,h,b,x)});if(Se&&(C=wu(h,u[0].ownerDocument,!1,u,x),I=C.firstChild,C.childNodes.length===1&&(C=I),I||x)){for(N=m.map(jn(C,"script"),Rp),q=N.length;Ee0&&Na(N,!K&&jn(u,"script")),q},cleanData:function(u){for(var h,b,x,C=m.event.special,I=0;(b=u[I])!==void 0;I++)if(we(b)){if(h=b[fe.expando]){if(h.events)for(x in h.events)C[x]?m.event.remove(b,x):m.removeEvent(b,x,h.handle);b[fe.expando]=void 0}b[ie.expando]&&(b[ie.expando]=void 0)}}}),m.fn.extend({detach:function(u){return Iu(this,u,!0)},remove:function(u){return Iu(this,u)},text:function(u){return De(this,function(h){return h===void 0?m.text(this):this.empty().each(function(){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&(this.textContent=h)})},null,u,arguments.length)},append:function(){return Jo(this,arguments,function(u){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var h=Su(this,u);h.appendChild(u)}})},prepend:function(){return Jo(this,arguments,function(u){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var h=Su(this,u);h.insertBefore(u,h.firstChild)}})},before:function(){return Jo(this,arguments,function(u){this.parentNode&&this.parentNode.insertBefore(u,this)})},after:function(){return Jo(this,arguments,function(u){this.parentNode&&this.parentNode.insertBefore(u,this.nextSibling)})},empty:function(){for(var u,h=0;(u=this[h])!=null;h++)u.nodeType===1&&(m.cleanData(jn(u,!1)),u.textContent="");return this},clone:function(u,h){return u=u??!1,h=h??u,this.map(function(){return m.clone(this,u,h)})},html:function(u){return De(this,function(h){var b=this[0]||{},x=0,C=this.length;if(h===void 0&&b.nodeType===1)return b.innerHTML;if(typeof h=="string"&&!Pp.test(h)&&!br[(Xn.exec(h)||["",""])[1].toLowerCase()]){h=m.htmlPrefilter(h);try{for(;x=0&&(K+=Math.max(0,Math.ceil(u["offset"+h[0].toUpperCase()+h.slice(1)]-I-K-q-.5))||0),K+le}function Rl(u,h,b){var x=Ra(u),C=!w.boxSizingReliable()||b,I=C&&m.css(u,"boxSizing",!1,x)==="border-box",N=I,q=Hi(u,h,x),K="offset"+h[0].toUpperCase()+h.slice(1);if(Pl.test(q)){if(!b)return q;q="auto"}return(!w.boxSizingReliable()&&I||!w.reliableTrDimensions()&&L(u,"tr")||q==="auto"||!parseFloat(q)&&m.css(u,"display",!1,x)==="inline")&&u.getClientRects().length&&(I=m.css(u,"boxSizing",!1,x)==="border-box",N=K in u,N&&(q=u[K])),q=parseFloat(q)||0,q+Ll(u,h,b||(I?"border":"content"),N,x,q)+"px"}m.extend({cssHooks:{opacity:{get:function(u,h){if(h){var b=Hi(u,"opacity");return b===""?"1":b}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(u,h,b,x){if(!(!u||u.nodeType===3||u.nodeType===8||!u.style)){var C,I,N,q=Z(h),K=Nl.test(h),le=u.style;if(K||(h=Ma(q)),N=m.cssHooks[h]||m.cssHooks[q],b!==void 0){if(I=typeof b,I==="string"&&(C=ke.exec(b))&&C[1]&&(b=it(u,h,C),I="number"),b==null||b!==b)return;I==="number"&&!K&&(b+=C&&C[3]||(m.cssNumber[q]?"":"px")),!w.clearCloneStyle&&b===""&&h.indexOf("background")===0&&(le[h]="inherit"),(!N||!("set"in N)||(b=N.set(u,b,x))!==void 0)&&(K?le.setProperty(h,b):le[h]=b)}else return N&&"get"in N&&(C=N.get(u,!1,x))!==void 0?C:le[h]}},css:function(u,h,b,x){var C,I,N,q=Z(h),K=Nl.test(h);return K||(h=Ma(q)),N=m.cssHooks[h]||m.cssHooks[q],N&&"get"in N&&(C=N.get(u,!0,b)),C===void 0&&(C=Hi(u,h,x)),C==="normal"&&h in Ru&&(C=Ru[h]),b===""||b?(I=parseFloat(C),b===!0||isFinite(I)?I||0:C):C}}),m.each(["height","width"],function(u,h){m.cssHooks[h]={get:function(b,x,C){if(x)return Lu.test(m.css(b,"display"))&&(!b.getClientRects().length||!b.getBoundingClientRect().width)?Ou(b,Mp,function(){return Rl(b,h,C)}):Rl(b,h,C)},set:function(b,x,C){var I,N=Ra(b),q=!w.scrollboxSize()&&N.position==="absolute",K=q||C,le=K&&m.css(b,"boxSizing",!1,N)==="border-box",Ee=C?Ll(b,h,C,le,N):0;return le&&q&&(Ee-=Math.ceil(b["offset"+h[0].toUpperCase()+h.slice(1)]-parseFloat(N[h])-Ll(b,h,"border",!1,N)-.5)),Ee&&(I=ke.exec(x))&&(I[3]||"px")!=="px"&&(b.style[h]=x,x=m.css(b,h)),Du(b,x,Ee)}}}),m.cssHooks.marginLeft=ji(w.reliableMarginLeft,function(u,h){if(h)return(parseFloat(Hi(u,"marginLeft"))||u.getBoundingClientRect().left-Ou(u,{marginLeft:0},function(){return u.getBoundingClientRect().left}))+"px"}),m.each({margin:"",padding:"",border:"Width"},function(u,h){m.cssHooks[u+h]={expand:function(b){for(var x=0,C={},I=typeof b=="string"?b.split(" "):[b];x<4;x++)C[u+He[x]+h]=I[x]||I[x-2]||I[0];return C}},u!=="margin"&&(m.cssHooks[u+h].set=Du)}),m.fn.extend({css:function(u,h){return De(this,function(b,x,C){var I,N,q={},K=0;if(Array.isArray(x)){for(I=Ra(b),N=x.length;K1)}});function dr(u,h,b,x,C){return new dr.prototype.init(u,h,b,x,C)}m.Tween=dr,dr.prototype={constructor:dr,init:function(u,h,b,x,C,I){this.elem=u,this.prop=b,this.easing=C||m.easing._default,this.options=h,this.start=this.now=this.cur(),this.end=x,this.unit=I||(m.cssNumber[b]?"":"px")},cur:function(){var u=dr.propHooks[this.prop];return u&&u.get?u.get(this):dr.propHooks._default.get(this)},run:function(u){var h,b=dr.propHooks[this.prop];return this.options.duration?this.pos=h=m.easing[this.easing](u,this.options.duration*u,0,1,this.options.duration):this.pos=h=u,this.now=(this.end-this.start)*h+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),b&&b.set?b.set(this):dr.propHooks._default.set(this),this}},dr.prototype.init.prototype=dr.prototype,dr.propHooks={_default:{get:function(u){var h;return u.elem.nodeType!==1||u.elem[u.prop]!=null&&u.elem.style[u.prop]==null?u.elem[u.prop]:(h=m.css(u.elem,u.prop,""),!h||h==="auto"?0:h)},set:function(u){m.fx.step[u.prop]?m.fx.step[u.prop](u):u.elem.nodeType===1&&(m.cssHooks[u.prop]||u.elem.style[Ma(u.prop)]!=null)?m.style(u.elem,u.prop,u.now+u.unit):u.elem[u.prop]=u.now}}},dr.propHooks.scrollTop=dr.propHooks.scrollLeft={set:function(u){u.elem.nodeType&&u.elem.parentNode&&(u.elem[u.prop]=u.now)}},m.easing={linear:function(u){return u},swing:function(u){return .5-Math.cos(u*Math.PI)/2},_default:"swing"},m.fx=dr.prototype.init,m.fx.step={};var xo,Zo,$p=/^(?:toggle|show|hide)$/,Mu=/queueHooks$/;function Qo(){Zo&&(R.hidden===!1&&t.requestAnimationFrame?t.requestAnimationFrame(Qo):t.setTimeout(Qo,m.fx.interval),m.fx.tick())}function Dl(){return t.setTimeout(function(){xo=void 0}),xo=Date.now()}function $a(u,h){var b,x=0,C={height:u};for(h=h?1:0;x<4;x+=2-h)b=He[x],C["margin"+b]=C["padding"+b]=u;return h&&(C.opacity=C.width=u),C}function Ml(u,h,b){for(var x,C=(rs.tweeners[h]||[]).concat(rs.tweeners["*"]),I=0,N=C.length;I1)},removeAttr:function(u){return this.each(function(){m.removeAttr(this,u)})}}),m.extend({attr:function(u,h,b){var x,C,I=u.nodeType;if(!(I===3||I===8||I===2)){if(typeof u.getAttribute>"u")return m.prop(u,h,b);if((I!==1||!m.isXMLDoc(u))&&(C=m.attrHooks[h.toLowerCase()]||(m.expr.match.bool.test(h)?Fl:void 0)),b!==void 0){if(b===null){m.removeAttr(u,h);return}return C&&"set"in C&&(x=C.set(u,b,h))!==void 0?x:(u.setAttribute(h,b+""),b)}return C&&"get"in C&&(x=C.get(u,h))!==null?x:(x=m.find.attr(u,h),x??void 0)}},attrHooks:{type:{set:function(u,h){if(!w.radioValue&&h==="radio"&&L(u,"input")){var b=u.value;return u.setAttribute("type",h),b&&(u.value=b),h}}}},removeAttr:function(u,h){var b,x=0,C=h&&h.match(Kt);if(C&&u.nodeType===1)for(;b=C[x++];)u.removeAttribute(b)}}),Fl={set:function(u,h,b){return h===!1?m.removeAttr(u,b):u.setAttribute(b,b),b}},m.each(m.expr.match.bool.source.match(/\w+/g),function(u,h){var b=wo[h]||m.find.attr;wo[h]=function(x,C,I){var N,q,K=C.toLowerCase();return I||(q=wo[K],wo[K]=N,N=b(x,C,I)!=null?K:null,wo[K]=q),N}});var Bl=/^(?:input|select|textarea|button)$/i,ei=/^(?:a|area)$/i;m.fn.extend({prop:function(u,h){return De(this,m.prop,u,h,arguments.length>1)},removeProp:function(u){return this.each(function(){delete this[m.propFix[u]||u]})}}),m.extend({prop:function(u,h,b){var x,C,I=u.nodeType;if(!(I===3||I===8||I===2))return(I!==1||!m.isXMLDoc(u))&&(h=m.propFix[h]||h,C=m.propHooks[h]),b!==void 0?C&&"set"in C&&(x=C.set(u,b,h))!==void 0?x:u[h]=b:C&&"get"in C&&(x=C.get(u,h))!==null?x:u[h]},propHooks:{tabIndex:{get:function(u){var h=m.find.attr(u,"tabindex");return h?parseInt(h,10):Bl.test(u.nodeName)||ei.test(u.nodeName)&&u.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),w.optSelected||(m.propHooks.selected={get:function(u){var h=u.parentNode;return h&&h.parentNode&&h.parentNode.selectedIndex,null},set:function(u){var h=u.parentNode;h&&(h.selectedIndex,h.parentNode&&h.parentNode.selectedIndex)}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this});function no(u){var h=u.match(Kt)||[];return h.join(" ")}function ro(u){return u.getAttribute&&u.getAttribute("class")||""}function Ul(u){return Array.isArray(u)?u:typeof u=="string"?u.match(Kt)||[]:[]}m.fn.extend({addClass:function(u){var h,b,x,C,I,N;return T(u)?this.each(function(q){m(this).addClass(u.call(this,q,ro(this)))}):(h=Ul(u),h.length?this.each(function(){if(x=ro(this),b=this.nodeType===1&&" "+no(x)+" ",b){for(I=0;I-1;)b=b.replace(" "+C+" "," ");N=no(b),x!==N&&this.setAttribute("class",N)}}):this):this.attr("class","")},toggleClass:function(u,h){var b,x,C,I,N=typeof u,q=N==="string"||Array.isArray(u);return T(u)?this.each(function(K){m(this).toggleClass(u.call(this,K,ro(this),h),h)}):typeof h=="boolean"&&q?h?this.addClass(u):this.removeClass(u):(b=Ul(u),this.each(function(){if(q)for(I=m(this),C=0;C-1)return!0;return!1}});var Fu=/\r/g;m.fn.extend({val:function(u){var h,b,x,C=this[0];return arguments.length?(x=T(u),this.each(function(I){var N;this.nodeType===1&&(x?N=u.call(this,I,m(this).val()):N=u,N==null?N="":typeof N=="number"?N+="":Array.isArray(N)&&(N=m.map(N,function(q){return q==null?"":q+""})),h=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],(!h||!("set"in h)||h.set(this,N,"value")===void 0)&&(this.value=N))})):C?(h=m.valHooks[C.type]||m.valHooks[C.nodeName.toLowerCase()],h&&"get"in h&&(b=h.get(C,"value"))!==void 0?b:(b=C.value,typeof b=="string"?b.replace(Fu,""):b??"")):void 0}}),m.extend({valHooks:{option:{get:function(u){var h=m.find.attr(u,"value");return h??no(m.text(u))}},select:{get:function(u){var h,b,x,C=u.options,I=u.selectedIndex,N=u.type==="select-one",q=N?null:[],K=N?I+1:C.length;for(I<0?x=K:x=N?I:0;x-1)&&(b=!0);return b||(u.selectedIndex=-1),I}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(u,h){if(Array.isArray(h))return u.checked=m.inArray(m(u).val(),h)>-1}},w.checkOn||(m.valHooks[this].get=function(u){return u.getAttribute("value")===null?"on":u.value})});var ti=t.location,Hl={guid:Date.now()},Fa=/\?/;m.parseXML=function(u){var h,b;if(!u||typeof u!="string")return null;try{h=new t.DOMParser().parseFromString(u,"text/xml")}catch{}return b=h&&h.getElementsByTagName("parsererror")[0],(!h||b)&&m.error("Invalid XML: "+(b?m.map(b.childNodes,function(x){return x.textContent}).join(` `):u)),h};var Bu=/^(?:focusinfocus|focusoutblur)$/,Uu=function(u){u.stopPropagation()};m.extend(m.event,{trigger:function(u,h,b,x){var C,I,N,q,K,le,Ee,Se,me=[b||R],Fe=g.call(u,"type")?u.type:u,ze=g.call(u,"namespace")?u.namespace.split("."):[];if(I=Se=N=b=b||R,!(b.nodeType===3||b.nodeType===8)&&!Bu.test(Fe+m.event.triggered)&&(Fe.indexOf(".")>-1&&(ze=Fe.split("."),Fe=ze.shift(),ze.sort()),K=Fe.indexOf(":")<0&&"on"+Fe,u=u[m.expando]?u:new m.Event(Fe,typeof u=="object"&&u),u.isTrigger=x?2:3,u.namespace=ze.join("."),u.rnamespace=u.namespace?new RegExp("(^|\\.)"+ze.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,u.result=void 0,u.target||(u.target=b),h=h==null?[u]:m.makeArray(h,[u]),Ee=m.event.special[Fe]||{},!(!x&&Ee.trigger&&Ee.trigger.apply(b,h)===!1))){if(!x&&!Ee.noBubble&&!P(b)){for(q=Ee.delegateType||Fe,Bu.test(q+Fe)||(I=I.parentNode);I;I=I.parentNode)me.push(I),N=I;N===(b.ownerDocument||R)&&me.push(N.defaultView||N.parentWindow||t)}for(C=0;(I=me[C++])&&!u.isPropagationStopped();)Se=I,u.type=C>1?q:Ee.bindType||Fe,le=(fe.get(I,"events")||Object.create(null))[u.type]&&fe.get(I,"handle"),le&&le.apply(I,h),le=K&&I[K],le&&le.apply&&we(I)&&(u.result=le.apply(I,h),u.result===!1&&u.preventDefault());return u.type=Fe,!x&&!u.isDefaultPrevented()&&(!Ee._default||Ee._default.apply(me.pop(),h)===!1)&&we(b)&&K&&T(b[Fe])&&!P(b)&&(N=b[K],N&&(b[K]=null),m.event.triggered=Fe,u.isPropagationStopped()&&Se.addEventListener(Fe,Uu),b[Fe](),u.isPropagationStopped()&&Se.removeEventListener(Fe,Uu),m.event.triggered=void 0,N&&(b[K]=N)),u.result}},simulate:function(u,h,b){var x=m.extend(new m.Event,b,{type:u,isSimulated:!0});m.event.trigger(x,null,h)}}),m.fn.extend({trigger:function(u,h){return this.each(function(){m.event.trigger(u,h,this)})},triggerHandler:function(u,h){var b=this[0];if(b)return m.event.trigger(u,h,b,!0)}});var Fp=/\[\]$/,jl=/\r?\n/g,Bp=/^(?:submit|button|image|reset|file)$/i,Up=/^(?:input|select|textarea|keygen)/i;function Vl(u,h,b,x){var C;if(Array.isArray(h))m.each(h,function(I,N){b||Fp.test(u)?x(u,N):Vl(u+"["+(typeof N=="object"&&N!=null?I:"")+"]",N,b,x)});else if(!b&&k(h)==="object")for(C in h)Vl(u+"["+C+"]",h[C],b,x);else x(u,h)}m.param=function(u,h){var b,x=[],C=function(I,N){var q=T(N)?N():N;x[x.length]=encodeURIComponent(I)+"="+encodeURIComponent(q??"")};if(u==null)return"";if(Array.isArray(u)||u.jquery&&!m.isPlainObject(u))m.each(u,function(){C(this.name,this.value)});else for(b in u)Vl(b,u[b],h,C);return x.join("&")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var u=m.prop(this,"elements");return u?m.makeArray(u):this}).filter(function(){var u=this.type;return this.name&&!m(this).is(":disabled")&&Up.test(this.nodeName)&&!Bp.test(u)&&(this.checked||!It.test(u))}).map(function(u,h){var b=m(this).val();return b==null?null:Array.isArray(b)?m.map(b,function(x){return{name:h.name,value:x.replace(jl,`\r `)}}):{name:h.name,value:b.replace(jl,`\r -`)}}).get()}});var Hp=/%20/g,Wl=/#.*$/,jp=/([?&])_=[^&]*/,Vp=/^(.*?):[ \t]*([^\r\n]*)$/mg,Wp=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gp=/^(?:GET|HEAD)$/,Kp=/^\/\//,bn={},fn={},Hu="*/".concat("*"),Gl=R.createElement("a");Gl.href=ti.href;function ju(u){return function(h,b){typeof h!="string"&&(b=h,h="*");var x,C=0,I=h.toLowerCase().match(Kt)||[];if(T(b))for(;x=I[C++];)x[0]==="+"?(x=x.slice(1)||"*",(u[x]=u[x]||[]).unshift(b)):(u[x]=u[x]||[]).push(b)}}function Vu(u,h,b,x){var C={},I=u===fn;function N(q){var K;return C[q]=!0,m.each(u[q]||[],function(le,Ee){var Se=Ee(h,b,x);if(typeof Se=="string"&&!I&&!C[Se])return h.dataTypes.unshift(Se),N(Se),!1;if(I)return!(K=Se)}),K}return N(h.dataTypes[0])||!C["*"]&&N("*")}function Kl(u,h){var b,x,C=m.ajaxSettings.flatOptions||{};for(b in h)h[b]!==void 0&&((C[b]?u:x||(x={}))[b]=h[b]);return x&&m.extend(!0,u,x),u}function zp(u,h,b){for(var x,C,I,N,q=u.contents,K=u.dataTypes;K[0]==="*";)K.shift(),x===void 0&&(x=u.mimeType||h.getResponseHeader("Content-Type"));if(x){for(C in q)if(q[C]&&q[C].test(x)){K.unshift(C);break}}if(K[0]in b)I=K[0];else{for(C in b){if(!K[0]||u.converters[C+" "+K[0]]){I=C;break}N||(N=C)}I=I||N}if(I)return I!==K[0]&&K.unshift(I),b[I]}function Wu(u,h,b,x){var C,I,N,q,K,le={},Ee=u.dataTypes.slice();if(Ee[1])for(N in u.converters)le[N.toLowerCase()]=u.converters[N];for(I=Ee.shift();I;)if(u.responseFields[I]&&(b[u.responseFields[I]]=h),!K&&x&&u.dataFilter&&(h=u.dataFilter(h,u.dataType)),K=I,I=Ee.shift(),I){if(I==="*")I=K;else if(K!=="*"&&K!==I){if(N=le[K+" "+I]||le["* "+I],!N){for(C in le)if(q=C.split(" "),q[1]===I&&(N=le[K+" "+q[0]]||le["* "+q[0]],N)){N===!0?N=le[C]:le[C]!==!0&&(I=q[0],Ee.unshift(q[1]));break}}if(N!==!0)if(N&&u.throws)h=N(h);else try{h=N(h)}catch(Se){return{state:"parsererror",error:N?Se:"No conversion from "+K+" to "+I}}}}return{state:"success",data:h}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ti.href,type:"GET",isLocal:Wp.test(ti.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hu,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(u,h){return h?Kl(Kl(u,m.ajaxSettings),h):Kl(m.ajaxSettings,u)},ajaxPrefilter:ju(bn),ajaxTransport:ju(fn),ajax:function(u,h){typeof u=="object"&&(h=u,u=void 0),h=h||{};var b,x,C,I,N,q,K,le,Ee,Se,me=m.ajaxSetup({},h),Fe=me.context||me,ze=me.context&&(Fe.nodeType||Fe.jquery)?m(Fe):m.event,Tt=m.Deferred(),wt=m.Callbacks("once memory"),qn=me.statusCode||{},Ln={},vs={},_s="canceled",jt={readyState:0,getResponseHeader:function(Vt){var mn;if(K){if(!I)for(I={};mn=Vp.exec(C);)I[mn[1].toLowerCase()+" "]=(I[mn[1].toLowerCase()+" "]||[]).concat(mn[2]);mn=I[Vt.toLowerCase()+" "]}return mn==null?null:mn.join(", ")},getAllResponseHeaders:function(){return K?C:null},setRequestHeader:function(Vt,mn){return K==null&&(Vt=vs[Vt.toLowerCase()]=vs[Vt.toLowerCase()]||Vt,Ln[Vt]=mn),this},overrideMimeType:function(Vt){return K==null&&(me.mimeType=Vt),this},statusCode:function(Vt){var mn;if(Vt)if(K)jt.always(Vt[jt.status]);else for(mn in Vt)qn[mn]=[qn[mn],Vt[mn]];return this},abort:function(Vt){var mn=Vt||_s;return b&&b.abort(mn),so(0,mn),this}};if(Tt.promise(jt),me.url=((u||me.url||ti.href)+"").replace(Kp,ti.protocol+"//"),me.type=h.method||h.type||me.method||me.type,me.dataTypes=(me.dataType||"*").toLowerCase().match(Kt)||[""],me.crossDomain==null){q=R.createElement("a");try{q.href=me.url,q.href=q.href,me.crossDomain=Gl.protocol+"//"+Gl.host!=q.protocol+"//"+q.host}catch{me.crossDomain=!0}}if(me.data&&me.processData&&typeof me.data!="string"&&(me.data=m.param(me.data,me.traditional)),Vu(bn,me,h,jt),K)return jt;le=m.event&&me.global,le&&m.active++===0&&m.event.trigger("ajaxStart"),me.type=me.type.toUpperCase(),me.hasContent=!Gp.test(me.type),x=me.url.replace(Wl,""),me.hasContent?me.data&&me.processData&&(me.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(me.data=me.data.replace(Hp,"+")):(Se=me.url.slice(x.length),me.data&&(me.processData||typeof me.data=="string")&&(x+=(Fa.test(x)?"&":"?")+me.data,delete me.data),me.cache===!1&&(x=x.replace(jp,"$1"),Se=(Fa.test(x)?"&":"?")+"_="+Hl.guid+++Se),me.url=x+Se),me.ifModified&&(m.lastModified[x]&&jt.setRequestHeader("If-Modified-Since",m.lastModified[x]),m.etag[x]&&jt.setRequestHeader("If-None-Match",m.etag[x])),(me.data&&me.hasContent&&me.contentType!==!1||h.contentType)&&jt.setRequestHeader("Content-Type",me.contentType),jt.setRequestHeader("Accept",me.dataTypes[0]&&me.accepts[me.dataTypes[0]]?me.accepts[me.dataTypes[0]]+(me.dataTypes[0]!=="*"?", "+Hu+"; q=0.01":""):me.accepts["*"]);for(Ee in me.headers)jt.setRequestHeader(Ee,me.headers[Ee]);if(me.beforeSend&&(me.beforeSend.call(Fe,jt,me)===!1||K))return jt.abort();if(_s="abort",wt.add(me.complete),jt.done(me.success),jt.fail(me.error),b=Vu(fn,me,h,jt),!b)so(-1,"No Transport");else{if(jt.readyState=1,le&&ze.trigger("ajaxSend",[jt,me]),K)return jt;me.async&&me.timeout>0&&(N=t.setTimeout(function(){jt.abort("timeout")},me.timeout));try{K=!1,b.send(Ln,so)}catch(Vt){if(K)throw Vt;so(-1,Vt)}}function so(Vt,mn,Vi,Ua){var ss,Eo,Hr,Bs,oo,vr=mn;K||(K=!0,N&&t.clearTimeout(N),b=void 0,C=Ua||"",jt.readyState=Vt>0?4:0,ss=Vt>=200&&Vt<300||Vt===304,Vi&&(Bs=zp(me,jt,Vi)),!ss&&m.inArray("script",me.dataTypes)>-1&&m.inArray("json",me.dataTypes)<0&&(me.converters["text script"]=function(){}),Bs=Wu(me,Bs,jt,ss),ss?(me.ifModified&&(oo=jt.getResponseHeader("Last-Modified"),oo&&(m.lastModified[x]=oo),oo=jt.getResponseHeader("etag"),oo&&(m.etag[x]=oo)),Vt===204||me.type==="HEAD"?vr="nocontent":Vt===304?vr="notmodified":(vr=Bs.state,Eo=Bs.data,Hr=Bs.error,ss=!Hr)):(Hr=vr,(Vt||!vr)&&(vr="error",Vt<0&&(Vt=0))),jt.status=Vt,jt.statusText=(mn||vr)+"",ss?Tt.resolveWith(Fe,[Eo,vr,jt]):Tt.rejectWith(Fe,[jt,vr,Hr]),jt.statusCode(qn),qn=void 0,le&&ze.trigger(ss?"ajaxSuccess":"ajaxError",[jt,me,ss?Eo:Hr]),wt.fireWith(Fe,[jt,vr]),le&&(ze.trigger("ajaxComplete",[jt,me]),--m.active||m.event.trigger("ajaxStop")))}return jt},getJSON:function(u,h,b){return m.get(u,h,b,"json")},getScript:function(u,h){return m.get(u,void 0,h,"script")}}),m.each(["get","post"],function(u,h){m[h]=function(b,x,C,I){return T(x)&&(I=I||C,C=x,x=void 0),m.ajax(m.extend({url:b,type:h,dataType:I,data:x,success:C},m.isPlainObject(b)&&b))}}),m.ajaxPrefilter(function(u){var h;for(h in u.headers)h.toLowerCase()==="content-type"&&(u.contentType=u.headers[h]||"")}),m._evalUrl=function(u,h,b){return m.ajax({url:u,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(x){m.globalEval(x,h,b)}})},m.fn.extend({wrapAll:function(u){var h;return this[0]&&(T(u)&&(u=u.call(this[0])),h=m(u,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&h.insertBefore(this[0]),h.map(function(){for(var b=this;b.firstElementChild;)b=b.firstElementChild;return b}).append(this)),this},wrapInner:function(u){return T(u)?this.each(function(h){m(this).wrapInner(u.call(this,h))}):this.each(function(){var h=m(this),b=h.contents();b.length?b.wrapAll(u):h.append(u)})},wrap:function(u){var h=T(u);return this.each(function(b){m(this).wrapAll(h?u.call(this,b):u)})},unwrap:function(u){return this.parent(u).not("body").each(function(){m(this).replaceWith(this.childNodes)}),this}}),m.expr.pseudos.hidden=function(u){return!m.expr.pseudos.visible(u)},m.expr.pseudos.visible=function(u){return!!(u.offsetWidth||u.offsetHeight||u.getClientRects().length)},m.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch{}};var Yp={0:200,1223:204},Nn=m.ajaxSettings.xhr();w.cors=!!Nn&&"withCredentials"in Nn,w.ajax=Nn=!!Nn,m.ajaxTransport(function(u){var h,b;if(w.cors||Nn&&!u.crossDomain)return{send:function(x,C){var I,N=u.xhr();if(N.open(u.type,u.url,u.async,u.username,u.password),u.xhrFields)for(I in u.xhrFields)N[I]=u.xhrFields[I];u.mimeType&&N.overrideMimeType&&N.overrideMimeType(u.mimeType),!u.crossDomain&&!x["X-Requested-With"]&&(x["X-Requested-With"]="XMLHttpRequest");for(I in x)N.setRequestHeader(I,x[I]);h=function(q){return function(){h&&(h=b=N.onload=N.onerror=N.onabort=N.ontimeout=N.onreadystatechange=null,q==="abort"?N.abort():q==="error"?typeof N.status!="number"?C(0,"error"):C(N.status,N.statusText):C(Yp[N.status]||N.status,N.statusText,(N.responseType||"text")!=="text"||typeof N.responseText!="string"?{binary:N.response}:{text:N.responseText},N.getAllResponseHeaders()))}},N.onload=h(),b=N.onerror=N.ontimeout=h("error"),N.onabort!==void 0?N.onabort=b:N.onreadystatechange=function(){N.readyState===4&&t.setTimeout(function(){h&&b()})},h=h("abort");try{N.send(u.hasContent&&u.data||null)}catch(q){if(h)throw q}},abort:function(){h&&h()}}}),m.ajaxPrefilter(function(u){u.crossDomain&&(u.contents.script=!1)}),m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(u){return m.globalEval(u),u}}}),m.ajaxPrefilter("script",function(u){u.cache===void 0&&(u.cache=!1),u.crossDomain&&(u.type="GET")}),m.ajaxTransport("script",function(u){if(u.crossDomain||u.scriptAttrs){var h,b;return{send:function(x,C){h=m("