UNPKG

92.1 kBJavaScriptView Raw
1!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("app-bridge",[],e):"object"==typeof exports?exports["app-bridge"]=e():t["app-bridge"]=e()}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},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=46)}([function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var c=n(5),s=n(7),u=n(9),p=n(13),l=a(n(50)),d=n(1),f=n(13),h=a(n(51)),y=n(52);function A(){return y.version}function O(t,e,n){var o=function(t){switch(t){case d.Group.ContextualSaveBar:return(e=t,e.replace(/([A-Z])/g,function(t,e,n){return(0!==n?"_":"")+t[0].toLowerCase()})).toUpperCase();default:return t.toUpperCase()}var e}(t);if(n){var r=n.subgroups,i=n.type;r&&r.length>0&&(o+=o.length>0?f.SEPARATOR:"",r.forEach(function(t,e){o+=""+t.toUpperCase()+(e<r.length-1?f.SEPARATOR:"")})),i!==t&&i&&(o+=""+(o.length>0?f.SEPARATOR:"")+i.toUpperCase())}return o&&(o+=""+(o.length>0?f.SEPARATOR:"")+e.toUpperCase()),""+p.PREFIX+f.SEPARATOR+o}e.actionWrapper=function(t){return i({},t,{version:A(),clientInterface:{name:y.name,version:A()}})},e.getVersion=A,e.getEventNameSpace=O,e.isValidOptionalNumber=function(t){return null==t||"number"==typeof t},e.isValidOptionalString=function(t){return null==t||"string"==typeof t};var E=function(){function t(t,e,n,o){var r=this;this.app=t,this.type=e,this.group=n,this.subgroups=[],this.subscriptions=[],t||c.throwError(c.ActionType.INVALID_OPTIONS,"Missing required `app`"),this.id=o||h.default(),this.defaultGroup=n;var i=this.set;this.set=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return r.app.hooks?(t=r.app.hooks).run.apply(t,[s.LifecycleHook.UpdateAction,i,r].concat(e)):i.apply(r,e)}}return t.prototype.set=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},Object.defineProperty(t.prototype,"component",{get:function(){return{id:this.id,subgroups:this.subgroups,type:this.type}},enumerable:!0,configurable:!0}),t.prototype.updateSubscription=function(t,e,n){var o,r=t.eventType,i=t.callback,a=t.component;return(o=this.subscriptions.findIndex(function(e){return e===t}))>=0?this.subscriptions[o].unsubscribe():o=void 0,this.group=e,this.subgroups=n,Object.assign(a,{subgroups:this.subgroups}),this.subscribe(r,i,a,o)},t.prototype.error=function(t){var e=this,n=[];return _(c.Action,function(o){n.push(e.subscriptions.length),e.subscribe(o,t)}),function(){n.map(function(t){return e.subscriptions[t]}).forEach(function(t){u.removeFromCollection(e.subscriptions,t,function(t){t.unsubscribe()})})}},t.prototype.subscribe=function(t,e,n,o){var r,a=this,s=n||this.component,u=t.toUpperCase(),p="number"==typeof o?e:e.bind(this);r=c.isErrorEventName(t)?O(d.Group.Error,t,i({},s,{type:""})):O(this.group,t,s);var l=this.app.subscribe(r,p,n?n.id:this.id),f={eventType:u,unsubscribe:l,callback:p,component:s,updateSubscribe:function(t,e){return a.updateSubscription.call(a,f,t,e)}};return"number"==typeof o&&o>=0&&o<this.subscriptions.length?this.subscriptions[o]=f:this.subscriptions.push(f),l},t.prototype.unsubscribe=function(t){return void 0===t&&(t=!1),P(this.subscriptions,this.defaultGroup,t),this},t}();e.ActionSet=E;var T=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.children=[],e}return r(e,t),e.prototype.unsubscribe=function(t,n){return void 0===t&&(t=!0),void 0===n&&(n=!1),P(this.subscriptions,this.defaultGroup,n),this.children.forEach(function(n){e.prototype.isPrototypeOf(n)?n.unsubscribe(t,!t):n.unsubscribe(!t)}),this},e.prototype.getChild=function(t){var e=this.children.findIndex(function(e){return e.id===t});return e>=0?this.children[e]:void 0},e.prototype.getChildIndex=function(t){return this.children.findIndex(function(e){return e.id===t})},e.prototype.getChildSubscriptions=function(t,e){return this.subscriptions.filter(function(n){return n.component.id===t&&(!e||e===n.eventType)})},e.prototype.addChild=function(t,n,o){var r=this,i=t.subscriptions;return this.getChild(t.id)||this.children.push(t),!i||n===t.group&&o===t.subgroups?this:(i.forEach(function(t){(0,t.updateSubscribe)(n,o)}),Object.assign(t,{group:n,subgroups:o}),e.prototype.isPrototypeOf(t)&&t.children.forEach(function(t){return r.addChild(t,n,o)}),this)},e.prototype.removeChild=function(t){var e=this;return u.removeFromCollection(this.children,this.getChild(t),function(){e.subscriptions.filter(function(e){return e.component.id===t}).forEach(function(t){u.removeFromCollection(e.subscriptions,t,function(t){t.unsubscribe()})})}),this},e.prototype.subscribeToChild=function(t,e,n){var o=this,r=n.bind(this);if(e instanceof Array)return e.forEach(function(e){return o.subscribeToChild(t,e,n)}),this;if("string"!=typeof e)return this;var i=e.toUpperCase(),a=this.getChildSubscriptions(t.id,i);if(a.length>0)a.forEach(function(e){return e.updateSubscribe(o.group,t.subgroups)});else{var c={id:t.id,subgroups:t.subgroups,type:t.type};this.subscribe(i,r,c)}return this},e.prototype.getUpdatedChildActions=function(t,e){if(0!==t.length){for(var n=t.filter(function(t,e,n){return e===n.indexOf(t)}),o=n.map(function(t){return t.id}),r=e.filter(function(t){return o.indexOf(t.id)<0});r.length>0;){if(!(i=r.pop()))break;this.removeChild(i.id)}return n}for(;e.length>0;){var i;if(!(i=e.pop()))break;this.removeChild(i.id)}},e}(E);function P(t,e,n){void 0===n&&(n=!1),t.forEach(function(t){n?(0,t.updateSubscribe)(e,[]):(0,t.unsubscribe)()}),n||(t.length=0)}function v(t,e){var n=l.default(t,e);return n||Object.assign(t,e)}function _(t,e){Object.keys(t).forEach(function(n){e(t[n])})}e.ActionSetWithChildren=T,e.updateActionFromPayload=function(t,e){return t.id===e.id&&(Object.assign(t,v(t,e)),!0)},e.getMergedProps=v,e.forEachInEnum=_,e.findMatchInEnum=function(t,e){var n=Object.keys(t).find(function(n){return e===t[n]});return n?t[n]:void 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Button="Button",t.ButtonGroup="ButtonGroup",t.Cart="Cart",t.Error="Error",t.Features="Features",t.Fullscreen="Fullscreen",t.Toast="Toast",t.Loading="Loading",t.Modal="Modal",t.Navigation="Navigation",t.Print="Print",t.TitleBar="TitleBar",t.ResourcePicker="Resource_Picker",t.ContextualSaveBar="ContextualSaveBar",t.Scanner="Scanner",t.Share="Share"}(e.Group||(e.Group={})),function(t){t.Button="Button",t.ButtonGroup="ButtonGroup"}(e.ComponentType||(e.ComponentType={}))},function(t,e,n){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var r="type_error_expected";function i(t,e,n){return void 0===n&&(n={message:void 0}),[{value:t,error:e,message:"function"==typeof n.message?n.message(e,t):n.message}]}function a(t,e,n){var r=n?t[n]:t,i=n?"['"+n+"']":void 0,a=e(r);if(a)return a.map(function(t){return o({},t,{path:""+(i||"")+(t.path||"")||void 0})})}e.matchesBoolean=function(t){return function(e){return"boolean"==typeof e?void 0:i(e,r+"_boolean",t)}},e.matchesString=function(t){return function(e){return"string"==typeof e?void 0:i(e,r+"_string",t)}},e.matchesPositiveInteger=function(t){return function(e){return!Number.isInteger(e)||e<0?i(e,r+"_integer",t):void 0}},e.matchesPositiveNumber=function(t){return function(e){return Number.isNaN(e)||!Number.isFinite(e)||e<0?i(e,r+"_number",t):void 0}},e.matchesEnum=function(t,e){return function(n){var r=Object.keys(t).map(function(e){return t[e]}),a=e&&e.message||"expected:"+r.map(function(t){return"`"+t+"`"}).join(" or ");return r.includes(n)?void 0:i(n,"invalid_enum_value",o({},e,{message:a}))}},e.matchesArray=function(t,e){return function(n){if(!Array.isArray(n))return i(n,r+"_array",e);if(t){var a=[];return n.forEach(function(e,n){var r=t(e);r&&(a=a.concat(r.map(function(t){return o({},t,{path:"['"+n+"']"+(t.path||"")})})))}),a.length?a:void 0}}},e.matchesObject=function(t,e){return function(n){if("object"!=typeof n||!n||Array.isArray(n))return i(n,r+"_object",e);var o=Object.keys(t).reduce(function(e,o){return e.concat(a(n,t[o],o)||[])},[]);return o.length?o:void 0}},e.makeOptional=function(t){return function(e){if(null!=e)return t(e)}},e.composeSchemas=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){for(var n,o=0,r=t.length;!n&&o<r;){if(n=t[o](e))return n;o++}}},e.validate=function(t,e){return a(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2);function r(t){return"string"==typeof t&&(""===t||t.startsWith("/"))}e.createActionValidator=function(t,e,n,r){void 0===e&&(e=void 0),void 0===n&&(n=!1),void 0===r&&(r=!1);var i=o.matchesObject({id:r?o.matchesString():o.makeOptional(o.matchesString())}),a=e?o.composeSchemas(i,e):i;return o.matchesObject({type:o.matchesEnum(t,{message:function(t,e){return"The action type `"+e+"` is invalid or unsupported"}}),payload:n?a:o.makeOptional(a)})},e.actionMessage=function(t){return t.map(function(t){var e=t.path,n=t.error,o=t.message,r=t.value;return"`"+n+"` thrown for"+(e?" path: "+e+" and":"")+" value: `"+("object"==typeof r?JSON.stringify(r):r)+"`"+(o?" with message: "+o:"")}).join(" | ")},e.isValidRelativePath=r,e.relativePathSchema=o.matchesObject({path:o.composeSchemas(o.matchesString(),function(t){return r(t)?void 0:[{error:"invalid_relative_path",value:t,message:"expected string to start with `/`"}]})})},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(47)),o(n(23))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(48)),o(n(20))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(53)),o(n(24))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(1);e.AnyAction=o.AnyAction,e.Dispatch=o.Dispatch,e.Unsubscribe=o.Unsubscribe;var r=n(8);e.Handler=r.Handler,e.HandlerData=r.HandlerData,function(t){t.Dispatch="Dispatch",t.Subscribe="Subscribe"}(e.PermissionType||(e.PermissionType={})),function(t){t.GetState="getState",t.Dispatch="dispatch",t.Subscribe="subscribe",t.Unsubscribe="unsubscribe"}(e.MessageType||(e.MessageType={})),function(t){t.UpdateAction="UpdateAction",t.DispatchAction="DispatchAction"}(e.LifecycleHook||(e.LifecycleHook={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=n(21),i=n(9),a=n(22);!function(t){t.Modal="Modal",t.Main="Main"}(e.Context||(e.Context={})),e.fromFrame=function(t,e,n){var a=[];if(void 0===t||!t.ownerDocument||!t.ownerDocument.defaultView)throw o.fromAction("App frame is undefined",o.AppActionType.WINDOW_UNDEFINED);var c=t.ownerDocument.defaultView;return c.addEventListener("message",function(t){if(t.origin===e&&r.isAppMessage(t))for(var n=0,o=a;n<o.length;n++)(0,o[n])(t)}),{context:n,localOrigin:e,frameWindow:t.contentWindow,hostFrame:c,dispatch:function(e){var n=t.contentWindow;n&&n.postMessage(e,"*")},subscribe:function(t){return i.addAndRemoveFromCollection(a,t)}}},e.fromWindow=function(t,e){var n=[];return void 0!==typeof window&&window.addEventListener("message",function(e){if((window!==t||a.isFrameless)&&e.source===t&&(r.isAppBridgeAction(e.data.payload)||r.isAppMessage(e)))for(var o=0,i=n;o<i.length;o++)(0,i[o])(e)}),{localOrigin:e,hostFrame:t,dispatch:function(e){if(e.source&&e.source.shopOrigin)if(a.isFrameless&&window&&window.SmartWebView)window.SmartWebView.handleMessage("frameless://fromClient",JSON.stringify(e));else{var n="https://"+e.source.shopOrigin;t.postMessage(e,n)}},subscribe:function(t){return i.addAndRemoveFromCollection(n,t)}}}},function(t,e,n){"use strict";function o(t,e,n){var o=t.findIndex(function(t){return t===e});return o>=0&&(t.splice(o,1),n&&n(e),!0)}Object.defineProperty(e,"__esModule",{value:!0}),e.addAndRemoveFromCollection=function(t,e,n){return t.push(e),function(){return o(t,e,n)}},e.removeFromCollection=o},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(57)),o(n(15))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4);e.ActionType=o.ActionType;var r=n(2),i=n(3);e.buttonSchema=r.matchesObject({disabled:r.makeOptional(r.matchesBoolean()),label:r.matchesString(),style:r.makeOptional(r.matchesEnum(o.Style)),icon:r.makeOptional(r.matchesEnum(o.Icon))}),e.buttonSchemaWithId=r.composeSchemas(r.matchesObject({id:r.matchesString()}),e.buttonSchema),e.validateProps=function(t){return r.validate(t,e.buttonSchema)},e.validateAction=function(t){var n=i.createActionValidator(o.ActionType,t.type===o.ActionType.UPDATE?e.buttonSchema:void 0,!0,!0);return r.validate(t,n)}},function(t,e,n){"use strict";var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=o(n(4));e.Button=r;var i=o(n(6));e.ButtonGroup=i;var a=o(n(25));e.Cart=a;var c=o(n(5));e.Error=c;var s=o(n(55));e.Flash=s;var u=o(n(58));e.Features=u;var p=o(n(28));e.Fullscreen=p;var l=o(n(29));e.Loading=l;var d=o(n(31));e.Modal=d;var f=o(n(61));e.History=f;var h=o(n(63));e.Redirect=h;var y=o(n(17));e.Print=y;var A=o(n(36));e.ResourcePicker=A;var O=o(n(38));e.Scanner=O;var E=o(n(40));e.TitleBar=E;var T=o(n(10));e.Toast=T;var P=o(n(42));e.ContextualSaveBar=P;var v=o(n(70));e.Share=v;var _=n(21);e.isAppBridgeAction=_.isAppBridgeAction,function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(1))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PREFIX="APP",e.SEPARATOR="::"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(4);e.getSingleButton=function(t,e,n,r){return t.addChild(e,t.group,n),t.subscribeToChild(e,o.Action.UPDATE,r),e.payload}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.SHOW="APP::TOAST::SHOW",t.CLEAR="APP::TOAST::CLEAR"}(e.ActionType||(e.ActionType={})),function(t){t.SHOW="SHOW",t.CLEAR="CLEAR"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.OPEN="OPEN",t.CLOSE="CLOSE",t.UPDATE="UPDATE",t.UPDATE_SIZE="UPDATE_SIZE"}(e.Action||(e.Action={})),function(t){t.OPEN="APP::MODAL::OPEN",t.CLOSE="APP::MODAL::CLOSE",t.UPDATE="APP::MODAL::UPDATE",t.FOOTER_BUTTON_CLICK="APP::MODAL::FOOTER::BUTTON::CLICK",t.FOOTER_BUTTON_UPDATE="APP::MODAL::FOOTER::BUTTON::UPDATE",t.UPDATE_SIZE="APP::MODAL::UPDATE_SIZE"}(e.ActionType||(e.ActionType={})),function(t){t.Small="small",t.Medium="medium",t.Large="large",t.Full="full",t.Auto="auto"}(e.Size||(e.Size={}))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(65)),o(n(35))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0});var r=n(43);o(n(7)),o(n(43)),e.default=r.createClientApp},function(t,e,n){"use strict";function o(){return r()?window.location:void 0}function r(){return"undefined"!=typeof window}Object.defineProperty(e,"__esModule",{value:!0}),e.shouldRedirect=function(t){return t===window},e.redirect=function(t){var e=o();e&&e.assign(t)},e.getLocation=o,e.getWindow=function(){return r()?window:void 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.INVALID_ACTION="INVALID_ACTION",t.INVALID_ACTION_TYPE="INVALID_ACTION_TYPE",t.INVALID_OPTIONS="INVALID_OPTIONS",t.INVALID_PAYLOAD="INVALID_PAYLOAD",t.UNEXPECTED_ACTION="UNEXPECTED_ACTION",t.PERSISTENCE="PERSISTENCE",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK="NETWORK",t.PERMISSION="PERMISSION"}(e.Action||(e.Action={})),function(t){t.INVALID_ACTION="APP::ERROR::INVALID_ACTION",t.INVALID_ACTION_TYPE="APP::ERROR::INVALID_ACTION_TYPE",t.INVALID_PAYLOAD="APP::ERROR::INVALID_PAYLOAD",t.INVALID_OPTIONS="APP::ERROR::INVALID_OPTIONS",t.UNEXPECTED_ACTION="APP::ERROR::UNEXPECTED_ACTION",t.PERSISTENCE="APP::ERROR::PERSISTENCE",t.UNSUPPORTED_OPERATION="APP::ERROR::UNSUPPORTED_OPERATION",t.NETWORK="APP::ERROR::NETWORK",t.PERMISSION="APP::ERROR::PERMISSION"}(e.ActionType||(e.ActionType={})),function(t){t.INVALID_CONFIG="APP::ERROR::INVALID_CONFIG",t.MISSING_CONFIG="APP::APP_ERROR::MISSING_CONFIG",t.MISSING_APP_BRIDGE_MIDDLEWARE="APP::APP_ERROR::MISSING_APP_BRIDGE_MIDDLEWARE",t.WINDOW_UNDEFINED="APP::APP_ERROR::WINDOW_UNDEFINED",t.MISSING_LOCAL_ORIGIN="APP::APP_ERROR::MISSING_LOCAL_ORIGIN"}(e.AppActionType||(e.AppActionType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(13),r=n(7),i=n(0);function a(t){return t.replace(new RegExp("^"+o.PREFIX+o.SEPARATOR+"\\w+"+o.SEPARATOR),"")}e.isAppBridgeAction=function(t){return t instanceof Object&&t.hasOwnProperty("type")&&t.type.toString().startsWith(o.PREFIX)},e.isFromApp=function(t){return"object"==typeof t&&"object"==typeof t.source&&"string"==typeof t.source.apiKey},e.getPermissionKey=a,e.isPermitted=function(t,e,n){var o=e.group,r=e.type;if(!o||!t.hasOwnProperty(o))return!1;var i=t[o];if(!i)return!1;var c=a(r);return!!i[c]&&!0===i[c][n]},e.isAppMessage=function(t){if("object"!=typeof t||!t.data||"object"!=typeof t.data)return!1;var e=t.data;return e.hasOwnProperty("type")&&void 0!==i.findMatchInEnum(r.MessageType,e.type)}},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.isServer="undefined"==typeof window,e.isClient=!e.isServer,e.isDevelopment=void 0!==t&&t.env&&!1,e.isProduction=!e.isDevelopment,e.isDevelopmentClient=e.isDevelopment&&e.isClient,e.isFrameless=!e.isServer&&window.navigator.userAgent.indexOf(" Frameless ")>0}).call(this,n(49))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.CLICK="CLICK",t.UPDATE="UPDATE"}(e.Action||(e.Action={})),function(t){t.CLICK="APP::BUTTON::CLICK",t.UPDATE="APP::BUTTON::UPDATE"}(e.ActionType||(e.ActionType={})),function(t){t.Print="print"}(e.Icon||(e.Icon={})),function(t){t.Danger="danger"}(e.Style||(e.Style={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={})),function(t){t.UPDATE="APP::BUTTONGROUP::UPDATE"}(e.ActionType||(e.ActionType={}))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(54)),o(n(26))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.FETCH="APP::CART::FETCH",t.UPDATE="APP::CART::UPDATE",t.SET_CUSTOMER="APP::CART::SET_CUSTOMER",t.REMOVE_CUSTOMER="APP::CART::REMOVE_CUSTOMER",t.ADD_CUSTOMER_ADDRESS="APP::CART::ADD_CUSTOMER_ADDRESS",t.UPDATE_CUSTOMER_ADDRESS="APP::CART::UPDATE_CUSTOMER_ADDRESS",t.SET_DISCOUNT="APP::CART::SET_DISCOUNT",t.REMOVE_DISCOUNT="APP::CART::REMOVE_DISCOUNT",t.SET_PROPERTIES="APP::CART::SET_PROPERTIES",t.REMOVE_PROPERTIES="APP::CART::REMOVE_PROPERTIES",t.CLEAR="APP::CART::CLEAR",t.ADD_LINE_ITEM="APP::CART::ADD_LINE_ITEM",t.UPDATE_LINE_ITEM="APP::CART::UPDATE_LINE_ITEM",t.REMOVE_LINE_ITEM="APP::CART::REMOVE_LINE_ITEM",t.SET_LINE_ITEM_DISCOUNT="APP::CART::SET_LINE_ITEM_DISCOUNT",t.REMOVE_LINE_ITEM_DISCOUNT="APP::CART::REMOVE_LINE_ITEM_DISCOUNT",t.SET_LINE_ITEM_PROPERTIES="APP::CART::SET_LINE_ITEM_PROPERTIES",t.REMOVE_LINE_ITEM_PROPERTIES="APP::CART::REMOVE_LINE_ITEM_PROPERTIES"}(e.ActionType||(e.ActionType={})),function(t){t.FETCH="FETCH",t.UPDATE="UPDATE",t.SET_CUSTOMER="SET_CUSTOMER",t.REMOVE_CUSTOMER="REMOVE_CUSTOMER",t.ADD_CUSTOMER_ADDRESS="ADD_CUSTOMER_ADDRESS",t.UPDATE_CUSTOMER_ADDRESS="UPDATE_CUSTOMER_ADDRESS",t.SET_DISCOUNT="SET_DISCOUNT",t.REMOVE_DISCOUNT="REMOVE_DISCOUNT",t.SET_PROPERTIES="SET_PROPERTIES",t.REMOVE_PROPERTIES="REMOVE_PROPERTIES",t.CLEAR="CLEAR",t.ADD_LINE_ITEM="ADD_LINE_ITEM",t.UPDATE_LINE_ITEM="UPDATE_LINE_ITEM",t.REMOVE_LINE_ITEM="REMOVE_LINE_ITEM",t.SET_LINE_ITEM_DISCOUNT="SET_LINE_ITEM_DISCOUNT",t.REMOVE_LINE_ITEM_DISCOUNT="REMOVE_LINE_ITEM_DISCOUNT",t.SET_LINE_ITEM_PROPERTIES="SET_LINE_ITEM_PROPERTIES",t.REMOVE_LINE_ITEM_PROPERTIES="REMOVE_LINE_ITEM_PROPERTIES"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.UPDATE="APP::FEATURES::UPDATE",t.REQUEST="APP::FEATURES::REQUEST",t.REQUEST_UPDATE="APP::FEATURES::REQUEST::UPDATE"}(e.ActionType||(e.ActionType={})),function(t){t.UPDATE="UPDATE",t.REQUEST="REQUEST",t.REQUEST_UPDATE="REQUEST::UPDATE"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i,a=n(0),c=n(1);!function(t){t.ENTER="ENTER",t.EXIT="EXIT"}(e.Action||(e.Action={})),function(t){t.ENTER="APP::FULLSCREEN::ENTER",t.EXIT="APP::FULLSCREEN::EXIT"}(i=e.ActionType||(e.ActionType={}));var s=function(t){function e(e){return t.call(this,e,c.Group.Fullscreen,c.Group.Fullscreen)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t){return this.app.dispatch(a.actionWrapper({group:this.group,type:i[t],payload:this.payload})),this},e}(a.ActionSet);e.Fullscreen=s,e.create=function(t){return new s(t)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(60)),o(n(30))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.START="APP::LOADING::START",t.STOP="APP::LOADING::STOP"}(e.ActionType||(e.ActionType={})),function(t){t.START="START",t.STOP="STOP"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(32)),o(n(16))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(14),c=n(0),s=n(1),u=n(4),p=n(16),l={group:s.Group.Modal,subgroups:["Footer"],type:s.ComponentType.Button};function d(t){return c.actionWrapper({group:s.Group.Modal,payload:t,type:p.ActionType.OPEN})}function f(t){return c.actionWrapper({group:s.Group.Modal,payload:t,type:p.ActionType.CLOSE})}function h(t){return c.actionWrapper({payload:t,group:s.Group.Modal,type:p.ActionType.UPDATE})}function y(t){return"string"==typeof t.url||"string"==typeof t.path}e.openModal=d,e.closeModal=f,e.updateModalSize=function(t){return c.actionWrapper({group:s.Group.Modal,payload:t,type:p.ActionType.UPDATE_SIZE})},e.clickFooterButton=function(t,e){var n=i({id:t},l);return u.clickButton(s.Group.Modal,n,e)},e.update=h,e.isIframeModal=y,e.isMessageModal=function(t){return"string"==typeof t.message};var A=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.size=p.Size.Small,e}return r(e,t),Object.defineProperty(e.prototype,"footer",{get:function(){if(this.footerPrimary||this.footerSecondary)return{buttons:{primary:this.footerPrimary,secondary:this.footerSecondary}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"footerOptions",{get:function(){if(this.footerPrimaryOptions||this.footerSecondaryOptions)return{buttons:{primary:this.footerPrimaryOptions,secondary:this.footerSecondaryOptions}}},enumerable:!0,configurable:!0}),e.prototype.close=function(){this.app.dispatch(f({id:this.id}))},e.prototype.setFooterPrimaryButton=function(t,e){var n=this,o=l.subgroups;this.footerPrimaryOptions=this.getChildButton(t,this.footerPrimaryOptions),this.footerPrimary=this.footerPrimaryOptions?a.getSingleButton(this,this.footerPrimaryOptions,o,function(t){n.updatePrimaryFooterButton(t,e)}):void 0},e.prototype.setFooterSecondaryButtons=function(t,e){var n=this,o=l.subgroups,r=t||[],i=this.footerOptions&&this.footerOptions.buttons.secondary||[];this.footerSecondaryOptions=this.getUpdatedChildActions(r,i),this.footerSecondary=this.footerSecondaryOptions?this.footerSecondaryOptions.map(function(t){return a.getSingleButton(n,t,o,function(t){n.updateSecondaryFooterButton(t,e)})}):void 0},e.prototype.getChildButton=function(t,e){var n=t?[t]:[],o=e?[e]:[],r=this.getUpdatedChildActions(n,o);return r?r[0]:void 0},e.prototype.updatePrimaryFooterButton=function(t,e){this.footer&&this.footer.buttons.primary&&c.updateActionFromPayload(this.footer.buttons.primary,t)&&e()},e.prototype.updateSecondaryFooterButton=function(t,e){if(this.footer&&this.footer.buttons&&this.footer.buttons.secondary){for(var n,o=0,r=this.footer.buttons.secondary;o<r.length;o++){var i=r[o];if(n=c.updateActionFromPayload(i,t))break}n&&e()}},e}(c.ActionSetWithChildren);e.Modal=A;var O=function(t){function e(e,n){var o=t.call(this,e,s.Group.Modal,s.Group.Modal)||this;return o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return{footer:this.footerOptions,message:this.message,size:this.size,title:this.title}},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){var n=this;void 0===e&&(e=!0);var o=c.getMergedProps(this.options,t),r=o.title,i=o.footer,a=o.message,s=o.size;return this.title=r,this.message=a,this.size=s,this.setFooterPrimaryButton(i?i.buttons.primary:void 0,function(){n.dispatch(p.Action.UPDATE)}),this.setFooterSecondaryButtons(i?i.buttons.secondary:void 0,function(){n.dispatch(p.Action.UPDATE)}),e&&this.dispatch(p.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case p.Action.OPEN:this.app.dispatch(d(this.payload));break;case p.Action.CLOSE:this.close();break;case p.Action.UPDATE:this.app.dispatch(h(this.payload))}return this},e}(A);e.ModalMessage=O;var E=function(t){function e(e,n){var o=t.call(this,e,s.Group.Modal,s.Group.Modal)||this;return o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{footer:this.footer,id:this.id})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return{footer:this.footerOptions,path:this.path,size:this.size,title:this.title,url:this.url}},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){var n=this;void 0===e&&(e=!0);var o=c.getMergedProps(this.options,t),r=o.title,i=o.footer,a=o.path,s=o.url,u=o.size;return this.title=r,this.url=s,this.path=a,this.size=u,this.setFooterPrimaryButton(i?i.buttons.primary:void 0,function(){n.dispatch(p.Action.UPDATE)}),this.setFooterSecondaryButtons(i?i.buttons.secondary:void 0,function(){n.dispatch(p.Action.UPDATE)}),e&&this.dispatch(p.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case p.Action.OPEN:this.app.dispatch(d(this.payload));break;case p.Action.CLOSE:this.close();break;case p.Action.UPDATE:this.app.dispatch(h(this.payload))}return this},e}(A);e.ModalIframe=E,e.create=function(t,e){return y(e)?new E(t,e):new O(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.PUSH="APP::NAVIGATION::HISTORY::PUSH",t.REPLACE="APP::NAVIGATION::HISTORY::REPLACE"}(e.ActionType||(e.ActionType={})),function(t){t.PUSH="PUSH",t.REPLACE="REPLACE"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.ADMIN_PATH="ADMIN::PATH",t.ADMIN_SECTION="ADMIN::SECTION",t.REMOTE="REMOTE",t.APP="APP"}(e.Action||(e.Action={})),function(t){t.ADMIN_SECTION="APP::NAVIGATION::REDIRECT::ADMIN::SECTION",t.ADMIN_PATH="APP::NAVIGATION::REDIRECT::ADMIN::PATH",t.REMOTE="APP::NAVIGATION::REDIRECT::REMOTE",t.APP="APP::NAVIGATION::REDIRECT::APP"}(e.ActionType||(e.ActionType={})),function(t){t.Product="products",t.Collection="collections",t.Order="orders",t.Customer="customers",t.Discount="discounts"}(e.ResourceType||(e.ResourceType={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.APP="APP::PRINT::APP"}(e.ActionType||(e.ActionType={})),function(t){t.APP="APP"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(66)),o(n(37))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.OPEN="OPEN",t.SELECT="SELECT",t.CLOSE="CLOSE",t.UPDATE="UPDATE",t.CANCEL="CANCEL"}(e.Action||(e.Action={})),function(t){t.OPEN="APP::RESOURCE_PICKER::OPEN",t.SELECT="APP::RESOURCE_PICKER::SELECT",t.CLOSE="APP::RESOURCE_PICKER::CLOSE",t.UPDATE="APP::RESOURCE_PICKER::UPDATE",t.CANCEL="APP::RESOURCE_PICKER::CANCEL"}(e.ActionType||(e.ActionType={})),function(t){t.Manual="MANUAL",t.BestSelling="BEST_SELLING",t.AlphaAsc="ALPHA_ASC",t.AlphaDesc="ALPHA_DESC",t.PriceDesc="PRICE_DESC",t.PriceAsc="PRICE_ASC",t.CreatedDesc="CREATED_DESC",t.Created="CREATED"}(e.CollectionSortOrder||(e.CollectionSortOrder={})),function(t){t.GiftCard="GIFT_CARD",t.Manual="MANUAL",t.ThirdParty="THIRD_PARTY"}(e.FulfillmentServiceType||(e.FulfillmentServiceType={})),function(t){t.Kilograms="KILOGRAMS",t.Grams="GRAMS",t.Pounds="POUNDS",t.Ounces="OUNCES"}(e.WeightUnit||(e.WeightUnit={})),function(t){t.Deny="DENY",t.Continue="CONTINUE"}(e.ProductVariantInventoryPolicy||(e.ProductVariantInventoryPolicy={})),function(t){t.Shopify="SHOPIFY",t.NotManaged="NOT_MANAGED",t.FulfillmentService="FULFILLMENT_SERVICE"}(e.ProductVariantInventoryManagement||(e.ProductVariantInventoryManagement={})),function(t){t.Product="product",t.ProductVariant="variant",t.Collection="collection"}(e.ResourceType||(e.ResourceType={})),function(t){t.Add="add",t.Select="select"}(e.ActionVerb||(e.ActionVerb={}))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(67)),o(n(39))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.OPEN_CAMERA="APP::SCANNER::OPEN::CAMERA",t.OPEN_NFC="APP::SCANNER::OPEN::NFC",t.CAPTURE="APP::SCANNER::CAPTURE"}(e.ActionType||(e.ActionType={})),function(t){t.OPEN_CAMERA="OPEN::CAMERA",t.OPEN_NFC="OPEN::NFC",t.CAPTURE="CAPTURE"}(e.Action||(e.Action={}))},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(68)),o(n(41))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.UPDATE="UPDATE"}(e.Action||(e.Action={})),function(t){t.UPDATE="APP::TITLEBAR::UPDATE",t.BUTTON_CLICK="APP::TITLEBAR::BUTTONS::BUTTON::CLICK",t.BUTTON_UPDATE="APP::TITLEBAR::BUTTONS::BUTTON::UPDATE",t.BUTTON_GROUP_UPDATE="APP::TITLEBAR::BUTTONS::BUTTONGROUP::UPDATE",t.BREADCRUMBS_CLICK="APP::TITLEBAR::BREADCRUMBS::BUTTON::CLICK",t.BREADCRUMBS_UPDATE="APP::TITLEBAR::BREADCRUMBS::BUTTON::UPDATE"}(e.ActionType||(e.ActionType={}))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a,c,s=n(0),u=n(1);function p(t,e){return s.actionWrapper({group:u.Group.ContextualSaveBar,type:c[t],payload:e})}!function(t){t.DISCARD="DISCARD",t.SAVE="SAVE",t.SHOW="SHOW",t.HIDE="HIDE",t.UPDATE="UPDATE"}(a=e.Action||(e.Action={})),function(t){t.DISCARD="APP::CONTEXTUAL_SAVE_BAR::DISCARD",t.SAVE="APP::CONTEXTUAL_SAVE_BAR::SAVE",t.SHOW="APP::CONTEXTUAL_SAVE_BAR::SHOW",t.HIDE="APP::CONTEXTUAL_SAVE_BAR::HIDE",t.UPDATE="APP::CONTEXTUAL_SAVE_BAR::UPDATE"}(c=e.ActionType||(e.ActionType={})),e.show=function(t){return p(a.SHOW,t)},e.hide=function(t){return p(a.HIDE,t)},e.save=function(t){return p(a.SAVE,t)},e.discard=function(t){return p(a.DISCARD,t)};var l=function(t){function e(e,n){void 0===n&&(n={});var o=t.call(this,e,u.Group.ContextualSaveBar,u.Group.ContextualSaveBar)||this;return o.options=n,o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=s.getMergedProps(this.options,t);return this.options=n,e&&this.dispatch(a.UPDATE),this},e.prototype.dispatch=function(t){return this.app.dispatch(p(t,this.payload)),this},e}(s.ActionSet);e.ContextualSaveBar=l,e.create=function(t,e){return new l(t,e)}},function(t,e,n){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(5),c=n(17),s=n(8),u=n(9),p=n(44),l=n(22),d=n(73),f=n(19),h=n(74),y=n(7),A=r(n(75));function O(){var t={},e=f.getLocation();return e?e.search.slice(e.search.indexOf("?")+1).split("&").reduce(function(t,e){var n,r=e.split("="),i=r[0],a=r[1];return o({},t,((n={})[decodeURIComponent(i)]=decodeURIComponent(a),n))},t):t}function E(t,n,o){if(void 0===o&&(o=[]),!t)throw a.fromAction(e.WINDOW_UNDEFINED_MESSAGE,a.AppActionType.WINDOW_UNDEFINED);var r=f.getLocation(),i=n||r&&r.origin;if(!i)throw a.fromAction("local origin cannot be blank",a.AppActionType.MISSING_LOCAL_ORIGIN);var c=s.fromWindow(t,i);return e.createClientApp(c,o)}function T(t){var e=f.getWindow();return e?E(e.top)(t):p.serverAppBridge}e.WINDOW_UNDEFINED_MESSAGE="window is not defined. Running an app outside a browser is not supported",e.getUrlParams=O,e.getShopOrigin=function(){return O().shop},e.createClientApp=function(t,e){void 0===e&&(e=[]);var n=[],o=[],r={};return t.subscribe(function(t){var e=t.data;switch(e.type){case"getState":n.splice(0).forEach(function(t){return t(e.payload)});break;case"dispatch":var c=e.payload;!function(t,e){var n=!1;if(r.hasOwnProperty(t))for(var o=0,c=r[t];o<c.length;o++){var s=c[o],u=s.id,p=s.callback;(!e||e.id!==u)&&u||(p(e),n=!0)}if(!n){var l=i.findMatchInEnum(a.ActionType,t);l&&a.throwError(l,e)}}(c.type,c.payload),o.forEach(function(t){return t.callback(c)})}}),function(s){if(!s.shopOrigin)throw a.fromAction("shopOrigin must be provided",a.AppActionType.INVALID_CONFIG);var p=/^https?:\/\//;if(p.test(s.shopOrigin)){var O="shopOrigin should not include protocol, please use: "+s.shopOrigin.replace(p,"");throw a.fromAction(O,a.AppActionType.INVALID_CONFIG)}if(!s.apiKey)throw a.fromAction("apiKey must be provided",a.AppActionType.INVALID_CONFIG);var E=function(t,e){return function(n,o){t.dispatch({payload:o,source:e,type:n})}}(t,s);function T(t){return E(y.MessageType.Dispatch,t),t}E(y.MessageType.Unsubscribe),function(t,e){var n=e.apiKey,o=e.shopOrigin,r=e.forceRedirect,i=void 0===r?!l.isDevelopmentClient:r,a=f.getLocation();if(!l.isFrameless&&a&&n&&o&&i&&f.shouldRedirect(t)){var c="https://"+o+"/admin/apps/"+n+a.pathname+(a.search||"");f.redirect(c)}}(t.hostFrame,s);for(var P=new A.default,v={localOrigin:t.localOrigin,hooks:P,dispatch:function(t){return v.hooks?v.hooks.run(y.LifecycleHook.DispatchAction,T,v,t):T(t)},featuresAvailable:function(t){return v.getState("features").then(function(e){return t&&Object.keys(e).forEach(function(n){t.includes(n)||delete e[n]}),e})},getState:function(t){return new Promise(function(t){n.push(t),E(y.MessageType.GetState)}).then(function(e){return t?t.split(".").reduce(function(t,n){if("object"==typeof e&&!Array.isArray(e))return t=e[n],e=t,t},void 0):e})},subscribe:function(){if(arguments.length<2)return u.addAndRemoveFromCollection(o,{callback:arguments[0]});var t=arguments[0],e=arguments[1],n=arguments[2],i={callback:e,id:n},a={type:t,id:n};return r.hasOwnProperty(t)||(r[t]=[]),E(y.MessageType.Subscribe,a),u.addAndRemoveFromCollection(r[t],i,function(){return E(y.MessageType.Unsubscribe,a)})},error:function(t,e){var n=this,o=[];return i.forEachInEnum(a.ActionType,function(r){o.push(n.subscribe(r,t,e))}),function(){o.forEach(function(t){return t()})}}},_=0,b=e;_<b.length;_++){(0,b[_])(P,v)}return function(t){t.subscribe(c.ActionType.APP,d.handleAppPrint),h.setupModalAutoSizing(t)}(v),v}},e.createAppWrapper=E,e.createApp=T,e.default=T},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),r=function(){};e.serverAppBridge={dispatch:function(){return{}},error:function(){return r},featuresAvailable:function(){return Promise.reject(o.fromAction("Feature detection is only available on the client side.",o.AppActionType.WINDOW_UNDEFINED))},getState:function(){return Promise.reject(o.fromAction("State is only available on the client side.",o.AppActionType.WINDOW_UNDEFINED))},localOrigin:"",subscribe:function(){return r}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(6);e.ActionType=o.ActionType;var r=n(11),i=n(2),a=n(3);e.buttonGroupSchema=i.composeSchemas(r.buttonSchema,i.matchesObject({buttons:i.matchesArray(i.makeOptional(r.buttonSchemaWithId))})),e.validateProps=function(t){return i.validate(t,e.buttonGroupSchema)},e.validateAction=function(t){var n=a.createActionValidator(o.ActionType,e.buttonGroupSchema,!0,!0);return i.validate(t,n)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}var r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(n(12));e.actions=a;var c=i(n(71)),s=n(19),u=n(18),p=n(44);function l(t){var e=s.getWindow();return e?u.createAppWrapper(e.top,e.location.origin,[c.default])(t):p.serverAppBridge}e.createApp=l,e.default=l,o(n(8)),o(n(18))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),c=n(1),s=n(23);function u(t,e,n){var o=e.id,r=a.getEventNameSpace(t,s.Action.CLICK,e),i={id:o,payload:n};return a.actionWrapper({type:r,group:t,payload:i})}function p(t,e,n){var o=e.id,r=n.label,c=a.getEventNameSpace(t,s.Action.UPDATE,e),u=i({id:o,label:r},n);return a.actionWrapper({type:c,group:t,payload:u})}e.clickButton=u,e.update=p,e.isValidButtonProps=function(t){return"string"==typeof t.id&&"string"==typeof t.label};var l=function(t){function e(e,n){var o=t.call(this,e,c.ComponentType.Button,c.Group.Button)||this;return o.disabled=!1,o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{disabled:this.disabled,icon:this.icon,label:this.label,style:this.style}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return i({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=a.getMergedProps(this.options,t),o=n.label,r=n.disabled,i=n.icon,c=n.style;return this.label=o,this.disabled=!!r,this.icon=i,this.style=c,e&&this.dispatch(s.Action.UPDATE),this},e.prototype.dispatch=function(t,e){switch(t){case s.Action.CLICK:this.app.dispatch(u(this.group,this.component,e));break;case s.Action.UPDATE:var n=p(this.group,this.component,this.payload);this.app.dispatch(n)}return this},e}(a.ActionSet);e.Button=l,e.create=function(t,e){return new l(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(20);function a(t,e,n){var i=e.payload;return o.actionWrapper({type:t,group:r.Group.Error,payload:{action:e,message:n,type:t,id:i&&i.id?i.id:void 0}})}!function(t){t.MISSING_PAYLOAD="Missing payload",t.INVALID_PAYLOAD_ID="Id in payload is missing or invalid"}(e.Message||(e.Message={})),e.invalidPayload=function(t,e){return a(i.ActionType.INVALID_PAYLOAD,t,e||"The action's payload is missing required properties or has invalid properties")},e.invalidActionType=function(t,e){return o.actionWrapper({group:r.Group.Error,payload:{action:t,message:e||"The action type is invalid or unsupported",type:i.ActionType.INVALID_ACTION_TYPE},type:i.ActionType.INVALID_ACTION_TYPE})},e.invalidAction=function(t,e){return o.actionWrapper({group:r.Group.Error,payload:{action:t,message:e||"The action's has missing/invalid values for `group`, `type` or `version`",type:i.ActionType.INVALID_ACTION},type:i.ActionType.INVALID_ACTION})},e.unexpectedAction=function(t,e){return o.actionWrapper({group:r.Group.Error,payload:{action:t,message:e||"Action cannot be called at this time",type:i.ActionType.UNEXPECTED_ACTION},type:i.ActionType.UNEXPECTED_ACTION})},e.unsupportedOperationAction=function(t,e){return a(i.ActionType.UNSUPPORTED_OPERATION,t,e||"The action type is unsupported")},e.persistenceAction=function(t,e){return a(i.ActionType.PERSISTENCE,t,e||"Action cannot be persisted on server")},e.networkAction=function(t,e){return a(i.ActionType.NETWORK,t,e||"Network error")},e.permissionAction=function(t,e){return a(i.ActionType.PERMISSION,t,e||"Action is not permitted")},e.isErrorEventName=function(t){return"string"==typeof o.findMatchInEnum(i.Action,t)};var c=function(){return function(t){this.name="AppBridgeError",this.message=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(this.message).stack}}();function s(t,e,n){var o=new c(t?e+": "+t:e);return o.action=n,o.type=e,o}e.AppBridgeError=c,c.prototype=Object.create(Error.prototype),e.fromAction=s,e.throwError=function(){var t,e,n=arguments[0];throw"string"==typeof arguments[1]?t=arguments[1]:(e=arguments[1],t=arguments[2]||""),s(t,n,e)}},function(t,e){var n,o,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(t){o=a}}();var s,u=[],p=!1,l=-1;function d(){p&&s&&(p=!1,s.length?u=s.concat(u):l=-1,u.length&&f())}function f(){if(!p){var t=c(d);p=!0;for(var e=u.length;e;){for(s=u,u=[];++l<e;)s&&s[l].run();l=-1,e=u.length}s=null,p=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function y(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new h(t,e)),1!==u.length||p||c(f)},h.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e,n){if(void 0!==n){if(void 0===e||!Object.getPrototypeOf(e).isPrototypeOf(n)||"Object"!==n.constructor.name&&"Array"!==n.constructor.name)return n;var o={};return Object.keys(n).forEach(function(r){e.hasOwnProperty(r)?"object"!=typeof e[r]||Array.isArray(e[r])?o[r]=n[r]:o[r]=t(e[r],n[r]):o[r]=n[r]}),Object.keys(e).forEach(function(t){n.hasOwnProperty(t)||(o[t]=e[t])}),Object.setPrototypeOf(o,Object.getPrototypeOf(e)),o}}},function(t,e,n){"use strict";function o(t){return Array.from(t).map(function(t){return("00"+t.toString(16)).slice(-2)}).join("")}function r(t){if("function"==typeof Uint8Array&&window.crypto){var e=new Uint8Array(t),n=window.crypto.getRandomValues(e);if(n)return n}return Array.from(new Array(t),function(){return 255*Math.random()|0})}function i(){var t=r(1),e=r(2);return t[0]&=191,e[0]&=79,[o(r(4)),"-",o(r(2)),"-",o(e),"-",o(t),o(r(1)),"-",o(r(6))].join("")}Object.defineProperty(e,"__esModule",{value:!0}),e.generateUuid=i,e.default=i},function(t){t.exports={name:"@shopify/app-bridge",version:"1.6.7",types:"index.d.ts",main:"index.js",unpkg:"umd/index.js",jsdelivr:"umd/index.js",files:["/actions/","/client/","/umd/","/util/","/validate/","/MessageTransport.d.ts","/MessageTransport.js","/development.d.ts","/development.js","/index.d.ts","/index.js","/production.d.ts","/production.js"],private:!1,publishConfig:{access:"public","@shopify:registry":"https://registry.npmjs.org"},repository:"git@github.com:Shopify/app-bridge.git",author:"Shopify Inc.",license:"MIT",scripts:{build:"yarn build:tsc && yarn build:umd","build:tsc":"NODE_ENV=production tsc","build:umd":"NODE_ENV=production webpack -p",check:"tsc --pretty --noEmit",clean:"cat package.json | node -pe \"JSON.parse(require('fs').readFileSync('/dev/stdin').toString()).files.map(f => './'+f).join(' ')\" | xargs rm -rf",pack:"yarn pack",size:"size-limit"},sideEffects:!1,"size-limit":[{limit:"14.5 KB",path:"production.js"}],devDependencies:{"@types/node":"^10.12.5",typescript:"3.2.1"},resolutions:{sqlite3:"4.0.1"}}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(14),c=n(0),s=n(1),u=n(24);function p(t,e,n){return function(t,e,n,o,r){var a=e.id,s=o.label,u=c.getEventNameSpace(t,n,e),p=i({id:a,label:s},o,{payload:r});return c.actionWrapper({type:u,group:t,payload:p})}(t,e,u.Action.UPDATE,n)}e.update=p,e.isGroupedButton=function(t){var e=t;return e.buttons&&e.buttons.length>0&&void 0!==e.label},e.isGroupedButtonPayload=function(t){var e=t;return Array.isArray(e.buttons)&&"string"==typeof e.id&&"string"==typeof e.label};var l=function(t){function e(e,n){var o=t.call(this,e,s.ComponentType.ButtonGroup,s.Group.ButtonGroup)||this;return o.disabled=!1,o.buttonsOptions=[],o.buttons=[],o.set(n,!1),o}return r(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{buttons:this.buttonsOptions,disabled:this.disabled,label:this.label}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=c.getMergedProps(this.options,t),o=n.label,r=n.disabled,i=n.buttons;return this.label=o,this.disabled=!!r,this.buttons=this.getButtons(i),e&&this.dispatch(u.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case u.Action.UPDATE:var e=p(this.group,this.component,this.payload);this.app.dispatch(e)}return this},e.prototype.updateButtons=function(t){if(this.buttons&&0!==this.buttons.length){for(var e,n=0,o=this.buttons;n<o.length;n++){var r=o[n];if(e=c.updateActionFromPayload(r,t))break}e&&this.dispatch(u.Action.UPDATE)}},e.prototype.getSingleButton=function(t){return a.getSingleButton(this,t,this.subgroups,this.updateButtons)},e.prototype.getButtons=function(t){var e=this,n=[];return t?(t.forEach(function(t){var o=a.getSingleButton(e,t,e.subgroups,e.updateButtons);n.push(o)}),this.buttonsOptions=t,n):[]},e}(c.ActionSetWithChildren);e.ButtonGroup=l,e.create=function(t,e){return new l(t,e)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),c=n(1),s=n(26),u=function(t){function e(e,n){return t.call(this,e,c.Group.Cart,c.Group.Cart,n?n.id:void 0)||this}return r(e,t),e.prototype.dispatch=function(t,e){switch(t){case s.Action.FETCH:this.dispatchCartAction(s.ActionType.FETCH);break;case s.Action.UPDATE:this.dispatchCartAction(s.ActionType.UPDATE,e);break;case s.Action.SET_CUSTOMER:this.dispatchCartAction(s.ActionType.SET_CUSTOMER,e);break;case s.Action.REMOVE_CUSTOMER:this.dispatchCartAction(s.ActionType.REMOVE_CUSTOMER,e);break;case s.Action.ADD_CUSTOMER_ADDRESS:this.dispatchCartAction(s.ActionType.ADD_CUSTOMER_ADDRESS,e);break;case s.Action.UPDATE_CUSTOMER_ADDRESS:this.dispatchCartAction(s.ActionType.UPDATE_CUSTOMER_ADDRESS,e);break;case s.Action.SET_DISCOUNT:this.dispatchCartAction(s.ActionType.SET_DISCOUNT,e);break;case s.Action.REMOVE_DISCOUNT:this.dispatchCartAction(s.ActionType.REMOVE_DISCOUNT,e);break;case s.Action.SET_PROPERTIES:this.dispatchCartAction(s.ActionType.SET_PROPERTIES,e);break;case s.Action.REMOVE_PROPERTIES:this.dispatchCartAction(s.ActionType.REMOVE_PROPERTIES,e);break;case s.Action.CLEAR:this.dispatchCartAction(s.ActionType.CLEAR,e);break;case s.Action.ADD_LINE_ITEM:this.dispatchCartAction(s.ActionType.ADD_LINE_ITEM,e);break;case s.Action.UPDATE_LINE_ITEM:this.dispatchCartAction(s.ActionType.UPDATE_LINE_ITEM,e);break;case s.Action.REMOVE_LINE_ITEM:this.dispatchCartAction(s.ActionType.REMOVE_LINE_ITEM,e);break;case s.Action.SET_LINE_ITEM_DISCOUNT:this.dispatchCartAction(s.ActionType.SET_LINE_ITEM_DISCOUNT,e);break;case s.Action.REMOVE_LINE_ITEM_DISCOUNT:this.dispatchCartAction(s.ActionType.REMOVE_LINE_ITEM_DISCOUNT,e);break;case s.Action.SET_LINE_ITEM_PROPERTIES:this.dispatchCartAction(s.ActionType.SET_LINE_ITEM_PROPERTIES,e);break;case s.Action.REMOVE_LINE_ITEM_PROPERTIES:this.dispatchCartAction(s.ActionType.REMOVE_LINE_ITEM_PROPERTIES,e)}return this},e.prototype.dispatchCartAction=function(t,e){this.app.dispatch(a.actionWrapper({type:t,group:c.Group.Cart,payload:i({},e||{},{id:this.id})}))},e}(a.ActionSet);e.Cart=u,e.create=function(t,e){return new u(t,e)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(56)),o(n(15))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(10),a=n(10);e.ActionBase=a.ActionBase,e.clear=a.clear,e.ClearAction=a.ClearAction,e.show=a.show,e.ShowAction=a.ShowAction,e.FlashAction=a.ToastAction;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(i.Toast);e.Flash=c,e.create=function(t,e){return new c(t,e)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),c=n(1),s=n(15);function u(t){return a.actionWrapper({group:c.Group.Toast,payload:t,type:s.ActionType.SHOW})}function p(t){return a.actionWrapper({payload:t,group:c.Group.Toast,type:s.ActionType.CLEAR})}e.show=u,e.clear=p;var l=function(t){function e(e,n){var o=t.call(this,e,c.Group.Toast,c.Group.Toast)||this;return o.message="",o.duration=5e3,o.set(n),o}return r(e,t),Object.defineProperty(e.prototype,"options",{get:function(){return{duration:this.duration,isError:this.isError,message:this.message}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return i({id:this.id},this.options)},enumerable:!0,configurable:!0}),e.prototype.set=function(t){var e=a.getMergedProps(this.options,t),n=e.message,o=e.duration,r=e.isError;return this.message=n,this.duration=o,this.isError=r,this},e.prototype.dispatch=function(t){switch(t){case s.Action.SHOW:var e=u(this.payload);this.app.dispatch(e);break;case s.Action.CLEAR:this.app.dispatch(p({id:this.id}))}return this},e}(a.ActionSet);e.Toast=l,e.create=function(t,e){return new l(t,e)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(59)),o(n(27))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),c=n(1),s=n(27),u=function(t){function e(e,n){return t.call(this,e,c.Group.Features,c.Group.Features,n?n.id:void 0)||this}return r(e,t),e.prototype.dispatch=function(t,e){switch(t){case s.Action.REQUEST:this.dispatchFeaturesAction(s.ActionType.REQUEST,e)}return this},e.prototype.dispatchFeaturesAction=function(t,e){this.app.dispatch(a.actionWrapper({group:c.Group.Features,type:t,payload:i({},e||{},{id:this.id})}))},e}(a.ActionSet);e.Features=u,e.create=function(t,e){return new u(t,e)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),c=n(30);function s(t){return i.actionWrapper({payload:t,group:a.Group.Loading,type:c.ActionType.START})}function u(t){return i.actionWrapper({payload:t,group:a.Group.Loading,type:c.ActionType.STOP})}e.start=s,e.stop=u;var p=function(t){function e(e){return t.call(this,e,a.Group.Loading,a.Group.Loading)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t){switch(t){case c.Action.START:this.app.dispatch(s(this.payload));break;case c.Action.STOP:this.app.dispatch(u(this.payload))}return this},e}(i.ActionSet);e.Loading=p,e.create=function(t){return new p(t)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(62)),o(n(33))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),c=n(1),s=n(33);function u(t){return a.actionWrapper({payload:t,group:c.Group.Navigation,type:s.ActionType.PUSH})}function p(t){return a.actionWrapper({payload:t,group:c.Group.Navigation,type:s.ActionType.REPLACE})}e.push=u,e.replace=p;var l=function(t){function e(e){return t.call(this,e,"History",c.Group.Navigation)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t,e){var n=i({},this.payload,{path:e});switch(t){case s.Action.PUSH:this.app.dispatch(u(n));break;case s.Action.REPLACE:this.app.dispatch(p(n))}return this},e}(a.ActionSet);e.History=l,e.create=function(t){return new l(t)}},function(t,e,n){"use strict";function o(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),o(n(64)),o(n(34))},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),c=n(1),s=n(34);function u(t){return!0===t.create}function p(t){var e=t;return void 0!==e.id&&void 0!==e.variant}function l(t){return a.actionWrapper({payload:t,group:c.Group.Navigation,type:s.ActionType.ADMIN_PATH})}function d(t){return a.actionWrapper({payload:t,group:c.Group.Navigation,type:s.ActionType.ADMIN_SECTION})}function f(t){return a.actionWrapper({payload:t,group:c.Group.Navigation,type:s.ActionType.REMOTE})}function h(t){return a.actionWrapper({payload:t,group:c.Group.Navigation,type:s.ActionType.APP})}e.isResourcePayload=function(t){return"string"==typeof t.id},e.isCreateResourcePayload=u,e.isProductVariantResourcePayload=p,e.isProductVariantCreateResourcePayload=function(t){return!!p(t)&&u(t.variant)},e.toAdminPath=l,e.toAdminSection=d,e.toRemote=f,e.toApp=h;var y=function(t){function e(e){return t.call(this,e,"Redirect",c.Group.Navigation)||this}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return{id:this.id}},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(t,e){switch(t){case s.Action.ADMIN_PATH:var n=function(t){return"object"==typeof t&&t.hasOwnProperty("path")}(e)?e:{path:e};this.app.dispatch(l(i({},this.payload,n)));break;case s.Action.ADMIN_SECTION:var o=function(t){return"object"==typeof t&&"object"==typeof t.section&&t.section.hasOwnProperty("name")}(e)?e:{section:e};this.app.dispatch(d(i({},this.payload,o)));break;case s.Action.APP:this.app.dispatch(h(i({},this.payload,{path:e})));break;case s.Action.REMOTE:var r=function(t){return"object"==typeof t&&t.hasOwnProperty("url")}(e)?e:{url:e};this.app.dispatch(f(i({},this.payload,r)))}return this},e}(a.ActionSet);e.Redirect=y,e.create=function(t){return new y(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(1),i=n(35);e.app=function(){return o.actionWrapper({group:r.Group.Print,type:i.ActionType.APP})}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),c=n(1),s=n(37);function u(t){return a.actionWrapper({payload:t,group:c.Group.ResourcePicker,type:s.ActionType.SELECT})}function p(t){return a.actionWrapper({payload:t,group:c.Group.ResourcePicker,type:s.ActionType.OPEN})}function l(t){return a.actionWrapper({payload:t,group:c.Group.ResourcePicker,type:s.ActionType.CANCEL})}function d(t){return a.actionWrapper({payload:t,group:c.Group.ResourcePicker,type:s.ActionType.UPDATE})}e.select=u,e.open=p,e.cancel=l,e.close=function(t){return a.actionWrapper({payload:t,group:c.Group.ResourcePicker,type:s.ActionType.CANCEL})},e.update=d;var f=function(t){function e(e,n,o){var r=t.call(this,e,c.Group.ResourcePicker,c.Group.ResourcePicker)||this;return r.selection=[],r.resourceType=o,r.set(n,!1),r}return r(e,t),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{id:this.id,resourceType:this.resourceType})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){var t={initialQuery:this.initialQuery,selectMultiple:this.selectMultiple,showHidden:this.showHidden,actionVerb:this.actionVerb};return this.resourceType===s.ResourceType.Product?i({},t,{showVariants:this.showVariants}):t},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=a.getMergedProps(this.options,t),o=n.initialQuery,r=n.showHidden,i=void 0===r||r,c=n.showVariants,u=void 0===c||c,p=n.selectMultiple,l=void 0===p||p,d=n.actionVerb,f=void 0===d?s.ActionVerb.Add:d;return this.initialQuery=o,this.showHidden=Boolean(i),this.showVariants=Boolean(u),this.selectMultiple=Boolean(l),this.actionVerb=f,e&&this.update(),this},e.prototype.dispatch=function(t,e){return t===s.Action.OPEN?this.open():t===s.Action.UPDATE?this.update():t===s.Action.CLOSE||t===s.Action.CANCEL?this.cancel():t===s.Action.SELECT&&(this.selection=e,this.app.dispatch(u({id:this.id,selection:this.selection}))),this},e.prototype.update=function(){this.app.dispatch(d(this.payload))},e.prototype.open=function(){this.app.dispatch(p(this.payload))},e.prototype.cancel=function(){this.app.dispatch(l({id:this.id}))},e.prototype.close=function(){this.cancel()},e}(a.ActionSet);e.ResourcePicker=f,e.create=function(t,e){var n=e.resourceType,o=e.options;return new f(t,void 0===o?{}:o,n)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(1),c=n(39),s=function(t){function e(e,n){return t.call(this,e,a.Group.Scanner,a.Group.Scanner,n?n.id:void 0)||this}return r(e,t),e.prototype.dispatch=function(t){switch(t){case c.Action.OPEN_CAMERA:this.dispatchScannerAction(c.ActionType.OPEN_CAMERA);break;case c.Action.OPEN_NFC:this.dispatchScannerAction(c.ActionType.OPEN_NFC)}return this},e.prototype.dispatchScannerAction=function(t){this.app.dispatch(i.actionWrapper({type:t,group:a.Group.Scanner,payload:{id:this.id}}))},e}(i.ActionSet);e.Scanner=s,e.create=function(t,e){return new s(t,e)}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a=n(4),c=n(6),s=n(69),u=n(14),p=n(0),l=n(1),d=n(41),f={group:l.Group.TitleBar,subgroups:["Buttons"]},h={group:l.Group.TitleBar,subgroups:["Breadcrumbs"],type:l.ComponentType.Button};function y(t){return p.actionWrapper({payload:t,group:l.Group.TitleBar,type:d.ActionType.UPDATE})}e.clickActionButton=function(t,e){var n=l.ComponentType.Button,o=i({id:t,type:n},f);return a.clickButton(l.Group.TitleBar,o,e)},e.clickBreadcrumb=function(t,e){var n=i({id:t},h);return a.clickButton(l.Group.TitleBar,n,e)},e.update=y;var A=function(t){function e(e,n){var o=t.call(this,e,l.Group.TitleBar,l.Group.TitleBar)||this;return o.set(n),o}return r(e,t),Object.defineProperty(e.prototype,"buttons",{get:function(){if(this.primary||this.secondary)return{primary:this.primary,secondary:this.secondary}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonsOptions",{get:function(){if(this.primaryOptions||this.secondaryOptions)return{primary:this.primaryOptions,secondary:this.secondaryOptions}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return{breadcrumbs:this.breadcrumbsOption,buttons:this.buttonsOptions,title:this.title}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"payload",{get:function(){return i({},this.options,{breadcrumbs:this.breadcrumb,buttons:this.buttons,id:this.id})},enumerable:!0,configurable:!0}),e.prototype.set=function(t,e){void 0===e&&(e=!0);var n=p.getMergedProps(this.options,t),o=n.title,r=n.buttons,i=n.breadcrumbs;return this.title=o,this.setBreadcrumbs(i),this.setPrimaryButton(r?r.primary:void 0),this.setSecondaryButton(r?r.secondary:void 0),e&&this.dispatch(d.Action.UPDATE),this},e.prototype.dispatch=function(t){switch(t){case d.Action.UPDATE:this.app.dispatch(y(this.payload))}return this},e.prototype.getButton=function(t,e,n){return t instanceof c.ButtonGroup?s.getGroupedButton(this,t,e,n):u.getSingleButton(this,t,e,n)},e.prototype.updatePrimaryButton=function(t){this.primary&&p.updateActionFromPayload(this.primary,t)&&this.dispatch(d.Action.UPDATE)},e.prototype.updateSecondaryButtons=function(t){if(this.secondary){var e=this.secondary.find(function(e){return e.id===t.id});if(e){(c.isGroupedButtonPayload(t),p.updateActionFromPayload(e,t))&&this.dispatch(d.Action.UPDATE)}}},e.prototype.updateBreadcrumbButton=function(t){this.breadcrumb&&p.updateActionFromPayload(this.breadcrumb,t)&&this.dispatch(d.Action.UPDATE)},e.prototype.setPrimaryButton=function(t){this.primaryOptions=this.getChildButton(t,this.primaryOptions),this.primary=this.primaryOptions?this.getButton(this.primaryOptions,f.subgroups,this.updatePrimaryButton):void 0},e.prototype.setSecondaryButton=function(t){var e=this,n=t||[],o=this.secondaryOptions||[];this.secondaryOptions=this.getUpdatedChildActions(n,o),this.secondary=this.secondaryOptions?this.secondaryOptions.map(function(t){return e.getButton(t,f.subgroups,e.updateSecondaryButtons)}):void 0},e.prototype.setBreadcrumbs=function(t){this.breadcrumbsOption=this.getChildButton(t,this.breadcrumbsOption),this.breadcrumb=this.breadcrumbsOption?this.getButton(this.breadcrumbsOption,h.subgroups,this.updateBreadcrumbButton):void 0},e.prototype.getChildButton=function(t,e){var n=t?[t]:[],o=e?[e]:[],r=this.getUpdatedChildActions(n,o);return r?r[0]:void 0},e}(p.ActionSetWithChildren);e.TitleBar=A,e.create=function(t,e){return new A(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(6);e.getGroupedButton=function(t,e,n,r){t.addChild(e,t.group,n);var i=e.id,a=e.label,c=e.disabled,s=e.buttons;return t.subscribeToChild(e,o.Action.UPDATE,r),{id:i,label:a,buttons:s,disabled:c}}},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var a,c,s=n(1),u=n(0);!function(t){t.SHOW="APP::SHARE::SHOW",t.CLOSE="APP::SHARE::CLOSE"}(a=e.ActionType||(e.ActionType={})),function(t){t.SHOW="SHOW",t.CLOSE="CLOSE"}(c=e.Action||(e.Action={}));var p=function(t){function e(e){return t.call(this,e,s.Group.Share,s.Group.Share)||this}return r(e,t),e.prototype.dispatch=function(t,e){switch(t){case c.SHOW:this.dispatchShareAction(a.SHOW,e);break;default:throw"Action: "+t+" not supported"}return this},e.prototype.dispatchShareAction=function(t,e){this.app.dispatch(u.actionWrapper({type:t,group:s.Group.Share,payload:i({id:this.id},e)}))},e}(u.ActionSet);e.Share=p,e.create=function(t){return new p(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(72);e.default=o.validatorMiddleware},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(18),r=n(12),i=n(5),a=n(76),c=n(2),s=n(3),u=n(0);function p(t,e){var n=c.validate(t,c.matchesObject({group:c.matchesEnum(r.Group,{message:function(t,e){return"Unknown or unsupported action group `"+e+"`"}}),version:c.matchesString()}));if(n)return i.invalidAction(t,s.actionMessage(n));var o=function(t,e){switch(t.group){case r.Group.Button:return a.Button.validateAction(t);case r.Group.ButtonGroup:return a.ButtonGroup.validateAction(t);case r.Group.Modal:return a.Modal.validateAction(t,e);case r.Group.TitleBar:return a.TitleBar.validateAction(t);case r.Group.ResourcePicker:return a.ResourcePicker.validateAction(t);case r.Group.Loading:return a.Loading.validateAction(t);case r.Group.Toast:return a.Toast.validateAction(t);case r.Group.Cart:return a.Cart.validateAction(t);case r.Group.Navigation:return a.Navigation.validateAction(t);case r.Group.Print:return a.Print.validateAction(t);case r.Group.Scanner:return a.Scanner.validateAction(t);case r.Group.Fullscreen:return a.Fullscreen.validateAction(t);case r.Group.ContextualSaveBar:return a.ContextualSaveBar.validateAction(t)}}(t,e);return o?i.invalidPayload(t,s.actionMessage(o)):t}e.connectValidatorToUpdateHook=function(t){return function(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];var c=u.getMergedProps(this.options,e),p=function(t,e,n){switch(e){case r.Group.Button:return a.Button.validateProps(n);case r.Group.ButtonGroup:return a.ButtonGroup.validateProps(n);case r.Group.Modal:return a.Modal.validateProps(n,t);case r.Group.TitleBar:return a.TitleBar.validateProps(n);case r.Group.ResourcePicker:return a.ResourcePicker.validateProps(n);case r.Group.Toast:return a.Toast.validateProps(n);case r.Group.ContextualSaveBar:return a.ContextualSaveBar.validateProps(n)}}(this.app.localOrigin,this.defaultGroup,c);if(p)throw i.fromAction(s.actionMessage(p),i.ActionType.INVALID_OPTIONS);return t.apply(void 0,[e].concat(n))}},e.connectValidatorToDispatchHook=function(t){return function(e){var n=p(e,this.localOrigin);return t(n)}},e.validatorMiddleware=function(t){t.set(o.LifecycleHook.UpdateAction,e.connectValidatorToUpdateHook),t.set(o.LifecycleHook.DispatchAction,e.connectValidatorToDispatchHook)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(19);function r(){o.getWindow()&&window.print()}function i(){var t=function(){var t=o.getWindow();if(t&&t.document&&t.document.body){var e=window.document.createElement("input");return e.style.display="none",window.document.body.appendChild(e),e}}();t&&(t.select(),r(),t.remove())}e.handleAppPrint=function(){navigator.userAgent.indexOf("iOS")>=0?i():r()}},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{s(o.next(t))}catch(t){i(t)}}function c(t){try{s(o.throw(t))}catch(t){i(t)}}function s(t){t.done?r(t.value):new n(function(e){e(t.value)}).then(a,c)}s((o=o.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(32),a=n(16),c=n(8);function s(t,e){var n,o=-1;function r(){var n=document.body.scrollHeight;n!==o&&(o=n,t.dispatch(i.updateModalSize({id:e,height:String(n)})))}new MutationObserver(function(){n&&window.clearTimeout(n);n=window.setTimeout(r,16)}).observe(document.body,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),r()}e.setupModalAutoSizing=function(t){return o(this,void 0,void 0,function(){return r(this,function(e){return[2,t.getState().then(function(e){if(e.context===c.Context.Modal){var n=e.modal,o=n.id;n.size===a.Size.Auto&&s(t,o)}})]})})},e.createMutationObserver=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(9),r=function(){function t(){this.map={}}return t.prototype.set=function(t,e){this.map.hasOwnProperty(t)||(this.map[t]=[]);var n={handler:e,remove:function(){}},r=o.addAndRemoveFromCollection(this.map[t],n);return n={handler:e,remove:r},r},t.prototype.get=function(t){var e=this.map[t];return e?e.map(function(t){return t.handler}):void 0},t.prototype.run=function(t,e,n){for(var o=[],r=3;r<arguments.length;r++)o[r-3]=arguments[r];var i=0,a=this.get(t)||[];return function t(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var c=a[i++];return c?c(t).apply(n,o):e.apply(n,o)}.apply(n,o)},t}();e.default=r},function(t,e,n){"use strict";var o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=o(n(11));e.Button=r;var i=o(n(77));e.Scanner=i;var a=o(n(78));e.Cart=a;var c=o(n(79));e.ContextualSaveBar=c;var s=o(n(80));e.Fullscreen=s;var u=o(n(81));e.Loading=u;var p=o(n(82));e.Modal=p;var l=o(n(84));e.Navigation=l;var d=o(n(85));e.Print=d;var f=o(n(45));e.ButtonGroup=f;var h=o(n(86));e.ResourcePicker=h;var y=o(n(87));e.Toast=y;var A=o(n(88));e.TitleBar=A},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(38);e.ActionType=o.ActionType;var r=n(2),i=n(3);e.validateAction=function(t){return r.validate(t,i.createActionValidator(o.ActionType))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(25);e.ActionType=o.ActionType;var r=n(2),i=n(3),a=r.matchesObject({address1:r.makeOptional(r.matchesString()),address2:r.makeOptional(r.matchesString()),city:r.makeOptional(r.matchesString()),company:r.makeOptional(r.matchesString()),firstName:r.makeOptional(r.matchesString()),lastName:r.makeOptional(r.matchesString()),phone:r.makeOptional(r.matchesString()),province:r.makeOptional(r.matchesString()),country:r.makeOptional(r.matchesString()),zip:r.makeOptional(r.matchesString()),name:r.makeOptional(r.matchesString()),provinceCode:r.makeOptional(r.matchesString()),countryCode:r.makeOptional(r.matchesString())}),c=r.matchesObject({amount:r.makeOptional(r.matchesPositiveInteger()),discountDescription:r.makeOptional(r.matchesString()),type:r.makeOptional(r.matchesString()),discountCode:r.makeOptional(r.matchesString())}),s=r.matchesObject({amount:r.matchesPositiveNumber(),discountDescription:r.makeOptional(r.matchesString()),type:r.makeOptional(r.matchesString())}),u=r.matchesObject({discountCode:r.matchesString()}),p=r.matchesObject({price:r.makeOptional(r.matchesPositiveNumber()),quantity:r.makeOptional(r.matchesPositiveInteger()),title:r.makeOptional(r.matchesString()),variantId:r.makeOptional(r.matchesPositiveInteger()),discount:r.makeOptional(s)}),l=r.matchesObject({quantity:r.matchesPositiveInteger()}),d=r.matchesObject({id:r.makeOptional(r.matchesPositiveInteger()),email:r.makeOptional(r.matchesString()),firstName:r.makeOptional(r.matchesString()),lastName:r.makeOptional(r.matchesString()),note:r.makeOptional(r.matchesString()),addresses:r.makeOptional(r.matchesArray(a))}),f=r.matchesObject({name:r.matchesString(),value:r.matchesString()}),h=r.matchesObject({cartDiscount:r.makeOptional(c),customer:r.makeOptional(d),grandTotal:r.makeOptional(r.matchesString()),lineItems:r.makeOptional(r.matchesArray(p)),noteAttributes:r.makeOptional(r.matchesArray(f)),subTotal:r.makeOptional(r.matchesString()),taxTotal:r.makeOptional(r.matchesString())}),y=r.composeSchemas(r.matchesObject({}),function(t){var e=r.matchesString(),n=Object.keys(t).reduce(function(t,n){return t[n]=e,t},{});return r.validate(t,r.matchesObject(n))}),A=r.matchesArray(r.matchesString());function O(t){return i.createActionValidator(o.ActionType,t?r.matchesObject({data:t}):void 0,!0,!0)}function E(t){var e=r.matchesObject({index:r.matchesPositiveInteger()});if(t){var n=r.matchesObject({data:t});return i.createActionValidator(o.ActionType,r.composeSchemas(e,n),!0,!0)}return i.createActionValidator(o.ActionType,e,!0,!0)}e.validateAction=function(t){switch(t.type){case o.ActionType.UPDATE:return r.validate(t,O(h));case o.ActionType.SET_CUSTOMER:return r.validate(t,O(d));case o.ActionType.ADD_CUSTOMER_ADDRESS:return r.validate(t,O(a));case o.ActionType.UPDATE_CUSTOMER_ADDRESS:return r.validate(t,E(a));case o.ActionType.SET_DISCOUNT:return r.validate(t,O(t.payload.data.amount?s:u));case o.ActionType.SET_PROPERTIES:return r.validate(t,O(y));case o.ActionType.REMOVE_PROPERTIES:return r.validate(t,O(A));case o.ActionType.ADD_LINE_ITEM:return r.validate(t,O(p));case o.ActionType.UPDATE_LINE_ITEM:return r.validate(t,E(l));case o.ActionType.REMOVE_LINE_ITEM:return r.validate(t,E());case o.ActionType.SET_LINE_ITEM_DISCOUNT:return r.validate(t,E(s));case o.ActionType.REMOVE_LINE_ITEM_DISCOUNT:return r.validate(t,E());case o.ActionType.SET_LINE_ITEM_PROPERTIES:return r.validate(t,E(y));case o.ActionType.REMOVE_LINE_ITEM_PROPERTIES:return r.validate(t,E(A));case o.ActionType.FETCH:case o.ActionType.REMOVE_CUSTOMER:case o.ActionType.REMOVE_DISCOUNT:case o.ActionType.CLEAR:default:return r.validate(t,i.createActionValidator(o.ActionType,void 0,!1,!0))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(2),r=n(42);e.ActionType=r.ActionType;var i=n(3);e.contextSaveBarSchema=o.makeOptional(o.matchesObject({discardAction:o.makeOptional(o.matchesObject({disabled:o.makeOptional(o.matchesBoolean()),discardConfirmationModal:o.makeOptional(o.matchesBoolean())})),saveAction:o.makeOptional(o.matchesObject({disabled:o.makeOptional(o.matchesBoolean())}))})),e.validateProps=function(t){return o.validate(t,e.contextSaveBarSchema)},e.validateAction=function(t){var n=i.createActionValidator(r.ActionType,e.contextSaveBarSchema);return o.validate(t,n)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(28);e.ActionType=o.ActionType;var r=n(2),i=n(3);e.validateAction=function(t){var e=i.createActionValidator(o.ActionType);return r.validate(t,e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(29);e.ActionType=o.ActionType;var r=n(2),i=n(3);e.validateAction=function(t){var e=i.createActionValidator(o.ActionType);return r.validate(t,e)}},function(t,e,n){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),i=n(3),a=n(11),c=n(31);e.ActionType=c.ActionType;var s=n(4),u=n(83);function p(t,e){void 0===t&&(t={});var n=r.matchesObject({title:r.makeOptional(r.matchesString()),footer:r.makeOptional(r.matchesObject({buttons:r.matchesObject({primary:r.makeOptional(a.buttonSchemaWithId),secondary:r.makeOptional(r.matchesArray(a.buttonSchemaWithId))})})),size:r.makeOptional(r.matchesEnum(c.Size))});if(c.isIframeModal(t)){if(t.url){var o=r.matchesObject({url:r.composeSchemas(r.matchesString(),function(t){return t.startsWith("https://")?void 0:[{error:"invalid_secure_url",value:t,message:"expected string to start with `https://`"}]},function(t){return e?function(t,e){var n;try{n=new URL(e).hostname}catch(t){return[{error:"invalid_app_origin",value:e,message:"Provided value for app origin: `"+e+"` is invalid"}]}if(!u.isSafe(t,{requireAbsolute:!0,requireSSL:!0,whitelist:[n]}))return[{error:"unsafe_origin",value:t,message:"Provided value is not whitelisted"}]}(t,e):void 0})});return r.composeSchemas(n,o)}return r.composeSchemas(n,i.relativePathSchema)}return r.composeSchemas(n,r.matchesObject({message:r.matchesString()}))}e.validateProps=function(t,e){return r.validate(t,p(t,e))},e.validateAction=function(t,e){var n=p(t.payload,e);switch(t.type){case c.ActionType.OPEN:case c.ActionType.UPDATE:return r.validate(t,i.createActionValidator(c.ActionType,n,!0,t.type===c.ActionType.UPDATE));case c.ActionType.FOOTER_BUTTON_CLICK:return a.validateAction(o({},t,{type:s.ActionType.CLICK}));case c.ActionType.FOOTER_BUTTON_UPDATE:return a.validateAction(o({},t,{type:s.ActionType.UPDATE}));case c.ActionType.CLOSE:default:return r.validate(t,i.createActionValidator(c.ActionType))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=/\/\/\//,r=/[\/\\][\/\\]/,i=["https:","http:"],a="http://test.com";function c(t,e){var n,c=void 0===e?{}:e,u=c.whitelist,p=void 0===u?[]:u,l=c.subdomains,d=void 0===l?[]:l,f=c.matchPath,h=c.requireAbsolute,y=c.requireSSL;if(o.test(t))return!1;if(t.startsWith("/"))return!(p.length>0||d.length>0||h||y)&&(f?s(new URL(t,a),t,f):!r.test(t));try{n=new URL(t)}catch(t){return!1}return!!i.includes(n.protocol)&&((!y||"https:"===n.protocol)&&(!n.username&&!n.password&&(!(f&&!s(n,t,f))&&!!function(t,e,n){if(!n.every(function(t){return t.startsWith(".")}))throw new TypeError("Subdomains must begin with .");var o=t.hostname;return 0===e.length&&0===n.length||e.includes(o)||n.some(function(t){return o.endsWith(t)})}(n,p,d))))}function s(t,e,n){var o=t.pathname,r=e.replace(t.origin,"").split("?")[0];return"string"==typeof n?o===n&&r===n:n.test(o)&&n.test(r)}e.isSafe=c,e.makeSafe=function(t,e,n){return c(t,n)?encodeURI(t):e}},function(t,e,n){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var r=n(12),i=n(2),a=n(3);e.validateAction=function(t){var e,n,c,s,u,p=i.matchesObject({newContext:i.makeOptional(i.matchesBoolean())}),l=r.Redirect.ActionType;switch(t.type){case r.History.ActionType.PUSH:case r.History.ActionType.REPLACE:l=r.History.ActionType,e=a.relativePathSchema;break;case r.Redirect.ActionType.APP:e=a.relativePathSchema;break;case r.Redirect.ActionType.REMOTE:e=i.composeSchemas(i.matchesObject({url:i.composeSchemas(i.matchesString(),function(t){return function(t){return t.match("^https?://")?void 0:[{value:t,error:"invalid_absolute_url",message:"expected string to start with `https://` or `http://`"}]}(t)})}),p);break;case r.Redirect.ActionType.ADMIN_PATH:e=i.composeSchemas(a.relativePathSchema,p);break;case r.Redirect.ActionType.ADMIN_SECTION:e=i.composeSchemas((n=t.payload,c=n&&n.section&&n.section.resource&&n.section.name===r.Redirect.ResourceType.Product,s={create:i.makeOptional(i.matchesBoolean()),id:i.makeOptional(i.matchesString())},u=o({},s,{variant:i.makeOptional(i.matchesObject(s))}),i.matchesObject({section:i.matchesObject({name:i.matchesEnum(r.Redirect.ResourceType),resource:i.makeOptional(i.matchesObject(c?u:s))})})),p)}return i.validate(t,a.createActionValidator(l,e))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(17);e.ActionType=o.ActionType;var r=n(2),i=n(3);e.validateAction=function(t){return r.validate(t,i.createActionValidator(o.ActionType))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(36);e.ActionType=o.ActionType;var r=n(2),i=n(3),a=r.matchesObject({initialQuery:r.makeOptional(r.matchesString()),selectMultiple:r.makeOptional(r.matchesBoolean()),showHidden:r.makeOptional(r.matchesBoolean()),showVariants:r.makeOptional(r.matchesBoolean()),actionVerb:r.makeOptional(r.matchesEnum(o.ActionVerb))}),c=r.matchesObject({resourceType:r.matchesEnum(o.ResourceType),options:r.makeOptional(a)}),s=r.matchesObject({selection:r.matchesArray(r.matchesObject({id:r.matchesString()}))});e.validateProps=function(t){return r.validate(t,a)},e.validateAction=function(t){switch(t.type){case o.ActionType.UPDATE:case o.ActionType.OPEN:return r.validate(t,i.createActionValidator(o.ActionType,c,!1,!0));case o.ActionType.SELECT:return r.validate(t,i.createActionValidator(o.ActionType,s,!0,!0));case o.ActionType.CANCEL:case o.ActionType.CLOSE:default:return r.validate(t,i.createActionValidator(o.ActionType))}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(10);e.ActionType=o.ActionType;var r=n(2),i=n(3);e.toastSchema=r.matchesObject({message:r.matchesString(),duration:r.matchesPositiveInteger(),isError:r.makeOptional(r.matchesBoolean())}),e.validateProps=function(t){return r.validate(t,e.toastSchema)},e.validateAction=function(t){switch(t.type){case o.ActionType.SHOW:return r.validate(t,i.createActionValidator(o.ActionType,e.toastSchema,!0));default:return r.validate(t,i.createActionValidator(o.ActionType))}}},function(t,e,n){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var r=n(40);e.ActionType=r.ActionType;var i=n(4),a=n(6),c=n(2),s=n(3),u=n(11),p=n(45),l=c.composeSchemas(u.buttonSchema,c.matchesObject({id:c.matchesString()}));e.titleBarSchema=c.matchesObject({breadcrumbs:c.makeOptional(u.buttonSchema),title:c.makeOptional(c.matchesString()),buttons:c.makeOptional(c.matchesObject({primary:c.makeOptional(l),secondary:c.makeOptional(c.matchesArray(c.composeSchemas(l,c.matchesObject({buttons:c.makeOptional(c.matchesArray(l))}))))}))}),e.validateProps=function(t){return c.validate(t,e.titleBarSchema)},e.validateAction=function(t){switch(t.type){default:case r.ActionType.UPDATE:return c.validate(t,s.createActionValidator(r.ActionType,e.titleBarSchema,!0,!1));case r.ActionType.BUTTON_CLICK:case r.ActionType.BREADCRUMBS_CLICK:return u.validateAction(o({},t,{type:i.ActionType.CLICK}));case r.ActionType.BUTTON_UPDATE:case r.ActionType.BREADCRUMBS_UPDATE:return u.validateAction(o({},t,{type:i.ActionType.UPDATE}));case r.ActionType.BUTTON_GROUP_UPDATE:return p.validateAction(o({},t,{type:a.ActionType.UPDATE}))}}}])});
\No newline at end of file