vendor: 4,425 bytes, line 1
1function _createForOfIteratorHelper(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}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,i=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){c=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw a}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.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,n){var a=e&&e.prototype instanceof m?e:m,i=Object.create(a.prototype),c=new x(n||[]);return o(i,"_invoke",{value:R(t,r,c)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",p="suspendedYield",d="executing",v="completed",y={};function m(){}function _(){}function g(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,O=w&&w(w(I([])));O&&O!==r&&n.call(O,i)&&(b=O);var T=g.prototype=m.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function D(t,e){function r(o,a,i,c){var s=f(t[o],t,a);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==_typeof(l)&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(l).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(s.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function R(e,r,n){var o=h;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=S(c,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?v:p,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function S(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}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 L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[i];if(r)return r.call(e);
1if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(_typeof(e)+" is not iterable")}return _.prototype=g,o(T,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:_,configurable:!0}),_.displayName=u(g,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u(t,s,"GeneratorFunction")),t.prototype=Object.create(T),t},e.awrap=function(t){return{__await:t}},E(D.prototype),u(D.prototype,c,(function(){return this})),e.AsyncIterator=D,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new D(l(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(T),u(T,s,"Generator"),u(T,i,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),e.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}},e.values=I,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},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),y},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),L(r),y}},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 o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function _typeof(t){return _typeof="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},_typeof(t)}var __awaiter=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function c(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))};export var INSIDER_CART_CHANGED="insider:cart:changed";export var INSIDER_CART_ERROR="insider:cart:error";var DISTINCT_MS=500;function cartFingerprint(t){var e=t.items.map((function(t){return"".concat(t.variant_id,":").concat(t.quantity)})).sort().join(",");return"".concat(t.token,"|").concat(e)}function isValidCart(t){if(!t||"object"!==_typeof(t))return!1;var e=t;return"string"==typeof e.token&&e.token.length>0&&Array.isArray(e.items)}export function dispatch(t){var e,r,n;if(isValidCart(t.cart)){var o=window,a=cartFingerprint(t.cart),i=Date.now(),c=null!==(e=o.__cartBusFp)&&void 0!==e?e:"",s=null!==(r=o.__cartBusTs)&&void 0!==r?r:0;a===c&&i-s<DISTINCT_MS?console.debug("[cart-event-bus] dispatch DESCARTADO â mesmo fp dentro de ".concat(DISTINCT_MS,"ms"),{source:t.source,operation:t.operation,fp:a,msSinceLastDispatch:i-s}):(console.debug("[cart-event-bus] dispatch EMITIDO",{source:t.source,operation:t.operation,fp:a,item_count:t.cart.item_count,prevFp:c,msSinceLastDispatch:i-s}),o.__cartBusFp=a,o.__cartBusTs=i,_lastInternalDispatchTs=i,document.dispatchEvent(new CustomEvent(INSIDER_CART_CHANGED,{bubbles:!0,detail:Object.assign(Object.assign({},t),{timestamp:null!==(n=t.timestamp)&&void 0!==n?n:i}
1)})))}else console.warn("[cart-event-bus] dispatch REJEITADO â cart inválido",{source:t.source,operation:t.operation,cartType:_typeof(t.cart)})}var cartUrl=function(){var t=window.routes;return(null==t?void 0:t.cart_url)?"".concat(t.cart_url,".js"):"/cart.js"},_inFlightCart=null;function fetchCart(){return _inFlightCart||(_inFlightCart=fetch(cartUrl(),{credentials:"same-origin",headers:{"Cache-Control":"no-cache"}}).then((function(t){return t.json()})).finally((function(){_inFlightCart=null})))}var _inFlightDispatch=null;export function fetchAndDispatch(t,e){var r=this;return _inFlightDispatch?(console.debug("[cart-event-bus] fetchAndDispatch SKIP â já há um em andamento",{source:t,operation:e}),_inFlightDispatch):_inFlightDispatch=__awaiter(r,void 0,void 0,_regeneratorRuntime().mark((function r(){var n;return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,fetchCart();case 3:n=r.sent,dispatch({source:t,operation:e,cart:n}),r.next=10;break;case 7:r.prev=7,r.t0=r.catch(0),document.dispatchEvent(new CustomEvent(INSIDER_CART_ERROR,{bubbles:!0,detail:{source:t,error:r.t0}}));case 10:return r.prev=10,_inFlightDispatch=null,r.finish(10);case 13:case"end":return r.stop()}}),r,null,[[0,7,10,13]])})))}export function silentCartUpdate(t){return __awaiter(this,void 0,void 0,_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return _lastInternalDispatchTs=Date.now(),e.next=3,fetch("/cart/update.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).finally((function(){_lastInternalDispatchTs=Date.now()}));case 3:case"end":return e.stop()}}),e)})))}var wGlobals=window;wGlobals.dispatchCartEvent=function(t){return dispatch(t)},wGlobals.fetchCartAndDispatch=function(t,e){return fetchAndDispatch(t,e)};var CART_MUTATION_RE=/\/cart\/(add|change|update)(?:\.js|\.json)?(\?.*)?$/,_lastInternalDispatchTs=0,_lastObserverDispatchTs=0,DEDUP_MS=2e3,OBSERVER_COOLDOWN_MS=3e3;function installFetchPatch(){var t=window;if(!0!==t.__cartBusDisableFetchPatch)if(!0!==t.__cartBusFetchPatched)if("function"==typeof window.fetch)try{var e=window.fetch.bind(window),r=function(t,e){var r,n;try{var o=function(t){try{return"string"==typeof t?t:t instanceof URL?t.toString():t instanceof Request?t.url:""}catch(t){return""}}(t);return!(!o||!CART_MUTATION_RE.test(o))&&"POST"===(null!==(n=null===(r=null==e?void 0:e.method)||void 0===r?void 0:r.toUpperCase())&&void 0!==n?n:t instanceof Request?t.method.toUpperCase():"GET")}catch(t){return!1}};window.fetch=function(t,n){return __awaiter(this,void 0,void 0,_regeneratorRuntime().mark((function o(){var a;return _regeneratorRuntime().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,e(t,n);case 2:if(a=o.sent,o.prev=3,r(t,n)){o.next=6;break}return o.abrupt("return",a);case 6:a.clone().json().then((function(t){t&&"object"===_typeof(t)&&"token"in t&&"items"in t&&Array.isArray(t.items)&&dispatch({source:"external",operation:"update",cart:t})})).catch((function(){})),o.next=12;break;case 10:o.prev=10,o.t0=o.catch(3);case 12:return o.abrupt("return",a);case 13:case"end":return o.stop()}}),o,null,[[3,10]])})))},t.__cartBusFetchPatched=!0,console.debug("[cart-event-bus] fetch patch INSTALADO")}catch(t){console.warn("[cart-event-bus] fetch patch FALHOU ao instalar, usando Observer como fallback:",t)}else console.debug("[cart-event-bus] window.fetch indisponÃvel â fetch patch skip");else console.debug("[cart-event-bus] fetch patch já instalado â skip");else console.debug("[cart-event-bus] fetch patch DESLIGADO via __cartBusDisableFetchPatch")}function installXHRPatch(){var t=window;
1if(!0!==t.__cartBusDisableFetchPatch&&!0!==t.__cartBusXHRPatched&&"undefined"!=typeof XMLHttpRequest)try{var e=XMLHttpRequest.prototype.open,r=XMLHttpRequest.prototype.send,n=new WeakMap;XMLHttpRequest.prototype.open=function(t,r){try{n.set(this,{method:String(t).toUpperCase(),url:"string"==typeof r?r:r.toString()})}catch(t){}for(var o=arguments.length,a=new Array(o>2?o-2:0),i=2;i<o;i++)a[i-2]=arguments[i];return e.apply(this,[t,r].concat(a))},XMLHttpRequest.prototype.send=function(){var t=this;try{var e=n.get(this);e&&"POST"===e.method&&CART_MUTATION_RE.test(e.url)&&this.addEventListener("loadend",(function(){try{if(t.status<200||t.status>=300)return;var e=t.responseText;if(!e)return;var r=JSON.parse(e);r&&"object"===_typeof(r)&&"token"in r&&"items"in r&&Array.isArray(r.items)&&dispatch({source:"external",operation:"update",cart:r})}catch(t){}}))}catch(t){}for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];return r.apply(this,a)},t.__cartBusXHRPatched=!0,console.debug("[cart-event-bus] XHR patch INSTALADO")}catch(t){console.warn("[cart-event-bus] XHR patch FALHOU ao instalar, usando Observer como fallback:",t)}}if(installFetchPatch(),installXHRPatch(),"undefined"!=typeof PerformanceObserver)try{new PerformanceObserver((function(t){var e,r=_createForOfIteratorHelper(t.getEntries());try{for(r.s();!(e=r.n()).done;){var n=e.value;if(CART_MUTATION_RE.test(n.name)){var o=Date.now(),a=o-_lastInternalDispatchTs,i=o-_lastObserverDispatchTs;if(a<=DEDUP_MS){console.debug("[cart-event-bus] PerformanceObserver SUPRIMIDO â dispatch interno recente",{url:n.name,msSinceInternal:a});break}if(i<=OBSERVER_COOLDOWN_MS){console.debug("[cart-event-bus] PerformanceObserver SUPRIMIDO â cooldown ativo",{url:n.name,msSinceObserver:i});break}_lastObserverDispatchTs=o,console.debug("[cart-event-bus] PerformanceObserver â fetchAndDispatch external",{url:n.name,msSinceInternal:a}),fetchAndDispatch("external","update");break}}}catch(t){r.e(t)}finally{r.f()}})).observe({type:"resource",buffered:!0})}catch(t){} 2//# sourceMappingURL=mod-cart-event-bus.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.