{"version":3,"file":"sso-Cs47Lv3j.js","sources":["../../../app/javascript/entrypoints/sso.js"],"sourcesContent":["(async () => {\n // å‹•çš„ã«Formを作æˆã—ã¦POSTã™ã‚‹\n const post = (path, params, method = \"post\") => {\n const form = document.createElement(\"form\");\n form.method = method;\n form.action = path;\n\n for (const key in params) {\n if (params.hasOwnProperty(key)) {\n const hiddenField = document.createElement(\"input\");\n hiddenField.type = \"hidden\";\n hiddenField.name = key;\n hiddenField.value = params[key];\n form.appendChild(hiddenField);\n }\n }\n document.body.appendChild(form);\n form.submit();\n };\n\n // SSOã€Railså´ã®ãƒã‚°ã‚¤ãƒ³çŠ¶æ³ã‚’ãƒã‚§ãƒƒã‚¯ã—ã¦ã€å¿…è¦ã§ã‚ã‚Œã°ãƒã‚°ã‚¤ãƒ³å‡¦ç†ã«ç§»è¡Œã™ã‚‹\n const result = await fetch(`${gon.global.libecityUrl}/identityService/customToken`, {\n mode: \"cors\",\n credentials: \"include\",\n });\n\n const json = await result.json();\n const customToken = json.custom_token || \"\";\n const ssoLoggedIn = customToken !== \"\";\n const isLoginPage = window.location.pathname.startsWith(\"/login\");\n\n if (isLoginPage) {\n post(\"/login\", { custom_token: customToken });\n return;\n }\n\n if (ssoLoggedIn && gon.logged_in) {\n return;\n }\n\n if (!ssoLoggedIn && gon.logged_in) {\n post(\"/logout\", {});\n return;\n }\n\n post(\"/login\", { custom_token: customToken });\n})();\n"],"names":["post","path","params","method","form","key","hiddenField","customToken","ssoLoggedIn"],"mappings":"CAAC,SAAY,CAEX,MAAMA,EAAO,CAACC,EAAMC,EAAQC,EAAS,SAAW,CAC9C,MAAMC,EAAO,SAAS,cAAc,MAAM,EAC1CA,EAAK,OAASD,EACdC,EAAK,OAASH,EAEd,UAAWI,KAAOH,EAChB,GAAIA,EAAO,eAAeG,CAAG,EAAG,CAC9B,MAAMC,EAAc,SAAS,cAAc,OAAO,EAClDA,EAAY,KAAO,SACnBA,EAAY,KAAOD,EACnBC,EAAY,MAAQJ,EAAOG,CAAG,EAC9BD,EAAK,YAAYE,CAAW,CACpC,CAEI,SAAS,KAAK,YAAYF,CAAI,EAC9BA,EAAK,OAAQ,CACd,EASKG,GADO,MALE,MAAM,MAAM,GAAG,IAAI,OAAO,WAAW,+BAAgC,CAClF,KAAM,OACN,YAAa,SACjB,CAAG,GAEyB,KAAM,GACP,cAAgB,GACnCC,EAAcD,IAAgB,GAGpC,GAFoB,OAAO,SAAS,SAAS,WAAW,QAAQ,EAE/C,CACfP,EAAK,SAAU,CAAE,aAAcO,CAAW,CAAE,EAC5C,MACJ,CAEE,GAAI,EAAAC,GAAe,IAAI,WAIvB,IAAI,CAACA,GAAe,IAAI,UAAW,CACjCR,EAAK,UAAW,EAAE,EAClB,MACJ,CAEEA,EAAK,SAAU,CAAE,aAAcO,CAAW,CAAE,EAC9C,GAAI"}