text: define("wixCodeInit/utils/urlBuilder",[],function(){"use strict";function e(){for(var e=arguments[0],t=1;t<arguments.length;++t)e=e.replace(/\/$/,"")+"/"+arguments[t].replace(/^\//,"");return e}function t(e){return/^https?:\/\/localhost\/?$/.test(e)}function i(e){return/^https?:\/\/s3.amazonaws.com\/integration-tests-statics\/(.+)\/SNAPSHOT\/santa?$/.test(e)}function n(e){return/^\d+\.\d+\.\d+$/.test(e)}function r(e,t){var i=e.lastIndexOf("/");return n(t)?e.substring(0,i+1)+t:e}function o(e,n){var o=e.serviceTopology,a=t(e.santaBase)||i(e.santaBase)?o.scriptsLocationMap.santa:e.santaBase;return a=r(a,n),/(.*\/services\/)?(.*)/.exec(a)[2]}function a(t,i,n,r){var a=r?"pub":"dev",s="//"+i.instanceId+"."+a+".",c=t.serviceTopology.wixCloudBaseDomain,d="node_modules/santa-wix-code/"+(n.useWixCodeFallback?"fallback.html":"index.html");return s+e(c,"_partials",o(t,n.runtimeSource),d)}function s(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")}return{buildUrl:function(e,t,i){i=i||{};var n=!!e.publicModel,r=a(e,t,i,n),o={compId:"wixCode_"+t.appDefinitionId,deviceType:i.isMobileView?"mobile":"desktop",viewMode:n?"site":e.renderFlags.componentViewMode||"preview",locale:e.rendererModel.languageCode,wixCodeBase:e.santaBase+"/node_modules/santa-wix-code","wix-code-platform":e.serviceTopology.scriptsLocationMap["wix-code-platform"]};return i.sdkSource&&(o.sdkSource=i.sdkSource),i.semiNativeSDKSource&&(o.semiNativeSDKSource=i.semiNativeSDKSource),i.applications&&(o.applications=JSON.stringify(i.applications)),i.ReactSource&&(o.ReactSource=i.ReactSource),i.ReactLibSource&&(o.ReactLibSource=i.ReactLibSource),i.ReactDomSource&&(o.ReactDomSource=i.ReactDomSource),r+"?"+s(o)},buildStaticUrl:function(e,t){t=t||{};var i=e.santaBase+"/node_modules/santa-wix-code/"+(t.useWixCodeFallback?"fallback.html":"index.html"),n=!!e.publicModel,r={deviceType:t.isMobileView?"mobile":"desktop",viewMode:n?"site":e.renderFlags.componentViewMode||"preview",locale:e.rendererModel.languageCode};return t.sdkSource&&(r.sdkSource=t.sdkSource),t.semiNativeSDKSource&&(r.semiNativeSDKSource=t.semiNativeSDKSource),t.applications&&(r.applications=JSON.stringify(t.applications)),t.ReactSource&&(r.ReactSource=t.ReactSource),t.ReactLibSource&&(r.ReactLibSource=t.ReactLibSource),t.ReactDomSource&&(r.ReactDomSource=t.ReactDomSource),i+"?"+s(r)}}}),define("wixCodeInit/utils/messageHolder",[],function(){"use strict";return{get:function(){var e=[],t=null;return{sendOrHoldMessage:function(i){t?t(i):e.push(i)},setMessageTarget:function(i){for(t=i;e.length>0;)t(e.shift())}}}}}),define("wixCodeInit/utils/iFrameUtils",["lodash"],function(e){"use strict";return{getIFrameForApp:function(t,i){var n=window.document.createElement("iframe");return n.style.cssText="position: fixed; left: 0; right: 0; top: 0; bottom: 0; width: 1px; height: 1px; background: transparent; border: 0",n.tabIndex=-1,n.setAttribute("aria-hidden","true"),n.src=t,e.get(i,"applicationId")&&e.get(i,"appDefinitionId")&&(n.setAttribute("data-app-id",i.applicationId),n.setAttribute("data-app-definition-id",i.appDefinitionId)),n},isIFrameEvent:function(e,t){return t.source===e.contentWindow}}}),define("wixCodeInit/utils/appsUtils",["lodash"],function(e){"use strict";function t(t,i){return e(i).map(function(e){return t.getDynamicPageData(e)}).find()}function i(i,n,r){if(i){var o=t(i,r);if(o){var a=o.routerData,s=o.routerDefinition;if(a&&s)if("wix-code"===s.appDefinitionId)e.forEach(r,function(t){e.forEach(n,function(e){e.id===t&&(e.routerData=a)})});else{var c=e.find(n,{id:s.appDefinitionId});c&&(c.routerData=a)}}}}function n(t){return e(t).reject({displayName:"siteextension"}).map(function(t){return e.assign({type:w.APPLICATION},t)}).value()}function r(t){return!!e.get(t,["wixCodeModel","appData","codeAppId"])}function o(t){return e.some(t.widgets,{componentFields:{semiNative:!0}})}function a(t,i,n,o,a){if(r(o.rendererModel)&&e.find(t,i)){var s=o.isPlatformAppOnPage("masterPage","wixCode");e.forEach(n,function(t){var i=o.isPlatformAppOnPage(t,"wixCode"),n=o.getDataByQuery(t),r=e.get(n,"isPopup");i&&a.push({id:t,type:r?w.POPUP:w.PAGE,displayName:o.getPageTitle(t)}),!r&&s&&a.push({id:t,type:w.MASTER_PAGE})})}}function s(t,r,o){t=e.without(t,"masterPage");var s=n(o);return a(o,{displayName:"siteextension"},t,r,s),i(r,s,t),s}function c(){for(var e=arguments[0],t=1;t<arguments.length;++t)e=e.replace(/\/$/,"")+"/"+arguments[t].replace(/^\//,"");return e}function d(e,t,i){var n=c(e.scriptsDomainUrl,"services",t);return i?c(n,i):e.scriptsLocationMap[t]}function u(t,i,n){if(e.get(t,"port")&&e.get(t,"path")&&e.get(t,"id")){n=e.endsWith(n,"/")?n.slice(0,-1):n;var r,o=e.template("<%= santaBase %><%= port %>/<%= path %>");r=/^(http(s)?:)?\/\//.test(t.path)?t.path:o("80"===t.port?{santaBase:n,port:"",path:t.path}:{santaBase:n,port:":"+t.port,path:t.path}),i.push({type:w.APPLICATION,id:t.id,url:r,displayName:t.id})}}function p(t,i,n,o,a){r(a)&&e.find(t,{type:"siteextension"})&&!e.find(i,{id:"dataBinding"})&&i.push({type:w.APPLICATION,id:"dataBinding",url:c(d(n,"dbsm-viewer-app",o.dataBinding),"/app.js"),hasSemiNativeWidgets:!1,displayName:"Data Binding"})}function l(t,i){return e(t).filter(function(t){return r(i)&&"siteextension"===t.type||e.has(t,"appFields.platform.viewerScriptUrl")}).map(function(t){var i={id:t.appDefinitionId,displayName:t.type,appInnerId:t.applicationId,instance:t.instance},n=e.get(t,"appFields.platform.viewerScriptUrl");return n&&(i.url=n),i.hasSemiNativeWidgets=o(t),i}).value()}function f(e){var t=l(e.clientSpecMap,e.rendererModel),i=m(e.viewerPlatformAppSources);return u(i,t,e.santaBase),p(e.clientSpecMap,t,e.serviceTopology,i,e.rendererModel),t}function g(t,i,n){return s(i,n,f({clientSpecMap:t,viewerPlatformAppSources:e.get(n,["currentUrl","query","viewerPlatformAppSources"]),serviceTopology:n.serviceTopology,santaBase:n.santaBase,rendererModel:n.rendererModel}))}function m(t){return e(t||"").split(",").invokeMap("split",/:(.+)/).fromPairs().value()}var w={POPUP:"Popup",PAGE:"Page",MASTER_PAGE:"masterPage",APPLICATION:"Application"};return{getApplications:g,getUserCodeDefinitions:function(t,i,n){return e.reject(g(t,i,n),{type:w.APPLICATION})},getAppsBaseInfo:function(t){var i=f(t);return e.filter(n(i),"url")}}}),define("wixCodeInit/utils/widgetsPreLoader",["wixCodeInit/utils/appsUtils"],function(e){"use strict";function t(e,t,c,d){if(n())return s.push([e,t,c,d]),void requirejs(["utils","widgets","wixCode"],i);var u=d(r);u.currentUrl=r.urlUtils.parseUrl(e);var p=r.wixUrlParser.parseUrl(u,e),l=p&&p.pageId;if(l){var f=t(o,u,l),g=a.wixCodeWidgetService.getWixCodeSpec(u.getClientSpecMap());c(a.messageBuilder.getExtendedMessage(f,u.rendererModel.wixCodeModel||{},g,u))}}function i(e,i,c){if(n()){r=e,o=i,a=c;for(var d=0;d<s.length;d++)t.apply(null,s[d]);s.length=0}}function n(){return!r||!o||!a}var r=null,o=null,a=null,s=[];return{asyncGetPreLoadMessage:function(i,n,r){t(n,function(t,n,r){var o=e.getApplications(i.rendererModel.clientSpecMap,[r],n),a=i.routers||{configMap:{}};return t.messageBuilder.loadWidgetsMessage(o,a.configMap,[r])},r,function(e){return new e.FullSiteData(i,function(){})})},asyncGetPreLoadUserCodeMessage:function(i,n,r){t(n,function(t,n,r){var o=e.getUserCodeDefinitions(i.rendererModel.clientSpecMap,[r],n);return t.messageBuilder.loadUserCodesMessage(o,[r])},r,function(e){return new e.FullSiteData(i,function(){})})},asyncGetPreInitMessage:function(e,i,n){t(i,function(e,t,i){var n={};return n[i]=e.widgetService.getContextInitData(t,i),e.messageBuilder.initWidgetsMessage(n)},n,function(){return e})},registerDeps:i}}),define("wixCodeInit/utils/specMapUtils",[],function(){"use strict";var e="siteextension";return{getAppSpec:function(t){for(var i in t)if(t.hasOwnProperty(i)&&t[i].type===e)return t[i]}}}),define("wixCodeInit/api/wixCodeAppApi",["lodash","wixCodeInit/utils/urlBuilder","wixCodeInit/utils/messageHolder","wixCodeInit/utils/iFrameUtils","wixCodeInit/utils/widgetsPreLoader","wixCodeInit/utils/specMapUtils","wixCodeInit/utils/appsUtils"],function(e,t,i,n,r,o,a){"use strict";function s(e){return("PLATFORM_IFRAME"===e.intent||"WIX_CODE"===e.intent)&&"wix_code_iframe_loaded"===e.type}function c(e){return"WIX_CODE_SITE_API"===e.intent&&"reportBI"===e.type}function d(e){function t(){var t=window.document.body;t.insertBefore(e,t.firstChild),window&&window.performance&&window.performance.mark&&window.performance.mark("platform-iframe-added-to-dom")}"loading"!==window.document.readyState?t():window.document.addEventListener("DOMContentLoaded",function(){t()})}function u(t){var i=t.rendererModel.clientSpecMap.toJS?t.rendererModel.clientSpecMap.toJS():t.rendererModel.clientSpecMap;return!!t.rendererModel.wixCodeModel&&e.some(i,{type:"siteextension"})}return{getApi:function(){function e(e,t){if(n.isIFrameEvent(e,t)){if(s(t.data)&&m.setMessageTarget(function(t){e.contentWindow.postMessage(t,"*")}),c(t.data)&&!f.length&&"undefined"!=typeof window){var i=t.data.reportDef,r=t.data.params;i.errorCode?window.wixBiSession.sendError(i,r.p1,r.p2,r.p3,r.p4):window.wixBiSession.sendBI(i.endpoint,i.eventId,i.src,r)}f.forEach(function(e){e(t.data)})}}function p(e){return g.reduce(function(e,t){return t(e)},e)}var l,f=[],g=[],m=i.get(),w=!1,v=!0,M=null,S=null,x=null;return{init:function(i,r,s){if(w)console.warn("Wix code is already initiated");else{var c,p=a.getAppsBaseInfo({clientSpecMap:r,serviceTopology:i.serviceTopology,rendererModel:i.rendererModel}).length>0;if(u(i)){var f=o.getAppSpec(r);c=t.buildUrl(i,f,s),l=n.getIFrameForApp(c,f)}else{if(!p)return;c=t.buildStaticUrl(i,s),l=n.getIFrameForApp(c,{})}var g=e.bind(null,l);window.addEventListener("message",g,!1),d(l),w=!0}},sendMessage:function(e){e&&m.sendOrHoldMessage(p(e))},registerMessageHandler:function(e){f.push(e)},registerMessageModifier:function(e){g.push(e)},unregisterMessageHandler:function(e){var t=f.indexOf(e);-1!==t&&f.splice(t,1)},preLoadWidgets:function(e,t){!M&&u(e)&&r.asyncGetPreLoadMessage(e,t,function(e){v&&!M&&(M=e,m.sendOrHoldMessage(M))})},preLoadUserCode:function(e,t){(!S&&u(e)||a.getAppsBaseInfo({clientSpecMap:e.rendererModel.clientSpecMap,serviceTopology:e.serviceTopology,rendererModel:e.rendererModel}))&&r.asyncGetPreLoadUserCodeMessage(e,t,function(e){S||(S=e,m.sendOrHoldMessage(S))})},preInitWidgets:function(e,t){!x&&u(e)&&r.asyncGetPreInitMessage(e,t,function(e){x||(x=e,m.sendOrHoldMessage(x))})},isAppInitiated:function(){return w},getAppsIframe:function(){return l}}}}}),define("wixCodeInit/api/initMainR",["lodash","wixCodeInit/utils/specMapUtils","wixCodeInit/utils/appsUtils"],function(e,t,i){"use strict";var n="//static.parastorage.com/services/semi-native-sdk/1.7.0/lib/wix.min.js",r="//unpkg.parastorage.com/react@16/umd/react",o="//unpkg.parastorage.com/react-dom@16/umd/react-dom";return function(a,s,c,d,u,p,l){function f(e){return t.getAppSpec(e)||y.applications.length}function g(e){return new e.FullSiteData(c,function(){})}function m(t,i){if(!i)return!1;var n=e.find(t.pageList.pages,{pageId:i});return!!n&&!n.pageJsonFileName}function w(e){var t=g(e);t.currentUrl=e.urlUtils.parseUrl(p);var i=e.wixUrlParser.parseUrl(t,p);return i&&i.pageId}function v(e,t,i){t&&m(t,w(i))||(a.init(c,e,y),f(e)&&(a.preLoadUserCode(c,p),!!c.publicModel&&a.preLoadWidgets(c,p)))}p=p||window.document.location.href;var M=e.trimEnd(c.serviceTopology.scriptsLocationMap["js-wixcode-sdk"],"/")+"/lib/"+(u.getParameterByName("debug")?"wix.js":"wix.min.js"),S=n||e.trimEnd(c.serviceTopology.scriptsLocationMap["semi-native-sdk"],"/")+"/lib/"+(u.getParameterByName("debug")?"wix.js":"wix.min.js"),x=function(e){return"false"!==e&&("true"===e||!window.Worker||l)}(u.getParameterByName("useWixCodeFallback")),I=r+(u.getParameterByName("debug")?".development.js":".production.min.js"),C=o+(u.getParameterByName("debug")?".development.js":".production.min.js"),y={isMobileView:d,sdkSource:M,semiNativeSDKSource:S,runtimeSource:u.getParameterByName("WixCodeRuntimeSource"),ReactLibSource:I,ReactDomSource:C,ReactSource:u.getParameterByName("ReactSource"),useWixCodeFallback:x},P=u.getParameterByName("viewerPlatformAppSources");y.applications=i.getAppsBaseInfo({rendererModel:c.rendererModel,clientSpecMap:c.rendererModel.clientSpecMap,serviceTopology:c.serviceTopology,viewerPlatformAppSources:P,santaBase:c.santaBase}),function(){function t(e){v(c.rendererModel.clientSpecMap,c.publicModel,e)}e.isObject(s)?t(s):requirejs.defined("utils")?t(requirejs("utils")):requirejs(["utils"],t)}()}}),define("wixCodeInit",["wixCodeInit/api/wixCodeAppApi","wixCodeInit/api/initMainR","wixCodeInit/utils/specMapUtils","wixCodeInit/utils/appsUtils","wixCodeInit/utils/widgetsPreLoader"],function(e,t,i,n,r){"use strict";return{getAppApi:e.getApi,initMainR:t,specMapUtils:i,appsUtils:n,registerDeps:r.registerDeps}});
  //# sourceMappingURL=wixCodeInit.min.js.map