import{i as s}from"./url.b17313e6.js";import"./jwt-decode.esm.611ae497.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="e3fb9694-c766-4e89-8bd4-8cca2b9dcced",e._sentryDebugIdIdentifier="sentry-dbid-e3fb9694-c766-4e89-8bd4-8cca2b9dcced")}catch{}})();function n(e){return e.startsWith("/")?e.slice(1):e}function d(e,r,c={}){if(s(r)){const a=new URL(r),t=new URLSearchParams(c),i=new URLSearchParams(a.search),o=new URLSearchParams([...i,...t]);return a.search=o.toString(),{action:"REPLACE_LOCAL_HREF",newHref:a.toString()}}else{const a=r.replace(/\/$/,"");if(e==="player")return{action:"GOTO_FORM_PLAYER",path:n(a),queryParams:c};if(e==="editor")return{action:"GOTO_FORM_EDITOR",path:n(a),queryParams:c};if(e==="preview")return{action:"GOTO_FORM_PLAYER",path:n(a),queryParams:c};throw new Error(`Invalid routing ${e}`)}}async function w(e,r,c,a={}){const t=d(e,c,a);switch(t.action){case"REPLACE_LOCAL_HREF":window.location.href=t.newHref;break;case"GOTO_FORM_EDITOR":await r.push({name:"formEditor",params:{formPath:t.path},query:t.queryParams});break;case"GOTO_FORM_PLAYER":await r.push({name:e==="preview"?"formPreview":"formPlayer",params:{formPath:t.path},query:t.queryParams});break;default:throw new Error("Invalid routing")}}export{w as r};
//# sourceMappingURL=redirect.5f56a6ae.js.map
