text: "use strict";define("wixCodeInit/utils/urlBuilder",["experiment"],function(e){function t(){for(var e=arguments[0],t=1;t<arguments.length;++t)e=e.replace(/\/$/,"")+"/"+arguments[t].replace(/^\//,"");return e}function i(e){return/^https?:\/\/localhost\/?$/.test(e)}function n(e){return/^https?:\/\/s3.amazonaws.com\/integration-tests-statics\/(.+)\/SNAPSHOT\/santa?$/.test(e)}function r(e){return/^\d+\.\d+\.\d+$/.test(e)}function a(e,t){var i=e.lastIndexOf("/");return r(t)?e.substring(0,i+1)+t:e}function o(e,t){var r=e.serviceTopology,o=i(e.santaBase)||n(e.santaBase)?r.scriptsLocationMap.santa:e.santaBase;return o=a(o,t),/(.*\/services\/)?(.*)/.exec(o)[2]}function s(i,n,r,a){var s;s=e.isOpen("sv_splitRouterUrls")?a?"//"+n.instanceId+".pub.":"//"+n.instanceId+".dev.":"//"+n.instanceId+".";var d=i.serviceTopology.wixCloudBaseDomain,p="node_modules/santa-wix-code/"+(r.useWixCodeFallback?"fallback.html":"index.html");return s+t(d,"_partials",o(i,r.runtimeSource),p)}function d(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")}function p(e,t,i){i=i||{};var n=!!e.publicModel,r=s(e,t,i,n),a={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&&(a.sdkSource=i.sdkSource),i.applications&&(a.applications=JSON.stringify(i.applications)),i.ReactSource&&(a.ReactSource=i.ReactSource),r+"?"+d(a)}function c(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.applications&&(r.applications=JSON.stringify(t.applications)),t.ReactSource&&(r.ReactSource=t.ReactSource),i+"?"+d(r)}return{buildUrl:p,buildStaticUrl:c}}),define("wixCodeInit/utils/messageHolder",[],function(){function e(){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())}}}return{get:e}}),define("wixCodeInit/utils/iFrameUtils",["lodash"],function(e){function t(t,i){var n=window.document.createElement("iframe");return n.style.cssText="position: fixed; left: 0; right: 0; top: 0; bottom: 0; width: 100%; height: 100%; 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}function i(e,t){return t.source===e.contentWindow}return{getIFrameForApp:t,isIFrameEvent:i}}),define("wixCodeInit/utils/constants",[],function(){return{APPS:{SANTA_MEMBERS:{appDefId:"14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9"}}}}),define("wixCodeInit/utils/appsUtils",["lodash","wixCodeInit/utils/constants"],function(e,t){function i(t,i){return e(i).map(function(e){return t.getDynamicPageData(e)}).find()}function n(t,n,r){if(t){var a=i(t,r);if(a){var o=a.routerData,s=a.routerDefinition;if(o&&s)if("wix-code"===s.appDefinitionId)e.forEach(r,function(t){e.forEach(n,function(e){e.id===t&&(e.routerData=o)})});else{var d=e.find(n,{id:s.appDefinitionId});d&&(d.routerData=o)}}}}function r(t){var i={displayName:"siteextension"};return e(t).reject(i).map(function(t){return e.assign({type:I.APPLICATION},t)}).value()}function a(t){return!!e.get(t,["wixCodeModel","appData","codeAppId"])}function o(t,i,n,r,o){if(a(r.rendererModel)&&e.find(t,i)){var s=r.isPlatformAppOnPage("masterPage","wixCode");e.forEach(n,function(t){var i=r.isPlatformAppOnPage(t,"wixCode"),n=r.getDataByQuery(t),a=e.get(n,"isPopup");i&&o.push({id:t,type:a?I.POPUP:I.PAGE,displayName:r.getPageTitle(t)}),!a&&s&&o.push({id:t,type:I.MASTER_PAGE})})}}function s(t,i,a){t=e.without(t,"masterPage");var s={displayName:"siteextension"},d=r(a);return o(a,s,t,i,d),n(i,d,t),d}function d(){for(var e=arguments[0],t=1;t<arguments.length;++t)e=e.replace(/\/$/,"")+"/"+arguments[t].replace(/^\//,"");return e}function p(e,t,i){var n=d(e.scriptsDomainUrl,"services",t);return i?d(n,i):e.scriptsLocationMap[t]}function c(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,a=e.template("<%= santaBase %><%= port %>/<%= path %>");r=/^(http(s)?:)?\/\//.test(t.path)?t.path:a("80"===t.port?{santaBase:n,port:"",path:t.path}:{santaBase:n,port:":"+t.port,path:t.path}),i.push({type:I.APPLICATION,id:t.id,url:r,displayName:t.id})}}function u(t,i,n,r,o){a(o)&&e.find(t,{type:"siteextension"})&&!e.find(i,{id:"dataBinding"})&&i.push({type:I.APPLICATION,id:"dataBinding",url:d(p(n,"dbsm-viewer-app",r.dataBinding),"/app.js"),displayName:"Data Binding"})}function l(i,n){return e.reduce(i,function(e,i){switch(i.appDefinitionId){case t.APPS.SANTA_MEMBERS.appDefId:e.push({id:i.appDefinitionId,displayName:i.type,appInnerId:i.applicationId,url:n.scriptsLocationMap["santa-members-viewer-app"]+"/app.js"})}return e},[])}function f(t,i){return e(t).filter(function(t){return a(i)&&"siteextension"===t.type||e.has(t,"platformApp.viewerUrl")}).map(function(t){var i={id:t.appDefinitionId,displayName:t.type,appInnerId:t.applicationId},n=e.get(t,"platformApp.viewerUrl");return n&&(i.url=n),i}).value()}function g(e){var t=f(e.clientSpecMap,e.rendererModel);t=t.concat(l(e.clientSpecMap,e.serviceTopology));var i=m(e.viewerPlatformAppSources);return c(i,t,e.santaBase),u(e.clientSpecMap,t,e.serviceTopology,i,e.rendererModel),t}function w(t){var i=g(t);return e.filter(r(i),"url")}function M(t,i,n){return s(i,n,g({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()}function v(t,i,n){return e.reject(M(t,i,n),{type:I.APPLICATION})}var I={POPUP:"Popup",PAGE:"Page",MASTER_PAGE:"masterPage",APPLICATION:"Application"};return{getApplications:M,getUserCodeDefinitions:v,getAppsBaseInfo:w}}),define("wixCodeInit/utils/widgetsPreLoader",["wixCodeInit/utils/appsUtils"],function(e){function t(e,t,i,n){if(o())return c.push([e,t,i,n]),void requirejs(["utils","widgets","wixCode"],a);var r=n(s);r.currentUrl=s.urlUtils.parseUrl(e);var u=s.wixUrlParser.parseUrl(r,e),l=u&&u.pageId;if(l){var f=t(d,r,l),g=p.wixCodeWidgetService.getWixCodeSpec(r.getClientSpecMap());i(p.messageBuilder.getExtendedMessage(f,r.rendererModel.wixCodeModel||{},g,r))}}function i(i,n,r){t(n,function(t,n,r){var a=e.getApplications(i.rendererModel.clientSpecMap,[r],n),o=i.routers||{configMap:{}};return t.messageBuilder.loadWidgetsMessage(a,o.configMap,[r])},r,function(e){return new e.FullSiteData(i,function(){})})}function n(i,n,r){t(n,function(t,n,r){var a=e.getUserCodeDefinitions(i.rendererModel.clientSpecMap,[r],n);return t.messageBuilder.loadUserCodesMessage(a,[r])},r,function(e){return new e.FullSiteData(i,function(){})})}function r(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})}function a(e,i,n){if(o()){s=e,d=i,p=n;for(var r=0;r<c.length;r++)t.apply(null,c[r]);c.length=0}}function o(){return!s||!d||!p}var s=null,d=null,p=null,c=[];return{asyncGetPreLoadMessage:i,asyncGetPreLoadUserCodeMessage:n,asyncGetPreInitMessage:r,registerDeps:a}}),define("wixCodeInit/utils/specMapUtils",[],function(){function e(e){for(var i in e)if(e.hasOwnProperty(i)&&e[i].type===t)return e[i]}var t="siteextension";return{getAppSpec:e}}),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,a,o){function s(e){return"WIX_CODE"===e.intent&&"wix_code_iframe_loaded"===e.type}function d(e){return"WIX_CODE_SITE_API"===e.intent&&"reportBI"===e.type}function p(e){function t(){var t=window.document.body;t.insertBefore(e,t.firstChild)}"loading"!==window.document.readyState?t():window.document.addEventListener("DOMContentLoaded",function(){t()})}function c(t){var i=t.rendererModel.clientSpecMap.toJS?t.rendererModel.clientSpecMap.toJS():t.rendererModel.clientSpecMap;return!!t.rendererModel.wixCodeModel&&e.some(i,{type:"siteextension"})}function u(){function e(e,t){if(n.isIFrameEvent(e,t)){if(s(t.data)&&y.setMessageTarget(function(t){e.contentWindow.postMessage(t,"*")}),d(t.data)&&!S.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)}S.forEach(function(e){e(t.data)})}}function u(){return P}function l(i,r,s){if(P)console.warn("Wix code is already initiated");else{var d,u,l=o.getAppsBaseInfo({clientSpecMap:r,serviceTopology:i.serviceTopology,rendererModel:i.rendererModel}).length>0;if(c(i)){var f=a.getAppSpec(r);d=t.buildUrl(i,f,s),u=n.getIFrameForApp(d,f)}else{if(!l)return;d=t.buildStaticUrl(i,s),u=n.getIFrameForApp(d,{})}var g=e.bind(null,u);window.addEventListener("message",g,!1),p(u),P=!0}}function f(e){S.push(e)}function g(e){C.push(e)}function w(e){return C.reduce(function(e,t){return t(e)},e)}function M(e){e&&y.sendOrHoldMessage(w(e))}function m(e,t){!h&&c(e)&&r.asyncGetPreLoadMessage(e,t,function(e){A&&!h&&(h=e,y.sendOrHoldMessage(h))})}function v(e,t){(!U&&c(e)||o.getAppsBaseInfo({clientSpecMap:e.rendererModel.clientSpecMap,serviceTopology:e.serviceTopology,rendererModel:e.rendererModel}))&&r.asyncGetPreLoadUserCodeMessage(e,t,function(e){U||(U=e,y.sendOrHoldMessage(U))})}function I(e,t){!B&&c(e)&&r.asyncGetPreInitMessage(e,t,function(e){B||(B=e,y.sendOrHoldMessage(B))})}function x(e){var t=S.indexOf(e);-1!==t&&S.splice(t,1)}var S=[],C=[],y=i.get(),P=!1,A=!0,h=null,U=null,B=null;return{init:l,sendMessage:M,registerMessageHandler:f,registerMessageModifier:g,unregisterMessageHandler:x,preLoadWidgets:m,preLoadUserCode:v,preInitWidgets:I,isAppInitiated:u}}return{getApi:u}}),define("wixCodeInit/api/initMainR",["lodash","wixCodeInit/utils/specMapUtils","wixCodeInit/utils/appsUtils"],function(e,t,i){function n(n,r,a,o,s,d,p){function c(e){return t.getAppSpec(e)||m.applications.length}function u(e){return new e.FullSiteData(a,function(){})}function l(t,i){return!!i&&!e.find(t.pageList.pages,{pageId:i}).pageJsonFileName}function f(e){var t=u(e);t.currentUrl=e.urlUtils.parseUrl(d);var i=e.wixUrlParser.parseUrl(t,d);return i&&i.pageId}function g(e,t,i){t&&l(t,f(i))||(n.init(a,e,m),c(e)&&(n.preLoadUserCode(a,d),!!a.publicModel&&n.preLoadWidgets(a,d)))}d=d||window.document.location.href;var w=e.trimEnd(a.serviceTopology.scriptsLocationMap["js-wixcode-sdk"],"/")+"/lib/"+(s.getParameterByName("debug")?"wix.js":"wix.min.js"),M="true"===s.getParameterByName("useWixCodeFallback")||!window.Worker||p,m={isMobileView:o,sdkSource:w,runtimeSource:s.getParameterByName("WixCodeRuntimeSource"),ReactSource:s.getParameterByName("ReactSource"),useWixCodeFallback:M},v=s.getParameterByName("viewerPlatformAppSources");m.applications=i.getAppsBaseInfo({rendererModel:a.rendererModel,clientSpecMap:a.rendererModel.clientSpecMap,serviceTopology:a.serviceTopology,viewerPlatformAppSources:v,santaBase:a.santaBase}),function(){function t(e){g(a.rendererModel.clientSpecMap,a.publicModel,e)}e.isObject(r)?t(r):requirejs.defined("utils")?t(requirejs("utils")):requirejs(["utils"],t)}()}return n}),define("wixCodeInit",["wixCodeInit/api/wixCodeAppApi","wixCodeInit/api/initMainR","wixCodeInit/utils/specMapUtils","wixCodeInit/utils/appsUtils","wixCodeInit/utils/widgetsPreLoader"],function(e,t,i,n,r){return{getAppApi:e.getApi,initMainR:t,specMapUtils:i,appsUtils:n,registerDeps:r.registerDeps}});
  //# sourceMappingURL=wixCodeInit.min.js.map