Changeset 3447136
- Timestamp:
- 01/26/2026 01:43:16 PM (2 months ago)
- Location:
- shipsmart
- Files:
-
- 59 deleted
- 19 edited
-
tags/1.0/resources/fonts/.gitkeep (deleted)
-
tags/1.0/resources/images/sprite/.gitkeep (deleted)
-
tags/1.0/resources/scripts/theme/vendor/.gitkeep (deleted)
-
tags/1.0/resources/styles/theme/vendor/.gitkeep (deleted)
-
tags/1.0/resources/vendor/.gitkeep (deleted)
-
tags/1.0/src/Repositories/.gitkeep (deleted)
-
tags/1.0/src/Widgets/.gitkeep (deleted)
-
tags/1.0/tests/Entities/.gitkeep (deleted)
-
tags/1.0/tests/Framework/Mock/.gitkeep (deleted)
-
tags/1.0/tests/Repositories/.gitkeep (deleted)
-
tags/1.0/views/.gitkeep (deleted)
-
tags/1.1.0/resources/fonts/.gitkeep (deleted)
-
tags/1.1.0/resources/images/sprite/.gitkeep (deleted)
-
tags/1.1.0/resources/scripts/theme/vendor/.gitkeep (deleted)
-
tags/1.1.0/resources/styles/theme/vendor/.gitkeep (deleted)
-
tags/1.1.0/resources/vendor/.gitkeep (deleted)
-
tags/1.1.0/src/Repositories/.gitkeep (deleted)
-
tags/1.1.0/src/Widgets/.gitkeep (deleted)
-
tags/1.1.0/tests/Entities/.gitkeep (deleted)
-
tags/1.1.0/tests/Framework/Mock/.gitkeep (deleted)
-
tags/1.1.0/tests/Repositories/.gitkeep (deleted)
-
tags/1.1.0/views/.gitkeep (deleted)
-
tags/1.1.0/views/Admin/.gitkeep (deleted)
-
tags/1.1.1/resources/fonts/.gitkeep (deleted)
-
tags/1.1.1/resources/images/sprite/.gitkeep (deleted)
-
tags/1.1.1/resources/scripts/theme/vendor/.gitkeep (deleted)
-
tags/1.1.1/resources/styles/theme/vendor/.gitkeep (deleted)
-
tags/1.1.1/resources/vendor/.gitkeep (deleted)
-
tags/1.1.1/src/Repositories/.gitkeep (deleted)
-
tags/1.1.1/src/Widgets/.gitkeep (deleted)
-
tags/1.1.1/tests/Entities/.gitkeep (deleted)
-
tags/1.1.1/tests/Framework/Mock/.gitkeep (deleted)
-
tags/1.1.1/tests/Repositories/.gitkeep (deleted)
-
tags/1.1.1/views/.gitkeep (deleted)
-
tags/1.1.1/views/Admin/.gitkeep (deleted)
-
tags/1.1.2/resources/fonts/.gitkeep (deleted)
-
tags/1.1.2/resources/images/sprite/.gitkeep (deleted)
-
tags/1.1.2/resources/scripts/theme/vendor/.gitkeep (deleted)
-
tags/1.1.2/resources/styles/theme/vendor/.gitkeep (deleted)
-
tags/1.1.2/resources/vendor/.gitkeep (deleted)
-
tags/1.1.2/src/Repositories/.gitkeep (deleted)
-
tags/1.1.2/src/Widgets/.gitkeep (deleted)
-
tags/1.1.2/tests/Entities/.gitkeep (deleted)
-
tags/1.1.2/tests/Framework/Mock/.gitkeep (deleted)
-
tags/1.1.2/tests/Repositories/.gitkeep (deleted)
-
tags/1.1.2/views/.gitkeep (deleted)
-
tags/1.1.2/views/Admin/.gitkeep (deleted)
-
trunk/README.md (modified) (1 diff)
-
trunk/dist/admin.js (modified) (1 diff)
-
trunk/dist/styles/admin.css (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/resources/fonts/.gitkeep (deleted)
-
trunk/resources/images/sprite/.gitkeep (deleted)
-
trunk/resources/scripts/admin/index.js (modified) (4 diffs)
-
trunk/resources/scripts/theme/vendor/.gitkeep (deleted)
-
trunk/resources/styles/admin/settings/index.scss (modified) (8 diffs)
-
trunk/resources/styles/theme/vendor/.gitkeep (deleted)
-
trunk/resources/vendor/.gitkeep (deleted)
-
trunk/shipsmart.php (modified) (5 diffs)
-
trunk/src/Providers/Config/SSFW_Api.php (modified) (1 diff)
-
trunk/src/Providers/Config/SSFW_Menu.php (modified) (3 diffs)
-
trunk/src/Providers/Config/SSFW_Product.php (modified) (3 diffs)
-
trunk/src/Repositories/.gitkeep (deleted)
-
trunk/src/Services/SSFW_ApiService.php (modified) (5 diffs)
-
trunk/src/Services/SSFW_Box.php (modified) (1 diff)
-
trunk/src/Widgets/.gitkeep (deleted)
-
trunk/tests/Entities/.gitkeep (deleted)
-
trunk/tests/Framework/Mock/.gitkeep (deleted)
-
trunk/tests/Repositories/.gitkeep (deleted)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (4 diffs)
-
trunk/vendor/composer/installed.json (modified) (2 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/views/.gitkeep (deleted)
-
trunk/views/Admin/.gitkeep (deleted)
-
trunk/views/Admin/Settings/template-parts/shipping.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shipsmart/trunk/README.md
r3296433 r3447136 1 1 2 # # SonarQube Analitycs2 # ShipSmart Plugin for WooCommerce 3 3 4 4 [](https://code-review.apiki.com/dashboard?id=Apiki_shipsmart-plugin_AYgGI79DnnQI-V6nS-fd) 5 5 6 [](https://code-review.apiki.com/dashboard?id=Apiki_shipsmart-plugin_AYgGI79DnnQI-V6nS-fd) 7 [](https://code-review.apiki.com/dashboard?id=Apiki_shipsmart-plugin_AYgGI79DnnQI-V6nS-fd) 6 Solução para logística crossborder. Cálculo de frete, impostos, gestão de pedidos e envios internacionais. 8 7 9 [](https://code-review.apiki.com/dashboard?id=Apiki_shipsmart-plugin_AYgGI79DnnQI-V6nS-fd) 10 [](https://code-review.apiki.com/dashboard?id=Apiki_shipsmart-plugin_AYgGI79DnnQI-V6nS-fd) 11 [](https://code-review.apiki.com/dashboard?id=Apiki_shipsmart-plugin_AYgGI79DnnQI-V6nS-fd) 12 [](https://code-review.apiki.com/dashboard?id=Apiki_shipsmart-plugin_AYgGI79DnnQI-V6nS-fd) 8 ## Pré-requisitos 13 9 10 Antes de instalar o plugin, certifique-se de que você possui: 14 11 15 **Requires at least:** 5.0 16 **Tested up to:** 6.8.1 17 **Stable tag:** 1.1.1 12 - **WordPress** >= 5.0 13 - **PHP** >= 7.4 14 - **WooCommerce** >= 5.3 (versão mais recente recomendada) 15 - **Node.js** >= 16.20.0 16 - **Composer** >= 2.0 17 - **NPM** ou **Yarn** 18 18 19 ## Description19 ## 🚀 Instalação e Configuração 20 20 21 Solução para logística crossborder. Cálculo de frete, impostos, gestão de pedidos e envios internacionais 21 ### 1. Clone do Repositório 22 22 23 ### Compatibility 23 ```bash 24 git clone https://github.com/Apiki/shipsmart-plugin.git 25 cd shipsmart-plugin 26 ``` 24 27 25 WooCommerce version 5.3.x 28 ### 2. Instalação das Dependências 26 29 27 ### Installation 30 #### 2.1. Dependências PHP (Composer) 31 ```bash 32 composer install 33 ``` 28 34 29 - Install and active the plugin 30 - `Menu` WooCommerce -> Ship Smart 31 - Add API Key 35 #### 2.2. Dependências Node.js 36 **Usando NPM:** 37 ```bash 38 npm install 39 ``` 32 40 33 ### Required 41 **Ou usando Yarn:** 42 ```bash 43 yarn install 44 ``` 34 45 35 - WordPress >= 5.0 36 - WooCommerce lastest version 37 - PHP >= 7.4 46 ### 3. Build dos Assets 38 47 39 ### Shipping methods 48 **Para desenvolvimento:** 49 ```bash 50 npm run dev 51 # ou 52 yarn dev 53 ``` 40 54 41 - Ship Smart 55 **Para produção:** 56 ```bash 57 npm run build 58 # ou 59 yarn build 60 ``` 61 62 ### 4. Configuração do Ambiente WordPress 63 64 #### 4.1. Banco de Dados 65 Se você ainda não possui um site WordPress configurado: 66 67 1. Crie um banco de dados 68 2. Configure um site WordPress com as seguintes características: 69 - **Tema**: Qualquer tema compatível com WooCommerce 70 - **Plugins obrigatórios**: WooCommerce 71 - **Configuração básica**: Moeda, país, zona de envio 72 73 #### 4.2. Instalação do Plugin 74 1. Copie a pasta do plugin para `wp-content/plugins/shipsmart-plugin` 75 2. Acesse o painel administrativo do WordPress 76 3. Vá em **Plugins** > **Plugins Instalados** 77 4. Ative o plugin **"Shipping with ShipSmart for WooCommerce"** 78 79 ### 5. Configuração de Produtos 80 81 Para testar o plugin adequadamente, você precisa criar produtos com as seguintes informações obrigatórias: 82 83 #### 5.1. Criação de Produtos de Teste 84 1. Acesse **Produtos** > **Adicionar Novo** 85 2. Configure os seguintes campos obrigatórios: 86 87 **Dados do Produto:** 88 - Nome do produto 89 - Preço 90 - **Peso** (obrigatório para cálculo de frete) 91 - Dimensões (Largura, Altura, Comprimento) 92 93 **Campos Específicos do ShipSmart:** 94 - **Código HS** (Harmonized System Code) 95 - **Custo Base** (para cálculo de impostos) 96 97 #### 5.2. Exemplo de Produto 98 ``` 99 Nome: Camiseta Teste 100 Preço: R$ 50,00 101 Peso: 0.2 kg 102 Dimensões: 30cm x 20cm x 2cm 103 Código HS: 61091000 104 Custo Base: R$ 25,00 105 ``` 106 107 ### 6. Configuração do Plugin 108 109 #### 6.1. Acesso às Configurações 110 1. No painel do WordPress, acesse **WooCommerce** > **ShipSmart** 111 2. Ou acesse diretamente o menu **ShipSmart** no painel lateral 112 113 #### 6.2. Configurações Principais 114 115 **API Configuration:** 116 - **API Key**: Insira sua chave da API do ShipSmart 117 - **Environment**: Selecione entre Sandbox (testes) ou Production 118 119 **Shipping Settings:** 120 - Configure as zonas de envio internacional 121 - Defina os contratos de frete disponíveis 122 - Configure os métodos de envio do ShipSmart 123 124 **Product Settings:** 125 - Ative os campos customizados (Código HS, Custo Base) 126 - Configure valores padrão se necessário 127 128 #### 6.3. Configuração de Métodos de Envio 129 1. Acesse **WooCommerce** > **Configurações** > **Envio** 130 2. Selecione a zona de envio desejada (ou crie uma nova para envios internacionais) 131 3. Adicione o método **"ShipSmart"** 132 4. Configure: 133 - Título do método 134 - Contrato associado 135 - Configurações específicas 136 137 ### 7. Testes 138 139 #### 7.1. Teste Básico de Funcionamento 140 1. Acesse a loja (frontend) 141 2. Adicione um produto com peso configurado ao carrinho 142 3. Vá para o checkout 143 4. Preencha um endereço internacional 144 5. Verifique se o frete do ShipSmart está sendo calculado 145 146 #### 7.2. Teste de API 147 1. No painel do ShipSmart, acesse **Configurações** 148 2. Clique em **"Testar Conexão com API"** 149 3. Verifique se a conexão está funcionando 150 151 #### 7.3. Teste de Pedido Completo 152 1. Finalize um pedido de teste 153 2. Acesse **Pedidos** no painel 154 3. Verifique se as informações do ShipSmart estão presentes 155 4. Teste a sincronização com a plataforma ShipSmart 156 157 ## Desenvolvimento 158 159 ### Scripts Disponíveis 160 161 ```bash 162 # Desenvolvimento com watch 163 npm run dev 164 165 # Build para produção 166 npm run build 167 168 ### Problemas Comuns 169 170 1. **Plugin não aparece no admin** 171 - Verifique se executou `composer install` 172 - Confirme que as dependências estão instaladas 173 174 2. **Assets não carregam** 175 - Execute `npm run build` ou `yarn build` 176 - Verifique se a pasta `dist/` foi criada 177 178 3. **Erro de API** 179 - Verifique a chave da API 180 - Confirme se está usando o ambiente correto 181 182 4. **Frete não calcula** 183 - Confirme que os produtos têm peso configurado 184 - Verifique se os códigos HS estão preenchidos 185 - Confirme que as zonas de envio estão configuradas 186 187 5. **Frete não aparece pra ser selecionado** 188 - Confime se ativou os fretes nas configurações 189 - Confirme se o endereço e de um pais diferente da loja 190 - Confime se é chace api esta correta, para isso acesse o site de stage e valide se aparece no checkou o frete 191 ``` 192 193 ### 8. Motivo da criação da branch stage 194 Por questões de organização, foi definido que seria melhor manter uma branch dedicada apenas ao plugin atualizado. Assim, a stage deve conter todas as últimas atualizações do plugin, diferentemente das demais branchs que incluem também a instalação completa do WordPress. Dessa forma, ela será a versão mais próxima possível do que é disponibilizado no WordPress.org para o plugin ShipSmart. -
shipsmart/trunk/dist/admin.js
r3294989 r3447136 1 !function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=243)}({243:function(t,e,r){"use strict";r.r(e);r(246);var n=r(82),i=r(27);function s(){!function(){var t=document.querySelector("#ssfw_shipping"),e=document.querySelector("#is_federal_tax_id");if(!t||!e)return;var r=document.getElementById("federal_tax_id"),n=(document.querySelector("#name"),document.querySelector("#phone")),s=(document.querySelector("#email"),document.querySelector("#percentual_discount")),a=document.querySelector("#insurance"),o=document.querySelector("#discount_taxable");document.querySelector("#plus_date_final");r.setAttribute("maxlength",18),r.setAttribute("placeholder","00.000.000/0000-00"),r.onkeypress=function(t){return/[0123456789,.]/.test(String.fromCharCode(t.which))};Object(i.a)(r,{mask:"00.000.000/0000-00"}),Object(i.a)(n,{mask:"+00 (00) 00000-0000"});s.setAttribute("min",0),s.setAttribute("max",100),a.setAttribute("min",0),a.setAttribute("max",100),o.setAttribute("min",0),o.setAttribute("max",100)}()}function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(){o=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,r){return t[e]=r}}function c(t,e,r,i){var s=e&&e.prototype instanceof f?e:f,a=Object.create(s.prototype),o=new F(i||[]);return n(a,"_invoke",{value:A(t,r,o)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var p={};function f(){}function g(){}function m(){}var v={};h(v,s,(function(){return this}));var _=Object.getPrototypeOf,y=_&&_(_(C([])));y&&y!==e&&r.call(y,s)&&(v=y);var k=m.prototype=f.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){var i;n(this,"_invoke",{value:function(n,s){function o(){return new e((function(i,o){!function n(i,s,o,u){var l=d(t[i],t,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==a(c)&&r.call(c,"__await")?e.resolve(c.__await).then((function(t){n("next",t,o,u)}),(function(t){n("throw",t,o,u)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return n("throw",t,o,u)}))}u(l.arg)}(n,s,i,o)}))}return i=i?i.then(o,o):o()}})}function A(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return B()}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=E(a,r);if(o){if(o===p)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=d(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function C(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:B}}function B(){return{value:void 0,done:!0}}return g.prototype=m,n(k,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:g,configurable:!0}),g.displayName=h(m,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,h(t,l,"GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},b(S.prototype),h(S.prototype,u,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(c(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(k),h(k,l,"Generator"),h(k,s,(function(){return this})),h(k,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=C,F.prototype={constructor:F,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(o&&u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:C(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function u(t,e,r,n,i,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}var l,h,c=function(t,e){wp.apiRequest({path:"/shipsmart/v1/updateOrders",method:"PUT",data:{order_id:t}}).then((function(t){return e(t)}))},d=function(t,e){wp.apiRequest({path:"/shipsmart/v1/saveBoxes",method:"POST",data:{measures:e}}).then((function(e){return t(e)}))},p=(l=o().mark((function t(e,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:wp.apiRequest({path:"/shipsmart/v1/order/items?order_id=".concat(r),method:"GET"}).then((function(t){return e(t)}));case 1:case"end":return t.stop()}}),t)})),h=function(){var t=this,e=arguments;return new Promise((function(r,n){var i=l.apply(t,e);function s(t){u(i,r,n,s,a,"next",t)}function a(t){u(i,r,n,s,a,"throw",t)}s(void 0)}))},function(t,e){return h.apply(this,arguments)});function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function g(){g=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new F(i||[]);return n(a,"_invoke",{value:A(t,r,o)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function d(){}function p(){}function m(){}var v={};u(v,s,(function(){return this}));var _=Object.getPrototypeOf,y=_&&_(_(C([])));y&&y!==e&&r.call(y,s)&&(v=y);var k=m.prototype=d.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){var i;n(this,"_invoke",{value:function(n,s){function a(){return new e((function(i,a){!function n(i,s,a,o){var u=h(t[i],t,s);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==f(c)&&r.call(c,"__await")?e.resolve(c.__await).then((function(t){n("next",t,a,o)}),(function(t){n("throw",t,a,o)})):e.resolve(c).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,o)}))}o(u.arg)}(n,s,i,a)}))}return i=i?i.then(a,a):a()}})}function A(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return B()}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=E(a,r);if(o){if(o===c)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),c;var i=h(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,c;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function C(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:B}}function B(){return{value:void 0,done:!0}}return p.prototype=m,n(k,"constructor",{value:m,configurable:!0}),n(m,"constructor",{value:p,configurable:!0}),p.displayName=u(m,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,o,"GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},b(S.prototype),u(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(l(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(k),u(k,o,"Generator"),u(k,s,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=C,F.prototype={constructor:F,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(o&&u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:C(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function m(t,e,r,n,i,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}function v(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){m(s,n,i,a,o,"next",t)}function o(t){m(s,n,i,a,o,"throw",t)}a(void 0)}))}}var _=[];function y(){return(y=v(g().mark((function t(){var e,r;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=document.querySelector(".Shipsmart__settings-title"),(r=document.querySelector(".wrap")).querySelector(".notice")&&r.querySelector(".notice").remove(),c((function(t){e.innerHTML+=t?'<div class="notice notice-success is-dismissible"><p>Pedidos atualizados com sucesso!</p></div>':'<div class="notice notice-error is-dismissible"><p>Houve algum problema na atualização!</p></div>'}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function k(){return(k=v(g().mark((function t(){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:d((function(t){t&&document.location.reload()}),_);case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function b(){var t;t=function(t){_=t.boxes,S()},wp.apiRequest({path:"/shipsmart/v1/boxes",method:"GET"}).then((function(e){return t(e)}))}function S(){var t=document.querySelector(".Shipsmart__settings-select");if(_)_.map((function(e){var r=e.weight,n=e.height,i=e.width,s=e.length,a="".concat(r,"kg - ").concat(n,"cm - ").concat(i,"cm - ").concat(s,"cm"),o=new Option(a);t.append(o)}));else{var e=new Option("Nenhuma caixa cadastrada",index);t.append(e)}}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0,i=document.querySelector(".ShipSmart__box-content--".concat(t)),s=document.querySelectorAll(".ShipSmart__box-card"),a=document.querySelector(".ShipSmart__box-select--".concat(t)),o=document.querySelector(".ShipSmart__box-price--".concat(t)),u=e.filter((function(e){return parseInt(e.id)-1==t}))[0].items.length,l=document.createElement("div"),h=0,c=0,d=[],p=r.filter((function(t){return t.id===parseInt(a.value)}));e.map((function(e){parseInt(e.id)-1==t&&(d=e.items.concat(p[0]))}));var f={items:d},g={weight:w(f),height:x(f),width:F(f),lengthBox:C(f)};M(g,n)?alert("Atenção! Essa caixa não comporta este produto, tente criar outra caixa."):(e.map((function(e){parseInt(e.id)-1==t&&(e.items.push(p[0]),c=w(e),h=E(e),e.price=h,e.weight=c,D(o,h))})),l.innerHTML='<span class="ShipSmart__box-item">'.concat(p[0].name,' </span><button class="add_note button ShipSmart__box-item--removed">x</button>'),l.querySelector(".ShipSmart__box-item--removed").onclick=function(){l.remove(),I(t,e,u,r,n)},i.append(l),r.splice(a.options.selectedIndex,1),Array.from(s).map((function(t,i){var s=t.getAttribute("data-box-id"),a=t.querySelector("select"),o=t.querySelector(".ShipSmart__box-button"),u=t.querySelector(".ShipSmart__box-remove");a.innerHTML="",B(a,r),o.onclick=function(){return A(s,e,r,n)},u.onclick=function(){return L(s,e,t,r,n)}})))}function E(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.price)}),0).toFixed(2)}function w(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.weight)}),0).toFixed(2)}function x(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.height)}),0).toFixed(2)}function F(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.width)}),0).toFixed(2)}function C(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.length)}),0).toFixed(2)}function B(t,e){Array.from(e).map((function(e){var r=new Option(e.name,e.id);t.append(r)}))}function D(t,e){t.innerHTML="Preço total: R$".concat(e)}function I(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4?arguments[4]:void 0,s=document.querySelector(".ShipSmart__box-content--".concat(t)),a=document.querySelectorAll(".ShipSmart__box-card"),o=document.querySelector(".ShipSmart__box-price--".concat(t)),u=0,l=0;s.innerHTML="",document.getElementById("sycro_with_shipsmart").removeAttribute("disabled"),e.map((function(e){parseInt(e.id)-1==t&&n.push(e.items[r])})),e.map((function(i){parseInt(i.id)-1==t&&(i.items.splice(r,1),i.items.map((function(r,i){var a=document.createElement("div");a.innerHTML='<span class="ShipSmart__box-item">'.concat(r.name,' <span><i style="cursor:pointer;" class="ShipSmart__box-item--removed">x</i>'),a.querySelector(".ShipSmart__box-item--removed").onclick=function(){a.remove(),I(t,e,i,n)},s.append(a)})),u=E(i),l=w(i),i.price=u,i.weight=l,D(o,u))})),Array.from(a).map((function(t,r){var s=t.getAttribute("data-box-id"),a=t.querySelector("select"),o=t.querySelector(".ShipSmart__box-button"),u=t.querySelector(".ShipSmart__box-remove");a.innerHTML="",B(a,n),o.onclick=function(){return A(s,e,n,i)},u.onclick=function(){return L(s,e,t,n,i)}}))}function M(t,e){return parseFloat(t.weight)>parseFloat(e.weight)||parseFloat(t.height)>parseFloat(e.height)||parseFloat(t.width)>parseFloat(e.width)||parseFloat(t.lengthBox)>parseFloat(e.length)}function L(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4?arguments[4]:void 0;r.map((function(r,n){parseInt(r.id)-1==t&&(e=n,r.items.map((function(t){i.push(t)})))})),r.splice(e,1),console.log(i),n.remove();var a=document.querySelectorAll(".ShipSmart__box-card");Array.from(a).map((function(t,e){var a=t.getAttribute("data-box-id"),o=t.querySelector("select"),u=t.querySelector(".ShipSmart__box-button"),l=t.querySelector(".ShipSmart__box-remove");o.innerHTML="",B(o,i),u.onclick=function(){return A(a,r,i,s)},l.onclick=function(){return L(a,r,n,i,s)}}))}r.p;function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){T=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new w(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function d(){}function p(){}function f(){}var g={};u(g,s,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(x([])));v&&v!==e&&r.call(v,s)&&(g=v);var _=f.prototype=d.prototype=Object.create(g);function y(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){var i;n(this,"_invoke",{value:function(n,s){function a(){return new e((function(i,a){!function n(i,s,a,o){var u=h(t[i],t,s);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==P(c)&&r.call(c,"__await")?e.resolve(c.__await).then((function(t){n("next",t,a,o)}),(function(t){n("throw",t,a,o)})):e.resolve(c).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,o)}))}o(u.arg)}(n,s,i,a)}))}return i=i?i.then(a,a):a()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return F()}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=S(a,r);if(o){if(o===c)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function S(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),c;var i=h(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,c;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function x(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:F}}function F(){return{value:void 0,done:!0}}return p.prototype=f,n(_,"constructor",{value:f,configurable:!0}),n(f,"constructor",{value:p,configurable:!0}),p.displayName=u(f,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,u(t,o,"GeneratorFunction")),t.prototype=Object.create(_),t},t.awrap=function(t){return{__await:t}},y(k.prototype),u(k.prototype,a,(function(){return this})),t.AsyncIterator=k,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new k(l(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},y(_),u(_,o,"Generator"),u(_,s,(function(){return this})),u(_,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=x,w.prototype={constructor:w,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(o&&u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},t}function O(t,e,r,n,i,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}var V;function j(){var t,e,r=document.getElementById("note_key"),n=document.getElementById("ss_note_key"),i=document.querySelector("#order_shipping_line_items table"),s=document.getElementById("woocomercer_order_id"),a=document.getElementById("sycro_with_shipsmart"),o=document.getElementById("update_shipsmart_order");(r.setAttribute("maxlength",44),n.value,V=s.value,p(function(){var t=function(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){O(s,n,i,a,o,"next",t)}function o(t){O(s,n,i,a,o,"throw",t)}a(void 0)}))}}(T().mark((function t(e){return T().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.items;case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),V),i)&&(document.querySelector("#order_shipping_line_items .line_cost").append(i),null===(t=document.querySelector("#order_shipping_line_items .line_cost table"))||void 0===t||t.classList.add("Show"),null===(e=document.querySelector("#order_shipping_line_items .line_cost table th"))||void 0===e||e.classList.add("ShipSmart__order-meta"));a&&(a.onclick=R),o&&(o.onclick=q)}function R(){var t=document.getElementById("note_key"),e=document.getElementById("sycro_with_shipsmart"),r=document.createElement("img"),n="".concat(wpApiSettings.imageRefreshUrl,"refresh-icon.6e7225bab3.png");r.setAttribute("src",n),r.classList.add("ShipSmart__refresh"),r.classList.add("refresh-start"),e.append(r),function(t,e){wp.apiRequest({path:"/shipsmart/v1/sycroOrder",method:"POST",data:e}).then((function(e){return t(e)})).catch((function(t){alert("Não foi possível sincronizar seu pedido. Um erro inesperado ocorreu!"),document.location.reload()}))}((function(t){console.log(t),t&&document.location.reload()}),{note_key:t.value,order_id:V})}function q(){c(V,(function(t){document.location.reload()}))}window.updateOrders=function(){return y.apply(this,arguments)},window.createBoxDimensions=function(){var t,e,r=document.getElementById("box_weight").value,n=document.getElementById("box_height").value,i=document.getElementById("box_width").value,s=document.getElementById("box_length").value,a=document.querySelector(".Shipsmart__settings-select"),o="".concat(r,"kg - ").concat(n,"cm - ").concat(i,"cm - ").concat(s,"cm");_.push({weight:r,height:n,width:i,length:s}),t=_.length-1,e=new Option(o,t),a.append(e),a.options[t].selected=!0},window.saveBoxesDimensions=function(){return k.apply(this,arguments)},window.removeBox=function(){var t=document.querySelector(".Shipsmart__settings-select");_.splice(t.options.selectedIndex,1),t.innerHTML="",S()},window.removeItemInBox=I,window.removeBoxElement=L,window.onload=function(){var t,e;document.location.href.includes("post.php")?(j(),t=document.querySelector("#update_shipsmart_order"),e=document.querySelector("#note_key"),t&&e&&(e.value||t.classList.add("shipsmart-button-none"))):document.location.href.includes("admin.php?page=wc-settings")?Object(n.a)():document.location.href.includes("admin.php?page=shipsmart")&&(b(),s())}},246:function(t,e){},27:function(t,e,r){"use strict";function n(t,e){if(null==t)return{};var r,n,i={},s=Object.keys(t);for(n=0;n<s.length;n++)r=s[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}function i(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new i.InputMask(t,e)}r.d(e,"a",(function(){return i}));class s{constructor(t){Object.assign(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},t)}aggregate(t){return this.rawInserted+=t.rawInserted,this.skip=this.skip||t.skip,this.inserted+=t.inserted,this.tailShift+=t.tailShift,this}get offset(){return this.tailShift+this.inserted.length}}function a(t){return"string"==typeof t||t instanceof String}i.ChangeDetails=s;const o="NONE",u="LEFT",l="FORCE_LEFT",h="RIGHT",c="FORCE_RIGHT";function d(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function p(t){return Array.isArray(t)?t:[t,new s]}function f(t,e){if(e===t)return!0;var r,n=Array.isArray(e),i=Array.isArray(t);if(n&&i){if(e.length!=t.length)return!1;for(r=0;r<e.length;r++)if(!f(e[r],t[r]))return!1;return!0}if(n!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){var s=e instanceof Date,a=t instanceof Date;if(s&&a)return e.getTime()==t.getTime();if(s!=a)return!1;var o=e instanceof RegExp,u=t instanceof RegExp;if(o&&u)return e.toString()==t.toString();if(o!=u)return!1;var l=Object.keys(e);for(r=0;r<l.length;r++)if(!Object.prototype.hasOwnProperty.call(t,l[r]))return!1;for(r=0;r<l.length;r++)if(!f(t[l[r]],e[l[r]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class g{constructor(t,e,r,n){for(this.value=t,this.cursorPos=e,this.oldValue=r,this.oldSelection=n;this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?o:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?u:h}}class m{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;this.value=t,this.from=e,this.stop=r}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class v{constructor(t){this._value="",this._update(Object.assign({},v.DEFAULTS,t)),this.isInitialized=!0}updateOptions(t){Object.keys(t).length&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{input:!0};return this.reset(),this.append(t,e,""),this.doCommit(),this.value}get unmaskedValue(){return this.value}set unmaskedValue(t){this.reset(),this.append(t,{},""),this.doCommit()}get typedValue(){return this.doParse(this.value)}set typedValue(t){this.value=this.doFormat(t)}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(t){this.reset(),this.append(t,{raw:!0},""),this.doCommit()}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return Math.min(this.value.length,e-t)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e)}extractTail(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new m(this.extractInput(t,e),t)}appendTail(t){return a(t)&&(t=new m(String(t))),t.appendTo(this)}_appendCharRaw(t){return t?(this._value+=t,new s({inserted:t,rawInserted:t})):new s}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;const n=this.state;let i;if([t,i]=p(this.doPrepare(t,e)),i=i.aggregate(this._appendCharRaw(t,e)),i.inserted){let t,a=!1!==this.doValidate(e);if(a&&null!=r){const e=this.state;!0===this.overwrite&&(t=r.state,r.unshift(this.value.length-i.tailShift));let n=this.appendTail(r);a=n.rawInserted===r.toString(),a&&n.inserted||"shift"!==this.overwrite||(this.state=e,t=r.state,r.shift(),n=this.appendTail(r),a=n.rawInserted===r.toString()),a&&n.inserted&&(this.state=e)}a||(i=new s,this.state=n,r&&t&&(r.state=t))}return i}_appendPlaceholder(){return new s}_appendEager(){return new s}append(t,e,r){if(!a(t))throw new Error("value should be string");const n=new s,i=a(r)?new m(String(r)):r;null!=e&&e.tail&&(e._beforeTailState=this.state);for(let r=0;r<t.length;++r){const s=this._appendChar(t[r],e,i);if(!s.rawInserted&&!this.doSkipInvalid(t[r],e,i))break;n.aggregate(s)}return null!=i&&(n.tailShift+=this.appendTail(i).tailShift),(!0===this.eager||"append"===this.eager)&&null!=e&&e.input&&t&&n.aggregate(this._appendEager()),n}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this._value=this.value.slice(0,t)+this.value.slice(e),new s}withValueRefresh(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;const e=this.rawInputValue,r=this.value,n=t();return this.rawInputValue=e,this.value&&this.value!==r&&0===r.indexOf(this.value)&&this.append(r.slice(this.value.length),{},""),delete this._refreshing,n}runIsolated(t){if(this._isolated||!this.isInitialized)return t(this);this._isolated=!0;const e=this.state,r=t(this);return this.state=e,delete this._isolated,r}doSkipInvalid(t){return this.skipInvalid}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare?this.prepare(t,this,e):t}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}doFormat(t){return this.format?this.format(t,this):t}doParse(t){return this.parse?this.parse(t,this):t}splice(t,e,r,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{input:!0};const a=t+e,d=this.extractTail(a),p=!0===this.eager||"remove"===this.eager;let f;p&&(n=function(t){switch(t){case u:return l;case h:return c;default:return t}}(n),f=this.extractInput(0,a,{raw:!0}));let g=t;const m=new s;if(n!==o&&(g=this.nearestInputPos(t,e>1&&0!==t&&!p?o:n),m.tailShift=g-t),m.aggregate(this.remove(g)),p&&n!==o&&f===this.rawInputValue)if(n===l){let t;for(;f===this.rawInputValue&&(t=this.value.length);)m.aggregate(new s({tailShift:-1})).aggregate(this.remove(t-1))}else n===c&&d.unshift();return m.aggregate(this.append(r,i,d))}maskEquals(t){return this.mask===t}typedValueEquals(t){const e=this.typedValue;return t===e||v.EMPTY_VALUES.includes(t)&&v.EMPTY_VALUES.includes(e)||this.doFormat(t)===this.doFormat(this.typedValue)}}function _(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?i.MaskedRegExp:a(t)?i.MaskedPattern:t instanceof Date||t===Date?i.MaskedDate:t instanceof Number||"number"==typeof t||t===Number?i.MaskedNumber:Array.isArray(t)||t===Array?i.MaskedDynamic:i.Masked&&t.prototype instanceof i.Masked?t:t instanceof i.Masked?t.constructor:t instanceof Function?i.MaskedFunction:(console.warn("Mask not found for mask",t),i.Masked)}function y(t){if(i.Masked&&t instanceof i.Masked)return t;const e=(t=Object.assign({},t)).mask;if(i.Masked&&e instanceof i.Masked)return e;const r=_(e);if(!r)throw new Error("Masked class is not found for provided mask, appropriate module needs to be import manually before creating mask.");return new r(t)}v.DEFAULTS={format:String,parse:t=>t,skipInvalid:!0},v.EMPTY_VALUES=[void 0,null,""],i.Masked=v,i.createMask=y;const k=["parent","isOptional","placeholderChar","displayChar","lazy","eager"],b={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class S{constructor(t){const{parent:e,isOptional:r,placeholderChar:i,displayChar:s,lazy:a,eager:o}=t,u=n(t,k);this.masked=y(u),Object.assign(this,{parent:e,isOptional:r,placeholderChar:i,displayChar:s,lazy:a,eager:o})}reset(){this.isFilled=!1,this.masked.reset()}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return 0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new s}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isFilled)return new s;const r=this.masked.state,n=this.masked._appendChar(t,e);return n.inserted&&!1===this.doValidate(e)&&(n.inserted=n.rawInserted="",this.masked.state=r),n.inserted||this.isOptional||this.lazy||e.input||(n.inserted=this.placeholderChar),n.skip=!n.inserted&&!this.isOptional,this.isFilled=Boolean(n.inserted),n}append(){return this.masked.append(...arguments)}_appendPlaceholder(){const t=new s;return this.isFilled||this.isOptional||(this.isFilled=!0,t.inserted=this.placeholderChar),t}_appendEager(){return new s}extractTail(){return this.masked.extractTail(...arguments)}appendTail(){return this.masked.appendTail(...arguments)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,r=arguments.length>2?arguments[2]:void 0;return this.masked.extractInput(t,e,r)}nearestInputPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;const r=this.value.length,n=Math.min(Math.max(t,0),r);switch(e){case u:case l:return this.isComplete?n:0;case h:case c:return this.isComplete?n:r;case o:default:return n}}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e).length}doValidate(){return this.masked.doValidate(...arguments)&&(!this.parent||this.parent.doValidate(...arguments))}doCommit(){this.masked.doCommit()}get state(){return{masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}}class A{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new s}nearestInputPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;const r=this._value.length;switch(e){case u:case l:return 0;case o:case h:case c:default:return r}}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._isRawInput?e-t:0}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=new s;if(this.isFilled)return r;const n=!0===this.eager||"append"===this.eager,i=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!n)&&!e.tail;return i&&(r.rawInserted=this.char),this._value=r.inserted=this.char,this._isRawInput=i&&(e.raw||e.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new s;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return arguments.length>1&&void 0!==arguments[1]||this.value.length,new m("")}appendTail(t){return a(t)&&(t=new m(String(t))),t.appendTo(this)}append(t,e,r){const n=this._appendChar(t[0],e);return null!=r&&(n.tailShift+=this.appendTail(r).tailShift),n}doCommit(){}get state(){return{_value:this._value,_isRawInput:this._isRawInput}}set state(t){Object.assign(this,t)}}const E=["chunks"];class w{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;a(t)&&(t=new m(String(t)));const e=this.chunks[this.chunks.length-1],r=e&&(e.stop===t.stop||null==t.stop)&&t.from===e.from+e.toString().length;if(t instanceof m)r?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof w){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof i.MaskedPattern)){return new m(this.toString()).appendTo(t)}const e=new s;for(let r=0;r<this.chunks.length&&!e.skip;++r){const n=this.chunks[r],i=t._mapPosToBlock(t.value.length),s=n.stop;let a;if(null!=s&&(!i||i.index<=s)){if(n instanceof w||t._stops.indexOf(s)>=0){const r=t._appendPlaceholder(s);e.aggregate(r)}a=n instanceof w&&t._blocks[s]}if(a){const r=a.appendTail(n);r.skip=!1,e.aggregate(r),t._value+=r.inserted;const i=n.toString().slice(r.rawInserted.length);i&&e.aggregate(t.append(i,{tail:!0}))}else e.aggregate(t.append(n.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e}=t,r=n(t,E);Object.assign(this,r),this.chunks=e.map(t=>{const e="chunks"in t?new w:new m;return e.state=t,e})}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let r=0;for(;r<this.chunks.length;){const t=this.chunks[r],n=t.unshift(e);if(t.toString()){if(!n)break;++r}else this.chunks.splice(r,1);if(n)return n}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],r=e.shift();if(e.toString()){if(!r)break;--t}else this.chunks.splice(t,1);if(r)return r}return""}}class x{constructor(t,e){this.masked=t,this._log=[];const{offset:r,index:n}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=n,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return this.state=t,t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.value.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null===(e=this.block)||void 0===e?void 0:e.value.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,l),0!==this.offset||void 0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,u),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,u),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,c),this.offset!==this.block.value.length||void 0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,o),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,o),!0})}}i.MaskedRegExp=class extends v{_update(t){t.mask&&(t.validate=e=>e.search(t.mask)>=0),super._update(t)}};const F=["_blocks"];class C extends v{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},b,t.definitions),super(Object.assign({},C.DEFAULTS,t))}_update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this._stops=[],this._maskedBlocks={};let e=this.mask;if(!e||!t)return;let r=!1,n=!1;for(let o=0;o<e.length;++o){var s,a;if(this.blocks){const t=e.slice(o),r=Object.keys(this.blocks).filter(e=>0===t.indexOf(e));r.sort((t,e)=>e.length-t.length);const n=r[0];if(n){const t=y(Object.assign({parent:this,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite},this.blocks[n]));t&&(this._blocks.push(t),this._maskedBlocks[n]||(this._maskedBlocks[n]=[]),this._maskedBlocks[n].push(this._blocks.length-1)),o+=n.length-1;continue}}let u=e[o],l=u in t;if(u===C.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===u||"}"===u){r=!r;continue}if("["===u||"]"===u){n=!n;continue}if(u===C.ESCAPE_CHAR){if(++o,u=e[o],!u)break;l=!1}const h=null===(s=t[u])||void 0===s||!s.mask||(null===(a=t[u])||void 0===a?void 0:a.mask.prototype)instanceof i.Masked?{mask:t[u]}:t[u],c=l?new S(Object.assign({parent:this,isOptional:n,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar},h)):new A({char:u,eager:this.eager,isUnmasking:r});this._blocks.push(c)}}get state(){return Object.assign({},super.state,{_blocks:this._blocks.map(t=>t.state)})}set state(t){const{_blocks:e}=t,r=n(t,F);this._blocks.forEach((t,r)=>t.state=e[r]),super.state=r}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this._blocks.reduce((t,e)=>t+e.unmaskedValue,"")}set unmaskedValue(t){super.unmaskedValue=t}get value(){return this._blocks.reduce((t,e)=>t+e.value,"")}set value(t){super.value=t}get displayValue(){return this._blocks.reduce((t,e)=>t+e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new s;let r=null===(t=this._mapPosToBlock(this.value.length))||void 0===t?void 0:t.index;if(null==r)return e;this._blocks[r].isFilled&&++r;for(let t=r;t<this._blocks.length;++t){const r=this._blocks[t]._appendEager();if(!r.inserted)break;e.aggregate(r)}return e}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this._mapPosToBlock(this.value.length),n=new s;if(!r)return n;for(let s=r.index;;++s){var i,a;const r=this._blocks[s];if(!r)break;const o=r._appendChar(t,Object.assign({},e,{_beforeTailState:null===(i=e._beforeTailState)||void 0===i||null===(a=i._blocks)||void 0===a?void 0:a[s]})),u=o.skip;if(n.aggregate(o),u||o.rawInserted)break}return n}extractTail(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const r=new w;return t===e||this._forEachBlocksInRange(t,e,(t,e,n,i)=>{const s=t.extractTail(n,i);s.stop=this._findStopBefore(e),s.from=this._blockStartPos(e),s instanceof w&&(s.blockIndex=e),r.extend(s)}),r}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";let n="";return this._forEachBlocksInRange(t,e,(t,e,i,s)=>{n+=t.extractInput(i,s,r)}),n}_findStopBefore(t){let e;for(let r=0;r<this._stops.length;++r){const n=this._stops[r];if(!(n<=t))break;e=n}return e}_appendPlaceholder(t){const e=new s;if(this.lazy&&null==t)return e;const r=this._mapPosToBlock(this.value.length);if(!r)return e;const n=r.index,i=null!=t?t:this._blocks.length;return this._blocks.slice(n,i).forEach(r=>{if(!r.lazy||null!=t){const t=null!=r._blocks?[r._blocks.length]:[],n=r._appendPlaceholder(...t);this._value+=n.inserted,e.aggregate(n)}}),e}_mapPosToBlock(t){let e="";for(let r=0;r<this._blocks.length;++r){const n=this._blocks[r],i=e.length;if(e+=n.value,t<=e.length)return{index:r,offset:t-i}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+e.value.length,0)}_forEachBlocksInRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,r=arguments.length>2?arguments[2]:void 0;const n=this._mapPosToBlock(t);if(n){const t=this._mapPosToBlock(e),i=t&&n.index===t.index,s=n.offset,a=t&&i?t.offset:this._blocks[n.index].value.length;if(r(this._blocks[n.index],n.index,s,a),t&&!i){for(let e=n.index+1;e<t.index;++e)r(this._blocks[e],e,0,this._blocks[e].value.length);r(this._blocks[t.index],t.index,0,t.offset)}}}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const r=super.remove(t,e);return this._forEachBlocksInRange(t,e,(t,e,n,i)=>{r.aggregate(t.remove(n,i))}),r}nearestInputPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;if(!this._blocks.length)return 0;const r=new x(this,t);if(e===o)return r.pushRightBeforeInput()?r.pos:(r.popState(),r.pushLeftBeforeInput()?r.pos:this.value.length);if(e===u||e===l){if(e===u){if(r.pushRightBeforeFilled(),r.ok&&r.pos===t)return t;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),e===u){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=t)return r.pos;if(r.popState(),r.ok&&r.pos<=t)return r.pos;r.popState()}return r.ok?r.pos:e===l?0:(r.popState(),r.ok?r.pos:(r.popState(),r.ok?r.pos:0))}return e===h||e===c?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:e===c?this.value.length:(r.popState(),r.ok?r.pos:(r.popState(),r.ok?r.pos:this.nearestInputPos(t,u)))):t}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,r=0;return this._forEachBlocksInRange(t,e,(t,e,n,i)=>{r+=t.totalInputPositions(n,i)}),r}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(t=>this._blocks[t]):[]}}C.DEFAULTS={lazy:!0,placeholderChar:"_"},C.STOP_CHAR="`",C.ESCAPE_CHAR="\\",C.InputDefinition=S,C.FixedDefinition=A,i.MaskedPattern=C;class B extends C{get _matchFrom(){return this.maxLength-String(this.from).length}_update(t){t=Object.assign({to:this.to||0,from:this.from||0,maxLength:this.maxLength||0},t);let e=String(t.to).length;null!=t.maxLength&&(e=Math.max(e,t.maxLength)),t.maxLength=e;const r=String(t.from).padStart(e,"0"),n=String(t.to).padStart(e,"0");let i=0;for(;i<n.length&&n[i]===r[i];)++i;t.mask=n.slice(0,i).replace(/0/g,"\\0")+"0".repeat(e-i),super._update(t)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",r="";const[,n,i]=t.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(e="0".repeat(n.length)+i,r="9".repeat(n.length)+i),e=e.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[e,r]}doPrepare(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if([t,e]=p(super.doPrepare(t.replace(/\D/g,""),r)),!this.autofix||!t)return t;const n=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0");let s=this.value+t;if(s.length>this.maxLength)return"";const[a,o]=this.boundaries(s);return Number(o)<this.from?n[s.length-1]:Number(a)>this.to?"pad"===this.autofix&&s.length<this.maxLength?["",e.aggregate(this.append(n[s.length-1]+t,r))]:i[s.length-1]:t}doValidate(){const t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;const[e,r]=this.boundaries(t);return this.from<=Number(r)&&Number(e)<=this.to&&super.doValidate(...arguments)}}i.MaskedRange=B;class D extends C{constructor(t){super(Object.assign({},D.DEFAULTS,t))}_update(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern);const e=t.blocks;t.blocks=Object.assign({},D.GET_DEFAULT_BLOCKS()),t.min&&(t.blocks.Y.from=t.min.getFullYear()),t.max&&(t.blocks.Y.to=t.max.getFullYear()),t.min&&t.max&&t.blocks.Y.from===t.blocks.Y.to&&(t.blocks.m.from=t.min.getMonth()+1,t.blocks.m.to=t.max.getMonth()+1,t.blocks.m.from===t.blocks.m.to&&(t.blocks.d.from=t.min.getDate(),t.blocks.d.to=t.max.getDate())),Object.assign(t.blocks,this.blocks,e),Object.keys(t.blocks).forEach(e=>{const r=t.blocks[e];!("autofix"in r)&&"autofix"in t&&(r.autofix=t.autofix)}),super._update(t)}doValidate(){const t=this.date;return super.doValidate(...arguments)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}}D.DEFAULTS={pattern:"d{.}`m{.}`Y",format:t=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:t=>{const[e,r,n]=t.split(".");return new Date(n,r-1,e)}},D.GET_DEFAULT_BLOCKS=()=>({d:{mask:B,from:1,to:31,maxLength:2},m:{mask:B,from:1,to:12,maxLength:2},Y:{mask:B,from:1900,to:9999}}),i.MaskedDate=D;class I{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch(t){}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch(t){}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch(t){}}_unsafeSelect(t,e){}get isActive(){return!1}bindEvents(t){}unbindEvents(){}}i.MaskElement=I;class M extends I{constructor(t){super(),this.input=t,this._handlers={}}get rootElement(){var t,e,r;return null!==(t=null===(e=(r=this.input).getRootNode)||void 0===e?void 0:e.call(r))&&void 0!==t?t:document}get isActive(){return this.input===this.rootElement.activeElement}get _unsafeSelectionStart(){return this.input.selectionStart}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}bindEvents(t){Object.keys(t).forEach(e=>this._toggleEventHandler(M.EVENTS_MAP[e],t[e]))}unbindEvents(){Object.keys(this._handlers).forEach(t=>this._toggleEventHandler(t))}_toggleEventHandler(t,e){this._handlers[t]&&(this.input.removeEventListener(t,this._handlers[t]),delete this._handlers[t]),e&&(this.input.addEventListener(t,e),this._handlers[t]=e)}}M.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"},i.HTMLMaskElement=M;class L extends M{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),r=e&&e.anchorOffset,n=e&&e.focusOffset;return null==n||null==r||r<n?r:n}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),r=e&&e.anchorOffset,n=e&&e.focusOffset;return null==n||null==r||r>n?r:n}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,t),r.setEnd(this.input.lastChild||this.input,e);const n=this.rootElement,i=n.getSelection&&n.getSelection();i&&(i.removeAllRanges(),i.addRange(r))}get value(){return this.input.textContent}set value(t){this.input.textContent=t}}i.HTMLContenteditableMaskElement=L;const P=["mask"];i.InputMask=class{constructor(t,e){this.el=t instanceof I?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new L(t):new M(t),this.masked=y(e),this._listeners={},this._value="",this._unmaskedValue="",this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}get mask(){return this.masked.mask}maskEquals(t){var e;return null==t||(null===(e=this.masked)||void 0===e?void 0:e.maskEquals(t))}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof i.Masked)&&this.masked.constructor===_(t))return void this.masked.updateOptions({mask:t});const e=y({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl(),this.alignCursor())}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl(),this.alignCursor())}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];const i=this._listeners[t];i&&i.forEach(t=>t(...r))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value}updateControl(){const t=this.masked.unmaskedValue,e=this.masked.value,r=this.displayValue,n=this.unmaskedValue!==t||this.value!==e;this._unmaskedValue=t,this._value=e,this.el.value!==r&&(this.el.value=r),n&&this._fireChangeEvents()}updateOptions(t){const{mask:e}=t,r=n(t,P),i=!this.maskEquals(e),s=!f(this.masked,r);i&&(this.mask=e),s&&this.masked.updateOptions(r),(i||s)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,u))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const r=this._listeners[t].indexOf(e);return r>=0&&this._listeners[t].splice(r,1),this}_onInput(t){if(this._inputEvent=t,this._abortUpdateCursor(),!this._selection)return this.updateValue();const e=new g(this.el.value,this.cursorPos,this.displayValue,this._selection),r=this.masked.rawInputValue,n=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,i=r===this.masked.rawInputValue?e.removeDirection:o;let s=this.masked.nearestInputPos(e.startChangePos+n,i);i!==o&&(s=this.masked.nearestInputPos(s,o)),this.updateControl(),this.updateCursor(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};i.MaskedEnum=class extends C{_update(t){t.enum&&(t.mask="*".repeat(t.enum[0].length)),super._update(t)}doValidate(){return this.enum.some(t=>t.indexOf(this.unmaskedValue)>=0)&&super.doValidate(...arguments)}};class T extends v{constructor(t){super(Object.assign({},T.DEFAULTS,t))}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){let t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"(".concat(d(this.radix),"\\d{0,").concat(this.scale,"})?"):"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("[".concat(this.mapToRadix.map(d).join(""),"]"),"g"),this._thousandsSeparatorRegExp=new RegExp(d(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t);const[r,n]=p(super.doPrepare(t,e));return t&&!r&&(n.skip=!0),[r,n]}_separatorsCount(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0;for(let n=0;n<t;++n)this._value.indexOf(this.thousandsSeparator,n)===n&&(++r,e&&(t+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._value;return this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,r=arguments.length>2?arguments[2]:void 0;return[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,r))}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.thousandsSeparator)return super._appendCharRaw(t,e);const r=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,n=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const i=super._appendCharRaw(t,e);this._value=this._insertThousandsSeparators(this._value);const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,a=this._separatorsCountFromSlice(s);return i.tailShift+=(a-n)*this.thousandsSeparator.length,i.skip=!i.rawInserted&&t===this.thousandsSeparator,i}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,e);if(r<=t)return r}return-1}_adjustRangeWithSeparators(t,e){const r=this._findSeparatorAround(t);r>=0&&(t=r);const n=this._findSeparatorAround(e);return n>=0&&(e=n+this.thousandsSeparator.length),[t,e]}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;[t,e]=this._adjustRangeWithSeparators(t,e);const r=this.value.slice(0,t),n=this.value.slice(e),i=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+n));const a=this._separatorsCountFromSlice(r);return new s({tailShift:(a-i)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case o:case u:case l:{const r=this._findSeparatorAround(t-1);if(r>=0){const n=r+this.thousandsSeparator.length;if(t<n||this.value.length<=n||e===l)return r}break}case h:case c:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doValidate(t){let e=Boolean(this._removeThousandsSeparators(this.value).match(this._numberRegExp));if(e){const t=this.number;e=e&&!isNaN(t)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return e&&super.doValidate(t)}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.doFormat(e));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,r,n)=>e+n),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;const n=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===T.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,r)&&!n}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,T.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.doParse(this.unmaskedValue)}set typedValue(t){this.rawInputValue=this.doFormat(t).replace(T.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}typedValueEquals(t){return(super.typedValueEquals(t)||T.EMPTY_VALUES.includes(t)&&T.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}T.UNMASKED_RADIX=".",T.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:[T.UNMASKED_RADIX],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},T.EMPTY_VALUES=[...v.EMPTY_VALUES,0],i.MaskedNumber=T;i.MaskedFunction=class extends v{_update(t){t.mask&&(t.validate=t.mask),super._update(t)}};const O=["compiledMasks","currentMaskRef","currentMask"],V=["mask"];class j extends v{constructor(t){super(Object.assign({},j.DEFAULTS,t)),this.currentMask=null}_update(t){super._update(t),"mask"in t&&(this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>y(t)):[])}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=this._applyDispatch(t,e);return this.currentMask&&r.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),r}_applyDispatch(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const n=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,i=this.rawInputValue,a=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:i,o=i.slice(a.length),u=this.currentMask,l=new s,h=null==u?void 0:u.state;if(this.currentMask=this.doDispatch(t,Object.assign({},e),r),this.currentMask)if(this.currentMask!==u){if(this.currentMask.reset(),a){const t=this.currentMask.append(a,{raw:!0});l.tailShift=t.inserted.length-n.length}o&&(l.tailShift+=this.currentMask.append(o,{raw:!0,tail:!0}).tailShift)}else this.currentMask.state=h;return l}_appendPlaceholder(){const t=this._applyDispatch(...arguments);return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch(...arguments);return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new s;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,r;return Object.assign({},t,{_beforeTailState:(null===(e=t._beforeTailState)||void 0===e?void 0:e.currentMaskRef)===this.currentMask&&(null===(r=t._beforeTailState)||void 0===r?void 0:r.currentMask)||t._beforeTailState})}doDispatch(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this.dispatch(t,this,e,r)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[r,n]=p(super.doPrepare(t,e));if(this.currentMask){let t;[r,t]=p(super.doPrepare(r,this.currentMaskFlags(e))),n=n.aggregate(t)}return[r,n]}reset(){var t;null===(t=this.currentMask)||void 0===t||t.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(t){super.value=t}get unmaskedValue(){return this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.currentMask?this.currentMask.typedValue:""}set typedValue(t){let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null===(t=this.currentMask)||void 0===t?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null===(t=this.currentMask)||void 0===t?void 0:t.isFilled)}remove(){const t=new s;return this.currentMask&&t.aggregate(this.currentMask.remove(...arguments)).aggregate(this._applyDispatch()),t}get state(){var t;return Object.assign({},super.state,{_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:null===(t=this.currentMask)||void 0===t?void 0:t.state})}set state(t){const{compiledMasks:e,currentMaskRef:r,currentMask:i}=t,s=n(t,O);this.compiledMasks.forEach((t,r)=>t.state=e[r]),null!=r&&(this.currentMask=r,this.currentMask.state=i),super.state=s}extractInput(){return this.currentMask?this.currentMask.extractInput(...arguments):""}extractTail(){return this.currentMask?this.currentMask.extractTail(...arguments):super.extractTail(...arguments)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(){return this.currentMask?this.currentMask.nearestInputPos(...arguments):super.nearestInputPos(...arguments)}get overwrite(){return this.currentMask?this.currentMask.overwrite:super.overwrite}set overwrite(t){console.warn('"overwrite" option is not available in dynamic mask, use this option in siblings')}get eager(){return this.currentMask?this.currentMask.eager:super.eager}set eager(t){console.warn('"eager" option is not available in dynamic mask, use this option in siblings')}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:super.skipInvalid}set skipInvalid(t){(this.isInitialized||t!==v.DEFAULTS.skipInvalid)&&console.warn('"skipInvalid" option is not available in dynamic mask, use this option in siblings')}maskEquals(t){return Array.isArray(t)&&this.compiledMasks.every((e,r)=>{if(!t[r])return;const i=t[r],{mask:s}=i;return f(e,n(i,V))&&e.maskEquals(s)})}typedValueEquals(t){var e;return Boolean(null===(e=this.currentMask)||void 0===e?void 0:e.typedValueEquals(t))}}j.DEFAULTS={dispatch:(t,e,r,n)=>{if(!e.compiledMasks.length)return;const i=e.rawInputValue,s=e.compiledMasks.map((s,a)=>{const o=e.currentMask===s,u=o?s.value.length:s.nearestInputPos(s.value.length,l);return s.rawInputValue!==i?(s.reset(),s.append(i,{raw:!0})):o||s.remove(u),s.append(t,e.currentMaskFlags(r)),s.appendTail(n),{index:a,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(u,s.nearestInputPos(s.value.length,l)))}});return s.sort((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions),e.compiledMasks[s[0].index]}},i.MaskedDynamic=j;const R={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function q(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R.MASKED,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:R.MASKED;const n=y(t);return t=>n.runIsolated(n=>(n[e]=t,n[r]))}i.PIPE_TYPE=R,i.createPipe=q,i.pipe=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return q(...r)(t)};try{globalThis.IMask=i}catch(t){}},47:function(t,e){t.exports=jQuery},82:function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));r(27);function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,s=function(){};return{s:s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(){var e=document.querySelector(".woocommerce-page.woocommerce-embed-page");e&&new MutationObserver(o).observe(e,{childList:!0});t(document.body).on("wc_backbone_modal_loaded",(function(t,e){"wc-modal-shipping-method-settings"===e&&a()}))}function a(){var t=document.querySelector("#woocommerce_ssfw_shipping_method_title"),e=document.querySelector("#woocommerce_ssfw_shipping_method_contract");(t||e)&&e.addEventListener("change",(function(){t.value=e.options[e.selectedIndex].text}))}function o(t,e){var r,i=n(t);try{for(i.s();!(r=i.n()).done;){r.value.addedNodes.forEach((function(t){a()}))}}catch(t){i.e(t)}finally{i.f()}}}).call(this,r(47))}});1 !function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=243)}({243:function(t,e,n){"use strict";n.r(e);n(246);var r=n(82),i=n(27);function s(){!function(){var t=document.querySelector("#ssfw_shipping"),e=document.querySelector("#is_federal_tax_id");if(!t||!e)return;var n=document.getElementById("federal_tax_id"),r=(document.querySelector("#name"),document.querySelector("#phone")),s=(document.querySelector("#email"),document.querySelector("#percentual_discount")),o=document.querySelector("#insurance"),a=document.querySelector("#discount_taxable");document.querySelector("#plus_date_final");n.setAttribute("maxlength",18),n.setAttribute("placeholder","00.000.000/0000-00"),n.onkeypress=function(t){return/[0123456789,.]/.test(String.fromCharCode(t.which))};Object(i.a)(n,{mask:"00.000.000/0000-00"}),Object(i.a)(r,{mask:"+00 (00) 00000-0000"});s.setAttribute("min",0),s.setAttribute("max",100),o.setAttribute("min",0),o.setAttribute("max",100),a.setAttribute("min",0),a.setAttribute("max",100)}()}function o(){var t=document.getElementById("selected_countries_list"),e=document.querySelectorAll('input[name="ddp_countries[]"]:checked');if(0!==e.length){var n="";e.forEach((function(t){var e=t.closest(".Shipsmart__country-checkbox-label").querySelector(".Shipsmart__country-name").textContent,r=t.value;n+='<span class="Shipsmart__selected-country-tag">\n '.concat(e," (").concat(r,')\n <button type="button" onclick="removeCountry(\'').concat(r,'\')" class="Shipsmart__remove-country">×</button>\n </span>')})),t.innerHTML=n}else t.innerHTML='<span class="Shipsmart__no-selection">Nenhum país selecionado</span>'}function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(){u=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function h(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var s=e&&e.prototype instanceof f?e:f,o=Object.create(s.prototype),a=new F(i||[]);return r(o,"_invoke",{value:E(t,n,a)}),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var p={};function f(){}function g(){}function m(){}var v={};h(v,s,(function(){return this}));var _=Object.getPrototypeOf,y=_&&_(_(C([])));y&&y!==e&&n.call(y,s)&&(v=y);var k=m.prototype=f.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){var i;r(this,"_invoke",{value:function(r,s){function o(){return new e((function(i,o){!function r(i,s,o,u){var l=d(t[i],t,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==a(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,o,u)}),(function(t){r("throw",t,o,u)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return r("throw",t,o,u)}))}u(l.arg)}(r,s,i,o)}))}return i=i?i.then(o,o):o()}})}function E(t,e,n){var r="suspendedStart";return function(i,s){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw s;return B()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=A(o,n);if(a){if(a===p)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function A(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=d(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function C(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:B}}function B(){return{value:void 0,done:!0}}return g.prototype=m,r(k,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:g,configurable:!0}),g.displayName=h(m,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,h(t,l,"GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},b(S.prototype),h(S.prototype,o,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,s){void 0===s&&(s=Promise);var o=new S(c(e,n,r,i),s);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},b(k),h(k,l,"Generator"),h(k,s,(function(){return this})),h(k,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,F.prototype={constructor:F,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(a&&u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:C(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}function l(t,e,n,r,i,s,o){try{var a=t[s](o),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}var h,c,d=function(t,e){wp.apiRequest({path:"/shipsmart/v1/updateOrders",method:"PUT",data:{order_id:t}}).then((function(t){return e(t)}))},p=function(t,e){wp.apiRequest({path:"/shipsmart/v1/saveBoxes",method:"POST",data:{measures:e}}).then((function(e){return t(e)}))},f=(h=u().mark((function t(e,n){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:wp.apiRequest({path:"/shipsmart/v1/order/items?order_id=".concat(n),method:"GET"}).then((function(t){return e(t)}));case 1:case"end":return t.stop()}}),t)})),c=function(){var t=this,e=arguments;return new Promise((function(n,r){var i=h.apply(t,e);function s(t){l(i,n,r,s,o,"next",t)}function o(t){l(i,n,r,s,o,"throw",t)}s(void 0)}))},function(t,e){return c.apply(this,arguments)});function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(){m=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var s=e&&e.prototype instanceof d?e:d,o=Object.create(s.prototype),a=new F(i||[]);return r(o,"_invoke",{value:E(t,n,a)}),o}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function d(){}function p(){}function f(){}var v={};u(v,s,(function(){return this}));var _=Object.getPrototypeOf,y=_&&_(_(C([])));y&&y!==e&&n.call(y,s)&&(v=y);var k=f.prototype=d.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){var i;r(this,"_invoke",{value:function(r,s){function o(){return new e((function(i,o){!function r(i,s,o,a){var u=h(t[i],t,s);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==g(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,o,a)}),(function(t){r("throw",t,o,a)})):e.resolve(c).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,a)}))}a(u.arg)}(r,s,i,o)}))}return i=i?i.then(o,o):o()}})}function E(t,e,n){var r="suspendedStart";return function(i,s){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw s;return B()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=A(o,n);if(a){if(a===c)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=h(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function A(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),c;var i=h(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,c;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function C(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:B}}function B(){return{value:void 0,done:!0}}return p.prototype=f,r(k,"constructor",{value:f,configurable:!0}),r(f,"constructor",{value:p,configurable:!0}),p.displayName=u(f,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,u(t,a,"GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},b(S.prototype),u(S.prototype,o,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,i,s){void 0===s&&(s=Promise);var o=new S(l(e,n,r,i),s);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},b(k),u(k,a,"Generator"),u(k,s,(function(){return this})),u(k,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,F.prototype={constructor:F,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(a&&u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:C(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},t}function v(t,e,n,r,i,s,o){try{var a=t[s](o),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function _(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var s=t.apply(e,n);function o(t){v(s,r,i,o,a,"next",t)}function a(t){v(s,r,i,o,a,"throw",t)}o(void 0)}))}}var y=[];function k(){return(k=_(m().mark((function t(){var e,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=document.querySelector(".Shipsmart__settings-title"),(n=document.querySelector(".wrap")).querySelector(".notice")&&n.querySelector(".notice").remove(),d((function(t){e.innerHTML+=t?'<div class="notice notice-success is-dismissible"><p>Pedidos atualizados com sucesso!</p></div>':'<div class="notice notice-error is-dismissible"><p>Houve algum problema na atualização!</p></div>'}));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function b(){return(b=_(m().mark((function t(){return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:p((function(t){t&&document.location.reload()}),y);case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function S(){var t;t=function(t){y=t.boxes,E()},wp.apiRequest({path:"/shipsmart/v1/boxes",method:"GET"}).then((function(e){return t(e)}))}function E(){var t=document.querySelector(".Shipsmart__settings-select");if(y)y.map((function(e){var n=e.weight,r=e.height,i=e.width,s=e.length,o="".concat(n,"kg - ").concat(r,"cm - ").concat(i,"cm - ").concat(s,"cm"),a=new Option(o);t.append(a)}));else{var e=new Option("Nenhuma caixa cadastrada",index);t.append(e)}}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3?arguments[3]:void 0,i=document.querySelector(".ShipSmart__box-content--".concat(t)),s=document.querySelectorAll(".ShipSmart__box-card"),o=document.querySelector(".ShipSmart__box-select--".concat(t)),a=document.querySelector(".ShipSmart__box-price--".concat(t)),u=e.filter((function(e){return parseInt(e.id)-1==t}))[0].items.length,l=document.createElement("div"),h=0,c=0,d=[],p=n.filter((function(t){return t.id===parseInt(o.value)}));e.map((function(e){parseInt(e.id)-1==t&&(d=e.items.concat(p[0]))}));var f={items:d},g={weight:x(f),height:F(f),width:C(f),lengthBox:B(f)};L(g,r)?alert("Atenção! Essa caixa não comporta este produto, tente criar outra caixa."):(e.map((function(e){parseInt(e.id)-1==t&&(e.items.push(p[0]),c=x(e),h=w(e),e.price=h,e.weight=c,I(a,h))})),l.innerHTML='<span class="ShipSmart__box-item">'.concat(p[0].name,' </span><button class="add_note button ShipSmart__box-item--removed">x</button>'),l.querySelector(".ShipSmart__box-item--removed").onclick=function(){l.remove(),M(t,e,u,n,r)},i.append(l),n.splice(o.options.selectedIndex,1),Array.from(s).map((function(t,i){var s=t.getAttribute("data-box-id"),o=t.querySelector("select"),a=t.querySelector(".ShipSmart__box-button"),u=t.querySelector(".ShipSmart__box-remove");o.innerHTML="",D(o,n),a.onclick=function(){return A(s,e,n,r)},u.onclick=function(){return P(s,e,t,n,r)}})))}function w(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.price)}),0).toFixed(2)}function x(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.weight)}),0).toFixed(2)}function F(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.height)}),0).toFixed(2)}function C(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.width)}),0).toFixed(2)}function B(t){return t.items.reduce((function(t,e){return t+=parseFloat(e.details.length)}),0).toFixed(2)}function D(t,e){Array.from(e).map((function(e){var n=new Option(e.name,e.id);t.append(n)}))}function I(t,e){t.innerHTML="Preço total: R$".concat(e)}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4?arguments[4]:void 0,s=document.querySelector(".ShipSmart__box-content--".concat(t)),o=document.querySelectorAll(".ShipSmart__box-card"),a=document.querySelector(".ShipSmart__box-price--".concat(t)),u=0,l=0;s.innerHTML="",document.getElementById("sycro_with_shipsmart").removeAttribute("disabled"),e.map((function(e){parseInt(e.id)-1==t&&r.push(e.items[n])})),e.map((function(i){parseInt(i.id)-1==t&&(i.items.splice(n,1),i.items.map((function(n,i){var o=document.createElement("div");o.innerHTML='<span class="ShipSmart__box-item">'.concat(n.name,' <span><i style="cursor:pointer;" class="ShipSmart__box-item--removed">x</i>'),o.querySelector(".ShipSmart__box-item--removed").onclick=function(){o.remove(),M(t,e,i,r)},s.append(o)})),u=w(i),l=x(i),i.price=u,i.weight=l,I(a,u))})),Array.from(o).map((function(t,n){var s=t.getAttribute("data-box-id"),o=t.querySelector("select"),a=t.querySelector(".ShipSmart__box-button"),u=t.querySelector(".ShipSmart__box-remove");o.innerHTML="",D(o,r),a.onclick=function(){return A(s,e,r,i)},u.onclick=function(){return P(s,e,t,r,i)}}))}function L(t,e){return parseFloat(t.weight)>parseFloat(e.weight)||parseFloat(t.height)>parseFloat(e.height)||parseFloat(t.width)>parseFloat(e.width)||parseFloat(t.lengthBox)>parseFloat(e.length)}function P(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4?arguments[4]:void 0;n.map((function(n,r){parseInt(n.id)-1==t&&(e=r,n.items.map((function(t){i.push(t)})))})),n.splice(e,1),console.log(i),r.remove();var o=document.querySelectorAll(".ShipSmart__box-card");Array.from(o).map((function(t,e){var o=t.getAttribute("data-box-id"),a=t.querySelector("select"),u=t.querySelector(".ShipSmart__box-button"),l=t.querySelector(".ShipSmart__box-remove");a.innerHTML="",D(a,i),u.onclick=function(){return A(o,n,i,s)},l.onclick=function(){return P(o,n,r,i,s)}}))}n.p;function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function O(){O=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var s=e&&e.prototype instanceof d?e:d,o=Object.create(s.prototype),a=new w(i||[]);return r(o,"_invoke",{value:b(t,n,a)}),o}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function d(){}function p(){}function f(){}var g={};u(g,s,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(x([])));v&&v!==e&&n.call(v,s)&&(g=v);var _=f.prototype=d.prototype=Object.create(g);function y(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){var i;r(this,"_invoke",{value:function(r,s){function o(){return new e((function(i,o){!function r(i,s,o,a){var u=h(t[i],t,s);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==T(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,o,a)}),(function(t){r("throw",t,o,a)})):e.resolve(c).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,a)}))}a(u.arg)}(r,s,i,o)}))}return i=i?i.then(o,o):o()}})}function b(t,e,n){var r="suspendedStart";return function(i,s){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw s;return F()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=S(o,n);if(a){if(a===c)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=h(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function S(t,e){var n=e.method,r=t.iterator[n];if(void 0===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),c;var i=h(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,c;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function x(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:F}}function F(){return{value:void 0,done:!0}}return p.prototype=f,r(_,"constructor",{value:f,configurable:!0}),r(f,"constructor",{value:p,configurable:!0}),p.displayName=u(f,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,u(t,a,"GeneratorFunction")),t.prototype=Object.create(_),t},t.awrap=function(t){return{__await:t}},y(k.prototype),u(k.prototype,o,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,r,i,s){void 0===s&&(s=Promise);var o=new k(l(e,n,r,i),s);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},y(_),u(_,a,"Generator"),u(_,s,(function(){return this})),u(_,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=x,w.prototype={constructor:w,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var a=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(a&&u){if(this.prev<s.catchLoc)return r(s.catchLoc,!0);if(this.prev<s.finallyLoc)return r(s.finallyLoc)}else if(a){if(this.prev<s.catchLoc)return r(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return r(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,c):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},t}function V(t,e,n,r,i,s,o){try{var a=t[s](o),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}var j;function R(){var t,e,n=document.getElementById("note_key"),r=document.getElementById("ss_note_key"),i=document.querySelector("#order_shipping_line_items table"),s=document.getElementById("woocomercer_order_id"),o=document.getElementById("sycro_with_shipsmart"),a=document.getElementById("update_shipsmart_order");(n.setAttribute("maxlength",44),r.value,j=s.value,f(function(){var t=function(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var s=t.apply(e,n);function o(t){V(s,r,i,o,a,"next",t)}function a(t){V(s,r,i,o,a,"throw",t)}o(void 0)}))}}(O().mark((function t(e){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.items;case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),j),i)&&(document.querySelector("#order_shipping_line_items .line_cost").append(i),null===(t=document.querySelector("#order_shipping_line_items .line_cost table"))||void 0===t||t.classList.add("Show"),null===(e=document.querySelector("#order_shipping_line_items .line_cost table th"))||void 0===e||e.classList.add("ShipSmart__order-meta"));o&&(o.onclick=q),a&&(a.onclick=N)}function q(){var t=document.getElementById("note_key"),e=document.getElementById("sycro_with_shipsmart"),n=document.createElement("img"),r="".concat(wpApiSettings.imageRefreshUrl,"refresh-icon.6e7225bab3.png");n.setAttribute("src",r),n.classList.add("ShipSmart__refresh"),n.classList.add("refresh-start"),e.append(n),function(t,e){wp.apiRequest({path:"/shipsmart/v1/sycroOrder",method:"POST",data:e}).then((function(e){return t(e)})).catch((function(t){alert("Não foi possível sincronizar seu pedido. Um erro inesperado ocorreu!"),document.location.reload()}))}((function(t){console.log(t),t&&document.location.reload()}),{note_key:t.value,order_id:j})}function N(){d(j,(function(t){document.location.reload()}))}window.updateOrders=function(){return k.apply(this,arguments)},window.createBoxDimensions=function(){var t,e,n=document.getElementById("box_weight").value,r=document.getElementById("box_height").value,i=document.getElementById("box_width").value,s=document.getElementById("box_length").value,o=document.querySelector(".Shipsmart__settings-select"),a="".concat(n,"kg - ").concat(r,"cm - ").concat(i,"cm - ").concat(s,"cm");y.push({weight:n,height:r,width:i,length:s}),t=y.length-1,e=new Option(a,t),o.append(e),o.options[t].selected=!0},window.saveBoxesDimensions=function(){return b.apply(this,arguments)},window.removeBox=function(){var t=document.querySelector(".Shipsmart__settings-select");y.splice(t.options.selectedIndex,1),t.innerHTML="",E()},window.removeItemInBox=M,window.removeBoxElement=P,window.toggleCountrySelection=function(){var t=document.getElementById("tax_mode").value,e=document.getElementById("ddp_countries_section");"custom"===t?(e.style.display="block",o()):e.style.display="none"},window.updateSelectedCountries=o,window.removeCountry=function(t){var e=document.querySelector('input[name="ddp_countries[]"][value="'.concat(t,'"]'));e&&(e.checked=!1,o())},window.selectAllCountries=function(){document.querySelectorAll('input[name="ddp_countries[]"]').forEach((function(t){t.checked=!0})),o()},window.clearAllCountries=function(){document.querySelectorAll('input[name="ddp_countries[]"]').forEach((function(t){t.checked=!1})),o()},window.onload=function(){var t,e,n,i;document.location.href.includes("post.php")?(R(),n=document.querySelector("#update_shipsmart_order"),i=document.querySelector("#note_key"),n&&i&&(i.value||n.classList.add("shipsmart-button-none"))):document.location.href.includes("admin.php?page=wc-settings")?Object(r.a)():document.location.href.includes("admin.php?page=shipsmart")&&(S(),s(),t=document.getElementById("country_search"),e=document.querySelectorAll(".Shipsmart__country-checkbox-label"),t&&t.addEventListener("input",(function(){var t=this.value.toLowerCase();e.forEach((function(e){var n=e.getAttribute("data-country"),r=e.querySelector(".Shipsmart__country-code");if(r){var i=r.textContent.toLowerCase();n.includes(t)||i.includes(t)?e.style.display="block":e.style.display="none"}}))})),o())}},246:function(t,e){},27:function(t,e,n){"use strict";function r(t,e){if(null==t)return{};var n,r,i={},s=Object.keys(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}function i(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new i.InputMask(t,e)}n.d(e,"a",(function(){return i}));class s{constructor(t){Object.assign(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},t)}aggregate(t){return this.rawInserted+=t.rawInserted,this.skip=this.skip||t.skip,this.inserted+=t.inserted,this.tailShift+=t.tailShift,this}get offset(){return this.tailShift+this.inserted.length}}function o(t){return"string"==typeof t||t instanceof String}i.ChangeDetails=s;const a="NONE",u="LEFT",l="FORCE_LEFT",h="RIGHT",c="FORCE_RIGHT";function d(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function p(t){return Array.isArray(t)?t:[t,new s]}function f(t,e){if(e===t)return!0;var n,r=Array.isArray(e),i=Array.isArray(t);if(r&&i){if(e.length!=t.length)return!1;for(n=0;n<e.length;n++)if(!f(e[n],t[n]))return!1;return!0}if(r!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){var s=e instanceof Date,o=t instanceof Date;if(s&&o)return e.getTime()==t.getTime();if(s!=o)return!1;var a=e instanceof RegExp,u=t instanceof RegExp;if(a&&u)return e.toString()==t.toString();if(a!=u)return!1;var l=Object.keys(e);for(n=0;n<l.length;n++)if(!Object.prototype.hasOwnProperty.call(t,l[n]))return!1;for(n=0;n<l.length;n++)if(!f(t[l[n]],e[l[n]]))return!1;return!0}return!(!e||!t||"function"!=typeof e||"function"!=typeof t)&&e.toString()===t.toString()}class g{constructor(t,e,n,r){for(this.value=t,this.cursorPos=e,this.oldValue=n,this.oldSelection=r;this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?a:this.oldSelection.end!==this.cursorPos&&this.oldSelection.start!==this.cursorPos||this.oldSelection.end!==this.oldSelection.start?u:h}}class m{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;this.value=t,this.from=e,this.stop=n}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||null!=t&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class v{constructor(t){this._value="",this._update(Object.assign({},v.DEFAULTS,t)),this.isInitialized=!0}updateOptions(t){Object.keys(t).length&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{input:!0};return this.reset(),this.append(t,e,""),this.doCommit(),this.value}get unmaskedValue(){return this.value}set unmaskedValue(t){this.reset(),this.append(t,{},""),this.doCommit()}get typedValue(){return this.doParse(this.value)}set typedValue(t){this.value=this.doFormat(t)}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(t){this.reset(),this.append(t,{raw:!0},""),this.doCommit()}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return Math.min(this.value.length,e-t)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e)}extractTail(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new m(this.extractInput(t,e),t)}appendTail(t){return o(t)&&(t=new m(String(t))),t.appendTo(this)}_appendCharRaw(t){return t?(this._value+=t,new s({inserted:t,rawInserted:t})):new s}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=this.state;let i;if([t,i]=p(this.doPrepare(t,e)),i=i.aggregate(this._appendCharRaw(t,e)),i.inserted){let t,o=!1!==this.doValidate(e);if(o&&null!=n){const e=this.state;!0===this.overwrite&&(t=n.state,n.unshift(this.value.length-i.tailShift));let r=this.appendTail(n);o=r.rawInserted===n.toString(),o&&r.inserted||"shift"!==this.overwrite||(this.state=e,t=n.state,n.shift(),r=this.appendTail(n),o=r.rawInserted===n.toString()),o&&r.inserted&&(this.state=e)}o||(i=new s,this.state=r,n&&t&&(n.state=t))}return i}_appendPlaceholder(){return new s}_appendEager(){return new s}append(t,e,n){if(!o(t))throw new Error("value should be string");const r=new s,i=o(n)?new m(String(n)):n;null!=e&&e.tail&&(e._beforeTailState=this.state);for(let n=0;n<t.length;++n){const s=this._appendChar(t[n],e,i);if(!s.rawInserted&&!this.doSkipInvalid(t[n],e,i))break;r.aggregate(s)}return null!=i&&(r.tailShift+=this.appendTail(i).tailShift),(!0===this.eager||"append"===this.eager)&&null!=e&&e.input&&t&&r.aggregate(this._appendEager()),r}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this._value=this.value.slice(0,t)+this.value.slice(e),new s}withValueRefresh(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;const e=this.rawInputValue,n=this.value,r=t();return this.rawInputValue=e,this.value&&this.value!==n&&0===n.indexOf(this.value)&&this.append(n.slice(this.value.length),{},""),delete this._refreshing,r}runIsolated(t){if(this._isolated||!this.isInitialized)return t(this);this._isolated=!0;const e=this.state,n=t(this);return this.state=e,delete this._isolated,n}doSkipInvalid(t){return this.skipInvalid}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare?this.prepare(t,this,e):t}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}doFormat(t){return this.format?this.format(t,this):t}doParse(t){return this.parse?this.parse(t,this):t}splice(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{input:!0};const o=t+e,d=this.extractTail(o),p=!0===this.eager||"remove"===this.eager;let f;p&&(r=function(t){switch(t){case u:return l;case h:return c;default:return t}}(r),f=this.extractInput(0,o,{raw:!0}));let g=t;const m=new s;if(r!==a&&(g=this.nearestInputPos(t,e>1&&0!==t&&!p?a:r),m.tailShift=g-t),m.aggregate(this.remove(g)),p&&r!==a&&f===this.rawInputValue)if(r===l){let t;for(;f===this.rawInputValue&&(t=this.value.length);)m.aggregate(new s({tailShift:-1})).aggregate(this.remove(t-1))}else r===c&&d.unshift();return m.aggregate(this.append(n,i,d))}maskEquals(t){return this.mask===t}typedValueEquals(t){const e=this.typedValue;return t===e||v.EMPTY_VALUES.includes(t)&&v.EMPTY_VALUES.includes(e)||this.doFormat(t)===this.doFormat(this.typedValue)}}function _(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?i.MaskedRegExp:o(t)?i.MaskedPattern:t instanceof Date||t===Date?i.MaskedDate:t instanceof Number||"number"==typeof t||t===Number?i.MaskedNumber:Array.isArray(t)||t===Array?i.MaskedDynamic:i.Masked&&t.prototype instanceof i.Masked?t:t instanceof i.Masked?t.constructor:t instanceof Function?i.MaskedFunction:(console.warn("Mask not found for mask",t),i.Masked)}function y(t){if(i.Masked&&t instanceof i.Masked)return t;const e=(t=Object.assign({},t)).mask;if(i.Masked&&e instanceof i.Masked)return e;const n=_(e);if(!n)throw new Error("Masked class is not found for provided mask, appropriate module needs to be import manually before creating mask.");return new n(t)}v.DEFAULTS={format:String,parse:t=>t,skipInvalid:!0},v.EMPTY_VALUES=[void 0,null,""],i.Masked=v,i.createMask=y;const k=["parent","isOptional","placeholderChar","displayChar","lazy","eager"],b={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class S{constructor(t){const{parent:e,isOptional:n,placeholderChar:i,displayChar:s,lazy:o,eager:a}=t,u=r(t,k);this.masked=y(u),Object.assign(this,{parent:e,isOptional:n,placeholderChar:i,displayChar:s,lazy:o,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return 0===t&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new s}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isFilled)return new s;const n=this.masked.state,r=this.masked._appendChar(t,e);return r.inserted&&!1===this.doValidate(e)&&(r.inserted=r.rawInserted="",this.masked.state=n),r.inserted||this.isOptional||this.lazy||e.input||(r.inserted=this.placeholderChar),r.skip=!r.inserted&&!this.isOptional,this.isFilled=Boolean(r.inserted),r}append(){return this.masked.append(...arguments)}_appendPlaceholder(){const t=new s;return this.isFilled||this.isOptional||(this.isFilled=!0,t.inserted=this.placeholderChar),t}_appendEager(){return new s}extractTail(){return this.masked.extractTail(...arguments)}appendTail(){return this.masked.appendTail(...arguments)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2?arguments[2]:void 0;return this.masked.extractInput(t,e,n)}nearestInputPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;const n=this.value.length,r=Math.min(Math.max(t,0),n);switch(e){case u:case l:return this.isComplete?r:0;case h:case c:return this.isComplete?r:n;case a:default:return r}}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e).length}doValidate(){return this.masked.doValidate(...arguments)&&(!this.parent||this.parent.doValidate(...arguments))}doCommit(){this.masked.doCommit()}get state(){return{masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}}class E{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new s}nearestInputPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;const n=this._value.length;switch(e){case u:case l:return 0;case a:case h:case c:default:return n}}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._isRawInput?e-t:0}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return Boolean(this._value)}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=new s;if(this.isFilled)return n;const r=!0===this.eager||"append"===this.eager,i=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!r)&&!e.tail;return i&&(n.rawInserted=this.char),this._value=n.inserted=this.char,this._isRawInput=i&&(e.raw||e.input),n}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new s;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return arguments.length>1&&void 0!==arguments[1]||this.value.length,new m("")}appendTail(t){return o(t)&&(t=new m(String(t))),t.appendTo(this)}append(t,e,n){const r=this._appendChar(t[0],e);return null!=n&&(r.tailShift+=this.appendTail(n).tailShift),r}doCommit(){}get state(){return{_value:this._value,_isRawInput:this._isRawInput}}set state(t){Object.assign(this,t)}}const A=["chunks"];class w{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;o(t)&&(t=new m(String(t)));const e=this.chunks[this.chunks.length-1],n=e&&(e.stop===t.stop||null==t.stop)&&t.from===e.from+e.toString().length;if(t instanceof m)n?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof w){if(null==t.stop){let e;for(;t.chunks.length&&null==t.chunks[0].stop;)e=t.chunks.shift(),e.from+=t.from,this.extend(e)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof i.MaskedPattern)){return new m(this.toString()).appendTo(t)}const e=new s;for(let n=0;n<this.chunks.length&&!e.skip;++n){const r=this.chunks[n],i=t._mapPosToBlock(t.value.length),s=r.stop;let o;if(null!=s&&(!i||i.index<=s)){if(r instanceof w||t._stops.indexOf(s)>=0){const n=t._appendPlaceholder(s);e.aggregate(n)}o=r instanceof w&&t._blocks[s]}if(o){const n=o.appendTail(r);n.skip=!1,e.aggregate(n),t._value+=n.inserted;const i=r.toString().slice(n.rawInserted.length);i&&e.aggregate(t.append(i,{tail:!0}))}else e.aggregate(t.append(r.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e}=t,n=r(t,A);Object.assign(this,n),this.chunks=e.map(t=>{const e="chunks"in t?new w:new m;return e.state=t,e})}unshift(t){if(!this.chunks.length||null!=t&&this.from>=t)return"";const e=null!=t?t-this.from:t;let n=0;for(;n<this.chunks.length;){const t=this.chunks[n],r=t.unshift(e);if(t.toString()){if(!r)break;++n}else this.chunks.splice(n,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],n=e.shift();if(e.toString()){if(!n)break;--t}else this.chunks.splice(t,1);if(n)return n}return""}}class x{constructor(t,e){this.masked=t,this._log=[];const{offset:n,index:r}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,this.index=r,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return this.state=t,t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.value.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=(null===(e=this.block)||void 0===e?void 0:e.value.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,l),0!==this.offset||void 0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,u),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,u),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!this.block.isFixed&&this.block.value)return this.offset=this.block.nearestInputPos(this.offset,c),this.offset!==this.block.value.length||void 0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,a),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,a),!0})}}i.MaskedRegExp=class extends v{_update(t){t.mask&&(t.validate=e=>e.search(t.mask)>=0),super._update(t)}};const F=["_blocks"];class C extends v{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},b,t.definitions),super(Object.assign({},C.DEFAULTS,t))}_update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this._stops=[],this._maskedBlocks={};let e=this.mask;if(!e||!t)return;let n=!1,r=!1;for(let a=0;a<e.length;++a){var s,o;if(this.blocks){const t=e.slice(a),n=Object.keys(this.blocks).filter(e=>0===t.indexOf(e));n.sort((t,e)=>e.length-t.length);const r=n[0];if(r){const t=y(Object.assign({parent:this,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite},this.blocks[r]));t&&(this._blocks.push(t),this._maskedBlocks[r]||(this._maskedBlocks[r]=[]),this._maskedBlocks[r].push(this._blocks.length-1)),a+=r.length-1;continue}}let u=e[a],l=u in t;if(u===C.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===u||"}"===u){n=!n;continue}if("["===u||"]"===u){r=!r;continue}if(u===C.ESCAPE_CHAR){if(++a,u=e[a],!u)break;l=!1}const h=null===(s=t[u])||void 0===s||!s.mask||(null===(o=t[u])||void 0===o?void 0:o.mask.prototype)instanceof i.Masked?{mask:t[u]}:t[u],c=l?new S(Object.assign({parent:this,isOptional:r,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar},h)):new E({char:u,eager:this.eager,isUnmasking:n});this._blocks.push(c)}}get state(){return Object.assign({},super.state,{_blocks:this._blocks.map(t=>t.state)})}set state(t){const{_blocks:e}=t,n=r(t,F);this._blocks.forEach((t,n)=>t.state=e[n]),super.state=n}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this._blocks.reduce((t,e)=>t+e.unmaskedValue,"")}set unmaskedValue(t){super.unmaskedValue=t}get value(){return this._blocks.reduce((t,e)=>t+e.value,"")}set value(t){super.value=t}get displayValue(){return this._blocks.reduce((t,e)=>t+e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new s;let n=null===(t=this._mapPosToBlock(this.value.length))||void 0===t?void 0:t.index;if(null==n)return e;this._blocks[n].isFilled&&++n;for(let t=n;t<this._blocks.length;++t){const n=this._blocks[t]._appendEager();if(!n.inserted)break;e.aggregate(n)}return e}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this._mapPosToBlock(this.value.length),r=new s;if(!n)return r;for(let s=n.index;;++s){var i,o;const n=this._blocks[s];if(!n)break;const a=n._appendChar(t,Object.assign({},e,{_beforeTailState:null===(i=e._beforeTailState)||void 0===i||null===(o=i._blocks)||void 0===o?void 0:o[s]})),u=a.skip;if(r.aggregate(a),u||a.rawInserted)break}return r}extractTail(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const n=new w;return t===e||this._forEachBlocksInRange(t,e,(t,e,r,i)=>{const s=t.extractTail(r,i);s.stop=this._findStopBefore(e),s.from=this._blockStartPos(e),s instanceof w&&(s.blockIndex=e),n.extend(s)}),n}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";let r="";return this._forEachBlocksInRange(t,e,(t,e,i,s)=>{r+=t.extractInput(i,s,n)}),r}_findStopBefore(t){let e;for(let n=0;n<this._stops.length;++n){const r=this._stops[n];if(!(r<=t))break;e=r}return e}_appendPlaceholder(t){const e=new s;if(this.lazy&&null==t)return e;const n=this._mapPosToBlock(this.value.length);if(!n)return e;const r=n.index,i=null!=t?t:this._blocks.length;return this._blocks.slice(r,i).forEach(n=>{if(!n.lazy||null!=t){const t=null!=n._blocks?[n._blocks.length]:[],r=n._appendPlaceholder(...t);this._value+=r.inserted,e.aggregate(r)}}),e}_mapPosToBlock(t){let e="";for(let n=0;n<this._blocks.length;++n){const r=this._blocks[n],i=e.length;if(e+=r.value,t<=e.length)return{index:n,offset:t-i}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+e.value.length,0)}_forEachBlocksInRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2?arguments[2]:void 0;const r=this._mapPosToBlock(t);if(r){const t=this._mapPosToBlock(e),i=t&&r.index===t.index,s=r.offset,o=t&&i?t.offset:this._blocks[r.index].value.length;if(n(this._blocks[r.index],r.index,s,o),t&&!i){for(let e=r.index+1;e<t.index;++e)n(this._blocks[e],e,0,this._blocks[e].value.length);n(this._blocks[t.index],t.index,0,t.offset)}}}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const n=super.remove(t,e);return this._forEachBlocksInRange(t,e,(t,e,r,i)=>{n.aggregate(t.remove(r,i))}),n}nearestInputPos(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;if(!this._blocks.length)return 0;const n=new x(this,t);if(e===a)return n.pushRightBeforeInput()?n.pos:(n.popState(),n.pushLeftBeforeInput()?n.pos:this.value.length);if(e===u||e===l){if(e===u){if(n.pushRightBeforeFilled(),n.ok&&n.pos===t)return t;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),e===u){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=t)return n.pos;if(n.popState(),n.ok&&n.pos<=t)return n.pos;n.popState()}return n.ok?n.pos:e===l?0:(n.popState(),n.ok?n.pos:(n.popState(),n.ok?n.pos:0))}return e===h||e===c?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:e===c?this.value.length:(n.popState(),n.ok?n.pos:(n.popState(),n.ok?n.pos:this.nearestInputPos(t,u)))):t}totalInputPositions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=0;return this._forEachBlocksInRange(t,e,(t,e,r,i)=>{n+=t.totalInputPositions(r,i)}),n}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(t=>this._blocks[t]):[]}}C.DEFAULTS={lazy:!0,placeholderChar:"_"},C.STOP_CHAR="`",C.ESCAPE_CHAR="\\",C.InputDefinition=S,C.FixedDefinition=E,i.MaskedPattern=C;class B extends C{get _matchFrom(){return this.maxLength-String(this.from).length}_update(t){t=Object.assign({to:this.to||0,from:this.from||0,maxLength:this.maxLength||0},t);let e=String(t.to).length;null!=t.maxLength&&(e=Math.max(e,t.maxLength)),t.maxLength=e;const n=String(t.from).padStart(e,"0"),r=String(t.to).padStart(e,"0");let i=0;for(;i<r.length&&r[i]===n[i];)++i;t.mask=r.slice(0,i).replace(/0/g,"\\0")+"0".repeat(e-i),super._update(t)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",n="";const[,r,i]=t.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(e="0".repeat(r.length)+i,n="9".repeat(r.length)+i),e=e.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[e,n]}doPrepare(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if([t,e]=p(super.doPrepare(t.replace(/\D/g,""),n)),!this.autofix||!t)return t;const r=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0");let s=this.value+t;if(s.length>this.maxLength)return"";const[o,a]=this.boundaries(s);return Number(a)<this.from?r[s.length-1]:Number(o)>this.to?"pad"===this.autofix&&s.length<this.maxLength?["",e.aggregate(this.append(r[s.length-1]+t,n))]:i[s.length-1]:t}doValidate(){const t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;const[e,n]=this.boundaries(t);return this.from<=Number(n)&&Number(e)<=this.to&&super.doValidate(...arguments)}}i.MaskedRange=B;class D extends C{constructor(t){super(Object.assign({},D.DEFAULTS,t))}_update(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern);const e=t.blocks;t.blocks=Object.assign({},D.GET_DEFAULT_BLOCKS()),t.min&&(t.blocks.Y.from=t.min.getFullYear()),t.max&&(t.blocks.Y.to=t.max.getFullYear()),t.min&&t.max&&t.blocks.Y.from===t.blocks.Y.to&&(t.blocks.m.from=t.min.getMonth()+1,t.blocks.m.to=t.max.getMonth()+1,t.blocks.m.from===t.blocks.m.to&&(t.blocks.d.from=t.min.getDate(),t.blocks.d.to=t.max.getDate())),Object.assign(t.blocks,this.blocks,e),Object.keys(t.blocks).forEach(e=>{const n=t.blocks[e];!("autofix"in n)&&"autofix"in t&&(n.autofix=t.autofix)}),super._update(t)}doValidate(){const t=this.date;return super.doValidate(...arguments)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}}D.DEFAULTS={pattern:"d{.}`m{.}`Y",format:t=>{if(!t)return"";return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:t=>{const[e,n,r]=t.split(".");return new Date(r,n-1,e)}},D.GET_DEFAULT_BLOCKS=()=>({d:{mask:B,from:1,to:31,maxLength:2},m:{mask:B,from:1,to:12,maxLength:2},Y:{mask:B,from:1900,to:9999}}),i.MaskedDate=D;class I{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch(t){}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch(t){}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch(t){}}_unsafeSelect(t,e){}get isActive(){return!1}bindEvents(t){}unbindEvents(){}}i.MaskElement=I;class M extends I{constructor(t){super(),this.input=t,this._handlers={}}get rootElement(){var t,e,n;return null!==(t=null===(e=(n=this.input).getRootNode)||void 0===e?void 0:e.call(n))&&void 0!==t?t:document}get isActive(){return this.input===this.rootElement.activeElement}get _unsafeSelectionStart(){return this.input.selectionStart}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}bindEvents(t){Object.keys(t).forEach(e=>this._toggleEventHandler(M.EVENTS_MAP[e],t[e]))}unbindEvents(){Object.keys(this._handlers).forEach(t=>this._toggleEventHandler(t))}_toggleEventHandler(t,e){this._handlers[t]&&(this.input.removeEventListener(t,this._handlers[t]),delete this._handlers[t]),e&&(this.input.addEventListener(t,e),this._handlers[t]=e)}}M.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"},i.HTMLMaskElement=M;class L extends M{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),n=e&&e.anchorOffset,r=e&&e.focusOffset;return null==r||null==n||n<r?n:r}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),n=e&&e.anchorOffset,r=e&&e.focusOffset;return null==r||null==n||n>r?n:r}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,t),n.setEnd(this.input.lastChild||this.input,e);const r=this.rootElement,i=r.getSelection&&r.getSelection();i&&(i.removeAllRanges(),i.addRange(n))}get value(){return this.input.textContent}set value(t){this.input.textContent=t}}i.HTMLContenteditableMaskElement=L;const P=["mask"];i.InputMask=class{constructor(t,e){this.el=t instanceof I?t:t.isContentEditable&&"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName?new L(t):new M(t),this.masked=y(e),this._listeners={},this._value="",this._unmaskedValue="",this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}get mask(){return this.masked.mask}maskEquals(t){var e;return null==t||(null===(e=this.masked)||void 0===e?void 0:e.maskEquals(t))}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof i.Masked)&&this.masked.constructor===_(t))return void this.masked.updateOptions({mask:t});const e=y({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl(),this.alignCursor())}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl(),this.alignCursor())}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];const i=this._listeners[t];i&&i.forEach(t=>t(...n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el&&this.el.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value}updateControl(){const t=this.masked.unmaskedValue,e=this.masked.value,n=this.displayValue,r=this.unmaskedValue!==t||this.value!==e;this._unmaskedValue=t,this._value=e,this.el.value!==n&&(this.el.value=n),r&&this._fireChangeEvents()}updateOptions(t){const{mask:e}=t,n=r(t,P),i=!this.maskEquals(e),s=!f(this.masked,n);i&&(this.mask=e),s&&this.masked.updateOptions(n),(i||s)&&this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,u))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const n=this._listeners[t].indexOf(e);return n>=0&&this._listeners[t].splice(n,1),this}_onInput(t){if(this._inputEvent=t,this._abortUpdateCursor(),!this._selection)return this.updateValue();const e=new g(this.el.value,this.cursorPos,this.displayValue,this._selection),n=this.masked.rawInputValue,r=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,i=n===this.masked.rawInputValue?e.removeDirection:a;let s=this.masked.nearestInputPos(e.startChangePos+r,i);i!==a&&(s=this.masked.nearestInputPos(s,a)),this.updateControl(),this.updateCursor(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}};i.MaskedEnum=class extends C{_update(t){t.enum&&(t.mask="*".repeat(t.enum[0].length)),super._update(t)}doValidate(){return this.enum.some(t=>t.indexOf(this.unmaskedValue)>=0)&&super.doValidate(...arguments)}};class T extends v{constructor(t){super(Object.assign({},T.DEFAULTS,t))}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){let t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"(".concat(d(this.radix),"\\d{0,").concat(this.scale,"})?"):"")+"$";this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("[".concat(this.mapToRadix.map(d).join(""),"]"),"g"),this._thousandsSeparatorRegExp=new RegExp(d(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t);const[n,r]=p(super.doPrepare(t,e));return t&&!n&&(r.skip=!0),[n,r]}_separatorsCount(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=0;for(let r=0;r<t;++r)this._value.indexOf(this.thousandsSeparator,r)===r&&(++n,e&&(t+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._value;return this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2?arguments[2]:void 0;return[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,n))}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.thousandsSeparator)return super._appendCharRaw(t,e);const n=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,r=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const i=super._appendCharRaw(t,e);this._value=this._insertThousandsSeparators(this._value);const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(s);return i.tailShift+=(o-r)*this.thousandsSeparator.length,i.skip=!i.rawInserted&&t===this.thousandsSeparator,i}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,e);if(n<=t)return n}return-1}_adjustRangeWithSeparators(t,e){const n=this._findSeparatorAround(t);n>=0&&(t=n);const r=this._findSeparatorAround(e);return r>=0&&(e=r+this.thousandsSeparator.length),[t,e]}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;[t,e]=this._adjustRangeWithSeparators(t,e);const n=this.value.slice(0,t),r=this.value.slice(e),i=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+r));const o=this._separatorsCountFromSlice(n);return new s({tailShift:(o-i)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case a:case u:case l:{const n=this._findSeparatorAround(t-1);if(n>=0){const r=n+this.thousandsSeparator.length;if(t<r||this.value.length<=r||e===l)return n}break}case h:case c:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return t}doValidate(t){let e=Boolean(this._removeThousandsSeparators(this.value).match(this._numberRegExp));if(e){const t=this.number;e=e&&!isNaN(t)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return e&&super.doValidate(t)}doCommit(){if(this.value){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.doFormat(e));let n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&this.scale>0&&(n=this._padFractionalZeros(n)),this._value=n}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,n,r)=>e+r),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=0===this.scale&&t!==this.thousandsSeparator&&(t===this.radix||t===T.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,n)&&!r}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,T.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.doParse(this.unmaskedValue)}set typedValue(t){this.rawInputValue=this.doFormat(t).replace(T.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}typedValueEquals(t){return(super.typedValueEquals(t)||T.EMPTY_VALUES.includes(t)&&T.EMPTY_VALUES.includes(this.typedValue))&&!(0===t&&""===this.value)}}T.UNMASKED_RADIX=".",T.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:[T.UNMASKED_RADIX],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:t=>t.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},T.EMPTY_VALUES=[...v.EMPTY_VALUES,0],i.MaskedNumber=T;i.MaskedFunction=class extends v{_update(t){t.mask&&(t.validate=t.mask),super._update(t)}};const O=["compiledMasks","currentMaskRef","currentMask"],V=["mask"];class j extends v{constructor(t){super(Object.assign({},j.DEFAULTS,t)),this.currentMask=null}_update(t){super._update(t),"mask"in t&&(this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>y(t)):[])}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this._applyDispatch(t,e);return this.currentMask&&n.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),n}_applyDispatch(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,i=this.rawInputValue,o=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:i,a=i.slice(o.length),u=this.currentMask,l=new s,h=null==u?void 0:u.state;if(this.currentMask=this.doDispatch(t,Object.assign({},e),n),this.currentMask)if(this.currentMask!==u){if(this.currentMask.reset(),o){const t=this.currentMask.append(o,{raw:!0});l.tailShift=t.inserted.length-r.length}a&&(l.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)}else this.currentMask.state=h;return l}_appendPlaceholder(){const t=this._applyDispatch(...arguments);return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch(...arguments);return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new s;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,n;return Object.assign({},t,{_beforeTailState:(null===(e=t._beforeTailState)||void 0===e?void 0:e.currentMaskRef)===this.currentMask&&(null===(n=t._beforeTailState)||void 0===n?void 0:n.currentMask)||t._beforeTailState})}doDispatch(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this.dispatch(t,this,e,n)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},[n,r]=p(super.doPrepare(t,e));if(this.currentMask){let t;[n,t]=p(super.doPrepare(n,this.currentMaskFlags(e))),r=r.aggregate(t)}return[n,r]}reset(){var t;null===(t=this.currentMask)||void 0===t||t.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(t){super.value=t}get unmaskedValue(){return this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.currentMask?this.currentMask.typedValue:""}set typedValue(t){let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return Boolean(null===(t=this.currentMask)||void 0===t?void 0:t.isComplete)}get isFilled(){var t;return Boolean(null===(t=this.currentMask)||void 0===t?void 0:t.isFilled)}remove(){const t=new s;return this.currentMask&&t.aggregate(this.currentMask.remove(...arguments)).aggregate(this._applyDispatch()),t}get state(){var t;return Object.assign({},super.state,{_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:null===(t=this.currentMask)||void 0===t?void 0:t.state})}set state(t){const{compiledMasks:e,currentMaskRef:n,currentMask:i}=t,s=r(t,O);this.compiledMasks.forEach((t,n)=>t.state=e[n]),null!=n&&(this.currentMask=n,this.currentMask.state=i),super.state=s}extractInput(){return this.currentMask?this.currentMask.extractInput(...arguments):""}extractTail(){return this.currentMask?this.currentMask.extractTail(...arguments):super.extractTail(...arguments)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(){return this.currentMask?this.currentMask.nearestInputPos(...arguments):super.nearestInputPos(...arguments)}get overwrite(){return this.currentMask?this.currentMask.overwrite:super.overwrite}set overwrite(t){console.warn('"overwrite" option is not available in dynamic mask, use this option in siblings')}get eager(){return this.currentMask?this.currentMask.eager:super.eager}set eager(t){console.warn('"eager" option is not available in dynamic mask, use this option in siblings')}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:super.skipInvalid}set skipInvalid(t){(this.isInitialized||t!==v.DEFAULTS.skipInvalid)&&console.warn('"skipInvalid" option is not available in dynamic mask, use this option in siblings')}maskEquals(t){return Array.isArray(t)&&this.compiledMasks.every((e,n)=>{if(!t[n])return;const i=t[n],{mask:s}=i;return f(e,r(i,V))&&e.maskEquals(s)})}typedValueEquals(t){var e;return Boolean(null===(e=this.currentMask)||void 0===e?void 0:e.typedValueEquals(t))}}j.DEFAULTS={dispatch:(t,e,n,r)=>{if(!e.compiledMasks.length)return;const i=e.rawInputValue,s=e.compiledMasks.map((s,o)=>{const a=e.currentMask===s,u=a?s.value.length:s.nearestInputPos(s.value.length,l);return s.rawInputValue!==i?(s.reset(),s.append(i,{raw:!0})):a||s.remove(u),s.append(t,e.currentMaskFlags(n)),s.appendTail(r),{index:o,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(u,s.nearestInputPos(s.value.length,l)))}});return s.sort((t,e)=>e.weight-t.weight||e.totalInputPositions-t.totalInputPositions),e.compiledMasks[s[0].index]}},i.MaskedDynamic=j;const R={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function q(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R.MASKED,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:R.MASKED;const r=y(t);return t=>r.runIsolated(r=>(r[e]=t,r[n]))}i.PIPE_TYPE=R,i.createPipe=q,i.pipe=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return q(...n)(t)};try{globalThis.IMask=i}catch(t){}},47:function(t,e){t.exports=jQuery},82:function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return s}));n(27);function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,s=function(){};return{s:s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s(){var e=document.querySelector(".woocommerce-page.woocommerce-embed-page");e&&new MutationObserver(a).observe(e,{childList:!0});t(document.body).on("wc_backbone_modal_loaded",(function(t,e){"wc-modal-shipping-method-settings"===e&&o()}))}function o(){var t=document.querySelector("#woocommerce_ssfw_shipping_method_title"),e=document.querySelector("#woocommerce_ssfw_shipping_method_contract");(t||e)&&e.addEventListener("change",(function(){t.value=e.options[e.selectedIndex].text}))}function a(t,e){var n,i=r(t);try{for(i.s();!(n=i.n()).done;){n.value.addedNodes.forEach((function(t){o()}))}}catch(t){i.e(t)}finally{i.f()}}}).call(this,n(47))}}); -
shipsmart/trunk/dist/styles/admin.css
r3294989 r3447136 1 .Shipsmart__settings-tab{margin-top:30px;overflow:hidden;background-color:#f1f1f1;border-bottom:1px solid #ccc}.Shipsmart__settings-tab button{background-color:inherit;float:left;outline:none;cursor:pointer;border:1px solid #ccc;margin-right:10px;padding:10px 16px;transition:.3s;color:#000;background-color:#ccc}.Shipsmart__settings-tab button:hover{background-color:#f0f0f1}.Shipsmart__settings-tab button.active{background-color:#f0f0f1;border-bottom:1px solid #f0f0f1}.Shipsmart__settings-form{animation:fadeEffect 1s;flex-direction:column;padding:20px;background-color:#f0f0f1;display:none;border-top:none}.Shipsmart__settings-description{margin:30px 0 30px 0;font-size:15px}.Shipsmart__settings-description--acount{line-height:25px;font-size:15px}.Shipsmart__settings-inputs{display:flex;align-items:center;margin:2vh 0}.Shipsmart__settings-label{width:auto;margin-right:10px}.Shipsmart__settings-label-content{font-weight:bold;width:300px}.Shipsmart__settings-input{width:280px;height:33px}.Shipsmart__settings-input.checkbox{margin-left:15px}.Shipsmart__settings-input-group{display:flex;align-items:baseline;margin-bottom:15px}.Shipsmart__settings-checked{color:#34c834}.Shipsmart__settings-unchecked{color:#c82d2d}.Shipsmart__settings-legend{font-size:10px;margin:0;font-style:italic;color:gray}.Shipsmart__settings-save-button{margin-top:44px;width:220px;display:inline-block;padding:8px 2em;border-radius:7px;background:linear-gradient(to right, #fcbf0a 0%, #ff9c00 100%) !important;color:#fff !important;text-transform:uppercase;text-decoration:none;cursor:pointer;border:none}.Shipsmart__settings-save-button:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,.3);overflow:hidden}.Shipsmart__settings-measure{width:5vw;margin-right:2vh}.Shipsmart__settings-separator{border:0 none;background-color:#000;width:100%;height:1px}.Shipsmart__measures-label{font-weight:bold}.Shipsmart__tutorial-section{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:2vh}.Shipsmart__tutorial-title{font-size:1.2em;font-weight:bold}.Shipsmart__tutorial-steps{display:flex;flex-direction:column;align-items:flex-start}.Shipsmart__tutorial-step{font-size:1.2em}.Shipsmart__tutorial-label{font-size:1em;margin-left:1vh} #shipping .sections .section>div{display:grid;grid-template-columns:300px 500px;margin:20px 0}#shipping .sections .section>div input[type=text],#shipping .sections .section>div select{width:400px;height:35px}#shipping .sections .section>div input[type=number]{width:70px;height:35px}#shipping .sections .section>div span{font-size:14px}#shipping .sections .section>div>div{display:flex;align-items:center}.ShipSmart__order-notekey{display:flex;flex-direction:column}.ShipSmart__order-notekey p{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:flex-start}.ShipSmart__order-notekey p label{margin-left:1vw;min-width:10%}.ShipSmart__order-input{width:80%}.ShipSmart__order-input.checkbox{margin-left:15px}.ShipSmart__order-input-group{display:flex;align-items:baseline;margin-bottom:15px}.ShipSmart__order-field{display:flex;flex-direction:column;width:40%}.ShipSmart__order-status{display:flex;flex-direction:column}.ShipSmart__order-documents{display:flex;flex-direction:column}.ShipSmart__order-documents-title{font-weight:bold !important}.ShipSmart__order-update{margin-top:44px;width:220px;display:inline-block;padding:8px 2em;border-radius:7px;background:linear-gradient(to right, #fcbf0a 0%, #ff9c00 100%) !important;color:#fff !important;text-transform:uppercase;text-decoration:none;cursor:pointer;border:none}.ShipSmart__order-update:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,.3);overflow:hidden}.ShipSmart__order-group{display:flex;justify-content:flex-start;align-items:center;height:5vh}.ShipSmart__order-group--label{min-width:20%}.ShipSmart__order-group--link{min-width:20%;margin:3vh 0 3vh 1vw}.ShipSmart__order-button{margin:1vw !important}.ShipSmart__order-meta{min-width:7vw}#order_shipping_line_items table{display:none}.Show{display:flex !important}.ShipSmart__section{color:#2b6c98;font-size:1.3em;margin:1em .5em}.ShipSmart__box{display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start}.ShipSmart__box-options{display:flex;flex-direction:row;align-items:center;justify-content:space-evenly;margin-left:1vw}.ShipSmart__box-options select{margin-right:1vh;border:2px solid #135e96;border-radius:5px;color:#135e96}.ShipSmart__box-content{margin-top:2vh;display:flex;flex-wrap:wrap}.ShipSmart__box-card{display:flex;flex-direction:column;align-items:flex-start;border:1px solid #ccc;width:30vw;margin-right:1vw;margin-bottom:1vh}.ShipSmart__box-header{padding:0;border-bottom:1px solid #ccc;width:100%;background-color:#ccc;display:flex;justify-content:space-between;align-items:center}.ShipSmart__box-title{padding:0;margin-top:1vh}.ShipSmart__box-body{display:flex;flex-direction:column;width:100%}.ShipSmart__box-group{display:flex;flex-direction:row;align-items:center;justify-content:space-evenly;margin:1vh 2vh}.ShipSmart__box-group select{width:100%;margin-right:1vh;border:2px solid #135e96;border-radius:5px;color:#135e96}.ShipSmart__box-items{width:100%;display:flex;justify-content:center;margin:1vh 0;min-height:5vh;flex-direction:column;align-items:center}.ShipSmart__box-items div{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.ShipSmart__box-item{margin-right:1vh}.ShipSmart__box-item--removed{cursor:pointer;margin-left:1vw}.ShipSmart__box-footer{width:100%;display:flex;margin-top:2vh;justify-content:flex-start;border-top:1px solid #ccc;background-color:#ccc;height:3vh;align-items:center}.ShipSmart__box-remove{margin-right:1vh !important}.ShipSmart__order-buttons{align-self:end}.ShipSmart__order-buttons .shipsmart-button-none{display:none}@keyframes rotate{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.ShipSmart__refresh{width:10px;height:10px;margin-left:1vh}.refresh-start{animation-name:rotate;animation-duration:1s;animation-iteration-count:infinite;animation-timing-function:linear;animation-play-state:running}.Hidden{display:none}1 .Shipsmart__settings-tab{margin-top:30px;overflow:hidden;background-color:#f1f1f1;border-bottom:1px solid #ccc}.Shipsmart__settings-tab button{background-color:inherit;float:left;outline:none;cursor:pointer;border:1px solid #ccc;margin-right:10px;padding:10px 16px;transition:.3s;color:#000;background-color:#ccc}.Shipsmart__settings-tab button:hover{background-color:#f0f0f1}.Shipsmart__settings-tab button.active{background-color:#f0f0f1;border-bottom:1px solid #f0f0f1}.Shipsmart__settings-form{animation:fadeEffect 1s;flex-direction:column;padding:20px;background-color:#f0f0f1;display:none;border-top:none}.Shipsmart__settings-description{margin:30px 0 30px 0;font-size:15px}.Shipsmart__settings-description--acount{line-height:25px;font-size:15px}.Shipsmart__settings-inputs{display:flex;align-items:center;margin:2vh 0}.Shipsmart__settings-label{width:auto;margin-right:10px}.Shipsmart__settings-label-content{font-weight:bold;width:300px}.Shipsmart__settings-input{width:280px;height:33px}.Shipsmart__settings-input.checkbox{margin-left:15px}.Shipsmart__settings-input-group{display:flex;align-items:baseline;margin-bottom:15px}.Shipsmart__settings-checked{color:#34c834}.Shipsmart__settings-unchecked{color:#c82d2d}.Shipsmart__settings-legend{font-size:10px;margin:0;font-style:italic;color:gray}.Shipsmart__settings-save-button{margin-top:44px;width:220px;display:inline-block;padding:8px 2em;border-radius:7px;background:linear-gradient(to right, #fcbf0a 0%, #ff9c00 100%) !important;color:#fff !important;text-transform:uppercase;text-decoration:none;cursor:pointer;border:none}.Shipsmart__settings-save-button:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,.3);overflow:hidden}.Shipsmart__settings-measure{width:5vw;margin-right:2vh}.Shipsmart__settings-separator{border:0 none;background-color:#000;width:100%;height:1px}.Shipsmart__measures-label{font-weight:bold}.Shipsmart__tutorial-section{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:2vh}.Shipsmart__tutorial-title{font-size:1.2em;font-weight:bold}.Shipsmart__tutorial-steps{display:flex;flex-direction:column;align-items:flex-start}.Shipsmart__tutorial-step{font-size:1.2em}.Shipsmart__tutorial-label{font-size:1em;margin-left:1vh}.Shipsmart__country-selection-section{margin-top:15px;padding:20px;background:#f9f9f9;border:1px solid #e5e5e5;border-radius:5px}.Shipsmart__country-header h4{margin:0 0 5px 0;color:#333}.Shipsmart__country-header .description{margin:0 0 5px 8px;color:#666;font-style:italic}.Shipsmart__country-search-container{display:flex;gap:10px;margin-bottom:15px;align-items:center}.Shipsmart__country-search-input{flex:1;padding:8px 12px;border:1px solid #ddd;border-radius:3px;font-size:14px}.Shipsmart__country-actions{display:flex;gap:5px}.Shipsmart__country-list-container{max-height:300px;overflow-y:auto;border:1px solid #ddd;border-radius:3px;background:#fff}.Shipsmart__country-checkboxes{padding:10px}.Shipsmart__country-checkbox-label{display:block;padding:5px 10px;border-bottom:1px solid #f0f0f0;cursor:pointer;transition:background-color .2s}.Shipsmart__country-checkbox-label:hover{background-color:#f5f5f5}.Shipsmart__country-checkbox-label:last-child{border-bottom:none}.Shipsmart__country-checkbox-label input{margin-right:8px}.Shipsmart__country-name{font-weight:500}.Shipsmart__country-code{color:#666;font-size:12px;margin-left:5px}.Shipsmart__selected-countries-display{margin-bottom:15px;padding:10px;background:#fff;border:1px solid #ddd;border-radius:3px}.Shipsmart__selected-countries-list{margin:0 0 0 8px;display:flex;flex-wrap:wrap;gap:5px}.Shipsmart__selected-country-tag{display:inline-flex;align-items:center;background:#0073aa;color:#fff;padding:4px 8px;border-radius:3px;font-size:12px;gap:5px}.Shipsmart__remove-country{background:none;border:none;color:#fff;font-size:16px;line-height:1;cursor:pointer;padding:0;margin:0}.Shipsmart__remove-country:hover{background:rgba(255,255,255,.2);border-radius:2px}.Shipsmart__no-selection{color:#666;font-style:italic}#shipping .sections .section>div{display:grid;grid-template-columns:300px 500px;margin:20px 0}#shipping .sections .section>div input[type=text],#shipping .sections .section>div select{width:400px;height:35px}#shipping .sections .section>div input[type=number]{width:70px;height:35px}#shipping .sections .section>div span{font-size:14px}#shipping .sections .section>div>div{display:flex;align-items:center}.ShipSmart__order-notekey{display:flex;flex-direction:column}.ShipSmart__order-notekey p{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:flex-start}.ShipSmart__order-notekey p label{margin-left:1vw;min-width:10%}.ShipSmart__order-input{width:80%}.ShipSmart__order-input.checkbox{margin-left:15px}.ShipSmart__order-input-group{display:flex;align-items:baseline;margin-bottom:15px}.ShipSmart__order-field{display:flex;flex-direction:column;width:40%}.ShipSmart__order-status{display:flex;flex-direction:column}.ShipSmart__order-documents{display:flex;flex-direction:column}.ShipSmart__order-documents-title{font-weight:bold !important}.ShipSmart__order-update{margin-top:44px;width:220px;display:inline-block;padding:8px 2em;border-radius:7px;background:linear-gradient(to right, #fcbf0a 0%, #ff9c00 100%) !important;color:#fff !important;text-transform:uppercase;text-decoration:none;cursor:pointer;border:none}.ShipSmart__order-update:hover{box-shadow:0 8px 16px 0 rgba(0,0,0,.3);overflow:hidden}.ShipSmart__order-group{display:flex;justify-content:flex-start;align-items:center;height:5vh}.ShipSmart__order-group--label{min-width:20%}.ShipSmart__order-group--link{min-width:20%;margin:3vh 0 3vh 1vw}.ShipSmart__order-button{margin:1vw !important}.ShipSmart__order-meta{min-width:7vw}#order_shipping_line_items table{display:none}.Show{display:flex !important}.ShipSmart__section{color:#2b6c98;font-size:1.3em;margin:1em .5em}.ShipSmart__box{display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start}.ShipSmart__box-options{display:flex;flex-direction:row;align-items:center;justify-content:space-evenly;margin-left:1vw}.ShipSmart__box-options select{margin-right:1vh;border:2px solid #135e96;border-radius:5px;color:#135e96}.ShipSmart__box-content{margin-top:2vh;display:flex;flex-wrap:wrap}.ShipSmart__box-card{display:flex;flex-direction:column;align-items:flex-start;border:1px solid #ccc;width:30vw;margin-right:1vw;margin-bottom:1vh}.ShipSmart__box-header{padding:0;border-bottom:1px solid #ccc;width:100%;background-color:#ccc;display:flex;justify-content:space-between;align-items:center}.ShipSmart__box-title{padding:0;margin-top:1vh}.ShipSmart__box-body{display:flex;flex-direction:column;width:100%}.ShipSmart__box-group{display:flex;flex-direction:row;align-items:center;justify-content:space-evenly;margin:1vh 2vh}.ShipSmart__box-group select{width:100%;margin-right:1vh;border:2px solid #135e96;border-radius:5px;color:#135e96}.ShipSmart__box-items{width:100%;display:flex;justify-content:center;margin:1vh 0;min-height:5vh;flex-direction:column;align-items:center}.ShipSmart__box-items div{display:flex;flex-direction:row;align-items:center;justify-content:space-between}.ShipSmart__box-item{margin-right:1vh}.ShipSmart__box-item--removed{cursor:pointer;margin-left:1vw}.ShipSmart__box-footer{width:100%;display:flex;margin-top:2vh;justify-content:flex-start;border-top:1px solid #ccc;background-color:#ccc;height:3vh;align-items:center}.ShipSmart__box-remove{margin-right:1vh !important}.ShipSmart__order-buttons{align-self:end}.ShipSmart__order-buttons .shipsmart-button-none{display:none}@keyframes rotate{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.ShipSmart__refresh{width:10px;height:10px;margin-left:1vh}.refresh-start{animation-name:rotate;animation-duration:1s;animation-iteration-count:infinite;animation-timing-function:linear;animation-play-state:running}.Hidden{display:none} -
shipsmart/trunk/readme.txt
r3296433 r3447136 1 1 === Shipping with ShipSmart for WooCommerce === 2 2 3 Contributors: apiki, joaovictorviana 3 Contributors: apiki, joaovictorviana, lucastgama 4 4 Tags: checkout, woocommerce, cart, shipsmart, ship, smart 5 5 Requires at least: 5.0 6 6 Requires PHP: 7.4 7 7 Tested up to: 6.8.1 8 Stable tag: 1.1. 18 Stable tag: 1.1.2 9 9 License: GPLv3 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 65 65 66 66 == Changelog == 67 = 1.1.2 - 25/08/2025 = 68 - **Melhoria:** Adição da nova funcionalidade de IOR. 69 - **Melhoria:** Adição da nova funcionalidade de DDP e DDU. 70 - **Melhoria:** Limitando quantidade de caracteres no nome do produto. 71 67 72 = 1.1.1 - 19/05/2025 = 68 73 - **Correção:** Verificação de compatibilidade com WordPress 6.8.1. -
shipsmart/trunk/resources/scripts/admin/index.js
r3294989 r3447136 5 5 import { loadSettingsModal } from './settings/ship'; 6 6 import { handleSettingsPage } from './settings/settings'; 7 import { 8 handleCountrySettings, 9 toggleCountrySelection, 10 updateSelectedCountries, 11 removeCountry, 12 selectAllCountries, 13 clearAllCountries 14 } from './settings/country'; 7 15 8 16 import { … … 21 29 import { removeItemInBox, removeBoxElement } from './services/box'; 22 30 31 // Funções globais para o plugin 23 32 window.updateOrders = updateOrders; 24 33 window.createBoxDimensions = createBoxDimensions; … … 26 35 window.removeBox = removeBox; 27 36 28 29 37 window.removeItemInBox = removeItemInBox; 30 38 window.removeBoxElement = removeBoxElement; 39 40 // Funções globais para o country 41 window.toggleCountrySelection = toggleCountrySelection; 42 window.updateSelectedCountries = updateSelectedCountries; 43 window.removeCountry = removeCountry; 44 window.selectAllCountries = selectAllCountries; 45 window.clearAllCountries = clearAllCountries; 31 46 32 47 // Your code goes here ... … … 40 55 loadBoxes(); 41 56 handleSettingsPage(); 57 handleCountrySettings(); 42 58 } 43 59 } -
shipsmart/trunk/resources/styles/admin/settings/index.scss
r3294989 r3447136 1 1 .Shipsmart { 2 2 &__settings { 3 4 3 &-tab { 5 4 margin-top: 30px; … … 7 6 background-color: #f1f1f1; 8 7 border-bottom: 1px solid #ccc; 9 8 10 9 button { 11 10 background-color: inherit; … … 13 12 outline: none; 14 13 cursor: pointer; 15 16 14 border: 1px solid #ccc; 17 15 margin-right: 10px; … … 20 18 color: black; 21 19 background-color: #ccc; 22 } 23 24 button:hover {25 background-color: #f0f0f1;26 } 27 28 button.active {29 background-color:#f0f0f1;30 border-bottom: 1px solid #f0f0f1;31 } 32 } 33 34 &-form {20 21 &:hover { 22 background-color: #f0f0f1; 23 } 24 25 &.active { 26 background-color: #f0f0f1; 27 border-bottom: 1px solid #f0f0f1; 28 } 29 } 30 } 31 32 &-form { 35 33 animation: fadeEffect 1s; 36 34 flex-direction: column; 37 35 padding: 20px; 38 36 background-color: #f0f0f1; 39 40 37 display: none; 41 38 border-top: none; … … 75 72 margin-left: 15px; 76 73 } 77 74 78 75 &-group { 79 76 display: flex; … … 99 96 100 97 &-save-button { 101 margin-top: 44px; 102 width: 220px; 103 display: inline-block; 104 padding: 8px 2em; 105 border-radius: 7px; 106 background: linear-gradient(to right, #fcbf0a 0%, #ff9c00 100%) !important; 107 color: white !important; 108 text-transform: uppercase; 109 text-decoration: none; 110 cursor: pointer; 111 border: none; 112 } 113 114 &-save-button:hover { 115 box-shadow: 0 8px 16px 0 rgba(0,0,0,.3); 116 overflow: hidden; 98 margin-top: 44px; 99 width: 220px; 100 display: inline-block; 101 padding: 8px 2em; 102 border-radius: 7px; 103 background: linear-gradient( 104 to right, 105 #fcbf0a 0%, 106 #ff9c00 100% 107 ) !important; 108 color: white !important; 109 text-transform: uppercase; 110 text-decoration: none; 111 cursor: pointer; 112 border: none; 113 114 &:hover { 115 box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.3); 116 overflow: hidden; 117 } 117 118 } 118 119 … … 130 131 } 131 132 132 &__measures{ 133 133 &__measures { 134 134 &-label { 135 135 font-weight: bold; … … 165 165 } 166 166 } 167 &__country { 168 &-selection-section { 169 margin-top: 15px; 170 padding: 20px; 171 background: #f9f9f9; 172 border: 1px solid #e5e5e5; 173 border-radius: 5px; 174 } 175 176 &-header { 177 h4 { 178 margin: 0 0 5px 0; 179 color: #333; 180 } 181 182 .description { 183 margin: 0 0 5px 8px; 184 color: #666; 185 font-style: italic; 186 } 187 } 188 189 &-search { 190 &-container { 191 display: flex; 192 gap: 10px; 193 margin-bottom: 15px; 194 align-items: center; 195 } 196 197 &-input { 198 flex: 1; 199 padding: 8px 12px; 200 border: 1px solid #ddd; 201 border-radius: 3px; 202 font-size: 14px; 203 } 204 } 205 206 &-actions { 207 display: flex; 208 gap: 5px; 209 } 210 211 &-list-container { 212 max-height: 300px; 213 overflow-y: auto; 214 border: 1px solid #ddd; 215 border-radius: 3px; 216 background: white; 217 } 218 219 &-checkboxes { 220 padding: 10px; 221 } 222 223 &-checkbox-label { 224 display: block; 225 padding: 5px 10px; 226 border-bottom: 1px solid #f0f0f0; 227 cursor: pointer; 228 transition: background-color 0.2s; 229 230 &:hover { 231 background-color: #f5f5f5; 232 } 233 234 &:last-child { 235 border-bottom: none; 236 } 237 238 input { 239 margin-right: 8px; 240 } 241 } 242 243 &-name { 244 font-weight: 500; 245 } 246 247 &-code { 248 color: #666; 249 font-size: 12px; 250 margin-left: 5px; 251 } 252 } 253 254 &__selected-countries { 255 &-display { 256 margin-bottom: 15px; 257 padding: 10px; 258 background: white; 259 border: 1px solid #ddd; 260 border-radius: 3px; 261 } 262 263 &-list { 264 margin: 0 0 0 8px; 265 display: flex; 266 flex-wrap: wrap; 267 gap: 5px; 268 } 269 } 270 271 &__selected-country-tag { 272 display: inline-flex; 273 align-items: center; 274 background: #0073aa; 275 color: white; 276 padding: 4px 8px; 277 border-radius: 3px; 278 font-size: 12px; 279 gap: 5px; 280 } 281 282 &__remove-country { 283 background: none; 284 border: none; 285 color: white; 286 font-size: 16px; 287 line-height: 1; 288 cursor: pointer; 289 padding: 0; 290 margin: 0; 291 292 &:hover { 293 background: rgba(255, 255, 255, 0.2); 294 border-radius: 2px; 295 } 296 } 297 298 &__no-selection { 299 color: #666; 300 font-style: italic; 301 } 167 302 } -
shipsmart/trunk/shipsmart.php
r3296433 r3447136 12 12 * Plugin Name: Shipping with ShipSmart for WooCommerce 13 13 * Description: Solução para logística crossborder. Calculo de frete, impostos, gestão de pedidos e envios internacionais. 14 * Version: 1.1. 114 * Version: 1.1.2 15 15 * Author: Apiki 16 16 * Author URI: https://apiki.com/ … … 71 71 'discount_taxable' => $shipping_instance->get_option('discount_taxable'), 72 72 'view_taxable' => $view_taxable, 73 'prc_active' => false, 74 'ior_active' => false, 73 75 'box_default' => $shipping_instance->get_option('box_default'), 74 76 'plus_date_final' => $shipping_instance->get_option('plus_date_final'), … … 95 97 'discount_taxable' => 0, 96 98 'view_taxable' => false, 99 'prc_active' => false, 100 'ior_active' => false, 97 101 'box_default' => 0, 98 102 'plus_date_final' => 0, … … 244 248 function calculate_shipping_cotation() 245 249 { 246 $settings = get_option('ss_shipping_method_settings'); 247 248 if (!$settings) { 249 return; 250 } 251 252 $box_id = $settings['box_default']; 253 $box_dimension = []; 254 255 if (is_numeric($box_id)) { 256 $box_dimension = get_option("_ss_box_{$box_id}_measure"); 257 $box_dimension = $box_dimension ? $box_dimension : []; 258 } 259 260 error_log('PCR'); 261 error_log(print_r($settings['prc_active'], true)); 262 263 $response_cotation = SSFW_ApiService::ssfw_cotation_request( 264 [ 265 'taxable' => $settings['taxable'], 266 'insurance' => $settings['insurance'], 267 'box_dimension' => $box_dimension, 268 'prc_active' => isset($settings['prc_active']) ? $settings['prc_active'] : false, 269 ] 270 ); 271 272 error_log('Cotação'); 273 error_log(print_r($response_cotation, true)); 274 275 if (isset($response_cotation['status']) && $response_cotation['status'] === 'success') { 276 $methods = get_shipsmart_carries($response_cotation); 277 $session = WC()->session->get_session_cookie(); 278 279 // Add this check to verify $session is an array before using end() 280 if (is_array($session) && !empty($session)) { 281 $session_id = end($session); 282 283 delete_transient('ss_quotation_' . $session_id, $response_cotation['data']['quotation'], $session[1]); 284 if (isset($response_cotation['data']['quotation'])) { 285 set_transient('ss_quotation_' . $session_id, $response_cotation['data']['quotation'], $session[1]); 286 } 287 delete_transient('ss_cart_' . $session_id, $methods, $session[1]); 288 if (!empty($methods)) { 289 set_transient('ss_cart_' . $session_id, $methods, $session[1]); 290 } 291 } 292 } 250 $settings = get_option('ss_shipping_method_settings'); 251 252 if (!$settings) { 253 return; 254 } 255 256 $box_id = $settings['box_default']; 257 $box_dimension = []; 258 259 if (is_numeric($box_id)) { 260 $box_dimension = get_option("_ss_box_{$box_id}_measure"); 261 $box_dimension = $box_dimension ? $box_dimension : []; 262 } 263 264 $response_cotation = SSFW_ApiService::ssfw_cotation_request( 265 [ 266 'taxable' => $settings['taxable'] ?? true, 267 'insurance' => $settings['insurance'], 268 'box_dimension' => $box_dimension, 269 'prc_active' => isset($settings['prc_active']) ? $settings['prc_active'] : false, 270 ] 271 ); 272 273 if (isset($response_cotation['status']) && $response_cotation['status'] === 'success') { 274 $methods = get_shipsmart_carries($response_cotation); 275 $session = WC()->session->get_session_cookie(); 276 277 if (is_array($session) && !empty($session)) { 278 $session_id = end($session); 279 280 delete_transient('ss_quotation_' . $session_id, $response_cotation['data']['quotation'], $session[1]); 281 if (isset($response_cotation['data']['quotation'])) { 282 set_transient('ss_quotation_' . $session_id, $response_cotation['data']['quotation'], $session[1]); 283 } 284 delete_transient('ss_cart_' . $session_id, $methods, $session[1]); 285 if (!empty($methods)) { 286 set_transient('ss_cart_' . $session_id, $methods, $session[1]); 287 } 288 } 289 } 293 290 } 294 291 … … 494 491 } 495 492 } 493 494 /** 495 * @since 1.2.0 496 * Do database option compatibility for the new version 497 */ 498 add_action('admin_init', function () { 499 $settings = get_option('ss_shipping_method_settings'); 500 501 if ($settings && !isset($settings['tax_mode'])) { 502 // Migrar configuração antiga para nova 503 if (isset($settings['taxable']) && $settings['taxable']) { 504 $settings['tax_mode'] = 'ddp_all'; 505 } else { 506 $settings['tax_mode'] = 'ddu_all'; 507 } 508 $settings['ddp_countries'] = array(); 509 510 update_option('ss_shipping_method_settings', $settings); 511 } 512 }); -
shipsmart/trunk/src/Providers/Config/SSFW_Api.php
r3294989 r3447136 154 154 [ 155 155 'id' => $item_id, 156 'name' => $item->get_name(),156 'name' => substr($item->get_name(), 0, 35), 157 157 'description' => $product->get_title(), 158 158 'price' => $product->get_price(), -
shipsmart/trunk/src/Providers/Config/SSFW_Menu.php
r3294989 r3447136 87 87 'is_federal_tax_id', 88 88 'insurance', 89 'prc_active' 89 'prc_active', 90 'ior_active' 90 91 ]; 91 92 … … 124 125 'is_federal_tax_id', 125 126 'insurance', 126 'prc_active' 127 'prc_active', 128 'ior_active', 129 'tax_mode' 127 130 ]; 128 131 … … 135 138 $vars[$value] = isset($inputs_post[$value]) ? $inputs_post[$value] : false; 136 139 } 140 } 141 142 if (isset($inputs_post['ddp_countries']) && is_array($inputs_post['ddp_countries'])) { 143 $vars['ddp_countries'] = array_map('sanitize_text_field', $inputs_post['ddp_countries']); 144 } else { 145 $vars['ddp_countries'] = array(); 137 146 } 138 147 -
shipsmart/trunk/src/Providers/Config/SSFW_Product.php
r3294989 r3447136 11 11 public function register_hooks(): void { 12 12 add_action( 'woocommerce_product_options_inventory_product_data', array( $this, 'add_hs_code_field' ), 10, 0 ); 13 add_action( 'woocommerce_product_options_inventory_product_data', array( $this, 'add_cost_base_field' ), 15, 0 ); 13 14 add_action( 'woocommerce_process_product_meta', array( $this, 'save_hs_code_field' ) ); 15 add_action( 'woocommerce_process_product_meta', array( $this, 'save_cost_base_field' ) ); 14 16 add_filter( "woocommerce_product_export_column_names", array($this, 'sv_wc_csv_export_modify_column_headers_example'), 10 ); 15 17 add_filter( 'woocommerce_product_export_product_default_columns', array($this, 'sv_wc_csv_export_modify_column_headers_example') ); 16 18 add_filter( 'woocommerce_product_export_product_column_hs_code', array($this, 'export_meta_data'), 10, 2 ); 19 add_filter( 'woocommerce_product_export_product_column_cost_base', array($this, 'export_cost_base_meta_data'), 10, 2 ); 17 20 } 18 21 19 22 public function sv_wc_csv_export_modify_column_headers_example( $column_headers ) { 20 23 $column_headers['hs_code'] = 'HS Code'; 24 $column_headers['cost_base'] = 'Custo Base'; 21 25 22 26 return $column_headers; … … 45 49 } 46 50 51 public function add_cost_base_field() { 52 $args = array( 53 'id' => 'cost_base_product', 54 'label' => __( 'Custo Base', 'shipsmart' ), 55 'class' => 'ShipSmart__product-input', 56 'value' => get_post_meta( get_the_ID(), 'ss_cost_base_product', true ), 57 'desc_tip' => true, 58 'description' => __( 'Custo base do produto para cálculo de IOR (Import Of Record).', 'shipsmart' ), 59 'type' => 'number', 60 'custom_attributes' => array( 61 'step' => '0.01', 62 'min' => '0' 63 ) 64 ); 65 woocommerce_wp_text_input( $args ); 66 } 67 47 68 public function save_hs_code_field( $post_id ) { 48 69 $inputs_post = filter_input_array( INPUT_POST ); … … 53 74 } 54 75 76 public function save_cost_base_field( $post_id ) { 77 $inputs_post = filter_input_array( INPUT_POST ); 78 $product = wc_get_product( $post_id ); 79 $cost_base = isset( $inputs_post['cost_base_product'] ) ? $inputs_post['cost_base_product'] : ''; 80 $product->update_meta_data( 'ss_cost_base_product', sanitize_text_field( $cost_base ) ); 81 $product->save(); 82 } 83 84 public function export_cost_base_meta_data( $value, $product ) { 85 $cost_base = get_post_meta( $product->get_id(), 'ss_cost_base_product' ); 86 87 if ( count( $cost_base ) ) { 88 return $cost_base[0]; 89 } 90 91 return $cost_base; 92 } 93 55 94 } -
shipsmart/trunk/src/Services/SSFW_ApiService.php
r3294989 r3447136 67 67 { 68 68 "box_id": 1, 69 "description" :"Black Leather Bag",70 "name" :"Black Leather Bag",71 "country_code" :"BR",72 "quantity" :1,73 "hscode" :"420221",74 "unit_value" :3000.0,75 "weight" :3.069 "description" => "Black Leather Bag", 70 "name" => "Black Leather Bag", 71 "country_code" => "BR", 72 "quantity" => 1, 73 "hscode" => "420221", 74 "unit_value" => 3000.0, 75 "weight" => 3.0 76 76 } 77 77 ] … … 145 145 $customer_country = $woocommerce->customer->get_shipping_country(); 146 146 } 147 148 $destination_country = $order_data ? $order_data['billing']['country'] : $customer_country; 149 147 150 $payload = []; 148 151 $country = get_option('woocommerce_default_country'); … … 152 155 $payload['object'] = 'not_doc'; 153 156 $payload['type'] = 'advanced'; 154 $payload['tax'] = $config['taxable'] ? 'sender' : 'receiver'; 157 158 $payload['tax'] = self::get_tax_type_by_country($destination_country); 159 155 160 $payload['currency_quote'] = get_option('woocommerce_currency'); 156 161 $payload['currency_payment'] = get_option('woocommerce_currency'); … … 164 169 165 170 $payload['address_receiver'] = [ 166 "country_code" => $ order_data ? $order_data['billing']['country'] : $customer_country,171 "country_code" => $destination_country, 167 172 "postal_code" => $order_data ? $order_data['billing']['postcode'] : $customer_postalcode, 168 173 "city" => $order_data ? $order_data['billing']['city'] : $customer_city … … 681 686 682 687 /** 688 * Determina o tipo de tax (sender/receiver) baseado no país de destino 689 * 690 * @param string $destination_country Código do país de destino 691 * @return string 'sender' para DDP ou 'receiver' para DDU 692 */ 693 public static function get_tax_type_by_country($destination_country) 694 { 695 $settings = get_option('ss_shipping_method_settings'); 696 697 if (!$settings || !isset($settings['tax_mode'])) { 698 return isset($settings['taxable']) && $settings['taxable'] ? 'sender' : 'receiver'; 699 } 700 701 switch ($settings['tax_mode']) { 702 case 'ddp_all': 703 return 'sender'; 704 705 case 'ddu_all': 706 return 'receiver'; 707 708 case 'custom': 709 $ddp_countries = isset($settings['ddp_countries']) ? (array) $settings['ddp_countries'] : array(); 710 return in_array($destination_country, $ddp_countries) ? 'sender' : 'receiver'; 711 712 default: 713 return 'receiver'; 714 } 715 } 716 717 /** 683 718 * Registra logs usando o sistema de log do WooCommerce 684 719 * -
shipsmart/trunk/src/Services/SSFW_Box.php
r3294989 r3447136 51 51 ); 52 52 53 54 $items = []; 53 $settings = get_option('ss_shipping_method_settings'); 54 $use_ior = isset($settings['ior_active']) && $settings['ior_active']; 55 56 $processed_items = []; 55 57 foreach($boxes_dimensions as $key => $box) { 56 58 $box_items = $box['items']; 57 59 foreach( $box_items as $item ) { 58 $items[] = [ 59 "box_id" => $key + 1, 60 "description" => $item['description'], 61 "name" => $item['description'], 62 "country_code" => $item['country_code'], 63 "quantity" => $item['quantity'], 64 "hscode" => $item['hscode'], 65 "sku" => $item['sku'], 66 "unit_value" => $item['price'], 67 "weight" => $item['weight'] 60 $unit_value = $item['price']; 61 62 if ($use_ior) { 63 foreach ($items as $original_item) { 64 $item_data = is_array( $original_item ) ? $original_item['data'] : $original_item; 65 $original_item_id = is_array($original_item) ? $original_item['product_id'] : $item_data->get_id(); 66 67 if (($item_data->get_sku() && $item_data->get_sku() === $item['sku']) || 68 $item_data->get_title() === $item['description']) { 69 $product_id = $original_item_id; 70 break; 71 } 72 } 73 74 if ($product_id) { 75 $cost_base = get_post_meta($product_id, 'ss_cost_base_product', true); 76 if ($cost_base && is_numeric($cost_base) && floatval($cost_base) > 0) { 77 $unit_value = floatval($cost_base); 78 } 79 } 80 } 81 82 $processed_items[] = [ 83 "box_id" => $key + 1, 84 "description" => $item['description'], 85 "name" => $item['description'], 86 "country_code" => $item['country_code'], 87 "quantity" => $item['quantity'], 88 "hscode" => $item['hscode'], 89 "sku" => $item['sku'], 90 "unit_value" => $unit_value, 91 "selling_unit_value" => $item['price'], 92 "weight" => $item['weight'] 68 93 ]; 69 94 } 70 95 } 71 96 72 return[97 $result = [ 73 98 'boxes' => $boxes, 74 'items' => $items 99 'items' => $processed_items, 100 'ior' => $use_ior ? true : false 75 101 ]; 102 103 return $result; 76 104 } 77 105 -
shipsmart/trunk/vendor/autoload.php
r3294989 r3447136 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 92b30d13fb2ae9ef205a033766ca0160::getLoader();25 return ComposerAutoloaderInit2c550d23498a52839f5b751cb14d1207::getLoader(); -
shipsmart/trunk/vendor/composer/autoload_psr4.php
r3294989 r3447136 8 8 return array( 9 9 'WPSteak\\' => array($vendorDir . '/apiki/wpsteak/src'), 10 'ShipSmart\\Test\\' => array($baseDir . '/tests'),11 10 'ShipSmart\\' => array($baseDir . '/src'), 12 11 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), -
shipsmart/trunk/vendor/composer/autoload_real.php
r3294989 r3447136 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 92b30d13fb2ae9ef205a033766ca01605 class ComposerAutoloaderInit2c550d23498a52839f5b751cb14d1207 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 92b30d13fb2ae9ef205a033766ca0160', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit2c550d23498a52839f5b751cb14d1207', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 92b30d13fb2ae9ef205a033766ca0160', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit2c550d23498a52839f5b751cb14d1207', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 92b30d13fb2ae9ef205a033766ca0160::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit2c550d23498a52839f5b751cb14d1207::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 92b30d13fb2ae9ef205a033766ca0160::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit2c550d23498a52839f5b751cb14d1207::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
shipsmart/trunk/vendor/composer/autoload_static.php
r3294989 r3447136 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 92b30d13fb2ae9ef205a033766ca01607 class ComposerStaticInit2c550d23498a52839f5b751cb14d1207 8 8 { 9 9 public static $files = array ( … … 19 19 'S' => 20 20 array ( 21 'ShipSmart\\Test\\' => 15,22 21 'ShipSmart\\' => 10, 23 22 ), … … 46 45 array ( 47 46 0 => __DIR__ . '/..' . '/apiki/wpsteak/src', 48 ),49 'ShipSmart\\Test\\' =>50 array (51 0 => __DIR__ . '/../..' . '/tests',52 47 ), 53 48 'ShipSmart\\' => … … 88 83 { 89 84 return \Closure::bind(function () use ($loader) { 90 $loader->prefixLengthsPsr4 = ComposerStaticInit 92b30d13fb2ae9ef205a033766ca0160::$prefixLengthsPsr4;91 $loader->prefixDirsPsr4 = ComposerStaticInit 92b30d13fb2ae9ef205a033766ca0160::$prefixDirsPsr4;92 $loader->classMap = ComposerStaticInit 92b30d13fb2ae9ef205a033766ca0160::$classMap;85 $loader->prefixLengthsPsr4 = ComposerStaticInit2c550d23498a52839f5b751cb14d1207::$prefixLengthsPsr4; 86 $loader->prefixDirsPsr4 = ComposerStaticInit2c550d23498a52839f5b751cb14d1207::$prefixDirsPsr4; 87 $loader->classMap = ComposerStaticInit2c550d23498a52839f5b751cb14d1207::$classMap; 93 88 94 89 }, null, ClassLoader::class); -
shipsmart/trunk/vendor/composer/installed.json
r3294989 r3447136 351 351 "extra": { 352 352 "branch-alias": { 353 "dev-master": "3.x-dev", 353 "dev-1.x": "1.x-dev", 354 "dev-2.x": "2.x-dev", 354 355 "dev-3.x": "3.x-dev", 355 "dev-2.x": "2.x-dev", 356 "dev-1.x": "1.x-dev" 356 "dev-master": "3.x-dev" 357 357 } 358 358 }, … … 503 503 } 504 504 ], 505 "dev": true,505 "dev": false, 506 506 "dev-package-names": [] 507 507 } -
shipsmart/trunk/vendor/composer/installed.php
r3294989 r3447136 2 2 'root' => array( 3 3 'name' => 'apiki/wpsteak-plugin', 4 'pretty_version' => ' dev-main',5 'version' => ' dev-main',6 'reference' => '9d7e42ae10fbec086672962cc54dc41ea897521c',4 'pretty_version' => '1.0.0+no-version-set', 5 'version' => '1.0.0.0', 6 'reference' => NULL, 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', 9 9 'aliases' => array(), 10 'dev' => true,10 'dev' => false, 11 11 ), 12 12 'versions' => array( … … 21 21 ), 22 22 'apiki/wpsteak-plugin' => array( 23 'pretty_version' => ' dev-main',24 'version' => ' dev-main',25 'reference' => '9d7e42ae10fbec086672962cc54dc41ea897521c',23 'pretty_version' => '1.0.0+no-version-set', 24 'version' => '1.0.0.0', 25 'reference' => NULL, 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../../', -
shipsmart/trunk/views/Admin/Settings/template-parts/shipping.php
r3294989 r3447136 1 <form class="Shipsmart__settings-form shipping-settings" method='POST' action="<?php echo esc_url( admin_url( 'admin-post.php' ) );?>" id="shipping">1 <form class="Shipsmart__settings-form shipping-settings" method='POST' action="<?php echo esc_url(admin_url('admin-post.php')); ?>" id="shipping"> 2 2 <input type="hidden" name="page" value="shipsmart"> 3 3 <input type="hidden" name="action" value="save_shipping_settings"> 4 4 <div class="sections" id="ssfw_shipping"> 5 5 <div class="section"> 6 <h2><?php echo __('Dados da loja', 'shipsmart'); ?></h2>7 <div> 8 <div> 9 <span><?php echo __('Loja com CNPJ', 'shipsmart'); ?></span>6 <h2><?php echo __('Dados da loja', 'shipsmart'); ?></h2> 7 <div> 8 <div> 9 <span><?php echo __('Loja com CNPJ', 'shipsmart'); ?></span> 10 10 </div> 11 11 <div> 12 12 <input type="checkbox" name="is_federal_tax_id" id="is_federal_tax_id" <?php echo esc_attr(isset($is_federal_tax_id) && $is_federal_tax_id ? 'checked' : ''); ?>> 13 <label for="is_federal_tax_id"><?php echo __('Cadastrar CNPJ', 'shipsmart'); ?></label>14 </div> 15 </div> 16 <div> 17 <div> 18 <span><?php echo __('CNPJ', 'shipsmart'); ?></span>13 <label for="is_federal_tax_id"><?php echo __('Cadastrar CNPJ', 'shipsmart'); ?></label> 14 </div> 15 </div> 16 <div> 17 <div> 18 <span><?php echo __('CNPJ', 'shipsmart'); ?></span> 19 19 </div> 20 20 <div> … … 24 24 <div> 25 25 <div> 26 <span><?php echo __('Nome da Loja', 'shipsmart'); ?></span>26 <span><?php echo __('Nome da Loja', 'shipsmart'); ?></span> 27 27 </div> 28 28 <div> … … 32 32 <div> 33 33 <div> 34 <span><?php echo __('Telefone da Loja', 'shipsmart'); ?></span>34 <span><?php echo __('Telefone da Loja', 'shipsmart'); ?></span> 35 35 </div> 36 36 <div> … … 40 40 <div> 41 41 <div> 42 <span><?php echo __('E-mail da Loja', 'shipsmart'); ?></span>43 </div> 44 <div> 45 <input type="text" name="email" id="email" value="<?php echo esc_html(isset($email) ? $email : ''); ?>">46 </div> 47 </div> 48 </div> 49 50 <div class="section"> 51 <h2><?php echo __('Taxas', 'shipsmart'); ?></h2>52 <div> 53 <div> 54 <span><?php echo __('Aplicar desconto no frete?', 'shipsmart'); ?></span>55 </div> 56 <div> 57 <input type="number" name="percentual_discount"id="percentual_discount" value="<?php echo esc_html(isset($percentual_discount) ? $percentual_discount : ''); ?>">58 </div> 59 </div> 60 <div> 61 <div> 62 <span><?php echo __('Com ou sem seguro?', 'shipsmart'); ?></span>42 <span><?php echo __('E-mail da Loja', 'shipsmart'); ?></span> 43 </div> 44 <div> 45 <input type="text" name="email" id="email" value="<?php echo esc_html(isset($email) ? $email : ''); ?>"> 46 </div> 47 </div> 48 </div> 49 50 <div class="section"> 51 <h2><?php echo __('Taxas', 'shipsmart'); ?></h2> 52 <div> 53 <div> 54 <span><?php echo __('Aplicar desconto no frete?', 'shipsmart'); ?></span> 55 </div> 56 <div> 57 <input type="number" name="percentual_discount" id="percentual_discount" value="<?php echo esc_html(isset($percentual_discount) ? $percentual_discount : ''); ?>"> 58 </div> 59 </div> 60 <div> 61 <div> 62 <span><?php echo __('Com ou sem seguro?', 'shipsmart'); ?></span> 63 63 </div> 64 64 <div> 65 65 <input type="checkbox" name="insurance" id="insurance" <?php echo esc_attr(isset($insurance) && $insurance ? 'checked' : ''); ?>> 66 <label for="insurance"><?php echo __('Aplicar seguro', 'shipsmart'); ?></label>67 </div> 68 </div> 69 <div> 70 <div> 71 <span><?php echo __('Aplicar desconto no seguro?', 'shipsmart'); ?></span>66 <label for="insurance"><?php echo __('Aplicar seguro', 'shipsmart'); ?></label> 67 </div> 68 </div> 69 <div> 70 <div> 71 <span><?php echo __('Aplicar desconto no seguro?', 'shipsmart'); ?></span> 72 72 </div> 73 73 <div> … … 77 77 <div> 78 78 <div> 79 <span><?php echo __('Com ou sem Duty and Tax?', 'shipsmart'); ?></span>79 <span><?php echo __('Com ou sem Duty and Tax?', 'shipsmart'); ?></span> 80 80 </div> 81 81 <div> 82 82 <input type="checkbox" name="taxable" id="taxable" <?php echo esc_attr(isset($taxable) && $taxable ? 'checked' : ''); ?>> 83 <label for="taxable"><?php echo __('Aplicar taxas', 'shipsmart'); ?></label>84 </div> 85 </div> 86 <div> 87 <div> 88 <span><?php echo __('PRC ativo?', 'shipsmart'); ?></span>83 <label for="taxable"><?php echo __('Aplicar taxas', 'shipsmart'); ?></label> 84 </div> 85 </div> 86 <div> 87 <div> 88 <span><?php echo __('PRC ativo?', 'shipsmart'); ?></span> 89 89 </div> 90 90 <div> 91 91 <input type="checkbox" name="prc_active" id="prc_active" <?php echo esc_attr(isset($prc_active) && $prc_active ? 'checked' : ''); ?>> 92 <label for="prc_active"><?php echo __('Aplicar PRC', 'shipsmart');?></label> 93 </div> 94 </div> 95 <div> 96 <div> 97 <span><?php echo __('Aplicar', 'shipsmart');?></span> 92 <label for="prc_active"><?php echo __('Aplicar PRC', 'shipsmart'); ?></label> 93 </div> 94 </div> 95 <div> 96 <div> 97 <span><?php echo __('IOR ativo?', 'shipsmart'); ?></span> 98 </div> 99 <div> 100 <input type="checkbox" name="ior_active" id="ior_active" <?php echo esc_attr(isset($ior_active) && $ior_active ? 'checked' : ''); ?>> 101 <label for="ior_active"><?php echo __('Usar custo base para cotação (Import Of Record)', 'shipsmart'); ?></label> 102 </div> 103 </div> 104 <div> 105 <div> 106 <span><?php echo __('Aplicar', 'shipsmart'); ?></span> 98 107 </div> 99 108 <div> … … 103 112 <div> 104 113 <div> 105 <span><?php echo __('Caixa padrão?', 'shipsmart'); ?></span>114 <span><?php echo __('Caixa padrão?', 'shipsmart'); ?></span> 106 115 </div> 107 116 <div> 108 117 <select name="box_default" id="box_default" value="<?php echo esc_html(isset($box_default) ? $box_default : ''); ?>"> 109 <?php foreach ($boxes as $key => $box): ?>118 <?php foreach ($boxes as $key => $box): ?> 110 119 <option value="<?php echo esc_attr($key); ?>"><?php echo esc_html($box); ?></option> 111 <?php endforeach; ?>120 <?php endforeach; ?> 112 121 </select> 113 122 </div> … … 116 125 117 126 <div class="section"> 118 <h2><?php echo __('Prazo adicional', 'shipsmart'); ?></h2>119 <div> 120 <div> 121 <span><?php echo __('Somar dias adicionais no prazo total?', 'shipsmart'); ?></span>127 <h2><?php echo __('Prazo adicional', 'shipsmart'); ?></h2> 128 <div> 129 <div> 130 <span><?php echo __('Somar dias adicionais no prazo total?', 'shipsmart'); ?></span> 122 131 </div> 123 132 <div> … … 128 137 129 138 <div class="section"> 130 <h2><?php echo __('Renomear rótulos', 'shipsmart'); ?></h2>131 <div> 132 <div> 133 <span><?php echo __('Título do frete', 'shipsmart'); ?></span>139 <h2><?php echo __('Renomear rótulos', 'shipsmart'); ?></h2> 140 <div> 141 <div> 142 <span><?php echo __('Título do frete', 'shipsmart'); ?></span> 134 143 </div> 135 144 <div> … … 139 148 <div> 140 149 <div> 141 <span><?php echo __('Nome do frete', 'shipsmart'); ?></span>150 <span><?php echo __('Nome do frete', 'shipsmart'); ?></span> 142 151 </div> 143 152 <div> … … 147 156 <div> 148 157 <div> 149 <span><?php echo __('Nome do seguro', 'shipsmart'); ?></span>158 <span><?php echo __('Nome do seguro', 'shipsmart'); ?></span> 150 159 </div> 151 160 <div> … … 155 164 <div> 156 165 <div> 157 <span><?php echo __('Nome da taxa', 'shipsmart'); ?></span>166 <span><?php echo __('Nome da taxa', 'shipsmart'); ?></span> 158 167 </div> 159 168 <div> … … 163 172 <div> 164 173 <div> 165 <span><?php echo __('Texto de previsão de taxa', 'shipsmart'); ?></span>174 <span><?php echo __('Texto de previsão de taxa', 'shipsmart'); ?></span> 166 175 </div> 167 176 <div> … … 171 180 <div> 172 181 <div> 173 <span><?php echo __('Texto valor total do frete', 'shipsmart'); ?></span>182 <span><?php echo __('Texto valor total do frete', 'shipsmart'); ?></span> 174 183 </div> 175 184 <div> … … 179 188 <div> 180 189 <div> 181 <span><?php echo __('Texto previsão entrega', 'shipsmart'); ?></span>190 <span><?php echo __('Texto previsão entrega', 'shipsmart'); ?></span> 182 191 </div> 183 192 <div> … … 187 196 <div> 188 197 <div> 189 <span><?php echo __('Texto rótulo dias de frete', 'shipsmart'); ?></span>198 <span><?php echo __('Texto rótulo dias de frete', 'shipsmart'); ?></span> 190 199 </div> 191 200 <div> … … 194 203 </div> 195 204 </div> 205 206 <div class="section"> 207 <h2><?php echo __('Configuração de Duty and Tax por país', 'shipsmart'); ?></h2> 208 <div> 209 <div> 210 <span><?php echo __('Modo de operação', 'shipsmart'); ?></span> 211 </div> 212 <div> 213 <select name="tax_mode" id="tax_mode" onchange="toggleCountrySelection()"> 214 <option value="ddp_all" <?php echo esc_attr(isset($tax_mode) && $tax_mode === 'ddp_all' ? 'selected' : ''); ?>> 215 <?php echo __('Operar DDP (todos os países como DDP)', 'shipsmart'); ?> 216 </option> 217 <option value="ddu_all" <?php echo esc_attr(isset($tax_mode) && $tax_mode === 'ddu_all' ? 'selected' : ''); ?>> 218 <?php echo __('Operar DDU (todos os países como DDU)', 'shipsmart'); ?> 219 </option> 220 <option value="custom" <?php echo esc_attr(isset($tax_mode) && $tax_mode === 'custom' ? 'selected' : ''); ?>> 221 <?php echo __('Personalizar por país (Selecão de DDP)', 'shipsmart'); ?> 222 </option> 223 </select> 224 </div> 225 </div> 226 227 <div id="ddp_countries_section" class="Shipsmart__country-selection-section" style="<?php echo esc_attr(isset($tax_mode) && $tax_mode === 'custom' ? 'display: block;' : 'display: none;'); ?>"> 228 <div class="Shipsmart__country-header"> 229 <h4><?php echo __('Países com DDP', 'shipsmart'); ?></h4> 230 <p class="description"><?php echo __('Os países não selecionados operarão como DDU', 'shipsmart'); ?></p> 231 </div> 232 233 <div class="Shipsmart__country-search-container"> 234 <input type="text" id="country_search" placeholder="<?php echo esc_attr__('Buscar países...', 'shipsmart'); ?>" class="Shipsmart__country-search-input"> 235 <div class="Shipsmart__country-actions"> 236 <button type="button" onclick="selectAllCountries()" class="button button-secondary"><?php echo __('Selecionar Todos', 'shipsmart'); ?></button> 237 <button type="button" onclick="clearAllCountries()" class="button button-secondary"><?php echo __('Limpar Seleção', 'shipsmart'); ?></button> 238 </div> 239 </div> 240 241 <div class="Shipsmart__selected-countries-display"> 242 <strong><?php echo __('Países selecionados:', 'shipsmart'); ?></strong> 243 <div id="selected_countries_list" class="Shipsmart__selected-countries-list"></div> 244 </div> 245 246 <div class="Shipsmart__country-list-container"> 247 <?php 248 $countries = WC()->countries->get_countries(); 249 $selected_ddp_countries = isset($ddp_countries) ? (array) $ddp_countries : array(); 250 ?> 251 <div class="Shipsmart__country-checkboxes" id="country_checkboxes"> 252 <?php foreach ($countries as $code => $name) : 253 $checked = in_array($code, $selected_ddp_countries) ? 'checked' : ''; 254 ?> 255 <label class="Shipsmart__country-checkbox-label" data-country="<?php echo esc_attr(strtolower($name)); ?>"> 256 <input type="checkbox" 257 name="ddp_countries[]" 258 value="<?php echo esc_attr($code); ?>" 259 <?php echo $checked; ?> 260 onchange="updateSelectedCountries()"> 261 <span class="Shipsmart__country-name"><?php echo esc_html($name); ?></span> 262 <span class="Shipsmart__country-code">(<?php echo esc_html($code); ?>)</span> 263 </label> 264 <?php endforeach; ?> 265 </div> 266 </div> 267 </div> 268 </div> 196 269 </div> 197 <button class="Shipsmart__settings-save-button"><?php echo __('Salvar Configurações', 'shipsmart'); ?></button>270 <button class="Shipsmart__settings-save-button"><?php echo __('Salvar Configurações', 'shipsmart'); ?></button> 198 271 </form>
Note: See TracChangeset
for help on using the changeset viewer.