Files
Gnuboard7/public/build/core/template-engine.min.js
T
HeuJung 90f154ecc0 fix(security): 배포본 소스맵 노출 차단 + 관리자 설정 탭 지연로딩 + 동반 결함 수정
## 소스맵 노출 차단 (공개 이슈 )

배포본에 .map 이 포함돼 원본 TS/TSX 전문(sourcesContent, 한글 주석 포함)이
그대로 노출됐다. 생성·서빙·저장소 유입 3계층을 모두 막는다.

- 빌드 config 15곳(코어 3 + _bundled 12): sourcemap 하드코딩 제거.
 G7_BUILD_SOURCEMAP 판정식으로 교체 — 미설정(로컬 npm run build)이면 생성해
 개발 디버깅 경험을 보존하고, 0 이면 미생성.
- Build{Core,Module,Plugin,Template}Command: 죽어 있던 --production 플래그 복구.
 $productionMode 를 콘솔 문자열에만 쓰고 npm 프로세스에 env 를 넘기지 않아
 산출물이 개발 빌드와 동일했다. runNpmCommand 에 $env 를 추가해 주입
 (--watch 에는 미주입). Symfony Process 는 부모 환경에 병합하므로 PATH 유실 없음.
- Allowed{Module,Plugin}FileType / {Module,Plugin}Service::getMimeType:
 허용 확장자 map 제거 — 익명 200 서빙 차단(템플릿은 원래 미허용, 3종 정책 일치).
- ExtensionBundleService: CSS 번들의 /*# sourceMappingURL=... */ strip 추가.
 CSS 는 블록 주석이라 JS 의 //# 패턴으로는 검출되지 않던 구멍.
- 추적 .map 13개 삭제 + .gitignore 전역 *.map 규칙(경로 한정 시 새 확장에서 누락).

실측: 산출 JS 의 sourceMappingURL 13 → 0, 추적 .map 13 → 0,
확장 디렉토리 npm run build 는 여전히 map 생성(개발 경험 회귀 없음).

## 관리자 환경설정 탭 지연 로딩

코어/이커머스/게시판 환경설정 화면이 진입 즉시 전 탭의 데이터소스를 한꺼번에
호출했다. 각 데이터소스에 활성 탭 조건(if)을 걸어 해당 탭에서만 fetch 하도록
변경하고, 결제 플러그인 3종의 테스트모드 상태 조회도 주문설정 탭으로 한정.

## 동반 결함 수정 (무관 결함 — 재발 방지 목적으로 같은 세션 처리)

- 나이스페이먼츠: 체크아웃 캐시 프리페치가 라우트를 가리지 않아 플러그인 번들이
 로드되는 모든 페이지(홈/게시판/로그인)에서 주문서를 조회 → 비회원 매번 422.
 형제 플러그인(kginicis)의 기존 가드 패턴을 적용해 체크아웃 경로로 한정.
- admin smoke 8건: 대부분 구현이 아니라 테스트 결함이었다 — URL 오타(단수 board),
 존재하지 않는 권한키, 앱 로케일이 en 인데 한국어 라벨 로케이터, DataGrid 버튼을
 먼저 잡던 휴리스틱 로케이터. 레이아웃에는 sticky className / 안정 id 를 부여.
- PHPDoc ↔ Pint 충돌 3건: 설명 없는 @param 은 no_superfluous_phpdoc_tags 가
 삭제해 audit phpdoc-public-method 와 무한 충돌. 한국어 설명을 붙여 양쪽 충족
 (리스너 3종의 설명 누락 메서드도 전수 보강).
- Log::spy 500 3건: spy 가 Log::channel('activity') 를 null 로 만들고
 logActivity 가 null->info 로 \Error → 같은 줄 catch(\Exception) 은 못 잡아
 통과. 운영에선 채널이 항상 로거이므로 제품 무결 → 테스트에 activity 채널
 보존 헬퍼 추가.
- NhnKcpApiServiceTest 5건: 스텁이 Unix 바이너리만 만들어 Windows 분기
 (pp_cli_exe.exe)에서만 실패. #!/bin/sh 는 Windows 실행 불가 → 파일 내 기존
 컨벤션대로 skip 가드.

## 테스트

- 소스맵 범위 130 passed (신규: BuildCommandSourcemapEnv, NoSourcemapArtifacts,
 ExtensionBundleService CSS strip, Allowed*FileType 반전, 자산 서빙 거부)
- 결제 3플러그인 505 passed / 0 failed (skipped 9 = Windows 전용 CLI, 사유 명시)
- 나이스페이먼츠 프론트 38 passed (가드 제거 시 red 실증 후 복원)
- E2E: production-sourcemap-exposure.spec.ts 6건 + 시나리오 매니페스트

버전: sirsoft-admin_basic 1.0.2 → 1.0.3, sirsoft-board 1.0.1 → 1.0.2
(각 manifest/package/lock/composer 동기화). 코어 7.0.4 는 미출시 누적.
2026-07-14 12:50:23 +09:00

244 lines
741 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var Px=Object.defineProperty;var Gx=(Vt,Ka,Wa)=>Ka in Vt?Px(Vt,Ka,{enumerable:!0,configurable:!0,writable:!0,value:Wa}):Vt[Ka]=Wa;var $=(Vt,Ka,Wa)=>Gx(Vt,typeof Ka!="symbol"?Ka+"":Ka,Wa);(function(Vt){"use strict";function Ka(o,e){for(var a=0;a<e.length;a++){const r=e[a];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in o)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(o,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}function Wa(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Bu={exports:{}},Ke={};var kg;function AS(){if(kg)return Ke;kg=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function S(x){return x===null||typeof x!="object"?null:(x=v&&x[v]||x["@@iterator"],typeof x=="function"?x:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,T={};function L(x,K,re){this.props=x,this.context=K,this.refs=T,this.updater=re||E}L.prototype.isReactComponent={},L.prototype.setState=function(x,K){if(typeof x!="object"&&typeof x!="function"&&x!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,x,K,"setState")},L.prototype.forceUpdate=function(x){this.updater.enqueueForceUpdate(this,x,"forceUpdate")};function M(){}M.prototype=L.prototype;function R(x,K,re){this.props=x,this.context=K,this.refs=T,this.updater=re||E}var D=R.prototype=new M;D.constructor=R,A(D,L.prototype),D.isPureReactComponent=!0;var U=Array.isArray;function j(){}var q={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ge(x,K,re){var de=re.ref;return{$$typeof:o,type:x,key:K,ref:de!==void 0?de:null,props:re}}function Ee(x,K){return ge(x.type,K,x.props)}function Ce(x){return typeof x=="object"&&x!==null&&x.$$typeof===o}function $e(x){var K={"=":"=0",":":"=2"};return"$"+x.replace(/[=:]/g,function(re){return K[re]})}var qe=/\/+/g;function Xe(x,K){return typeof x=="object"&&x!==null&&x.key!=null?$e(""+x.key):K.toString(36)}function ht(x){switch(x.status){case"fulfilled":return x.value;case"rejected":throw x.reason;default:switch(typeof x.status=="string"?x.then(j,j):(x.status="pending",x.then(function(K){x.status==="pending"&&(x.status="fulfilled",x.value=K)},function(K){x.status==="pending"&&(x.status="rejected",x.reason=K)})),x.status){case"fulfilled":return x.value;case"rejected":throw x.reason}}throw x}function Q(x,K,re,de,se){var me=typeof x;(me==="undefined"||me==="boolean")&&(x=null);var Ne=!1;if(x===null)Ne=!0;else switch(me){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(x.$$typeof){case o:case e:Ne=!0;break;case m:return Ne=x._init,Q(Ne(x._payload),K,re,de,se)}}if(Ne)return se=se(x),Ne=de===""?"."+Xe(x,0):de,U(se)?(re="",Ne!=null&&(re=Ne.replace(qe,"$&/")+"/"),Q(se,K,re,"",function(Ae){return Ae})):se!=null&&(Ce(se)&&(se=Ee(se,re+(se.key==null||x&&x.key===se.key?"":(""+se.key).replace(qe,"$&/")+"/")+Ne)),K.push(se)),1;Ne=0;var ve=de===""?".":de+":";if(U(x))for(var He=0;He<x.length;He++)de=x[He],me=ve+Xe(de,He),Ne+=Q(de,K,re,me,se);else if(He=S(x),typeof He=="function")for(x=He.call(x),He=0;!(de=x.next()).done;)de=de.value,me=ve+Xe(de,He++),Ne+=Q(de,K,re,me,se);else if(me==="object"){if(typeof x.then=="function")return Q(ht(x),K,re,de,se);throw K=String(x),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function fe(x,K,re){if(x==null)return x;var de=[],se=0;return Q(x,de,"","",function(me){return K.call(re,me,se++)}),de}function ye(x){if(x._status===-1){var K=x._result;K=K(),K.then(function(re){(x._status===0||x._status===-1)&&(x._status=1,x._result=re)},function(re){(x._status===0||x._status===-1)&&(x._status=2,x._result=re)}),x._status===-1&&(x._status=0,x._result=K)}if(x._status===1)return x._result.default;throw x._result}var te=typeof reportError=="function"?reportError:function(x){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof x=="object"&&x!==null&&typeof x.message=="string"?String(x.message):String(x),error:x});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",x);return}console.error(x)},he={map:fe,forEach:function(x,K,re){fe(x,function(){K.apply(this,arguments)},re)},count:function(x){var K=0;return fe(x,function(){K++}),K},toArray:function(x){return fe(x,function(K){return K})||[]},only:function(x){if(!Ce(x))throw Error("React.Children.only expected to receive a single React element child.");return x}};return Ke.Activity=b,Ke.Children=he,Ke.Component=L,Ke.Fragment=a,Ke.Profiler=i,Ke.PureComponent=R,Ke.StrictMode=r,Ke.Suspense=f,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(x){return q.H.useMemoCache(x)}},Ke.cache=function(x){return function(){return x.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(x,K,re){if(x==null)throw Error("The argument must be a React element, but you passed "+x+".");var de=A({},x.props),se=x.key;if(K!=null)for(me in K.key!==void 0&&(se=""+K.key),K)!X.call(K,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&K.ref===void 0||(de[me]=K[me]);var me=arguments.length-2;if(me===1)de.children=re;else if(1<me){for(var Ne=Array(me),ve=0;ve<me;ve++)Ne[ve]=arguments[ve+2];de.children=Ne}return ge(x.type,se,de)},Ke.createContext=function(x){return x={$$typeof:u,_currentValue:x,_currentValue2:x,_threadCount:0,Provider:null,Consumer:null},x.Provider=x,x.Consumer={$$typeof:l,_context:x},x},Ke.createElement=function(x,K,re){var de,se={},me=null;if(K!=null)for(de in K.key!==void 0&&(me=""+K.key),K)X.call(K,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(se[de]=K[de]);var Ne=arguments.length-2;if(Ne===1)se.children=re;else if(1<Ne){for(var ve=Array(Ne),He=0;He<Ne;He++)ve[He]=arguments[He+2];se.children=ve}if(x&&x.defaultProps)for(de in Ne=x.defaultProps,Ne)se[de]===void 0&&(se[de]=Ne[de]);return ge(x,me,se)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(x){return{$$typeof:d,render:x}},Ke.isValidElement=Ce,Ke.lazy=function(x){return{$$typeof:m,_payload:{_status:-1,_result:x},_init:ye}},Ke.memo=function(x,K){return{$$typeof:g,type:x,compare:K===void 0?null:K}},Ke.startTransition=function(x){var K=q.T,re={};q.T=re;try{var de=x(),se=q.S;se!==null&&se(re,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(j,te)}catch(me){te(me)}finally{K!==null&&re.types!==null&&(K.types=re.types),q.T=K}},Ke.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},Ke.use=function(x){return q.H.use(x)},Ke.useActionState=function(x,K,re){return q.H.useActionState(x,K,re)},Ke.useCallback=function(x,K){return q.H.useCallback(x,K)},Ke.useContext=function(x){return q.H.useContext(x)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(x,K){return q.H.useDeferredValue(x,K)},Ke.useEffect=function(x,K){return q.H.useEffect(x,K)},Ke.useEffectEvent=function(x){return q.H.useEffectEvent(x)},Ke.useId=function(){return q.H.useId()},Ke.useImperativeHandle=function(x,K,re){return q.H.useImperativeHandle(x,K,re)},Ke.useInsertionEffect=function(x,K){return q.H.useInsertionEffect(x,K)},Ke.useLayoutEffect=function(x,K){return q.H.useLayoutEffect(x,K)},Ke.useMemo=function(x,K){return q.H.useMemo(x,K)},Ke.useOptimistic=function(x,K){return q.H.useOptimistic(x,K)},Ke.useReducer=function(x,K,re){return q.H.useReducer(x,K,re)},Ke.useRef=function(x){return q.H.useRef(x)},Ke.useState=function(x){return q.H.useState(x)},Ke.useSyncExternalStore=function(x,K,re){return q.H.useSyncExternalStore(x,K,re)},Ke.useTransition=function(){return q.H.useTransition()},Ke.version="19.2.6",Ke}var Dg;function qu(){return Dg||(Dg=1,Bu.exports=AS()),Bu.exports}var N=qu();const Ye=Wa(N);var Pu={exports:{}},Bs={},Gu={exports:{}},Vu={};var Og;function xS(){return Og||(Og=1,(function(o){function e(Q,fe){var ye=Q.length;Q.push(fe);e:for(;0<ye;){var te=ye-1>>>1,he=Q[te];if(0<i(he,fe))Q[te]=fe,Q[ye]=he,ye=te;else break e}}function a(Q){return Q.length===0?null:Q[0]}function r(Q){if(Q.length===0)return null;var fe=Q[0],ye=Q.pop();if(ye!==fe){Q[0]=ye;e:for(var te=0,he=Q.length,x=he>>>1;te<x;){var K=2*(te+1)-1,re=Q[K],de=K+1,se=Q[de];if(0>i(re,ye))de<he&&0>i(se,re)?(Q[te]=se,Q[de]=ye,te=de):(Q[te]=re,Q[K]=ye,te=K);else if(de<he&&0>i(se,ye))Q[te]=se,Q[de]=ye,te=de;else break e}}return fe}function i(Q,fe){var ye=Q.sortIndex-fe.sortIndex;return ye!==0?ye:Q.id-fe.id}if(o.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;o.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();o.unstable_now=function(){return u.now()-d}}var f=[],g=[],m=1,b=null,v=3,S=!1,E=!1,A=!1,T=!1,L=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function D(Q){for(var fe=a(g);fe!==null;){if(fe.callback===null)r(g);else if(fe.startTime<=Q)r(g),fe.sortIndex=fe.expirationTime,e(f,fe);else break;fe=a(g)}}function U(Q){if(A=!1,D(Q),!E)if(a(f)!==null)E=!0,j||(j=!0,$e());else{var fe=a(g);fe!==null&&ht(U,fe.startTime-Q)}}var j=!1,q=-1,X=5,ge=-1;function Ee(){return T?!0:!(o.unstable_now()-ge<X)}function Ce(){if(T=!1,j){var Q=o.unstable_now();ge=Q;var fe=!0;try{e:{E=!1,A&&(A=!1,M(q),q=-1),S=!0;var ye=v;try{t:{for(D(Q),b=a(f);b!==null&&!(b.expirationTime>Q&&Ee());){var te=b.callback;if(typeof te=="function"){b.callback=null,v=b.priorityLevel;var he=te(b.expirationTime<=Q);if(Q=o.unstable_now(),typeof he=="function"){b.callback=he,D(Q),fe=!0;break t}b===a(f)&&r(f),D(Q)}else r(f);b=a(f)}if(b!==null)fe=!0;else{var x=a(g);x!==null&&ht(U,x.startTime-Q),fe=!1}}break e}finally{b=null,v=ye,S=!1}fe=void 0}}finally{fe?$e():j=!1}}}var $e;if(typeof R=="function")$e=function(){R(Ce)};else if(typeof MessageChannel<"u"){var qe=new MessageChannel,Xe=qe.port2;qe.port1.onmessage=Ce,$e=function(){Xe.postMessage(null)}}else $e=function(){L(Ce,0)};function ht(Q,fe){q=L(function(){Q(o.unstable_now())},fe)}o.unstable_IdlePriority=5,o.unstable_ImmediatePriority=1,o.unstable_LowPriority=4,o.unstable_NormalPriority=3,o.unstable_Profiling=null,o.unstable_UserBlockingPriority=2,o.unstable_cancelCallback=function(Q){Q.callback=null},o.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<Q?Math.floor(1e3/Q):5},o.unstable_getCurrentPriorityLevel=function(){return v},o.unstable_next=function(Q){switch(v){case 1:case 2:case 3:var fe=3;break;default:fe=v}var ye=v;v=fe;try{return Q()}finally{v=ye}},o.unstable_requestPaint=function(){T=!0},o.unstable_runWithPriority=function(Q,fe){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var ye=v;v=Q;try{return fe()}finally{v=ye}},o.unstable_scheduleCallback=function(Q,fe,ye){var te=o.unstable_now();switch(typeof ye=="object"&&ye!==null?(ye=ye.delay,ye=typeof ye=="number"&&0<ye?te+ye:te):ye=te,Q){case 1:var he=-1;break;case 2:he=250;break;case 5:he=1073741823;break;case 4:he=1e4;break;default:he=5e3}return he=ye+he,Q={id:m++,callback:fe,priorityLevel:Q,startTime:ye,expirationTime:he,sortIndex:-1},ye>te?(Q.sortIndex=ye,e(g,Q),a(f)===null&&Q===a(g)&&(A?(M(q),q=-1):A=!0,ht(U,ye-te))):(Q.sortIndex=he,e(f,Q),E||S||(E=!0,j||(j=!0,$e()))),Q},o.unstable_shouldYield=Ee,o.unstable_wrapCallback=function(Q){var fe=v;return function(){var ye=v;v=fe;try{return Q.apply(this,arguments)}finally{v=ye}}}})(Vu)),Vu}var Lg;function TS(){return Lg||(Lg=1,Gu.exports=xS()),Gu.exports}var Fu={exports:{}},mn={};var Mg;function RS(){if(Mg)return mn;Mg=1;var o=qu();function e(f){var g="https://react.dev/errors/"+f;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)g+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(e(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(f,g,m){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:b==null?null:""+b,children:f,containerInfo:g,implementation:m}}var u=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,g){if(f==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,mn.createPortal=function(f,g){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(e(299));return l(f,g,null,m)},mn.flushSync=function(f){var g=u.T,m=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=g,r.p=m,r.d.f()}},mn.preconnect=function(f,g){typeof f=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,r.d.C(f,g))},mn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},mn.preinit=function(f,g){if(typeof f=="string"&&g&&typeof g.as=="string"){var m=g.as,b=d(m,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,S=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;m==="style"?r.d.S(f,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:S}):m==="script"&&r.d.X(f,{crossOrigin:b,integrity:v,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},mn.preinitModule=function(f,g){if(typeof f=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var m=d(g.as,g.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&r.d.M(f)},mn.preload=function(f,g){if(typeof f=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var m=g.as,b=d(m,g.crossOrigin);r.d.L(f,m,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},mn.preloadModule=function(f,g){if(typeof f=="string")if(g){var m=d(g.as,g.crossOrigin);r.d.m(f,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:m,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else r.d.m(f)},mn.requestFormReset=function(f){r.d.r(f)},mn.unstable_batchedUpdates=function(f,g){return f(g)},mn.useFormState=function(f,g,m){return u.H.useFormState(f,g,m)},mn.useFormStatus=function(){return u.H.useHostTransitionStatus()},mn.version="19.2.6",mn}var $g;function Ng(){if($g)return Fu.exports;$g=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),Fu.exports=RS(),Fu.exports}var Ig;function kS(){if(Ig)return Bs;Ig=1;var o=TS(),e=qu(),a=Ng();function r(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function l(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function u(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function d(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function f(t){if(l(t)!==t)throw Error(r(188))}function g(t){var n=t.alternate;if(!n){if(n=l(t),n===null)throw Error(r(188));return n!==t?null:t}for(var s=t,c=n;;){var h=s.return;if(h===null)break;var p=h.alternate;if(p===null){if(c=h.return,c!==null){s=c;continue}break}if(h.child===p.child){for(p=h.child;p;){if(p===s)return f(h),t;if(p===c)return f(h),n;p=p.sibling}throw Error(r(188))}if(s.return!==c.return)s=h,c=p;else{for(var w=!1,k=h.child;k;){if(k===s){w=!0,s=h,c=p;break}if(k===c){w=!0,c=h,s=p;break}k=k.sibling}if(!w){for(k=p.child;k;){if(k===s){w=!0,s=p,c=h;break}if(k===c){w=!0,c=p,s=h;break}k=k.sibling}if(!w)throw Error(r(189))}}if(s.alternate!==c)throw Error(r(190))}if(s.tag!==3)throw Error(r(188));return s.stateNode.current===s?t:n}function m(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=m(t),n!==null)return n;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),R=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ge=Symbol.for("react.activity"),Ee=Symbol.for("react.memo_cache_sentinel"),Ce=Symbol.iterator;function $e(t){return t===null||typeof t!="object"?null:(t=Ce&&t[Ce]||t["@@iterator"],typeof t=="function"?t:null)}var qe=Symbol.for("react.client.reference");function Xe(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===qe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case L:return"Profiler";case T:return"StrictMode";case U:return"Suspense";case j:return"SuspenseList";case ge:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case R:return t.displayName||"Context";case M:return(t._context.displayName||"Context")+".Consumer";case D:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case q:return n=t.displayName||null,n!==null?n:Xe(t.type)||"Memo";case X:n=t._payload,t=t._init;try{return Xe(t(n))}catch{}}return null}var ht=Array.isArray,Q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},te=[],he=-1;function x(t){return{current:t}}function K(t){0>he||(t.current=te[he],te[he]=null,he--)}function re(t,n){he++,te[he]=t.current,t.current=n}var de=x(null),se=x(null),me=x(null),Ne=x(null);function ve(t,n){switch(re(me,n),re(se,t),re(de,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?Vv(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=Vv(n),t=Fv(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(de),re(de,t)}function He(){K(de),K(se),K(me)}function Ae(t){t.memoizedState!==null&&re(Ne,t);var n=de.current,s=Fv(n,t.type);n!==s&&(re(se,t),re(de,s))}function Et(t){se.current===t&&(K(de),K(se)),Ne.current===t&&(K(Ne),yl._currentValue=ye)}var Rt,_t;function ft(t){if(Rt===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);Rt=n&&n[1]||"",_t=-1<s.stack.indexOf(`
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Rt+t+_t}var un=!1;function gt(t,n){if(!t||un)return"";un=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(n){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ee){var J=ee}Reflect.construct(t,[],ue)}else{try{ue.call()}catch(ee){J=ee}t.call(ue.prototype)}}else{try{throw Error()}catch(ee){J=ee}(ue=t())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ee){if(ee&&J&&typeof ee.stack=="string")return[ee.stack,J.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=c.DetermineComponentFrameRoot(),w=p[0],k=p[1];if(w&&k){var z=w.split(`
`),Y=k.split(`
`);for(h=c=0;c<z.length&&!z[c].includes("DetermineComponentFrameRoot");)c++;for(;h<Y.length&&!Y[h].includes("DetermineComponentFrameRoot");)h++;if(c===z.length||h===Y.length)for(c=z.length-1,h=Y.length-1;1<=c&&0<=h&&z[c]!==Y[h];)h--;for(;1<=c&&0<=h;c--,h--)if(z[c]!==Y[h]){if(c!==1||h!==1)do if(c--,h--,0>h||z[c]!==Y[h]){var ae=`
`+z[c].replace(" at new "," at ");return t.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",t.displayName)),ae}while(1<=c&&0<=h);break}}}finally{un=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?ft(s):""}function za(t,n){switch(t.tag){case 26:case 27:case 5:return ft(t.type);case 16:return ft("Lazy");case 13:return t.child!==n&&n!==null?ft("Suspense Fallback"):ft("Suspense");case 19:return ft("SuspenseList");case 0:case 15:return gt(t.type,!1);case 11:return gt(t.type.render,!1);case 1:return gt(t.type,!0);case 31:return ft("Activity");default:return""}}function kn(t){try{var n="",s=null;do n+=za(t,s),s=t,t=t.return;while(t);return n}catch(c){return`
Error generating stack: `+c.message+`
`+c.stack}}var Dn=Object.prototype.hasOwnProperty,jt=o.unstable_scheduleCallback,On=o.unstable_cancelCallback,ea=o.unstable_shouldYield,ja=o.unstable_requestPaint,Ft=o.unstable_now,Rr=o.unstable_getCurrentPriorityLevel,Za=o.unstable_ImmediatePriority,bn=o.unstable_UserBlockingPriority,en=o.unstable_NormalPriority,et=o.unstable_LowPriority,ta=o.unstable_IdlePriority,En=o.log,er=o.unstable_setDisableYieldValue,Ea=null,tn=null;function _n(t){if(typeof En=="function"&&er(t),tn&&typeof tn.setStrictMode=="function")try{tn.setStrictMode(Ea,t)}catch{}}var P=Math.clz32?Math.clz32:Z,ce=Math.log,le=Math.LN2;function Z(t){return t>>>=0,t===0?32:31-(ce(t)/le|0)|0}var be=256,Se=262144,Re=4194304;function xe(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function je(t,n,s){var c=t.pendingLanes;if(c===0)return 0;var h=0,p=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var k=c&134217727;return k!==0?(c=k&~p,c!==0?h=xe(c):(w&=k,w!==0?h=xe(w):s||(s=k&~t,s!==0&&(h=xe(s))))):(k=c&~p,k!==0?h=xe(k):w!==0?h=xe(w):s||(s=c&~t,s!==0&&(h=xe(s)))),h===0?0:n!==0&&n!==h&&(n&p)===0&&(p=h&-h,s=n&-n,p>=s||p===32&&(s&4194048)!==0)?n:h}function ze(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function Le(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ke(){var t=Re;return Re<<=1,(Re&62914560)===0&&(Re=4194304),t}function We(t){for(var n=[],s=0;31>s;s++)n.push(t);return n}function Fe(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function _e(t,n,s,c,h,p){var w=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var k=t.entanglements,z=t.expirationTimes,Y=t.hiddenUpdates;for(s=w&~s;0<s;){var ae=31-P(s),ue=1<<ae;k[ae]=0,z[ae]=-1;var J=Y[ae];if(J!==null)for(Y[ae]=null,ae=0;ae<J.length;ae++){var ee=J[ae];ee!==null&&(ee.lane&=-536870913)}s&=~ue}c!==0&&Te(t,c,0),p!==0&&h===0&&t.tag!==0&&(t.suspendedLanes|=p&~(w&~n))}function Te(t,n,s){t.pendingLanes|=n,t.suspendedLanes&=~n;var c=31-P(n);t.entangledLanes|=n,t.entanglements[c]=t.entanglements[c]|1073741824|s&261930}function Ue(t,n){var s=t.entangledLanes|=n;for(t=t.entanglements;s;){var c=31-P(s),h=1<<c;h&n|t[c]&n&&(t[c]|=n),s&=~h}}function st(t,n){var s=n&-n;return s=(s&42)!==0?1:Dt(s),(s&(t.suspendedLanes|n))!==0?0:s}function Dt(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function nn(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Kt(){var t=fe.p;return t!==0?t:(t=window.event,t===void 0?32:pS(t.type))}function Pn(t,n){var s=fe.p;try{return fe.p=t,n()}finally{fe.p=s}}var Ln=Math.random().toString(36).slice(2),an="__reactFiber$"+Ln,vn="__reactProps$"+Ln,kr="__reactContainer$"+Ln,_o="__reactEvents$"+Ln,df="__reactListeners$"+Ln,pc="__reactHandles$"+Ln,Ua="__reactResources$"+Ln,pi="__reactMarker$"+Ln;function Ao(t){delete t[an],delete t[vn],delete t[_o],delete t[df],delete t[pc]}function Dr(t){var n=t[an];if(n)return n;for(var s=t.parentNode;s;){if(n=s[kr]||s[an]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(t=Zv(t);t!==null;){if(s=t[an])return s;t=Zv(t)}return n}t=s,s=t.parentNode}return null}function Ba(t){if(t=t[an]||t[kr]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function tr(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(r(33))}function Or(t){var n=t[Ua];return n||(n=t[Ua]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Wt(t){t[pi]=!0}var mc=new Set,yc={};function _a(t,n){Lr(t,n),Lr(t+"Capture",n)}function Lr(t,n){for(yc[t]=n,t=0;t<n.length;t++)mc.add(n[t])}var ff=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),bc={},vc={};function hf(t){return Dn.call(vc,t)?!0:Dn.call(bc,t)?!1:ff.test(t)?vc[t]=!0:(bc[t]=!0,!1)}function Mn(t,n,s){if(hf(n))if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var c=n.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+s)}}function mi(t,n,s){if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+s)}}function dn(t,n,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(n,s,""+c)}}function Sn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Sc(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function gf(t,n,s){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var h=c.get,p=c.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return h.call(this)},set:function(w){s=""+w,p.call(this,w)}}),Object.defineProperty(t,n,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(w){s=""+w},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function xo(t){if(!t._valueTracker){var n=Sc(t)?"checked":"value";t._valueTracker=gf(t,n,""+t[n])}}function wc(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var s=n.getValue(),c="";return t&&(c=Sc(t)?t.checked?"true":"false":t.value),t=c,t!==s?(n.setValue(t),!0):!1}function Mr(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var pf=/[\n"\\]/g;function $n(t){return t.replace(pf,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function os(t,n,s,c,h,p,w,k){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),n!=null?w==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Sn(n)):t.value!==""+Sn(n)&&(t.value=""+Sn(n)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),n!=null?nr(t,w,Sn(n)):s!=null?nr(t,w,Sn(s)):c!=null&&t.removeAttribute("value"),h==null&&p!=null&&(t.defaultChecked=!!p),h!=null&&(t.checked=h&&typeof h!="function"&&typeof h!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?t.name=""+Sn(k):t.removeAttribute("name")}function yi(t,n,s,c,h,p,w,k){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(t.type=p),n!=null||s!=null){if(!(p!=="submit"&&p!=="reset"||n!=null)){xo(t);return}s=s!=null?""+Sn(s):"",n=n!=null?""+Sn(n):s,k||n===t.value||(t.value=n),t.defaultValue=n}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=k?t.checked:!!c,t.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),xo(t)}function nr(t,n,s){n==="number"&&Mr(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function $r(t,n,s,c){if(t=t.options,n){n={};for(var h=0;h<s.length;h++)n["$"+s[h]]=!0;for(s=0;s<t.length;s++)h=n.hasOwnProperty("$"+t[s].value),t[s].selected!==h&&(t[s].selected=h),h&&c&&(t[s].defaultSelected=!0)}else{for(s=""+Sn(s),n=null,h=0;h<t.length;h++){if(t[h].value===s){t[h].selected=!0,c&&(t[h].defaultSelected=!0);return}n!==null||t[h].disabled||(n=t[h])}n!==null&&(n.selected=!0)}}function Nr(t,n,s){if(n!=null&&(n=""+Sn(n),n!==t.value&&(t.value=n),s==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=s!=null?""+Sn(s):""}function Cc(t,n,s,c){if(n==null){if(c!=null){if(s!=null)throw Error(r(92));if(ht(c)){if(1<c.length)throw Error(r(93));c=c[0]}s=c}s==null&&(s=""),n=s}s=Sn(n),t.defaultValue=s,c=t.textContent,c===s&&c!==""&&c!==null&&(t.value=c),xo(t)}function Ir(t,n){if(n){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=n;return}}t.textContent=n}var mf=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ec(t,n,s){var c=n.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":c?t.setProperty(n,s):typeof s!="number"||s===0||mf.has(n)?n==="float"?t.cssFloat=s:t[n]=(""+s).trim():t[n]=s+"px"}function _c(t,n,s){if(n!=null&&typeof n!="object")throw Error(r(62));if(t=t.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||n!=null&&n.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var h in n)c=n[h],n.hasOwnProperty(h)&&s[h]!==c&&Ec(t,h,c)}else for(var p in n)n.hasOwnProperty(p)&&Ec(t,p,n[p])}function To(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yf=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ro=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function na(t){return Ro.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Aa(){}var ko=null;function Do(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Hr=null,ar=null;function Ac(t){var n=Ba(t);if(n&&(t=n.stateNode)){var s=t[vn]||null;e:switch(t=n.stateNode,n.type){case"input":if(os(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),n=s.name,s.type==="radio"&&n!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+$n(""+n)+'"][type="radio"]'),n=0;n<s.length;n++){var c=s[n];if(c!==t&&c.form===t.form){var h=c[vn]||null;if(!h)throw Error(r(90));os(c,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(n=0;n<s.length;n++)c=s[n],c.form===t.form&&wc(c)}break e;case"textarea":Nr(t,s.value,s.defaultValue);break e;case"select":n=s.value,n!=null&&$r(t,!!s.multiple,n,!1)}}}var ls=!1;function xc(t,n,s){if(ls)return t(n,s);ls=!0;try{var c=t(n);return c}finally{if(ls=!1,(Hr!==null||ar!==null)&&(vu(),Hr&&(n=Hr,t=ar,ar=Hr=null,Ac(n),t)))for(n=0;n<t.length;n++)Ac(t[n])}}function bi(t,n){var s=t.stateNode;if(s===null)return null;var c=s[vn]||null;if(c===null)return null;s=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(r(231,n,typeof s));return s}var xa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oo=!1;if(xa)try{var vi={};Object.defineProperty(vi,"passive",{get:function(){Oo=!0}}),window.addEventListener("test",vi,vi),window.removeEventListener("test",vi,vi)}catch{Oo=!1}var qa=null,Lo=null,cs=null;function Tc(){if(cs)return cs;var t,n=Lo,s=n.length,c,h="value"in qa?qa.value:qa.textContent,p=h.length;for(t=0;t<s&&n[t]===h[t];t++);var w=s-t;for(c=1;c<=w&&n[s-c]===h[p-c];c++);return cs=h.slice(t,1<c?1-c:void 0)}function Si(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Mo(){return!0}function Rc(){return!1}function Be(t){function n(s,c,h,p,w){this._reactName=s,this._targetInst=h,this.type=c,this.nativeEvent=p,this.target=w,this.currentTarget=null;for(var k in t)t.hasOwnProperty(k)&&(s=t[k],this[k]=s?s(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Mo:Rc,this.isPropagationStopped=Rc,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Mo)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Mo)},persist:function(){},isPersistent:Mo}),n}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rr=Be(Ta),wi=b({},Ta,{view:0,detail:0}),bf=Be(wi),us,$o,Ci,ds=b({},wi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ci&&(Ci&&t.type==="mousemove"?(us=t.screenX-Ci.screenX,$o=t.screenY-Ci.screenY):$o=us=0,Ci=t),us)},movementY:function(t){return"movementY"in t?t.movementY:$o}}),kc=Be(ds),vf=b({},ds,{dataTransfer:0}),oy=Be(vf),Sf=b({},wi,{relatedTarget:0}),No=Be(Sf),ly=b({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),wf=Be(ly),Cf=b({},Ta,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Dc=Be(Cf),Ef=b({},Ta,{data:0}),Oc=Be(Ef),_f={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Af={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Lc(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=xf[t])?!!n[t]:!1}function Io(){return Lc}var Tf=b({},wi,{key:function(t){if(t.key){var n=_f[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Si(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Af[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(t){return t.type==="keypress"?Si(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Si(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Rf=Be(Tf),kf=b({},ds,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mc=Be(kf),Df=b({},wi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),Of=Be(Df),rn=b({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),fs=Be(rn),Lf=b({},ds,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),_=Be(Lf),y=b({},Ta,{newState:0,oldState:0}),C=Be(y),O=[9,13,27,32],I=xa&&"CompositionEvent"in window,ne=null;xa&&"documentMode"in document&&(ne=document.documentMode);var pe=xa&&"TextEvent"in window&&!ne,Me=xa&&(!I||ne&&8<ne&&11>=ne),Ve=" ",ot=!1;function pt(t,n){switch(t){case"keyup":return O.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nt(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ra=!1;function Mf(t,n){switch(t){case"compositionend":return Nt(n);case"keypress":return n.which!==32?null:(ot=!0,Ve);case"textInput":return t=n.data,t===Ve&&ot?null:t;default:return null}}function $c(t,n){if(Ra)return t==="compositionend"||!I&&pt(t,n)?(t=Tc(),cs=Lo=qa=null,Ra=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Me&&n.locale!=="ko"?null:n.data;default:return null}}var $f={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ho(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!$f[t.type]:n==="textarea"}function Nc(t,n,s,c){Hr?ar?ar.push(c):ar=[c]:Hr=c,n=xu(n,"onChange"),0<n.length&&(s=new rr("onChange","change",null,s,c),t.push({event:s,listeners:n}))}var zr=null,Ei=null;function Nf(t){jv(t,0)}function _i(t){var n=tr(t);if(wc(n))return t}function zo(t,n){if(t==="change")return n}var jo=!1;if(xa){var Ai;if(xa){var xi="oninput"in document;if(!xi){var Uo=document.createElement("div");Uo.setAttribute("oninput","return;"),xi=typeof Uo.oninput=="function"}Ai=xi}else Ai=!1;jo=Ai&&(!document.documentMode||9<document.documentMode)}function Ic(){zr&&(zr.detachEvent("onpropertychange",Hc),Ei=zr=null)}function Hc(t){if(t.propertyName==="value"&&_i(Ei)){var n=[];Nc(n,Ei,t,Do(t)),xc(Nf,n)}}function If(t,n,s){t==="focusin"?(Ic(),zr=n,Ei=s,zr.attachEvent("onpropertychange",Hc)):t==="focusout"&&Ic()}function Hf(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return _i(Ei)}function zc(t,n){if(t==="click")return _i(n)}function SA(t,n){if(t==="input"||t==="change")return _i(n)}function wA(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Gn=typeof Object.is=="function"?Object.is:wA;function Bo(t,n){if(Gn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var s=Object.keys(t),c=Object.keys(n);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var h=s[c];if(!Dn.call(n,h)||!Gn(t[h],n[h]))return!1}return!0}function cy(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function uy(t,n){var s=cy(t);t=0;for(var c;s;){if(s.nodeType===3){if(c=t+s.textContent.length,t<=n&&c>=n)return{node:s,offset:n-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=cy(s)}}function dy(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?dy(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function fy(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=Mr(t.document);n instanceof t.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)t=n.contentWindow;else break;n=Mr(t.document)}return n}function zf(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var CA=xa&&"documentMode"in document&&11>=document.documentMode,hs=null,jf=null,qo=null,Uf=!1;function hy(t,n,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Uf||hs==null||hs!==Mr(c)||(c=hs,"selectionStart"in c&&zf(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),qo&&Bo(qo,c)||(qo=c,c=xu(jf,"onSelect"),0<c.length&&(n=new rr("onSelect","select",null,n,s),t.push({event:n,listeners:c}),n.target=hs)))}function Ti(t,n){var s={};return s[t.toLowerCase()]=n.toLowerCase(),s["Webkit"+t]="webkit"+n,s["Moz"+t]="moz"+n,s}var gs={animationend:Ti("Animation","AnimationEnd"),animationiteration:Ti("Animation","AnimationIteration"),animationstart:Ti("Animation","AnimationStart"),transitionrun:Ti("Transition","TransitionRun"),transitionstart:Ti("Transition","TransitionStart"),transitioncancel:Ti("Transition","TransitionCancel"),transitionend:Ti("Transition","TransitionEnd")},Bf={},gy={};xa&&(gy=document.createElement("div").style,"AnimationEvent"in window||(delete gs.animationend.animation,delete gs.animationiteration.animation,delete gs.animationstart.animation),"TransitionEvent"in window||delete gs.transitionend.transition);function Ri(t){if(Bf[t])return Bf[t];if(!gs[t])return t;var n=gs[t],s;for(s in n)if(n.hasOwnProperty(s)&&s in gy)return Bf[t]=n[s];return t}var py=Ri("animationend"),my=Ri("animationiteration"),yy=Ri("animationstart"),EA=Ri("transitionrun"),_A=Ri("transitionstart"),AA=Ri("transitioncancel"),by=Ri("transitionend"),vy=new Map,qf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");qf.push("scrollEnd");function ka(t,n){vy.set(t,n),_a(n,[t])}var jc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},aa=[],ps=0,Pf=0;function Uc(){for(var t=ps,n=Pf=ps=0;n<t;){var s=aa[n];aa[n++]=null;var c=aa[n];aa[n++]=null;var h=aa[n];aa[n++]=null;var p=aa[n];if(aa[n++]=null,c!==null&&h!==null){var w=c.pending;w===null?h.next=h:(h.next=w.next,w.next=h),c.pending=h}p!==0&&Sy(s,h,p)}}function Bc(t,n,s,c){aa[ps++]=t,aa[ps++]=n,aa[ps++]=s,aa[ps++]=c,Pf|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function Gf(t,n,s,c){return Bc(t,n,s,c),qc(t)}function ki(t,n){return Bc(t,null,null,n),qc(t)}function Sy(t,n,s){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s);for(var h=!1,p=t.return;p!==null;)p.childLanes|=s,c=p.alternate,c!==null&&(c.childLanes|=s),p.tag===22&&(t=p.stateNode,t===null||t._visibility&1||(h=!0)),t=p,p=p.return;return t.tag===3?(p=t.stateNode,h&&n!==null&&(h=31-P(s),t=p.hiddenUpdates,c=t[h],c===null?t[h]=[n]:c.push(n),n.lane=s|536870912),p):null}function qc(t){if(50<ul)throw ul=0,Zh=null,Error(r(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var ms={};function xA(t,n,s,c){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vn(t,n,s,c){return new xA(t,n,s,c)}function Vf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ir(t,n){var s=t.alternate;return s===null?(s=Vn(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function wy(t,n){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,n=s.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Pc(t,n,s,c,h,p){var w=0;if(c=t,typeof t=="function")Vf(t)&&(w=1);else if(typeof t=="string")w=Ox(t,s,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ge:return t=Vn(31,s,n,h),t.elementType=ge,t.lanes=p,t;case A:return Di(s.children,h,p,n);case T:w=8,h|=24;break;case L:return t=Vn(12,s,n,h|2),t.elementType=L,t.lanes=p,t;case U:return t=Vn(13,s,n,h),t.elementType=U,t.lanes=p,t;case j:return t=Vn(19,s,n,h),t.elementType=j,t.lanes=p,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case R:w=10;break e;case M:w=9;break e;case D:w=11;break e;case q:w=14;break e;case X:w=16,c=null;break e}w=29,s=Error(r(130,t===null?"null":typeof t,"")),c=null}return n=Vn(w,s,n,h),n.elementType=t,n.type=c,n.lanes=p,n}function Di(t,n,s,c){return t=Vn(7,t,c,n),t.lanes=s,t}function Ff(t,n,s){return t=Vn(6,t,null,n),t.lanes=s,t}function Cy(t){var n=Vn(18,null,null,0);return n.stateNode=t,n}function Kf(t,n,s){return n=Vn(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var Ey=new WeakMap;function ra(t,n){if(typeof t=="object"&&t!==null){var s=Ey.get(t);return s!==void 0?s:(n={value:t,source:n,stack:kn(n)},Ey.set(t,n),n)}return{value:t,source:n,stack:kn(n)}}var ys=[],bs=0,Gc=null,Po=0,ia=[],sa=0,jr=null,Pa=1,Ga="";function sr(t,n){ys[bs++]=Po,ys[bs++]=Gc,Gc=t,Po=n}function _y(t,n,s){ia[sa++]=Pa,ia[sa++]=Ga,ia[sa++]=jr,jr=t;var c=Pa;t=Ga;var h=32-P(c)-1;c&=~(1<<h),s+=1;var p=32-P(n)+h;if(30<p){var w=h-h%5;p=(c&(1<<w)-1).toString(32),c>>=w,h-=w,Pa=1<<32-P(n)+h|s<<h|c,Ga=p+t}else Pa=1<<p|s<<h|c,Ga=t}function Wf(t){t.return!==null&&(sr(t,1),_y(t,1,0))}function Yf(t){for(;t===Gc;)Gc=ys[--bs],ys[bs]=null,Po=ys[--bs],ys[bs]=null;for(;t===jr;)jr=ia[--sa],ia[sa]=null,Ga=ia[--sa],ia[sa]=null,Pa=ia[--sa],ia[sa]=null}function Ay(t,n){ia[sa++]=Pa,ia[sa++]=Ga,ia[sa++]=jr,Pa=n.id,Ga=n.overflow,jr=t}var fn=null,Ot=null,lt=!1,Ur=null,oa=!1,Xf=Error(r(519));function Br(t){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Go(ra(n,t)),Xf}function xy(t){var n=t.stateNode,s=t.type,c=t.memoizedProps;switch(n[an]=t,n[vn]=c,s){case"dialog":nt("cancel",n),nt("close",n);break;case"iframe":case"object":case"embed":nt("load",n);break;case"video":case"audio":for(s=0;s<fl.length;s++)nt(fl[s],n);break;case"source":nt("error",n);break;case"img":case"image":case"link":nt("error",n),nt("load",n);break;case"details":nt("toggle",n);break;case"input":nt("invalid",n),yi(n,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":nt("invalid",n);break;case"textarea":nt("invalid",n),Cc(n,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||n.textContent===""+s||c.suppressHydrationWarning===!0||Pv(n.textContent,s)?(c.popover!=null&&(nt("beforetoggle",n),nt("toggle",n)),c.onScroll!=null&&nt("scroll",n),c.onScrollEnd!=null&&nt("scrollend",n),c.onClick!=null&&(n.onclick=Aa),n=!0):n=!1,n||Br(t,!0)}function Ty(t){for(fn=t.return;fn;)switch(fn.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:fn=fn.return}}function vs(t){if(t!==fn)return!1;if(!lt)return Ty(t),lt=!0,!1;var n=t.tag,s;if((s=n!==3&&n!==27)&&((s=n===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||gg(t.type,t.memoizedProps)),s=!s),s&&Ot&&Br(t),Ty(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));Ot=Qv(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));Ot=Qv(t)}else n===27?(n=Ot,ti(t.type)?(t=vg,vg=null,Ot=t):Ot=n):Ot=fn?ca(t.stateNode.nextSibling):null;return!0}function Oi(){Ot=fn=null,lt=!1}function Jf(){var t=Ur;return t!==null&&(zn===null?zn=t:zn.push.apply(zn,t),Ur=null),t}function Go(t){Ur===null?Ur=[t]:Ur.push(t)}var Qf=x(null),Li=null,or=null;function qr(t,n,s){re(Qf,n._currentValue),n._currentValue=s}function lr(t){t._currentValue=Qf.current,K(Qf)}function Zf(t,n,s){for(;t!==null;){var c=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),t===s)break;t=t.return}}function eh(t,n,s,c){var h=t.child;for(h!==null&&(h.return=t);h!==null;){var p=h.dependencies;if(p!==null){var w=h.child;p=p.firstContext;e:for(;p!==null;){var k=p;p=h;for(var z=0;z<n.length;z++)if(k.context===n[z]){p.lanes|=s,k=p.alternate,k!==null&&(k.lanes|=s),Zf(p.return,s,t),c||(w=null);break e}p=k.next}}else if(h.tag===18){if(w=h.return,w===null)throw Error(r(341));w.lanes|=s,p=w.alternate,p!==null&&(p.lanes|=s),Zf(w,s,t),w=null}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===t){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}}function Ss(t,n,s,c){t=null;for(var h=n,p=!1;h!==null;){if(!p){if((h.flags&524288)!==0)p=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var w=h.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var k=h.type;Gn(h.pendingProps.value,w.value)||(t!==null?t.push(k):t=[k])}}else if(h===Ne.current){if(w=h.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(t!==null?t.push(yl):t=[yl])}h=h.return}t!==null&&eh(n,t,s,c),n.flags|=262144}function Vc(t){for(t=t.firstContext;t!==null;){if(!Gn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Mi(t){Li=t,or=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function hn(t){return Ry(Li,t)}function Fc(t,n){return Li===null&&Mi(t),Ry(t,n)}function Ry(t,n){var s=n._currentValue;if(n={context:n,memoizedValue:s,next:null},or===null){if(t===null)throw Error(r(308));or=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else or=or.next=n;return s}var TA=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(s,c){t.push(c)}};this.abort=function(){n.aborted=!0,t.forEach(function(s){return s()})}},RA=o.unstable_scheduleCallback,kA=o.unstable_NormalPriority,Yt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function th(){return{controller:new TA,data:new Map,refCount:0}}function Vo(t){t.refCount--,t.refCount===0&&RA(kA,function(){t.controller.abort()})}var Fo=null,nh=0,ws=0,Cs=null;function DA(t,n){if(Fo===null){var s=Fo=[];nh=0,ws=ig(),Cs={status:"pending",value:void 0,then:function(c){s.push(c)}}}return nh++,n.then(ky,ky),n}function ky(){if(--nh===0&&Fo!==null){Cs!==null&&(Cs.status="fulfilled");var t=Fo;Fo=null,ws=0,Cs=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function OA(t,n){var s=[],c={status:"pending",value:null,reason:null,then:function(h){s.push(h)}};return t.then(function(){c.status="fulfilled",c.value=n;for(var h=0;h<s.length;h++)(0,s[h])(n)},function(h){for(c.status="rejected",c.reason=h,h=0;h<s.length;h++)(0,s[h])(void 0)}),c}var Dy=Q.S;Q.S=function(t,n){hv=Ft(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&DA(t,n),Dy!==null&&Dy(t,n)};var $i=x(null);function ah(){var t=$i.current;return t!==null?t:kt.pooledCache}function Kc(t,n){n===null?re($i,$i.current):re($i,n.pool)}function Oy(){var t=ah();return t===null?null:{parent:Yt._currentValue,pool:t}}var Es=Error(r(460)),rh=Error(r(474)),Wc=Error(r(542)),Yc={then:function(){}};function Ly(t){return t=t.status,t==="fulfilled"||t==="rejected"}function My(t,n,s){switch(s=t[s],s===void 0?t.push(n):s!==n&&(n.then(Aa,Aa),n=s),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Ny(t),t;default:if(typeof n.status=="string")n.then(Aa,Aa);else{if(t=kt,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=n,t.status="pending",t.then(function(c){if(n.status==="pending"){var h=n;h.status="fulfilled",h.value=c}},function(c){if(n.status==="pending"){var h=n;h.status="rejected",h.reason=c}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,Ny(t),t}throw Ii=n,Es}}function Ni(t){try{var n=t._init;return n(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Ii=s,Es):s}}var Ii=null;function $y(){if(Ii===null)throw Error(r(459));var t=Ii;return Ii=null,t}function Ny(t){if(t===Es||t===Wc)throw Error(r(483))}var _s=null,Ko=0;function Xc(t){var n=Ko;return Ko+=1,_s===null&&(_s=[]),My(_s,t,n)}function Wo(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Jc(t,n){throw n.$$typeof===v?Error(r(525)):(t=Object.prototype.toString.call(n),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function Iy(t){function n(V,G){if(t){var W=V.deletions;W===null?(V.deletions=[G],V.flags|=16):W.push(G)}}function s(V,G){if(!t)return null;for(;G!==null;)n(V,G),G=G.sibling;return null}function c(V){for(var G=new Map;V!==null;)V.key!==null?G.set(V.key,V):G.set(V.index,V),V=V.sibling;return G}function h(V,G){return V=ir(V,G),V.index=0,V.sibling=null,V}function p(V,G,W){return V.index=W,t?(W=V.alternate,W!==null?(W=W.index,W<G?(V.flags|=67108866,G):W):(V.flags|=67108866,G)):(V.flags|=1048576,G)}function w(V){return t&&V.alternate===null&&(V.flags|=67108866),V}function k(V,G,W,oe){return G===null||G.tag!==6?(G=Ff(W,V.mode,oe),G.return=V,G):(G=h(G,W),G.return=V,G)}function z(V,G,W,oe){var Pe=W.type;return Pe===A?ae(V,G,W.props.children,oe,W.key):G!==null&&(G.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===X&&Ni(Pe)===G.type)?(G=h(G,W.props),Wo(G,W),G.return=V,G):(G=Pc(W.type,W.key,W.props,null,V.mode,oe),Wo(G,W),G.return=V,G)}function Y(V,G,W,oe){return G===null||G.tag!==4||G.stateNode.containerInfo!==W.containerInfo||G.stateNode.implementation!==W.implementation?(G=Kf(W,V.mode,oe),G.return=V,G):(G=h(G,W.children||[]),G.return=V,G)}function ae(V,G,W,oe,Pe){return G===null||G.tag!==7?(G=Di(W,V.mode,oe,Pe),G.return=V,G):(G=h(G,W),G.return=V,G)}function ue(V,G,W){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Ff(""+G,V.mode,W),G.return=V,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case S:return W=Pc(G.type,G.key,G.props,null,V.mode,W),Wo(W,G),W.return=V,W;case E:return G=Kf(G,V.mode,W),G.return=V,G;case X:return G=Ni(G),ue(V,G,W)}if(ht(G)||$e(G))return G=Di(G,V.mode,W,null),G.return=V,G;if(typeof G.then=="function")return ue(V,Xc(G),W);if(G.$$typeof===R)return ue(V,Fc(V,G),W);Jc(V,G)}return null}function J(V,G,W,oe){var Pe=G!==null?G.key:null;if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return Pe!==null?null:k(V,G,""+W,oe);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case S:return W.key===Pe?z(V,G,W,oe):null;case E:return W.key===Pe?Y(V,G,W,oe):null;case X:return W=Ni(W),J(V,G,W,oe)}if(ht(W)||$e(W))return Pe!==null?null:ae(V,G,W,oe,null);if(typeof W.then=="function")return J(V,G,Xc(W),oe);if(W.$$typeof===R)return J(V,G,Fc(V,W),oe);Jc(V,W)}return null}function ee(V,G,W,oe,Pe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return V=V.get(W)||null,k(G,V,""+oe,Pe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case S:return V=V.get(oe.key===null?W:oe.key)||null,z(G,V,oe,Pe);case E:return V=V.get(oe.key===null?W:oe.key)||null,Y(G,V,oe,Pe);case X:return oe=Ni(oe),ee(V,G,W,oe,Pe)}if(ht(oe)||$e(oe))return V=V.get(W)||null,ae(G,V,oe,Pe,null);if(typeof oe.then=="function")return ee(V,G,W,Xc(oe),Pe);if(oe.$$typeof===R)return ee(V,G,W,Fc(G,oe),Pe);Jc(G,oe)}return null}function De(V,G,W,oe){for(var Pe=null,mt=null,Ie=G,Qe=G=0,rt=null;Ie!==null&&Qe<W.length;Qe++){Ie.index>Qe?(rt=Ie,Ie=null):rt=Ie.sibling;var yt=J(V,Ie,W[Qe],oe);if(yt===null){Ie===null&&(Ie=rt);break}t&&Ie&&yt.alternate===null&&n(V,Ie),G=p(yt,G,Qe),mt===null?Pe=yt:mt.sibling=yt,mt=yt,Ie=rt}if(Qe===W.length)return s(V,Ie),lt&&sr(V,Qe),Pe;if(Ie===null){for(;Qe<W.length;Qe++)Ie=ue(V,W[Qe],oe),Ie!==null&&(G=p(Ie,G,Qe),mt===null?Pe=Ie:mt.sibling=Ie,mt=Ie);return lt&&sr(V,Qe),Pe}for(Ie=c(Ie);Qe<W.length;Qe++)rt=ee(Ie,V,Qe,W[Qe],oe),rt!==null&&(t&&rt.alternate!==null&&Ie.delete(rt.key===null?Qe:rt.key),G=p(rt,G,Qe),mt===null?Pe=rt:mt.sibling=rt,mt=rt);return t&&Ie.forEach(function(si){return n(V,si)}),lt&&sr(V,Qe),Pe}function Ge(V,G,W,oe){if(W==null)throw Error(r(151));for(var Pe=null,mt=null,Ie=G,Qe=G=0,rt=null,yt=W.next();Ie!==null&&!yt.done;Qe++,yt=W.next()){Ie.index>Qe?(rt=Ie,Ie=null):rt=Ie.sibling;var si=J(V,Ie,yt.value,oe);if(si===null){Ie===null&&(Ie=rt);break}t&&Ie&&si.alternate===null&&n(V,Ie),G=p(si,G,Qe),mt===null?Pe=si:mt.sibling=si,mt=si,Ie=rt}if(yt.done)return s(V,Ie),lt&&sr(V,Qe),Pe;if(Ie===null){for(;!yt.done;Qe++,yt=W.next())yt=ue(V,yt.value,oe),yt!==null&&(G=p(yt,G,Qe),mt===null?Pe=yt:mt.sibling=yt,mt=yt);return lt&&sr(V,Qe),Pe}for(Ie=c(Ie);!yt.done;Qe++,yt=W.next())yt=ee(Ie,V,Qe,yt.value,oe),yt!==null&&(t&&yt.alternate!==null&&Ie.delete(yt.key===null?Qe:yt.key),G=p(yt,G,Qe),mt===null?Pe=yt:mt.sibling=yt,mt=yt);return t&&Ie.forEach(function(qx){return n(V,qx)}),lt&&sr(V,Qe),Pe}function Tt(V,G,W,oe){if(typeof W=="object"&&W!==null&&W.type===A&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case S:e:{for(var Pe=W.key;G!==null;){if(G.key===Pe){if(Pe=W.type,Pe===A){if(G.tag===7){s(V,G.sibling),oe=h(G,W.props.children),oe.return=V,V=oe;break e}}else if(G.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===X&&Ni(Pe)===G.type){s(V,G.sibling),oe=h(G,W.props),Wo(oe,W),oe.return=V,V=oe;break e}s(V,G);break}else n(V,G);G=G.sibling}W.type===A?(oe=Di(W.props.children,V.mode,oe,W.key),oe.return=V,V=oe):(oe=Pc(W.type,W.key,W.props,null,V.mode,oe),Wo(oe,W),oe.return=V,V=oe)}return w(V);case E:e:{for(Pe=W.key;G!==null;){if(G.key===Pe)if(G.tag===4&&G.stateNode.containerInfo===W.containerInfo&&G.stateNode.implementation===W.implementation){s(V,G.sibling),oe=h(G,W.children||[]),oe.return=V,V=oe;break e}else{s(V,G);break}else n(V,G);G=G.sibling}oe=Kf(W,V.mode,oe),oe.return=V,V=oe}return w(V);case X:return W=Ni(W),Tt(V,G,W,oe)}if(ht(W))return De(V,G,W,oe);if($e(W)){if(Pe=$e(W),typeof Pe!="function")throw Error(r(150));return W=Pe.call(W),Ge(V,G,W,oe)}if(typeof W.then=="function")return Tt(V,G,Xc(W),oe);if(W.$$typeof===R)return Tt(V,G,Fc(V,W),oe);Jc(V,W)}return typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint"?(W=""+W,G!==null&&G.tag===6?(s(V,G.sibling),oe=h(G,W),oe.return=V,V=oe):(s(V,G),oe=Ff(W,V.mode,oe),oe.return=V,V=oe),w(V)):s(V,G)}return function(V,G,W,oe){try{Ko=0;var Pe=Tt(V,G,W,oe);return _s=null,Pe}catch(Ie){if(Ie===Es||Ie===Wc)throw Ie;var mt=Vn(29,Ie,null,V.mode);return mt.lanes=oe,mt.return=V,mt}}}var Hi=Iy(!0),Hy=Iy(!1),Pr=!1;function ih(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sh(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Gr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Vr(t,n,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(vt&2)!==0){var h=c.pending;return h===null?n.next=n:(n.next=h.next,h.next=n),c.pending=n,n=qc(t),Sy(t,null,s),n}return Bc(t,c,n,s),qc(t)}function Yo(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194048)!==0)){var c=n.lanes;c&=t.pendingLanes,s|=c,n.lanes=s,Ue(t,s)}}function oh(t,n){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var h=null,p=null;if(s=s.firstBaseUpdate,s!==null){do{var w={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};p===null?h=p=w:p=p.next=w,s=s.next}while(s!==null);p===null?h=p=n:p=p.next=n}else h=p=n;s={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:p,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}var lh=!1;function Xo(){if(lh){var t=Cs;if(t!==null)throw t}}function Jo(t,n,s,c){lh=!1;var h=t.updateQueue;Pr=!1;var p=h.firstBaseUpdate,w=h.lastBaseUpdate,k=h.shared.pending;if(k!==null){h.shared.pending=null;var z=k,Y=z.next;z.next=null,w===null?p=Y:w.next=Y,w=z;var ae=t.alternate;ae!==null&&(ae=ae.updateQueue,k=ae.lastBaseUpdate,k!==w&&(k===null?ae.firstBaseUpdate=Y:k.next=Y,ae.lastBaseUpdate=z))}if(p!==null){var ue=h.baseState;w=0,ae=Y=z=null,k=p;do{var J=k.lane&-536870913,ee=J!==k.lane;if(ee?(at&J)===J:(c&J)===J){J!==0&&J===ws&&(lh=!0),ae!==null&&(ae=ae.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var De=t,Ge=k;J=n;var Tt=s;switch(Ge.tag){case 1:if(De=Ge.payload,typeof De=="function"){ue=De.call(Tt,ue,J);break e}ue=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=Ge.payload,J=typeof De=="function"?De.call(Tt,ue,J):De,J==null)break e;ue=b({},ue,J);break e;case 2:Pr=!0}}J=k.callback,J!==null&&(t.flags|=64,ee&&(t.flags|=8192),ee=h.callbacks,ee===null?h.callbacks=[J]:ee.push(J))}else ee={lane:J,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ae===null?(Y=ae=ee,z=ue):ae=ae.next=ee,w|=J;if(k=k.next,k===null){if(k=h.shared.pending,k===null)break;ee=k,k=ee.next,ee.next=null,h.lastBaseUpdate=ee,h.shared.pending=null}}while(!0);ae===null&&(z=ue),h.baseState=z,h.firstBaseUpdate=Y,h.lastBaseUpdate=ae,p===null&&(h.shared.lanes=0),Xr|=w,t.lanes=w,t.memoizedState=ue}}function zy(t,n){if(typeof t!="function")throw Error(r(191,t));t.call(n)}function jy(t,n){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)zy(s[t],n)}var As=x(null),Qc=x(0);function Uy(t,n){t=yr,re(Qc,t),re(As,n),yr=t|n.baseLanes}function ch(){re(Qc,yr),re(As,As.current)}function uh(){yr=Qc.current,K(As),K(Qc)}var Fn=x(null),la=null;function Fr(t){var n=t.alternate;re(Pt,Pt.current&1),re(Fn,t),la===null&&(n===null||As.current!==null||n.memoizedState!==null)&&(la=t)}function dh(t){re(Pt,Pt.current),re(Fn,t),la===null&&(la=t)}function By(t){t.tag===22?(re(Pt,Pt.current),re(Fn,t),la===null&&(la=t)):Kr()}function Kr(){re(Pt,Pt.current),re(Fn,Fn.current)}function Kn(t){K(Fn),la===t&&(la=null),K(Pt)}var Pt=x(0);function Zc(t){for(var n=t;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||yg(s)||bg(s)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var cr=0,Je=null,At=null,Xt=null,eu=!1,xs=!1,zi=!1,tu=0,Qo=0,Ts=null,LA=0;function Ut(){throw Error(r(321))}function fh(t,n){if(n===null)return!1;for(var s=0;s<n.length&&s<t.length;s++)if(!Gn(t[s],n[s]))return!1;return!0}function hh(t,n,s,c,h,p){return cr=p,Je=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,Q.H=t===null||t.memoizedState===null?_b:Rh,zi=!1,p=s(c,h),zi=!1,xs&&(p=Py(n,s,c,h)),qy(t),p}function qy(t){Q.H=tl;var n=At!==null&&At.next!==null;if(cr=0,Xt=At=Je=null,eu=!1,Qo=0,Ts=null,n)throw Error(r(300));t===null||Jt||(t=t.dependencies,t!==null&&Vc(t)&&(Jt=!0))}function Py(t,n,s,c){Je=t;var h=0;do{if(xs&&(Ts=null),Qo=0,xs=!1,25<=h)throw Error(r(301));if(h+=1,Xt=At=null,t.updateQueue!=null){var p=t.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}Q.H=Ab,p=n(s,c)}while(xs);return p}function MA(){var t=Q.H,n=t.useState()[0];return n=typeof n.then=="function"?Zo(n):n,t=t.useState()[0],(At!==null?At.memoizedState:null)!==t&&(Je.flags|=1024),n}function gh(){var t=tu!==0;return tu=0,t}function ph(t,n,s){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~s}function mh(t){if(eu){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}eu=!1}cr=0,Xt=At=Je=null,xs=!1,Qo=tu=0,Ts=null}function An(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Je.memoizedState=Xt=t:Xt=Xt.next=t,Xt}function Gt(){if(At===null){var t=Je.alternate;t=t!==null?t.memoizedState:null}else t=At.next;var n=Xt===null?Je.memoizedState:Xt.next;if(n!==null)Xt=n,At=t;else{if(t===null)throw Je.alternate===null?Error(r(467)):Error(r(310));At=t,t={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},Xt===null?Je.memoizedState=Xt=t:Xt=Xt.next=t}return Xt}function nu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Zo(t){var n=Qo;return Qo+=1,Ts===null&&(Ts=[]),t=My(Ts,t,n),n=Je,(Xt===null?n.memoizedState:Xt.next)===null&&(n=n.alternate,Q.H=n===null||n.memoizedState===null?_b:Rh),t}function au(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Zo(t);if(t.$$typeof===R)return hn(t)}throw Error(r(438,String(t)))}function yh(t){var n=null,s=Je.updateQueue;if(s!==null&&(n=s.memoCache),n==null){var c=Je.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(n={data:c.data.map(function(h){return h.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),s===null&&(s=nu(),Je.updateQueue=s),s.memoCache=n,s=n.data[n.index],s===void 0)for(s=n.data[n.index]=Array(t),c=0;c<t;c++)s[c]=Ee;return n.index++,s}function ur(t,n){return typeof n=="function"?n(t):n}function ru(t){var n=Gt();return bh(n,At,t)}function bh(t,n,s){var c=t.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=s;var h=t.baseQueue,p=c.pending;if(p!==null){if(h!==null){var w=h.next;h.next=p.next,p.next=w}n.baseQueue=h=p,c.pending=null}if(p=t.baseState,h===null)t.memoizedState=p;else{n=h.next;var k=w=null,z=null,Y=n,ae=!1;do{var ue=Y.lane&-536870913;if(ue!==Y.lane?(at&ue)===ue:(cr&ue)===ue){var J=Y.revertLane;if(J===0)z!==null&&(z=z.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),ue===ws&&(ae=!0);else if((cr&J)===J){Y=Y.next,J===ws&&(ae=!0);continue}else ue={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(k=z=ue,w=p):z=z.next=ue,Je.lanes|=J,Xr|=J;ue=Y.action,zi&&s(p,ue),p=Y.hasEagerState?Y.eagerState:s(p,ue)}else J={lane:ue,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},z===null?(k=z=J,w=p):z=z.next=J,Je.lanes|=ue,Xr|=ue;Y=Y.next}while(Y!==null&&Y!==n);if(z===null?w=p:z.next=k,!Gn(p,t.memoizedState)&&(Jt=!0,ae&&(s=Cs,s!==null)))throw s;t.memoizedState=p,t.baseState=w,t.baseQueue=z,c.lastRenderedState=p}return h===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function vh(t){var n=Gt(),s=n.queue;if(s===null)throw Error(r(311));s.lastRenderedReducer=t;var c=s.dispatch,h=s.pending,p=n.memoizedState;if(h!==null){s.pending=null;var w=h=h.next;do p=t(p,w.action),w=w.next;while(w!==h);Gn(p,n.memoizedState)||(Jt=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),s.lastRenderedState=p}return[p,c]}function Gy(t,n,s){var c=Je,h=Gt(),p=lt;if(p){if(s===void 0)throw Error(r(407));s=s()}else s=n();var w=!Gn((At||h).memoizedState,s);if(w&&(h.memoizedState=s,Jt=!0),h=h.queue,Ch(Ky.bind(null,c,h,t),[t]),h.getSnapshot!==n||w||Xt!==null&&Xt.memoizedState.tag&1){if(c.flags|=2048,Rs(9,{destroy:void 0},Fy.bind(null,c,h,s,n),null),kt===null)throw Error(r(349));p||(cr&127)!==0||Vy(c,n,s)}return s}function Vy(t,n,s){t.flags|=16384,t={getSnapshot:n,value:s},n=Je.updateQueue,n===null?(n=nu(),Je.updateQueue=n,n.stores=[t]):(s=n.stores,s===null?n.stores=[t]:s.push(t))}function Fy(t,n,s,c){n.value=s,n.getSnapshot=c,Wy(n)&&Yy(t)}function Ky(t,n,s){return s(function(){Wy(n)&&Yy(t)})}function Wy(t){var n=t.getSnapshot;t=t.value;try{var s=n();return!Gn(t,s)}catch{return!0}}function Yy(t){var n=ki(t,2);n!==null&&jn(n,t,2)}function Sh(t){var n=An();if(typeof t=="function"){var s=t;if(t=s(),zi){_n(!0);try{s()}finally{_n(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:t},n}function Xy(t,n,s,c){return t.baseState=s,bh(t,At,typeof c=="function"?c:ur)}function $A(t,n,s,c,h){if(ou(t))throw Error(r(485));if(t=n.action,t!==null){var p={payload:h,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){p.listeners.push(w)}};Q.T!==null?s(!0):p.isTransition=!1,c(p),s=n.pending,s===null?(p.next=n.pending=p,Jy(n,p)):(p.next=s.next,n.pending=s.next=p)}}function Jy(t,n){var s=n.action,c=n.payload,h=t.state;if(n.isTransition){var p=Q.T,w={};Q.T=w;try{var k=s(h,c),z=Q.S;z!==null&&z(w,k),Qy(t,n,k)}catch(Y){wh(t,n,Y)}finally{p!==null&&w.types!==null&&(p.types=w.types),Q.T=p}}else try{p=s(h,c),Qy(t,n,p)}catch(Y){wh(t,n,Y)}}function Qy(t,n,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){Zy(t,n,c)},function(c){return wh(t,n,c)}):Zy(t,n,s)}function Zy(t,n,s){n.status="fulfilled",n.value=s,eb(n),t.state=s,n=t.pending,n!==null&&(s=n.next,s===n?t.pending=null:(s=s.next,n.next=s,Jy(t,s)))}function wh(t,n,s){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do n.status="rejected",n.reason=s,eb(n),n=n.next;while(n!==c)}t.action=null}function eb(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function tb(t,n){return n}function nb(t,n){if(lt){var s=kt.formState;if(s!==null){e:{var c=Je;if(lt){if(Ot){t:{for(var h=Ot,p=oa;h.nodeType!==8;){if(!p){h=null;break t}if(h=ca(h.nextSibling),h===null){h=null;break t}}p=h.data,h=p==="F!"||p==="F"?h:null}if(h){Ot=ca(h.nextSibling),c=h.data==="F!";break e}}Br(c)}c=!1}c&&(n=s[0])}}return s=An(),s.memoizedState=s.baseState=n,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tb,lastRenderedState:n},s.queue=c,s=wb.bind(null,Je,c),c.dispatch=s,c=Sh(!1),p=Th.bind(null,Je,!1,c.queue),c=An(),h={state:n,dispatch:null,action:t,pending:null},c.queue=h,s=$A.bind(null,Je,h,p,s),h.dispatch=s,c.memoizedState=t,[n,s,!1]}function ab(t){var n=Gt();return rb(n,At,t)}function rb(t,n,s){if(n=bh(t,n,tb)[0],t=ru(ur)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var c=Zo(n)}catch(w){throw w===Es?Wc:w}else c=n;n=Gt();var h=n.queue,p=h.dispatch;return s!==n.memoizedState&&(Je.flags|=2048,Rs(9,{destroy:void 0},NA.bind(null,h,s),null)),[c,p,t]}function NA(t,n){t.action=n}function ib(t){var n=Gt(),s=At;if(s!==null)return rb(n,s,t);Gt(),n=n.memoizedState,s=Gt();var c=s.queue.dispatch;return s.memoizedState=t,[n,c,!1]}function Rs(t,n,s,c){return t={tag:t,create:s,deps:c,inst:n,next:null},n=Je.updateQueue,n===null&&(n=nu(),Je.updateQueue=n),s=n.lastEffect,s===null?n.lastEffect=t.next=t:(c=s.next,s.next=t,t.next=c,n.lastEffect=t),t}function sb(){return Gt().memoizedState}function iu(t,n,s,c){var h=An();Je.flags|=t,h.memoizedState=Rs(1|n,{destroy:void 0},s,c===void 0?null:c)}function su(t,n,s,c){var h=Gt();c=c===void 0?null:c;var p=h.memoizedState.inst;At!==null&&c!==null&&fh(c,At.memoizedState.deps)?h.memoizedState=Rs(n,p,s,c):(Je.flags|=t,h.memoizedState=Rs(1|n,p,s,c))}function ob(t,n){iu(8390656,8,t,n)}function Ch(t,n){su(2048,8,t,n)}function IA(t){Je.flags|=4;var n=Je.updateQueue;if(n===null)n=nu(),Je.updateQueue=n,n.events=[t];else{var s=n.events;s===null?n.events=[t]:s.push(t)}}function lb(t){var n=Gt().memoizedState;return IA({ref:n,nextImpl:t}),function(){if((vt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function cb(t,n){return su(4,2,t,n)}function ub(t,n){return su(4,4,t,n)}function db(t,n){if(typeof n=="function"){t=t();var s=n(t);return function(){typeof s=="function"?s():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function fb(t,n,s){s=s!=null?s.concat([t]):null,su(4,4,db.bind(null,n,t),s)}function Eh(){}function hb(t,n){var s=Gt();n=n===void 0?null:n;var c=s.memoizedState;return n!==null&&fh(n,c[1])?c[0]:(s.memoizedState=[t,n],t)}function gb(t,n){var s=Gt();n=n===void 0?null:n;var c=s.memoizedState;if(n!==null&&fh(n,c[1]))return c[0];if(c=t(),zi){_n(!0);try{t()}finally{_n(!1)}}return s.memoizedState=[c,n],c}function _h(t,n,s){return s===void 0||(cr&1073741824)!==0&&(at&261930)===0?t.memoizedState=n:(t.memoizedState=s,t=pv(),Je.lanes|=t,Xr|=t,s)}function pb(t,n,s,c){return Gn(s,n)?s:As.current!==null?(t=_h(t,s,c),Gn(t,n)||(Jt=!0),t):(cr&42)===0||(cr&1073741824)!==0&&(at&261930)===0?(Jt=!0,t.memoizedState=s):(t=pv(),Je.lanes|=t,Xr|=t,n)}function mb(t,n,s,c,h){var p=fe.p;fe.p=p!==0&&8>p?p:8;var w=Q.T,k={};Q.T=k,Th(t,!1,n,s);try{var z=h(),Y=Q.S;if(Y!==null&&Y(k,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var ae=OA(z,c);el(t,n,ae,Xn(t))}else el(t,n,c,Xn(t))}catch(ue){el(t,n,{then:function(){},status:"rejected",reason:ue},Xn())}finally{fe.p=p,w!==null&&k.types!==null&&(w.types=k.types),Q.T=w}}function HA(){}function Ah(t,n,s,c){if(t.tag!==5)throw Error(r(476));var h=yb(t).queue;mb(t,h,n,ye,s===null?HA:function(){return bb(t),s(c)})}function yb(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ye,baseState:ye,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:ye},next:null};var s={};return n.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ur,lastRenderedState:s},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function bb(t){var n=yb(t);n.next===null&&(n=t.alternate.memoizedState),el(t,n.next.queue,{},Xn())}function xh(){return hn(yl)}function vb(){return Gt().memoizedState}function Sb(){return Gt().memoizedState}function zA(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var s=Xn();t=Gr(s);var c=Vr(n,t,s);c!==null&&(jn(c,n,s),Yo(c,n,s)),n={cache:th()},t.payload=n;return}n=n.return}}function jA(t,n,s){var c=Xn();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ou(t)?Cb(n,s):(s=Gf(t,n,s,c),s!==null&&(jn(s,t,c),Eb(s,n,c)))}function wb(t,n,s){var c=Xn();el(t,n,s,c)}function el(t,n,s,c){var h={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(ou(t))Cb(n,h);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var w=n.lastRenderedState,k=p(w,s);if(h.hasEagerState=!0,h.eagerState=k,Gn(k,w))return Bc(t,n,h,0),kt===null&&Uc(),!1}catch{}if(s=Gf(t,n,h,c),s!==null)return jn(s,t,c),Eb(s,n,c),!0}return!1}function Th(t,n,s,c){if(c={lane:2,revertLane:ig(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},ou(t)){if(n)throw Error(r(479))}else n=Gf(t,s,c,2),n!==null&&jn(n,t,2)}function ou(t){var n=t.alternate;return t===Je||n!==null&&n===Je}function Cb(t,n){xs=eu=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function Eb(t,n,s){if((s&4194048)!==0){var c=n.lanes;c&=t.pendingLanes,s|=c,n.lanes=s,Ue(t,s)}}var tl={readContext:hn,use:au,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useLayoutEffect:Ut,useInsertionEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useSyncExternalStore:Ut,useId:Ut,useHostTransitionStatus:Ut,useFormState:Ut,useActionState:Ut,useOptimistic:Ut,useMemoCache:Ut,useCacheRefresh:Ut};tl.useEffectEvent=Ut;var _b={readContext:hn,use:au,useCallback:function(t,n){return An().memoizedState=[t,n===void 0?null:n],t},useContext:hn,useEffect:ob,useImperativeHandle:function(t,n,s){s=s!=null?s.concat([t]):null,iu(4194308,4,db.bind(null,n,t),s)},useLayoutEffect:function(t,n){return iu(4194308,4,t,n)},useInsertionEffect:function(t,n){iu(4,2,t,n)},useMemo:function(t,n){var s=An();n=n===void 0?null:n;var c=t();if(zi){_n(!0);try{t()}finally{_n(!1)}}return s.memoizedState=[c,n],c},useReducer:function(t,n,s){var c=An();if(s!==void 0){var h=s(n);if(zi){_n(!0);try{s(n)}finally{_n(!1)}}}else h=n;return c.memoizedState=c.baseState=h,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:h},c.queue=t,t=t.dispatch=jA.bind(null,Je,t),[c.memoizedState,t]},useRef:function(t){var n=An();return t={current:t},n.memoizedState=t},useState:function(t){t=Sh(t);var n=t.queue,s=wb.bind(null,Je,n);return n.dispatch=s,[t.memoizedState,s]},useDebugValue:Eh,useDeferredValue:function(t,n){var s=An();return _h(s,t,n)},useTransition:function(){var t=Sh(!1);return t=mb.bind(null,Je,t.queue,!0,!1),An().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,s){var c=Je,h=An();if(lt){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),kt===null)throw Error(r(349));(at&127)!==0||Vy(c,n,s)}h.memoizedState=s;var p={value:s,getSnapshot:n};return h.queue=p,ob(Ky.bind(null,c,p,t),[t]),c.flags|=2048,Rs(9,{destroy:void 0},Fy.bind(null,c,p,s,n),null),s},useId:function(){var t=An(),n=kt.identifierPrefix;if(lt){var s=Ga,c=Pa;s=(c&~(1<<32-P(c)-1)).toString(32)+s,n="_"+n+"R_"+s,s=tu++,0<s&&(n+="H"+s.toString(32)),n+="_"}else s=LA++,n="_"+n+"r_"+s.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:xh,useFormState:nb,useActionState:nb,useOptimistic:function(t){var n=An();n.memoizedState=n.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=s,n=Th.bind(null,Je,!0,s),s.dispatch=n,[t,n]},useMemoCache:yh,useCacheRefresh:function(){return An().memoizedState=zA.bind(null,Je)},useEffectEvent:function(t){var n=An(),s={impl:t};return n.memoizedState=s,function(){if((vt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}},Rh={readContext:hn,use:au,useCallback:hb,useContext:hn,useEffect:Ch,useImperativeHandle:fb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:gb,useReducer:ru,useRef:sb,useState:function(){return ru(ur)},useDebugValue:Eh,useDeferredValue:function(t,n){var s=Gt();return pb(s,At.memoizedState,t,n)},useTransition:function(){var t=ru(ur)[0],n=Gt().memoizedState;return[typeof t=="boolean"?t:Zo(t),n]},useSyncExternalStore:Gy,useId:vb,useHostTransitionStatus:xh,useFormState:ab,useActionState:ab,useOptimistic:function(t,n){var s=Gt();return Xy(s,At,t,n)},useMemoCache:yh,useCacheRefresh:Sb};Rh.useEffectEvent=lb;var Ab={readContext:hn,use:au,useCallback:hb,useContext:hn,useEffect:Ch,useImperativeHandle:fb,useInsertionEffect:cb,useLayoutEffect:ub,useMemo:gb,useReducer:vh,useRef:sb,useState:function(){return vh(ur)},useDebugValue:Eh,useDeferredValue:function(t,n){var s=Gt();return At===null?_h(s,t,n):pb(s,At.memoizedState,t,n)},useTransition:function(){var t=vh(ur)[0],n=Gt().memoizedState;return[typeof t=="boolean"?t:Zo(t),n]},useSyncExternalStore:Gy,useId:vb,useHostTransitionStatus:xh,useFormState:ib,useActionState:ib,useOptimistic:function(t,n){var s=Gt();return At!==null?Xy(s,At,t,n):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:yh,useCacheRefresh:Sb};Ab.useEffectEvent=lb;function kh(t,n,s,c){n=t.memoizedState,s=s(c,n),s=s==null?n:b({},n,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Dh={enqueueSetState:function(t,n,s){t=t._reactInternals;var c=Xn(),h=Gr(c);h.payload=n,s!=null&&(h.callback=s),n=Vr(t,h,c),n!==null&&(jn(n,t,c),Yo(n,t,c))},enqueueReplaceState:function(t,n,s){t=t._reactInternals;var c=Xn(),h=Gr(c);h.tag=1,h.payload=n,s!=null&&(h.callback=s),n=Vr(t,h,c),n!==null&&(jn(n,t,c),Yo(n,t,c))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var s=Xn(),c=Gr(s);c.tag=2,n!=null&&(c.callback=n),n=Vr(t,c,s),n!==null&&(jn(n,t,s),Yo(n,t,s))}};function xb(t,n,s,c,h,p,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,p,w):n.prototype&&n.prototype.isPureReactComponent?!Bo(s,c)||!Bo(h,p):!0}function Tb(t,n,s,c){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,c),n.state!==t&&Dh.enqueueReplaceState(n,n.state,null)}function ji(t,n){var s=n;if("ref"in n){s={};for(var c in n)c!=="ref"&&(s[c]=n[c])}if(t=t.defaultProps){s===n&&(s=b({},s));for(var h in t)s[h]===void 0&&(s[h]=t[h])}return s}function Rb(t){jc(t)}function kb(t){console.error(t)}function Db(t){jc(t)}function lu(t,n){try{var s=t.onUncaughtError;s(n.value,{componentStack:n.stack})}catch(c){setTimeout(function(){throw c})}}function Ob(t,n,s){try{var c=t.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Oh(t,n,s){return s=Gr(s),s.tag=3,s.payload={element:null},s.callback=function(){lu(t,n)},s}function Lb(t){return t=Gr(t),t.tag=3,t}function Mb(t,n,s,c){var h=s.type.getDerivedStateFromError;if(typeof h=="function"){var p=c.value;t.payload=function(){return h(p)},t.callback=function(){Ob(n,s,c)}}var w=s.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){Ob(n,s,c),typeof h!="function"&&(Jr===null?Jr=new Set([this]):Jr.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function UA(t,n,s,c,h){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(n=s.alternate,n!==null&&Ss(n,s,h,!0),s=Fn.current,s!==null){switch(s.tag){case 31:case 13:return la===null?Su():s.alternate===null&&Bt===0&&(Bt=3),s.flags&=-257,s.flags|=65536,s.lanes=h,c===Yc?s.flags|=16384:(n=s.updateQueue,n===null?s.updateQueue=new Set([c]):n.add(c),ng(t,c,h)),!1;case 22:return s.flags|=65536,c===Yc?s.flags|=16384:(n=s.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=n):(s=n.retryQueue,s===null?n.retryQueue=new Set([c]):s.add(c)),ng(t,c,h)),!1}throw Error(r(435,s.tag))}return ng(t,c,h),Su(),!1}if(lt)return n=Fn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=h,c!==Xf&&(t=Error(r(422),{cause:c}),Go(ra(t,s)))):(c!==Xf&&(n=Error(r(423),{cause:c}),Go(ra(n,s))),t=t.current.alternate,t.flags|=65536,h&=-h,t.lanes|=h,c=ra(c,s),h=Oh(t.stateNode,c,h),oh(t,h),Bt!==4&&(Bt=2)),!1;var p=Error(r(520),{cause:c});if(p=ra(p,s),cl===null?cl=[p]:cl.push(p),Bt!==4&&(Bt=2),n===null)return!0;c=ra(c,s),s=n;do{switch(s.tag){case 3:return s.flags|=65536,t=h&-h,s.lanes|=t,t=Oh(s.stateNode,c,t),oh(s,t),!1;case 1:if(n=s.type,p=s.stateNode,(s.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Jr===null||!Jr.has(p))))return s.flags|=65536,h&=-h,s.lanes|=h,h=Lb(h),Mb(h,t,s,c),oh(s,h),!1}s=s.return}while(s!==null);return!1}var Lh=Error(r(461)),Jt=!1;function gn(t,n,s,c){n.child=t===null?Hy(n,null,s,c):Hi(n,t.child,s,c)}function $b(t,n,s,c,h){s=s.render;var p=n.ref;if("ref"in c){var w={};for(var k in c)k!=="ref"&&(w[k]=c[k])}else w=c;return Mi(n),c=hh(t,n,s,w,p,h),k=gh(),t!==null&&!Jt?(ph(t,n,h),dr(t,n,h)):(lt&&k&&Wf(n),n.flags|=1,gn(t,n,c,h),n.child)}function Nb(t,n,s,c,h){if(t===null){var p=s.type;return typeof p=="function"&&!Vf(p)&&p.defaultProps===void 0&&s.compare===null?(n.tag=15,n.type=p,Ib(t,n,p,c,h)):(t=Pc(s.type,null,c,n,n.mode,h),t.ref=n.ref,t.return=n,n.child=t)}if(p=t.child,!Uh(t,h)){var w=p.memoizedProps;if(s=s.compare,s=s!==null?s:Bo,s(w,c)&&t.ref===n.ref)return dr(t,n,h)}return n.flags|=1,t=ir(p,c),t.ref=n.ref,t.return=n,n.child=t}function Ib(t,n,s,c,h){if(t!==null){var p=t.memoizedProps;if(Bo(p,c)&&t.ref===n.ref)if(Jt=!1,n.pendingProps=c=p,Uh(t,h))(t.flags&131072)!==0&&(Jt=!0);else return n.lanes=t.lanes,dr(t,n,h)}return Mh(t,n,s,c,h)}function Hb(t,n,s,c){var h=c.children,p=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((n.flags&128)!==0){if(p=p!==null?p.baseLanes|s:s,t!==null){for(c=n.child=t.child,h=0;c!==null;)h=h|c.lanes|c.childLanes,c=c.sibling;c=h&~p}else c=0,n.child=null;return zb(t,n,p,s,c)}if((s&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Kc(n,p!==null?p.cachePool:null),p!==null?Uy(n,p):ch(),By(n);else return c=n.lanes=536870912,zb(t,n,p!==null?p.baseLanes|s:s,s,c)}else p!==null?(Kc(n,p.cachePool),Uy(n,p),Kr(),n.memoizedState=null):(t!==null&&Kc(n,null),ch(),Kr());return gn(t,n,h,s),n.child}function nl(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function zb(t,n,s,c,h){var p=ah();return p=p===null?null:{parent:Yt._currentValue,pool:p},n.memoizedState={baseLanes:s,cachePool:p},t!==null&&Kc(n,null),ch(),By(n),t!==null&&Ss(t,n,c,!0),n.childLanes=h,null}function cu(t,n){return n=du({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function jb(t,n,s){return Hi(n,t.child,null,s),t=cu(n,n.pendingProps),t.flags|=2,Kn(n),n.memoizedState=null,t}function BA(t,n,s){var c=n.pendingProps,h=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(lt){if(c.mode==="hidden")return t=cu(n,c),n.lanes=536870912,nl(null,t);if(dh(n),(t=Ot)?(t=Jv(t,oa),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:jr!==null?{id:Pa,overflow:Ga}:null,retryLane:536870912,hydrationErrors:null},s=Cy(t),s.return=n,n.child=s,fn=n,Ot=null)):t=null,t===null)throw Br(n);return n.lanes=536870912,null}return cu(n,c)}var p=t.memoizedState;if(p!==null){var w=p.dehydrated;if(dh(n),h)if(n.flags&256)n.flags&=-257,n=jb(t,n,s);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(r(558));else if(Jt||Ss(t,n,s,!1),h=(s&t.childLanes)!==0,Jt||h){if(c=kt,c!==null&&(w=st(c,s),w!==0&&w!==p.retryLane))throw p.retryLane=w,ki(t,w),jn(c,t,w),Lh;Su(),n=jb(t,n,s)}else t=p.treeContext,Ot=ca(w.nextSibling),fn=n,lt=!0,Ur=null,oa=!1,t!==null&&Ay(n,t),n=cu(n,c),n.flags|=4096;return n}return t=ir(t.child,{mode:c.mode,children:c.children}),t.ref=n.ref,n.child=t,t.return=n,t}function uu(t,n){var s=n.ref;if(s===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(r(284));(t===null||t.ref!==s)&&(n.flags|=4194816)}}function Mh(t,n,s,c,h){return Mi(n),s=hh(t,n,s,c,void 0,h),c=gh(),t!==null&&!Jt?(ph(t,n,h),dr(t,n,h)):(lt&&c&&Wf(n),n.flags|=1,gn(t,n,s,h),n.child)}function Ub(t,n,s,c,h,p){return Mi(n),n.updateQueue=null,s=Py(n,c,s,h),qy(t),c=gh(),t!==null&&!Jt?(ph(t,n,p),dr(t,n,p)):(lt&&c&&Wf(n),n.flags|=1,gn(t,n,s,p),n.child)}function Bb(t,n,s,c,h){if(Mi(n),n.stateNode===null){var p=ms,w=s.contextType;typeof w=="object"&&w!==null&&(p=hn(w)),p=new s(c,p),n.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Dh,n.stateNode=p,p._reactInternals=n,p=n.stateNode,p.props=c,p.state=n.memoizedState,p.refs={},ih(n),w=s.contextType,p.context=typeof w=="object"&&w!==null?hn(w):ms,p.state=n.memoizedState,w=s.getDerivedStateFromProps,typeof w=="function"&&(kh(n,s,w,c),p.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(w=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),w!==p.state&&Dh.enqueueReplaceState(p,p.state,null),Jo(n,c,p,h),Xo(),p.state=n.memoizedState),typeof p.componentDidMount=="function"&&(n.flags|=4194308),c=!0}else if(t===null){p=n.stateNode;var k=n.memoizedProps,z=ji(s,k);p.props=z;var Y=p.context,ae=s.contextType;w=ms,typeof ae=="object"&&ae!==null&&(w=hn(ae));var ue=s.getDerivedStateFromProps;ae=typeof ue=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=n.pendingProps!==k,ae||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||Y!==w)&&Tb(n,p,c,w),Pr=!1;var J=n.memoizedState;p.state=J,Jo(n,c,p,h),Xo(),Y=n.memoizedState,k||J!==Y||Pr?(typeof ue=="function"&&(kh(n,s,ue,c),Y=n.memoizedState),(z=Pr||xb(n,s,z,c,J,Y,w))?(ae||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(n.flags|=4194308)):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=Y),p.props=c,p.state=Y,p.context=w,c=z):(typeof p.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{p=n.stateNode,sh(t,n),w=n.memoizedProps,ae=ji(s,w),p.props=ae,ue=n.pendingProps,J=p.context,Y=s.contextType,z=ms,typeof Y=="object"&&Y!==null&&(z=hn(Y)),k=s.getDerivedStateFromProps,(Y=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w!==ue||J!==z)&&Tb(n,p,c,z),Pr=!1,J=n.memoizedState,p.state=J,Jo(n,c,p,h),Xo();var ee=n.memoizedState;w!==ue||J!==ee||Pr||t!==null&&t.dependencies!==null&&Vc(t.dependencies)?(typeof k=="function"&&(kh(n,s,k,c),ee=n.memoizedState),(ae=Pr||xb(n,s,ae,c,J,ee,z)||t!==null&&t.dependencies!==null&&Vc(t.dependencies))?(Y||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(c,ee,z),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(c,ee,z)),typeof p.componentDidUpdate=="function"&&(n.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=ee),p.props=c,p.state=ee,p.context=z,c=ae):(typeof p.componentDidUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=1024),c=!1)}return p=c,uu(t,n),c=(n.flags&128)!==0,p||c?(p=n.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:p.render(),n.flags|=1,t!==null&&c?(n.child=Hi(n,t.child,null,h),n.child=Hi(n,null,s,h)):gn(t,n,s,h),n.memoizedState=p.state,t=n.child):t=dr(t,n,h),t}function qb(t,n,s,c){return Oi(),n.flags|=256,gn(t,n,s,c),n.child}var $h={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nh(t){return{baseLanes:t,cachePool:Oy()}}function Ih(t,n,s){return t=t!==null?t.childLanes&~s:0,n&&(t|=Yn),t}function Pb(t,n,s){var c=n.pendingProps,h=!1,p=(n.flags&128)!==0,w;if((w=p)||(w=t!==null&&t.memoizedState===null?!1:(Pt.current&2)!==0),w&&(h=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,t===null){if(lt){if(h?Fr(n):Kr(),(t=Ot)?(t=Jv(t,oa),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:jr!==null?{id:Pa,overflow:Ga}:null,retryLane:536870912,hydrationErrors:null},s=Cy(t),s.return=n,n.child=s,fn=n,Ot=null)):t=null,t===null)throw Br(n);return bg(t)?n.lanes=32:n.lanes=536870912,null}var k=c.children;return c=c.fallback,h?(Kr(),h=n.mode,k=du({mode:"hidden",children:k},h),c=Di(c,h,s,null),k.return=n,c.return=n,k.sibling=c,n.child=k,c=n.child,c.memoizedState=Nh(s),c.childLanes=Ih(t,w,s),n.memoizedState=$h,nl(null,c)):(Fr(n),Hh(n,k))}var z=t.memoizedState;if(z!==null&&(k=z.dehydrated,k!==null)){if(p)n.flags&256?(Fr(n),n.flags&=-257,n=zh(t,n,s)):n.memoizedState!==null?(Kr(),n.child=t.child,n.flags|=128,n=null):(Kr(),k=c.fallback,h=n.mode,c=du({mode:"visible",children:c.children},h),k=Di(k,h,s,null),k.flags|=2,c.return=n,k.return=n,c.sibling=k,n.child=c,Hi(n,t.child,null,s),c=n.child,c.memoizedState=Nh(s),c.childLanes=Ih(t,w,s),n.memoizedState=$h,n=nl(null,c));else if(Fr(n),bg(k)){if(w=k.nextSibling&&k.nextSibling.dataset,w)var Y=w.dgst;w=Y,c=Error(r(419)),c.stack="",c.digest=w,Go({value:c,source:null,stack:null}),n=zh(t,n,s)}else if(Jt||Ss(t,n,s,!1),w=(s&t.childLanes)!==0,Jt||w){if(w=kt,w!==null&&(c=st(w,s),c!==0&&c!==z.retryLane))throw z.retryLane=c,ki(t,c),jn(w,t,c),Lh;yg(k)||Su(),n=zh(t,n,s)}else yg(k)?(n.flags|=192,n.child=t.child,n=null):(t=z.treeContext,Ot=ca(k.nextSibling),fn=n,lt=!0,Ur=null,oa=!1,t!==null&&Ay(n,t),n=Hh(n,c.children),n.flags|=4096);return n}return h?(Kr(),k=c.fallback,h=n.mode,z=t.child,Y=z.sibling,c=ir(z,{mode:"hidden",children:c.children}),c.subtreeFlags=z.subtreeFlags&65011712,Y!==null?k=ir(Y,k):(k=Di(k,h,s,null),k.flags|=2),k.return=n,c.return=n,c.sibling=k,n.child=c,nl(null,c),c=n.child,k=t.child.memoizedState,k===null?k=Nh(s):(h=k.cachePool,h!==null?(z=Yt._currentValue,h=h.parent!==z?{parent:z,pool:z}:h):h=Oy(),k={baseLanes:k.baseLanes|s,cachePool:h}),c.memoizedState=k,c.childLanes=Ih(t,w,s),n.memoizedState=$h,nl(t.child,c)):(Fr(n),s=t.child,t=s.sibling,s=ir(s,{mode:"visible",children:c.children}),s.return=n,s.sibling=null,t!==null&&(w=n.deletions,w===null?(n.deletions=[t],n.flags|=16):w.push(t)),n.child=s,n.memoizedState=null,s)}function Hh(t,n){return n=du({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function du(t,n){return t=Vn(22,t,null,n),t.lanes=0,t}function zh(t,n,s){return Hi(n,t.child,null,s),t=Hh(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function Gb(t,n,s){t.lanes|=n;var c=t.alternate;c!==null&&(c.lanes|=n),Zf(t.return,n,s)}function jh(t,n,s,c,h,p){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:h,treeForkCount:p}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=c,w.tail=s,w.tailMode=h,w.treeForkCount=p)}function Vb(t,n,s){var c=n.pendingProps,h=c.revealOrder,p=c.tail;c=c.children;var w=Pt.current,k=(w&2)!==0;if(k?(w=w&1|2,n.flags|=128):w&=1,re(Pt,w),gn(t,n,c,s),c=lt?Po:0,!k&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Gb(t,s,n);else if(t.tag===19)Gb(t,s,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(h){case"forwards":for(s=n.child,h=null;s!==null;)t=s.alternate,t!==null&&Zc(t)===null&&(h=s),s=s.sibling;s=h,s===null?(h=n.child,n.child=null):(h=s.sibling,s.sibling=null),jh(n,!1,h,s,p,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,h=n.child,n.child=null;h!==null;){if(t=h.alternate,t!==null&&Zc(t)===null){n.child=h;break}t=h.sibling,h.sibling=s,s=h,h=t}jh(n,!0,s,null,p,c);break;case"together":jh(n,!1,null,null,void 0,c);break;default:n.memoizedState=null}return n.child}function dr(t,n,s){if(t!==null&&(n.dependencies=t.dependencies),Xr|=n.lanes,(s&n.childLanes)===0)if(t!==null){if(Ss(t,n,s,!1),(s&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(r(153));if(n.child!==null){for(t=n.child,s=ir(t,t.pendingProps),n.child=s,s.return=n;t.sibling!==null;)t=t.sibling,s=s.sibling=ir(t,t.pendingProps),s.return=n;s.sibling=null}return n.child}function Uh(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Vc(t)))}function qA(t,n,s){switch(n.tag){case 3:ve(n,n.stateNode.containerInfo),qr(n,Yt,t.memoizedState.cache),Oi();break;case 27:case 5:Ae(n);break;case 4:ve(n,n.stateNode.containerInfo);break;case 10:qr(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,dh(n),null;break;case 13:var c=n.memoizedState;if(c!==null)return c.dehydrated!==null?(Fr(n),n.flags|=128,null):(s&n.child.childLanes)!==0?Pb(t,n,s):(Fr(n),t=dr(t,n,s),t!==null?t.sibling:null);Fr(n);break;case 19:var h=(t.flags&128)!==0;if(c=(s&n.childLanes)!==0,c||(Ss(t,n,s,!1),c=(s&n.childLanes)!==0),h){if(c)return Vb(t,n,s);n.flags|=128}if(h=n.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),re(Pt,Pt.current),c)break;return null;case 22:return n.lanes=0,Hb(t,n,s,n.pendingProps);case 24:qr(n,Yt,t.memoizedState.cache)}return dr(t,n,s)}function Fb(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps)Jt=!0;else{if(!Uh(t,s)&&(n.flags&128)===0)return Jt=!1,qA(t,n,s);Jt=(t.flags&131072)!==0}else Jt=!1,lt&&(n.flags&1048576)!==0&&_y(n,Po,n.index);switch(n.lanes=0,n.tag){case 16:e:{var c=n.pendingProps;if(t=Ni(n.elementType),n.type=t,typeof t=="function")Vf(t)?(c=ji(t,c),n.tag=1,n=Bb(null,n,t,c,s)):(n.tag=0,n=Mh(null,n,t,c,s));else{if(t!=null){var h=t.$$typeof;if(h===D){n.tag=11,n=$b(null,n,t,c,s);break e}else if(h===q){n.tag=14,n=Nb(null,n,t,c,s);break e}}throw n=Xe(t)||t,Error(r(306,n,""))}}return n;case 0:return Mh(t,n,n.type,n.pendingProps,s);case 1:return c=n.type,h=ji(c,n.pendingProps),Bb(t,n,c,h,s);case 3:e:{if(ve(n,n.stateNode.containerInfo),t===null)throw Error(r(387));c=n.pendingProps;var p=n.memoizedState;h=p.element,sh(t,n),Jo(n,c,null,s);var w=n.memoizedState;if(c=w.cache,qr(n,Yt,c),c!==p.cache&&eh(n,[Yt],s,!0),Xo(),c=w.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){n=qb(t,n,c,s);break e}else if(c!==h){h=ra(Error(r(424)),n),Go(h),n=qb(t,n,c,s);break e}else for(t=n.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Ot=ca(t.firstChild),fn=n,lt=!0,Ur=null,oa=!0,s=Hy(n,null,c,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Oi(),c===h){n=dr(t,n,s);break e}gn(t,n,c,s)}n=n.child}return n;case 26:return uu(t,n),t===null?(s=aS(n.type,null,n.pendingProps,null))?n.memoizedState=s:lt||(s=n.type,t=n.pendingProps,c=Tu(me.current).createElement(s),c[an]=n,c[vn]=t,pn(c,s,t),Wt(c),n.stateNode=c):n.memoizedState=aS(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return Ae(n),t===null&&lt&&(c=n.stateNode=eS(n.type,n.pendingProps,me.current),fn=n,oa=!0,h=Ot,ti(n.type)?(vg=h,Ot=ca(c.firstChild)):Ot=h),gn(t,n,n.pendingProps.children,s),uu(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&lt&&((h=c=Ot)&&(c=bx(c,n.type,n.pendingProps,oa),c!==null?(n.stateNode=c,fn=n,Ot=ca(c.firstChild),oa=!1,h=!0):h=!1),h||Br(n)),Ae(n),h=n.type,p=n.pendingProps,w=t!==null?t.memoizedProps:null,c=p.children,gg(h,p)?c=null:w!==null&&gg(h,w)&&(n.flags|=32),n.memoizedState!==null&&(h=hh(t,n,MA,null,null,s),yl._currentValue=h),uu(t,n),gn(t,n,c,s),n.child;case 6:return t===null&&lt&&((t=s=Ot)&&(s=vx(s,n.pendingProps,oa),s!==null?(n.stateNode=s,fn=n,Ot=null,t=!0):t=!1),t||Br(n)),null;case 13:return Pb(t,n,s);case 4:return ve(n,n.stateNode.containerInfo),c=n.pendingProps,t===null?n.child=Hi(n,null,c,s):gn(t,n,c,s),n.child;case 11:return $b(t,n,n.type,n.pendingProps,s);case 7:return gn(t,n,n.pendingProps,s),n.child;case 8:return gn(t,n,n.pendingProps.children,s),n.child;case 12:return gn(t,n,n.pendingProps.children,s),n.child;case 10:return c=n.pendingProps,qr(n,n.type,c.value),gn(t,n,c.children,s),n.child;case 9:return h=n.type._context,c=n.pendingProps.children,Mi(n),h=hn(h),c=c(h),n.flags|=1,gn(t,n,c,s),n.child;case 14:return Nb(t,n,n.type,n.pendingProps,s);case 15:return Ib(t,n,n.type,n.pendingProps,s);case 19:return Vb(t,n,s);case 31:return BA(t,n,s);case 22:return Hb(t,n,s,n.pendingProps);case 24:return Mi(n),c=hn(Yt),t===null?(h=ah(),h===null&&(h=kt,p=th(),h.pooledCache=p,p.refCount++,p!==null&&(h.pooledCacheLanes|=s),h=p),n.memoizedState={parent:c,cache:h},ih(n),qr(n,Yt,h)):((t.lanes&s)!==0&&(sh(t,n),Jo(n,null,null,s),Xo()),h=t.memoizedState,p=n.memoizedState,h.parent!==c?(h={parent:c,cache:c},n.memoizedState=h,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=h),qr(n,Yt,c)):(c=p.cache,qr(n,Yt,c),c!==h.cache&&eh(n,[Yt],s,!0))),gn(t,n,n.pendingProps.children,s),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function fr(t){t.flags|=4}function Bh(t,n,s,c,h){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(h&335544128)===h)if(t.stateNode.complete)t.flags|=8192;else if(vv())t.flags|=8192;else throw Ii=Yc,rh}else t.flags&=-16777217}function Kb(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!lS(n))if(vv())t.flags|=8192;else throw Ii=Yc,rh}function fu(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?ke():536870912,t.lanes|=n,Ls|=n)}function al(t,n){if(!lt)switch(t.tailMode){case"hidden":n=t.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function Lt(t){var n=t.alternate!==null&&t.alternate.child===t.child,s=0,c=0;if(n)for(var h=t.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags&65011712,c|=h.flags&65011712,h.return=t,h=h.sibling;else for(h=t.child;h!==null;)s|=h.lanes|h.childLanes,c|=h.subtreeFlags,c|=h.flags,h.return=t,h=h.sibling;return t.subtreeFlags|=c,t.childLanes=s,n}function PA(t,n,s){var c=n.pendingProps;switch(Yf(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(n),null;case 1:return Lt(n),null;case 3:return s=n.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),n.memoizedState.cache!==c&&(n.flags|=2048),lr(Yt),He(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(vs(n)?fr(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Jf())),Lt(n),null;case 26:var h=n.type,p=n.memoizedState;return t===null?(fr(n),p!==null?(Lt(n),Kb(n,p)):(Lt(n),Bh(n,h,null,c,s))):p?p!==t.memoizedState?(fr(n),Lt(n),Kb(n,p)):(Lt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==c&&fr(n),Lt(n),Bh(n,h,t,c,s)),null;case 27:if(Et(n),s=me.current,h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&fr(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return Lt(n),null}t=de.current,vs(n)?xy(n):(t=eS(h,c,s),n.stateNode=t,fr(n))}return Lt(n),null;case 5:if(Et(n),h=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&fr(n);else{if(!c){if(n.stateNode===null)throw Error(r(166));return Lt(n),null}if(p=de.current,vs(n))xy(n);else{var w=Tu(me.current);switch(p){case 1:p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":p=w.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":p=w.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":p=w.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?p.multiple=!0:c.size&&(p.size=c.size);break;default:p=typeof c.is=="string"?w.createElement(h,{is:c.is}):w.createElement(h)}}p[an]=n,p[vn]=c;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=p;e:switch(pn(p,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&fr(n)}}return Lt(n),Bh(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,s),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==c&&fr(n);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(t=me.current,vs(n)){if(t=n.stateNode,s=n.memoizedProps,c=null,h=fn,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}t[an]=n,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||Pv(t.nodeValue,s)),t||Br(n,!0)}else t=Tu(t).createTextNode(c),t[an]=n,n.stateNode=t}return Lt(n),null;case 31:if(s=n.memoizedState,t===null||t.memoizedState!==null){if(c=vs(n),s!==null){if(t===null){if(!c)throw Error(r(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[an]=n}else Oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),t=!1}else s=Jf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return n.flags&256?(Kn(n),n):(Kn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return Lt(n),null;case 13:if(c=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(h=vs(n),c!==null&&c.dehydrated!==null){if(t===null){if(!h)throw Error(r(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[an]=n}else Oi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Lt(n),h=!1}else h=Jf(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=h),h=!0;if(!h)return n.flags&256?(Kn(n),n):(Kn(n),null)}return Kn(n),(n.flags&128)!==0?(n.lanes=s,n):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=n.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),p=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(p=c.memoizedState.cachePool.pool),p!==h&&(c.flags|=2048)),s!==t&&s&&(n.child.flags|=8192),fu(n,n.updateQueue),Lt(n),null);case 4:return He(),t===null&&cg(n.stateNode.containerInfo),Lt(n),null;case 10:return lr(n.type),Lt(n),null;case 19:if(K(Pt),c=n.memoizedState,c===null)return Lt(n),null;if(h=(n.flags&128)!==0,p=c.rendering,p===null)if(h)al(c,!1);else{if(Bt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(p=Zc(t),p!==null){for(n.flags|=128,al(c,!1),t=p.updateQueue,n.updateQueue=t,fu(n,t),n.subtreeFlags=0,t=s,s=n.child;s!==null;)wy(s,t),s=s.sibling;return re(Pt,Pt.current&1|2),lt&&sr(n,c.treeForkCount),n.child}t=t.sibling}c.tail!==null&&Ft()>yu&&(n.flags|=128,h=!0,al(c,!1),n.lanes=4194304)}else{if(!h)if(t=Zc(p),t!==null){if(n.flags|=128,h=!0,t=t.updateQueue,n.updateQueue=t,fu(n,t),al(c,!0),c.tail===null&&c.tailMode==="hidden"&&!p.alternate&&!lt)return Lt(n),null}else 2*Ft()-c.renderingStartTime>yu&&s!==536870912&&(n.flags|=128,h=!0,al(c,!1),n.lanes=4194304);c.isBackwards?(p.sibling=n.child,n.child=p):(t=c.last,t!==null?t.sibling=p:n.child=p,c.last=p)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Ft(),t.sibling=null,s=Pt.current,re(Pt,h?s&1|2:s&1),lt&&sr(n,c.treeForkCount),t):(Lt(n),null);case 22:case 23:return Kn(n),uh(),c=n.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(n.flags|=8192):c&&(n.flags|=8192),c?(s&536870912)!==0&&(n.flags&128)===0&&(Lt(n),n.subtreeFlags&6&&(n.flags|=8192)):Lt(n),s=n.updateQueue,s!==null&&fu(n,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==s&&(n.flags|=2048),t!==null&&K($i),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),lr(Yt),Lt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function GA(t,n){switch(Yf(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return lr(Yt),He(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return Et(n),null;case 31:if(n.memoizedState!==null){if(Kn(n),n.alternate===null)throw Error(r(340));Oi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Kn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Oi()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return K(Pt),null;case 4:return He(),null;case 10:return lr(n.type),null;case 22:case 23:return Kn(n),uh(),t!==null&&K($i),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return lr(Yt),null;case 25:return null;default:return null}}function Wb(t,n){switch(Yf(n),n.tag){case 3:lr(Yt),He();break;case 26:case 27:case 5:Et(n);break;case 4:He();break;case 31:n.memoizedState!==null&&Kn(n);break;case 13:Kn(n);break;case 19:K(Pt);break;case 10:lr(n.type);break;case 22:case 23:Kn(n),uh(),t!==null&&K($i);break;case 24:lr(Yt)}}function rl(t,n){try{var s=n.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var h=c.next;s=h;do{if((s.tag&t)===t){c=void 0;var p=s.create,w=s.inst;c=p(),w.destroy=c}s=s.next}while(s!==h)}}catch(k){Ct(n,n.return,k)}}function Wr(t,n,s){try{var c=n.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var p=h.next;c=p;do{if((c.tag&t)===t){var w=c.inst,k=w.destroy;if(k!==void 0){w.destroy=void 0,h=n;var z=s,Y=k;try{Y()}catch(ae){Ct(h,z,ae)}}}c=c.next}while(c!==p)}}catch(ae){Ct(n,n.return,ae)}}function Yb(t){var n=t.updateQueue;if(n!==null){var s=t.stateNode;try{jy(n,s)}catch(c){Ct(t,t.return,c)}}}function Xb(t,n,s){s.props=ji(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){Ct(t,n,c)}}function il(t,n){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof s=="function"?t.refCleanup=s(c):s.current=c}}catch(h){Ct(t,n,h)}}function Va(t,n){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(h){Ct(t,n,h)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){Ct(t,n,h)}else s.current=null}function Jb(t){var n=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(h){Ct(t,t.return,h)}}function qh(t,n,s){try{var c=t.stateNode;fx(c,t.type,s,n),c[vn]=n}catch(h){Ct(t,t.return,h)}}function Qb(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ti(t.type)||t.tag===4}function Ph(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Qb(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ti(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Gh(t,n,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,n?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,n):(n=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,n.appendChild(t),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=Aa));else if(c!==4&&(c===27&&ti(t.type)&&(s=t.stateNode,n=null),t=t.child,t!==null))for(Gh(t,n,s),t=t.sibling;t!==null;)Gh(t,n,s),t=t.sibling}function hu(t,n,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,n?s.insertBefore(t,n):s.appendChild(t);else if(c!==4&&(c===27&&ti(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(hu(t,n,s),t=t.sibling;t!==null;)hu(t,n,s),t=t.sibling}function Zb(t){var n=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,h=n.attributes;h.length;)n.removeAttributeNode(h[0]);pn(n,c,s),n[an]=t,n[vn]=s}catch(p){Ct(t,t.return,p)}}var hr=!1,Qt=!1,Vh=!1,ev=typeof WeakSet=="function"?WeakSet:Set,cn=null;function VA(t,n){if(t=t.containerInfo,fg=$u,t=fy(t),zf(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{s.nodeType,p.nodeType}catch{s=null;break e}var w=0,k=-1,z=-1,Y=0,ae=0,ue=t,J=null;t:for(;;){for(var ee;ue!==s||h!==0&&ue.nodeType!==3||(k=w+h),ue!==p||c!==0&&ue.nodeType!==3||(z=w+c),ue.nodeType===3&&(w+=ue.nodeValue.length),(ee=ue.firstChild)!==null;)J=ue,ue=ee;for(;;){if(ue===t)break t;if(J===s&&++Y===h&&(k=w),J===p&&++ae===c&&(z=w),(ee=ue.nextSibling)!==null)break;ue=J,J=ue.parentNode}ue=ee}s=k===-1||z===-1?null:{start:k,end:z}}else s=null}s=s||{start:0,end:0}}else s=null;for(hg={focusedElem:t,selectionRange:s},$u=!1,cn=n;cn!==null;)if(n=cn,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,cn=t;else for(;cn!==null;){switch(n=cn,p=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)h=t[s],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&p!==null){t=void 0,s=n,h=p.memoizedProps,p=p.memoizedState,c=s.stateNode;try{var De=ji(s.type,h);t=c.getSnapshotBeforeUpdate(De,p),c.__reactInternalSnapshotBeforeUpdate=t}catch(Ge){Ct(s,s.return,Ge)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,s=t.nodeType,s===9)mg(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":mg(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(r(163))}if(t=n.sibling,t!==null){t.return=n.return,cn=t;break}cn=n.return}}function tv(t,n,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:pr(t,s),c&4&&rl(5,s);break;case 1:if(pr(t,s),c&4)if(t=s.stateNode,n===null)try{t.componentDidMount()}catch(w){Ct(s,s.return,w)}else{var h=ji(s.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(h,n,t.__reactInternalSnapshotBeforeUpdate)}catch(w){Ct(s,s.return,w)}}c&64&&Yb(s),c&512&&il(s,s.return);break;case 3:if(pr(t,s),c&64&&(t=s.updateQueue,t!==null)){if(n=null,s.child!==null)switch(s.child.tag){case 27:case 5:n=s.child.stateNode;break;case 1:n=s.child.stateNode}try{jy(t,n)}catch(w){Ct(s,s.return,w)}}break;case 27:n===null&&c&4&&Zb(s);case 26:case 5:pr(t,s),n===null&&c&4&&Jb(s),c&512&&il(s,s.return);break;case 12:pr(t,s);break;case 31:pr(t,s),c&4&&rv(t,s);break;case 13:pr(t,s),c&4&&iv(t,s),c&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=ex.bind(null,s),Sx(t,s))));break;case 22:if(c=s.memoizedState!==null||hr,!c){n=n!==null&&n.memoizedState!==null||Qt,h=hr;var p=Qt;hr=c,(Qt=n)&&!p?mr(t,s,(s.subtreeFlags&8772)!==0):pr(t,s),hr=h,Qt=p}break;case 30:break;default:pr(t,s)}}function nv(t){var n=t.alternate;n!==null&&(t.alternate=null,nv(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Ao(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Mt=null,Nn=!1;function gr(t,n,s){for(s=s.child;s!==null;)av(t,n,s),s=s.sibling}function av(t,n,s){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(Ea,s)}catch{}switch(s.tag){case 26:Qt||Va(s,n),gr(t,n,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Qt||Va(s,n);var c=Mt,h=Nn;ti(s.type)&&(Mt=s.stateNode,Nn=!1),gr(t,n,s),gl(s.stateNode),Mt=c,Nn=h;break;case 5:Qt||Va(s,n);case 6:if(c=Mt,h=Nn,Mt=null,gr(t,n,s),Mt=c,Nn=h,Mt!==null)if(Nn)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(s.stateNode)}catch(p){Ct(s,n,p)}else try{Mt.removeChild(s.stateNode)}catch(p){Ct(s,n,p)}break;case 18:Mt!==null&&(Nn?(t=Mt,Yv(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),Us(t)):Yv(Mt,s.stateNode));break;case 4:c=Mt,h=Nn,Mt=s.stateNode.containerInfo,Nn=!0,gr(t,n,s),Mt=c,Nn=h;break;case 0:case 11:case 14:case 15:Wr(2,s,n),Qt||Wr(4,s,n),gr(t,n,s);break;case 1:Qt||(Va(s,n),c=s.stateNode,typeof c.componentWillUnmount=="function"&&Xb(s,n,c)),gr(t,n,s);break;case 21:gr(t,n,s);break;case 22:Qt=(c=Qt)||s.memoizedState!==null,gr(t,n,s),Qt=c;break;default:gr(t,n,s)}}function rv(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Us(t)}catch(s){Ct(n,n.return,s)}}}function iv(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Us(t)}catch(s){Ct(n,n.return,s)}}function FA(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new ev),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new ev),n;default:throw Error(r(435,t.tag))}}function gu(t,n){var s=FA(t);n.forEach(function(c){if(!s.has(c)){s.add(c);var h=tx.bind(null,t,c);c.then(h,h)}})}function In(t,n){var s=n.deletions;if(s!==null)for(var c=0;c<s.length;c++){var h=s[c],p=t,w=n,k=w;e:for(;k!==null;){switch(k.tag){case 27:if(ti(k.type)){Mt=k.stateNode,Nn=!1;break e}break;case 5:Mt=k.stateNode,Nn=!1;break e;case 3:case 4:Mt=k.stateNode.containerInfo,Nn=!0;break e}k=k.return}if(Mt===null)throw Error(r(160));av(p,w,h),Mt=null,Nn=!1,p=h.alternate,p!==null&&(p.return=null),h.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)sv(n,t),n=n.sibling}var Da=null;function sv(t,n){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:In(n,t),Hn(t),c&4&&(Wr(3,t,t.return),rl(3,t),Wr(5,t,t.return));break;case 1:In(n,t),Hn(t),c&512&&(Qt||s===null||Va(s,s.return)),c&64&&hr&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var h=Da;if(In(n,t),Hn(t),c&512&&(Qt||s===null||Va(s,s.return)),c&4){var p=s!==null?s.memoizedState:null;if(c=t.memoizedState,s===null)if(c===null)if(t.stateNode===null){e:{c=t.type,s=t.memoizedProps,h=h.ownerDocument||h;t:switch(c){case"title":p=h.getElementsByTagName("title")[0],(!p||p[pi]||p[an]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=h.createElement(c),h.head.insertBefore(p,h.querySelector("head > title"))),pn(p,c,s),p[an]=t,Wt(p),c=p;break e;case"link":var w=sS("link","href",h).get(c+(s.href||""));if(w){for(var k=0;k<w.length;k++)if(p=w[k],p.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&p.getAttribute("rel")===(s.rel==null?null:s.rel)&&p.getAttribute("title")===(s.title==null?null:s.title)&&p.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){w.splice(k,1);break t}}p=h.createElement(c),pn(p,c,s),h.head.appendChild(p);break;case"meta":if(w=sS("meta","content",h).get(c+(s.content||""))){for(k=0;k<w.length;k++)if(p=w[k],p.getAttribute("content")===(s.content==null?null:""+s.content)&&p.getAttribute("name")===(s.name==null?null:s.name)&&p.getAttribute("property")===(s.property==null?null:s.property)&&p.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&p.getAttribute("charset")===(s.charSet==null?null:s.charSet)){w.splice(k,1);break t}}p=h.createElement(c),pn(p,c,s),h.head.appendChild(p);break;default:throw Error(r(468,c))}p[an]=t,Wt(p),c=p}t.stateNode=c}else oS(h,t.type,t.stateNode);else t.stateNode=iS(h,c,t.memoizedProps);else p!==c?(p===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):p.count--,c===null?oS(h,t.type,t.stateNode):iS(h,c,t.memoizedProps)):c===null&&t.stateNode!==null&&qh(t,t.memoizedProps,s.memoizedProps)}break;case 27:In(n,t),Hn(t),c&512&&(Qt||s===null||Va(s,s.return)),s!==null&&c&4&&qh(t,t.memoizedProps,s.memoizedProps);break;case 5:if(In(n,t),Hn(t),c&512&&(Qt||s===null||Va(s,s.return)),t.flags&32){h=t.stateNode;try{Ir(h,"")}catch(De){Ct(t,t.return,De)}}c&4&&t.stateNode!=null&&(h=t.memoizedProps,qh(t,h,s!==null?s.memoizedProps:h)),c&1024&&(Vh=!0);break;case 6:if(In(n,t),Hn(t),c&4){if(t.stateNode===null)throw Error(r(162));c=t.memoizedProps,s=t.stateNode;try{s.nodeValue=c}catch(De){Ct(t,t.return,De)}}break;case 3:if(Du=null,h=Da,Da=Ru(n.containerInfo),In(n,t),Da=h,Hn(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{Us(n.containerInfo)}catch(De){Ct(t,t.return,De)}Vh&&(Vh=!1,ov(t));break;case 4:c=Da,Da=Ru(t.stateNode.containerInfo),In(n,t),Hn(t),Da=c;break;case 12:In(n,t),Hn(t);break;case 31:In(n,t),Hn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,gu(t,c)));break;case 13:In(n,t),Hn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(mu=Ft()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,gu(t,c)));break;case 22:h=t.memoizedState!==null;var z=s!==null&&s.memoizedState!==null,Y=hr,ae=Qt;if(hr=Y||h,Qt=ae||z,In(n,t),Qt=ae,hr=Y,Hn(t),c&8192)e:for(n=t.stateNode,n._visibility=h?n._visibility&-2:n._visibility|1,h&&(s===null||z||hr||Qt||Ui(t)),s=null,n=t;;){if(n.tag===5||n.tag===26){if(s===null){z=s=n;try{if(p=z.stateNode,h)w=p.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{k=z.stateNode;var ue=z.memoizedProps.style,J=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;k.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(De){Ct(z,z.return,De)}}}else if(n.tag===6){if(s===null){z=n;try{z.stateNode.nodeValue=h?"":z.memoizedProps}catch(De){Ct(z,z.return,De)}}}else if(n.tag===18){if(s===null){z=n;try{var ee=z.stateNode;h?Xv(ee,!0):Xv(z.stateNode,!1)}catch(De){Ct(z,z.return,De)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;s===n&&(s=null),n=n.return}s===n&&(s=null),n.sibling.return=n.return,n=n.sibling}c&4&&(c=t.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,gu(t,s))));break;case 19:In(n,t),Hn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,gu(t,c)));break;case 30:break;case 21:break;default:In(n,t),Hn(t)}}function Hn(t){var n=t.flags;if(n&2){try{for(var s,c=t.return;c!==null;){if(Qb(c)){s=c;break}c=c.return}if(s==null)throw Error(r(160));switch(s.tag){case 27:var h=s.stateNode,p=Ph(t);hu(t,p,h);break;case 5:var w=s.stateNode;s.flags&32&&(Ir(w,""),s.flags&=-33);var k=Ph(t);hu(t,k,w);break;case 3:case 4:var z=s.stateNode.containerInfo,Y=Ph(t);Gh(t,Y,z);break;default:throw Error(r(161))}}catch(ae){Ct(t,t.return,ae)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function ov(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;ov(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function pr(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)tv(t,n.alternate,n),n=n.sibling}function Ui(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:Wr(4,n,n.return),Ui(n);break;case 1:Va(n,n.return);var s=n.stateNode;typeof s.componentWillUnmount=="function"&&Xb(n,n.return,s),Ui(n);break;case 27:gl(n.stateNode);case 26:case 5:Va(n,n.return),Ui(n);break;case 22:n.memoizedState===null&&Ui(n);break;case 30:Ui(n);break;default:Ui(n)}t=t.sibling}}function mr(t,n,s){for(s=s&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var c=n.alternate,h=t,p=n,w=p.flags;switch(p.tag){case 0:case 11:case 15:mr(h,p,s),rl(4,p);break;case 1:if(mr(h,p,s),c=p,h=c.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(Y){Ct(c,c.return,Y)}if(c=p,h=c.updateQueue,h!==null){var k=c.stateNode;try{var z=h.shared.hiddenCallbacks;if(z!==null)for(h.shared.hiddenCallbacks=null,h=0;h<z.length;h++)zy(z[h],k)}catch(Y){Ct(c,c.return,Y)}}s&&w&64&&Yb(p),il(p,p.return);break;case 27:Zb(p);case 26:case 5:mr(h,p,s),s&&c===null&&w&4&&Jb(p),il(p,p.return);break;case 12:mr(h,p,s);break;case 31:mr(h,p,s),s&&w&4&&rv(h,p);break;case 13:mr(h,p,s),s&&w&4&&iv(h,p);break;case 22:p.memoizedState===null&&mr(h,p,s),il(p,p.return);break;case 30:break;default:mr(h,p,s)}n=n.sibling}}function Fh(t,n){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Vo(s))}function Kh(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Vo(t))}function Oa(t,n,s,c){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)lv(t,n,s,c),n=n.sibling}function lv(t,n,s,c){var h=n.flags;switch(n.tag){case 0:case 11:case 15:Oa(t,n,s,c),h&2048&&rl(9,n);break;case 1:Oa(t,n,s,c);break;case 3:Oa(t,n,s,c),h&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&Vo(t)));break;case 12:if(h&2048){Oa(t,n,s,c),t=n.stateNode;try{var p=n.memoizedProps,w=p.id,k=p.onPostCommit;typeof k=="function"&&k(w,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(z){Ct(n,n.return,z)}}else Oa(t,n,s,c);break;case 31:Oa(t,n,s,c);break;case 13:Oa(t,n,s,c);break;case 23:break;case 22:p=n.stateNode,w=n.alternate,n.memoizedState!==null?p._visibility&2?Oa(t,n,s,c):sl(t,n):p._visibility&2?Oa(t,n,s,c):(p._visibility|=2,ks(t,n,s,c,(n.subtreeFlags&10256)!==0||!1)),h&2048&&Fh(w,n);break;case 24:Oa(t,n,s,c),h&2048&&Kh(n.alternate,n);break;default:Oa(t,n,s,c)}}function ks(t,n,s,c,h){for(h=h&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var p=t,w=n,k=s,z=c,Y=w.flags;switch(w.tag){case 0:case 11:case 15:ks(p,w,k,z,h),rl(8,w);break;case 23:break;case 22:var ae=w.stateNode;w.memoizedState!==null?ae._visibility&2?ks(p,w,k,z,h):sl(p,w):(ae._visibility|=2,ks(p,w,k,z,h)),h&&Y&2048&&Fh(w.alternate,w);break;case 24:ks(p,w,k,z,h),h&&Y&2048&&Kh(w.alternate,w);break;default:ks(p,w,k,z,h)}n=n.sibling}}function sl(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var s=t,c=n,h=c.flags;switch(c.tag){case 22:sl(s,c),h&2048&&Fh(c.alternate,c);break;case 24:sl(s,c),h&2048&&Kh(c.alternate,c);break;default:sl(s,c)}n=n.sibling}}var ol=8192;function Ds(t,n,s){if(t.subtreeFlags&ol)for(t=t.child;t!==null;)cv(t,n,s),t=t.sibling}function cv(t,n,s){switch(t.tag){case 26:Ds(t,n,s),t.flags&ol&&t.memoizedState!==null&&Lx(s,Da,t.memoizedState,t.memoizedProps);break;case 5:Ds(t,n,s);break;case 3:case 4:var c=Da;Da=Ru(t.stateNode.containerInfo),Ds(t,n,s),Da=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=ol,ol=16777216,Ds(t,n,s),ol=c):Ds(t,n,s));break;default:Ds(t,n,s)}}function uv(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function ll(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var c=n[s];cn=c,fv(c,t)}uv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)dv(t),t=t.sibling}function dv(t){switch(t.tag){case 0:case 11:case 15:ll(t),t.flags&2048&&Wr(9,t,t.return);break;case 3:ll(t);break;case 12:ll(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,pu(t)):ll(t);break;default:ll(t)}}function pu(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var c=n[s];cn=c,fv(c,t)}uv(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:Wr(8,n,n.return),pu(n);break;case 22:s=n.stateNode,s._visibility&2&&(s._visibility&=-3,pu(n));break;default:pu(n)}t=t.sibling}}function fv(t,n){for(;cn!==null;){var s=cn;switch(s.tag){case 0:case 11:case 15:Wr(8,s,n);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Vo(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,cn=c;else e:for(s=t;cn!==null;){c=cn;var h=c.sibling,p=c.return;if(nv(c),c===s){cn=null;break e}if(h!==null){h.return=p,cn=h;break e}cn=p}}}var KA={getCacheForType:function(t){var n=hn(Yt),s=n.data.get(t);return s===void 0&&(s=t(),n.data.set(t,s)),s},cacheSignal:function(){return hn(Yt).controller.signal}},WA=typeof WeakMap=="function"?WeakMap:Map,vt=0,kt=null,tt=null,at=0,wt=0,Wn=null,Yr=!1,Os=!1,Wh=!1,yr=0,Bt=0,Xr=0,Bi=0,Yh=0,Yn=0,Ls=0,cl=null,zn=null,Xh=!1,mu=0,hv=0,yu=1/0,bu=null,Jr=null,sn=0,Qr=null,Ms=null,br=0,Jh=0,Qh=null,gv=null,ul=0,Zh=null;function Xn(){return(vt&2)!==0&&at!==0?at&-at:Q.T!==null?ig():Kt()}function pv(){if(Yn===0)if((at&536870912)===0||lt){var t=Se;Se<<=1,(Se&3932160)===0&&(Se=262144),Yn=t}else Yn=536870912;return t=Fn.current,t!==null&&(t.flags|=32),Yn}function jn(t,n,s){(t===kt&&(wt===2||wt===9)||t.cancelPendingCommit!==null)&&($s(t,0),Zr(t,at,Yn,!1)),Fe(t,s),((vt&2)===0||t!==kt)&&(t===kt&&((vt&2)===0&&(Bi|=s),Bt===4&&Zr(t,at,Yn,!1)),Fa(t))}function mv(t,n,s){if((vt&6)!==0)throw Error(r(327));var c=!s&&(n&127)===0&&(n&t.expiredLanes)===0||ze(t,n),h=c?JA(t,n):tg(t,n,!0),p=c;do{if(h===0){Os&&!c&&Zr(t,n,0,!1);break}else{if(s=t.current.alternate,p&&!YA(s)){h=tg(t,n,!1),p=!1;continue}if(h===2){if(p=n,t.errorRecoveryDisabledLanes&p)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var k=t;h=cl;var z=k.current.memoizedState.isDehydrated;if(z&&($s(k,w).flags|=256),w=tg(k,w,!1),w!==2){if(Wh&&!z){k.errorRecoveryDisabledLanes|=p,Bi|=p,h=4;break e}p=zn,zn=h,p!==null&&(zn===null?zn=p:zn.push.apply(zn,p))}h=w}if(p=!1,h!==2)continue}}if(h===1){$s(t,0),Zr(t,n,0,!0);break}e:{switch(c=t,p=h,p){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Zr(c,n,Yn,!Yr);break e;case 2:zn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(h=mu+300-Ft(),10<h)){if(Zr(c,n,Yn,!Yr),je(c,0,!0)!==0)break e;br=n,c.timeoutHandle=Kv(yv.bind(null,c,s,zn,bu,Xh,n,Yn,Bi,Ls,Yr,p,"Throttled",-0,0),h);break e}yv(c,s,zn,bu,Xh,n,Yn,Bi,Ls,Yr,p,null,-0,0)}}break}while(!0);Fa(t)}function yv(t,n,s,c,h,p,w,k,z,Y,ae,ue,J,ee){if(t.timeoutHandle=-1,ue=n.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Aa},cv(n,p,ue);var De=(p&62914560)===p?mu-Ft():(p&4194048)===p?hv-Ft():0;if(De=Mx(ue,De),De!==null){br=p,t.cancelPendingCommit=De(Av.bind(null,t,n,p,s,c,h,w,k,z,ae,ue,null,J,ee)),Zr(t,p,w,!Y);return}}Av(t,n,p,s,c,h,w,k,z)}function YA(t){for(var n=t;;){var s=n.tag;if((s===0||s===11||s===15)&&n.flags&16384&&(s=n.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var h=s[c],p=h.getSnapshot;h=h.value;try{if(!Gn(p(),h))return!1}catch{return!1}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Zr(t,n,s,c){n&=~Yh,n&=~Bi,t.suspendedLanes|=n,t.pingedLanes&=~n,c&&(t.warmLanes|=n),c=t.expirationTimes;for(var h=n;0<h;){var p=31-P(h),w=1<<p;c[p]=-1,h&=~w}s!==0&&Te(t,s,n)}function vu(){return(vt&6)===0?(dl(0),!1):!0}function eg(){if(tt!==null){if(wt===0)var t=tt.return;else t=tt,or=Li=null,mh(t),_s=null,Ko=0,t=tt;for(;t!==null;)Wb(t.alternate,t),t=t.return;tt=null}}function $s(t,n){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,px(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),br=0,eg(),kt=t,tt=s=ir(t.current,null),at=n,wt=0,Wn=null,Yr=!1,Os=ze(t,n),Wh=!1,Ls=Yn=Yh=Bi=Xr=Bt=0,zn=cl=null,Xh=!1,(n&8)!==0&&(n|=n&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=n;0<c;){var h=31-P(c),p=1<<h;n|=t[h],c&=~p}return yr=n,Uc(),s}function bv(t,n){Je=null,Q.H=tl,n===Es||n===Wc?(n=$y(),wt=3):n===rh?(n=$y(),wt=4):wt=n===Lh?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Wn=n,tt===null&&(Bt=1,lu(t,ra(n,t.current)))}function vv(){var t=Fn.current;return t===null?!0:(at&4194048)===at?la===null:(at&62914560)===at||(at&536870912)!==0?t===la:!1}function Sv(){var t=Q.H;return Q.H=tl,t===null?tl:t}function wv(){var t=Q.A;return Q.A=KA,t}function Su(){Bt=4,Yr||(at&4194048)!==at&&Fn.current!==null||(Os=!0),(Xr&134217727)===0&&(Bi&134217727)===0||kt===null||Zr(kt,at,Yn,!1)}function tg(t,n,s){var c=vt;vt|=2;var h=Sv(),p=wv();(kt!==t||at!==n)&&(bu=null,$s(t,n)),n=!1;var w=Bt;e:do try{if(wt!==0&&tt!==null){var k=tt,z=Wn;switch(wt){case 8:eg(),w=6;break e;case 3:case 2:case 9:case 6:Fn.current===null&&(n=!0);var Y=wt;if(wt=0,Wn=null,Ns(t,k,z,Y),s&&Os){w=0;break e}break;default:Y=wt,wt=0,Wn=null,Ns(t,k,z,Y)}}XA(),w=Bt;break}catch(ae){bv(t,ae)}while(!0);return n&&t.shellSuspendCounter++,or=Li=null,vt=c,Q.H=h,Q.A=p,tt===null&&(kt=null,at=0,Uc()),w}function XA(){for(;tt!==null;)Cv(tt)}function JA(t,n){var s=vt;vt|=2;var c=Sv(),h=wv();kt!==t||at!==n?(bu=null,yu=Ft()+500,$s(t,n)):Os=ze(t,n);e:do try{if(wt!==0&&tt!==null){n=tt;var p=Wn;t:switch(wt){case 1:wt=0,Wn=null,Ns(t,n,p,1);break;case 2:case 9:if(Ly(p)){wt=0,Wn=null,Ev(n);break}n=function(){wt!==2&&wt!==9||kt!==t||(wt=7),Fa(t)},p.then(n,n);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:Ly(p)?(wt=0,Wn=null,Ev(n)):(wt=0,Wn=null,Ns(t,n,p,7));break;case 5:var w=null;switch(tt.tag){case 26:w=tt.memoizedState;case 5:case 27:var k=tt;if(w?lS(w):k.stateNode.complete){wt=0,Wn=null;var z=k.sibling;if(z!==null)tt=z;else{var Y=k.return;Y!==null?(tt=Y,wu(Y)):tt=null}break t}}wt=0,Wn=null,Ns(t,n,p,5);break;case 6:wt=0,Wn=null,Ns(t,n,p,6);break;case 8:eg(),Bt=6;break e;default:throw Error(r(462))}}QA();break}catch(ae){bv(t,ae)}while(!0);return or=Li=null,Q.H=c,Q.A=h,vt=s,tt!==null?0:(kt=null,at=0,Uc(),Bt)}function QA(){for(;tt!==null&&!ea();)Cv(tt)}function Cv(t){var n=Fb(t.alternate,t,yr);t.memoizedProps=t.pendingProps,n===null?wu(t):tt=n}function Ev(t){var n=t,s=n.alternate;switch(n.tag){case 15:case 0:n=Ub(s,n,n.pendingProps,n.type,void 0,at);break;case 11:n=Ub(s,n,n.pendingProps,n.type.render,n.ref,at);break;case 5:mh(n);default:Wb(s,n),n=tt=wy(n,yr),n=Fb(s,n,yr)}t.memoizedProps=t.pendingProps,n===null?wu(t):tt=n}function Ns(t,n,s,c){or=Li=null,mh(n),_s=null,Ko=0;var h=n.return;try{if(UA(t,h,n,s,at)){Bt=1,lu(t,ra(s,t.current)),tt=null;return}}catch(p){if(h!==null)throw tt=h,p;Bt=1,lu(t,ra(s,t.current)),tt=null;return}n.flags&32768?(lt||c===1?t=!0:Os||(at&536870912)!==0?t=!1:(Yr=t=!0,(c===2||c===9||c===3||c===6)&&(c=Fn.current,c!==null&&c.tag===13&&(c.flags|=16384))),_v(n,t)):wu(n)}function wu(t){var n=t;do{if((n.flags&32768)!==0){_v(n,Yr);return}t=n.return;var s=PA(n.alternate,n,yr);if(s!==null){tt=s;return}if(n=n.sibling,n!==null){tt=n;return}tt=n=t}while(n!==null);Bt===0&&(Bt=5)}function _v(t,n){do{var s=GA(t.alternate,t);if(s!==null){s.flags&=32767,tt=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!n&&(t=t.sibling,t!==null)){tt=t;return}tt=t=s}while(t!==null);Bt=6,tt=null}function Av(t,n,s,c,h,p,w,k,z){t.cancelPendingCommit=null;do Cu();while(sn!==0);if((vt&6)!==0)throw Error(r(327));if(n!==null){if(n===t.current)throw Error(r(177));if(p=n.lanes|n.childLanes,p|=Pf,_e(t,s,p,w,k,z),t===kt&&(tt=kt=null,at=0),Ms=n,Qr=t,br=s,Jh=p,Qh=h,gv=c,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,nx(en,function(){return Dv(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||c){c=Q.T,Q.T=null,h=fe.p,fe.p=2,w=vt,vt|=4;try{VA(t,n,s)}finally{vt=w,fe.p=h,Q.T=c}}sn=1,xv(),Tv(),Rv()}}function xv(){if(sn===1){sn=0;var t=Qr,n=Ms,s=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||s){s=Q.T,Q.T=null;var c=fe.p;fe.p=2;var h=vt;vt|=4;try{sv(n,t);var p=hg,w=fy(t.containerInfo),k=p.focusedElem,z=p.selectionRange;if(w!==k&&k&&k.ownerDocument&&dy(k.ownerDocument.documentElement,k)){if(z!==null&&zf(k)){var Y=z.start,ae=z.end;if(ae===void 0&&(ae=Y),"selectionStart"in k)k.selectionStart=Y,k.selectionEnd=Math.min(ae,k.value.length);else{var ue=k.ownerDocument||document,J=ue&&ue.defaultView||window;if(J.getSelection){var ee=J.getSelection(),De=k.textContent.length,Ge=Math.min(z.start,De),Tt=z.end===void 0?Ge:Math.min(z.end,De);!ee.extend&&Ge>Tt&&(w=Tt,Tt=Ge,Ge=w);var V=uy(k,Ge),G=uy(k,Tt);if(V&&G&&(ee.rangeCount!==1||ee.anchorNode!==V.node||ee.anchorOffset!==V.offset||ee.focusNode!==G.node||ee.focusOffset!==G.offset)){var W=ue.createRange();W.setStart(V.node,V.offset),ee.removeAllRanges(),Ge>Tt?(ee.addRange(W),ee.extend(G.node,G.offset)):(W.setEnd(G.node,G.offset),ee.addRange(W))}}}}for(ue=[],ee=k;ee=ee.parentNode;)ee.nodeType===1&&ue.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<ue.length;k++){var oe=ue[k];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}$u=!!fg,hg=fg=null}finally{vt=h,fe.p=c,Q.T=s}}t.current=n,sn=2}}function Tv(){if(sn===2){sn=0;var t=Qr,n=Ms,s=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||s){s=Q.T,Q.T=null;var c=fe.p;fe.p=2;var h=vt;vt|=4;try{tv(t,n.alternate,n)}finally{vt=h,fe.p=c,Q.T=s}}sn=3}}function Rv(){if(sn===4||sn===3){sn=0,ja();var t=Qr,n=Ms,s=br,c=gv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?sn=5:(sn=0,Ms=Qr=null,kv(t,t.pendingLanes));var h=t.pendingLanes;if(h===0&&(Jr=null),nn(s),n=n.stateNode,tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(Ea,n,void 0,(n.current.flags&128)===128)}catch{}if(c!==null){n=Q.T,h=fe.p,fe.p=2,Q.T=null;try{for(var p=t.onRecoverableError,w=0;w<c.length;w++){var k=c[w];p(k.value,{componentStack:k.stack})}}finally{Q.T=n,fe.p=h}}(br&3)!==0&&Cu(),Fa(t),h=t.pendingLanes,(s&261930)!==0&&(h&42)!==0?t===Zh?ul++:(ul=0,Zh=t):ul=0,dl(0)}}function kv(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,Vo(n)))}function Cu(){return xv(),Tv(),Rv(),Dv()}function Dv(){if(sn!==5)return!1;var t=Qr,n=Jh;Jh=0;var s=nn(br),c=Q.T,h=fe.p;try{fe.p=32>s?32:s,Q.T=null,s=Qh,Qh=null;var p=Qr,w=br;if(sn=0,Ms=Qr=null,br=0,(vt&6)!==0)throw Error(r(331));var k=vt;if(vt|=4,dv(p.current),lv(p,p.current,w,s),vt=k,dl(0,!1),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(Ea,p)}catch{}return!0}finally{fe.p=h,Q.T=c,kv(t,n)}}function Ov(t,n,s){n=ra(s,n),n=Oh(t.stateNode,n,2),t=Vr(t,n,2),t!==null&&(Fe(t,2),Fa(t))}function Ct(t,n,s){if(t.tag===3)Ov(t,t,s);else for(;n!==null;){if(n.tag===3){Ov(n,t,s);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Jr===null||!Jr.has(c))){t=ra(s,t),s=Lb(2),c=Vr(n,s,2),c!==null&&(Mb(s,c,n,t),Fe(c,2),Fa(c));break}}n=n.return}}function ng(t,n,s){var c=t.pingCache;if(c===null){c=t.pingCache=new WA;var h=new Set;c.set(n,h)}else h=c.get(n),h===void 0&&(h=new Set,c.set(n,h));h.has(s)||(Wh=!0,h.add(s),t=ZA.bind(null,t,n,s),n.then(t,t))}function ZA(t,n,s){var c=t.pingCache;c!==null&&c.delete(n),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,kt===t&&(at&s)===s&&(Bt===4||Bt===3&&(at&62914560)===at&&300>Ft()-mu?(vt&2)===0&&$s(t,0):Yh|=s,Ls===at&&(Ls=0)),Fa(t)}function Lv(t,n){n===0&&(n=ke()),t=ki(t,n),t!==null&&(Fe(t,n),Fa(t))}function ex(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),Lv(t,s)}function tx(t,n){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,h=t.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(n),Lv(t,s)}function nx(t,n){return jt(t,n)}var Eu=null,Is=null,ag=!1,_u=!1,rg=!1,ei=0;function Fa(t){t!==Is&&t.next===null&&(Is===null?Eu=Is=t:Is=Is.next=t),_u=!0,ag||(ag=!0,rx())}function dl(t,n){if(!rg&&_u){rg=!0;do for(var s=!1,c=Eu;c!==null;){if(t!==0){var h=c.pendingLanes;if(h===0)var p=0;else{var w=c.suspendedLanes,k=c.pingedLanes;p=(1<<31-P(42|t)+1)-1,p&=h&~(w&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(s=!0,Iv(c,p))}else p=at,p=je(c,c===kt?p:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(p&3)===0||ze(c,p)||(s=!0,Iv(c,p));c=c.next}while(s);rg=!1}}function ax(){Mv()}function Mv(){_u=ag=!1;var t=0;ei!==0&&gx()&&(t=ei);for(var n=Ft(),s=null,c=Eu;c!==null;){var h=c.next,p=$v(c,n);p===0?(c.next=null,s===null?Eu=h:s.next=h,h===null&&(Is=s)):(s=c,(t!==0||(p&3)!==0)&&(_u=!0)),c=h}sn!==0&&sn!==5||dl(t),ei!==0&&(ei=0)}function $v(t,n){for(var s=t.suspendedLanes,c=t.pingedLanes,h=t.expirationTimes,p=t.pendingLanes&-62914561;0<p;){var w=31-P(p),k=1<<w,z=h[w];z===-1?((k&s)===0||(k&c)!==0)&&(h[w]=Le(k,n)):z<=n&&(t.expiredLanes|=k),p&=~k}if(n=kt,s=at,s=je(t,t===n?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,s===0||t===n&&(wt===2||wt===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&On(c),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||ze(t,s)){if(n=s&-s,n===t.callbackPriority)return n;switch(c!==null&&On(c),nn(s)){case 2:case 8:s=bn;break;case 32:s=en;break;case 268435456:s=ta;break;default:s=en}return c=Nv.bind(null,t),s=jt(s,c),t.callbackPriority=n,t.callbackNode=s,n}return c!==null&&c!==null&&On(c),t.callbackPriority=2,t.callbackNode=null,2}function Nv(t,n){if(sn!==0&&sn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(Cu()&&t.callbackNode!==s)return null;var c=at;return c=je(t,t===kt?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(mv(t,c,n),$v(t,Ft()),t.callbackNode!=null&&t.callbackNode===s?Nv.bind(null,t):null)}function Iv(t,n){if(Cu())return null;mv(t,n,!0)}function rx(){mx(function(){(vt&6)!==0?jt(Za,ax):Mv()})}function ig(){if(ei===0){var t=ws;t===0&&(t=be,be<<=1,(be&261888)===0&&(be=256)),ei=t}return ei}function Hv(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:na(""+t)}function zv(t,n){var s=n.ownerDocument.createElement("input");return s.name=n.name,s.value=n.value,t.id&&s.setAttribute("form",t.id),n.parentNode.insertBefore(s,n),t=new FormData(t),s.parentNode.removeChild(s),t}function ix(t,n,s,c,h){if(n==="submit"&&s&&s.stateNode===h){var p=Hv((h[vn]||null).action),w=c.submitter;w&&(n=(n=w[vn]||null)?Hv(n.formAction):w.getAttribute("formAction"),n!==null&&(p=n,w=null));var k=new rr("action","action",null,c,h);t.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(ei!==0){var z=w?zv(h,w):new FormData(h);Ah(s,{pending:!0,data:z,method:h.method,action:p},null,z)}}else typeof p=="function"&&(k.preventDefault(),z=w?zv(h,w):new FormData(h),Ah(s,{pending:!0,data:z,method:h.method,action:p},p,z))},currentTarget:h}]})}}for(var sg=0;sg<qf.length;sg++){var og=qf[sg],sx=og.toLowerCase(),ox=og[0].toUpperCase()+og.slice(1);ka(sx,"on"+ox)}ka(py,"onAnimationEnd"),ka(my,"onAnimationIteration"),ka(yy,"onAnimationStart"),ka("dblclick","onDoubleClick"),ka("focusin","onFocus"),ka("focusout","onBlur"),ka(EA,"onTransitionRun"),ka(_A,"onTransitionStart"),ka(AA,"onTransitionCancel"),ka(by,"onTransitionEnd"),Lr("onMouseEnter",["mouseout","mouseover"]),Lr("onMouseLeave",["mouseout","mouseover"]),Lr("onPointerEnter",["pointerout","pointerover"]),Lr("onPointerLeave",["pointerout","pointerover"]),_a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),_a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),_a("onBeforeInput",["compositionend","keypress","textInput","paste"]),_a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),_a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),_a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),lx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fl));function jv(t,n){n=(n&4)!==0;for(var s=0;s<t.length;s++){var c=t[s],h=c.event;c=c.listeners;e:{var p=void 0;if(n)for(var w=c.length-1;0<=w;w--){var k=c[w],z=k.instance,Y=k.currentTarget;if(k=k.listener,z!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=Y;try{p(h)}catch(ae){jc(ae)}h.currentTarget=null,p=z}else for(w=0;w<c.length;w++){if(k=c[w],z=k.instance,Y=k.currentTarget,k=k.listener,z!==p&&h.isPropagationStopped())break e;p=k,h.currentTarget=Y;try{p(h)}catch(ae){jc(ae)}h.currentTarget=null,p=z}}}}function nt(t,n){var s=n[_o];s===void 0&&(s=n[_o]=new Set);var c=t+"__bubble";s.has(c)||(Uv(n,t,2,!1),s.add(c))}function lg(t,n,s){var c=0;n&&(c|=4),Uv(s,t,c,n)}var Au="_reactListening"+Math.random().toString(36).slice(2);function cg(t){if(!t[Au]){t[Au]=!0,mc.forEach(function(s){s!=="selectionchange"&&(lx.has(s)||lg(s,!1,t),lg(s,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Au]||(n[Au]=!0,lg("selectionchange",!1,n))}}function Uv(t,n,s,c){switch(pS(n)){case 2:var h=Ix;break;case 8:h=Hx;break;default:h=_g}s=h.bind(null,n,s,t),h=void 0,!Oo||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(h=!0),c?h!==void 0?t.addEventListener(n,s,{capture:!0,passive:h}):t.addEventListener(n,s,!0):h!==void 0?t.addEventListener(n,s,{passive:h}):t.addEventListener(n,s,!1)}function ug(t,n,s,c,h){var p=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var k=c.stateNode.containerInfo;if(k===h)break;if(w===4)for(w=c.return;w!==null;){var z=w.tag;if((z===3||z===4)&&w.stateNode.containerInfo===h)return;w=w.return}for(;k!==null;){if(w=Dr(k),w===null)return;if(z=w.tag,z===5||z===6||z===26||z===27){c=p=w;continue e}k=k.parentNode}}c=c.return}xc(function(){var Y=p,ae=Do(s),ue=[];e:{var J=vy.get(t);if(J!==void 0){var ee=rr,De=t;switch(t){case"keypress":if(Si(s)===0)break e;case"keydown":case"keyup":ee=Rf;break;case"focusin":De="focus",ee=No;break;case"focusout":De="blur",ee=No;break;case"beforeblur":case"afterblur":ee=No;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=kc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=oy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=Of;break;case py:case my:case yy:ee=wf;break;case by:ee=fs;break;case"scroll":case"scrollend":ee=bf;break;case"wheel":ee=_;break;case"copy":case"cut":case"paste":ee=Dc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Mc;break;case"toggle":case"beforetoggle":ee=C}var Ge=(n&4)!==0,Tt=!Ge&&(t==="scroll"||t==="scrollend"),V=Ge?J!==null?J+"Capture":null:J;Ge=[];for(var G=Y,W;G!==null;){var oe=G;if(W=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||W===null||V===null||(oe=bi(G,V),oe!=null&&Ge.push(hl(G,oe,W))),Tt)break;G=G.return}0<Ge.length&&(J=new ee(J,De,null,s,ae),ue.push({event:J,listeners:Ge}))}}if((n&7)===0){e:{if(J=t==="mouseover"||t==="pointerover",ee=t==="mouseout"||t==="pointerout",J&&s!==ko&&(De=s.relatedTarget||s.fromElement)&&(Dr(De)||De[kr]))break e;if((ee||J)&&(J=ae.window===ae?ae:(J=ae.ownerDocument)?J.defaultView||J.parentWindow:window,ee?(De=s.relatedTarget||s.toElement,ee=Y,De=De?Dr(De):null,De!==null&&(Tt=l(De),Ge=De.tag,De!==Tt||Ge!==5&&Ge!==27&&Ge!==6)&&(De=null)):(ee=null,De=Y),ee!==De)){if(Ge=kc,oe="onMouseLeave",V="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Ge=Mc,oe="onPointerLeave",V="onPointerEnter",G="pointer"),Tt=ee==null?J:tr(ee),W=De==null?J:tr(De),J=new Ge(oe,G+"leave",ee,s,ae),J.target=Tt,J.relatedTarget=W,oe=null,Dr(ae)===Y&&(Ge=new Ge(V,G+"enter",De,s,ae),Ge.target=W,Ge.relatedTarget=Tt,oe=Ge),Tt=oe,ee&&De)t:{for(Ge=cx,V=ee,G=De,W=0,oe=V;oe;oe=Ge(oe))W++;oe=0;for(var Pe=G;Pe;Pe=Ge(Pe))oe++;for(;0<W-oe;)V=Ge(V),W--;for(;0<oe-W;)G=Ge(G),oe--;for(;W--;){if(V===G||G!==null&&V===G.alternate){Ge=V;break t}V=Ge(V),G=Ge(G)}Ge=null}else Ge=null;ee!==null&&Bv(ue,J,ee,Ge,!1),De!==null&&Tt!==null&&Bv(ue,Tt,De,Ge,!0)}}e:{if(J=Y?tr(Y):window,ee=J.nodeName&&J.nodeName.toLowerCase(),ee==="select"||ee==="input"&&J.type==="file")var mt=zo;else if(Ho(J))if(jo)mt=SA;else{mt=Hf;var Ie=If}else ee=J.nodeName,!ee||ee.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Y&&To(Y.elementType)&&(mt=zo):mt=zc;if(mt&&(mt=mt(t,Y))){Nc(ue,mt,s,ae);break e}Ie&&Ie(t,J,Y),t==="focusout"&&Y&&J.type==="number"&&Y.memoizedProps.value!=null&&nr(J,"number",J.value)}switch(Ie=Y?tr(Y):window,t){case"focusin":(Ho(Ie)||Ie.contentEditable==="true")&&(hs=Ie,jf=Y,qo=null);break;case"focusout":qo=jf=hs=null;break;case"mousedown":Uf=!0;break;case"contextmenu":case"mouseup":case"dragend":Uf=!1,hy(ue,s,ae);break;case"selectionchange":if(CA)break;case"keydown":case"keyup":hy(ue,s,ae)}var Qe;if(I)e:{switch(t){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else Ra?pt(t,s)&&(rt="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(rt="onCompositionStart");rt&&(Me&&s.locale!=="ko"&&(Ra||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&Ra&&(Qe=Tc()):(qa=ae,Lo="value"in qa?qa.value:qa.textContent,Ra=!0)),Ie=xu(Y,rt),0<Ie.length&&(rt=new Oc(rt,t,null,s,ae),ue.push({event:rt,listeners:Ie}),Qe?rt.data=Qe:(Qe=Nt(s),Qe!==null&&(rt.data=Qe)))),(Qe=pe?Mf(t,s):$c(t,s))&&(rt=xu(Y,"onBeforeInput"),0<rt.length&&(Ie=new Oc("onBeforeInput","beforeinput",null,s,ae),ue.push({event:Ie,listeners:rt}),Ie.data=Qe)),ix(ue,t,Y,s,ae)}jv(ue,n)})}function hl(t,n,s){return{instance:t,listener:n,currentTarget:s}}function xu(t,n){for(var s=n+"Capture",c=[];t!==null;){var h=t,p=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||p===null||(h=bi(t,s),h!=null&&c.unshift(hl(t,h,p)),h=bi(t,n),h!=null&&c.push(hl(t,h,p))),t.tag===3)return c;t=t.return}return[]}function cx(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Bv(t,n,s,c,h){for(var p=n._reactName,w=[];s!==null&&s!==c;){var k=s,z=k.alternate,Y=k.stateNode;if(k=k.tag,z!==null&&z===c)break;k!==5&&k!==26&&k!==27||Y===null||(z=Y,h?(Y=bi(s,p),Y!=null&&w.unshift(hl(s,Y,z))):h||(Y=bi(s,p),Y!=null&&w.push(hl(s,Y,z)))),s=s.return}w.length!==0&&t.push({event:n,listeners:w})}var ux=/\r\n?/g,dx=/\u0000|\uFFFD/g;function qv(t){return(typeof t=="string"?t:""+t).replace(ux,`
`).replace(dx,"")}function Pv(t,n){return n=qv(n),qv(t)===n}function xt(t,n,s,c,h,p){switch(s){case"children":typeof c=="string"?n==="body"||n==="textarea"&&c===""||Ir(t,c):(typeof c=="number"||typeof c=="bigint")&&n!=="body"&&Ir(t,""+c);break;case"className":mi(t,"class",c);break;case"tabIndex":mi(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":mi(t,s,c);break;case"style":_c(t,c,p);break;case"data":if(n!=="object"){mi(t,"data",c);break}case"src":case"href":if(c===""&&(n!=="a"||s!=="href")){t.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=na(""+c),t.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(s==="formAction"?(n!=="input"&&xt(t,n,"name",h.name,h,null),xt(t,n,"formEncType",h.formEncType,h,null),xt(t,n,"formMethod",h.formMethod,h,null),xt(t,n,"formTarget",h.formTarget,h,null)):(xt(t,n,"encType",h.encType,h,null),xt(t,n,"method",h.method,h,null),xt(t,n,"target",h.target,h,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=na(""+c),t.setAttribute(s,c);break;case"onClick":c!=null&&(t.onclick=Aa);break;case"onScroll":c!=null&&nt("scroll",t);break;case"onScrollEnd":c!=null&&nt("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(s=c.__html,s!=null){if(h.children!=null)throw Error(r(60));t.innerHTML=s}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}s=na(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""+c):t.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":c===!0?t.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,c):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(s,c):t.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(s):t.setAttribute(s,c);break;case"popover":nt("beforetoggle",t),nt("toggle",t),Mn(t,"popover",c);break;case"xlinkActuate":dn(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":dn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":dn(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":dn(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":dn(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":dn(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":dn(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":dn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":dn(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Mn(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=yf.get(s)||s,Mn(t,s,c))}}function dg(t,n,s,c,h,p){switch(s){case"style":_c(t,c,p);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(s=c.__html,s!=null){if(h.children!=null)throw Error(r(60));t.innerHTML=s}}break;case"children":typeof c=="string"?Ir(t,c):(typeof c=="number"||typeof c=="bigint")&&Ir(t,""+c);break;case"onScroll":c!=null&&nt("scroll",t);break;case"onScrollEnd":c!=null&&nt("scrollend",t);break;case"onClick":c!=null&&(t.onclick=Aa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yc.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(h=s.endsWith("Capture"),n=s.slice(2,h?s.length-7:void 0),p=t[vn]||null,p=p!=null?p[s]:null,typeof p=="function"&&t.removeEventListener(n,p,h),typeof c=="function")){typeof p!="function"&&p!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(n,c,h);break e}s in t?t[s]=c:c===!0?t.setAttribute(s,""):Mn(t,s,c)}}}function pn(t,n,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":nt("error",t),nt("load",t);var c=!1,h=!1,p;for(p in s)if(s.hasOwnProperty(p)){var w=s[p];if(w!=null)switch(p){case"src":c=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:xt(t,n,p,w,s,null)}}h&&xt(t,n,"srcSet",s.srcSet,s,null),c&&xt(t,n,"src",s.src,s,null);return;case"input":nt("invalid",t);var k=p=w=h=null,z=null,Y=null;for(c in s)if(s.hasOwnProperty(c)){var ae=s[c];if(ae!=null)switch(c){case"name":h=ae;break;case"type":w=ae;break;case"checked":z=ae;break;case"defaultChecked":Y=ae;break;case"value":p=ae;break;case"defaultValue":k=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,n));break;default:xt(t,n,c,ae,s,null)}}yi(t,p,k,z,Y,w,h,!1);return;case"select":nt("invalid",t),c=w=p=null;for(h in s)if(s.hasOwnProperty(h)&&(k=s[h],k!=null))switch(h){case"value":p=k;break;case"defaultValue":w=k;break;case"multiple":c=k;default:xt(t,n,h,k,s,null)}n=p,s=w,t.multiple=!!c,n!=null?$r(t,!!c,n,!1):s!=null&&$r(t,!!c,s,!0);return;case"textarea":nt("invalid",t),p=h=c=null;for(w in s)if(s.hasOwnProperty(w)&&(k=s[w],k!=null))switch(w){case"value":c=k;break;case"defaultValue":h=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:xt(t,n,w,k,s,null)}Cc(t,c,h,p);return;case"option":for(z in s)s.hasOwnProperty(z)&&(c=s[z],c!=null)&&(z==="selected"?t.selected=c&&typeof c!="function"&&typeof c!="symbol":xt(t,n,z,c,s,null));return;case"dialog":nt("beforetoggle",t),nt("toggle",t),nt("cancel",t),nt("close",t);break;case"iframe":case"object":nt("load",t);break;case"video":case"audio":for(c=0;c<fl.length;c++)nt(fl[c],t);break;case"image":nt("error",t),nt("load",t);break;case"details":nt("toggle",t);break;case"embed":case"source":case"link":nt("error",t),nt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in s)if(s.hasOwnProperty(Y)&&(c=s[Y],c!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:xt(t,n,Y,c,s,null)}return;default:if(To(n)){for(ae in s)s.hasOwnProperty(ae)&&(c=s[ae],c!==void 0&&dg(t,n,ae,c,s,void 0));return}}for(k in s)s.hasOwnProperty(k)&&(c=s[k],c!=null&&xt(t,n,k,c,s,null))}function fx(t,n,s,c){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,p=null,w=null,k=null,z=null,Y=null,ae=null;for(ee in s){var ue=s[ee];if(s.hasOwnProperty(ee)&&ue!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":z=ue;default:c.hasOwnProperty(ee)||xt(t,n,ee,null,c,ue)}}for(var J in c){var ee=c[J];if(ue=s[J],c.hasOwnProperty(J)&&(ee!=null||ue!=null))switch(J){case"type":p=ee;break;case"name":h=ee;break;case"checked":Y=ee;break;case"defaultChecked":ae=ee;break;case"value":w=ee;break;case"defaultValue":k=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,n));break;default:ee!==ue&&xt(t,n,J,ee,c,ue)}}os(t,w,k,z,Y,ae,p,h);return;case"select":ee=w=k=J=null;for(p in s)if(z=s[p],s.hasOwnProperty(p)&&z!=null)switch(p){case"value":break;case"multiple":ee=z;default:c.hasOwnProperty(p)||xt(t,n,p,null,c,z)}for(h in c)if(p=c[h],z=s[h],c.hasOwnProperty(h)&&(p!=null||z!=null))switch(h){case"value":J=p;break;case"defaultValue":k=p;break;case"multiple":w=p;default:p!==z&&xt(t,n,h,p,c,z)}n=k,s=w,c=ee,J!=null?$r(t,!!s,J,!1):!!c!=!!s&&(n!=null?$r(t,!!s,n,!0):$r(t,!!s,s?[]:"",!1));return;case"textarea":ee=J=null;for(k in s)if(h=s[k],s.hasOwnProperty(k)&&h!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:xt(t,n,k,null,c,h)}for(w in c)if(h=c[w],p=s[w],c.hasOwnProperty(w)&&(h!=null||p!=null))switch(w){case"value":J=h;break;case"defaultValue":ee=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(r(91));break;default:h!==p&&xt(t,n,w,h,c,p)}Nr(t,J,ee);return;case"option":for(var De in s)J=s[De],s.hasOwnProperty(De)&&J!=null&&!c.hasOwnProperty(De)&&(De==="selected"?t.selected=!1:xt(t,n,De,null,c,J));for(z in c)J=c[z],ee=s[z],c.hasOwnProperty(z)&&J!==ee&&(J!=null||ee!=null)&&(z==="selected"?t.selected=J&&typeof J!="function"&&typeof J!="symbol":xt(t,n,z,J,c,ee));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ge in s)J=s[Ge],s.hasOwnProperty(Ge)&&J!=null&&!c.hasOwnProperty(Ge)&&xt(t,n,Ge,null,c,J);for(Y in c)if(J=c[Y],ee=s[Y],c.hasOwnProperty(Y)&&J!==ee&&(J!=null||ee!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:xt(t,n,Y,J,c,ee)}return;default:if(To(n)){for(var Tt in s)J=s[Tt],s.hasOwnProperty(Tt)&&J!==void 0&&!c.hasOwnProperty(Tt)&&dg(t,n,Tt,void 0,c,J);for(ae in c)J=c[ae],ee=s[ae],!c.hasOwnProperty(ae)||J===ee||J===void 0&&ee===void 0||dg(t,n,ae,J,c,ee);return}}for(var V in s)J=s[V],s.hasOwnProperty(V)&&J!=null&&!c.hasOwnProperty(V)&&xt(t,n,V,null,c,J);for(ue in c)J=c[ue],ee=s[ue],!c.hasOwnProperty(ue)||J===ee||J==null&&ee==null||xt(t,n,ue,J,c,ee)}function Gv(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hx(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var h=s[c],p=h.transferSize,w=h.initiatorType,k=h.duration;if(p&&k&&Gv(w)){for(w=0,k=h.responseEnd,c+=1;c<s.length;c++){var z=s[c],Y=z.startTime;if(Y>k)break;var ae=z.transferSize,ue=z.initiatorType;ae&&Gv(ue)&&(z=z.responseEnd,w+=ae*(z<k?1:(k-Y)/(z-Y)))}if(--c,n+=8*(p+w)/(h.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var fg=null,hg=null;function Tu(t){return t.nodeType===9?t:t.ownerDocument}function Vv(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Fv(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function gg(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var pg=null;function gx(){var t=window.event;return t&&t.type==="popstate"?t===pg?!1:(pg=t,!0):(pg=null,!1)}var Kv=typeof setTimeout=="function"?setTimeout:void 0,px=typeof clearTimeout=="function"?clearTimeout:void 0,Wv=typeof Promise=="function"?Promise:void 0,mx=typeof queueMicrotask=="function"?queueMicrotask:typeof Wv<"u"?function(t){return Wv.resolve(null).then(t).catch(yx)}:Kv;function yx(t){setTimeout(function(){throw t})}function ti(t){return t==="head"}function Yv(t,n){var s=n,c=0;do{var h=s.nextSibling;if(t.removeChild(s),h&&h.nodeType===8)if(s=h.data,s==="/$"||s==="/&"){if(c===0){t.removeChild(h),Us(n);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")gl(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,gl(s);for(var p=s.firstChild;p;){var w=p.nextSibling,k=p.nodeName;p[pi]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||s.removeChild(p),p=w}}else s==="body"&&gl(t.ownerDocument.body);s=h}while(s);Us(n)}function Xv(t,n){var s=t;t=0;do{var c=s.nextSibling;if(s.nodeType===1?n?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(n?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=c}while(s)}function mg(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var s=n;switch(n=n.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":mg(s),Ao(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function bx(t,n,s,c){for(;t.nodeType===1;){var h=s;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[pi])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(p=t.getAttribute("rel"),p==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(p!==h.rel||t.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||t.getAttribute("title")!==(h.title==null?null:h.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(p=t.getAttribute("src"),(p!==(h.src==null?null:h.src)||t.getAttribute("type")!==(h.type==null?null:h.type)||t.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&p&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var p=h.name==null?null:""+h.name;if(h.type==="hidden"&&t.getAttribute("name")===p)return t}else return t;if(t=ca(t.nextSibling),t===null)break}return null}function vx(t,n,s){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=ca(t.nextSibling),t===null))return null;return t}function Jv(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=ca(t.nextSibling),t===null))return null;return t}function yg(t){return t.data==="$?"||t.data==="$~"}function bg(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Sx(t,n){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||s.readyState!=="loading")n();else{var c=function(){n(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function ca(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var vg=null;function Qv(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(n===0)return ca(t.nextSibling);n--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||n++}t=t.nextSibling}return null}function Zv(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(n===0)return t;n--}else s!=="/$"&&s!=="/&"||n++}t=t.previousSibling}return null}function eS(t,n,s){switch(n=Tu(s),t){case"html":if(t=n.documentElement,!t)throw Error(r(452));return t;case"head":if(t=n.head,!t)throw Error(r(453));return t;case"body":if(t=n.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function gl(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Ao(t)}var ua=new Map,tS=new Set;function Ru(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var vr=fe.d;fe.d={f:wx,r:Cx,D:Ex,C:_x,L:Ax,m:xx,X:Rx,S:Tx,M:kx};function wx(){var t=vr.f(),n=vu();return t||n}function Cx(t){var n=Ba(t);n!==null&&n.tag===5&&n.type==="form"?bb(n):vr.r(t)}var Hs=typeof document>"u"?null:document;function nS(t,n,s){var c=Hs;if(c&&typeof n=="string"&&n){var h=$n(n);h='link[rel="'+t+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),tS.has(h)||(tS.add(h),t={rel:t,crossOrigin:s,href:n},c.querySelector(h)===null&&(n=c.createElement("link"),pn(n,"link",t),Wt(n),c.head.appendChild(n)))}}function Ex(t){vr.D(t),nS("dns-prefetch",t,null)}function _x(t,n){vr.C(t,n),nS("preconnect",t,n)}function Ax(t,n,s){vr.L(t,n,s);var c=Hs;if(c&&t&&n){var h='link[rel="preload"][as="'+$n(n)+'"]';n==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+$n(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+$n(s.imageSizes)+'"]')):h+='[href="'+$n(t)+'"]';var p=h;switch(n){case"style":p=zs(t);break;case"script":p=js(t)}ua.has(p)||(t=b({rel:"preload",href:n==="image"&&s&&s.imageSrcSet?void 0:t,as:n},s),ua.set(p,t),c.querySelector(h)!==null||n==="style"&&c.querySelector(pl(p))||n==="script"&&c.querySelector(ml(p))||(n=c.createElement("link"),pn(n,"link",t),Wt(n),c.head.appendChild(n)))}}function xx(t,n){vr.m(t,n);var s=Hs;if(s&&t){var c=n&&typeof n.as=="string"?n.as:"script",h='link[rel="modulepreload"][as="'+$n(c)+'"][href="'+$n(t)+'"]',p=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=js(t)}if(!ua.has(p)&&(t=b({rel:"modulepreload",href:t},n),ua.set(p,t),s.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(ml(p)))return}c=s.createElement("link"),pn(c,"link",t),Wt(c),s.head.appendChild(c)}}}function Tx(t,n,s){vr.S(t,n,s);var c=Hs;if(c&&t){var h=Or(c).hoistableStyles,p=zs(t);n=n||"default";var w=h.get(p);if(!w){var k={loading:0,preload:null};if(w=c.querySelector(pl(p)))k.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":n},s),(s=ua.get(p))&&Sg(t,s);var z=w=c.createElement("link");Wt(z),pn(z,"link",t),z._p=new Promise(function(Y,ae){z.onload=Y,z.onerror=ae}),z.addEventListener("load",function(){k.loading|=1}),z.addEventListener("error",function(){k.loading|=2}),k.loading|=4,ku(w,n,c)}w={type:"stylesheet",instance:w,count:1,state:k},h.set(p,w)}}}function Rx(t,n){vr.X(t,n);var s=Hs;if(s&&t){var c=Or(s).hoistableScripts,h=js(t),p=c.get(h);p||(p=s.querySelector(ml(h)),p||(t=b({src:t,async:!0},n),(n=ua.get(h))&&wg(t,n),p=s.createElement("script"),Wt(p),pn(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function kx(t,n){vr.M(t,n);var s=Hs;if(s&&t){var c=Or(s).hoistableScripts,h=js(t),p=c.get(h);p||(p=s.querySelector(ml(h)),p||(t=b({src:t,async:!0,type:"module"},n),(n=ua.get(h))&&wg(t,n),p=s.createElement("script"),Wt(p),pn(p,"link",t),s.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},c.set(h,p))}}function aS(t,n,s,c){var h=(h=me.current)?Ru(h):null;if(!h)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(n=zs(s.href),s=Or(h).hoistableStyles,c=s.get(n),c||(c={type:"style",instance:null,count:0,state:null},s.set(n,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=zs(s.href);var p=Or(h).hoistableStyles,w=p.get(t);if(w||(h=h.ownerDocument||h,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(t,w),(p=h.querySelector(pl(t)))&&!p._p&&(w.instance=p,w.state.loading=5),ua.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ua.set(t,s),p||Dx(h,t,s,w.state))),n&&c===null)throw Error(r(528,""));return w}if(n&&c!==null)throw Error(r(529,""));return null;case"script":return n=s.async,s=s.src,typeof s=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=js(s),s=Or(h).hoistableScripts,c=s.get(n),c||(c={type:"script",instance:null,count:0,state:null},s.set(n,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function zs(t){return'href="'+$n(t)+'"'}function pl(t){return'link[rel="stylesheet"]['+t+"]"}function rS(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function Dx(t,n,s,c){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?c.loading=1:(n=t.createElement("link"),c.preload=n,n.addEventListener("load",function(){return c.loading|=1}),n.addEventListener("error",function(){return c.loading|=2}),pn(n,"link",s),Wt(n),t.head.appendChild(n))}function js(t){return'[src="'+$n(t)+'"]'}function ml(t){return"script[async]"+t}function iS(t,n,s){if(n.count++,n.instance===null)switch(n.type){case"style":var c=t.querySelector('style[data-href~="'+$n(s.href)+'"]');if(c)return n.instance=c,Wt(c),c;var h=b({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Wt(c),pn(c,"style",h),ku(c,s.precedence,t),n.instance=c;case"stylesheet":h=zs(s.href);var p=t.querySelector(pl(h));if(p)return n.state.loading|=4,n.instance=p,Wt(p),p;c=rS(s),(h=ua.get(h))&&Sg(c,h),p=(t.ownerDocument||t).createElement("link"),Wt(p);var w=p;return w._p=new Promise(function(k,z){w.onload=k,w.onerror=z}),pn(p,"link",c),n.state.loading|=4,ku(p,s.precedence,t),n.instance=p;case"script":return p=js(s.src),(h=t.querySelector(ml(p)))?(n.instance=h,Wt(h),h):(c=s,(h=ua.get(p))&&(c=b({},s),wg(c,h)),t=t.ownerDocument||t,h=t.createElement("script"),Wt(h),pn(h,"link",c),t.head.appendChild(h),n.instance=h);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(c=n.instance,n.state.loading|=4,ku(c,s.precedence,t));return n.instance}function ku(t,n,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,p=h,w=0;w<c.length;w++){var k=c[w];if(k.dataset.precedence===n)p=k;else if(p!==h)break}p?p.parentNode.insertBefore(t,p.nextSibling):(n=s.nodeType===9?s.head:s,n.insertBefore(t,n.firstChild))}function Sg(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function wg(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Du=null;function sS(t,n,s){if(Du===null){var c=new Map,h=Du=new Map;h.set(s,c)}else h=Du,c=h.get(s),c||(c=new Map,h.set(s,c));if(c.has(t))return c;for(c.set(t,null),s=s.getElementsByTagName(t),h=0;h<s.length;h++){var p=s[h];if(!(p[pi]||p[an]||t==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var w=p.getAttribute(n)||"";w=t+w;var k=c.get(w);k?k.push(p):c.set(w,[p])}}return c}function oS(t,n,s){t=t.ownerDocument||t,t.head.insertBefore(s,n==="title"?t.querySelector("head > title"):null)}function Ox(t,n,s){if(s===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function lS(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Lx(t,n,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=zs(c.href),p=n.querySelector(pl(h));if(p){n=p._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Ou.bind(t),n.then(t,t)),s.state.loading|=4,s.instance=p,Wt(p);return}p=n.ownerDocument||n,c=rS(c),(h=ua.get(h))&&Sg(c,h),p=p.createElement("link"),Wt(p);var w=p;w._p=new Promise(function(k,z){w.onload=k,w.onerror=z}),pn(p,"link",c),s.instance=p}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,n),(n=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=Ou.bind(t),n.addEventListener("load",s),n.addEventListener("error",s))}}var Cg=0;function Mx(t,n){return t.stylesheets&&t.count===0&&Mu(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var c=setTimeout(function(){if(t.stylesheets&&Mu(t,t.stylesheets),t.unsuspend){var p=t.unsuspend;t.unsuspend=null,p()}},6e4+n);0<t.imgBytes&&Cg===0&&(Cg=62500*hx());var h=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Mu(t,t.stylesheets),t.unsuspend)){var p=t.unsuspend;t.unsuspend=null,p()}},(t.imgBytes>Cg?50:800)+n);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Ou(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Lu=null;function Mu(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Lu=new Map,n.forEach($x,t),Lu=null,Ou.call(t))}function $x(t,n){if(!(n.state.loading&4)){var s=Lu.get(t);if(s)var c=s.get(null);else{s=new Map,Lu.set(t,s);for(var h=t.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<h.length;p++){var w=h[p];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(s.set(w.dataset.precedence,w),c=w)}c&&s.set(null,c)}h=n.instance,w=h.getAttribute("data-precedence"),p=s.get(w)||c,p===c&&s.set(null,h),s.set(w,h),this.count++,c=Ou.bind(this),h.addEventListener("load",c),h.addEventListener("error",c),p?p.parentNode.insertBefore(h,p.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(h,t.firstChild)),n.state.loading|=4}}var yl={$$typeof:R,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function Nx(t,n,s,c,h,p,w,k,z){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=We(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=We(0),this.hiddenUpdates=We(null),this.identifierPrefix=c,this.onUncaughtError=h,this.onCaughtError=p,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=z,this.incompleteTransitions=new Map}function cS(t,n,s,c,h,p,w,k,z,Y,ae,ue){return t=new Nx(t,n,s,w,z,Y,ae,ue,k),n=1,p===!0&&(n|=24),p=Vn(3,null,null,n),t.current=p,p.stateNode=t,n=th(),n.refCount++,t.pooledCache=n,n.refCount++,p.memoizedState={element:c,isDehydrated:s,cache:n},ih(p),t}function uS(t){return t?(t=ms,t):ms}function dS(t,n,s,c,h,p){h=uS(h),c.context===null?c.context=h:c.pendingContext=h,c=Gr(n),c.payload={element:s},p=p===void 0?null:p,p!==null&&(c.callback=p),s=Vr(t,c,n),s!==null&&(jn(s,t,n),Yo(s,t,n))}function fS(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<n?s:n}}function Eg(t,n){fS(t,n),(t=t.alternate)&&fS(t,n)}function hS(t){if(t.tag===13||t.tag===31){var n=ki(t,67108864);n!==null&&jn(n,t,67108864),Eg(t,67108864)}}function gS(t){if(t.tag===13||t.tag===31){var n=Xn();n=Dt(n);var s=ki(t,n);s!==null&&jn(s,t,n),Eg(t,n)}}var $u=!0;function Ix(t,n,s,c){var h=Q.T;Q.T=null;var p=fe.p;try{fe.p=2,_g(t,n,s,c)}finally{fe.p=p,Q.T=h}}function Hx(t,n,s,c){var h=Q.T;Q.T=null;var p=fe.p;try{fe.p=8,_g(t,n,s,c)}finally{fe.p=p,Q.T=h}}function _g(t,n,s,c){if($u){var h=Ag(c);if(h===null)ug(t,n,c,Nu,s),mS(t,c);else if(jx(h,t,n,s,c))c.stopPropagation();else if(mS(t,c),n&4&&-1<zx.indexOf(t)){for(;h!==null;){var p=Ba(h);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var w=xe(p.pendingLanes);if(w!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;w;){var z=1<<31-P(w);k.entanglements[1]|=z,w&=~z}Fa(p),(vt&6)===0&&(yu=Ft()+500,dl(0))}}break;case 31:case 13:k=ki(p,2),k!==null&&jn(k,p,2),vu(),Eg(p,2)}if(p=Ag(c),p===null&&ug(t,n,c,Nu,s),p===h)break;h=p}h!==null&&c.stopPropagation()}else ug(t,n,c,null,s)}}function Ag(t){return t=Do(t),xg(t)}var Nu=null;function xg(t){if(Nu=null,t=Dr(t),t!==null){var n=l(t);if(n===null)t=null;else{var s=n.tag;if(s===13){if(t=u(n),t!==null)return t;t=null}else if(s===31){if(t=d(n),t!==null)return t;t=null}else if(s===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return Nu=t,null}function pS(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Rr()){case Za:return 2;case bn:return 8;case en:case et:return 32;case ta:return 268435456;default:return 32}default:return 32}}var Tg=!1,ni=null,ai=null,ri=null,bl=new Map,vl=new Map,ii=[],zx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function mS(t,n){switch(t){case"focusin":case"focusout":ni=null;break;case"dragenter":case"dragleave":ai=null;break;case"mouseover":case"mouseout":ri=null;break;case"pointerover":case"pointerout":bl.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":vl.delete(n.pointerId)}}function Sl(t,n,s,c,h,p){return t===null||t.nativeEvent!==p?(t={blockedOn:n,domEventName:s,eventSystemFlags:c,nativeEvent:p,targetContainers:[h]},n!==null&&(n=Ba(n),n!==null&&hS(n)),t):(t.eventSystemFlags|=c,n=t.targetContainers,h!==null&&n.indexOf(h)===-1&&n.push(h),t)}function jx(t,n,s,c,h){switch(n){case"focusin":return ni=Sl(ni,t,n,s,c,h),!0;case"dragenter":return ai=Sl(ai,t,n,s,c,h),!0;case"mouseover":return ri=Sl(ri,t,n,s,c,h),!0;case"pointerover":var p=h.pointerId;return bl.set(p,Sl(bl.get(p)||null,t,n,s,c,h)),!0;case"gotpointercapture":return p=h.pointerId,vl.set(p,Sl(vl.get(p)||null,t,n,s,c,h)),!0}return!1}function yS(t){var n=Dr(t.target);if(n!==null){var s=l(n);if(s!==null){if(n=s.tag,n===13){if(n=u(s),n!==null){t.blockedOn=n,Pn(t.priority,function(){gS(s)});return}}else if(n===31){if(n=d(s),n!==null){t.blockedOn=n,Pn(t.priority,function(){gS(s)});return}}else if(n===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Iu(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var s=Ag(t.nativeEvent);if(s===null){s=t.nativeEvent;var c=new s.constructor(s.type,s);ko=c,s.target.dispatchEvent(c),ko=null}else return n=Ba(s),n!==null&&hS(n),t.blockedOn=s,!1;n.shift()}return!0}function bS(t,n,s){Iu(t)&&s.delete(n)}function Ux(){Tg=!1,ni!==null&&Iu(ni)&&(ni=null),ai!==null&&Iu(ai)&&(ai=null),ri!==null&&Iu(ri)&&(ri=null),bl.forEach(bS),vl.forEach(bS)}function Hu(t,n){t.blockedOn===n&&(t.blockedOn=null,Tg||(Tg=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,Ux)))}var zu=null;function vS(t){zu!==t&&(zu=t,o.unstable_scheduleCallback(o.unstable_NormalPriority,function(){zu===t&&(zu=null);for(var n=0;n<t.length;n+=3){var s=t[n],c=t[n+1],h=t[n+2];if(typeof c!="function"){if(xg(c||s)===null)continue;break}var p=Ba(s);p!==null&&(t.splice(n,3),n-=3,Ah(p,{pending:!0,data:h,method:s.method,action:c},c,h))}}))}function Us(t){function n(z){return Hu(z,t)}ni!==null&&Hu(ni,t),ai!==null&&Hu(ai,t),ri!==null&&Hu(ri,t),bl.forEach(n),vl.forEach(n);for(var s=0;s<ii.length;s++){var c=ii[s];c.blockedOn===t&&(c.blockedOn=null)}for(;0<ii.length&&(s=ii[0],s.blockedOn===null);)yS(s),s.blockedOn===null&&ii.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var h=s[c],p=s[c+1],w=h[vn]||null;if(typeof p=="function")w||vS(s);else if(w){var k=null;if(p&&p.hasAttribute("formAction")){if(h=p,w=p[vn]||null)k=w.formAction;else if(xg(h)!==null)continue}else k=w.action;typeof k=="function"?s[c+1]=k:(s.splice(c,3),c-=3),vS(s)}}}function SS(){function t(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(w){return h=w})},focusReset:"manual",scroll:"manual"})}function n(){h!==null&&(h(),h=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,h=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),h!==null&&(h(),h=null)}}}function Rg(t){this._internalRoot=t}ju.prototype.render=Rg.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(r(409));var s=n.current,c=Xn();dS(s,c,t,n,null,null)},ju.prototype.unmount=Rg.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;dS(t.current,2,null,t,null,null),vu(),n[kr]=null}};function ju(t){this._internalRoot=t}ju.prototype.unstable_scheduleHydration=function(t){if(t){var n=Kt();t={blockedOn:null,target:t,priority:n};for(var s=0;s<ii.length&&n!==0&&n<ii[s].priority;s++);ii.splice(s,0,t),s===0&&yS(t)}};var wS=e.version;if(wS!=="19.2.6")throw Error(r(527,wS,"19.2.6"));fe.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=g(n),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var Bx={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:Q,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Uu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uu.isDisabled&&Uu.supportsFiber)try{Ea=Uu.inject(Bx),tn=Uu}catch{}}return Bs.createRoot=function(t,n){if(!i(t))throw Error(r(299));var s=!1,c="",h=Rb,p=kb,w=Db;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(h=n.onUncaughtError),n.onCaughtError!==void 0&&(p=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=cS(t,1,!1,null,null,s,c,null,h,p,w,SS),t[kr]=n.current,cg(t),new Rg(n)},Bs.hydrateRoot=function(t,n,s){if(!i(t))throw Error(r(299));var c=!1,h="",p=Rb,w=kb,k=Db,z=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(h=s.identifierPrefix),s.onUncaughtError!==void 0&&(p=s.onUncaughtError),s.onCaughtError!==void 0&&(w=s.onCaughtError),s.onRecoverableError!==void 0&&(k=s.onRecoverableError),s.formState!==void 0&&(z=s.formState)),n=cS(t,1,!0,n,s??null,c,h,z,p,w,k,SS),n.context=uS(null),s=n.current,c=Xn(),c=Dt(c),h=Gr(c),h.callback=null,Vr(s,h,c),s=c,n.current.lanes=s,Fe(n,s),Fa(n),t[kr]=n.current,cg(t),new ju(n)},Bs.version="19.2.6",Bs}var Hg;function DS(){if(Hg)return Pu.exports;Hg=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(e){console.error(e)}}return o(),Pu.exports=kS(),Pu.exports}var Ku=DS();const Wu=Wa(Ku),qs=[],OS=50;let Yu=!1;function zg(){try{return window.G7Core?.devTools}catch{return}}function qi(o,e,a){const r=zg();if(Yu&&r?.isEnabled?.()){r.trackLog?.(o,e,a);return}Yu||(o==="error"||o==="warn")&&qs.length<OS&&qs.push({level:o,prefix:e,args:a,timestamp:Date.now()})}function Xu(){Yu=!0;const o=zg();if(!o?.isEnabled?.()){qs.length=0;return}for(const e of qs)o.trackLog?.(e.level,e.prefix,e.args);qs.length=0}const fi=class fi{constructor(){$(this,"debug");$(this,"prefix","[TemplateEngine]");this.debug=!1}static getInstance(){return fi.instance||(fi.instance=new fi),fi.instance}setDebug(e){this.debug=e}isDebugEnabled(){return this.debug}log(...e){this.debug&&console.log(this.prefix,...e),qi("log","TemplateEngine",e)}error(...e){this.debug&&console.error(this.prefix,...e),qi("error","TemplateEngine",e)}warn(...e){this.debug&&console.warn(this.prefix,...e),qi("warn","TemplateEngine",e)}};$(fi,"instance");let Ps=fi;function ct(o){const e=`[${o}]`,a=Ps.getInstance();return{log:(...r)=>{a.isDebugEnabled()&&console.log(e,...r),qi("log",o,r)},warn:(...r)=>{a.isDebugEnabled()&&console.warn(e,...r),qi("warn",o,r)},error:(...r)=>{a.isDebugEnabled()&&console.error(e,...r),qi("error",o,r)}}}Ps.getInstance();const Pi=ct("networkResilience"),jg=2,Ug=300,Bg=2e3,LS=15e3;function qg(o){return o?.name==="AbortError"}function MS(o){return qg(o)?!1:o instanceof TypeError}let wl=!1,Pg=!1;function Ju(){return wl}function $S(){typeof window>"u"||Pg||(Pg=!0,window.addEventListener("pagehide",()=>{wl=!0}),window.addEventListener("pageshow",o=>{o.persisted&&(wl=!1)}),window.addEventListener("beforeunload",()=>{wl=!0}))}function Gg(o,e,a){const r=Math.min(e*Math.pow(2,o),a),i=r*.25*(Math.random()*2-1);return Math.max(0,Math.round(r+i))}function Vg(o){return new Promise(e=>setTimeout(e,o))}async function Cl(o,e={}){const{retries:a=jg,baseDelayMs:r=Ug,maxDelayMs:i=Bg,timeoutMs:l=LS,label:u=o,init:d}=e,f=a+1;let g;for(let m=0;m<f;m++){let b=!1,v;const S=l>0?new AbortController:null;try{const E={...d};if(S){const T=d?.signal;T&&(T.aborted?S.abort():T.addEventListener("abort",()=>S.abort(),{once:!0})),E.signal=S.signal,v=setTimeout(()=>{b=!0,S.abort()},l)}return await fetch(o,E)}catch(E){if(g=E,qg(E)&&!b||!(b||MS(E)))throw E;if(Ju())throw Pi.warn(`Document unloading, aborting retries: ${u}`),E;if(m===f-1)throw Pi.warn(`All ${f} attempts failed: ${u}`,E),E;const L=Gg(m,r,i);Pi.warn(`Network failure (attempt ${m+1}/${f}), retrying in ${L}ms: ${u}`),await Vg(L)}finally{v!==void 0&&clearTimeout(v)}}throw g}async function Fg(o,e={},a={}){const{retries:r=jg,baseDelayMs:i=Ug,maxDelayMs:l=Bg,label:u=o}=a,d=r+1;for(let f=0;f<d;f++)try{await NS(o,e);return}catch(g){if(e.id&&document.getElementById(e.id)?.remove(),Ju())throw Pi.warn(`Document unloading, aborting script retries: ${u}`),g;if(f===d-1)throw Pi.warn(`All ${d} script attempts failed: ${u}`),g;const b=Gg(f,i,l);Pi.warn(`Script load failed (attempt ${f+1}/${d}), retrying in ${b}ms: ${u}`),await Vg(b)}}function NS(o,e){return new Promise((a,r)=>{const i=document.createElement("script");i.src=o,i.async=!1;for(const[l,u]of Object.entries(e))l==="id"?i.id=u:i.setAttribute(l,u);i.onload=()=>a(),i.onerror=()=>r(new Error(`Failed to load script: ${o}`)),document.head.appendChild(i)})}const La=ct("ComponentRegistry");class on extends Error{constructor(a,r,i){super(a);$(this,"code");$(this,"details");this.code=r,this.details=i,this.name="ComponentRegistryError"}}const qn=class qn{constructor(){$(this,"registry",{});$(this,"manifest",null);$(this,"loadingState","idle");$(this,"error",null);$(this,"templateId",null);$(this,"templateType",null)}static getInstance(){return qn.instance||(qn.instance=new qn),qn.instance}static createIsolatedInstance(){return new qn}static resetInstance(){qn.instance=null}async loadComponents(e,a){if(this.loadingState==="loading")throw new on("Components are already being loaded","LOADING_IN_PROGRESS");if(this.loadingState==="loaded"&&this.templateId===e&&this.templateType===a){La.log("Components already loaded for template:",e,a);return}this.loadingState="loading",this.templateId=e,this.templateType=a,this.error=null;try{await this.loadManifest(),await this.loadComponentBundle(),this.loadingState="loaded",La.log("Successfully loaded components:",Object.keys(this.registry).length)}catch(r){throw this.loadingState="error",this.error=r instanceof Error?r:new Error(String(r)),new on(`Failed to load components: ${this.error.message}`,"LOAD_FAILED",{originalError:this.error})}}async loadManifest(){try{if(!this.templateId)throw new on("Template ID not set","TEMPLATE_ID_NOT_SET");const e=`${this.templateId}:${this.templateType}`;if(qn.manifestCache.has(e)){this.manifest=qn.manifestCache.get(e),La.log("Manifest loaded from cache:",this.manifest.templateId);return}const a=`/api/templates/${this.templateId}/components.json`,r=await Cl(a,{label:"components.json"});if(!r.ok)throw new on(`Failed to fetch manifest: ${r.status} ${r.statusText}`,"MANIFEST_FETCH_FAILED",{status:r.status,statusText:r.statusText});const i=await r.json();this.validateManifest(i),this.manifest=i,qn.manifestCache.set(e,i),La.log("Manifest loaded and cached:",i.templateId)}catch(e){throw e instanceof on?e:new on("Failed to load component manifest","MANIFEST_LOAD_FAILED",{originalError:e})}}validateManifest(e){if(!e.version)throw new on("Manifest missing required field: version","MANIFEST_INVALID",{field:"version"});if(!e.templateId)throw new on("Manifest missing required field: templateId","MANIFEST_INVALID",{field:"templateId"});if(!e.components||typeof e.components!="object")throw new on("Manifest missing required field: components","MANIFEST_INVALID",{field:"components"});const a=["basic","composite","layout"];for(const r of a){if(!Array.isArray(e.components[r]))throw new on(`Manifest field 'components.${r}' must be an array`,"MANIFEST_INVALID",{field:`components.${r}`,value:e.components[r]});e.components[r].forEach((i,l)=>{if(!i.name||typeof i.name!="string")throw new on(`Invalid component metadata at ${r}[${l}]: missing or invalid 'name'`,"MANIFEST_INVALID",{type:r,index:l,metadata:i});if(!i.type||typeof i.type!="string")throw new on(`Invalid component metadata at ${r}[${l}]: missing or invalid 'type'`,"MANIFEST_INVALID",{type:r,index:l,metadata:i})})}La.log("Manifest validation passed")}async loadComponentBundle(){try{if(!this.templateId)throw new on("Template ID not set","TEMPLATE_ID_NOT_SET");const e=this.getGlobalVariableName(),a=window[e];if(!a||typeof a!="object")throw new on(`Component bundle not loaded. Expected global variable: ${e}. Ensure admin.blade.php includes the IIFE bundle script.`,"BUNDLE_NOT_LOADED",{expectedVariable:e});await this.registerComponentsFromManifest(a),La.log("Component bundle loaded from global variable:",e)}catch(e){throw e instanceof on?e:new on("Failed to load component bundle","BUNDLE_LOAD_FAILED",{originalError:e})}}getGlobalVariableName(){if(!this.templateId)throw new on("Template ID not set","TEMPLATE_ID_NOT_SET");return this.templateId.split(/[-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")}async registerComponentsFromManifest(e){if(!this.manifest)throw new on("Manifest not loaded","MANIFEST_NOT_LOADED");const a=["basic","composite","layout"];for(const r of a){const i=this.manifest.components[r]||[];for(const l of i){const u=l.name,d=e[u];if(!d){La.warn(`Component '${u}' not found in bundle`);continue}this.registerComponent(u,d,l)}}}registerComponent(e,a,r){this.registry[e]&&La.warn(`Component '${e}' already registered, overwriting`);const i=Ye.memo(a);this.registry[e]={component:i,metadata:r},La.log(`[ComponentRegistry] Registered component: ${e} (${r.type})`)}getComponent(e){const a=this.registry[e];return a?a.component:null}getMetadata(e){const a=this.registry[e];return a?a.metadata:null}hasComponent(e){return e in this.registry}getComponentsByType(e){return Object.entries(this.registry).filter(([a,r])=>r.metadata.type===e).map(([a,r])=>a)}getAllComponents(){return Object.keys(this.registry)}getComponentMap(){const e={};for(const[a,r]of Object.entries(this.registry))e[a]=r.component;return e}getLoadingState(){return this.loadingState}getError(){return this.error}getTemplateId(){return this.templateId}getManifest(){return this.manifest}clear(){this.registry={},this.manifest=null,this.loadingState="idle",this.error=null,this.templateId=null,this.templateType=null,La.log("Registry cleared")}};$(qn,"instance",null),$(qn,"manifestCache",new Map);let da=qn;const Kg=ct("TranslationEngine");class Qu extends Error{constructor(a,r,i){super(a);$(this,"key");$(this,"locale");this.key=r,this.locale=i,this.name="TranslationError"}}const Rn=class Rn{constructor(e={}){$(this,"cache",new Map);$(this,"translations",new Map);$(this,"options");$(this,"cacheVersion",0);this.options={defaultLocale:e.defaultLocale||"ko",fallbackLocale:e.fallbackLocale||"en",cacheTTL:e.cacheTTL||3e5}}static getInstance(e={}){return Rn.instance||(Rn.instance=new Rn(e)),Rn.instance}static resetInstance(){Rn.instance=null}setCacheVersion(e){this.cacheVersion!==e&&(Kg.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.cache.clear())}getCacheVersion(){return this.cacheVersion}async loadTranslations(e,a,r="/api",i=!1){const l=`${e}:${a}`;if(!i){const u=this.getFromCache(l);if(u)return this.translations.set(l,u),u}try{let u=`${r}/templates/${e}/lang/${a}.json`;const d=[];this.cacheVersion>0&&d.push(`v=${this.cacheVersion}`),i&&d.push(`_=${Date.now()}`),d.length>0&&(u+=`?${d.join("&")}`);const f=await fetch(u);if(!f.ok)throw new Qu(`Failed to load translations: ${f.statusText}`,void 0,a);const m=await f.json();return this.saveToCache(l,m),this.translations.set(l,m),m}catch(u){throw new Qu(`Failed to fetch translations for ${a}: ${u instanceof Error?u.message:String(u)}`,void 0,a)}}resolveTranslations(e,a,r){let i=e;const l=5;let u=0;for(;u<l&&i.includes("=$t:");){const d=i;if(i=i.replace(Rn.NESTED_TRANSLATION_PARAM_PATTERN,(f,g,m)=>"="+this.translate(m,a,void 0,r)),i===d)break;u++}return i.replace(Rn.TRANSLATION_PATTERN,(d,f,g)=>{const{cleanedParams:m,trailing:b}=this.separateTrailingText(g);return this.translate(f,a,m,r)+b})}translate(e,a,r,i){const l=this.getTranslation(e,a),u=r&&this.cleanParamsStr(r);if(u){const d=this.parseParams(u,i);return this.replaceParams(l,d)}return l}getTranslation(e,a){const{templateId:r,locale:i}=a,l=`${r}:${i}`,u=this.translations.get(l);if(u){const d=this.getNestedValue(u,e);if(d!==null)return d}if(i!==this.options.fallbackLocale){const d=`${r}:${this.options.fallbackLocale}`,f=this.translations.get(d);if(f){const g=this.getNestedValue(f,e);if(g!==null)return g}}return e}getNestedValue(e,a){const r=a.split(".");let i=e;for(const l of r){if(i==null||typeof i!="object")return null;i=i[l]}return typeof i=="string"?i:null}setTranslationValue(e,a,r,i){const l=`${e}:${a}`,u=this.translations.get(l)??{},d=r.split(".");let f=u;for(let g=0;g<d.length-1;g+=1){const m=d[g],b=f[m];(b==null||typeof b!="object"||Array.isArray(b))&&(f[m]={}),f=f[m]}f[d[d.length-1]]=i,this.translations.set(l,u)}parseParams(e,a){const r={},i=e.startsWith("|")?e.slice(1):e,l=[],d=i.replace(/\{\{(?:[^}]|\}(?!\}))*\}\}/g,f=>(l.push(f),`__PLACEHOLDER_${l.length-1}__`)).matchAll(Rn.PARAM_PATTERN);for(const f of d){const[,g,m]=f,b=m.replace(/__PLACEHOLDER_(\d+)__/g,(v,S)=>l[parseInt(S,10)]);r[g.trim()]=this.resolveParamValue(b.trim(),a)}return r}resolveParamValue(e,a){if(e.startsWith("{{")&&e.endsWith("}}")){const r=e.slice(2,-2).trim();if(/[|&()[\]!?:+\-*/%<>=\s]/.test(r)&&a)try{const u=new Function(...Object.keys(a),`return ${r}`)(...Object.values(a));return String(u??"")}catch(l){return Kg.error("Expression evaluation failed:",r,l),""}else{const l=this.getNestedDataValue(a,r);return String(l??"")}}return e}separateTrailingText(e){if(!e)return{cleanedParams:void 0,trailing:""};if(e.trimEnd().endsWith("}}"))return{cleanedParams:e,trailing:""};if(!(e.startsWith("|")?e.slice(1):e).includes("="))return{cleanedParams:void 0,trailing:e};const r=e.match(/(\s+[^\p{L}\w=|&\s][^\p{L}\w=]*\s*)$/u);return r?{cleanedParams:e.slice(0,-r[1].length),trailing:r[1]}:{cleanedParams:e,trailing:""}}cleanParamsStr(e){return this.separateTrailingText(e).cleanedParams||""}getNestedDataValue(e,a){if(!e)return;const r=a.split(".");let i=e;for(const l of r){if(i==null)return;i=i[l]}return i}replaceParams(e,a){let r=e;for(const[i,l]of Object.entries(a)){const u=new RegExp(`\\{\\{${i}\\}\\}`,"g");r=r.replace(u,String(l));const d=new RegExp(`\\{${i}\\}`,"g");r=r.replace(d,String(l))}return r}getFromCache(e){const a=this.cache.get(e);return a?Date.now()-a.timestamp>this.options.cacheTTL?(this.cache.delete(e),null):a.data:null}saveToCache(e,a){this.cache.set(e,{data:a,timestamp:Date.now()})}clearCache(){this.cache.clear(),this.translations.clear()}pruneCache(){const e=Date.now(),a=[];for(const[r,i]of this.cache.entries())e-i.timestamp>this.options.cacheTTL&&a.push(r);for(const r of a)this.cache.delete(r)}getCacheStats(){const e=Date.now();let a=0;for(const r of this.cache.values())e-r.timestamp>this.options.cacheTTL&&a++;return{size:this.cache.size,expired:a}}};$(Rn,"instance",null),$(Rn,"TRANSLATION_PATTERN",/\$t:(?:defer:)?([a-zA-Z0-9._-]+)(\|(?:(?!\$t:).)+)?/g),$(Rn,"NESTED_TRANSLATION_PARAM_PATTERN",/=(\$t:([a-zA-Z0-9._-]+))(?=[|&\s]|$)/g),$(Rn,"PARAM_PATTERN",/([^=|&]+)=([^|&]+)/g);let Sr=Rn,Zu=null;function IS(o){return Zu||(Zu=new Sr(o)),Zu}const Wg=Object.freeze(Object.defineProperty({__proto__:null,TranslationEngine:Sr,TranslationError:Qu,getTranslationEngine:IS},Symbol.toStringTag,{value:"Module"})),Gi=ct("PipeRegistry");function Yg(o,e){const a=o.getFullYear(),r=String(o.getMonth()+1).padStart(2,"0"),i=String(o.getDate()).padStart(2,"0"),l=String(o.getHours()).padStart(2,"0"),u=String(o.getMinutes()).padStart(2,"0"),d=String(o.getSeconds()).padStart(2,"0");return e.replace("YYYY",String(a)).replace("YY",String(a).slice(-2)).replace("MM",r).replace("M",String(o.getMonth()+1)).replace("DD",i).replace("D",String(o.getDate())).replace("HH",l).replace("H",String(o.getHours())).replace("mm",u).replace("m",String(o.getMinutes())).replace("ss",d).replace("s",String(o.getSeconds()))}function HS(o,e="ko"){const r=new Date().getTime()-o.getTime(),i=Math.floor(r/1e3),l=Math.floor(i/60),u=Math.floor(l/60),d=Math.floor(u/24),f=Math.floor(d/7),g=Math.floor(d/30),m=Math.floor(d/365);return e==="ko"?i<60?"방금 전":l<60?`${l}분 전`:u<24?`${u}시간 전`:d<7?`${d}일 전`:f<4?`${f}주 전`:g<12?`${g}개월 전`:`${m}년 전`:i<60?"just now":l<60?`${l} minute${l===1?"":"s"} ago`:u<24?`${u} hour${u===1?"":"s"} ago`:d<7?`${d} day${d===1?"":"s"} ago`:f<4?`${f} week${f===1?"":"s"} ago`:g<12?`${g} month${g===1?"":"s"} ago`:`${m} year${m===1?"":"s"} ago`}function ed(o){if(o==null)return null;if(o instanceof Date)return o;if(typeof o=="number")return new Date(o);if(typeof o=="string"){const e=new Date(o);return isNaN(e.getTime())?null:e}return null}const Gs={date:{fn:(o,e="YYYY-MM-DD")=>{const a=ed(o);return a?Yg(a,e):""},description:"날짜 포맷 (기본: YYYY-MM-DD)"},datetime:{fn:(o,e="YYYY-MM-DD HH:mm")=>{const a=ed(o);return a?Yg(a,e):""},description:"날짜+시간 포맷 (기본: YYYY-MM-DD HH:mm)"},relativeTime:{fn:(o,e="ko")=>{const a=ed(o);return a?HS(a,e):""},description:'상대 시간 표시 (예: "3분 전")'},number:{fn:(o,e)=>{const a=Number(o);if(isNaN(a))return String(o??"");const r={};return e!==void 0&&(r.minimumFractionDigits=e,r.maximumFractionDigits=e),a.toLocaleString(void 0,r)},description:"숫자 포맷 (천단위 구분, 선택적 소수점)"},truncate:{fn:(o,e=100,a="...")=>typeof o!="string"?String(o??""):o.length<=e?o:o.slice(0,e)+a,description:'문자열 자르기 (기본: 100자, 접미사: "...")'},uppercase:{fn:o=>typeof o!="string"?String(o??""):o.toUpperCase(),description:"대문자 변환"},lowercase:{fn:o=>typeof o!="string"?String(o??""):o.toLowerCase(),description:"소문자 변환"},stripHtml:{fn:o=>typeof o!="string"?String(o??""):o.replace(/<[^>]*>/g,""),description:"HTML 태그 제거"},default:{fn:(o,e="")=>o==null||o===""?e:o,description:"기본값 설정 (null, undefined, 빈문자열 시)"},fallback:{fn:(o,e)=>o??e,description:"폴백 값 설정 (null, undefined 시만)"},first:{fn:o=>{if(Array.isArray(o))return o[0]},description:"배열의 첫 번째 요소"},last:{fn:o=>{if(Array.isArray(o))return o[o.length-1]},description:"배열의 마지막 요소"},join:{fn:(o,e=", ")=>Array.isArray(o)?o.join(e):"",description:'배열을 문자열로 결합 (기본 구분자: ", ")'},length:{fn:o=>Array.isArray(o)||typeof o=="string"?o.length:0,description:"배열/문자열 길이"},filterBy:{fn:(o,e,a)=>Array.isArray(o)?Array.isArray(e)?o.filter(r=>{const i=a?r?.[a]:r;return e.includes(i)}):o:[],description:"배열 필터링 (allowList에 포함된 항목만 반환)"},keys:{fn:o=>o==null||typeof o!="object"?[]:Object.keys(o),description:"객체의 키 배열"},values:{fn:o=>o==null||typeof o!="object"?[]:Object.values(o),description:"객체의 값 배열"},json:{fn:(o,e)=>{try{return JSON.stringify(o,null,e)}catch{return""}},description:"JSON 문자열로 변환"},localized:{fn:(o,e)=>o==null?"":typeof o=="string"?o:typeof o!="object"?String(o):o[e||"ko"]||o.ko||o.en||Object.values(o)[0]||"",description:"다국어 객체에서 로케일에 맞는 값 추출"}},Vi=new Map,hi=class hi{static getInstance(){return hi.instance||(hi.instance=new hi),hi.instance}register(e,a,r){if(Gs[e]){Gi.warn(`[PipeRegistry] 내장 파이프를 덮어쓸 수 없습니다: ${e}`);return}Vi.set(e,{fn:a,description:r}),Gi.log(`[PipeRegistry] 커스텀 파이프 등록됨: ${e}`)}unregister(e){if(Gs[e])return Gi.warn(`[PipeRegistry] 내장 파이프는 해제할 수 없습니다: ${e}`),!1;const a=Vi.delete(e);return a&&Gi.log(`[PipeRegistry] 커스텀 파이프 해제됨: ${e}`),a}get(e){const a=Gs[e];return a?a.fn:Vi.get(e)?.fn}has(e){return!!Gs[e]||Vi.has(e)}execute(e,a,r=[]){const i=this.get(e);if(!i)return Gi.warn(`[PipeRegistry] 알 수 없는 파이프: ${e}`),a;try{return i(a,...r)}catch(l){return Gi.error(`[PipeRegistry] 파이프 실행 오류 (${e}):`,l),a}}list(){const e=[];for(const[a,r]of Object.entries(Gs))e.push({name:a,description:r.description,type:"built-in"});for(const[a,r]of Vi.entries())e.push({name:a,description:r.description,type:"custom"});return e.sort((a,r)=>a.name.localeCompare(r.name))}clearCustomPipes(){Vi.clear()}};$(hi,"instance",null);let El=hi;El.getInstance();function zS(o){const e=o.trim(),a=e.indexOf("(");if(a===-1)return{name:e,args:[]};const r=e.slice(0,a).trim(),i=e.slice(a+1,-1);if(!i.trim())return{name:r,args:[]};const l=[];let u="",d=null,f=0;for(let g=0;g<i.length;g++){const m=i[g];if((g>0?i[g-1]:"")==="\\"){u+=m;continue}if((m==='"'||m==="'")&&!d){d=m;continue}if(m===d){d=null;continue}if(d){u+=m;continue}if(m==="("||m==="["||m==="{"){f++,u+=m;continue}if(m===")"||m==="]"||m==="}"){f--,u+=m;continue}if(m===","&&f===0){l.push(Xg(u.trim())),u="";continue}u+=m}return u.trim()&&l.push(Xg(u.trim())),{name:r,args:l}}function Xg(o){if(o==="null")return null;if(o==="undefined")return;if(o==="true")return!0;if(o==="false")return!1;const e=Number(o);return!isNaN(e)&&o!==""?e:o}function jS(o){const e=[];let a="",r=null,i=0;for(let l=0;l<o.length;l++){const u=o[l],d=l>0?o[l-1]:"",f=l<o.length-1?o[l+1]:"";if(d==="\\"){a+=u;continue}if((u==='"'||u==="'")&&!r){r=u,a+=u;continue}if(u===r){r=null,a+=u;continue}if(r){a+=u;continue}if(u==="("||u==="["||u==="{"){i++,a+=u;continue}if(u===")"||u==="]"||u==="}"){i--,a+=u;continue}if(u==="|"&&f!=="|"&&d!=="|"&&i===0){e.push(a.trim()),a="";continue}a+=u}return a.trim()&&e.push(a.trim()),e.length===0?[o,[]]:[e[0],e.slice(1)]}function Jg(o){let e=null,a=0;for(let r=0;r<o.length;r++){const i=o[r],l=r>0?o[r-1]:"",u=r<o.length-1?o[r+1]:"";if(l!=="\\"){if((i==='"'||i==="'")&&!e){e=i;continue}if(i===e){e=null;continue}if(!e){if(i==="("||i==="["||i==="{"){a++;continue}if(i===")"||i==="]"||i==="}"){a--;continue}if(i==="|"&&u!=="|"&&l!=="|"&&a===0)return!0}}}return!1}function US(o,e){const a=El.getInstance();let r=o;for(const i of e){const l=zS(i);r=a.execute(l.name,r,l.args)}return r}const wr="raw:",_l="﷐",Vs="﷑",Cr="﷒";function Fs(o){return _l+o+Vs}function Qg(o){return o.length>=2&&o.charCodeAt(0)===64976&&o.charCodeAt(o.length-1)===64977}function Zg(o){return o.includes(_l)}function ep(o){return o.slice(1,-1)}function Ks(o){if(typeof o=="string")return Fs(o);if(Array.isArray(o))return o.map(Ks);if(o&&typeof o=="object"){const e={};for(const[a,r]of Object.entries(o))e[a]=Ks(r);return e}return o}const Ws=ct("DataBindingEngine");function Al(){try{return window.G7Core?.devTools}catch{return}}class td extends Error{constructor(a,r,i){super(a);$(this,"path");$(this,"context");this.path=r,this.context=i,this.name="DataBindingError"}}const Sa=class Sa{constructor(e){$(this,"cache",new Map);$(this,"expressionFnCache",new Map);$(this,"renderCycleCache",new Map);$(this,"currentRenderCycleId",0);$(this,"defaultOptions",{defaultValue:void 0,nullSafe:!0,detectCircular:!0,maxDepth:10});e&&(this.defaultOptions={...this.defaultOptions,...e})}startRenderCycle(){this.currentRenderCycleId++,this.renderCycleCache.clear()}isRenderCycleCacheActive(){return this.currentRenderCycleId>0}getFromRenderCycleCache(e){if(this.isRenderCycleCacheActive())return this.renderCycleCache.get(e)}saveToRenderCycleCache(e,a){this.isRenderCycleCacheActive()&&this.renderCycleCache.set(e,a)}resolveBindings(e,a,r,i){const l={...this.defaultOptions,...r},u=Al(),d=a._computed&&!a.$computed?{...a,$computed:a._computed}:a;return e.replace(Sa.BINDING_PATTERN,(f,g)=>{const m=g.trim();let b=!1,v=m;if(m.startsWith(wr)&&(b=!0,v=m.slice(wr.length)),Jg(v)){const R=u?.isEnabled()?performance.now():0;try{const[D,U]=jS(v);let j,q=!1;const X=/[?:|&!+\-*/<>=()]/.test(D)||/\[['"]/.test(D),ge=D.startsWith("_global")||D.startsWith("_local")||D.startsWith("_isolated")||D.startsWith("$parent");if(l.skipCache)X?j=this.evaluateExpression(D,d):j=this.resolvePath(D,d,l);else if(X){const $e=this.getFromRenderCycleCache(`expr:${D}`);$e!==void 0?(j=$e,q=!0):(j=this.evaluateExpression(D,d),this.saveToRenderCycleCache(`expr:${D}`,j))}else if(ge){const $e=this.getFromRenderCycleCache(D);$e!==void 0?(j=$e,q=!0):(j=this.resolvePath(D,d,l),this.saveToRenderCycleCache(D,j))}else{const $e=this.getFromCache(D);$e!==void 0?(j=$e,q=!0):(j=this.resolvePath(D,d,l),this.saveToCache(D,j))}const Ee=US(j,U);if(u?.isEnabled()){const $e=performance.now()-R;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(Ee),resultType:this.getResultType(Ee),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:q,duration:$e,method:"resolveBindings",skipCache:l.skipCache})}const Ce=this.formatValue(Ee);return b?Fs(Ce):Ce}catch(D){return Ws.error("Pipe expression evaluation failed:",v,D),f}}if(/[?:&!+\-*/<>=()]/.test(v)||/\|\|/.test(v)||/\[['"]/.test(v)){const R=u?.isEnabled()?performance.now():0;try{let D,U=!1;if(l.skipCache)D=this.evaluateExpression(v,d);else{const q=`expr:${v}`,X=this.getFromRenderCycleCache(q);X!==void 0?(D=X,U=!0):(D=this.evaluateExpression(v,d),this.saveToRenderCycleCache(q,D))}if(u?.isEnabled()){const q=performance.now()-R;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(D),resultType:this.getResultType(D),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:U,duration:q,method:"resolveBindings",skipCache:l.skipCache})}const j=this.formatValue(D);return b?Fs(j):j}catch(D){return Ws.error("Expression evaluation failed:",v,D),f}}if(l.skipCache){const R=u?.isEnabled()?performance.now():0,D=this.resolvePath(v,d,l);if(u?.isEnabled()){const j=performance.now()-R;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(D),resultType:this.getResultType(D),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!1,duration:j,method:"resolveBindings",skipCache:!0})}const U=this.formatValue(D);return b?Fs(U):U}const E=v.startsWith("_global")||v.startsWith("_local")||v.startsWith("_isolated")||v.startsWith("$parent"),A=u?.isEnabled()?performance.now():0;let T,L=!1;if(E){const R=this.getFromRenderCycleCache(v);R!==void 0?(T=R,L=!0):(T=this.resolvePath(v,d,l),this.saveToRenderCycleCache(v,T))}else{const R=this.getFromCache(v);R!==void 0?(T=R,L=!0):(T=this.resolvePath(v,d,l),this.saveToCache(v,T))}if(u?.isEnabled()){const R=performance.now()-A;u.trackExpressionEval({expression:`{{${m}}}`,result:this.sanitizeResultForTracking(T),resultType:this.getResultType(T),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:L,duration:R,method:"resolveBindings",skipCache:l.skipCache})}const M=this.formatValue(T);return b?Fs(M):M})}resolve(e,a,r,i){const l={...this.defaultOptions,...r},u=Al(),d=u?.isEnabled()?performance.now():0;if(l.skipCache){const b=this.resolvePath(e,a,l);return u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(b),resultType:this.getResultType(b),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!1,duration:performance.now()-d,method:"resolve",skipCache:!0}),b}const f=e.startsWith("_global")||e.startsWith("_local")||e.startsWith("_isolated")||e.startsWith("$parent");let g=!1;if(f){const b=this.getFromRenderCycleCache(e);if(b!==void 0)return g=!0,u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(b),resultType:this.getResultType(b),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-d,method:"resolve",skipCache:l.skipCache}),b}else{const b=this.getFromCache(e);if(b!==void 0)return g=!0,u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(b),resultType:this.getResultType(b),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:!0,duration:performance.now()-d,method:"resolve",skipCache:l.skipCache}),b}const m=this.resolvePath(e,a,l);return f?this.saveToRenderCycleCache(e,m):this.saveToCache(e,m),u?.isEnabled()&&u.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(m),resultType:this.getResultType(m),componentId:i?.componentId,componentName:i?.componentName,propName:i?.propName,fromCache:g,duration:performance.now()-d,method:"resolve",skipCache:l.skipCache}),m}resolvePath(e,a,r,i=0,l=new WeakSet){if(r.maxDepth&&i>r.maxDepth){if(r.detectCircular)throw new td(`Maximum depth exceeded (${r.maxDepth}). Possible circular reference.`,e,a);return r.defaultValue}const u=this.parsePath(e);let d=a;for(let f=0;f<u.length;f++){const g=u[f];if(d==null){if(r.nullSafe)return r.defaultValue;throw new td(`Cannot read property '${g}' of ${d}`,e,a)}if(r.detectCircular&&typeof d=="object"){if(l.has(d))throw new td(`Circular reference detected at path: ${u.slice(0,f+1).join(".")}`,e,a);l.add(d)}d=d[g],e==="_global.toasts"&&Ws.log(`[DataBindingEngine] segment: ${g}, current:`,d)}return d!==void 0?d:r.defaultValue}parsePath(e){const a=[];let r;for(Sa.PATH_SEGMENT_PATTERN.lastIndex=0;(r=Sa.PATH_SEGMENT_PATTERN.exec(e))!==null;){const i=r[1]||r[2];i&&a.push(i)}return a}formatValue(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return"[Object]"}return String(e)}getFromCache(e){const a=this.cache.get(e),r=Al();if(!a){r?.isEnabled()&&r.recordCacheMiss();return}if(Date.now()-a.timestamp>Sa.CACHE_EXPIRY){this.cache.delete(e),r?.isEnabled()&&r.recordCacheMiss();return}return r?.isEnabled()&&r.recordCacheHit(),a.value}saveToCache(e,a){this.cache.set(e,{value:a,timestamp:Date.now()})}isActionDefinition(e){return typeof e.handler!="string"?!1:e.params!==void 0||Array.isArray(e.actions)||typeof e.target=="string"||e.onSuccess!==void 0||e.onError!==void 0}extractSingleBinding(e){if(!e.startsWith("{{")||!e.endsWith("}}")||e.length<5)return null;const a=e.slice(2,-2);let r=0;for(let i=0;i<a.length-1;i++){const l=a[i];if(l==="{")r++;else if(l==="}"){if(r>0)r--;else if(a[i+1]==="}")return null}}return a}resolveObject(e,a,r){if(this.isSwitchExpression(e)){const d=e;return this.resolveSwitch(d,a,r)}if(this.isActionDefinition(e))return{...e};if("iteration"in e)return{...e};const i={},u=[...["cellChildren","expandChildren","expandContext","render"],...r?.skipBindingKeys||[]];for(const[d,f]of Object.entries(e)){if(u.includes(d)){i[d]=f;continue}if(typeof f=="string"){const g=this.extractSingleBinding(f);if(g!==null){const m=g.trim();let b=!1,v=m;m.startsWith(wr)&&(b=!0,v=m.slice(wr.length));const E=/[?:|&!+\-*/<>=()]/.test(v)||/\[['"]/.test(v)?this.evaluateExpression(v,a,r):this.resolve(v,a,r);i[d]=b&&E!=null?Ks(E):E}else i[d]=this.resolveBindings(f,a,r)}else Array.isArray(f)?i[d]=f.map(g=>typeof g=="string"?this.resolveBindings(g,a,r):typeof g=="object"&&g!==null?this.resolveObject(g,a,r):g):f&&typeof f=="object"?i[d]=this.resolveObject(f,a,r):i[d]=f}return i}clearCache(){this.cache.clear(),this.expressionFnCache.clear()}invalidateCacheByKeys(e){for(const a of this.cache.keys())for(const r of e)if(a===r||a.startsWith(`${r}.`)||a.startsWith(`${r}[`)){this.cache.delete(a);break}}pruneCache(){const e=Date.now();for(const[a,r]of this.cache.entries())e-r.timestamp>Sa.CACHE_EXPIRY&&this.cache.delete(a)}getCacheStats(){const e=Date.now();let a=0;for(const r of this.cache.values())e-r.timestamp>Sa.CACHE_EXPIRY&&a++;return{size:this.cache.size,expired:a}}evaluateExpression(e,a,r){const i=Al(),l=i?.isEnabled()?performance.now():0;i?.isEnabled()&&i.trackBindingEval();try{let u=this.preprocessOptionalChaining(e);u=this.preprocessTranslationTokens(u);const d=this.extractVariablesFromExpression(u),f={...a};for(const D of d)D in f||(f[D]=void 0);a._computed&&!f.$computed&&(f.$computed=a._computed);let g=a.$templateId,m=a.$locale;if(typeof window<"u"&&(!g||!m)){const D=window.__templateApp?.getConfig?.();g??(g=D?.templateId),m??(m=D?.locale)}const b=m||"ko";f.$localized=(D,U)=>{if(D==null&&!U)return"";if(typeof D=="string")return D;if(D&&typeof D=="object"&&D[b])return D[b];if(U&&typeof U=="string"){const j=f.$t?f.$t(U):U;if(j&&j!==U)return j}return D&&typeof D=="object"?D.ko||D.en||Object.values(D)[0]||"":D==null?"":String(D)};const v=typeof window<"u"?window.G7Core:void 0;f.$uuid=()=>v?.uuid?v.uuid():typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,D=>{const U=Math.random()*16|0;return(D==="x"?U:U&3|8).toString(16)});const S={templateId:g||"",locale:b};f.$t=D=>{if(!D||typeof D!="string")return"";try{return Sr.getInstance().translate(D,S)}catch(U){return Ws.warn("$t() translation failed for key:",D,U),D}},f.$get=(D,U,j=void 0)=>{if(D==null)return j;const q=Array.isArray(U)?U:[U];if(q.length===0)return D;let X=D;for(const ge of q){if(X==null||ge==null)return j;X=X[ge]}return X??j};const E=Object.keys(f),A=Object.values(f),T=`${u}|${E.join(",")}`;let L=this.expressionFnCache.get(T);const M=!!L;L||(L=new Function(...E,`return (${u});`),this.expressionFnCache.set(T,L));const R=L(...A);if(i?.isEnabled()){const D=performance.now()-l;i.trackExpressionEval({expression:e,result:this.sanitizeResultForTracking(R),resultType:this.getResultType(R),componentId:r?.componentId,componentName:r?.componentName,propName:r?.propName,fromCache:M,duration:D,method:"evaluateExpression",skipCache:r?.skipCache})}return R}catch(u){throw new Error(`Failed to evaluate expression "${e}": ${u instanceof Error?u.message:String(u)}`)}}getResultType(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}sanitizeResultForTracking(e){if(e==null||typeof e!="object")return e;try{if(Array.isArray(e))return e.length>10?`[Array(${e.length})]`:e.slice(0,10);const a=Object.keys(e);return a.length>20?`{Object(${a.length} keys)}`:(JSON.stringify(e),e)}catch{return"[Complex Object]"}}preprocessTranslationTokens(e){return e=e.replace(/(['"])(\$t:([a-zA-Z_][a-zA-Z0-9_.\-]*))\1/g,(a,r,i,l)=>`$t('${l}')`),e.replace(/(?<!['"]\s*)(\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*)(?!\s*['"])/g,'"$1"')}preprocessOptionalChaining(e){const a=[];let r=e.replace(/(['"])(?:(?!\1|\\).|\\.)*\1/g,l=>(a.push(l),`__STRING_LITERAL_${a.length-1}__`));const i=[];return r=r.replace(/\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*(?:\|[^'"\s,)]+)?/g,l=>(i.push(l),`__TRANSLATION_TOKEN_${i.length-1}__`)),r=r.replace(/([a-zA-Z_$][a-zA-Z0-9_$]*)\.(?!\?)/g,"$1?."),r=r.replace(/__TRANSLATION_TOKEN_(\d+)__/g,(l,u)=>i[parseInt(u,10)]),r=r.replace(/__STRING_LITERAL_(\d+)__/g,(l,u)=>a[parseInt(u,10)]),r}extractVariablesFromExpression(e){const a=new Set(["true","false","null","undefined","NaN","Infinity","if","else","for","while","do","switch","case","break","continue","return","function","class","const","let","var","new","delete","typeof","instanceof","this","super","import","export","default","try","catch","finally","throw","Math","Date","JSON","Array","Object","String","Number","Boolean","RegExp","Set","Map","WeakSet","WeakMap","Symbol","Promise","BigInt","Error","parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent"]),r=/(?<![.\w$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,i=new Set;let l;for(;(l=r.exec(e))!==null;){const u=l[1];a.has(u)||i.add(u)}return Array.from(i)}isSwitchExpression(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$switch"in e&&"$cases"in e}resolveSwitch(e,a,r){const i={...r,skipCache:!0};let l;try{l=this.resolveBindings(e.$switch,a,i)?.toString()?.trim()??""}catch(d){Ws.warn("resolveSwitch: $switch 키 평가 실패:",e.$switch,d),l=""}let u;if(l&&e.$cases&&l in e.$cases)u=e.$cases[l];else if("$default"in e)u=e.$default;else return;return typeof u=="string"?u.includes("{{")?this.resolveBindings(u,a,i):u:u!==null&&typeof u=="object"?this.resolveObject(u,a,i):u}};$(Sa,"BINDING_PATTERN",/\{\{([^}]+)\}\}/g),$(Sa,"PATH_SEGMENT_PATTERN",/([^.[\]]+)|\[(\d+)\]/g),$(Sa,"CACHE_EXPIRY",3e4);let wn=Sa;const BS=new wn,xl={mobile:{min:0,max:767},tablet:{min:768,max:1023},desktop:{min:1024,max:1/0},portable:{min:0,max:1023}},Tl=new Map;function qS(o,e){let a=null;return((...r)=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{o(...r)},e)})}class PS{constructor(){$(this,"subscribers",new Set);$(this,"currentWidth",1024);$(this,"debouncedHandler",null);$(this,"isInitialized",!1);this.initialize()}initialize(){typeof window>"u"||(this.currentWidth=window.innerWidth,this.isInitialized=!0,this.debouncedHandler=qS(()=>{this.currentWidth=window.innerWidth,this.notifySubscribers()},150),window.addEventListener("resize",this.debouncedHandler))}notifySubscribers(){this.subscribers.forEach(e=>{e(this.currentWidth)})}subscribe(e){return this.subscribers.add(e),e(this.currentWidth),()=>{this.subscribers.delete(e)}}getWidth(){return this.currentWidth}parseRange(e){if(Tl.has(e))return Tl.get(e)??null;let a=null;if(xl[e])a={...xl[e]};else{const r=e.match(/^(-?\d*)-(-?\d*)$/);if(r){const[,i,l]=r,u=i===""?0:parseInt(i,10),d=l===""?1/0:parseInt(l,10);!isNaN(u)&&!isNaN(d)&&u<=d&&(a={min:u,max:d})}}return Tl.set(e,a),a}getMatchingKey(e,a){const r=[];for(const i of Object.keys(e)){const l=this.parseRange(i);l&&a>=l.min&&a<=l.max&&r.push({key:i,range:l,isPreset:!!xl[i]})}return r.length===0?null:(r.sort((i,l)=>{if(i.isPreset!==l.isPreset)return i.isPreset?1:-1;const u=i.range.max-i.range.min,d=l.range.max-l.range.min;return u-d}),r[0].key)}matches(e){const a=this.parseRange(e);return a?this.currentWidth>=a.min&&this.currentWidth<=a.max:!1}clearSubscribers(){this.subscribers.clear()}destroy(){this.debouncedHandler&&typeof window<"u"&&window.removeEventListener("resize",this.debouncedHandler),this.clearSubscribers(),Tl.clear()}_setWidthForTesting(e){this.currentWidth=e,this.notifySubscribers()}}const oi=new PS,Rl=ct("ConditionEvaluator");function GS(o){switch(o){case"true":return{value:!0};case"false":return{value:!1};case"null":return{value:null};case"undefined":return{value:void 0};default:return}}function VS(o){return/[?:|&!+\-*/<>=()]/.test(o)}function FS(o){if(!o.startsWith("{{")||!o.endsWith("}}"))return null;const e=o.slice(2,-2);let a=null,r=0;for(let i=0;i<e.length;i++){const l=e[i];if((i>0?e[i-1]:"")!=="\\"&&((l==='"'||l==="'")&&!a?a=l:l===a&&(a=null),!a&&(l==="{"&&r++,l==="}"&&r--,r<0)))return null}return r===0?e.trim():null}function KS(o,e,a){if(!o)return!0;try{const r=FS(o);let i;if(r!==null){const l=GS(r);l!==void 0?i=l.value:VS(r)?i=a.evaluateExpression(r,e):i=a.resolve(r,e,{skipCache:!0})}else i=a.resolveBindings(o,e,{skipCache:!0});if(typeof i=="string"){const l=i.toLowerCase().trim();if(l==="false"||l==="0"||l===""||l==="null"||l==="undefined")return!1}return!!i}catch(r){return Rl.warn(`evaluateStringCondition: 조건 평가 실패: ${o}`,r),!1}}function kl(o,e,a){if(typeof o=="string")return KS(o,e,a);if("and"in o){if(!Array.isArray(o.and)||o.and.length===0)return Rl.warn("evaluateConditionExpression: AND 그룹이 비어있습니다"),!0;for(const r of o.and)if(!kl(r,e,a))return!1;return!0}if("or"in o){if(!Array.isArray(o.or)||o.or.length===0)return Rl.warn("evaluateConditionExpression: OR 그룹이 비어있습니다"),!1;for(const r of o.or)if(kl(r,e,a))return!0;return!1}return Rl.warn("evaluateConditionExpression: 알 수 없는 조건 형식",o),!1}function tp(o,e,a){if(!Array.isArray(o)||o.length===0)return{matched:!1,branchIndex:-1};for(let r=0;r<o.length;r++){const i=o[r];if(i.if===void 0)return{matched:!0,branchIndex:r};if(kl(i.if,e,a))return{matched:!0,branchIndex:r}}return{matched:!1,branchIndex:-1}}function WS(o){return typeof o=="string"?!0:o&&typeof o=="object"?"and"in o||"or"in o:!1}function YS(o){if(!Array.isArray(o)||o.length===0)return!1;const e=o[0];return!e||typeof e!="object"?!1:"if"in e||"then"in e}const Ya=ct("RenderHelpers"),XS=new Map([["true",!0],["false",!1],["null",null]]);function np(){try{return window.G7Core?.devTools}catch{return}}const ap=new wn;function nd(o){return/[?:|&!+\-*/<>=()[\]{}]/.test(o)}function rp(o){if(!o.startsWith("{{")||!o.endsWith("}}"))return null;const e=o.slice(2,-2);let a=null,r=0;for(let i=0;i<e.length;i++){const l=e[i];if((i>0?e[i-1]:"")!=="\\"&&((l==='"'||l==="'")&&!a?a=l:l===a&&(a=null),!a&&(l==="{"&&r++,l==="}"&&r--,r<0)))return null}return r===0?e.trim():null}function ad(o,e,a){let r=o;if(o.startsWith("{{")&&o.endsWith("}}")&&(r=o.slice(2,-2).trim()),nd(r))try{return a.evaluateExpression(r,e)}catch(i){Ya.warn(`resolveIterationSource: 표현식 평가 실패: ${o}`,i);return}return a.resolve(r,e,{skipCache:!0})}function JS(o,e){const a={...o};if(e?.parentDataContext)for(const[r,i]of Object.entries(e.parentDataContext))r in a||(a[r]=i);if(e?.state){const r=a._local||{};a._local={...r,...e.state}}return e?.isolatedContext?.state&&(a._isolated=e.isolatedContext.state),a}function rd(o,e,a,r){if(!e||!Array.isArray(e)||e.length===0)return o;const i=r?.actionDispatcher??Kp(),l={...o,actions:e},u=i.bindActionsToProps(l,a,r?.componentContext);return delete u.actions,u}function ip(o,e,a,r){if(typeof o=="boolean")return o;if(!o)return!0;try{const i=rp(o);let l;if(i!==null){const u=XS.get(i);u!==void 0?l=u:nd(i)?l=a.evaluateExpression(i,e):l=a.resolve(i,e,{skipCache:!0})}else l=a.resolveBindings(o,e,{skipCache:!0});if(typeof l=="string"){const u=l.toLowerCase().trim();if(u==="false"||u==="0"||u===""||u==="null"||u==="undefined")return!1}return!!l}catch(i){return Ya.warn(`evaluateIfCondition: 조건 평가 실패 (컴포넌트: ${r||"unknown"}):`,i),!1}}function Fi(o,e,a,r){if(o.if!==void 0)return ip(o.if,e,a,r);if(o.condition!==void 0)return ip(o.condition,e,a,r);if(o.conditions===void 0)return!0;const i=o.conditions;try{return WS(i)?kl(i,e,a):YS(i)?tp(i,e,a).matched:(Ya.warn(`evaluateRenderCondition: 알 수 없는 conditions 형식 (컴포넌트: ${r||"unknown"})`),!0)}catch(l){return Ya.warn(`evaluateRenderCondition: conditions 평가 실패 (컴포넌트: ${r||"unknown"}):`,l),!1}}function sp(o){if(!o.responsive)return o;const e=oi.getWidth(),a=oi.getMatchingKey(o.responsive,e);if(!a)return o;const r=o.responsive[a];return{...o,props:{...o.props,...r.props},children:r.children??o.children,text:r.text??o.text,if:r.if??o.if,iteration:r.iteration??o.iteration}}function Ys(o,e,a,r,i){if(!o||o.length===0)return[];const l=i?.bindingEngine??new wn,u=i?.translationEngine??Sr.getInstance(),d=i?.translationContext??{templateId:"",locale:"ko"},f=JS(e,i?.componentContext),g=(v,S)=>{if(typeof v=="string"){if(Qg(v))return ep(v);if(Zg(v)){const A=[],T=v.replace(new RegExp(`${_l}([^${Vs}]*)${Vs}`,"g"),(M,R)=>(A.push(R),`${Cr}${A.length-1}${Cr}`));let L=T;return/\$t:[a-zA-Z0-9._-]+/.test(T)&&(L=u.resolveTranslations(T,d,S)),L.replace(new RegExp(`${Cr}(\\d+)${Cr}`,"g"),(M,R)=>A[parseInt(R)])}if(v.startsWith("$t:defer:")){const A="$t:"+v.slice(9);return u.resolveTranslations(A,d,S)}if(v.startsWith("$t:"))return u.resolveTranslations(v,d,S);const E=rp(v);if(E!==null){let A=!1,T=E;E.startsWith(wr)&&(A=!0,T=E.slice(wr.length));let L;if(nd(T))try{L=l.evaluateExpression(T,S)}catch(M){Ya.warn("renderItemChildren: 표현식 평가 실패:",M);return}else L=l.resolve(T,S,{skipCache:!0});return!A&&typeof L=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(L)&&(L=u.resolveTranslations(L,d,S)),A&&L!=null?Ks(L):L}if(v.includes("{{")){const A=l.resolveBindings(v,S,{skipCache:!0});return typeof A=="string"&&/\$t:[a-zA-Z0-9._-]+/.test(A)?u.resolveTranslations(A,d,S):A}return v}if(Array.isArray(v))return v.map(E=>g(E,S));if(v&&typeof v=="object"){const E={};for(const[A,T]of Object.entries(v))E[A]=g(T,S);return E}return v},m=(v,S)=>{if(!v)return{};const E={};for(const[A,T]of Object.entries(v))E[A]=g(T,S);return E},b=(v,S,E)=>{const A=sp(v),T=A.iteration;if(!T)return[];const L=ad(T.source,E,l);if(!Array.isArray(L))return Ya.warn(`renderItemChildren: iteration.source가 배열이 아닙니다: ${T.source}`),[];const M=np();if(M?.isEnabled()){const D=`${S}-iteration`;M.trackIteration(D,T.source,T.item_var,T.index_var,L.length)}const R=a[A.name];return R?L.flatMap((D,U)=>{const j={...E,[T.item_var]:D,[`${T.item_var}_index`]:U,...T.index_var?{[T.index_var]:U}:{}},q=Fi({if:A.if,condition:A.condition,conditions:A.conditions},j,l,A.id);if(A.if&&M?.isEnabled()){const Xe=`${S}-iter-${U}-if`;M.trackIfCondition(Xe,A.if,q,A.name)}if(!q)return[];const X=A.id?String(g(A.id,j)):void 0,ge=`${S}-iter-${U}`,Ee=i?.getRemountKey?i.getRemountKey(X,ge):ge,Ce=m(A.props,j),$e=rd(Ce,A.actions,j,{actionDispatcher:i?.actionDispatcher,componentContext:i?.componentContext});let qe=null;return A.text!==void 0?qe=g(A.text,j):A.children&&A.children.length>0&&(qe=Ys(A.children,j,a,Ee,i)),M?.isEnabled()&&M.trackRender(A.name),[Ye.createElement(R,{key:Ee,...$e},qe)]}):(Ya.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${A.name}`),[])};return o.flatMap((v,S)=>{const E=sp(v),A=E.id?String(g(E.id,f)):void 0,T=r?`${r}-${A||S}`:A||`child-${S}`,L=i?.getRemountKey?i.getRemountKey(A,T):T;if(E.iteration)return b(E,L,f);const M=Fi({if:E.if,condition:E.condition,conditions:E.conditions},f,l,E.id),R=np();if(E.if&&R?.isEnabled()){const X=`${L}-if`;R.trackIfCondition(X,E.if,M,E.name)}if(!M)return[];const D=a[E.name];if(!D)return Ya.warn(`renderItemChildren: 컴포넌트를 찾을 수 없습니다: ${E.name}`),[];const U=m(E.props,f),j=rd(U,E.actions,f,{actionDispatcher:i?.actionDispatcher,componentContext:i?.componentContext});let q=null;return E.text!==void 0?q=g(E.text,f):E.children&&E.children.length>0&&(q=Ys(E.children,f,a,L,i)),R?.isEnabled()&&R.trackRender(E.name),[Ye.createElement(D,{key:L,...j},q)]})}function Ki(o,e,a,r){let i,l;return a instanceof wn?(i=a,l=r):(i=ap,l=a),i.resolveBindings(o,e,l)}function QS(o,e,a,r){const i=a??ap,l={skipCache:!0,...r};let u;try{u=i.resolveBindings(o.key,e,{skipCache:l.skipCache})?.toString()?.trim()??""}catch(g){Ya.warn("resolveClassMap: key 평가 실패:",o.key,g),u=""}let d="";u&&o.variants&&u in o.variants?d=o.variants[u]:o.default&&(d=o.default);const f=[];return o.base?.trim()&&f.push(o.base.trim()),d?.trim()&&f.push(d.trim()),f.join(" ")}function op(o,e){return function(){return o.apply(e,arguments)}}const{toString:ZS}=Object.prototype,{getPrototypeOf:Dl}=Object,{iterator:Ol,toStringTag:lp}=Symbol,Ll=(o=>e=>{const a=ZS.call(e);return o[a]||(o[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),fa=o=>(o=o.toLowerCase(),e=>Ll(e)===o),Ml=o=>e=>typeof e===o,{isArray:Wi}=Array,Yi=Ml("undefined");function Xs(o){return o!==null&&!Yi(o)&&o.constructor!==null&&!Yi(o.constructor)&&xn(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const cp=fa("ArrayBuffer");function ew(o){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(o):e=o&&o.buffer&&cp(o.buffer),e}const tw=Ml("string"),xn=Ml("function"),up=Ml("number"),Js=o=>o!==null&&typeof o=="object",nw=o=>o===!0||o===!1,$l=o=>{if(Ll(o)!=="object")return!1;const e=Dl(o);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(lp in o)&&!(Ol in o)},aw=o=>{if(!Js(o)||Xs(o))return!1;try{return Object.keys(o).length===0&&Object.getPrototypeOf(o)===Object.prototype}catch{return!1}},rw=fa("Date"),iw=fa("File"),sw=o=>!!(o&&typeof o.uri<"u"),ow=o=>o&&typeof o.getParts<"u",lw=fa("Blob"),cw=fa("FileList"),uw=o=>Js(o)&&xn(o.pipe);function dw(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const dp=dw(),fp=typeof dp.FormData<"u"?dp.FormData:void 0,fw=o=>{if(!o)return!1;if(fp&&o instanceof fp)return!0;const e=Dl(o);if(!e||e===Object.prototype||!xn(o.append))return!1;const a=Ll(o);return a==="formdata"||a==="object"&&xn(o.toString)&&o.toString()==="[object FormData]"},hw=fa("URLSearchParams"),[gw,pw,mw,yw]=["ReadableStream","Request","Response","Headers"].map(fa),bw=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Qs(o,e,{allOwnKeys:a=!1}={}){if(o===null||typeof o>"u")return;let r,i;if(typeof o!="object"&&(o=[o]),Wi(o))for(r=0,i=o.length;r<i;r++)e.call(null,o[r],r,o);else{if(Xs(o))return;const l=a?Object.getOwnPropertyNames(o):Object.keys(o),u=l.length;let d;for(r=0;r<u;r++)d=l[r],e.call(null,o[d],d,o)}}function hp(o,e){if(Xs(o))return null;e=e.toLowerCase();const a=Object.keys(o);let r=a.length,i;for(;r-- >0;)if(i=a[r],e===i.toLowerCase())return i;return null}const li=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gp=o=>!Yi(o)&&o!==li;function id(...o){const{caseless:e,skipUndefined:a}=gp(this)&&this||{},r={},i=(l,u)=>{if(u==="__proto__"||u==="constructor"||u==="prototype")return;const d=e&&hp(r,u)||u,f=sd(r,d)?r[d]:void 0;$l(f)&&$l(l)?r[d]=id(f,l):$l(l)?r[d]=id({},l):Wi(l)?r[d]=l.slice():(!a||!Yi(l))&&(r[d]=l)};for(let l=0,u=o.length;l<u;l++)o[l]&&Qs(o[l],i);return r}const vw=(o,e,a,{allOwnKeys:r}={})=>(Qs(e,(i,l)=>{a&&xn(i)?Object.defineProperty(o,l,{__proto__:null,value:op(i,a),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(o,l,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),o),Sw=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),ww=(o,e,a,r)=>{o.prototype=Object.create(e.prototype,r),Object.defineProperty(o.prototype,"constructor",{__proto__:null,value:o,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(o,"super",{__proto__:null,value:e.prototype}),a&&Object.assign(o.prototype,a)},Cw=(o,e,a,r)=>{let i,l,u;const d={};if(e=e||{},o==null)return e;do{for(i=Object.getOwnPropertyNames(o),l=i.length;l-- >0;)u=i[l],(!r||r(u,o,e))&&!d[u]&&(e[u]=o[u],d[u]=!0);o=a!==!1&&Dl(o)}while(o&&(!a||a(o,e))&&o!==Object.prototype);return e},Ew=(o,e,a)=>{o=String(o),(a===void 0||a>o.length)&&(a=o.length),a-=e.length;const r=o.indexOf(e,a);return r!==-1&&r===a},_w=o=>{if(!o)return null;if(Wi(o))return o;let e=o.length;if(!up(e))return null;const a=new Array(e);for(;e-- >0;)a[e]=o[e];return a},Aw=(o=>e=>o&&e instanceof o)(typeof Uint8Array<"u"&&Dl(Uint8Array)),xw=(o,e)=>{const r=(o&&o[Ol]).call(o);let i;for(;(i=r.next())&&!i.done;){const l=i.value;e.call(o,l[0],l[1])}},Tw=(o,e)=>{let a;const r=[];for(;(a=o.exec(e))!==null;)r.push(a);return r},Rw=fa("HTMLFormElement"),kw=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,r,i){return r.toUpperCase()+i}),sd=(({hasOwnProperty:o})=>(e,a)=>o.call(e,a))(Object.prototype),Dw=fa("RegExp"),pp=(o,e)=>{const a=Object.getOwnPropertyDescriptors(o),r={};Qs(a,(i,l)=>{let u;(u=e(i,l,o))!==!1&&(r[l]=u||i)}),Object.defineProperties(o,r)},Ow=o=>{pp(o,(e,a)=>{if(xn(o)&&["arguments","caller","callee"].includes(a))return!1;const r=o[a];if(xn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},Lw=(o,e)=>{const a={},r=i=>{i.forEach(l=>{a[l]=!0})};return Wi(o)?r(o):r(String(o).split(e)),a},Mw=()=>{},$w=(o,e)=>o!=null&&Number.isFinite(o=+o)?o:e;function Nw(o){return!!(o&&xn(o.append)&&o[lp]==="FormData"&&o[Ol])}const Iw=o=>{const e=new WeakSet,a=r=>{if(Js(r)){if(e.has(r))return;if(Xs(r))return r;if(!("toJSON"in r)){e.add(r);const i=Wi(r)?[]:{};return Qs(r,(l,u)=>{const d=a(l);!Yi(d)&&(i[u]=d)}),e.delete(r),i}}return r};return a(o)},Hw=fa("AsyncFunction"),zw=o=>o&&(Js(o)||xn(o))&&xn(o.then)&&xn(o.catch),mp=((o,e)=>o?setImmediate:e?((a,r)=>(li.addEventListener("message",({source:i,data:l})=>{i===li&&l===a&&r.length&&r.shift()()},!1),i=>{r.push(i),li.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",xn(li.postMessage)),jw=typeof queueMicrotask<"u"?queueMicrotask.bind(li):typeof process<"u"&&process.nextTick||mp,F={isArray:Wi,isArrayBuffer:cp,isBuffer:Xs,isFormData:fw,isArrayBufferView:ew,isString:tw,isNumber:up,isBoolean:nw,isObject:Js,isPlainObject:$l,isEmptyObject:aw,isReadableStream:gw,isRequest:pw,isResponse:mw,isHeaders:yw,isUndefined:Yi,isDate:rw,isFile:iw,isReactNativeBlob:sw,isReactNative:ow,isBlob:lw,isRegExp:Dw,isFunction:xn,isStream:uw,isURLSearchParams:hw,isTypedArray:Aw,isFileList:cw,forEach:Qs,merge:id,extend:vw,trim:bw,stripBOM:Sw,inherits:ww,toFlatObject:Cw,kindOf:Ll,kindOfTest:fa,endsWith:Ew,toArray:_w,forEachEntry:xw,matchAll:Tw,isHTMLForm:Rw,hasOwnProperty:sd,hasOwnProp:sd,reduceDescriptors:pp,freezeMethods:Ow,toObjectSet:Lw,toCamelCase:kw,noop:Mw,toFiniteNumber:$w,findKey:hp,global:li,isContextDefined:gp,isSpecCompliantForm:Nw,toJSONObject:Iw,isAsyncFn:Hw,isThenable:zw,setImmediate:mp,asap:jw,isIterable:o=>o!=null&&xn(o[Ol])},Uw=F.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Bw=o=>{const e={};let a,r,i;return o&&o.split(`
`).forEach(function(u){i=u.indexOf(":"),a=u.substring(0,i).trim().toLowerCase(),r=u.substring(i+1).trim(),!(!a||e[a]&&Uw[a])&&(a==="set-cookie"?e[a]?e[a].push(r):e[a]=[r]:e[a]=e[a]?e[a]+", "+r:r)}),e};function qw(o){let e=0,a=o.length;for(;e<a;){const r=o.charCodeAt(e);if(r!==9&&r!==32)break;e+=1}for(;a>e;){const r=o.charCodeAt(a-1);if(r!==9&&r!==32)break;a-=1}return e===0&&a===o.length?o:o.slice(e,a)}const Pw=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),Gw=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function od(o,e){return F.isArray(o)?o.map(a=>od(a,e)):qw(String(o).replace(e,""))}const Vw=o=>od(o,Pw),Fw=o=>od(o,Gw);function yp(o){const e=Object.create(null);return F.forEach(o.toJSON(),(a,r)=>{e[r]=Fw(a)}),e}const bp=Symbol("internals");function Zs(o){return o&&String(o).trim().toLowerCase()}function Nl(o){return o===!1||o==null?o:F.isArray(o)?o.map(Nl):Vw(String(o))}function Kw(o){const e=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=a.exec(o);)e[r[1]]=r[2];return e}const Ww=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function ld(o,e,a,r,i){if(F.isFunction(r))return r.call(this,e,a);if(i&&(e=a),!!F.isString(e)){if(F.isString(r))return e.indexOf(r)!==-1;if(F.isRegExp(r))return r.test(e)}}function Yw(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,a,r)=>a.toUpperCase()+r)}function Xw(o,e){const a=F.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(o,r+a,{__proto__:null,value:function(i,l,u){return this[r].call(this,e,i,l,u)},configurable:!0})})}let Cn=class{constructor(e){e&&this.set(e)}set(e,a,r){const i=this;function l(d,f,g){const m=Zs(f);if(!m)throw new Error("header name must be a non-empty string");const b=F.findKey(i,m);(!b||i[b]===void 0||g===!0||g===void 0&&i[b]!==!1)&&(i[b||f]=Nl(d))}const u=(d,f)=>F.forEach(d,(g,m)=>l(g,m,f));if(F.isPlainObject(e)||e instanceof this.constructor)u(e,a);else if(F.isString(e)&&(e=e.trim())&&!Ww(e))u(Bw(e),a);else if(F.isObject(e)&&F.isIterable(e)){let d={},f,g;for(const m of e){if(!F.isArray(m))throw TypeError("Object iterator must return a key-value pair");d[g=m[0]]=(f=d[g])?F.isArray(f)?[...f,m[1]]:[f,m[1]]:m[1]}u(d,a)}else e!=null&&l(a,e,r);return this}get(e,a){if(e=Zs(e),e){const r=F.findKey(this,e);if(r){const i=this[r];if(!a)return i;if(a===!0)return Kw(i);if(F.isFunction(a))return a.call(this,i,r);if(F.isRegExp(a))return a.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,a){if(e=Zs(e),e){const r=F.findKey(this,e);return!!(r&&this[r]!==void 0&&(!a||ld(this,this[r],r,a)))}return!1}delete(e,a){const r=this;let i=!1;function l(u){if(u=Zs(u),u){const d=F.findKey(r,u);d&&(!a||ld(r,r[d],d,a))&&(delete r[d],i=!0)}}return F.isArray(e)?e.forEach(l):l(e),i}clear(e){const a=Object.keys(this);let r=a.length,i=!1;for(;r--;){const l=a[r];(!e||ld(this,this[l],l,e,!0))&&(delete this[l],i=!0)}return i}normalize(e){const a=this,r={};return F.forEach(this,(i,l)=>{const u=F.findKey(r,l);if(u){a[u]=Nl(i),delete a[l];return}const d=e?Yw(l):String(l).trim();d!==l&&delete a[l],a[d]=Nl(i),r[d]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const a=Object.create(null);return F.forEach(this,(r,i)=>{r!=null&&r!==!1&&(a[i]=e&&F.isArray(r)?r.join(", "):r)}),a}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,a])=>e+": "+a).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...a){const r=new this(e);return a.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[bp]=this[bp]={accessors:{}}).accessors,i=this.prototype;function l(u){const d=Zs(u);r[d]||(Xw(i,u),r[d]=!0)}return F.isArray(e)?e.forEach(l):l(e),this}};Cn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),F.reduceDescriptors(Cn.prototype,({value:o},e)=>{let a=e[0].toUpperCase()+e.slice(1);return{get:()=>o,set(r){this[a]=r}}}),F.freezeMethods(Cn);const Jw="[REDACTED ****]";function Qw(o){if(F.hasOwnProp(o,"toJSON"))return!0;let e=Object.getPrototypeOf(o);for(;e&&e!==Object.prototype;){if(F.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function Zw(o,e){const a=new Set(e.map(l=>String(l).toLowerCase())),r=[],i=l=>{if(l===null||typeof l!="object"||F.isBuffer(l))return l;if(r.indexOf(l)!==-1)return;l instanceof Cn&&(l=l.toJSON()),r.push(l);let u;if(F.isArray(l))u=[],l.forEach((d,f)=>{const g=i(d);F.isUndefined(g)||(u[f]=g)});else{if(!F.isPlainObject(l)&&Qw(l))return r.pop(),l;u=Object.create(null);for(const[d,f]of Object.entries(l)){const g=a.has(d.toLowerCase())?Jw:i(f);F.isUndefined(g)||(u[d]=g)}}return r.pop(),u};return i(o)}let Oe=class CS extends Error{static from(e,a,r,i,l,u){const d=new CS(e.message,a||e.code,r,i,l);return d.cause=e,d.name=e.name,e.status!=null&&d.status==null&&(d.status=e.status),u&&Object.assign(d,u),d}constructor(e,a,r,i,l){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,a&&(this.code=a),r&&(this.config=r),i&&(this.request=i),l&&(this.response=l,this.status=l.status)}toJSON(){const e=this.config,a=e&&F.hasOwnProp(e,"redact")?e.redact:void 0,r=F.isArray(a)&&a.length>0?Zw(e,a):F.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};Oe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Oe.ERR_BAD_OPTION="ERR_BAD_OPTION",Oe.ECONNABORTED="ECONNABORTED",Oe.ETIMEDOUT="ETIMEDOUT",Oe.ECONNREFUSED="ECONNREFUSED",Oe.ERR_NETWORK="ERR_NETWORK",Oe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Oe.ERR_DEPRECATED="ERR_DEPRECATED",Oe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Oe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Oe.ERR_CANCELED="ERR_CANCELED",Oe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Oe.ERR_INVALID_URL="ERR_INVALID_URL",Oe.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const e0=null;function cd(o){return F.isPlainObject(o)||F.isArray(o)}function vp(o){return F.endsWith(o,"[]")?o.slice(0,-2):o}function ud(o,e,a){return o?o.concat(e).map(function(i,l){return i=vp(i),!a&&l?"["+i+"]":i}).join(a?".":""):e}function t0(o){return F.isArray(o)&&!o.some(cd)}const n0=F.toFlatObject(F,{},null,function(e){return/^is[A-Z]/.test(e)});function Il(o,e,a){if(!F.isObject(o))throw new TypeError("target must be an object");e=e||new FormData,a=F.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,L){return!F.isUndefined(L[T])});const r=a.metaTokens,i=a.visitor||b,l=a.dots,u=a.indexes,d=a.Blob||typeof Blob<"u"&&Blob,f=a.maxDepth===void 0?100:a.maxDepth,g=d&&F.isSpecCompliantForm(e);if(!F.isFunction(i))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(F.isDate(A))return A.toISOString();if(F.isBoolean(A))return A.toString();if(!g&&F.isBlob(A))throw new Oe("Blob is not supported. Use a Buffer instead.");return F.isArrayBuffer(A)||F.isTypedArray(A)?g&&typeof Blob=="function"?new Blob([A]):Buffer.from(A):A}function b(A,T,L){let M=A;if(F.isReactNative(e)&&F.isReactNativeBlob(A))return e.append(ud(L,T,l),m(A)),!1;if(A&&!L&&typeof A=="object"){if(F.endsWith(T,"{}"))T=r?T:T.slice(0,-2),A=JSON.stringify(A);else if(F.isArray(A)&&t0(A)||(F.isFileList(A)||F.endsWith(T,"[]"))&&(M=F.toArray(A)))return T=vp(T),M.forEach(function(D,U){!(F.isUndefined(D)||D===null)&&e.append(u===!0?ud([T],U,l):u===null?T:T+"[]",m(D))}),!1}return cd(A)?!0:(e.append(ud(L,T,l),m(A)),!1)}const v=[],S=Object.assign(n0,{defaultVisitor:b,convertValue:m,isVisitable:cd});function E(A,T,L=0){if(!F.isUndefined(A)){if(L>f)throw new Oe("Object is too deeply nested ("+L+" levels). Max depth: "+f,Oe.ERR_FORM_DATA_DEPTH_EXCEEDED);if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+T.join("."));v.push(A),F.forEach(A,function(R,D){(!(F.isUndefined(R)||R===null)&&i.call(e,R,F.isString(D)?D.trim():D,T,S))===!0&&E(R,T?T.concat(D):[D],L+1)}),v.pop()}}if(!F.isObject(o))throw new TypeError("data must be an object");return E(o),e}function Sp(o){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(o).replace(/[!'()~]|%20/g,function(r){return e[r]})}function dd(o,e){this._pairs=[],o&&Il(o,this,e)}const wp=dd.prototype;wp.append=function(e,a){this._pairs.push([e,a])},wp.toString=function(e){const a=e?function(r){return e.call(this,r,Sp)}:Sp;return this._pairs.map(function(i){return a(i[0])+"="+a(i[1])},"").join("&")};function a0(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Cp(o,e,a){if(!e)return o;const r=a&&a.encode||a0,i=F.isFunction(a)?{serialize:a}:a,l=i&&i.serialize;let u;if(l?u=l(e,i):u=F.isURLSearchParams(e)?e.toString():new dd(e,i).toString(r),u){const d=o.indexOf("#");d!==-1&&(o=o.slice(0,d)),o+=(o.indexOf("?")===-1?"?":"&")+u}return o}class Ep{constructor(){this.handlers=[]}use(e,a,r){return this.handlers.push({fulfilled:e,rejected:a,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){F.forEach(this.handlers,function(r){r!==null&&e(r)})}}const fd={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},r0={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:dd,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},hd=typeof window<"u"&&typeof document<"u",gd=typeof navigator=="object"&&navigator||void 0,i0=hd&&(!gd||["ReactNative","NativeScript","NS"].indexOf(gd.product)<0),s0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",o0=hd&&window.location.href||"http://localhost",yn={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hd,hasStandardBrowserEnv:i0,hasStandardBrowserWebWorkerEnv:s0,navigator:gd,origin:o0},Symbol.toStringTag,{value:"Module"})),...r0};function l0(o,e){return Il(o,new yn.classes.URLSearchParams,{visitor:function(a,r,i,l){return yn.isNode&&F.isBuffer(a)?(this.append(r,a.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...e})}function c0(o){return F.matchAll(/\w+|\[(\w*)]/g,o).map(e=>e[0]==="[]"?"":e[1]||e[0])}function u0(o){const e={},a=Object.keys(o);let r;const i=a.length;let l;for(r=0;r<i;r++)l=a[r],e[l]=o[l];return e}function _p(o){function e(a,r,i,l){let u=a[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),f=l>=a.length;return u=!u&&F.isArray(i)?i.length:u,f?(F.hasOwnProp(i,u)?i[u]=F.isArray(i[u])?i[u].concat(r):[i[u],r]:i[u]=r,!d):((!F.hasOwnProp(i,u)||!F.isObject(i[u]))&&(i[u]=[]),e(a,r,i[u],l)&&F.isArray(i[u])&&(i[u]=u0(i[u])),!d)}if(F.isFormData(o)&&F.isFunction(o.entries)){const a={};return F.forEachEntry(o,(r,i)=>{e(c0(r),i,a,0)}),a}return null}const Xi=(o,e)=>o!=null&&F.hasOwnProp(o,e)?o[e]:void 0;function d0(o,e,a){if(F.isString(o))try{return(e||JSON.parse)(o),F.trim(o)}catch(r){if(r.name!=="SyntaxError")throw r}return(a||JSON.stringify)(o)}const eo={transitional:fd,adapter:["xhr","http","fetch"],transformRequest:[function(e,a){const r=a.getContentType()||"",i=r.indexOf("application/json")>-1,l=F.isObject(e);if(l&&F.isHTMLForm(e)&&(e=new FormData(e)),F.isFormData(e))return i?JSON.stringify(_p(e)):e;if(F.isArrayBuffer(e)||F.isBuffer(e)||F.isStream(e)||F.isFile(e)||F.isBlob(e)||F.isReadableStream(e))return e;if(F.isArrayBufferView(e))return e.buffer;if(F.isURLSearchParams(e))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let d;if(l){const f=Xi(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return l0(e,f).toString();if((d=F.isFileList(e))||r.indexOf("multipart/form-data")>-1){const g=Xi(this,"env"),m=g&&g.FormData;return Il(d?{"files[]":e}:e,m&&new m,f)}}return l||i?(a.setContentType("application/json",!1),d0(e)):e}],transformResponse:[function(e){const a=Xi(this,"transitional")||eo.transitional,r=a&&a.forcedJSONParsing,i=Xi(this,"responseType"),l=i==="json";if(F.isResponse(e)||F.isReadableStream(e))return e;if(e&&F.isString(e)&&(r&&!i||l)){const d=!(a&&a.silentJSONParsing)&&l;try{return JSON.parse(e,Xi(this,"parseReviver"))}catch(f){if(d)throw f.name==="SyntaxError"?Oe.from(f,Oe.ERR_BAD_RESPONSE,this,null,Xi(this,"response")):f}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:yn.classes.FormData,Blob:yn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};F.forEach(["delete","get","head","post","put","patch","query"],o=>{eo.headers[o]={}});function pd(o,e){const a=this||eo,r=e||a,i=Cn.from(r.headers);let l=r.data;return F.forEach(o,function(d){l=d.call(a,l,i.normalize(),e?e.status:void 0)}),i.normalize(),l}function Ap(o){return!!(o&&o.__CANCEL__)}let to=class extends Oe{constructor(e,a,r){super(e??"canceled",Oe.ERR_CANCELED,a,r),this.name="CanceledError",this.__CANCEL__=!0}};function xp(o,e,a){const r=a.config.validateStatus;!a.status||!r||r(a.status)?o(a):e(new Oe("Request failed with status code "+a.status,a.status>=400&&a.status<500?Oe.ERR_BAD_REQUEST:Oe.ERR_BAD_RESPONSE,a.config,a.request,a))}function f0(o){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(o);return e&&e[1]||""}function h0(o,e){o=o||10;const a=new Array(o),r=new Array(o);let i=0,l=0,u;return e=e!==void 0?e:1e3,function(f){const g=Date.now(),m=r[l];u||(u=g),a[i]=f,r[i]=g;let b=l,v=0;for(;b!==i;)v+=a[b++],b=b%o;if(i=(i+1)%o,i===l&&(l=(l+1)%o),g-u<e)return;const S=m&&g-m;return S?Math.round(v*1e3/S):void 0}}function g0(o,e){let a=0,r=1e3/e,i,l;const u=(g,m=Date.now())=>{a=m,i=null,l&&(clearTimeout(l),l=null),o(...g)};return[(...g)=>{const m=Date.now(),b=m-a;b>=r?u(g,m):(i=g,l||(l=setTimeout(()=>{l=null,u(i)},r-b)))},()=>i&&u(i)]}const Hl=(o,e,a=3)=>{let r=0;const i=h0(50,250);return g0(l=>{if(!l||typeof l.loaded!="number")return;const u=l.loaded,d=l.lengthComputable?l.total:void 0,f=d!=null?Math.min(u,d):u,g=Math.max(0,f-r),m=i(g);r=Math.max(r,f);const b={loaded:f,total:d,progress:d?f/d:void 0,bytes:g,rate:m||void 0,estimated:m&&d?(d-f)/m:void 0,event:l,lengthComputable:d!=null,[e?"download":"upload"]:!0};o(b)},a)},Tp=(o,e)=>{const a=o!=null;return[r=>e[0]({lengthComputable:a,total:o,loaded:r}),e[1]]},Rp=o=>(...e)=>F.asap(()=>o(...e)),p0=yn.hasStandardBrowserEnv?((o,e)=>a=>(a=new URL(a,yn.origin),o.protocol===a.protocol&&o.host===a.host&&(e||o.port===a.port)))(new URL(yn.origin),yn.navigator&&/(msie|trident)/i.test(yn.navigator.userAgent)):()=>!0,m0=yn.hasStandardBrowserEnv?{write(o,e,a,r,i,l,u){if(typeof document>"u")return;const d=[`${o}=${encodeURIComponent(e)}`];F.isNumber(a)&&d.push(`expires=${new Date(a).toUTCString()}`),F.isString(r)&&d.push(`path=${r}`),F.isString(i)&&d.push(`domain=${i}`),l===!0&&d.push("secure"),F.isString(u)&&d.push(`SameSite=${u}`),document.cookie=d.join("; ")},read(o){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let a=0;a<e.length;a++){const r=e[a].replace(/^\s+/,""),i=r.indexOf("=");if(i!==-1&&r.slice(0,i)===o)return decodeURIComponent(r.slice(i+1))}return null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function y0(o){return typeof o!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function b0(o,e){return e?o.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):o}function kp(o,e,a){let r=!y0(e);return o&&(r||a===!1)?b0(o,e):e}const Dp=o=>o instanceof Cn?{...o}:o;function ci(o,e){e=e||{};const a=Object.create(null);Object.defineProperty(a,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(g,m,b,v){return F.isPlainObject(g)&&F.isPlainObject(m)?F.merge.call({caseless:v},g,m):F.isPlainObject(m)?F.merge({},m):F.isArray(m)?m.slice():m}function i(g,m,b,v){if(F.isUndefined(m)){if(!F.isUndefined(g))return r(void 0,g,b,v)}else return r(g,m,b,v)}function l(g,m){if(!F.isUndefined(m))return r(void 0,m)}function u(g,m){if(F.isUndefined(m)){if(!F.isUndefined(g))return r(void 0,g)}else return r(void 0,m)}function d(g,m,b){if(F.hasOwnProp(e,b))return r(g,m);if(F.hasOwnProp(o,b))return r(void 0,g)}const f={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,allowedSocketPaths:u,responseEncoding:u,validateStatus:d,headers:(g,m,b)=>i(Dp(g),Dp(m),b,!0)};return F.forEach(Object.keys({...o,...e}),function(m){if(m==="__proto__"||m==="constructor"||m==="prototype")return;const b=F.hasOwnProp(f,m)?f[m]:i,v=F.hasOwnProp(o,m)?o[m]:void 0,S=F.hasOwnProp(e,m)?e[m]:void 0,E=b(v,S,m);F.isUndefined(E)&&b!==d||(a[m]=E)}),a}const v0=["content-type","content-length"];function S0(o,e,a){if(a!=="content-only"){o.set(e);return}Object.entries(e).forEach(([r,i])=>{v0.includes(r.toLowerCase())&&o.set(r,i)})}const w0=o=>encodeURIComponent(o).replace(/%([0-9A-F]{2})/gi,(e,a)=>String.fromCharCode(parseInt(a,16))),Op=o=>{const e=ci({},o),a=v=>F.hasOwnProp(e,v)?e[v]:void 0,r=a("data");let i=a("withXSRFToken");const l=a("xsrfHeaderName"),u=a("xsrfCookieName");let d=a("headers");const f=a("auth"),g=a("baseURL"),m=a("allowAbsoluteUrls"),b=a("url");if(e.headers=d=Cn.from(d),e.url=Cp(kp(g,b,m),o.params,o.paramsSerializer),f&&d.set("Authorization","Basic "+btoa((f.username||"")+":"+(f.password?w0(f.password):""))),F.isFormData(r)&&(yn.hasStandardBrowserEnv||yn.hasStandardBrowserWebWorkerEnv?d.setContentType(void 0):F.isFunction(r.getHeaders)&&S0(d,r.getHeaders(),a("formDataHeaderPolicy"))),yn.hasStandardBrowserEnv&&(F.isFunction(i)&&(i=i(e)),i===!0||i==null&&p0(e.url))){const S=l&&u&&m0.read(u);S&&d.set(l,S)}return e},C0=typeof XMLHttpRequest<"u"&&function(o){return new Promise(function(a,r){const i=Op(o);let l=i.data;const u=Cn.from(i.headers).normalize();let{responseType:d,onUploadProgress:f,onDownloadProgress:g}=i,m,b,v,S,E;function A(){S&&S(),E&&E(),i.cancelToken&&i.cancelToken.unsubscribe(m),i.signal&&i.signal.removeEventListener("abort",m)}let T=new XMLHttpRequest;T.open(i.method.toUpperCase(),i.url,!0),T.timeout=i.timeout;function L(){if(!T)return;const R=Cn.from("getAllResponseHeaders"in T&&T.getAllResponseHeaders()),U={data:!d||d==="text"||d==="json"?T.responseText:T.response,status:T.status,statusText:T.statusText,headers:R,config:o,request:T};xp(function(q){a(q),A()},function(q){r(q),A()},U),T=null}"onloadend"in T?T.onloadend=L:T.onreadystatechange=function(){!T||T.readyState!==4||T.status===0&&!(T.responseURL&&T.responseURL.startsWith("file:"))||setTimeout(L)},T.onabort=function(){T&&(r(new Oe("Request aborted",Oe.ECONNABORTED,o,T)),A(),T=null)},T.onerror=function(D){const U=D&&D.message?D.message:"Network Error",j=new Oe(U,Oe.ERR_NETWORK,o,T);j.event=D||null,r(j),A(),T=null},T.ontimeout=function(){let D=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const U=i.transitional||fd;i.timeoutErrorMessage&&(D=i.timeoutErrorMessage),r(new Oe(D,U.clarifyTimeoutError?Oe.ETIMEDOUT:Oe.ECONNABORTED,o,T)),A(),T=null},l===void 0&&u.setContentType(null),"setRequestHeader"in T&&F.forEach(yp(u),function(D,U){T.setRequestHeader(U,D)}),F.isUndefined(i.withCredentials)||(T.withCredentials=!!i.withCredentials),d&&d!=="json"&&(T.responseType=i.responseType),g&&([v,E]=Hl(g,!0),T.addEventListener("progress",v)),f&&T.upload&&([b,S]=Hl(f),T.upload.addEventListener("progress",b),T.upload.addEventListener("loadend",S)),(i.cancelToken||i.signal)&&(m=R=>{T&&(r(!R||R.type?new to(null,o,T):R),T.abort(),A(),T=null)},i.cancelToken&&i.cancelToken.subscribe(m),i.signal&&(i.signal.aborted?m():i.signal.addEventListener("abort",m)));const M=f0(i.url);if(M&&!yn.protocols.includes(M)){r(new Oe("Unsupported protocol "+M+":",Oe.ERR_BAD_REQUEST,o));return}T.send(l||null)})},E0=(o,e)=>{if(o=o?o.filter(Boolean):[],!e&&!o.length)return;const a=new AbortController;let r=!1;const i=function(f){if(!r){r=!0,u();const g=f instanceof Error?f:this.reason;a.abort(g instanceof Oe?g:new to(g instanceof Error?g.message:g))}};let l=e&&setTimeout(()=>{l=null,i(new Oe(`timeout of ${e}ms exceeded`,Oe.ETIMEDOUT))},e);const u=()=>{o&&(l&&clearTimeout(l),l=null,o.forEach(f=>{f.unsubscribe?f.unsubscribe(i):f.removeEventListener("abort",i)}),o=null)};o.forEach(f=>f.addEventListener("abort",i));const{signal:d}=a;return d.unsubscribe=()=>F.asap(u),d},_0=function*(o,e){let a=o.byteLength;if(a<e){yield o;return}let r=0,i;for(;r<a;)i=r+e,yield o.slice(r,i),r=i},A0=async function*(o,e){for await(const a of x0(o))yield*_0(a,e)},x0=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const e=o.getReader();try{for(;;){const{done:a,value:r}=await e.read();if(a)break;yield r}}finally{await e.cancel()}},Lp=(o,e,a,r)=>{const i=A0(o,e);let l=0,u,d=f=>{u||(u=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:g,value:m}=await i.next();if(g){d(),f.close();return}let b=m.byteLength;if(a){let v=l+=b;a(v)}f.enqueue(new Uint8Array(m))}catch(g){throw d(g),g}},cancel(f){return d(f),i.return()}},{highWaterMark:2})};function T0(o){if(!o||typeof o!="string"||!o.startsWith("data:"))return 0;const e=o.indexOf(",");if(e<0)return 0;const a=o.slice(5,e),r=o.slice(e+1);if(/;base64/i.test(a)){let u=r.length;const d=r.length;for(let S=0;S<d;S++)if(r.charCodeAt(S)===37&&S+2<d){const E=r.charCodeAt(S+1),A=r.charCodeAt(S+2);(E>=48&&E<=57||E>=65&&E<=70||E>=97&&E<=102)&&(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102)&&(u-=2,S+=2)}let f=0,g=d-1;const m=S=>S>=2&&r.charCodeAt(S-2)===37&&r.charCodeAt(S-1)===51&&(r.charCodeAt(S)===68||r.charCodeAt(S)===100);g>=0&&(r.charCodeAt(g)===61?(f++,g--):m(g)&&(f++,g-=3)),f===1&&g>=0&&(r.charCodeAt(g)===61||m(g))&&f++;const v=Math.floor(u/4)*3-(f||0);return v>0?v:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(r,"utf8");let l=0;for(let u=0,d=r.length;u<d;u++){const f=r.charCodeAt(u);if(f<128)l+=1;else if(f<2048)l+=2;else if(f>=55296&&f<=56319&&u+1<d){const g=r.charCodeAt(u+1);g>=56320&&g<=57343?(l+=4,u++):l+=3}else l+=3}return l}const md="1.16.1",Mp=64*1024,{isFunction:zl}=F,$p=(o,...e)=>{try{return!!o(...e)}catch{return!1}},R0=o=>{const e=F.global!==void 0&&F.global!==null?F.global:globalThis,{ReadableStream:a,TextEncoder:r}=e;o=F.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},o);const{fetch:i,Request:l,Response:u}=o,d=i?zl(i):typeof fetch=="function",f=zl(l),g=zl(u);if(!d)return!1;const m=d&&zl(a),b=d&&(typeof r=="function"?(L=>M=>L.encode(M))(new r):async L=>new Uint8Array(await new l(L).arrayBuffer())),v=f&&m&&$p(()=>{let L=!1;const M=new l(yn.origin,{body:new a,method:"POST",get duplex(){return L=!0,"half"}}),R=M.headers.has("Content-Type");return M.body!=null&&M.body.cancel(),L&&!R}),S=g&&m&&$p(()=>F.isReadableStream(new u("").body)),E={stream:S&&(L=>L.body)};d&&["text","arrayBuffer","blob","formData","stream"].forEach(L=>{!E[L]&&(E[L]=(M,R)=>{let D=M&&M[L];if(D)return D.call(M);throw new Oe(`Response type '${L}' is not supported`,Oe.ERR_NOT_SUPPORT,R)})});const A=async L=>{if(L==null)return 0;if(F.isBlob(L))return L.size;if(F.isSpecCompliantForm(L))return(await new l(yn.origin,{method:"POST",body:L}).arrayBuffer()).byteLength;if(F.isArrayBufferView(L)||F.isArrayBuffer(L))return L.byteLength;if(F.isURLSearchParams(L)&&(L=L+""),F.isString(L))return(await b(L)).byteLength},T=async(L,M)=>{const R=F.toFiniteNumber(L.getContentLength());return R??A(M)};return async L=>{let{url:M,method:R,data:D,signal:U,cancelToken:j,timeout:q,onDownloadProgress:X,onUploadProgress:ge,responseType:Ee,headers:Ce,withCredentials:$e="same-origin",fetchOptions:qe,maxContentLength:Xe,maxBodyLength:ht}=Op(L);const Q=F.isNumber(Xe)&&Xe>-1,fe=F.isNumber(ht)&&ht>-1;let ye=i||fetch;Ee=Ee?(Ee+"").toLowerCase():"text";let te=E0([U,j&&j.toAbortSignal()],q),he=null;const x=te&&te.unsubscribe&&(()=>{te.unsubscribe()});let K;try{if(Q&&typeof M=="string"&&M.startsWith("data:")&&T0(M)>Xe)throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he);if(fe&&R!=="get"&&R!=="head"){const ve=await T(Ce,D);if(typeof ve=="number"&&isFinite(ve)&&ve>ht)throw new Oe("Request body larger than maxBodyLength limit",Oe.ERR_BAD_REQUEST,L,he)}if(ge&&v&&R!=="get"&&R!=="head"&&(K=await T(Ce,D))!==0){let ve=new l(M,{method:"POST",body:D,duplex:"half"}),He;if(F.isFormData(D)&&(He=ve.headers.get("content-type"))&&Ce.setContentType(He),ve.body){const[Ae,Et]=Tp(K,Hl(Rp(ge)));D=Lp(ve.body,Mp,Ae,Et)}}F.isString($e)||($e=$e?"include":"omit");const re=f&&"credentials"in l.prototype;if(F.isFormData(D)){const ve=Ce.getContentType();ve&&/^multipart\/form-data/i.test(ve)&&!/boundary=/i.test(ve)&&Ce.delete("content-type")}Ce.set("User-Agent","axios/"+md,!1);const de={...qe,signal:te,method:R.toUpperCase(),headers:yp(Ce.normalize()),body:D,duplex:"half",credentials:re?$e:void 0};he=f&&new l(M,de);let se=await(f?ye(he,qe):ye(M,de));if(Q){const ve=F.toFiniteNumber(se.headers.get("content-length"));if(ve!=null&&ve>Xe)throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he)}const me=S&&(Ee==="stream"||Ee==="response");if(S&&se.body&&(X||Q||me&&x)){const ve={};["status","statusText","headers"].forEach(ft=>{ve[ft]=se[ft]});const He=F.toFiniteNumber(se.headers.get("content-length")),[Ae,Et]=X&&Tp(He,Hl(Rp(X),!0))||[];let Rt=0;const _t=ft=>{if(Q&&(Rt=ft,Rt>Xe))throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he);Ae&&Ae(ft)};se=new u(Lp(se.body,Mp,_t,()=>{Et&&Et(),x&&x()}),ve)}Ee=Ee||"text";let Ne=await E[F.findKey(E,Ee)||"text"](se,L);if(Q&&!S&&!me){let ve;if(Ne!=null&&(typeof Ne.byteLength=="number"?ve=Ne.byteLength:typeof Ne.size=="number"?ve=Ne.size:typeof Ne=="string"&&(ve=typeof r=="function"?new r().encode(Ne).byteLength:Ne.length)),typeof ve=="number"&&ve>Xe)throw new Oe("maxContentLength size of "+Xe+" exceeded",Oe.ERR_BAD_RESPONSE,L,he)}return!me&&x&&x(),await new Promise((ve,He)=>{xp(ve,He,{data:Ne,headers:Cn.from(se.headers),status:se.status,statusText:se.statusText,config:L,request:he})})}catch(re){if(x&&x(),te&&te.aborted&&te.reason instanceof Oe){const de=te.reason;throw de.config=L,he&&(de.request=he),re!==de&&(de.cause=re),de}throw re&&re.name==="TypeError"&&/Load failed|fetch/i.test(re.message)?Object.assign(new Oe("Network Error",Oe.ERR_NETWORK,L,he,re&&re.response),{cause:re.cause||re}):Oe.from(re,re&&re.code,L,he,re&&re.response)}}},k0=new Map,Np=o=>{let e=o&&o.env||{};const{fetch:a,Request:r,Response:i}=e,l=[r,i,a];let u=l.length,d=u,f,g,m=k0;for(;d--;)f=l[d],g=m.get(f),g===void 0&&m.set(f,g=d?new Map:R0(e)),m=g;return g};Np();const yd={http:e0,xhr:C0,fetch:{get:Np}};F.forEach(yd,(o,e)=>{if(o){try{Object.defineProperty(o,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(o,"adapterName",{__proto__:null,value:e})}});const Ip=o=>`- ${o}`,D0=o=>F.isFunction(o)||o===null||o===!1;function O0(o,e){o=F.isArray(o)?o:[o];const{length:a}=o;let r,i;const l={};for(let u=0;u<a;u++){r=o[u];let d;if(i=r,!D0(r)&&(i=yd[(d=String(r)).toLowerCase()],i===void 0))throw new Oe(`Unknown adapter '${d}'`);if(i&&(F.isFunction(i)||(i=i.get(e))))break;l[d||"#"+u]=i}if(!i){const u=Object.entries(l).map(([f,g])=>`adapter ${f} `+(g===!1?"is not supported by the environment":"is not available in the build"));let d=a?u.length>1?`since :
`+u.map(Ip).join(`
`):" "+Ip(u[0]):"as no adapter specified";throw new Oe("There is no suitable adapter to dispatch the request "+d,"ERR_NOT_SUPPORT")}return i}const Hp={getAdapter:O0,adapters:yd};function bd(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new to(null,o)}function zp(o){return bd(o),o.headers=Cn.from(o.headers),o.data=pd.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),Hp.getAdapter(o.adapter||eo.adapter,o)(o).then(function(r){bd(o),o.response=r;try{r.data=pd.call(o,o.transformResponse,r)}finally{delete o.response}return r.headers=Cn.from(r.headers),r},function(r){if(!Ap(r)&&(bd(o),r&&r.response)){o.response=r.response;try{r.response.data=pd.call(o,o.transformResponse,r.response)}finally{delete o.response}r.response.headers=Cn.from(r.response.headers)}return Promise.reject(r)})}const jl={};["object","boolean","number","function","string","symbol"].forEach((o,e)=>{jl[o]=function(r){return typeof r===o||"a"+(e<1?"n ":" ")+o}});const jp={};jl.transitional=function(e,a,r){function i(l,u){return"[Axios v"+md+"] Transitional option '"+l+"'"+u+(r?". "+r:"")}return(l,u,d)=>{if(e===!1)throw new Oe(i(u," has been removed"+(a?" in "+a:"")),Oe.ERR_DEPRECATED);return a&&!jp[u]&&(jp[u]=!0,console.warn(i(u," has been deprecated since v"+a+" and will be removed in the near future"))),e?e(l,u,d):!0}},jl.spelling=function(e){return(a,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function L0(o,e,a){if(typeof o!="object")throw new Oe("options must be an object",Oe.ERR_BAD_OPTION_VALUE);const r=Object.keys(o);let i=r.length;for(;i-- >0;){const l=r[i],u=Object.prototype.hasOwnProperty.call(e,l)?e[l]:void 0;if(u){const d=o[l],f=d===void 0||u(d,l,o);if(f!==!0)throw new Oe("option "+l+" must be "+f,Oe.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new Oe("Unknown option "+l,Oe.ERR_BAD_OPTION)}}const Ul={assertOptions:L0,validators:jl},Jn=Ul.validators;let ui=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ep,response:new Ep}}async request(e,a){try{return await this._request(e,a)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const l=(()=>{if(!i.stack)return"";const u=i.stack.indexOf(`
`);return u===-1?"":i.stack.slice(u+1)})();try{if(!r.stack)r.stack=l;else if(l){const u=l.indexOf(`
`),d=u===-1?-1:l.indexOf(`
`,u+1),f=d===-1?"":l.slice(d+1);String(r.stack).endsWith(f)||(r.stack+=`
`+l)}}catch{}}throw r}}_request(e,a){typeof e=="string"?(a=a||{},a.url=e):a=e||{},a=ci(this.defaults,a);const{transitional:r,paramsSerializer:i,headers:l}=a;r!==void 0&&Ul.assertOptions(r,{silentJSONParsing:Jn.transitional(Jn.boolean),forcedJSONParsing:Jn.transitional(Jn.boolean),clarifyTimeoutError:Jn.transitional(Jn.boolean),legacyInterceptorReqResOrdering:Jn.transitional(Jn.boolean)},!1),i!=null&&(F.isFunction(i)?a.paramsSerializer={serialize:i}:Ul.assertOptions(i,{encode:Jn.function,serialize:Jn.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),Ul.assertOptions(a,{baseUrl:Jn.spelling("baseURL"),withXsrfToken:Jn.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let u=l&&F.merge(l.common,l[a.method]);l&&F.forEach(["delete","get","head","post","put","patch","query","common"],E=>{delete l[E]}),a.headers=Cn.concat(u,l);const d=[];let f=!0;this.interceptors.request.forEach(function(A){if(typeof A.runWhen=="function"&&A.runWhen(a)===!1)return;f=f&&A.synchronous;const T=a.transitional||fd;T&&T.legacyInterceptorReqResOrdering?d.unshift(A.fulfilled,A.rejected):d.push(A.fulfilled,A.rejected)});const g=[];this.interceptors.response.forEach(function(A){g.push(A.fulfilled,A.rejected)});let m,b=0,v;if(!f){const E=[zp.bind(this),void 0];for(E.unshift(...d),E.push(...g),v=E.length,m=Promise.resolve(a);b<v;)m=m.then(E[b++],E[b++]);return m}v=d.length;let S=a;for(;b<v;){const E=d[b++],A=d[b++];try{S=E(S)}catch(T){A.call(this,T);break}}try{m=zp.call(this,S)}catch(E){return Promise.reject(E)}for(b=0,v=g.length;b<v;)m=m.then(g[b++],g[b++]);return m}getUri(e){e=ci(this.defaults,e);const a=kp(e.baseURL,e.url,e.allowAbsoluteUrls);return Cp(a,e.params,e.paramsSerializer)}};F.forEach(["delete","get","head","options"],function(e){ui.prototype[e]=function(a,r){return this.request(ci(r||{},{method:e,url:a,data:(r||{}).data}))}}),F.forEach(["post","put","patch","query"],function(e){function a(r){return function(l,u,d){return this.request(ci(d||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}ui.prototype[e]=a(),e!=="query"&&(ui.prototype[e+"Form"]=a(!0))});let M0=class ES{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(l){a=l});const r=this;this.promise.then(i=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](i);r._listeners=null}),this.promise.then=i=>{let l;const u=new Promise(d=>{r.subscribe(d),l=d}).then(i);return u.cancel=function(){r.unsubscribe(l)},u},e(function(l,u,d){r.reason||(r.reason=new to(l,u,d),a(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const a=this._listeners.indexOf(e);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const e=new AbortController,a=r=>{e.abort(r)};return this.subscribe(a),e.signal.unsubscribe=()=>this.unsubscribe(a),e.signal}static source(){let e;return{token:new ES(function(i){e=i}),cancel:e}}};function $0(o){return function(a){return o.apply(null,a)}}function N0(o){return F.isObject(o)&&o.isAxiosError===!0}const vd={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(vd).forEach(([o,e])=>{vd[e]=o});function Up(o){const e=new ui(o),a=op(ui.prototype.request,e);return F.extend(a,ui.prototype,e,{allOwnKeys:!0}),F.extend(a,e,null,{allOwnKeys:!0}),a.create=function(i){return Up(ci(o,i))},a}const qt=Up(eo);qt.Axios=ui,qt.CanceledError=to,qt.CancelToken=M0,qt.isCancel=Ap,qt.VERSION=md,qt.toFormData=Il,qt.AxiosError=Oe,qt.Cancel=qt.CanceledError,qt.all=function(e){return Promise.all(e)},qt.spread=$0,qt.isAxiosError=N0,qt.mergeConfig=ci,qt.AxiosHeaders=Cn,qt.formToJSON=o=>_p(F.isHTMLForm(o)?new FormData(o):o),qt.getAdapter=Hp.getAdapter,qt.HttpStatusCode=vd,qt.default=qt;const{Axios:Jx,AxiosError:Qx,CanceledError:Zx,isCancel:eT,CancelToken:tT,VERSION:nT,all:aT,Cancel:rT,isAxiosError:iT,spread:sT,toFormData:oT,AxiosHeaders:lT,HttpStatusCode:cT,formToJSON:uT,getAdapter:dT,mergeConfig:fT,create:hT}=qt,Sd="g7.identity.redirectStash",Bl=ct("IdentityGuardInterceptor");class St{static setLauncher(e){this.launcher=e}static hasLauncher(){return this.launcher!==null}static markDomainNoticeShown(){this.domainNoticeShown=!0}static consumeDomainNoticeShown(){const e=this.domainNoticeShown;return this.domainNoticeShown=!1,e}static resolveDeferred(e){const a=this.deferredResolver;if(!a){Bl.warn("IdentityGuardInterceptor.resolveDeferred 호출됐지만 대기 중인 launcher 가 없습니다. 모달이 launcher 외부에서 열렸는지 확인하세요.");return}this.deferredResolver=null,a(e)}static createDeferred(){if(this.deferredResolver){const e=this.deferredResolver;this.deferredResolver=null,e({status:"cancelled"})}return new Promise(e=>{this.deferredResolver=e})}static isIdentityRequired(e,a){return e===428&&typeof a=="object"&&a!==null&&a.error_code==="identity_verification_required"}static async handle(e,a,r){this.domainNoticeShown=!1;const i=this.launcher??H0,u=!!(r&&(r.email||r.phone))?{...e.verification,target:r}:e.verification,d=await i(u);if(d.status!=="verified")return null;const f=u.return_request;if(!f)return null;const g=I0(f.url,d.token);return fetch(g,{method:f.method,headers:a?.headers??{Accept:"application/json","Content-Type":"application/json"},body:a?.body,credentials:a?.credentials??"same-origin"})}static redirectExternally(e){const a=e.redirect_url;if(!a)return Bl.error("redirectExternally 호출 시 verification.redirect_url 이 없습니다. payload:",e),Promise.resolve({status:"failed",failureCode:"MISSING_REDIRECT_URL",reason:"verification.redirect_url is required for external_redirect flow"});if(typeof window<"u"){const r={return_url:window.location.href,payload:e,stashed_at:Date.now()};try{window.sessionStorage?.setItem(Sd,JSON.stringify(r))}catch(i){Bl.warn("sessionStorage 접근 실패 — stash 없이 redirect 합니다.",i)}window.location.href=a}return new Promise(()=>{})}static reset(){if(this.deferredResolver){const e=this.deferredResolver;this.deferredResolver=null;try{e({status:"cancelled"})}catch{}}this.launcher=null,this.domainNoticeShown=!1}}$(St,"launcher",null),$(St,"deferredResolver",null),$(St,"domainNoticeShown",!1);function I0(o,e){if(!e)return o;try{const a=typeof window<"u"?window.location.origin:"http://localhost",r=new URL(o,a);return r.searchParams.set("verification_token",e),/^https?:\/\//i.test(o)?r.toString():`${r.pathname}${r.search}${r.hash}`}catch{const a=o.includes("?")?"&":"?";return`${o}${a}verification_token=${encodeURIComponent(e)}`}}const H0=async o=>{if(typeof window>"u")return{status:"cancelled"};if(o.render_hint==="external_redirect"||o.redirect_url)return St.redirectExternally(o);const e=window.G7Core;if(!e?.dispatch)return console.error("[IdentityGuardInterceptor] defaultLauncher: G7Core 가 초기화되지 않아 본인인증 흐름을 시작할 수 없습니다."),{status:"failed",failureCode:"G7_NOT_READY"};try{await e.dispatch({handler:"toast",params:{message:"본인 확인이 필요합니다.",variant:"warning"}})}catch{}const a=window.location.href,r={return_url:a,payload:o,stashed_at:Date.now()};try{window.sessionStorage?.setItem(Sd,JSON.stringify(r))}catch{}const i=`/identity/challenge?return=${encodeURIComponent(a)}`;try{await e.dispatch({handler:"navigate",params:{path:i}})}catch(l){Bl.warn("navigate 실패 — window.location 으로 폴백",l),window.location.href=i}return new Promise(()=>{})},z0=ct("ApiClient");function wd(){return typeof window<"u"&&window.__G7_DEVTOOLS__?window.__G7_DEVTOOLS__:null}class j0{constructor(e={}){$(this,"client");$(this,"config");$(this,"TOKEN_KEY","auth_token");this.config={baseURL:e.baseURL||"/api",timeout:e.timeout||3e4,onTokenExpired:e.onTokenExpired,onUnauthorized:e.onUnauthorized,onError:e.onError},this.client=qt.create({baseURL:this.config.baseURL,timeout:this.config.timeout,headers:{"Content-Type":"application/json",Accept:"application/json"},paramsSerializer:{serialize:a=>{const r=[];for(const[i,l]of Object.entries(a))if(l!=null)if(Array.isArray(l)){const u=i.endsWith("[]")?i:`${i}[]`;for(const d of l)r.push(`${encodeURIComponent(u)}=${encodeURIComponent(String(d))}`)}else r.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(l))}`);return r.join("&")}}}),this.setupInterceptors()}setToken(e){typeof window<"u"&&localStorage.setItem(this.TOKEN_KEY,e)}getToken(){return typeof window<"u"?localStorage.getItem(this.TOKEN_KEY):null}removeToken(){typeof window<"u"&&localStorage.removeItem(this.TOKEN_KEY)}setupInterceptors(){this.client.interceptors.request.use(e=>{e.url?.startsWith("/api")&&e.baseURL==="/api"&&(e.baseURL="");const a=this.getToken();if(a&&e.headers&&(e.headers.Authorization=`Bearer ${a}`),typeof window<"u"&&e.headers){const i=localStorage.getItem("g7_locale");i&&(e.headers["Accept-Language"]=i)}const r=wd();if(r?.isEnabled()){const i=this.buildFullUrl(e),l=(e.method||"GET").toUpperCase(),u=r.trackRequest(i,l,{requestBody:e.data});e._devToolsRequestId=u}return e},e=>Promise.reject(e)),this.client.interceptors.response.use(e=>{const a=e.config,r=a._devToolsRequestId;if(r){const i=wd();i?.isEnabled()&&i.completeRequest(r,e.status,e.data),a._devToolsRequestId=null}return e},async e=>{const a=e.config,r=a?.url||"",l=["/auth/","/layouts/"].some(u=>r.includes(u));if(e.response?.status===401&&!a?._retry&&!l){if(a._retry=!0,await ha.getInstance().refreshToken()){const f=this.getToken();return f&&(a.headers.Authorization=`Bearer ${f}`),a._devToolsRequestId=null,this.client(a)}return this.completeDevToolsRequest(a,e),this.removeToken(),this.config.onUnauthorized&&this.config.onUnauthorized(),Promise.reject(e)}if(e.response?.status===401&&l)return this.completeDevToolsRequest(a,e),Promise.reject(e);if(St.isIdentityRequired(e.response?.status,e.response?.data)){this.completeDevToolsRequest(a,e);const u={},d=a?.headers??{};for(const[v,S]of Object.entries(d))typeof S=="string"&&(u[v]=S);let f;a?.data!==void 0&&a?.data!==null&&(f=typeof a.data=="string"?a.data:JSON.stringify(a.data),u["Content-Type"]=u["Content-Type"]??"application/json");const g=a?.identity_target,m=await St.handle(e.response.data,{headers:u,body:f,credentials:"same-origin"},g);if(!m)return Promise.reject(e);let b=null;try{b=await m.json()}catch{b=null}return m.ok?{...e.response,status:m.status,data:b}:Promise.reject(Object.assign(new Error("replay failed"),{response:{status:m.status,data:b}}))}return e.response?.status===403?(this.completeDevToolsRequest(a,e),this.callOnError(e),Promise.reject(e)):(this.completeDevToolsRequest(a,e),e.response&&this.callOnError(e),Promise.reject(e))})}async get(e,a){return(await this.client.get(e,a)).data}async post(e,a,r){return(await this.client.post(e,a,r)).data}async put(e,a,r){return(await this.client.put(e,a,r)).data}async patch(e,a,r){return(await this.client.patch(e,a,r)).data}async delete(e,a){return(await this.client.delete(e,a)).data}getInstance(){return this.client}setOnUnauthorized(e){this.config.onUnauthorized=e}setOnError(e){this.config.onError=e}completeDevToolsRequest(e,a){if(!e?._devToolsRequestId)return;const r=wd();if(!r?.isEnabled())return;const i=e._devToolsRequestId;e._devToolsRequestId=null,a.response?r.completeRequest(i,a.response.status,a.response.data):a.request?r.failRequest(i,a.message||"Network error"):r.failRequest(i,a.message||"Request error")}buildFullUrl(e){let a=e.url||"";if(e.baseURL&&!a.startsWith("http")&&(a=`${e.baseURL}${a.startsWith("/")?"":"/"}${a}`),e.params&&typeof e.params=="object"){const r=e.params,i=[];for(const[l,u]of Object.entries(r))if(u!=null)if(Array.isArray(u)){const d=l.endsWith("[]")?l:`${l}[]`;for(const f of u)i.push(`${encodeURIComponent(d)}=${encodeURIComponent(String(f))}`)}else i.push(`${encodeURIComponent(l)}=${encodeURIComponent(String(u))}`);i.length>0&&(a+=(a.includes("?")?"&":"?")+i.join("&"))}return a}callOnError(e){if(!this.config.onError)return;const a={status:e.response?.status||0,message:e.response?.data?.message||e.message||"Unknown error",data:e.response?.data,statusText:e.response?.statusText};try{this.config.onError(a)}catch(r){z0.error("Error in onError handler:",r)}}}let Cd=null;function Ma(){return Cd||(Cd=new j0),Cd}const no=ct("AuthManager");function Ji(o,e,a,r){try{window.G7Core?.devTools?.trackAuthEvent?.(o,e,a,r)}catch{}}const ql={admin:{type:"admin",loginPath:"/admin/login",defaultPath:"/admin",userEndpoint:"/admin/auth/user",loginEndpoint:"/auth/admin/login",logoutEndpoint:"/admin/auth/logout",refreshEndpoint:"/admin/auth/refresh"},user:{type:"user",loginPath:"/login",defaultPath:"/",userEndpoint:"/auth/user",loginEndpoint:"/auth/login",logoutEndpoint:"/auth/logout",refreshEndpoint:"/auth/refresh"}},wa=class wa{constructor(){$(this,"state");$(this,"config");$(this,"isRefreshing",!1);$(this,"refreshPromise",null);$(this,"eventHandlers",new Map);this.state={isAuthenticated:!1,user:null,type:null},this.config=new Map,this.config.set("admin",ql.admin),this.config.set("user",ql.user)}static getInstance(){return wa.instance||(wa.instance=new wa),wa.instance}on(e,a){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(a)}emit(e,...a){const r=this.eventHandlers.get(e);r&&r.forEach(i=>i(...a))}isAuthenticated(){return this.state.isAuthenticated}getUser(){return this.state.user}getAuthType(){return this.state.type}async checkAuth(e){const a=Ma();if(!a.getToken())return this.clearState(),!1;const i=this.config.get(e);if(!i)return no.error(`Unknown auth type: ${e}`),!1;try{const l=await a.get(i.userEndpoint);return l.success&&l.data?(this.state={isAuthenticated:!0,user:l.data,type:e},this.emit("authStateChange",this.state),!0):(this.clearState(),!1)}catch(l){return l.response?.status===401&&await this.refreshToken()?this.checkAuth(e):(this.clearState(),!1)}}async preloadAuth(e){try{return await this.checkAuth(e)}catch(a){return no.warn(`Preload auth failed for type ${e}:`,a),!1}}async login(e,a,r){const i=Ma();if(!this.config.get(e))throw new Error(`Unknown auth type: ${e}`);const u=e==="admin"?ql.admin.loginEndpoint:ql.user.loginEndpoint;try{const d=r?.headers?{headers:r.headers}:void 0,f=await i.post(u,a,d);if(f.success&&f.data){i.setToken(f.data.token);const g=f.data.user.language,m=localStorage.getItem(wa.LOCALE_STORAGE_KEY),b=g&&g!==m;if(g)try{localStorage.setItem(wa.LOCALE_STORAGE_KEY,g)}catch(v){no.warn("Failed to save user language to localStorage:",v)}return this.state={isAuthenticated:!0,user:f.data.user,type:e},this.emit("login",this.state),this.emit("authStateChange",this.state),Ji("login",!0,void 0,{userId:f.data.user.uuid,email:f.data.user.email,type:e}),b&&window.__templateApp&&window.__templateApp.changeLocale(g),f.data.user}throw new Error("Login failed")}catch(d){this.clearState();const f=d.response?.data?.message,g=new Error(f||d.message||"Login failed");throw g.response=d.response,g.status=d.response?.status,Ji("login",!1,g.message,{type:e,status:d.response?.status}),g}}async logout(){const e=Ma(),a=this.state.type?this.config.get(this.state.type):null;try{a&&await e.post(a.logoutEndpoint)}catch(r){no.warn("Logout API call failed:",r)}finally{e.removeToken();const r={...this.state};if(this.clearState(),this.emit("logout",r),this.emit("authStateChange",this.state),Ji("logout",!0,void 0,{previousType:r.type}),a&&r.type){const i=window.location.pathname+window.location.search;window.location.href=this.getLoginRedirectUrl(r.type,i)}}}async refreshToken(){if(this.isRefreshing&&this.refreshPromise)return this.refreshPromise;this.isRefreshing=!0,this.refreshPromise=this.doRefreshToken();try{return await this.refreshPromise}finally{this.isRefreshing=!1,this.refreshPromise=null}}async doRefreshToken(){const e=this.state.type;if(!e)return!1;const a=this.config.get(e);if(!a)return!1;const r=Ma();try{const i=await r.post(a.refreshEndpoint);return i.success&&i.data?.token?(r.setToken(i.data.token),this.emit("tokenRefreshed"),Ji("token-refresh",!0,void 0,{type:e}),!0):(Ji("token-refresh",!1,"No token in response",{type:e}),!1)}catch(i){return no.error("Token refresh failed:",i),Ji("token-refresh",!1,i instanceof Error?i.message:"Unknown error",{type:e}),!1}}getLoginRedirectUrl(e,a,r){const i=this.config.get(e);if(!i)return"/login";const l=encodeURIComponent(a);let u=`${i.loginPath}?redirect=${l}`;return r&&(u+=`&reason=${encodeURIComponent(r)}`),u}updateConfig(e,a){if(a.loginPath!==void 0){const i=a.loginPath;if(!i.startsWith("/")||i.startsWith("//"))throw new Error(`AuthManager.updateConfig: loginPath must be a same-origin path starting with '/' (got: ${i})`)}const r=this.config.get(e);r&&this.config.set(e,{...r,...a})}getRedirectUrl(e){const r=this.config.get(e)?.defaultPath||"/",l=new URLSearchParams(window.location.search).get("redirect");if(l)try{const u=decodeURIComponent(l);if(u.startsWith("/"))return u}catch{}return r}getConfig(e){return this.config.get(e)}clearState(){this.state={isAuthenticated:!1,user:null,type:null}}static resetInstance(){wa.instance=null}};$(wa,"instance"),$(wa,"LOCALE_STORAGE_KEY","g7_locale");let ha=wa;const Bp={401:{handler:"navigate",params:{path:"{{auth.loginPath}}"}},403:{handler:"toast",params:{type:"error",message:"{{error.message}}"}},404:{handler:"toast",params:{type:"error",message:"{{error.message}}"}},422:{handler:"toast",params:{type:"error",message:"{{error.message}}"}},default:{handler:"toast",params:{type:"error",message:"{{error.message}}"}}},Xa={findHandler(o,e){if(o){if(o[e])return o[e];if(o[String(e)])return o[String(e)];if(o.default)return o.default}},normalizeOnError(o){return o?Array.isArray(o)?o:[o]:[]},injectErrorCode(o,e,a){if(o.handler!=="showErrorPage"||o.params?.errorCode!==void 0)return o;const r=typeof e=="string"?parseInt(e,10):e,i=isNaN(r)?a:r;return i===void 0?o:{...o,params:{...o.params,errorCode:i}}}},ga=ct("ErrorHandlingResolver"),Tr=class Tr{constructor(){$(this,"templateErrorHandling",null);$(this,"layoutErrorHandling",null);$(this,"executeAction",null)}static getInstance(){return Tr.instance||(Tr.instance=new Tr),Tr.instance}static resetInstance(){Tr.instance=null}setTemplateConfig(e){this.templateErrorHandling=e,ga.log("Template config set:",e)}setLayoutConfig(e){this.layoutErrorHandling=e,ga.log("Layout config set:",e)}setActionExecutor(e){this.executeAction=e}resolve(e,a={}){const{errorHandling:r,onError:i}=a;ga.log("Resolving error:",e,{hasActionErrorHandling:!!r,hasActionOnError:!!i,hasLayoutConfig:!!this.layoutErrorHandling,hasTemplateConfig:!!this.templateErrorHandling});let l=Xa.findHandler(r,e);if(l){const u=this.getMatchedKey(r,e);return{handler:Xa.injectErrorCode(l,u,e),level:"action",matchedKey:u}}if(i){const u=Xa.normalizeOnError(i);if(u.length>0)return{handler:u.length===1?u[0]:{handler:"sequence",actions:u},level:"action",matchedKey:"onError"}}if(l=Xa.findHandler(this.layoutErrorHandling||void 0,e),l){const u=this.getMatchedKey(this.layoutErrorHandling,e);return{handler:Xa.injectErrorCode(l,u,e),level:"layout",matchedKey:u}}if(l=Xa.findHandler(this.templateErrorHandling||void 0,e),l){const u=this.getMatchedKey(this.templateErrorHandling,e);return{handler:Xa.injectErrorCode(l,u,e),level:"template",matchedKey:u}}if(l=Xa.findHandler(Bp,e),l){const u=this.getMatchedKey(Bp,e);return{handler:Xa.injectErrorCode(l,u,e),level:"system",matchedKey:u}}return{handler:null,level:null,matchedKey:null}}async execute(e,a){if(!this.executeAction){ga.error("Action executor is not set");return}ga.log("Executing handler:",e.handler,{errorContext:a});try{return await this.executeAction(e,{error:a})}catch(r){throw ga.error("Failed to execute handler:",r),r}}async resolveAndExecute(e,a,r={}){const i=this.resolve(e,r);if(ga.log("Resolve result:",{errorCode:e,handler:i.handler?.handler,level:i.level,matchedKey:i.matchedKey}),!i.handler)return ga.warn("No handler found for error:",e),{handled:!1};try{return{handled:!0,result:await this.execute(i.handler,a)}}catch(l){return ga.error("Handler execution failed:",l),{handled:!1}}}getMatchedKey(e,a){return e[a]?a:e[String(a)]?String(a):"default"}clearLayoutConfig(){this.layoutErrorHandling=null,ga.log("Layout config cleared")}clearAllConfig(){this.templateErrorHandling=null,this.layoutErrorHandling=null,ga.log("All config cleared")}getConfigStatus(){return{hasTemplate:this.templateErrorHandling!==null,hasLayout:this.layoutErrorHandling!==null,hasExecutor:this.executeAction!==null}}};$(Tr,"instance",null);let Ed=Tr;function pa(){return Ed.getInstance()}var _d={exports:{}},ao={};var qp;function U0(){if(qp)return ao;qp=1;var o=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function a(r,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+i.key),"key"in i){l={};for(var d in i)d!=="key"&&(l[d]=i[d])}else l=i;return i=l.ref,{$$typeof:o,type:r,key:u,ref:i!==void 0?i:null,props:l}}return ao.Fragment=e,ao.jsx=a,ao.jsxs=a,ao}var Pp;function B0(){return Pp||(Pp=1,_d.exports=U0()),_d.exports}var ut=B0();const q0=Ka({__proto__:null,default:Wa(ut)},[ut]),Ad=ct("ParentContextProvider"),Gp=N.createContext(null);let Pl=null;function xd(){Pl?(Ad.log("[triggerModalParentUpdate] 모달 부모 컨텍스트 업데이트 트리거"),Pl()):Ad.warn("[triggerModalParentUpdate] Provider가 아직 마운트되지 않음")}const Vp=({children:o})=>{const[e,a]=N.useState(0),r=N.useRef(!0),i=N.useCallback(()=>{const u=window.__g7LayoutContextStack||[];return u[u.length-1]?.dataContext},[]);N.useEffect(()=>(r.current=!0,Pl=()=>{r.current&&(a(u=>u+1),Ad.log("[ParentContextProvider] 버전 업데이트됨"))},()=>{r.current=!1,Pl=null}),[]);const l={version:e,getParentDataContext:i};return ut.jsx(Gp.Provider,{value:l,children:o})};function P0(){return N.useContext(Gp)}const H=ct("ActionDispatcher"),Fp=new Set(["navigate","navigateBack","navigateForward","replaceUrl","refresh","logout"]),G0=new Set(["redirect"]);function Un(){try{return window.G7Core?.devTools}catch{return}}class It extends Error{constructor(a,r,i){super(a);$(this,"action");$(this,"originalError");$(this,"unknownHandler",!1);this.action=r,this.originalError=i,this.name="ActionError"}}const ss=class ss{constructor(e={},a,r){$(this,"bindingEngine");$(this,"translationEngine");$(this,"translationContext");$(this,"customHandlers",new Map);$(this,"defaultContext");$(this,"globalStateUpdater");$(this,"errorHandlingSetup",!1);$(this,"debounceTimers",new Map);$(this,"pendingDebounceFlushers",new Map);$(this,"debounceAccumulatedValues",new Map);$(this,"globalHeaders",[]);$(this,"namedActions",{});$(this,"previewMode",!1);$(this,"intervals",new Map);this.bindingEngine=new wn,this.translationEngine=a,this.translationContext=r,this.defaultContext=e,this.registerDefaultHandlers(),this.setupErrorHandling()}setGlobalHeaders(e){this.globalHeaders=e||[]}setNamedActions(e){this.namedActions=e||{};const a=Un();a?.isEnabled?.()&&a.setNamedActionDefinitions?.(this.namedActions),H.log("[setNamedActions] registered:",Object.keys(this.namedActions))}getNamedActions(){return this.namedActions}setPreviewMode(e){this.previewMode=e,H.log("Preview mode:",e?"enabled":"disabled")}isPreviewMode(){return this.previewMode}static getPreviewSuppressedHandlers(){return Fp}static getPreviewSuppressedLayoutFeatures(){return G0}resolveActionRef(e){if(!e.actionRef)return e;const a=this.namedActions[e.actionRef];if(!a)return H.warn(`[resolveActionRef] named action not found: "${e.actionRef}"`),e;const r=Un();r?.isEnabled?.()&&r.trackNamedActionRef?.({actionRefName:e.actionRef,resolvedHandler:a.handler,timestamp:Date.now()});const{actionRef:i,type:l,key:u,event:d,...f}=e,g={...a,...Object.fromEntries(Object.entries(f).filter(([,m])=>m!==void 0)),type:l??a.type};return u!==void 0&&(g.key=u),d!==void 0&&(g.event=d),g}matchesPattern(e,a){if(a==="*")return!0;const r=a.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${r}$`).test(e)}getMatchingGlobalHeaders(e,a){const r={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([l,u])=>{const d=Ki(u,a,{skipCache:!0});d!=null&&d!==""&&(r[l]=String(d))});return r}setupErrorHandling(){if(this.errorHandlingSetup)return;pa().setActionExecutor(async(a,r)=>{const i={type:"click",handler:a.handler,target:a.target,params:a.params,actions:a.actions},l={data:{...this.defaultContext.data,error:r.error}};return await this.dispatchAction(i,l)}),this.errorHandlingSetup=!0}registerDefaultHandlers(){this.registerHandler("refetchDataSource",async(a,r)=>{const i=a.params?.dataSourceId,l=a.params?.sync;if(!i){H.warn("refetchDataSource: dataSourceId is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.refetch){const u=window.G7Core?.state?.get?.()||{},d={...r.state?._global,...u},f=window.G7Core?.state?.getLocal?.()||{},g=r.data?._local||r.state||{},m={...f,...g},b=r.isolatedContext?.state;H.log("[refetchDataSource] localStateOverride:",m),await window.G7Core.dataSource.refetch(i,{...l?{sync:!0}:{},...d?{globalStateOverride:d}:{},...m?{localStateOverride:m}:{},...b?{isolatedStateOverride:b}:{}})}else H.warn("refetchDataSource: G7Core.dataSource.refetch is not available")}),this.registerHandler("appendDataSource",async(a,r)=>{const{dataSourceId:i,dataPath:l,newData:u}=a.params||{};if(!i){H.warn("appendDataSource: dataSourceId is required");return}if(u===void 0){H.warn("appendDataSource: newData is required");return}if(typeof window<"u"&&window.G7Core?.dataSource?.updateData){if(!Array.isArray(u)){H.warn("appendDataSource: newData must be an array, got:",typeof u,u);return}await window.G7Core.dataSource.updateData(i,l||null,u,"append")}else H.warn("appendDataSource: G7Core.dataSource.updateData is not available")}),this.registerHandler("updateDataSource",async(a,r)=>{const{dataSourceId:i,data:l,merge:u=!1}=a.params||{};if(!i){H.warn("updateDataSource: dataSourceId is required");return}if(l===void 0){H.warn("updateDataSource: data is required");return}typeof window<"u"&&window.G7Core?.dataSource?.set?(H.log(`[updateDataSource] Updating dataSource '${i}' with:`,l),window.G7Core.dataSource.set(i,l,{merge:u})):H.warn("updateDataSource: G7Core.dataSource.set is not available")}),this.registerHandler("scrollIntoView",async(a,r)=>{const{selector:i,behavior:l="smooth",block:u="nearest",inline:d="nearest",waitForElement:f=!1,timeout:g=2e3,delay:m=0,retryCount:b=0,retryInterval:v=50,scrollContainer:S}=a.params||{};if(!i){H.warn("scrollIntoView: selector is required");return}if(typeof window>"u"||typeof document>"u"){H.warn("scrollIntoView: window/document is not available");return}let E=null;if(f){if(E=await new Promise(A=>{const T=document.querySelector(i);if(T){A(T);return}const L=setTimeout(()=>{M.disconnect(),A(null)},g),M=new MutationObserver(()=>{const R=document.querySelector(i);R&&(clearTimeout(L),M.disconnect(),A(R))});M.observe(document.body,{childList:!0,subtree:!0})}),!E){H.warn(`scrollIntoView: element not found for selector "${i}" after ${g}ms timeout`);return}}else{m>0&&await new Promise(T=>setTimeout(T,m)),E=document.querySelector(i);let A=0;for(;!E&&A<b;)await new Promise(T=>setTimeout(T,v)),E=document.querySelector(i),A++;if(!E){H.warn(`scrollIntoView: element not found for selector "${i}" after ${A+1} attempts`);return}}if(S){const A=document.querySelector(S);if(!A){H.warn(`scrollIntoView: container not found for selector "${S}"`);return}const T=E.getBoundingClientRect(),L=A.getBoundingClientRect(),M=T.top-L.top+A.scrollTop,R=M+T.height;let D;switch(u){case"start":D=M;break;case"center":D=M-A.clientHeight/2+T.height/2;break;case"end":D=R-A.clientHeight;break;default:const U=T.top<L.top,j=T.bottom>L.bottom;if(U)D=M;else if(j)D=R-A.clientHeight;else return;break}A.scrollTo({top:Math.max(0,D),behavior:l});return}E.scrollIntoView({behavior:l,block:u,inline:d})}),this.registerHandler("reloadExtensions",async(a,r)=>{if(typeof window>"u"){H.warn("reloadExtensions: window is not available");return}const i=window.__templateApp;if(!i){H.warn("reloadExtensions: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState()}catch(d){throw H.error("reloadExtensions: reloadExtensionState failed",d),d}else H.warn("reloadExtensions: TemplateApp.reloadExtensionState unavailable");const{moduleInfo:l,pluginInfo:u}=a.params||{};if(l)try{await this.executeAction({handler:"reloadModuleHandlers",params:a.params},r)}catch(d){H.error("reloadExtensions: reloadModuleHandlers failed",d)}if(u)try{await this.executeAction({handler:"reloadPluginHandlers",params:a.params},r)}catch(d){H.error("reloadExtensions: reloadPluginHandlers failed",d)}H.log("reloadExtensions: done")}),this.registerHandler("reloadRoutes",async(a,r)=>{if(typeof window>"u"){H.warn("reloadRoutes: window is not available");return}const i=window.__templateApp;if(!i){H.warn("reloadRoutes: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState(),H.log("reloadRoutes: delegated to reloadExtensionState")}catch(l){throw H.error("reloadRoutes: Failed to reload routes",l),l}else{const l=i.getRouter?.();l&&(await l.loadRoutes(),H.log("reloadRoutes: Routes reloaded (legacy fallback)"))}}),this.registerHandler("refresh",async(a,r)=>{if(typeof window>"u"){H.warn("refresh: window is not available");return}const i=Number(a.params?.delayMs??0);i>0&&await new Promise(l=>setTimeout(l,i)),window.location.reload()}),this.registerHandler("remount",async(a,r)=>{const{componentId:i}=a.params||{};if(!i){H.warn("remount: componentId parameter is required");return}if(!this.globalStateUpdater){H.warn("remount: globalStateUpdater is not set");return}const d=(window.G7Core?.state?.get()||{})._global?._remountKeys||{},f=d[i]||0;this.globalStateUpdater({_remountKeys:{...d,[i]:f+1}}),H.log(`remount: ${i} key incremented to ${f+1}`)}),this.registerHandler("reloadTranslations",async(a,r)=>{if(typeof window>"u"){H.warn("reloadTranslations: window is not available");return}const i=window.__templateApp;if(!i){H.warn("reloadTranslations: TemplateApp not initialized");return}if(typeof i.reloadExtensionState=="function")try{await i.reloadExtensionState(),H.log("reloadTranslations: delegated to reloadExtensionState")}catch(l){throw H.error("reloadTranslations: Failed to reload translations",l),l}}),this.registerHandler("reloadModuleHandlers",async(a,r)=>{if(typeof window>"u"){H.warn("reloadModuleHandlers: window is not available");return}const{moduleInfo:i,action:l}=a.params||{};if(!i){H.warn("reloadModuleHandlers: moduleInfo is required");return}const u=i.data||i;if(!u.identifier){H.warn("reloadModuleHandlers: moduleInfo with identifier is required");return}if(!l||l!=="add"&&l!=="remove"){H.warn('reloadModuleHandlers: action must be "add" or "remove"');return}const d=window.G7Config;if(!d){H.warn("reloadModuleHandlers: G7Config not available");return}const f=u.identifier;try{if(l==="add"){if(u.assets&&(d.moduleAssets=d.moduleAssets||{},d.moduleAssets[f]=u.assets,H.log(`reloadModuleHandlers: Added assets for ${f}`),u.assets.js)){const g=u.assets.js,m=`module-${f}`;if(document.getElementById(m)){H.warn(`reloadModuleHandlers: Script ${m} already loaded`);return}const b=document.createElement("script");if(b.id=m,b.src=g,b.async=!0,await new Promise((v,S)=>{b.onload=()=>{H.log(`reloadModuleHandlers: Script loaded successfully for ${f}`),v()},b.onerror=()=>{H.error(`reloadModuleHandlers: Failed to load script for ${f}`),S(new Error(`Failed to load module script: ${g}`))},document.head.appendChild(b)}),u.assets.css){const v=u.assets.css,S=`module-css-${f}`;if(!document.getElementById(S)){const E=document.createElement("link");E.id=S,E.rel="stylesheet",E.href=v,document.head.appendChild(E),H.log(`reloadModuleHandlers: CSS loaded for ${f}`)}}}}else if(l==="remove"){d.moduleAssets&&d.moduleAssets[f]&&(delete d.moduleAssets[f],H.log(`reloadModuleHandlers: Removed assets for ${f}`));const g=`module-${f}`,m=document.getElementById(g);m&&(m.remove(),H.log(`reloadModuleHandlers: Removed script for ${f}`));const b=`module-css-${f}`,v=document.getElementById(b);v&&(v.remove(),H.log(`reloadModuleHandlers: Removed CSS for ${f}`))}}catch(g){throw H.error(`reloadModuleHandlers: Failed to ${l} module assets`,g),g}}),this.registerHandler("reloadPluginHandlers",async(a,r)=>{if(typeof window>"u"){H.warn("reloadPluginHandlers: window is not available");return}const{pluginInfo:i,action:l}=a.params||{};if(!i){H.warn("reloadPluginHandlers: pluginInfo is required");return}const u=i.data||i;if(!u.identifier){H.warn("reloadPluginHandlers: pluginInfo with identifier is required");return}if(!l||l!=="add"&&l!=="remove"){H.warn('reloadPluginHandlers: action must be "add" or "remove"');return}const d=window.G7Config;if(!d){H.warn("reloadPluginHandlers: G7Config not available");return}const f=u.identifier;try{if(l==="add"){if(u.assets&&(d.pluginAssets=d.pluginAssets||{},d.pluginAssets[f]=u.assets,H.log(`reloadPluginHandlers: Added assets for ${f}`),u.assets.js)){const g=u.assets.js,m=`plugin-${f}`;if(document.getElementById(m)){H.warn(`reloadPluginHandlers: Script ${m} already loaded`);return}const b=document.createElement("script");if(b.id=m,b.src=g,b.async=!0,await new Promise((v,S)=>{b.onload=()=>{H.log(`reloadPluginHandlers: Script loaded successfully for ${f}`),v()},b.onerror=()=>{H.error(`reloadPluginHandlers: Failed to load script for ${f}`),S(new Error(`Failed to load plugin script: ${g}`))},document.head.appendChild(b)}),u.assets.css){const v=u.assets.css,S=`plugin-css-${f}`;if(!document.getElementById(S)){const E=document.createElement("link");E.id=S,E.rel="stylesheet",E.href=v,document.head.appendChild(E),H.log(`reloadPluginHandlers: CSS loaded for ${f}`)}}}}else if(l==="remove"){d.pluginAssets&&d.pluginAssets[f]&&(delete d.pluginAssets[f],H.log(`reloadPluginHandlers: Removed assets for ${f}`));const g=`plugin-${f}`,m=document.getElementById(g);m&&(m.remove(),H.log(`reloadPluginHandlers: Removed script for ${f}`));const b=`plugin-css-${f}`,v=document.getElementById(b);v&&(v.remove(),H.log(`reloadPluginHandlers: Removed CSS for ${f}`))}}catch(g){throw H.error(`reloadPluginHandlers: Failed to ${l} plugin assets`,g),g}});let e=!1;this.registerHandler("showErrorPage",async(a,r)=>{if(e){H.log("showErrorPage: Already active, skipping duplicate call");return}if(e=!0,typeof window>"u"){e=!1,H.warn("showErrorPage: window is not available");return}const i=window.__templateApp;if(!i){e=!1,H.warn("showErrorPage: TemplateApp not initialized");return}const l=i.getErrorPageHandler?.();if(!l){e=!1,H.warn("showErrorPage: ErrorPageHandler not available");return}const u=a.params?.errorCode||500,d=a.params?.target||"content";let f=a.params?.containerId;f||(f=d==="full"?"app":"main_content"),H.log("showErrorPage:",{errorCode:u,target:d,containerId:f});const g=(m,b=6e4)=>new Promise((v,S)=>{const E=document.getElementById(m);if(E){v(E);return}H.log(`showErrorPage: Waiting for container #${m}...`);let A;const T=new MutationObserver((L,M)=>{const R=document.getElementById(m);R&&(H.log(`showErrorPage: Container #${m} found`),M.disconnect(),clearTimeout(A),v(R))});T.observe(document.body,{childList:!0,subtree:!0}),A=setTimeout(()=>{T.disconnect(),S(new Error(`Container #${m} not found within ${b}ms`))},b)});try{await g(f);const m=pa(),b=m.layoutErrorHandling;m.clearLayoutConfig();try{await l.renderError(u,f)||H.warn(`showErrorPage: Failed to render error page for code ${u}`)}finally{m.setLayoutConfig(b)}}catch(m){throw H.error("showErrorPage: Error rendering error page:",m),m}finally{e=!1}}),this.registerHandler("emitEvent",async(a,r)=>{const i=a.params?.event,l=a.params?.data;if(!i){H.warn("emitEvent: event parameter is required");return}if(typeof window>"u"){H.warn("emitEvent: window is not available");return}const u=window.G7Core;if(!u?.componentEvent?.emit){H.warn("emitEvent: G7Core.componentEvent is not available");return}try{H.log(`emitEvent: Emitting "${i}"`,l);const d={...l,_context:{data:r.data,state:r.state}},f=await u.componentEvent.emit(i,d);if(!f||f.length===0?H.warn(`emitEvent: No listeners found for "${i}"`):H.log(`emitEvent: Event "${i}" completed with ${f.length} listener(s)`,f),this.globalStateUpdater){const g=(u?.state?.get()||{})._local||{},m={event:i,success:!0,data:f.length===1?f[0]:f,listeners:f.length};this.globalStateUpdater({_local:{...g,_eventResult:m}});const b=r.state&&typeof r.state=="object"&&!Array.isArray(r.state)?r.state:g;window.__g7SequenceLocalSync={...b,_eventResult:m}}}catch(d){if(H.error(`emitEvent: Event "${i}" failed`,d),this.globalStateUpdater){const f=u?.state?.get()||{};this.globalStateUpdater({_local:{...f._local,_eventResult:{event:i,success:!1,error:d instanceof Error?d.message:String(d)}}})}throw d}}),this.registerHandler("updateProductField",async(a,r)=>{const{productId:i,field:l,value:u}=a.params||{};if(!i||!l){H.warn("updateProductField: productId and field are required");return}if(typeof window>"u"){H.warn("updateProductField: window is not available");return}const d=window.G7Core;if(!d?.state?.get||!this.globalStateUpdater){H.warn("updateProductField: G7Core.state or globalStateUpdater is not available");return}try{const f=d.state.get()||{},m=(f.products?.data?.data||[]).map(v=>v.id===i?{...v,[l]:u,_modified:!0}:v),b=new Set(f._local?.modifiedProductIds||[]);b.add(i),this.globalStateUpdater({products:{...f.products,data:{...f.products?.data,data:m}},_local:{...f._local,modifiedProductIds:Array.from(b)}}),H.log(`updateProductField: Updated product ${i}, field: ${l}, value:`,u)}catch(f){throw H.error("updateProductField: Error updating product field",f),f}}),this.registerHandler("updateOptionField",async(a,r)=>{const{productId:i,optionId:l,field:u,value:d}=a.params||{};if(!i||!l||!u){H.warn("updateOptionField: productId, optionId and field are required");return}if(typeof window>"u"){H.warn("updateOptionField: window is not available");return}const f=window.G7Core;if(!f?.state?.get||!this.globalStateUpdater){H.warn("updateOptionField: G7Core.state or globalStateUpdater is not available");return}try{const g=f.state.get()||{},b=(g.products?.data?.data||[]).map(S=>{if(S.id===i&&S.options){const E=S.options.map(A=>A.id===l?{...A,[u]:d,_modified:!0}:A);return{...S,options:E,_modified:!0}}return S}),v=new Set(g._local?.modifiedProductIds||[]);v.add(i),this.globalStateUpdater({products:{...g.products,data:{...g.products?.data,data:b}},_local:{...g._local,modifiedProductIds:Array.from(v)}}),H.log(`updateOptionField: Updated product ${i} option ${l}, field: ${u}, value:`,d)}catch(g){throw H.error("updateOptionField: Error updating option field",g),g}}),this.registerHandler("setLocale",async(a,r)=>{const i=a.target;if(!i||typeof i!="string"){H.warn("setLocale: Invalid locale:",i);return}const l=window.__templateApp;if(l&&typeof l.changeLocale=="function")try{await l.changeLocale(i),H.log("setLocale: Locale changed to",i)}catch(u){H.error("setLocale: Failed to change locale:",u),window.location.reload()}else{H.warn("setLocale: TemplateApp not found, falling back to page reload");try{localStorage.setItem("g7_locale",i)}catch{}window.location.reload()}}),this.registerHandler("suppress",async()=>{H.log("suppress: Error intentionally suppressed")}),this.registerBuiltInHandlerMetadata()}registerBuiltInHandlerMetadata(){const e=Un();if(!e?.isEnabled())return;const a=[{name:"refetchDataSource",description:"데이터 소스를 다시 fetch합니다"},{name:"appendDataSource",description:"데이터 소스에 새 데이터를 병합합니다 (무한 스크롤용)"},{name:"updateDataSource",description:"API 응답으로 데이터 소스를 직접 업데이트합니다 (refetch 대체)"},{name:"reloadRoutes",description:"라우트를 다시 로드합니다"},{name:"refresh",description:"현재 페이지를 새로고침합니다"},{name:"remount",description:"컴포넌트를 리마운트합니다"},{name:"reloadTranslations",description:"다국어 파일을 다시 로드합니다"},{name:"showErrorPage",description:"에러 페이지를 표시합니다"},{name:"emitEvent",description:"이벤트를 발생시킵니다"},{name:"updateProductField",description:"상품 필드를 인라인 수정합니다"},{name:"updateOptionField",description:"상품 옵션 필드를 인라인 수정합니다"},{name:"setLocale",description:"언어를 변경합니다 (DB 저장 + UI 리렌더링)"}];for(const r of a)e.trackHandlerRegistration(r.name,"built-in",r.description)}createHandler(e,a,r){H.log("createHandler called for:",e.handler,e.type);const i=window.__g7DevTools,l=Date.now(),u=r?.state?{...r.state}:null,d=`handler_${e.handler}_${l}`;return async f=>{if(H.log("Handler invoked for:",e.handler,"event:",f.type),i?.isEnabled?.()&&u){const m=window.G7Core?.state?.getLocal?.()??r?.state??{},b=Date.now()-l;for(const v of Object.keys(u)){const S=u[v],E=m[v];S!==E&&b>100&&(i.trackStaleClosureWarning?.({type:"event-handler-stale",location:`createHandler(${e.handler})`,capturedPath:`_local.${v}`,capturedValue:S,capturedAt:l,currentValue:E,actionId:d,stackTrace:new Error().stack}),H.warn(`[Stale Closure] _local.${v} changed after handler creation:`,`captured="${S}" → current="${E}" (${b}ms ago)`))}}try{f.type!=="change"&&f.preventDefault();let g={};if(f.type==="submit"&&f.target instanceof HTMLFormElement){const v=f.target;new FormData(v).forEach((E,A)=>{g[A]=E})}const m={...this.defaultContext,data:{...a,form:g,_local:r?.state||{},$event:f},event:f,...r&&{state:r.state,setState:r.setState},isolatedContext:r?.isolatedContext};if(e.confirm){let v=this.resolveValue(e.confirm,m.data);if(this.translationEngine&&this.translationContext&&v.startsWith("$t:")&&(v=this.translationEngine.resolveTranslations(v,this.translationContext,m.data)),!confirm(v))return}const b=window.__g7ActionContext;window.__g7ActionContext={...r,data:m.data};try{await this.executeAction(e,m)}finally{window.__g7ActionContext=b}}catch(g){if(H.error("Action execution failed:",g),e.onError){const m=g instanceof It&&g.originalError?g.originalError:g,b={...this.defaultContext,data:{...a,error:m,_local:r?.state||{},$event:f},event:f,...r&&{state:r.state,setState:r.setState}},v=Array.isArray(e.onError)?e.onError:[e.onError];for(const S of v)await this.executeAction(S,b)}}}}generateActionId(e,a){const r=e.handler,i=a||"no-target",l=Date.now(),u=Math.random().toString(36).substring(2,9);return`${r}_${i.replace(/[^a-zA-Z0-9]/g,"_")}_${l}_${u}`}async executeAction(e,a){if(e=this.resolveActionRef(e),typeof e.handler=="string"&&e.handler.includes("{{")){const f=this.evaluateExpression(e.handler,a.data);e={...e,handler:f==null?"":String(f)}}const r=Un(),i=r?.isEnabled()?`action_${Date.now()}_${Math.random().toString(36).substring(2,11)}`:void 0,l=performance.now();let u;if(i&&r&&r.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),context:this.sanitizeForDevTools({hasState:!!a.state,hasSetState:!!a.setState,dataKeys:a.data?Object.keys(a.data):[]}),startTime:l,status:"started"}),e.if!==void 0)try{const f=this.resolveValue(e.if,a.data),g=f===!0||f==="true"||f&&f!=="false"&&f!=="0"&&f!==!1;if(H.log("[executeAction] if condition result:",e.handler,g),!g)return i&&r&&r.logAction({id:i,type:e.handler,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"success",result:{skipped:!0,reason:"if condition false"}}),{success:!0,data:void 0}}catch(f){return H.error("[executeAction] if condition error:",e.handler,f),i&&r&&r.logAction({id:i,type:e.handler,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"error",error:{name:"ConditionEvaluationError",message:f instanceof Error?f.message:String(f),stack:f instanceof Error?f.stack:void 0}}),{success:!0,data:void 0}}let d;try{const f=this.resolveParams(e.params,a.data);i&&(u=this.sanitizeForDevTools(f));const g=e.target?this.resolveValue(e.target,a.data):void 0;if(e.handler==="apiCall"&&a.setState){d=this.generateActionId(e,g);const b=a.state?.loadingActions||{};a.setState({loadingActions:{...b,[d]:!0}})}if(this.previewMode&&Fp.has(e.handler))return H.warn(`Preview mode: "${e.handler}" suppressed`,g||f),i&&r&&r.logAction({id:i,type:e.handler,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"skipped",metadata:{reason:"preview_mode_suppressed"}}),{success:!0,data:void 0};let m;switch(e.handler){case"ensureIdentityVerified":m=await this.handleEnsureIdentityVerified(f);break;case"resolveIdentityChallenge":m=this.handleResolveIdentityChallenge(f);break;case"navigate":const b=f.path||g;m=await this.handleNavigate(b,f,a);break;case"navigateBack":m=await this.handleNavigateBack();break;case"navigateForward":m=await this.handleNavigateForward();break;case"openWindow":{const E=f.path||g;m=await this.handleOpenWindow(E,f);break}case"replaceUrl":{const E=f.path||g||window.location.pathname;m=await this.handleReplaceUrl(E,f);break}case"apiCall":if(e.onSuccess&&r?.isEnabled()&&i){const E=window.G7Core,A={};if(E?.state?.get){const T=E.state.get();A._global=T}a.state&&(A._local=a.state),r.registerStateCaptureForHandler?.(i,["_global","_local"],A)}const v=e.auth_mode??(e.auth_required?"required":"none"),S=e.identity_target?this.resolveParams(e.identity_target,a.data):void 0;m=await this.handleApiCall(g,f,a,v,S);break;case"login":m=await this.handleLogin(g,f,a);break;case"logout":m=await this.handleLogout(g,a);break;case"setState":H.log("[executeAction] setState resolvedParams:",f),m=await this.handleSetState(e.render!==void 0?{...f,__render:e.render}:f,a);break;case"setError":m=await this.handleSetError(g,f,a);break;case"openModal":m=await this.handleOpenModal(g,a);break;case"closeModal":m=await this.handleCloseModal(a);break;case"showAlert":m=await this.handleShowAlert(g,a);break;case"toast":m=await this.handleToast(f,a);break;case"switch":m=await this.handleSwitch(e,a);break;case"conditions":m=await this.handleConditions(e,a);break;case"sequence":m=await this.handleSequence(e,a);break;case"parallel":m=await this.handleParallel(e,a);break;case"startInterval":m=this.handleStartInterval(f,a);break;case"stopInterval":m=this.handleStopInterval(f);break;case"loadScript":m=await this.handleLoadScript(f,e,a);break;case"callExternal":m=await this.handleCallExternal(f,e,a);break;case"callExternalEmbed":m=await this.handleCallExternalEmbed(f,e,a);break;case"saveToLocalStorage":m=await this.handleSaveToLocalStorage(f,a);break;case"loadFromLocalStorage":m=await this.handleLoadFromLocalStorage(f,a);break;default:m=await this.handleCustomAction({...e,target:g,params:f},a);break}if(e.resultTo&&m!==void 0){const{target:b,key:v,merge:S}=e.resultTo,E=this.resolveValue(v,a.data),A=S==="replace"?"replace":S==="shallow"?"shallow":"deep";if(b==="_local"&&a.setState){const T=this.buildNestedUpdate(E,m),L=A!=="deep"?{...T,__mergeMode:A}:T;a.setState(L),H.log(`[resultTo] Saved to _local.${E} (merge=${A}):`,m)}else if(b==="_local"&&this.globalStateUpdater){const M=(window.G7Core?.state?.get()||{})._local||{},R=this.buildNestedUpdate(E,m);let D;A==="replace"?D=R:A==="shallow"?D={...M,...R}:D=this.deepMergeWithState(R,M),this.globalStateUpdater({_local:D}),H.log(`[resultTo] Saved to _local.${E} via globalStateUpdater (merge=${A}):`,m)}else if(b==="_global"&&this.globalStateUpdater){const T=this.buildNestedUpdate(E,m);this.globalStateUpdater(T),H.log(`[resultTo] Saved to _global.${E}:`,m)}else if(b==="_isolated"&&a.isolatedContext){const T=this.buildNestedUpdate(E,m);a.isolatedContext.mergeState(T,A),H.log(`[resultTo] Saved to _isolated.${E} (merge=${A}):`,m)}else H.warn(`[resultTo] Cannot save result: target=${b}, setState=${!!a.setState}, globalStateUpdater=${!!this.globalStateUpdater}, isolatedContext=${!!a.isolatedContext}`)}if(e.onSuccess){if(r?.isEnabled()&&i&&e.handler==="apiCall"){const S=window.G7Core,E={};S?.state?.get&&(E._global=S.state.get()),a.state&&(E._local=a.state),r.detectStaleClosure?.(i,`${e.handler} → onSuccess`,E,"callback-state-capture",i)}const b={...a,data:{...a.data,result:m,response:m}},v=Array.isArray(e.onSuccess)?e.onSuccess:[e.onSuccess];v.length>1?await this.handleSequence({handler:"sequence",type:"click",actions:v},b):v.length===1&&await this.executeAction(v[0],b)}return i&&r&&r.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),resolvedParams:u,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"success",result:this.sanitizeForDevTools(m)}),{success:!0,data:m}}catch(f){const g=f instanceof It?f:new It(`Failed to execute action: ${e.handler}`,e,f instanceof Error?f:void 0),m=g.originalError?.response||{},b=m.data||{},v=g.originalError?.status||m.status||500,S=b.message||g.message,E={status:v,message:S,errors:b.errors||m.errors,data:b,statusText:g.originalError?.statusText,error_code:b.error_code??m.error_code};if(g.unknownHandler)throw H.warn(`Unknown action handler "${e.handler}" — skipped (extension not loaded?). Not surfaced to the user.`),g;const T=pa().resolve(v,{errorHandling:e.errorHandling,onError:e.onError});if(T.handler){if(r?.isEnabled()&&i&&e.handler==="apiCall"){const M=window.G7Core,R={};M?.state?.get&&(R._global=M.state.get()),a.state&&(R._local=a.state),r.detectStaleClosure?.(i,`${e.handler} → onError`,R,"callback-state-capture",i)}const L={...a,data:{...a.data,error:E}};try{const M={type:"click",handler:T.handler.handler,target:T.handler.target,params:T.handler.params,actions:T.handler.actions};return await this.executeAction(M,L),{success:!1,error:g}}catch(M){return H.error("Error executing error handler:",M),{success:!1,error:g}}}throw i&&r&&r.logAction({id:i,type:e.handler,params:this.sanitizeForDevTools(e.params),resolvedParams:u,startTime:l,endTime:performance.now(),duration:performance.now()-l,status:"error",error:{name:g.name,message:g.message,stack:g.stack}}),g}finally{if(e.handler==="apiCall"&&a.setState&&d){const f=a.state?.loadingActions||{},{[d]:g,...m}=f;a.setState({loadingActions:m})}}}async handleNavigate(e,a,r){let i=e;if(a.query)if(a.mergeQuery===!0)i=this.buildMergedQueryPath(e,a.query);else{const u=new URLSearchParams;for(const[f,g]of Object.entries(a.query))if(g!=null&&g!=="")if(Array.isArray(g)){const m=f.endsWith("[]")?f:`${f}[]`;for(const b of g)b!=null&&b!==""&&u.append(m,String(b))}else u.set(f,String(g));const d=u.toString();d&&(i=`${e}?${d}`)}if(H.log("handleNavigate:",{target:e,params:a,finalPath:i,replace:a.replace,windowLocationSearch:window.location.search}),a.replace===!0){const u=window.G7Core;if(u?.updateQueryParams){const d=typeof a.transition_overlay_target=="string"?a.transition_overlay_target:void 0;await u.updateQueryParams(i,d?{transitionOverlayTarget:d}:void 0),H.log("handleNavigate: Used updateQueryParams for replace mode",d?{transitionOverlayTarget:d}:void 0),this.applyScrollOption(a.scroll,a.scrollBehavior,"top");return}H.warn("handleNavigate: G7Core.updateQueryParams not available, falling back to React Router")}const l=this.resolveNavigateFallbackAction(i,a);if(l){H.warn(`handleNavigate: No route matched, falling back to "${l.handler}"`),await this.dispatchAction({type:"click",handler:l.handler,params:l.params},r),this.applyScrollOption(a.scroll,a.scrollBehavior,"top");return}if(!r.navigate)throw new It("Navigate function is not provided in context");r.navigate(i,{replace:a.replace===!0}),this.applyScrollOption(a.scroll,a.scrollBehavior,"top")}resolveNavigateFallbackAction(e,a){const r=a.fallback;if(r===!1||a.replace===!0)return null;const l=window.__templateApp?.getRouter?.();if(!l||typeof l.match!="function"||typeof l.getRoutes=="function"&&l.getRoutes().length===0)return null;const u=e.split("?")[0];return l.match(u)?null:this.resolveNavigateFallback(r,e,a)}resolveNavigateFallback(e,a,r){return e==null?{handler:"openWindow",params:{path:a,target:"_self"}}:typeof e=="string"?{handler:e,params:{path:a}}:typeof e=="object"&&typeof e.handler=="string"?{handler:e.handler,params:{path:a,...e.params||{}}}:(H.warn("resolveNavigateFallback: unrecognized fallback option, using openWindow",e),{handler:"openWindow",params:{path:a,target:"_blank"}})}applyScrollOption(e,a,r){const i=e===void 0?r:e;if(i==="preserve")return;const l=a==="smooth"?"smooth":"instant",u=b=>{if(typeof b!="object"||b===null)return!1;const v=b;return"container"in v||"to"in v||"block"in v||"offset"in v},d=(b,v,S=0)=>{b===window?window.scrollTo({top:v,left:S,behavior:l}):b.scrollTo({top:v,left:S,behavior:l})},f=(b,v,S,E)=>{if(v===window){b.scrollIntoView({behavior:l,block:S}),E&&window.scrollBy({top:-E,left:0,behavior:l});return}const A=v,T=b.getBoundingClientRect(),L=A.getBoundingClientRect(),M=A.scrollTop+(T.top-L.top);let R;S==="center"?R=M-(A.clientHeight-b.clientHeight)/2:S==="end"?R=M-(A.clientHeight-b.clientHeight):R=M,R-=E,A.scrollTo({top:Math.max(0,R),left:0,behavior:l})},g=()=>{window.scrollTo({top:0,left:0,behavior:l});const b=document.getElementById("app")??document.body;if(!b)return;b.querySelectorAll("*").forEach(S=>{if(S.scrollTop===0&&S.scrollLeft===0)return;const E=window.getComputedStyle(S),A=E.overflowY,T=E.overflowX;(A==="auto"||A==="scroll"||T==="auto"||T==="scroll")&&S.scrollTo({top:0,left:0,behavior:l})})},m=()=>{try{if(u(i)){const b=i,v=b.block??"start",S=typeof b.offset=="number"?b.offset:0;let E=window;if(typeof b.container=="string"&&b.container.length>0){const T=document.querySelector(b.container);if(!T){H.warn(`applyScrollOption: container not found: ${b.container}`);return}E=T}const A=b.to??"top";if(A==="top"){E===window?g():d(E,0);return}if(typeof A=="number"){d(E,A-S);return}if(typeof A=="object"&&A!==null&&("x"in A||"y"in A)){const{x:T=0,y:L=0}=A;d(E,L-S,T);return}if(typeof A=="string"&&(A.startsWith("#")||A.startsWith("."))){const T=document.querySelector(A);T?f(T,E,v,S):H.warn(`applyScrollOption: target element not found: ${A}`);return}H.warn('applyScrollOption: invalid "to" value in extended form',A);return}if(i==="top"){g();return}if(typeof i=="number"){window.scrollTo({top:i,left:0,behavior:l});return}if(typeof i=="object"&&i!==null&&("x"in i||"y"in i)){const{x:b=0,y:v=0}=i;window.scrollTo({top:v,left:b,behavior:l});return}if(typeof i=="string"&&(i.startsWith("#")||i.startsWith("."))){const b=document.querySelector(i);b&&b.scrollIntoView({behavior:l,block:"start"});return}}catch(b){H.warn("applyScrollOption: failed to apply scroll",b)}};typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(m):m()}async handleOpenWindow(e,a){let r=e;if(a.query){const l=new URLSearchParams;for(const[d,f]of Object.entries(a.query))f!=null&&f!==""&&l.set(d,String(f));const u=l.toString();u&&(r=`${e}?${u}`)}const i=a.target==="_self"?"_self":"_blank";H.log("handleOpenWindow:",{target:e,params:a,finalPath:r,windowTarget:i}),i==="_self"?window.location.assign(r):window.open(r,"_blank")}async handleNavigateBack(){H.log("handleNavigateBack"),window.history.back()}async handleNavigateForward(){H.log("handleNavigateForward"),window.history.forward()}async handleReplaceUrl(e,a){let r=e;if(a.query)if(a.mergeQuery===!0)r=this.buildMergedQueryPath(e,a.query);else{const i=new URLSearchParams;for(const[u,d]of Object.entries(a.query))if(d!=null&&d!=="")if(Array.isArray(d)){const f=u.endsWith("[]")?u:`${u}[]`;for(const g of d)g!=null&&g!==""&&i.append(f,String(g))}else i.set(u,String(d));const l=i.toString();l&&(r=`${e}?${l}`)}H.log("handleReplaceUrl:",{target:e,params:a,finalPath:r}),window.history.replaceState(null,"",r),this.applyScrollOption(a.scroll,a.scrollBehavior,"preserve")}buildMergedQueryPath(e,a){const r=new URLSearchParams(window.location.search);for(const[u,d]of Object.entries(a))if(d==null||d==="")r.delete(u);else if(Array.isArray(d)){const f=u.endsWith("[]")?u:`${u}[]`;r.delete(u),r.delete(f);for(const g of d)g!=null&&g!==""&&r.append(f,String(g))}else r.set(u,String(d));const i=r.toString(),l=e.split("?")[0];return i?`${l}?${i}`:l}async ensureCsrfToken(){try{await fetch("/sanctum/csrf-cookie",{credentials:"include"})}catch(e){throw new It("Failed to fetch CSRF token",void 0,e instanceof Error?e:void 0)}}getCsrfTokenFromCookie(){const r=`; ${document.cookie}`.split("; XSRF-TOKEN=");if(r.length===2){const i=r.pop()?.split(";").shift();return i?decodeURIComponent(i):null}return null}buildQueryString(e){const a=new URLSearchParams;for(const[r,i]of Object.entries(e))if(!(i==null||i===""))if(Array.isArray(i))for(const l of i)l!=null&&l!==""&&a.append(`${r}[]`,String(l));else typeof i=="object"?a.append(r,JSON.stringify(i)):a.append(r,String(i));return a.toString()}async handleEnsureIdentityVerified(e){const a=typeof e.purpose=="string"?e.purpose:"sensitive_action",r=e.target&&typeof e.target=="object"?e.target:void 0;return await St.handle({success:!1,error_code:"identity_verification_required",message:"",verification:{policy_key:e.policy_key??"",purpose:a,provider_id:e.provider_id??null,render_hint:e.render_hint??null,return_request:null}},void 0,r)!==null}handleResolveIdentityChallenge(e){const a=typeof e.result=="string"?e.result:"cancelled";let r;switch(a){case"verified":{const i=typeof e.token=="string"?e.token:"";if(!i){H.warn("resolveIdentityChallenge: result=verified 인데 token 이 비어있습니다. failed 로 강등합니다."),r={status:"failed",failureCode:"MISSING_TOKEN"};break}r={status:"verified",token:i,providerData:e.providerData&&typeof e.providerData=="object"?e.providerData:void 0};break}case"pending":{const i=typeof e.pollUrl=="string"?e.pollUrl:"",l=typeof e.expiresAt=="string"?e.expiresAt:"";if(!i||!l){H.warn("resolveIdentityChallenge: result=pending 인데 pollUrl/expiresAt 누락 — failed 로 강등합니다."),r={status:"failed",failureCode:"MALFORMED_PENDING"};break}r={status:"pending",pollUrl:i,pollIntervalMs:typeof e.pollIntervalMs=="number"?e.pollIntervalMs:void 0,expiresAt:l};break}case"failed":r={status:"failed",failureCode:typeof e.failureCode=="string"?e.failureCode:"UNKNOWN",reason:typeof e.reason=="string"?e.reason:void 0};break;default:r={status:"cancelled"};break}return St.resolveDeferred(r),!0}async handleApiCall(e,a,r,i="none",l){const{method:u="GET",body:d,headers:f,contentType:g}=a;u!=="GET"&&u!=="HEAD"&&await this.ensureCsrfToken();const m=this.getCsrfTokenFromCookie();let b={};if(i==="required"||i==="optional"){const X=Ma().getToken();X&&(b={Authorization:`Bearer ${X}`})}let v=e;const S=a.query||(u==="GET"?d:null);if(S&&typeof S=="object"){const q=this.buildQueryString(S);if(q){const X=e.includes("?")?"&":"?";v=`${e}${X}${q}`}}const E=window.G7Core?.state?.getGlobal?.()||r.state?._global||{},A=window.G7Core?.state?.getLocal?.()||r.state?._local||{},T={_global:E,_local:A},L=this.getMatchingGlobalHeaders(e,T),M={};if(typeof window<"u"){const q=localStorage.getItem("g7_locale");q&&(M["Accept-Language"]=q)}const R=g==="multipart/form-data",D={method:u,headers:{...R?{}:{"Content-Type":"application/json"},Accept:"application/json",...M,...m&&{"X-XSRF-TOKEN":m},...b,...L,...f},credentials:"include"};if(d&&u!=="GET")if(R){const q=new FormData;for(const[X,ge]of Object.entries(d))ge instanceof File||ge instanceof Blob?q.append(X,ge):ge!=null&&q.append(X,typeof ge=="object"?JSON.stringify(ge):String(ge));D.body=q}else D.body=JSON.stringify(d);const U=Un();let j=null;U?.isEnabled()&&(j=U.trackRequest(v,u));try{let q=await fetch(v,D),X;try{X=await q.json()}catch{X=null}if(St.isIdentityRequired(q.status,X)){const ge=await St.handle(X,{body:D.body,headers:D.headers,credentials:D.credentials},l);if(ge){q=ge;try{X=await q.json()}catch{X=null}}}if(j&&U?.isEnabled()&&(U.completeRequest(j,q.status,X),j=null),!q.ok){const ge=X||{},Ee=new Error(ge.message||`API call failed: ${q.statusText}`);throw Ee.response=ge,Ee.status=q.status,Ee.statusText=q.statusText,new It(ge.message||`API call failed: ${q.statusText}`,void 0,Ee)}return X}catch(q){throw j&&U?.isEnabled()&&U.failRequest(j,q instanceof Error?q.message:String(q)),q}}async handleLogin(e,a,r){const{body:i}=a;if(!i||!i.email||!i.password)throw new It("Login requires email and password in body params");const l=e==="user"?"user":"admin",u=l==="admin"?"/api/auth/admin/login":"/api/auth/login",d=window.G7Core?.state?.getGlobal?.()||r.state?._global||{},f=window.G7Core?.state?.getLocal?.()||r.state?._local||{},g={_global:d,_local:f},m=this.getMatchingGlobalHeaders(u,g),b=ha.getInstance();try{const v=Object.keys(m).length>0?{headers:m}:void 0;return{user:await b.login(l,{email:i.email,password:i.password},v)}}catch(v){const S=v.message||"Login failed",E=new Error(S);throw E.response=v.response?.data||{},E.status=v.status||v.response?.status||500,new It(S,void 0,E)}}async handleLogout(e,a){await ha.getInstance().logout()}async handleSetState(e,a){H.log("[handleSetState] START, params:",e);const{target:r="component",scope:i,merge:l,__render:u,...d}=e,f=Un(),g=window.G7Core;if(typeof r=="string"&&(r.startsWith("$parent.")||r.startsWith("$root.")))return this.handleParentScopeSetState(r,d,l,a);const m=a.state&&Object.keys(a.state).length>0?a.state:g?.state?.get()||{},b=r==="global"?"_global":r.startsWith("_local.")?r:"_local",v=b==="_global"?m._global:b.startsWith("_local.")?this.getNestedProperty(m._local||{},b.slice(7)):m._local,S=f?.isEnabled()?f.startStateChange(b,v,d,{actionId:a.actionId,handlerType:"setState",source:`target=${r}`}):void 0,E=l==="replace"?"replace":l==="shallow"?"shallow":"deep",A=E!=="deep"?{...d,__mergeMode:E,...S?{__setStateId:S}:{}}:{...d,...S?{__setStateId:S}:{}};if(r==="global"){if(!this.globalStateUpdater){H.warn("Global state updater is not set"),S&&f&&f.completeStateChange(S);return}const T=g?.state?.get()||{},{__setStateId:L,__mergeMode:M,...R}=A,D=E==="deep"?this.deepMergeWithState(R,T):R,U={...D,...S?{__setStateId:S}:{},...E!=="deep"?{__mergeMode:E}:{}};return H.log("setState global:",U),this.globalStateUpdater(U,{render:u}),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"global",...E!=="deep"?{__mergeMode:E}:{},...D}}else if(r==="isolated"){const T=a.isolatedContext;if(T){const{__mergeMode:L,__setStateId:M,...R}=A;return T.mergeState(R,E),H.log("[handleSetState] isolated state updated:",R,"mergeMode:",E),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"isolated",...R}}else if(H.warn('[handleSetState] isolated target used but no IsolatedStateContext found. Make sure the component has "isolatedState" attribute. Falling back to local state.'),a.setState){const M=window.__g7PendingLocalState||a.state||{},R=E==="deep"?this.deepMergeWithState(A,M):A;return a.setState(R),S&&f&&setTimeout(()=>f.completeStateChange(S),0),R}else throw S&&f&&f.completeStateChange(S),new It("isolated target used but no IsolatedStateContext found and no setState function in context")}else if(r==="local"||r==="component"||r==="_local"){if(i==="parent"||i==="root"){const L=window.__g7LayoutContextStack||[];if(L.length>0){const M=i==="parent"?L[L.length-1]:L[0];if(M?.setState){const{__mergeMode:R,__setStateId:D,...U}=A,j=E==="deep"?this.deepMergeWithState(U,M.state||{}):U;return H.log(`[handleSetState] scope=${i}: 타겟 컨텍스트에 상태 업데이트`,j),M.setState(j),S&&f&&setTimeout(()=>f.completeStateChange(S),0),j}}H.warn(`[handleSetState] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const T=a.setState&&!a._isDispatchFallbackContext;if(H.log("[handleSetState] isRealComponentContext:",T,"context.setState:",!!a.setState,"_isDispatchFallbackContext:",a._isDispatchFallbackContext),T){H.log("[handleSetState] Using COMPONENT setState path"),H.log("[handleSetState] resolvedPayload:",A),H.log("[handleSetState] context.state:",a.state),H.log("[handleSetState] mergeMode:",E);const M=window.__g7PendingLocalState||a.state||{},R=E==="deep"?this.deepMergeWithState(A,{}):A;H.log("[handleSetState] convertedPayload (변경 필드만, dot notation 변환):",R),a.setState(R);const D=E==="deep"?this.deepMergeWithState(A,M):E==="shallow"?{...a.state||{},...A}:A,{__mergeMode:U,__setStateId:j,...q}=D;window.__g7PendingLocalState=q,H.log("[handleSetState] __g7PendingLocalState updated:",q),this.globalStateUpdater&&(this.globalStateUpdater({_local:q},{render:!1}),H.log("[handleSetState] _global._local synced (render:false):",q));const{__mergeMode:X,__setStateId:ge,...Ee}=A;if(E==="replace")window.__g7ForcedLocalFields=Ee;else{const Ce=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=this.deepMergeWithState(Ee,Ce)}return H.log("[handleSetState] __g7ForcedLocalFields updated:",Ee),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"local",...D}}else if(this.globalStateUpdater){H.log("[handleSetState] Using GLOBAL STATE UPDATER path for _local");const M=window.__g7PendingLocalState||m._local||{};H.log("[handleSetState] currentLocal (with pending):",M);const R=E==="deep"?this.deepMergeWithState(A,M):A;return H.log("[handleSetState] finalLocal (merged):",R),this.globalStateUpdater({_local:R},{render:u}),window.__g7PendingLocalState=R,H.log("[handleSetState] __g7PendingLocalState updated for globalStateUpdater path"),S&&f&&setTimeout(()=>f.completeStateChange(S),0),{__target:"local",...R}}else throw S&&f&&f.completeStateChange(S),new It("setState function is not provided in context and globalStateUpdater is not set")}else if(r.startsWith("_local.")){const T=r.slice(7),{__mergeMode:L,__setStateId:M,...R}=A,D=R.value!==void 0?R.value:Object.values(R)[0];if(a.setState){const j=window.__g7PendingLocalState||a.state||{},q=this.createNestedUpdate(T,D,j),X={...j,...q};return a.setState(q),S&&f&&setTimeout(()=>f.completeStateChange(S),0),X}else throw S&&f&&f.completeStateChange(S),new It("setState function is not provided in context")}else{if(!a.setState)throw S&&f&&f.completeStateChange(S),new It("setState function is not provided in context");const L=window.__g7PendingLocalState||a.state||{},M=E==="deep"?this.deepMergeWithState(A,L):A;return a.setState(M),S&&f&&setTimeout(()=>f.completeStateChange(S),0),M}}async handleParentScopeSetState(e,a,r,i){const l=Un(),u=window.G7Core,d=r==="replace"?"replace":r==="shallow"?"shallow":"deep",f=e.startsWith("$parent."),g=f?"$parent.":"$root.",m=e.slice(g.length);let b,v;if(m==="_local"||m==="_global")b=m,v=void 0;else if(m.startsWith("_local."))b="_local",v=m.slice(7);else if(m.startsWith("_global."))b="_global",v=m.slice(8);else{H.warn(`[handleParentScopeSetState] 지원하지 않는 타겟 형식: ${e}. _local 또는 _global으로 시작해야 합니다.`);return}const S=window.__g7LayoutContextStack||[];if(S.length===0){H.warn(`[handleParentScopeSetState] 레이아웃 컨텍스트 스택이 비어있습니다. target=${e}`);return}const E=f?S[S.length-1]:S[0];if(!E){H.warn(`[handleParentScopeSetState] 타겟 컨텍스트를 찾을 수 없습니다. target=${e}`);return}const A=b==="_global"?E.state?._global:E.state?._local,T=l?.isEnabled()?l.startStateChange(e,A,a,{actionId:i.actionId,handlerType:"setState",source:`target=${e}`}):void 0,{__mergeMode:L,__setStateId:M,...R}=a;if(b==="_global"){if(!this.globalStateUpdater){H.warn("[handleParentScopeSetState] globalStateUpdater가 설정되지 않았습니다."),T&&l&&l.completeStateChange(T);return}const D=u?.state?.get()||{};if(v){const U=R.value!==void 0?R.value:Object.values(R)[0],j=this.createNestedUpdate(v,U,D),q={...D,...j};H.log(`[handleParentScopeSetState] ${e}: 전역 상태 중첩 경로 업데이트`,q),this.globalStateUpdater(q)}else{const U=d==="deep"?this.deepMergeWithState(R,D):R;H.log(`[handleParentScopeSetState] ${e}: 전역 상태 업데이트 (mergeMode=${d})`,U),this.globalStateUpdater(d!=="deep"?{...U,__mergeMode:d}:U)}return T&&l&&setTimeout(()=>l.completeStateChange(T),0),{__target:e,...R}}else{if(!E.setState){H.warn(`[handleParentScopeSetState] 타겟 컨텍스트에 setState가 없습니다. target=${e}`),T&&l&&l.completeStateChange(T);return}const D=E.state||{};if(v){const U=R.value!==void 0?R.value:Object.values(R)[0],j=this.createNestedUpdate(v,U,D),q={...D,...j};return H.log(`[handleParentScopeSetState] ${e}: 로컬 상태 중첩 경로 업데이트`,j),E.setState(j),E.state=q,E.dataContext&&(E.dataContext._local=q),xd(),T&&l&&setTimeout(()=>l.completeStateChange(T),0),q}else{const U=d!=="deep"?{...R,__mergeMode:d}:R,j=d==="replace"?R:d==="shallow"?{...D,...R}:this.deepMergeWithState(R,D);return H.log(`[handleParentScopeSetState] ${e}: 로컬 상태 업데이트 (mergeMode=${d})`,j),E.setState(U),E.state=j,E.dataContext&&(E.dataContext._local=j),xd(),T&&l&&setTimeout(()=>l.completeStateChange(T),0),j}}}deepMergeWithState(e,a){const r=["errors"];let i=e;if("..."in e){const u=e["..."];if(u&&typeof u=="object"&&!Array.isArray(u)){const{"...":d,...f}=e;i={...u,...f}}else{const{"...":d,...f}=e;i=f}}const l={...a};for(const[u,d]of Object.entries(i)){if(r.includes(u)){l[u]=d;continue}if(u.includes(".")&&u!=="..."){const f=this.createNestedUpdate(u,d,l);this.deepMergeInto(l,f,l);continue}if(d!==null&&typeof d=="object"&&!Array.isArray(d)&&Object.getPrototypeOf(d)!==Object.prototype&&Object.getPrototypeOf(d)!==null){l[u]=d;continue}d!==null&&typeof d=="object"&&!Array.isArray(d)&&a[u]!==null&&typeof a[u]=="object"&&!Array.isArray(a[u])?l[u]=this.deepMergeWithState(d,a[u]):l[u]=d}return l}deepMergeInto(e,a,r){for(const[i,l]of Object.entries(a)){if(l===null){e[i]=l;continue}if(e[i]===null){e[i]=l;continue}typeof l=="object"&&!Array.isArray(l)&&e[i]!==void 0&&e[i]!==null&&typeof e[i]=="object"&&!Array.isArray(e[i])?(e[i]===r[i]&&(e[i]={...e[i]}),this.deepMergeInto(e[i],l,r[i]||{})):typeof l=="object"&&!Array.isArray(l)&&e[i]===void 0&&r[i]!==null&&typeof r[i]=="object"&&!Array.isArray(r[i])?e[i]={...r[i],...l}:e[i]=l}}createNestedUpdate(e,a,r){const i=e.split(".");if(i.length===1)return{[i[0]]:a};const l={};let u=l,d=r;for(let f=0;f<i.length-1;f++){const g=i[f],m=d?.[g],b=m!=null&&typeof m=="object"&&!Array.isArray(m);b?u[g]={...m}:u[g]={},u=u[g],d=b?m:{}}return u[i[i.length-1]]=a,l}buildNestedUpdate(e,a){const r=e.split(".");if(r.length===1)return{[r[0]]:a};const i={};let l=i;for(let u=0;u<r.length-1;u++)l[r[u]]={},l=l[r[u]];return l[r[r.length-1]]=a,i}async handleSetError(e,a,r){let i=e;i=this.resolveValue(i,r.data),this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,r.data));const l=a?.stateTarget||"local";l==="isolated"&&r.isolatedContext?(r.isolatedContext.mergeState({apiError:i}),H.log("[handleSetError] Error set to isolated state:",i)):l==="global"&&this.globalStateUpdater?(this.globalStateUpdater({apiError:i}),H.log("[handleSetError] Error set to global state:",i)):r.setState?(r.setState({apiError:i}),H.log("[handleSetError] Error set to local state:",i)):H.warn("[handleSetError] Cannot set error: no state updater available")}async handleOpenModal(e,a){if(!this.globalStateUpdater){H.warn("Global state updater is not set for openModal");return}const r=a.data?._global?.modalStack||[];if(r.includes(e)){H.warn(`Modal "${e}" is already open`);return}const i=window.G7Core,l=a.setState&&a.state!==void 0,u=l?void 0:i?.state?.getLocal?.()||{},d=!l&&u!==void 0&&this.globalStateUpdater;if(l||d){const m=window.__g7LayoutContextStack||[],b=l?a.state:u,v=l?a.setState:S=>{this.globalStateUpdater({_local:S})};m.push({state:b,setState:v,dataContext:{_local:b||a.data?._local,_global:l?a.data?._global:a.data?._global||i?.state?.get?.(),_computed:a.data?._computed}}),window.__g7LayoutContextStack=m,H.log(`[handleOpenModal] 레이아웃 컨텍스트 스택에 push, 스택 크기: ${m.length}, state:`,b,l?"(direct)":"(fallback via G7Core)")}else H.warn(`[handleOpenModal] 컨텍스트 스택에 push 실패 - setState: ${!!a.setState}, state: ${a.state!==void 0}, G7Core: ${!!i?.state?.getLocal}`);const f=[...r,e];this.globalStateUpdater({modalStack:f,activeModal:e});const g=Un();if(g?.isEnabled()){const m=r.length>0?r[r.length-1]:void 0;g.trackModalOpen?.({modalId:e,modalName:e,scopeType:"isolated",parentModalId:m,initialState:a.state?{...a.state}:{}})}}async handleCloseModal(e){if(!this.globalStateUpdater){H.warn("Global state updater is not set for closeModal");return}const a=e?.data?._global?.modalStack||[],r=a.length>0?a[a.length-1]:null,i=a.slice(0,-1),l=i.length>0?i[i.length-1]:null,u=window.__g7LayoutContextStack||[];if(u.length>0){const d=u[u.length-1];d&&(d.dataContext=void 0),u.pop(),window.__g7LayoutContextStack=u,H.log(`[handleCloseModal] 레이아웃 컨텍스트 스택에서 pop, 스택 크기: ${u.length}`)}if(r){const d=Un();d?.isEnabled()&&d.trackModalClose?.(r,e?.state)}this.globalStateUpdater({modalStack:i,activeModal:l})}async handleShowAlert(e,a){let r=e;this.translationEngine&&this.translationContext&&e.startsWith("$t:")&&(r=this.translationEngine.resolveTranslations(e,this.translationContext,a.data)),alert(r)}async handleToast(e,a){const{type:r="info",message:i,icon:l,duration:u}=e;if(r==="error"){const f=a.data?.error;if((f?.error_code==="identity_verification_required"||f?.data?.error_code==="identity_verification_required")&&St.consumeDomainNoticeShown()){H.log("[Toast] IDV 도메인 안내 표출됨 — 중복 가드 토스트 1건 skip");return}}let d=i;if(this.translationEngine&&this.translationContext&&i?.startsWith("$t:")&&(d=this.translationEngine.resolveTranslations(i,this.translationContext,a.data)),this.globalStateUpdater){const g={id:`toast_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,type:r,message:d,...l&&{icon:l},...u&&{duration:u}},S=[...window.G7Core?.state?.get()?.toasts||[],g];this.globalStateUpdater({toasts:S})}else H.log(`[Toast ${r}] ${d}`)}async handleSwitch(e,a){const{cases:r}=e;if(!r){H.warn("switch handler requires cases property");return}const i=this.resolveParams(e.params,a.data);let l;if(i?.value!==void 0?(l=i.value,H.log("switch handler: using params.value as case key:",l)):(l=a.data?.$args?.[0],H.log("switch handler: using $args[0] as case key:",l)),l==null){if(r.default)return H.log("switch handler: case key is undefined, using default case"),await this.executeAction(r.default,a);H.warn("switch handler: case key is not defined and no default case");return}const u=String(l);let d=r[u];if(!d&&r.default&&(H.log(`switch handler: no case found for key "${u}", using default case`),d=r.default),!d){H.warn(`switch handler: no case found for key "${u}" and no default case`);return}return await this.executeAction(d,a)}async handleConditions(e,a){const{conditions:r}=e;if(!r||!Array.isArray(r)){H.warn("conditions handler requires conditions array");return}const i=a.data||{},l=tp(r,i,this.bindingEngine);if(!l.matched){H.log("conditions handler: no matching branch found");return}const u=r[l.branchIndex];if(H.log(`conditions handler: matched branch ${l.branchIndex}`),!u.then){H.warn('conditions handler: matched branch has no "then" action');return}return Array.isArray(u.then)?await this.handleSequence({...e,actions:u.then},a):await this.executeAction(u.then,a)}handleStartInterval(e,a){const r=typeof e.id=="string"?e.id:"",i=Number(e.intervalMs??1e3),l=Array.isArray(e.actions)?e.actions:[];if(r===""||!l.length||i<=0)return H.warn("startInterval requires non-empty id, positive intervalMs, and actions array"),{success:!1};const u=this.intervals.get(r);u&&(clearInterval(u),this.intervals.delete(r));const d=setInterval(()=>{for(const f of l)this.executeAction(f,a).catch(g=>{H.error(`[startInterval:${r}] tick action failed`,g)})},i);return this.intervals.set(r,d),{success:!0,id:r}}handleStopInterval(e){const a=typeof e.id=="string"?e.id:"";if(a==="")return H.warn("stopInterval requires id parameter"),{success:!1};const r=this.intervals.get(a);return r&&(clearInterval(r),this.intervals.delete(a)),{success:!0,id:a}}stopAllIntervals(){for(const e of this.intervals.values())clearInterval(e);this.intervals.clear()}async handleSequence(e,a){const r=e.actions||e.params?.actions;if(!r||!Array.isArray(r)||r.length===0)return H.warn("sequence handler requires non-empty actions array"),[];const i=Un(),l=i?.isEnabled()&&i.startSequenceExecution?.({eventType:e.type})||"";window.__g7SequenceLocalSync=void 0;const u=[];let d,f=a.state?{...a.state}:{},g=a.isolatedContext?.state?{...a.isolatedContext.state}:{},m=a.data?._computed||{};const b=window.G7Core,v=()=>({_global:b?.state?.get()||{},_local:{...f},_isolated:Object.keys(g).length>0?{...g}:void 0});for(let S=0;S<r.length;S++){const E=r[S],A=Date.now();l&&i?.isEnabled()&&i.captureSequenceActionBefore?.(l,S,E.handler||"unknown",E.params||{},v());const T={...a,state:f,data:{...a.data,_local:f,_computed:m,$computed:m,$prev:d,$results:[...u],_isolated:g},isolatedContext:a.isolatedContext?{...a.isolatedContext,state:g}:null};try{const L=await this.executeAction(E,T);if(d=L.data,u.push(L.data),E.handler==="setState"&&L.data!==void 0){if(L.data.__target==="global"){const{__target:R,__mergeMode:D,...U}=L.data;D==="replace"?f={...f,_global:U}:f={...f,_global:{...f._global||{},...U}},H.log("[handleSequence] global state synchronized (mergeMode=%s):",D||"deep",f._global)}else if(L.data.__target==="isolated"){const{__target:R,__mergeMode:D,...U}=L.data;D==="replace"?g=U:g={...g,...U},H.log("[handleSequence] isolated state synchronized (mergeMode=%s):",D||"deep",g)}else if(L.data.__target==="local"){const{__target:R,__mergeMode:D,__setStateId:U,...j}=L.data;D==="replace"?f=j:f={...f,...j},H.log("[handleSequence] local state synchronized (mergeMode=%s):",D||"deep",f)}else f=L.data,H.log("[handleSequence] state synchronized (legacy):",f);const M=a.data?._computedDefinitions;if(M&&Object.keys(M).length>0){const R={},D={...a.data,_local:f,_computed:R,$computed:R,_isolated:g};for(const[U,j]of Object.entries(M))if(typeof j=="string"){const q=j.trim();if(q.startsWith("{{")&&q.endsWith("}}"))try{const X=q.slice(2,-2).trim();R[U]=this.bindingEngine.evaluateExpression(X,D,{skipCache:!0})}catch{R[U]=m[U]}}m=R,H.log("[handleSequence] _computed recalculated after setState:",m)}}if(E.handler!=="setState"){const M=window.__g7SequenceLocalSync;if(M&&M!==f){f=M,window.__g7SequenceLocalSync=void 0,H.log("[handleSequence] currentState synchronized from __g7SequenceLocalSync after custom handler:",E.handler);const R=a.data?._computedDefinitions;if(R&&Object.keys(R).length>0){const D={},U={...a.data,_local:f,_computed:D,$computed:D,_isolated:g};for(const[j,q]of Object.entries(R))if(typeof q=="string"){const X=q.trim();if(X.startsWith("{{")&&X.endsWith("}}"))try{const ge=X.slice(2,-2).trim();D[j]=this.bindingEngine.evaluateExpression(ge,U,{skipCache:!0})}catch{D[j]=m[j]}}m=D,H.log("[handleSequence] _computed recalculated after custom handler:",m)}}}l&&i?.isEnabled()&&i.captureSequenceActionAfter?.(l,S,v(),Date.now()-A,L.data)}catch(L){throw l&&i?.isEnabled()&&(i.captureSequenceActionAfter?.(l,S,v(),Date.now()-A,void 0,L),i.endSequenceExecution?.(l,L)),H.error(`sequence handler: action[${S}] failed:`,L),L}}return window.__g7SequenceLocalSync=void 0,l&&i?.isEnabled()&&i.endSequenceExecution?.(l),u}async handleParallel(e,a){const r=e.actions||e.params?.actions;if(!r||!Array.isArray(r)||r.length===0)return H.warn("parallel handler requires non-empty actions array"),[];H.log(`parallel handler: executing ${r.length} actions in parallel`);const i=a.isolatedContext?{...a.isolatedContext,state:{...a.isolatedContext.state}}:null,l=r.map((f,g)=>{const m={...a,isolatedContext:i};return this.executeAction(f,m).catch(b=>{throw H.error(`parallel handler: action[${g}] failed:`,b),b})}),u=await Promise.allSettled(l),d=u.filter(f=>f.status==="rejected").length;return d>0&&H.warn(`parallel handler: ${d}/${r.length} actions failed`),u}async handleLoadScript(e,a,r){const{src:i,id:l,async:u=!0,defer:d=!1}=e;if(!i)throw new It('loadScript handler requires "src" parameter',a);const f=l||`script_${i.replace(/[^a-zA-Z0-9]/g,"_")}`;return ss.loadedScripts.has(f)?(H.log(`loadScript: script already loaded, skipping: ${f}`),a.onLoad&&await this.executeAction(a.onLoad,r),!0):document.getElementById(f)?(H.log(`loadScript: script element already exists: ${f}`),ss.loadedScripts.add(f),a.onLoad&&await this.executeAction(a.onLoad,r),!0):(H.log(`loadScript: loading script: ${i}`),new Promise((m,b)=>{const v=document.createElement("script");v.id=f,v.src=i,v.async=u,v.defer=d,v.onload=async()=>{if(H.log(`loadScript: script loaded successfully: ${f}`),ss.loadedScripts.add(f),a.onLoad)try{await this.executeAction(a.onLoad,r)}catch(S){H.error("loadScript: onLoad action failed:",S)}m(!0)},v.onerror=S=>{H.error(`loadScript: failed to load script: ${i}`,S),b(new It(`Failed to load script: ${i}`,a))},document.head.appendChild(v)}))}async handleCallExternal(e,a,r){const i=e.constructor,l=e.args||{},u=e.method,d=e.methodArgs||[],f=e.callbackEvent,g=e.embedTarget,m=e.callbackSetState,b=e.callbackAction;if(!i)throw new It('callExternal handler requires "constructor" parameter',a);const v=this.getNestedProperty(window,i);if(!v||typeof v!="function")throw new It(`Constructor not found or not a function: ${i}. Make sure the script is loaded first using loadScript handler.`,a);H.log(`callExternal: calling constructor ${i}`);const S={...l};for(const[A,T]of Object.entries(l))T===!0&&(S[A]=L=>{if(H.log(`callExternal: callback triggered for ${A}`,L),f&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(f,L),m&&r.setState){const M=U=>{const j={};for(const[q,X]of Object.entries(U))typeof X=="string"?j[q]=this.getNestedProperty(L,X):typeof X=="object"&&X!==null&&(j[q]=M(X));return j},R=M(m);H.log("callExternal: callbackSetState mapping result",R);const D=this.deepMergeWithState(R,r.state||{});H.log("callExternal: merged with existing state",D),r.setState(D)}else f&&r.setState&&r.setState({[`${f.replace(/:/g,"_")}_result`]:L});if(b){const M={...r,data:{...r.data,$event:L}},R=Array.isArray(b)?b:[b];for(const D of R)try{this.executeAction(D,M)}catch(U){H.error("callExternal: callbackAction failed:",U)}}});const E=new v(S);if(u&&typeof E[u]=="function"){if(H.log(`callExternal: calling method ${u}`),u==="embed"&&g){const A=document.querySelector(g);if(A)return E[u](A,...d);throw new It(`Embed target element not found: ${g}`,a)}return E[u](...d)}return E}async handleCallExternalEmbed(e,a,r){const i=e.constructor,l=e.args||{},u=e.callbackSetState,d=e.callbackEvent,f=e.layerClassName,g=e.callbackAction;if(!i)throw new It('callExternalEmbed handler requires "constructor" parameter',a);const m=this.getNestedProperty(window,i);if(!m||typeof m!="function")throw new It(`Constructor not found or not a function: ${i}. Make sure the script is loaded first.`,a);H.log(`callExternalEmbed: creating layer for ${i}`);const{layer:b,closeLayer:v}=this.createEmbedLayer(f),S={...l};for(const[A,T]of Object.entries(l))T===!0&&(S[A]=L=>{if(H.log(`callExternalEmbed: callback triggered for ${A}`,L),v(),d&&typeof window<"u"&&window.G7Core?.componentEvent&&window.G7Core.componentEvent.emit(d,L),u&&r.setState){const M=U=>{const j={};for(const[q,X]of Object.entries(U))typeof X=="string"?j[q]=this.getNestedProperty(L,X):typeof X=="object"&&X!==null&&(j[q]=M(X));return j},R=M(u);H.log("callExternalEmbed: callbackSetState mapping result",R);const D=this.deepMergeWithState(R,r.state||{});H.log("callExternalEmbed: merged with existing state",D),r.setState(D)}if(g){const M={...r,data:{...r.data,$event:L}},R=Array.isArray(g)?g:[g];for(const D of R)try{this.executeAction(D,M)}catch(U){H.error("callExternalEmbed: callbackAction failed:",U)}}});const E=new m(S);if(typeof E.embed=="function")E.embed(b),H.log("callExternalEmbed: embedded in layer");else throw v(),new It(`Constructor ${i} does not have embed method`,a);return E}isImeComposing(e){return e?.isComposing===!0||e?.keyCode===229}createEmbedLayer(e){const a=document.createElement("div");a.id="g7-embed-overlay",a.style.cssText=`
position: fixed;
inset: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
`;const r=document.createElement("div");r.id="g7-embed-layer",r.style.cssText=`
position: relative;
background: white;
border-radius: 8px;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
max-width: 90vw;
max-height: 90vh;
overflow: hidden;
`,e&&(r.className=e);const i=document.createElement("button");i.type="button",i.innerHTML="×",i.style.cssText=`
position: absolute;
top: 8px;
right: 8px;
width: 32px;
height: 32px;
border: none;
background: rgba(0, 0, 0, 0.1);
border-radius: 50%;
font-size: 20px;
cursor: pointer;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
color: #666;
transition: background-color 0.2s;
`,i.onmouseenter=()=>{i.style.backgroundColor="rgba(0, 0, 0, 0.2)"},i.onmouseleave=()=>{i.style.backgroundColor="rgba(0, 0, 0, 0.1)"};const l=()=>{a.parentNode&&a.parentNode.removeChild(a)};i.onclick=l;const u=d=>{this.isImeComposing(d)||d.key==="Escape"&&(l(),document.removeEventListener("keydown",u))};return document.addEventListener("keydown",u),a.onclick=d=>{d.target===a&&l()},r.appendChild(i),a.appendChild(r),document.body.appendChild(a),{overlay:a,layer:r,closeLayer:l}}getNestedProperty(e,a){return a.split(".").reduce((r,i)=>r&&r[i]!==void 0?r[i]:void 0,e)}async handleSaveToLocalStorage(e,a){const{key:r,value:i}=e;if(!r)return H.error("saveToLocalStorage: key parameter is required"),!1;try{const l=typeof i=="string"?i:JSON.stringify(i);return localStorage.setItem(r,l),H.log(`saveToLocalStorage: saved ${r}`,i),!0}catch(l){return H.error("saveToLocalStorage: failed to save",{key:r,error:l}),!1}}async handleLoadFromLocalStorage(e,a){const{key:r,target:i,stateKey:l,defaultValue:u}=e;if(!r)return H.error("loadFromLocalStorage: key parameter is required"),u;try{const d=localStorage.getItem(r);if(d===null)return H.log(`loadFromLocalStorage: no value found for ${r}, using default`),l&&a.setState&&a.setState({[l]:u}),u;let f;try{f=JSON.parse(d)}catch{f=d}return H.log(`loadFromLocalStorage: loaded ${r}`,f),l&&a.setState&&a.setState({[l]:f}),f}catch(d){return H.error("loadFromLocalStorage: failed to load",{key:r,error:d}),u}}async handleCustomAction(e,a){const r=this.customHandlers.get(e.handler);if(!r){if(this.previewMode){H.warn(`[Preview] Unknown action handler "${e.handler}" — skipped (preview mode)`);return}const i=new It(`Unknown action handler: ${e.handler}`,e);throw i.unknownHandler=!0,i}return await r(e,a)}resolveParams(e,a){if(!e)return{};const r={};for(const[i,l]of Object.entries(e))i.includes("{{")&&H.warn(`[resolveParams] setState params의 키에 표현식이 포함되어 있습니다: "${i}". 키는 해석되지 않습니다. 배열 항목 수정은 .map()/.filter() 패턴을 사용하세요.`),typeof l=="string"&&l.includes("{{")?r[i]=this.evaluateExpression(l,a):typeof l=="string"?r[i]=l:Array.isArray(l)?r[i]=l.map(u=>typeof u=="string"&&u.includes("{{")?this.evaluateExpression(u,a):u):typeof l=="object"&&l!==null&&!Array.isArray(l)&&Object.getPrototypeOf(l)!==Object.prototype&&Object.getPrototypeOf(l)!==null?r[i]=l:typeof l=="object"&&l!==null?r[i]=this.resolveParams(l,a):r[i]=l;return r}resolveValue(e,a){return a?this.bindingEngine.resolveBindings(e,a,{skipCache:!0}):e}evaluateExpressions(e,a){let r={};for(const[i,l]of Object.entries(e))if(i==="..."){let u=l;typeof l=="string"&&l.includes("{{")&&(u=this.evaluateExpression(l,a)),u&&typeof u=="object"&&!Array.isArray(u)&&(r={...r,...u})}else typeof l=="string"&&l.includes("{{")?r[i]=this.evaluateExpression(l,a):typeof l=="object"&&l!==null&&!Array.isArray(l)?r[i]=this.evaluateExpressions(l,a):r[i]=l;return r}evaluateExpressionsIfNeeded(e,a){const r={};for(const[i,l]of Object.entries(e))typeof l=="string"&&l.includes("{{")?r[i]=this.evaluateExpression(l,a):r[i]=l;return r}evaluateExpression(e,a){if(!a)return e;const r=e.match(/^\{\{(.+)\}\}$/);if(!(r&&!r[1].includes("}}")&&!r[1].includes("{{"))){let d=a;if(e.includes("_global")){const g=window.G7Core?.state?.get()?._global;g&&(d={...a,_global:g})}if(e.includes("_computed")||e.includes("$computed")){const g=window.__g7ActionContext?.computedRef?.current;g&&Object.keys(g).length>0&&(d={...d,_computed:g,$computed:g})}return this.bindingEngine.resolveBindings(e,d,{skipCache:!0})}let l=r[1].trim();l=l.replace(/\$args\.(\d+)/g,"$args[$1]");let u=a;if(l.includes("_global")){const f=window.G7Core?.state?.get()?._global;f&&(u={...a,_global:f})}if(l.includes("_computed")||l.includes("$computed")){const f=window.__g7ActionContext?.computedRef?.current;f&&Object.keys(f).length>0&&(u={...u,_computed:f,$computed:f})}l.includes("_global.modules")&&(H.log("[evaluateExpression] expression:",l),H.log("[evaluateExpression] dataContext._global:",u._global),H.log("[evaluateExpression] dataContext._global?.modules:",u._global?.modules));try{const d=this.bindingEngine.evaluateExpression(l,u);return l.includes("_global.modules")&&H.log("[evaluateExpression] result:",d),typeof d=="string"&&d.startsWith("$t:")&&this.translationEngine&&this.translationContext?this.translationEngine.resolveTranslations(d,this.translationContext,a):d}catch(d){return H.error("Expression evaluation failed:",e,d),e}}setDefaultContext(e){this.defaultContext={...this.defaultContext,...e}}setGlobalStateUpdater(e){this.globalStateUpdater=e}getGlobalStateUpdater(){return this.globalStateUpdater}async dispatchAction(e,a){const r={...this.defaultContext,...a,data:{...this.defaultContext.data,...a?.data}};if(e.confirm){let i=this.resolveValue(e.confirm,r.data);if(this.translationEngine&&this.translationContext&&i.startsWith("$t:")&&(i=this.translationEngine.resolveTranslations(i,this.translationContext,r.data)),!confirm(i))return{success:!1}}try{return await this.executeAction(e,r)}catch(i){if(H.error("dispatchAction failed:",i),e.onError){const l=i instanceof It&&i.originalError?{message:i.originalError.message,response:i.originalError.response}:{message:i instanceof Error?i.message:String(i)},u={...r,data:{...r.data,error:l}},d=Array.isArray(e.onError)?e.onError:[e.onError];for(const f of d)await this.executeAction(f,u)}return{success:!1,error:i instanceof Error?i:new Error(String(i))}}}registerHandler(e,a,r){this.customHandlers.set(e,a);const i=Un();i?.isEnabled()&&i.trackHandlerRegistration(e,r?.category??"custom",r?.description,r?.source)}unregisterHandler(e){this.customHandlers.delete(e);const a=Un();a?.isEnabled()&&a.trackHandlerUnregistration(e)}getRegisteredHandlers(){return Array.from(this.customHandlers.keys())}getHandler(e){return this.customHandlers.get(e)}normalizeDebounceConfig(e){return typeof e=="number"?{delay:e,leading:!1,trailing:!0}:{delay:e.delay,leading:e.leading??!1,trailing:e.trailing??!0}}extractEventData(e){const a=e.target;if(a&&!("tagName"in a)){const l={type:e.type??"custom",target:{value:a.value,name:a.name??""}};return e._changedKeys&&(l._changedKeys=e._changedKeys),l}const i=a?{value:a.value,name:a.name??"",checked:a.checked??!1,type:a.type??"",tagName:a.tagName}:{};if(e.type==="scroll"&&a){const l=a;i.scrollHeight=l.scrollHeight??0,i.scrollTop=l.scrollTop??0,i.clientHeight=l.clientHeight??0,i.scrollLeft=l.scrollLeft??0,i.clientWidth=l.clientWidth??0,i.scrollWidth=l.scrollWidth??0}return{type:e.type,target:a?i:null}}executeDebouncedAction(e,a,r,i,l){const u={...r,$event:a,$args:l},d={type:a.type,target:a.target,preventDefault:()=>{},stopPropagation:()=>{}};this.createHandler(e,u,i)(d)}handleDebouncedAction(e,a,r,i,l,u){const d=this.normalizeDebounceConfig(e.debounce),f=l||`default-${e.handler}-${Date.now()}`,g=this.extractEventData(a),m=g._changedKeys;if(m&&Array.isArray(m)&&g?.target?.value&&typeof g.target.value=="object"&&!Array.isArray(g.target.value)){const E=this.debounceAccumulatedValues.get(f);if(E){const A={...E};for(const T of m)A[T]=g.target.value[T];g.target.value=A}this.debounceAccumulatedValues.set(f,g.target.value)}const b=this.debounceTimers.get(f);b&&(clearTimeout(b),this.debounceTimers.delete(f));const v=Un();v?.isEnabled()&&v.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"pending",params:e.params,debounce:{delay:d.delay,status:"pending",scheduledAt:Date.now()}});const S=!this.debounceTimers.has(f+"_leading");if(d.leading&&S&&(this.debounceTimers.set(f+"_leading",setTimeout(()=>{},0)),this.executeDebouncedAction(e,g,r,i,u),v?.isEnabled()&&v.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"success",params:e.params,debounce:{delay:d.delay,status:"executed",executedAt:Date.now(),mode:"leading"}})),d.trailing){const E=()=>{this.executeDebouncedAction(e,g,r,i,u),v?.isEnabled()&&v.trackAction({handler:typeof e.handler=="string"?e.handler:String(e.handler),type:e.type,status:"success",params:e.params,debounce:{delay:d.delay,status:"executed",executedAt:Date.now(),mode:"trailing"}})},A=setTimeout(()=>{this.debounceTimers.delete(f),this.debounceTimers.delete(f+"_leading"),this.pendingDebounceFlushers.delete(f),this.debounceAccumulatedValues.delete(f),E()},d.delay);this.debounceTimers.set(f,A),this.pendingDebounceFlushers.set(f,E)}}clearDebounceTimers(e){if(e)for(const[a,r]of this.debounceTimers)a.startsWith(e+"-")&&(clearTimeout(r),this.debounceTimers.delete(a),this.pendingDebounceFlushers.delete(a),this.debounceAccumulatedValues.delete(a));else{for(const a of this.debounceTimers.values())clearTimeout(a);this.debounceTimers.clear(),this.pendingDebounceFlushers.clear(),this.debounceAccumulatedValues.clear()}}debouncedCall(e,a,r){const i=this.debounceTimers.get(e);i&&(clearTimeout(i),this.debounceTimers.delete(e));const l=setTimeout(()=>{this.debounceTimers.delete(e),this.pendingDebounceFlushers.delete(e),r()},a);this.debounceTimers.set(e,l),this.pendingDebounceFlushers.set(e,r)}flushPendingDebounceTimers(){if(this.pendingDebounceFlushers.size===0)return;const e=new Map(this.pendingDebounceFlushers);for(const[a,r]of e){const i=this.debounceTimers.get(a);i&&(clearTimeout(i),this.debounceTimers.delete(a)),this.debounceTimers.delete(a+"_leading"),this.pendingDebounceFlushers.delete(a),r()}this.globalStateUpdater&&this.globalStateUpdater({})}bindActionsToProps(e,a,r){const i={...e};if(e.actions&&Array.isArray(e.actions)){const l=new Map;for(const m of e.actions){const b=this.resolveActionRef(m),v=b.event||this.getEventHandlerName(b.type);l.has(v)||l.set(v,[]),l.get(v).push(b)}const u=e.name||e.id||"unknown",d=l.has("onDrop"),f=l.has("onDragOver"),g=l.has("onDragEnter");d&&!f&&(i.onDragOver=m=>{m.preventDefault()}),d&&!g&&(i.onDragEnter=m=>{m.preventDefault()});for(const[m,b]of l)i[m]=(...v)=>{for(const S of b){const E=v[0],A=E&&typeof E=="object"&&"preventDefault"in E;if(A&&(m==="onDragOver"||m==="onDrop")&&E.preventDefault(),A&&S.key&&"key"in E){if(this.isImeComposing(E)){H.log("Key filter skipped (IME composing):",S.key);continue}if(E.key!==S.key){H.log("Key filter not matched:",S.key,"actual:",E.key);continue}H.log("Key filter matched:",S.key)}if(S.debounce){const T=`${u}-${S.handler}-${m}`,L=E&&typeof E=="object"&&!("preventDefault"in E)&&"target"in E&&E.target!==null;let M;if(A)M=E;else if(L){const D={type:"custom",target:E.target,preventDefault:()=>{},stopPropagation:()=>{}};E._changedKeys&&(D._changedKeys=E._changedKeys),M=D}else M=new Event("custom");const R=S.event?{...a,$args:v}:a;this.handleDebouncedAction(S,M,R,r,T,v)}else if(this.flushPendingDebounceTimers(),S.event){const T={...a,$args:v},L=A?E:new Event("custom");this.createHandler(S,T,r)(L)}else if(A)this.createHandler(S,a,r)(E);else if(E&&typeof E=="object"&&!("preventDefault"in E)&&"target"in E&&E.target!==null){const L={type:"custom",target:E.target,preventDefault:()=>{},stopPropagation:()=>{}};this.createHandler(S,a,r)(L)}}}}return i}getEventHandlerName(e){return{click:"onClick",change:"onChange",input:"onInput",submit:"onSubmit",focus:"onFocus",blur:"onBlur",keydown:"onKeyDown",keyup:"onKeyUp",keypress:"onKeyPress",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",scroll:"onScroll",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",dragenter:"onDragEnter",dragover:"onDragOver",dragleave:"onDragLeave",drop:"onDrop"}[e]||`on${e.charAt(0).toUpperCase()}${e.slice(1)}`}sanitizeForDevTools(e,a=5){const r=new WeakSet,i=(l,u)=>{if(l==null||typeof l=="string"||typeof l=="number"||typeof l=="boolean")return l;if(u>a)return"[Max Depth Exceeded]";if(typeof l=="function")return`[Function: ${l.name||"anonymous"}]`;if(l instanceof Element)return`[Element: ${l.tagName}${l.className?"."+l.className.split(" ").join("."):""}]`;if(l instanceof Event)return`[Event: ${l.type}]`;if(Array.isArray(l)){if(r.has(l))return"[Circular Array]";r.add(l);const d=l.slice(0,10).map(f=>i(f,u+1));return l.length>10&&d.push(`... ${l.length-10} more items`),d}if(typeof l=="object"){if(r.has(l))return"[Circular Reference]";r.add(l);const d={},f=Object.keys(l),g=f.slice(0,20);for(const m of g)try{d[m]=i(l[m],u+1)}catch{d[m]="[Error accessing property]"}return f.length>20&&(d["..."]=`${f.length-20} more properties`),d}return String(l)};return i(e,0)}};$(ss,"loadedScripts",new Set);let ro=ss,Gl=null;function Kp(o){return Gl||(Gl=new ro(o)),Gl}function V0(o){Gl=o}const Wp=ct("TransitionManager");class F0{constructor(){$(this,"isPending",!1);$(this,"subscribers",new Set)}setPending(e){this.isPending!==e&&(Wp.log("setPending:",{from:this.isPending,to:e,stack:new Error().stack}),this.isPending=e,this.notifySubscribers())}getIsPending(){return this.isPending}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}notifySubscribers(){Wp.log("notifySubscribers:",{isPending:this.isPending,subscriberCount:this.subscribers.size}),this.subscribers.forEach(e=>{e(this.isPending)})}clearSubscribers(){this.subscribers.clear()}}const $a=new F0,Vl=ct("TransitionContext"),Yp=N.createContext({isTransitioning:!1}),Td=({children:o})=>{const[e,a]=N.useState(()=>{const i=$a.getIsPending();return Vl.log("Initial state:",i),i});N.useEffect(()=>{Vl.log("Subscribing to TransitionManager");const i=$a.subscribe(l=>{Vl.log("Received isPending update:",l),a(l)});return()=>{Vl.log("Unsubscribing from TransitionManager"),i()}},[]);const r=N.useMemo(()=>({isTransitioning:e}),[e]);return ut.jsx(Yp.Provider,{value:r,children:o})},Xp=()=>N.useContext(Yp),Fl="__g7LocalInitTracking";function Rd(){const o=globalThis;return o[Fl]||(o[Fl]={hash:"",timestamp:void 0,consumed:void 0}),o[Fl]}function K0(){const o=globalThis;o[Fl]={hash:"",timestamp:void 0,consumed:void 0}}function W0(o){Rd().consumed=o}function Y0(o){return Rd().consumed===o}function X0(o,e){return typeof o=="number"&&typeof e=="number"?Math.max(o,e):e??o}function J0(o,e){if(e===void 0)return o;if(!(o!==null&&typeof o=="object"&&e!==null&&typeof e=="object"&&!Y0(o)))return e;const{_forceLocalInit:r,...i}=o,{_forceLocalInit:l,...u}=e,d={...i,...u},f=X0(r,l);return f!==void 0&&(d._forceLocalInit=f),d}function Q0(o){return o<768?"mobile":o<1024?"tablet":"desktop"}function Jp(o){const e=Q0(o);return{width:o,isMobile:e==="mobile",isTablet:e==="tablet",isDesktop:e==="desktop",matchedPreset:e}}const kd=N.createContext(Jp(1024)),Kl=({children:o,overrideWidth:e})=>{const[a,r]=N.useState(()=>oi.getWidth());N.useEffect(()=>{const u=oi.subscribe(d=>{r(d)});return()=>{u()}},[]);const i=e??a,l=N.useMemo(()=>Jp(i),[i]);return ut.jsx(kd.Provider,{value:l,children:o})},Dd=()=>N.useContext(kd);window.G7Core?.createLogger?.("Core:State");function Z0(o,e,a,r){const{syncOnControlledChange:i=!0,isEqual:l}=r??{},u=o!==void 0;N.useRef(u);const[d,f]=N.useState(o!==void 0?o:e),g=d,m=N.useRef(o),b=N.useRef(!1);N.useEffect(()=>{if(b.current){m.current=o;return}i&&u&&o!==m.current&&(l?!l(d,o):d!==o)&&f(o),m.current=o},[o,u,i,l,d]);const v=N.useCallback(S=>{const E=typeof S=="function"?S(g):S;(l?l(g,E):g===E)||(b.current=!0,f(E),a?.(E),requestAnimationFrame(()=>{b.current=!1}))},[g,u,a,l]);return[g,v]}function eC(o,e){return o===e?!0:o.length!==e.length?!1:o.every((a,r)=>a===e[r])}function Qp(o,e){if(o===e)return!0;const a=Object.keys(o),r=Object.keys(e);return a.length!==r.length?!1:a.every(i=>o[i]===e[i])}const Zp=N.createContext({}),tC=({children:o,value:e})=>ut.jsx(Zp.Provider,{value:e,children:o}),nC=()=>N.useContext(Zp),aC=(o,e)=>{if(!o)return;const a=e.split(".");let r=o;for(const i of a){if(r==null)return;r=r[i]}return r},rC=(o,e,a)=>{const r=e.split(".");if(r.length===1)return{...o,[r[0]]:a};const i={...o};let l=i;for(let u=0;u<r.length-1;u++){const d=r[u],f=r[u+1],g=/^\d+$/.test(f);Array.isArray(l[d])&&!g?l[d]={...l[d]}:Array.isArray(l[d])?l[d]=[...l[d]]:g?l[d]=Array.isArray(l[d])?[...l[d]]:[]:l[d]={...l[d]||{}},l=l[d]}return l[r[r.length-1]]=a,i},Qi=ct("IsolatedStateContext"),iC={state:{},setState:()=>{Qi.warn("IsolatedStateContext not available: setState called outside IsolatedStateProvider")},getState:()=>{},mergeState:()=>{Qi.warn("IsolatedStateContext not available: mergeState called outside IsolatedStateProvider")},stateRef:{current:{}},scopeId:""},em=N.createContext(iC);let sC=0;function oC(){return`isolated-${++sC}-${Date.now().toString(36)}`}function tm(o,e){if(e==null)return o;if(typeof e!="object"||Array.isArray(e))return e;const a={...o};for(const r of Object.keys(e)){const i=e[r],l=o?.[r];i!==null&&typeof i=="object"&&!Array.isArray(i)&&l!==null&&typeof l=="object"&&!Array.isArray(l)?a[r]=tm(l,i):a[r]=i}return a}function lC(o,e){return e?e.split(".").reduce((a,r)=>a?.[r],o):o}function cC(o,e,a){const r=e.split("."),i={...o};let l=i;for(let u=0;u<r.length-1;u++){const d=r[u];l[d]={...l[d]},l=l[d]}return l[r[r.length-1]]=a,i}const uC=({initialState:o={},scopeId:e,children:a})=>{const i=N.useRef(e||oC()).current,[l,u]=N.useState(o),d=N.useRef(l);d.current=l;const f=N.useCallback(S=>lC(d.current,S),[]),g=N.useCallback((S,E)=>{u(A=>{const T=cC(A,S,E);return Qi.log(`[${i}] setState: ${S} =`,E),T})},[i]),m=N.useCallback((S,E="deep")=>{u(A=>{let T;return E==="replace"?T=S:E==="shallow"?T={...A,...S}:T=tm(A,S),Qi.log(`[${i}] mergeState (${E}):`,S),T})},[i]),b=N.useMemo(()=>({state:l,setState:g,getState:f,mergeState:m,stateRef:d,scopeId:i}),[l,g,f,m,i]),v=N.useMemo(()=>({state:d.current,setState:g,getState:f,mergeState:m}),[g,f,m]);return N.useEffect(()=>{const S=window.G7Core,E=window.__g7IsolatedStates||{};return window.__g7IsolatedStates||(window.__g7IsolatedStates=E),E[i]=v,S&&(S._isolatedStates||(S._isolatedStates={}),S._isolatedStates[i]=l),S?.devTools?.isEnabled?.()&&S.devTools.emit?.("isolated:created",{id:i,state:l}),Qi.log(`[${i}] IsolatedStateProvider mounted with initial state:`,l),()=>{delete E[i],S?._isolatedStates&&delete S._isolatedStates[i],S?.devTools?.isEnabled?.()&&S.devTools.emit?.("isolated:destroyed",{id:i}),Qi.log(`[${i}] IsolatedStateProvider unmounted`)}},[i,v]),N.useEffect(()=>{const S=window.G7Core,E=window.__g7IsolatedStates;E?.[i]&&(E[i].state=l),S?._isolatedStates&&(S._isolatedStates[i]=l),S?.devTools?.isEnabled?.()&&S.devTools.emit?.("isolated:updated",{id:i,state:l})},[l,i]),ut.jsx(em.Provider,{value:b,children:a})},dC=()=>{const o=N.useContext(em);return o.scopeId?o:null};var Er=Ng();function fC(){for(var o=arguments.length,e=new Array(o),a=0;a<o;a++)e[a]=arguments[a];return N.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const Wl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zi(o){const e=Object.prototype.toString.call(o);return e==="[object Window]"||e==="[object global]"}function Od(o){return"nodeType"in o}function Tn(o){var e,a;return o?Zi(o)?o:Od(o)&&(e=(a=o.ownerDocument)==null?void 0:a.defaultView)!=null?e:window:window}function Ld(o){const{Document:e}=Tn(o);return o instanceof e}function io(o){return Zi(o)?!1:o instanceof Tn(o).HTMLElement}function nm(o){return o instanceof Tn(o).SVGElement}function es(o){return o?Zi(o)?o.document:Od(o)?Ld(o)?o:io(o)||nm(o)?o.ownerDocument:document:document:document}const Na=Wl?N.useLayoutEffect:N.useEffect;function Md(o){const e=N.useRef(o);return Na(()=>{e.current=o}),N.useCallback(function(){for(var a=arguments.length,r=new Array(a),i=0;i<a;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function hC(){const o=N.useRef(null),e=N.useCallback((r,i)=>{o.current=setInterval(r,i)},[]),a=N.useCallback(()=>{o.current!==null&&(clearInterval(o.current),o.current=null)},[]);return[e,a]}function so(o,e){e===void 0&&(e=[o]);const a=N.useRef(o);return Na(()=>{a.current!==o&&(a.current=o)},e),a}function oo(o,e){const a=N.useRef();return N.useMemo(()=>{const r=o(a.current);return a.current=r,r},[...e])}function Yl(o){const e=Md(o),a=N.useRef(null),r=N.useCallback(i=>{i!==a.current&&e?.(i,a.current),a.current=i},[]);return[a,r]}function $d(o){const e=N.useRef();return N.useEffect(()=>{e.current=o},[o]),e.current}let Nd={};function lo(o,e){return N.useMemo(()=>{if(e)return e;const a=Nd[o]==null?0:Nd[o]+1;return Nd[o]=a,o+"-"+a},[o,e])}function am(o){return function(e){for(var a=arguments.length,r=new Array(a>1?a-1:0),i=1;i<a;i++)r[i-1]=arguments[i];return r.reduce((l,u)=>{const d=Object.entries(u);for(const[f,g]of d){const m=l[f];m!=null&&(l[f]=m+o*g)}return l},{...e})}}const ts=am(1),co=am(-1);function gC(o){return"clientX"in o&&"clientY"in o}function Id(o){if(!o)return!1;const{KeyboardEvent:e}=Tn(o.target);return e&&o instanceof e}function pC(o){if(!o)return!1;const{TouchEvent:e}=Tn(o.target);return e&&o instanceof e}function Hd(o){if(pC(o)){if(o.touches&&o.touches.length){const{clientX:e,clientY:a}=o.touches[0];return{x:e,y:a}}else if(o.changedTouches&&o.changedTouches.length){const{clientX:e,clientY:a}=o.changedTouches[0];return{x:e,y:a}}}return gC(o)?{x:o.clientX,y:o.clientY}:null}const uo=Object.freeze({Translate:{toString(o){if(!o)return;const{x:e,y:a}=o;return"translate3d("+(e?Math.round(e):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(o){if(!o)return;const{scaleX:e,scaleY:a}=o;return"scaleX("+e+") scaleY("+a+")"}},Transform:{toString(o){if(o)return[uo.Translate.toString(o),uo.Scale.toString(o)].join(" ")}},Transition:{toString(o){let{property:e,duration:a,easing:r}=o;return e+" "+a+"ms "+r}}}),rm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function mC(o){return o.matches(rm)?o:o.querySelector(rm)}const yC={display:"none"};function bC(o){let{id:e,value:a}=o;return Ye.createElement("div",{id:e,style:yC},a)}function vC(o){let{id:e,announcement:a,ariaLiveType:r="assertive"}=o;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ye.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},a)}function SC(){const[o,e]=N.useState("");return{announce:N.useCallback(r=>{r!=null&&e(r)},[]),announcement:o}}const im=N.createContext(null);function wC(o){const e=N.useContext(im);N.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(o)},[o,e])}function CC(){const[o]=N.useState(()=>new Set),e=N.useCallback(r=>(o.add(r),()=>o.delete(r)),[o]);return[N.useCallback(r=>{let{type:i,event:l}=r;o.forEach(u=>{var d;return(d=u[i])==null?void 0:d.call(u,l)})},[o]),e]}const EC={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},_C={onDragStart(o){let{active:e}=o;return"Picked up draggable item "+e.id+"."},onDragOver(o){let{active:e,over:a}=o;return a?"Draggable item "+e.id+" was moved over droppable area "+a.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(o){let{active:e,over:a}=o;return a?"Draggable item "+e.id+" was dropped over droppable area "+a.id:"Draggable item "+e.id+" was dropped."},onDragCancel(o){let{active:e}=o;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function AC(o){let{announcements:e=_C,container:a,hiddenTextDescribedById:r,screenReaderInstructions:i=EC}=o;const{announce:l,announcement:u}=SC(),d=lo("DndLiveRegion"),[f,g]=N.useState(!1);if(N.useEffect(()=>{g(!0)},[]),wC(N.useMemo(()=>({onDragStart(b){let{active:v}=b;l(e.onDragStart({active:v}))},onDragMove(b){let{active:v,over:S}=b;e.onDragMove&&l(e.onDragMove({active:v,over:S}))},onDragOver(b){let{active:v,over:S}=b;l(e.onDragOver({active:v,over:S}))},onDragEnd(b){let{active:v,over:S}=b;l(e.onDragEnd({active:v,over:S}))},onDragCancel(b){let{active:v,over:S}=b;l(e.onDragCancel({active:v,over:S}))}}),[l,e])),!f)return null;const m=Ye.createElement(Ye.Fragment,null,Ye.createElement(bC,{id:r,value:i.draggable}),Ye.createElement(vC,{id:d,announcement:u}));return a?Er.createPortal(m,a):m}var Zt;(function(o){o.DragStart="dragStart",o.DragMove="dragMove",o.DragEnd="dragEnd",o.DragCancel="dragCancel",o.DragOver="dragOver",o.RegisterDroppable="registerDroppable",o.SetDroppableDisabled="setDroppableDisabled",o.UnregisterDroppable="unregisterDroppable"})(Zt||(Zt={}));function Xl(){}function sm(o,e){return N.useMemo(()=>({sensor:o,options:e??{}}),[o,e])}function xC(){for(var o=arguments.length,e=new Array(o),a=0;a<o;a++)e[a]=arguments[a];return N.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const ma=Object.freeze({x:0,y:0});function om(o,e){return Math.sqrt(Math.pow(o.x-e.x,2)+Math.pow(o.y-e.y,2))}function lm(o,e){let{data:{value:a}}=o,{data:{value:r}}=e;return a-r}function TC(o,e){let{data:{value:a}}=o,{data:{value:r}}=e;return r-a}function cm(o){let{left:e,top:a,height:r,width:i}=o;return[{x:e,y:a},{x:e+i,y:a},{x:e,y:a+r},{x:e+i,y:a+r}]}function um(o,e){if(!o||o.length===0)return null;const[a]=o;return a[e]}function dm(o,e,a){return e===void 0&&(e=o.left),a===void 0&&(a=o.top),{x:e+o.width*.5,y:a+o.height*.5}}const RC=o=>{let{collisionRect:e,droppableRects:a,droppableContainers:r}=o;const i=dm(e,e.left,e.top),l=[];for(const u of r){const{id:d}=u,f=a.get(d);if(f){const g=om(dm(f),i);l.push({id:d,data:{droppableContainer:u,value:g}})}}return l.sort(lm)},kC=o=>{let{collisionRect:e,droppableRects:a,droppableContainers:r}=o;const i=cm(e),l=[];for(const u of r){const{id:d}=u,f=a.get(d);if(f){const g=cm(f),m=i.reduce((v,S,E)=>v+om(g[E],S),0),b=Number((m/4).toFixed(4));l.push({id:d,data:{droppableContainer:u,value:b}})}}return l.sort(lm)};function DC(o,e){const a=Math.max(e.top,o.top),r=Math.max(e.left,o.left),i=Math.min(e.left+e.width,o.left+o.width),l=Math.min(e.top+e.height,o.top+o.height),u=i-r,d=l-a;if(r<i&&a<l){const f=e.width*e.height,g=o.width*o.height,m=u*d,b=m/(f+g-m);return Number(b.toFixed(4))}return 0}const OC=o=>{let{collisionRect:e,droppableRects:a,droppableContainers:r}=o;const i=[];for(const l of r){const{id:u}=l,d=a.get(u);if(d){const f=DC(d,e);f>0&&i.push({id:u,data:{droppableContainer:l,value:f}})}}return i.sort(TC)};function LC(o,e,a){return{...o,scaleX:e&&a?e.width/a.width:1,scaleY:e&&a?e.height/a.height:1}}function fm(o,e){return o&&e?{x:o.left-e.left,y:o.top-e.top}:ma}function MC(o){return function(a){for(var r=arguments.length,i=new Array(r>1?r-1:0),l=1;l<r;l++)i[l-1]=arguments[l];return i.reduce((u,d)=>({...u,top:u.top+o*d.y,bottom:u.bottom+o*d.y,left:u.left+o*d.x,right:u.right+o*d.x}),{...a})}}const $C=MC(1);function NC(o){if(o.startsWith("matrix3d(")){const e=o.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(o.startsWith("matrix(")){const e=o.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function IC(o,e,a){const r=NC(e);if(!r)return o;const{scaleX:i,scaleY:l,x:u,y:d}=r,f=o.left-u-(1-i)*parseFloat(a),g=o.top-d-(1-l)*parseFloat(a.slice(a.indexOf(" ")+1)),m=i?o.width/i:o.width,b=l?o.height/l:o.height;return{width:m,height:b,top:g,right:f+m,bottom:g+b,left:f}}const HC={ignoreTransform:!1};function ns(o,e){e===void 0&&(e=HC);let a=o.getBoundingClientRect();if(e.ignoreTransform){const{transform:g,transformOrigin:m}=Tn(o).getComputedStyle(o);g&&(a=IC(a,g,m))}const{top:r,left:i,width:l,height:u,bottom:d,right:f}=a;return{top:r,left:i,width:l,height:u,bottom:d,right:f}}function hm(o){return ns(o,{ignoreTransform:!0})}function zC(o){const e=o.innerWidth,a=o.innerHeight;return{top:0,left:0,right:e,bottom:a,width:e,height:a}}function jC(o,e){return e===void 0&&(e=Tn(o).getComputedStyle(o)),e.position==="fixed"}function UC(o,e){e===void 0&&(e=Tn(o).getComputedStyle(o));const a=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const l=e[i];return typeof l=="string"?a.test(l):!1})}function Jl(o,e){const a=[];function r(i){if(e!=null&&a.length>=e||!i)return a;if(Ld(i)&&i.scrollingElement!=null&&!a.includes(i.scrollingElement))return a.push(i.scrollingElement),a;if(!io(i)||nm(i)||a.includes(i))return a;const l=Tn(o).getComputedStyle(i);return i!==o&&UC(i,l)&&a.push(i),jC(i,l)?a:r(i.parentNode)}return o?r(o):a}function gm(o){const[e]=Jl(o,1);return e??null}function zd(o){return!Wl||!o?null:Zi(o)?o:Od(o)?Ld(o)||o===es(o).scrollingElement?window:io(o)?o:null:null}function pm(o){return Zi(o)?o.scrollX:o.scrollLeft}function mm(o){return Zi(o)?o.scrollY:o.scrollTop}function jd(o){return{x:pm(o),y:mm(o)}}var ln;(function(o){o[o.Forward=1]="Forward",o[o.Backward=-1]="Backward"})(ln||(ln={}));function ym(o){return!Wl||!o?!1:o===document.scrollingElement}function bm(o){const e={x:0,y:0},a=ym(o)?{height:window.innerHeight,width:window.innerWidth}:{height:o.clientHeight,width:o.clientWidth},r={x:o.scrollWidth-a.width,y:o.scrollHeight-a.height},i=o.scrollTop<=e.y,l=o.scrollLeft<=e.x,u=o.scrollTop>=r.y,d=o.scrollLeft>=r.x;return{isTop:i,isLeft:l,isBottom:u,isRight:d,maxScroll:r,minScroll:e}}const BC={x:.2,y:.2};function qC(o,e,a,r,i){let{top:l,left:u,right:d,bottom:f}=a;r===void 0&&(r=10),i===void 0&&(i=BC);const{isTop:g,isBottom:m,isLeft:b,isRight:v}=bm(o),S={x:0,y:0},E={x:0,y:0},A={height:e.height*i.y,width:e.width*i.x};return!g&&l<=e.top+A.height?(S.y=ln.Backward,E.y=r*Math.abs((e.top+A.height-l)/A.height)):!m&&f>=e.bottom-A.height&&(S.y=ln.Forward,E.y=r*Math.abs((e.bottom-A.height-f)/A.height)),!v&&d>=e.right-A.width?(S.x=ln.Forward,E.x=r*Math.abs((e.right-A.width-d)/A.width)):!b&&u<=e.left+A.width&&(S.x=ln.Backward,E.x=r*Math.abs((e.left+A.width-u)/A.width)),{direction:S,speed:E}}function PC(o){if(o===document.scrollingElement){const{innerWidth:l,innerHeight:u}=window;return{top:0,left:0,right:l,bottom:u,width:l,height:u}}const{top:e,left:a,right:r,bottom:i}=o.getBoundingClientRect();return{top:e,left:a,right:r,bottom:i,width:o.clientWidth,height:o.clientHeight}}function vm(o){return o.reduce((e,a)=>ts(e,jd(a)),ma)}function GC(o){return o.reduce((e,a)=>e+pm(a),0)}function VC(o){return o.reduce((e,a)=>e+mm(a),0)}function FC(o,e){if(e===void 0&&(e=ns),!o)return;const{top:a,left:r,bottom:i,right:l}=e(o);gm(o)&&(i<=0||l<=0||a>=window.innerHeight||r>=window.innerWidth)&&o.scrollIntoView({block:"center",inline:"center"})}const KC=[["x",["left","right"],GC],["y",["top","bottom"],VC]];class Ud{constructor(e,a){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Jl(a),i=vm(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[l,u,d]of KC)for(const f of u)Object.defineProperty(this,f,{get:()=>{const g=d(r),m=i[l]-g;return this.rect[f]+m},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class fo{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(a=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...a)})},this.target=e}add(e,a,r){var i;(i=this.target)==null||i.addEventListener(e,a,r),this.listeners.push([e,a,r])}}function WC(o){const{EventTarget:e}=Tn(o);return o instanceof e?o:es(o)}function Bd(o,e){const a=Math.abs(o.x),r=Math.abs(o.y);return typeof e=="number"?Math.sqrt(a**2+r**2)>e:"x"in e&&"y"in e?a>e.x&&r>e.y:"x"in e?a>e.x:"y"in e?r>e.y:!1}var Qn;(function(o){o.Click="click",o.DragStart="dragstart",o.Keydown="keydown",o.ContextMenu="contextmenu",o.Resize="resize",o.SelectionChange="selectionchange",o.VisibilityChange="visibilitychange"})(Qn||(Qn={}));function Sm(o){o.preventDefault()}function YC(o){o.stopPropagation()}var it;(function(o){o.Space="Space",o.Down="ArrowDown",o.Right="ArrowRight",o.Left="ArrowLeft",o.Up="ArrowUp",o.Esc="Escape",o.Enter="Enter",o.Tab="Tab"})(it||(it={}));const wm={start:[it.Space,it.Enter],cancel:[it.Esc],end:[it.Space,it.Enter,it.Tab]},XC=(o,e)=>{let{currentCoordinates:a}=e;switch(o.code){case it.Right:return{...a,x:a.x+25};case it.Left:return{...a,x:a.x-25};case it.Down:return{...a,y:a.y+25};case it.Up:return{...a,y:a.y-25}}};class qd{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:a}}=e;this.props=e,this.listeners=new fo(es(a)),this.windowListeners=new fo(Tn(a)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Qn.Resize,this.handleCancel),this.windowListeners.add(Qn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Qn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:a}=this.props,r=e.node.current;r&&FC(r),a(ma)}handleKeyDown(e){if(Id(e)){const{active:a,context:r,options:i}=this.props,{keyboardCodes:l=wm,coordinateGetter:u=XC,scrollBehavior:d="smooth"}=i,{code:f}=e;if(l.end.includes(f)){this.handleEnd(e);return}if(l.cancel.includes(f)){this.handleCancel(e);return}const{collisionRect:g}=r.current,m=g?{x:g.left,y:g.top}:ma;this.referenceCoordinates||(this.referenceCoordinates=m);const b=u(e,{active:a,context:r.current,currentCoordinates:m});if(b){const v=co(b,m),S={x:0,y:0},{scrollableAncestors:E}=r.current;for(const A of E){const T=e.code,{isTop:L,isRight:M,isLeft:R,isBottom:D,maxScroll:U,minScroll:j}=bm(A),q=PC(A),X={x:Math.min(T===it.Right?q.right-q.width/2:q.right,Math.max(T===it.Right?q.left:q.left+q.width/2,b.x)),y:Math.min(T===it.Down?q.bottom-q.height/2:q.bottom,Math.max(T===it.Down?q.top:q.top+q.height/2,b.y))},ge=T===it.Right&&!M||T===it.Left&&!R,Ee=T===it.Down&&!D||T===it.Up&&!L;if(ge&&X.x!==b.x){const Ce=A.scrollLeft+v.x,$e=T===it.Right&&Ce<=U.x||T===it.Left&&Ce>=j.x;if($e&&!v.y){A.scrollTo({left:Ce,behavior:d});return}$e?S.x=A.scrollLeft-Ce:S.x=T===it.Right?A.scrollLeft-U.x:A.scrollLeft-j.x,S.x&&A.scrollBy({left:-S.x,behavior:d});break}else if(Ee&&X.y!==b.y){const Ce=A.scrollTop+v.y,$e=T===it.Down&&Ce<=U.y||T===it.Up&&Ce>=j.y;if($e&&!v.x){A.scrollTo({top:Ce,behavior:d});return}$e?S.y=A.scrollTop-Ce:S.y=T===it.Down?A.scrollTop-U.y:A.scrollTop-j.y,S.y&&A.scrollBy({top:-S.y,behavior:d});break}}this.handleMove(e,ts(co(b,this.referenceCoordinates),S))}}}handleMove(e,a){const{onMove:r}=this.props;e.preventDefault(),r(a)}handleEnd(e){const{onEnd:a}=this.props;e.preventDefault(),this.detach(),a()}handleCancel(e){const{onCancel:a}=this.props;e.preventDefault(),this.detach(),a()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qd.activators=[{eventName:"onKeyDown",handler:(o,e,a)=>{let{keyboardCodes:r=wm,onActivation:i}=e,{active:l}=a;const{code:u}=o.nativeEvent;if(r.start.includes(u)){const d=l.activatorNode.current;return d&&o.target!==d?!1:(o.preventDefault(),i?.({event:o.nativeEvent}),!0)}return!1}}];function Cm(o){return!!(o&&"distance"in o)}function Em(o){return!!(o&&"delay"in o)}class Pd{constructor(e,a,r){var i;r===void 0&&(r=WC(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=a;const{event:l}=e,{target:u}=l;this.props=e,this.events=a,this.document=es(u),this.documentListeners=new fo(this.document),this.listeners=new fo(r),this.windowListeners=new fo(Tn(u)),this.initialCoordinates=(i=Hd(l))!=null?i:ma,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:a,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Qn.Resize,this.handleCancel),this.windowListeners.add(Qn.DragStart,Sm),this.windowListeners.add(Qn.VisibilityChange,this.handleCancel),this.windowListeners.add(Qn.ContextMenu,Sm),this.documentListeners.add(Qn.Keydown,this.handleKeydown),a){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Em(a)){this.timeoutId=setTimeout(this.handleStart,a.delay),this.handlePending(a);return}if(Cm(a)){this.handlePending(a);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,a){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,a)}handleStart(){const{initialCoordinates:e}=this,{onStart:a}=this.props;e&&(this.activated=!0,this.documentListeners.add(Qn.Click,YC,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Qn.SelectionChange,this.removeTextSelection),a(e))}handleMove(e){var a;const{activated:r,initialCoordinates:i,props:l}=this,{onMove:u,options:{activationConstraint:d}}=l;if(!i)return;const f=(a=Hd(e))!=null?a:ma,g=co(i,f);if(!r&&d){if(Cm(d)){if(d.tolerance!=null&&Bd(g,d.tolerance))return this.handleCancel();if(Bd(g,d.distance))return this.handleStart()}if(Em(d)&&Bd(g,d.tolerance))return this.handleCancel();this.handlePending(d,g);return}e.cancelable&&e.preventDefault(),u(f)}handleEnd(){const{onAbort:e,onEnd:a}=this.props;this.detach(),this.activated||e(this.props.active),a()}handleCancel(){const{onAbort:e,onCancel:a}=this.props;this.detach(),this.activated||e(this.props.active),a()}handleKeydown(e){e.code===it.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const JC={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Gd extends Pd{constructor(e){const{event:a}=e,r=es(a.target);super(e,JC,r)}}Gd.activators=[{eventName:"onPointerDown",handler:(o,e)=>{let{nativeEvent:a}=o,{onActivation:r}=e;return!a.isPrimary||a.button!==0?!1:(r?.({event:a}),!0)}}];const QC={move:{name:"mousemove"},end:{name:"mouseup"}};var Vd;(function(o){o[o.RightClick=2]="RightClick"})(Vd||(Vd={}));class ZC extends Pd{constructor(e){super(e,QC,es(e.event.target))}}ZC.activators=[{eventName:"onMouseDown",handler:(o,e)=>{let{nativeEvent:a}=o,{onActivation:r}=e;return a.button===Vd.RightClick?!1:(r?.({event:a}),!0)}}];const Fd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class eE extends Pd{constructor(e){super(e,Fd)}static setup(){return window.addEventListener(Fd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Fd.move.name,e)};function e(){}}}eE.activators=[{eventName:"onTouchStart",handler:(o,e)=>{let{nativeEvent:a}=o,{onActivation:r}=e;const{touches:i}=a;return i.length>1?!1:(r?.({event:a}),!0)}}];var ho;(function(o){o[o.Pointer=0]="Pointer",o[o.DraggableRect=1]="DraggableRect"})(ho||(ho={}));var Ql;(function(o){o[o.TreeOrder=0]="TreeOrder",o[o.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ql||(Ql={}));function tE(o){let{acceleration:e,activator:a=ho.Pointer,canScroll:r,draggingRect:i,enabled:l,interval:u=5,order:d=Ql.TreeOrder,pointerCoordinates:f,scrollableAncestors:g,scrollableAncestorRects:m,delta:b,threshold:v}=o;const S=aE({delta:b,disabled:!l}),[E,A]=hC(),T=N.useRef({x:0,y:0}),L=N.useRef({x:0,y:0}),M=N.useMemo(()=>{switch(a){case ho.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case ho.DraggableRect:return i}},[a,i,f]),R=N.useRef(null),D=N.useCallback(()=>{const j=R.current;if(!j)return;const q=T.current.x*L.current.x,X=T.current.y*L.current.y;j.scrollBy(q,X)},[]),U=N.useMemo(()=>d===Ql.TreeOrder?[...g].reverse():g,[d,g]);N.useEffect(()=>{if(!l||!g.length||!M){A();return}for(const j of U){if(r?.(j)===!1)continue;const q=g.indexOf(j),X=m[q];if(!X)continue;const{direction:ge,speed:Ee}=qC(j,X,M,e,v);for(const Ce of["x","y"])S[Ce][ge[Ce]]||(Ee[Ce]=0,ge[Ce]=0);if(Ee.x>0||Ee.y>0){A(),R.current=j,E(D,u),T.current=Ee,L.current=ge;return}}T.current={x:0,y:0},L.current={x:0,y:0},A()},[e,D,r,A,l,u,JSON.stringify(M),JSON.stringify(S),E,g,U,m,JSON.stringify(v)])}const nE={x:{[ln.Backward]:!1,[ln.Forward]:!1},y:{[ln.Backward]:!1,[ln.Forward]:!1}};function aE(o){let{delta:e,disabled:a}=o;const r=$d(e);return oo(i=>{if(a||!r||!i)return nE;const l={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ln.Backward]:i.x[ln.Backward]||l.x===-1,[ln.Forward]:i.x[ln.Forward]||l.x===1},y:{[ln.Backward]:i.y[ln.Backward]||l.y===-1,[ln.Forward]:i.y[ln.Forward]||l.y===1}}},[a,e,r])}function rE(o,e){const a=e!=null?o.get(e):void 0,r=a?a.node.current:null;return oo(i=>{var l;return e==null?null:(l=r??i)!=null?l:null},[r,e])}function iE(o,e){return N.useMemo(()=>o.reduce((a,r)=>{const{sensor:i}=r,l=i.activators.map(u=>({eventName:u.eventName,handler:e(u.handler,r)}));return[...a,...l]},[]),[o,e])}var go;(function(o){o[o.Always=0]="Always",o[o.BeforeDragging=1]="BeforeDragging",o[o.WhileDragging=2]="WhileDragging"})(go||(go={}));var Kd;(function(o){o.Optimized="optimized"})(Kd||(Kd={}));const _m=new Map;function sE(o,e){let{dragging:a,dependencies:r,config:i}=e;const[l,u]=N.useState(null),{frequency:d,measure:f,strategy:g}=i,m=N.useRef(o),b=T(),v=so(b),S=N.useCallback(function(L){L===void 0&&(L=[]),!v.current&&u(M=>M===null?L:M.concat(L.filter(R=>!M.includes(R))))},[v]),E=N.useRef(null),A=oo(L=>{if(b&&!a)return _m;if(!L||L===_m||m.current!==o||l!=null){const M=new Map;for(let R of o){if(!R)continue;if(l&&l.length>0&&!l.includes(R.id)&&R.rect.current){M.set(R.id,R.rect.current);continue}const D=R.node.current,U=D?new Ud(f(D),D):null;R.rect.current=U,U&&M.set(R.id,U)}return M}return L},[o,l,a,b,f]);return N.useEffect(()=>{m.current=o},[o]),N.useEffect(()=>{b||S()},[a,b]),N.useEffect(()=>{l&&l.length>0&&u(null)},[JSON.stringify(l)]),N.useEffect(()=>{b||typeof d!="number"||E.current!==null||(E.current=setTimeout(()=>{S(),E.current=null},d))},[d,b,S,...r]),{droppableRects:A,measureDroppableContainers:S,measuringScheduled:l!=null};function T(){switch(g){case go.Always:return!1;case go.BeforeDragging:return a;default:return!a}}}function Am(o,e){return oo(a=>o?a||(typeof e=="function"?e(o):o):null,[e,o])}function oE(o,e){return Am(o,e)}function lE(o){let{callback:e,disabled:a}=o;const r=Md(e),i=N.useMemo(()=>{if(a||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(r)},[r,a]);return N.useEffect(()=>()=>i?.disconnect(),[i]),i}function Zl(o){let{callback:e,disabled:a}=o;const r=Md(e),i=N.useMemo(()=>{if(a||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(r)},[a]);return N.useEffect(()=>()=>i?.disconnect(),[i]),i}function cE(o){return new Ud(ns(o),o)}function xm(o,e,a){e===void 0&&(e=cE);const[r,i]=N.useState(null);function l(){i(f=>{if(!o)return null;if(o.isConnected===!1){var g;return(g=f??a)!=null?g:null}const m=e(o);return JSON.stringify(f)===JSON.stringify(m)?f:m})}const u=lE({callback(f){if(o)for(const g of f){const{type:m,target:b}=g;if(m==="childList"&&b instanceof HTMLElement&&b.contains(o)){l();break}}}}),d=Zl({callback:l});return Na(()=>{l(),o?(d?.observe(o),u?.observe(document.body,{childList:!0,subtree:!0})):(d?.disconnect(),u?.disconnect())},[o]),r}function uE(o){const e=Am(o);return fm(o,e)}const Tm=[];function dE(o){const e=N.useRef(o),a=oo(r=>o?r&&r!==Tm&&o&&e.current&&o.parentNode===e.current.parentNode?r:Jl(o):Tm,[o]);return N.useEffect(()=>{e.current=o},[o]),a}function fE(o){const[e,a]=N.useState(null),r=N.useRef(o),i=N.useCallback(l=>{const u=zd(l.target);u&&a(d=>d?(d.set(u,jd(u)),new Map(d)):null)},[]);return N.useEffect(()=>{const l=r.current;if(o!==l){u(l);const d=o.map(f=>{const g=zd(f);return g?(g.addEventListener("scroll",i,{passive:!0}),[g,jd(g)]):null}).filter(f=>f!=null);a(d.length?new Map(d):null),r.current=o}return()=>{u(o),u(l)};function u(d){d.forEach(f=>{const g=zd(f);g?.removeEventListener("scroll",i)})}},[i,o]),N.useMemo(()=>o.length?e?Array.from(e.values()).reduce((l,u)=>ts(l,u),ma):vm(o):ma,[o,e])}function Rm(o,e){e===void 0&&(e=[]);const a=N.useRef(null);return N.useEffect(()=>{a.current=null},e),N.useEffect(()=>{const r=o!==ma;r&&!a.current&&(a.current=o),!r&&a.current&&(a.current=null)},[o]),a.current?co(o,a.current):ma}function hE(o){N.useEffect(()=>{if(!Wl)return;const e=o.map(a=>{let{sensor:r}=a;return r.setup==null?void 0:r.setup()});return()=>{for(const a of e)a?.()}},o.map(e=>{let{sensor:a}=e;return a}))}function gE(o,e){return N.useMemo(()=>o.reduce((a,r)=>{let{eventName:i,handler:l}=r;return a[i]=u=>{l(u,e)},a},{}),[o,e])}function km(o){return N.useMemo(()=>o?zC(o):null,[o])}const Dm=[];function pE(o,e){e===void 0&&(e=ns);const[a]=o,r=km(a?Tn(a):null),[i,l]=N.useState(Dm);function u(){l(()=>o.length?o.map(f=>ym(f)?r:new Ud(e(f),f)):Dm)}const d=Zl({callback:u});return Na(()=>{d?.disconnect(),u(),o.forEach(f=>d?.observe(f))},[o]),i}function mE(o){if(!o)return null;if(o.children.length>1)return o;const e=o.children[0];return io(e)?e:o}function yE(o){let{measure:e}=o;const[a,r]=N.useState(null),i=N.useCallback(g=>{for(const{target:m}of g)if(io(m)){r(b=>{const v=e(m);return b?{...b,width:v.width,height:v.height}:v});break}},[e]),l=Zl({callback:i}),u=N.useCallback(g=>{const m=mE(g);l?.disconnect(),m&&l?.observe(m),r(m?e(m):null)},[e,l]),[d,f]=Yl(u);return N.useMemo(()=>({nodeRef:d,rect:a,setRef:f}),[a,d,f])}const bE=[{sensor:Gd,options:{}},{sensor:qd,options:{}}],vE={current:{}},ec={draggable:{measure:hm},droppable:{measure:hm,strategy:go.WhileDragging,frequency:Kd.Optimized},dragOverlay:{measure:ns}};class po extends Map{get(e){var a;return e!=null&&(a=super.get(e))!=null?a:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:a}=e;return!a})}getNodeFor(e){var a,r;return(a=(r=this.get(e))==null?void 0:r.node.current)!=null?a:void 0}}const SE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new po,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Xl},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ec,measureDroppableContainers:Xl,windowRect:null,measuringScheduled:!1},wE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Xl,draggableNodes:new Map,over:null,measureDroppableContainers:Xl},tc=N.createContext(wE),Om=N.createContext(SE);function CE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new po}}}function EE(o,e){switch(e.type){case Zt.DragStart:return{...o,draggable:{...o.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Zt.DragMove:return o.draggable.active==null?o:{...o,draggable:{...o.draggable,translate:{x:e.coordinates.x-o.draggable.initialCoordinates.x,y:e.coordinates.y-o.draggable.initialCoordinates.y}}};case Zt.DragEnd:case Zt.DragCancel:return{...o,draggable:{...o.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Zt.RegisterDroppable:{const{element:a}=e,{id:r}=a,i=new po(o.droppable.containers);return i.set(r,a),{...o,droppable:{...o.droppable,containers:i}}}case Zt.SetDroppableDisabled:{const{id:a,key:r,disabled:i}=e,l=o.droppable.containers.get(a);if(!l||r!==l.key)return o;const u=new po(o.droppable.containers);return u.set(a,{...l,disabled:i}),{...o,droppable:{...o.droppable,containers:u}}}case Zt.UnregisterDroppable:{const{id:a,key:r}=e,i=o.droppable.containers.get(a);if(!i||r!==i.key)return o;const l=new po(o.droppable.containers);return l.delete(a),{...o,droppable:{...o.droppable,containers:l}}}default:return o}}function _E(o){let{disabled:e}=o;const{active:a,activatorEvent:r,draggableNodes:i}=N.useContext(tc),l=$d(r),u=$d(a?.id);return N.useEffect(()=>{if(!e&&!r&&l&&u!=null){if(!Id(l)||document.activeElement===l.target)return;const d=i.get(u);if(!d)return;const{activatorNode:f,node:g}=d;if(!f.current&&!g.current)return;requestAnimationFrame(()=>{for(const m of[f.current,g.current]){if(!m)continue;const b=mC(m);if(b){b.focus();break}}})}},[r,e,i,u,l]),null}function AE(o,e){let{transform:a,...r}=e;return o!=null&&o.length?o.reduce((i,l)=>l({transform:i,...r}),a):a}function xE(o){return N.useMemo(()=>({draggable:{...ec.draggable,...o?.draggable},droppable:{...ec.droppable,...o?.droppable},dragOverlay:{...ec.dragOverlay,...o?.dragOverlay}}),[o?.draggable,o?.droppable,o?.dragOverlay])}function TE(o){let{activeNode:e,measure:a,initialRect:r,config:i=!0}=o;const l=N.useRef(!1),{x:u,y:d}=typeof i=="boolean"?{x:i,y:i}:i;Na(()=>{if(!u&&!d||!e){l.current=!1;return}if(l.current||!r)return;const g=e?.node.current;if(!g||g.isConnected===!1)return;const m=a(g),b=fm(m,r);if(u||(b.x=0),d||(b.y=0),l.current=!0,Math.abs(b.x)>0||Math.abs(b.y)>0){const v=gm(g);v&&v.scrollBy({top:b.y,left:b.x})}},[e,u,d,r,a])}const Lm=N.createContext({...ma,scaleX:1,scaleY:1});var _r;(function(o){o[o.Uninitialized=0]="Uninitialized",o[o.Initializing=1]="Initializing",o[o.Initialized=2]="Initialized"})(_r||(_r={}));const RE=N.memo(function(e){var a,r,i,l;let{id:u,accessibility:d,autoScroll:f=!0,children:g,sensors:m=bE,collisionDetection:b=OC,measuring:v,modifiers:S,...E}=e;const A=N.useReducer(EE,void 0,CE),[T,L]=A,[M,R]=CC(),[D,U]=N.useState(_r.Uninitialized),j=D===_r.Initialized,{draggable:{active:q,nodes:X,translate:ge},droppable:{containers:Ee}}=T,Ce=q!=null?X.get(q):null,$e=N.useRef({initial:null,translated:null}),qe=N.useMemo(()=>{var Re;return q!=null?{id:q,data:(Re=Ce?.data)!=null?Re:vE,rect:$e}:null},[q,Ce]),Xe=N.useRef(null),[ht,Q]=N.useState(null),[fe,ye]=N.useState(null),te=so(E,Object.values(E)),he=lo("DndDescribedBy",u),x=N.useMemo(()=>Ee.getEnabled(),[Ee]),K=xE(v),{droppableRects:re,measureDroppableContainers:de,measuringScheduled:se}=sE(x,{dragging:j,dependencies:[ge.x,ge.y],config:K.droppable}),me=rE(X,q),Ne=N.useMemo(()=>fe?Hd(fe):null,[fe]),ve=Se(),He=oE(me,K.draggable.measure);TE({activeNode:q!=null?X.get(q):null,config:ve.layoutShiftCompensation,initialRect:He,measure:K.draggable.measure});const Ae=xm(me,K.draggable.measure,He),Et=xm(me?me.parentElement:null),Rt=N.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:X,draggingNode:null,draggingNodeRect:null,droppableContainers:Ee,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),_t=Ee.getNodeFor((a=Rt.current.over)==null?void 0:a.id),ft=yE({measure:K.dragOverlay.measure}),un=(r=ft.nodeRef.current)!=null?r:me,gt=j?(i=ft.rect)!=null?i:Ae:null,za=!!(ft.nodeRef.current&&ft.rect),kn=uE(za?null:Ae),Dn=km(un?Tn(un):null),jt=dE(j?_t??me:null),On=pE(jt),ea=AE(S,{transform:{x:ge.x-kn.x,y:ge.y-kn.y,scaleX:1,scaleY:1},activatorEvent:fe,active:qe,activeNodeRect:Ae,containerNodeRect:Et,draggingNodeRect:gt,over:Rt.current.over,overlayNodeRect:ft.rect,scrollableAncestors:jt,scrollableAncestorRects:On,windowRect:Dn}),ja=Ne?ts(Ne,ge):null,Ft=fE(jt),Rr=Rm(Ft),Za=Rm(Ft,[Ae]),bn=ts(ea,Rr),en=gt?$C(gt,ea):null,et=qe&&en?b({active:qe,collisionRect:en,droppableRects:re,droppableContainers:x,pointerCoordinates:ja}):null,ta=um(et,"id"),[En,er]=N.useState(null),Ea=za?ea:ts(ea,Za),tn=LC(Ea,(l=En?.rect)!=null?l:null,Ae),_n=N.useRef(null),P=N.useCallback((Re,xe)=>{let{sensor:je,options:ze}=xe;if(Xe.current==null)return;const Le=X.get(Xe.current);if(!Le)return;const ke=Re.nativeEvent,We=new je({active:Xe.current,activeNode:Le,event:ke,options:ze,context:Rt,onAbort(_e){if(!X.get(_e))return;const{onDragAbort:Ue}=te.current,st={id:_e};Ue?.(st),M({type:"onDragAbort",event:st})},onPending(_e,Te,Ue,st){if(!X.get(_e))return;const{onDragPending:nn}=te.current,Kt={id:_e,constraint:Te,initialCoordinates:Ue,offset:st};nn?.(Kt),M({type:"onDragPending",event:Kt})},onStart(_e){const Te=Xe.current;if(Te==null)return;const Ue=X.get(Te);if(!Ue)return;const{onDragStart:st}=te.current,Dt={activatorEvent:ke,active:{id:Te,data:Ue.data,rect:$e}};Er.unstable_batchedUpdates(()=>{st?.(Dt),U(_r.Initializing),L({type:Zt.DragStart,initialCoordinates:_e,active:Te}),M({type:"onDragStart",event:Dt}),Q(_n.current),ye(ke)})},onMove(_e){L({type:Zt.DragMove,coordinates:_e})},onEnd:Fe(Zt.DragEnd),onCancel:Fe(Zt.DragCancel)});_n.current=We;function Fe(_e){return async function(){const{active:Ue,collisions:st,over:Dt,scrollAdjustedTranslate:nn}=Rt.current;let Kt=null;if(Ue&&nn){const{cancelDrop:Pn}=te.current;Kt={activatorEvent:ke,active:Ue,collisions:st,delta:nn,over:Dt},_e===Zt.DragEnd&&typeof Pn=="function"&&await Promise.resolve(Pn(Kt))&&(_e=Zt.DragCancel)}Xe.current=null,Er.unstable_batchedUpdates(()=>{L({type:_e}),U(_r.Uninitialized),er(null),Q(null),ye(null),_n.current=null;const Pn=_e===Zt.DragEnd?"onDragEnd":"onDragCancel";if(Kt){const Ln=te.current[Pn];Ln?.(Kt),M({type:Pn,event:Kt})}})}}},[X]),ce=N.useCallback((Re,xe)=>(je,ze)=>{const Le=je.nativeEvent,ke=X.get(ze);if(Xe.current!==null||!ke||Le.dndKit||Le.defaultPrevented)return;const We={active:ke};Re(je,xe.options,We)===!0&&(Le.dndKit={capturedBy:xe.sensor},Xe.current=ze,P(je,xe))},[X,P]),le=iE(m,ce);hE(m),Na(()=>{Ae&&D===_r.Initializing&&U(_r.Initialized)},[Ae,D]),N.useEffect(()=>{const{onDragMove:Re}=te.current,{active:xe,activatorEvent:je,collisions:ze,over:Le}=Rt.current;if(!xe||!je)return;const ke={active:xe,activatorEvent:je,collisions:ze,delta:{x:bn.x,y:bn.y},over:Le};Er.unstable_batchedUpdates(()=>{Re?.(ke),M({type:"onDragMove",event:ke})})},[bn.x,bn.y]),N.useEffect(()=>{const{active:Re,activatorEvent:xe,collisions:je,droppableContainers:ze,scrollAdjustedTranslate:Le}=Rt.current;if(!Re||Xe.current==null||!xe||!Le)return;const{onDragOver:ke}=te.current,We=ze.get(ta),Fe=We&&We.rect.current?{id:We.id,rect:We.rect.current,data:We.data,disabled:We.disabled}:null,_e={active:Re,activatorEvent:xe,collisions:je,delta:{x:Le.x,y:Le.y},over:Fe};Er.unstable_batchedUpdates(()=>{er(Fe),ke?.(_e),M({type:"onDragOver",event:_e})})},[ta]),Na(()=>{Rt.current={activatorEvent:fe,active:qe,activeNode:me,collisionRect:en,collisions:et,droppableRects:re,draggableNodes:X,draggingNode:un,draggingNodeRect:gt,droppableContainers:Ee,over:En,scrollableAncestors:jt,scrollAdjustedTranslate:bn},$e.current={initial:gt,translated:en}},[qe,me,et,en,X,un,gt,re,Ee,En,jt,bn]),tE({...ve,delta:ge,draggingRect:en,pointerCoordinates:ja,scrollableAncestors:jt,scrollableAncestorRects:On});const Z=N.useMemo(()=>({active:qe,activeNode:me,activeNodeRect:Ae,activatorEvent:fe,collisions:et,containerNodeRect:Et,dragOverlay:ft,draggableNodes:X,droppableContainers:Ee,droppableRects:re,over:En,measureDroppableContainers:de,scrollableAncestors:jt,scrollableAncestorRects:On,measuringConfiguration:K,measuringScheduled:se,windowRect:Dn}),[qe,me,Ae,fe,et,Et,ft,X,Ee,re,En,de,jt,On,K,se,Dn]),be=N.useMemo(()=>({activatorEvent:fe,activators:le,active:qe,activeNodeRect:Ae,ariaDescribedById:{draggable:he},dispatch:L,draggableNodes:X,over:En,measureDroppableContainers:de}),[fe,le,qe,Ae,L,he,X,En,de]);return Ye.createElement(im.Provider,{value:R},Ye.createElement(tc.Provider,{value:be},Ye.createElement(Om.Provider,{value:Z},Ye.createElement(Lm.Provider,{value:tn},g)),Ye.createElement(_E,{disabled:d?.restoreFocus===!1})),Ye.createElement(AC,{...d,hiddenTextDescribedById:he}));function Se(){const Re=ht?.autoScrollEnabled===!1,xe=typeof f=="object"?f.enabled===!1:f===!1,je=j&&!Re&&!xe;return typeof f=="object"?{...f,enabled:je}:{enabled:je}}}),kE=N.createContext(null),Mm="button",DE="Draggable";function OE(o){let{id:e,data:a,disabled:r=!1,attributes:i}=o;const l=lo(DE),{activators:u,activatorEvent:d,active:f,activeNodeRect:g,ariaDescribedById:m,draggableNodes:b,over:v}=N.useContext(tc),{role:S=Mm,roleDescription:E="draggable",tabIndex:A=0}=i??{},T=f?.id===e,L=N.useContext(T?Lm:kE),[M,R]=Yl(),[D,U]=Yl(),j=gE(u,e),q=so(a);Na(()=>(b.set(e,{id:e,key:l,node:M,activatorNode:D,data:q}),()=>{const ge=b.get(e);ge&&ge.key===l&&b.delete(e)}),[b,e]);const X=N.useMemo(()=>({role:S,tabIndex:A,"aria-disabled":r,"aria-pressed":T&&S===Mm?!0:void 0,"aria-roledescription":E,"aria-describedby":m.draggable}),[r,S,A,T,E,m.draggable]);return{active:f,activatorEvent:d,activeNodeRect:g,attributes:X,isDragging:T,listeners:r?void 0:j,node:M,over:v,setNodeRef:R,setActivatorNodeRef:U,transform:L}}function LE(){return N.useContext(Om)}const ME="Droppable",$E={timeout:25};function NE(o){let{data:e,disabled:a=!1,id:r,resizeObserverConfig:i}=o;const l=lo(ME),{active:u,dispatch:d,over:f,measureDroppableContainers:g}=N.useContext(tc),m=N.useRef({disabled:a}),b=N.useRef(!1),v=N.useRef(null),S=N.useRef(null),{disabled:E,updateMeasurementsFor:A,timeout:T}={...$E,...i},L=so(A??r),M=N.useCallback(()=>{if(!b.current){b.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{g(Array.isArray(L.current)?L.current:[L.current]),S.current=null},T)},[T]),R=Zl({callback:M,disabled:E||!u}),D=N.useCallback((X,ge)=>{R&&(ge&&(R.unobserve(ge),b.current=!1),X&&R.observe(X))},[R]),[U,j]=Yl(D),q=so(e);return N.useEffect(()=>{!R||!U.current||(R.disconnect(),b.current=!1,R.observe(U.current))},[U,R]),N.useEffect(()=>(d({type:Zt.RegisterDroppable,element:{id:r,key:l,disabled:a,node:U,rect:v,data:q}}),()=>d({type:Zt.UnregisterDroppable,key:l,id:r})),[r]),N.useEffect(()=>{a!==m.current.disabled&&(d({type:Zt.SetDroppableDisabled,id:r,key:l,disabled:a}),m.current.disabled=a)},[r,l,a,d]),{active:u,rect:v,isOver:f?.id===r,node:U,over:f,setNodeRef:j}}function Wd(o,e,a){const r=o.slice();return r.splice(a<0?r.length+a:a,0,r.splice(e,1)[0]),r}function IE(o,e){return o.reduce((a,r,i)=>{const l=e.get(r);return l&&(a[i]=l),a},Array(o.length))}function nc(o){return o!==null&&o>=0}function HE(o,e){if(o===e)return!0;if(o.length!==e.length)return!1;for(let a=0;a<o.length;a++)if(o[a]!==e[a])return!1;return!0}function zE(o){return typeof o=="boolean"?{draggable:o,droppable:o}:o}const ac={scaleX:1,scaleY:1},jE=o=>{var e;let{rects:a,activeNodeRect:r,activeIndex:i,overIndex:l,index:u}=o;const d=(e=a[i])!=null?e:r;if(!d)return null;const f=UE(a,u,i);if(u===i){const g=a[l];return g?{x:i<l?g.left+g.width-(d.left+d.width):g.left-d.left,y:0,...ac}:null}return u>i&&u<=l?{x:-d.width-f,y:0,...ac}:u<i&&u>=l?{x:d.width+f,y:0,...ac}:{x:0,y:0,...ac}};function UE(o,e,a){const r=o[e],i=o[e-1],l=o[e+1];return!r||!i&&!l?0:a<e?i?r.left-(i.left+i.width):l.left-(r.left+r.width):l?l.left-(r.left+r.width):r.left-(i.left+i.width)}const Yd=o=>{let{rects:e,activeIndex:a,overIndex:r,index:i}=o;const l=Wd(e,r,a),u=e[i],d=l[i];return!d||!u?null:{x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height}},rc={scaleX:1,scaleY:1},BE=o=>{var e;let{activeIndex:a,activeNodeRect:r,index:i,rects:l,overIndex:u}=o;const d=(e=l[a])!=null?e:r;if(!d)return null;if(i===a){const g=l[u];return g?{x:0,y:a<u?g.top+g.height-(d.top+d.height):g.top-d.top,...rc}:null}const f=qE(l,i,a);return i>a&&i<=u?{x:0,y:-d.height-f,...rc}:i<a&&i>=u?{x:0,y:d.height+f,...rc}:{x:0,y:0,...rc}};function qE(o,e,a){const r=o[e],i=o[e-1],l=o[e+1];return r?a<e?i?r.top-(i.top+i.height):l?l.top-(r.top+r.height):0:l?l.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const $m="Sortable",Nm=Ye.createContext({activeIndex:-1,containerId:$m,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Yd,disabled:{draggable:!1,droppable:!1}});function PE(o){let{children:e,id:a,items:r,strategy:i=Yd,disabled:l=!1}=o;const{active:u,dragOverlay:d,droppableRects:f,over:g,measureDroppableContainers:m}=LE(),b=lo($m,a),v=d.rect!==null,S=N.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),E=u!=null,A=u?S.indexOf(u.id):-1,T=g?S.indexOf(g.id):-1,L=N.useRef(S),M=!HE(S,L.current),R=T!==-1&&A===-1||M,D=zE(l);Na(()=>{M&&E&&m(S)},[M,S,E,m]),N.useEffect(()=>{L.current=S},[S]);const U=N.useMemo(()=>({activeIndex:A,containerId:b,disabled:D,disableTransforms:R,items:S,overIndex:T,useDragOverlay:v,sortedRects:IE(S,f),strategy:i}),[A,b,D.draggable,D.droppable,R,S,T,f,v,i]);return Ye.createElement(Nm.Provider,{value:U},e)}const GE=o=>{let{id:e,items:a,activeIndex:r,overIndex:i}=o;return Wd(a,r,i).indexOf(e)},VE=o=>{let{containerId:e,isSorting:a,wasDragging:r,index:i,items:l,newIndex:u,previousItems:d,previousContainerId:f,transition:g}=o;return!g||!r||d!==l&&i===u?!1:a?!0:u!==i&&e===f},FE={duration:200,easing:"ease"},Im="transform",KE=uo.Transition.toString({property:Im,duration:0,easing:"linear"}),WE={roleDescription:"sortable"};function YE(o){let{disabled:e,index:a,node:r,rect:i}=o;const[l,u]=N.useState(null),d=N.useRef(a);return Na(()=>{if(!e&&a!==d.current&&r.current){const f=i.current;if(f){const g=ns(r.current,{ignoreTransform:!0}),m={x:f.left-g.left,y:f.top-g.top,scaleX:f.width/g.width,scaleY:f.height/g.height};(m.x||m.y)&&u(m)}}a!==d.current&&(d.current=a)},[e,a,r,i]),N.useEffect(()=>{l&&u(null)},[l]),l}function XE(o){let{animateLayoutChanges:e=VE,attributes:a,disabled:r,data:i,getNewIndex:l=GE,id:u,strategy:d,resizeObserverConfig:f,transition:g=FE}=o;const{items:m,containerId:b,activeIndex:v,disabled:S,disableTransforms:E,sortedRects:A,overIndex:T,useDragOverlay:L,strategy:M}=N.useContext(Nm),R=JE(r,S),D=m.indexOf(u),U=N.useMemo(()=>({sortable:{containerId:b,index:D,items:m},...i}),[b,i,D,m]),j=N.useMemo(()=>m.slice(m.indexOf(u)),[m,u]),{rect:q,node:X,isOver:ge,setNodeRef:Ee}=NE({id:u,data:U,disabled:R.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...f}}),{active:Ce,activatorEvent:$e,activeNodeRect:qe,attributes:Xe,setNodeRef:ht,listeners:Q,isDragging:fe,over:ye,setActivatorNodeRef:te,transform:he}=OE({id:u,data:U,attributes:{...WE,...a},disabled:R.draggable}),x=fC(Ee,ht),K=!!Ce,re=K&&!E&&nc(v)&&nc(T),de=!L&&fe,se=de&&re?he:null,Ne=re?se??(d??M)({rects:A,activeNodeRect:qe,activeIndex:v,overIndex:T,index:D}):null,ve=nc(v)&&nc(T)?l({id:u,items:m,activeIndex:v,overIndex:T}):D,He=Ce?.id,Ae=N.useRef({activeId:He,items:m,newIndex:ve,containerId:b}),Et=m!==Ae.current.items,Rt=e({active:Ce,containerId:b,isDragging:fe,isSorting:K,id:u,index:D,items:m,newIndex:Ae.current.newIndex,previousItems:Ae.current.items,previousContainerId:Ae.current.containerId,transition:g,wasDragging:Ae.current.activeId!=null}),_t=YE({disabled:!Rt,index:D,node:X,rect:q});return N.useEffect(()=>{K&&Ae.current.newIndex!==ve&&(Ae.current.newIndex=ve),b!==Ae.current.containerId&&(Ae.current.containerId=b),m!==Ae.current.items&&(Ae.current.items=m)},[K,ve,b,m]),N.useEffect(()=>{if(He===Ae.current.activeId)return;if(He!=null&&Ae.current.activeId==null){Ae.current.activeId=He;return}const un=setTimeout(()=>{Ae.current.activeId=He},50);return()=>clearTimeout(un)},[He]),{active:Ce,activeIndex:v,attributes:Xe,data:U,rect:q,index:D,newIndex:ve,items:m,isOver:ge,isSorting:K,isDragging:fe,listeners:Q,node:X,overIndex:T,over:ye,setNodeRef:x,setActivatorNodeRef:te,setDroppableNodeRef:Ee,setDraggableNodeRef:ht,transform:_t??Ne,transition:ft()};function ft(){if(_t||Et&&Ae.current.newIndex===D)return KE;if(!(de&&!Id($e)||!g)&&(K||Rt))return uo.Transition.toString({...g,property:Im})}}function JE(o,e){var a,r;return typeof o=="boolean"?{draggable:o,droppable:!1}:{draggable:(a=o?.draggable)!=null?a:e.draggable,droppable:(r=o?.droppable)!=null?r:e.droppable}}function ic(o){if(!o)return!1;const e=o.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const QE=[it.Down,it.Right,it.Up,it.Left],ZE=(o,e)=>{let{context:{active:a,collisionRect:r,droppableRects:i,droppableContainers:l,over:u,scrollableAncestors:d}}=e;if(QE.includes(o.code)){if(o.preventDefault(),!a||!r)return;const f=[];l.getEnabled().forEach(b=>{if(!b||b!=null&&b.disabled)return;const v=i.get(b.id);if(v)switch(o.code){case it.Down:r.top<v.top&&f.push(b);break;case it.Up:r.top>v.top&&f.push(b);break;case it.Left:r.left>v.left&&f.push(b);break;case it.Right:r.left<v.left&&f.push(b);break}});const g=kC({collisionRect:r,droppableRects:i,droppableContainers:f});let m=um(g,"id");if(m===u?.id&&g.length>1&&(m=g[1].id),m!=null){const b=l.get(a.id),v=l.get(m),S=v?i.get(v.id):null,E=v?.node.current;if(E&&S&&b&&v){const T=Jl(E).some((j,q)=>d[q]!==j),L=Hm(b,v),M=e_(b,v),R=T||!L?{x:0,y:0}:{x:M?r.width-S.width:0,y:M?r.height-S.height:0},D={x:S.left,y:S.top};return R.x&&R.y?D:co(D,R)}}}};function Hm(o,e){return!ic(o)||!ic(e)?!1:o.data.current.sortable.containerId===e.data.current.sortable.containerId}function e_(o,e){return!ic(o)||!ic(e)||!Hm(o,e)?!1:o.data.current.sortable.index<e.data.current.sortable.index}const t_={verticalList:BE,horizontalList:jE,rectSorting:Yd},n_=({items:o,itemKey:e,strategy:a,children:r,onSortEnd:i,onSortStart:l,sortVersion:u})=>{const d=N.useId(),f=N.useRef({inProgress:!1,lastSortTime:0,lastActiveId:null}),g=xC(sm(Gd,{activationConstraint:{distance:5}}),sm(qd,{coordinateGetter:ZE})),m=N.useCallback(S=>{f.current={inProgress:!0,lastSortTime:Date.now(),lastActiveId:S.active.id},l?.({activeId:S.active.id})},[l]),b=N.useCallback(S=>{const{active:E,over:A}=S,T=Date.now();if(!A||E.id===A.id){f.current.inProgress=!1;return}const{lastSortTime:L,lastActiveId:M,inProgress:R}=f.current;if(M===E.id&&T-L<500&&!R)return;f.current={inProgress:!1,lastSortTime:T,lastActiveId:E.id};const D=o.findIndex(j=>String(j[e])===String(E.id)),U=o.findIndex(j=>String(j[e])===String(A.id));if(D!==-1&&U!==-1&&D!==U){const j=Wd(o,D,U);i?.(j,{oldIndex:D,newIndex:U})}},[o,e,i]),v=o.map(S=>String(S[e]));return ut.jsx(RE,{id:d,sensors:g,collisionDetection:RC,onDragStart:m,onDragEnd:b,children:ut.jsx(PE,{items:v,strategy:t_[a],children:r})},u!==void 0?`${d}-v${u}`:d)},zm=N.createContext(null),a_=({value:o,children:e})=>ut.jsx(zm.Provider,{value:o,children:e}),r_=()=>N.useContext(zm),i_=({id:o,handle:e,as:a="div",children:r})=>{const{attributes:i,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:g}=XE({id:o}),m={transform:uo.Transform.toString(d),transition:f,opacity:g?.5:1,position:"relative"};return ut.jsx(a,{ref:u,style:m,...i,...e?{}:l,"data-sortable-item":!0,"data-sortable-id":String(o),"data-dragging":g,children:ut.jsx(a_,{value:{listeners:l,handle:e,isDragging:g},children:r})})},dt=ct("DynamicRenderer");function Ja(){try{return window.G7Core?.devTools}catch{return}}function Xd(o,e,a,r){if(typeof o=="string"){if(/\$t:[a-zA-Z_][a-zA-Z0-9_.\-]*/.test(o))try{return e.resolveTranslations(o,a,r)}catch{return o}return o}if(Array.isArray(o))return o.map(i=>Xd(i,e,a,r));if(o&&typeof o=="object"){const i={};for(const[l,u]of Object.entries(o))i[l]=Xd(u,e,a,r);return i}return o}function s_(o){const e=Object.keys(o);return e.length>0&&e.every(a=>/^\d+$/.test(a))}const ya=(o,e)=>{const a=["errors"],r={...o};for(const i of Object.keys(e)){const l=e[i],u=o[i];if(l===null){r[i]=null;continue}if(a.includes(i)){r[i]=l;continue}if(Array.isArray(l)){r[i]=l;continue}if(Array.isArray(u)&&l!==null&&typeof l=="object"&&!Array.isArray(l)&&s_(l)){const d=Object.keys(l).map(g=>parseInt(g,10));if((d.length>0?Math.max(...d):0)>=u.length+d.length+10)r[i]={...l};else{const g=[...u];for(const[m,b]of Object.entries(l)){const v=parseInt(m,10);v>=0&&v<g.length?b!==null&&typeof b=="object"&&!Array.isArray(b)&&g[v]!==null&&typeof g[v]=="object"?g[v]=ya(g[v],b):g[v]=b:v>=g.length&&(g[v]=b)}r[i]=g}}else l!==null&&typeof l=="object"&&u!==null&&typeof u=="object"&&!Array.isArray(u)?r[i]=ya(u,l):r[i]=l}return r},jm=(o,e)=>{const a={...o};for(const r of Object.keys(e)){if(!(r in a))continue;const i=e[r],l=a[r];if(i!==null&&typeof i=="object"&&!Array.isArray(i)&&l!==null&&typeof l=="object"&&!Array.isArray(l)){const u=jm(l,i);Object.keys(u).length===0?delete a[r]:a[r]=u}else delete a[r]}return a},o_=o=>{const e={},a=o.split(";").filter(r=>r.trim());for(const r of a){const i=r.indexOf(":");if(i===-1)continue;const l=r.substring(0,i).trim(),u=r.substring(i+1).trim();if(l&&u){const d=l.replace(/-([a-z])/g,(f,g)=>g.toUpperCase());e[d]=u}}return e};class l_ extends N.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,a){dt.error(`컴포넌트 렌더링 에러 (ID: ${this.props.componentId}, Name: ${this.props.componentName}):`,e,a)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:ut.jsxs("div",{className:"p-4 my-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg text-red-800 dark:text-red-400",children:[ut.jsx("div",{className:"font-semibold mb-1",children:"컴포넌트 로드 실패"}),ut.jsxs("div",{className:"text-xs opacity-80",children:[this.props.componentName&&`[${this.props.componentName}] `,"데이터를 표시할 수 없습니다."]}),this.state.error&&ut.jsxs("details",{className:"mt-2",children:[ut.jsx("summary",{className:"cursor-pointer text-xs opacity-70 hover:opacity-100",children:"상세 정보"}),ut.jsx("div",{className:"mt-1 p-2 bg-red-100 dark:bg-red-900/30 rounded text-xs font-mono whitespace-pre-wrap break-all",children:this.state.error.message})]})]}):this.props.children}}const Ia=N.memo(({componentDef:o,dataContext:e,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:d,parentFormContextProp:f,parentDataContext:g,isRootRenderer:m=!1,isInsideIteration:b=!1,isEditMode:v=!1,onComponentSelect:S,onComponentHover:E,onDragStart:A,onDragEnd:T,componentPath:L,layoutKey:M})=>{const[R,D]=N.useState({loadingActions:{}});N.useLayoutEffect(()=>{d||(i.startRenderCycle(),window.__g7SetLocalOverrideKeys||(window.__g7ForcedLocalFields=void 0),window.__g7PendingLocalState=null)});const U=N.useRef(null);N.useLayoutEffect(()=>{if(!d&&e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:P,_merge:ce,...le}=e._localInit,Z=`${JSON.stringify(le)}:${P||"no-force"}`;if(U.current!==Z){U.current=Z;const be=ce||"shallow",Re=window.G7Core?.state?.get?.()?._local||{},xe=window.__g7PendingLocalState||{},je={...Re,...xe};be==="replace"?window.__g7PendingLocalState={loadingActions:je.loadingActions||{},...le,hasChanges:!1}:be==="deep"?window.__g7PendingLocalState=ya(je,{...le,hasChanges:!1}):window.__g7PendingLocalState={...je,...le,hasChanges:!1};const ze=window.__g7SetLocalOverrideKeys;ze&&typeof ze=="object"&&(be==="replace"?window.__g7SetLocalOverrideKeys={...le,hasChanges:!1}:window.__g7SetLocalOverrideKeys=ya(ze,{...le,hasChanges:!1}))}}}),N.useLayoutEffect(()=>{if(!d){const P=window.__g7SetLocalOverrideKeys;if(P){D(be=>jm(be,P));const ce=P,le=window.__g7ForcedLocalFields,Z=window.__g7LastSetLocalSnapshot;queueMicrotask(()=>{window.__g7SetLocalOverrideKeys===ce&&(window.__g7SetLocalOverrideKeys=void 0),window.__g7ForcedLocalFields===le&&(window.__g7ForcedLocalFields=void 0),window.__g7LastSetLocalSnapshot===Z&&(window.__g7LastSetLocalSnapshot=void 0)})}}},[e._local]);const j=N.useRef(M);N.useEffect(()=>{o._fromBase&&M&&j.current!==M&&(j.current=M,D({loadingActions:{}}))},[M,o._fromBase]);const q=N.useRef(""),X=N.useRef(!1),ge=N.useRef(null),Ee=N.useRef({}),Ce=N.useRef({}),$e=N.useRef(g),qe=dC(),Xe=P0(),ht=Xe?.getParentDataContext()??g;N.useEffect(()=>{if(e._localInit&&typeof e._localInit=="object"){const{_forceLocalInit:P,...ce}=e._localInit,le=JSON.stringify(ce),Z=P!==void 0,be=Rd(),Se=`${le}:${P||"no-force"}`;if(be.hash!==Se){be.hash=Se,be.timestamp=P,q.current=le,Z&&(X.current=!0);const{_merge:je,...ze}=ce,Le=je||"shallow";if(D(ke=>Le==="replace"?{loadingActions:ke.loadingActions||{},...ze,hasChanges:!1}:Le==="deep"?ya(ke,{...ze,hasChanges:!1}):{...ke,...ze,hasChanges:!1}),e._globalSetState){const ke=e._global?._local||{};let We;Le==="replace"?We={...ze,hasChanges:!1}:Le==="deep"?We=ya(ke,{...ze,hasChanges:!1}):We={...ke,...ze,hasChanges:!1},e._globalSetState({_local:We})}i.invalidateCacheByKeys(["_local"]),dt.log("_localInit applied (data changed):",Object.keys(ce))}ge.current=e._localInit,W0(e._localInit)}},[e._localInit,g,i]);const{isTransitioning:Q}=Xp(),fe=nC(),ye=f??fe,{width:te}=Dd(),he=r_(),x=N.useMemo(()=>{let P=o;if(o.type==="iterator"&&o.data){const{data:Z,itemName:be,indexName:Se,...Re}=o;P={...Re,iteration:{source:Z,item_var:be||"item",index_var:Se}}}if(!P.responsive)return P;const ce=oi.getMatchingKey(P.responsive,te);if(!ce)return P;const le=P.responsive[ce];return{...P,props:{...P.props,...le.props},children:le.children??P.children,text:le.text??P.text,if:le.if??P.if,iteration:le.iteration??P.iteration,__responsiveChildrenKey:le.children!==void 0?ce:void 0}},[o,te]),K=N.useCallback(P=>{const ce=P?.__setStateId;if(D(le=>{const Z=window.__g7PendingLocalState,Se=window.__g7SetLocalOverrideKeys||Z,Re=Se?ya(le,Se):le;if(typeof P=="function"){const ke=P(Re);return ya(Re,ke)}const{__mergeMode:xe,__setStateId:je,...ze}=P;let Le;if(xe==="replace"?Le=ze:xe==="shallow"?Le={...Re,...ze}:Le=ya(Re,ze),xe!==void 0){const ke=window.__g7ForcedLocalFields;ke&&(window.__g7ForcedLocalFields={...ke,...ze})}return Le}),ce){const le=Ja();if(le?.isEnabled()){const Z=x.id||"unknown",be=x.name||"Unknown";setTimeout(()=>{le.trackComponentRender?.(Z,be,0,["_local"],[]),le.completeStateChange?.(ce)},0)}}},[x.id,x.name]),re=d?.state??R,de=d?.setState??K,se=N.useMemo(()=>{const P=e._localInit&&e._localInit!==ge.current;let ce;P&&e._local?ce=e._local:ce=e._local?ya(e._local,re):re;const le=window.__g7ForcedLocalFields;le&&(ce=ya(ce,le));const Z={...e,_local:ce},be=e._computedDefinitions;if(be&&Object.keys(be).length>0){const Se=new wn,Re={...Z,...qe?{_isolated:qe.state}:{}},xe={},je=Ja(),ze=je?.isEnabled()??!1;for(const[Le,ke]of Object.entries(be)){const We=ze?Date.now():0,Fe=ze?e._computed?.[Le]:void 0;let _e;try{if(typeof ke=="string")if(ke.startsWith("{{")&&ke.endsWith("}}")){const Te=ke.slice(2,-2).trim(),Ue=Se.evaluateExpression(Te,Re,{skipCache:!0});xe[Le]=Ue}else xe[Le]=ke;else if(ke&&typeof ke=="object"&&"$switch"in ke){const Te=Se.resolveSwitch(ke,Re,{skipCache:!0});xe[Le]=Te}}catch(Te){dt.warn(`Failed to recalculate computed value: ${Le}`,Te),xe[Le]=e._computed?.[Le],_e=Te instanceof Error?Te.message:String(Te)}if(ze&&(_e||Fe!==xe[Le])){const Ue=Date.now()-We;je.trackComputedProperty?.(Le,typeof ke=="string"?ke:JSON.stringify(ke),[{type:"_local",path:"_local",value:Z._local}],xe[Le],Ue,x.id,_e),Fe!==xe[Le]&&je.trackComputedRecalc?.(Le,"dependency-change",Fe,xe[Le],Ue,{type:"_local",path:"_local"},x.id)}}Z._computed=xe}if(qe&&(Z._isolated=qe.state),ht&&(Z.$parent=ht),o.extensionPointProps){const Se=i.resolveObject(o.extensionPointProps,Z,b?{skipCache:!0}:void 0);Z.extensionPointProps=v&&l?Xd(Se,l,a,Z):Se}return o.extensionPointCallbacks&&(Z.extensionPointCallbacks=o.extensionPointCallbacks),v&&(Z.$templateId===void 0&&a?.templateId&&(Z.$templateId=a.templateId),Z.$locale===void 0&&a?.locale&&(Z.$locale=a.locale)),Z},[e,re,qe?.state,ht,Xe?.version,o.extensionPointProps,o.extensionPointCallbacks]);Ee.current=se._local,Ce.current=se._computed||{},$e.current=ht,N.useEffect(()=>{const P=Ja();if(!P?.isEnabled())return;const ce=se._local;ce&&P.updateLocalState(ce);const le=se._computed;le&&P.updateComputedState(le),ht&&P.updateParentContext?.(ht);const Z=x.id||`comp-${Date.now()}`,be=x.name||"Unknown",Se={global:Object.keys(e._global||{}),local:Object.keys(ce||{}),context:d?Object.keys(d.state||{}):[]},Re={type:d?"componentContext":"dynamicState",hasComponentContext:!!d,parentId:d?"parent":void 0};P.trackComponentStateSource?.(Z,be,Se,Re),re&&Object.keys(re).length>0&&P.trackDynamicState?.(Z,re);const xe=!!(x.expandChildren||x.props?.expandChildren);P.trackContextFlow?.(Z,be,!!d,xe,!0)},[se._local,e,x.id,x.name,d,re,x.expandChildren,x.props?.expandChildren,ht]);const me=N.useMemo(()=>({state:{...se._local},setState:de,stateRef:Ee,computedRef:Ce,isolatedContext:qe,parentDataContext:se}),[se._local,de,R,qe,se]),Ne=N.useMemo(()=>{const P=Fi({if:x.if,condition:x.condition,conditions:x.conditions},se,i,x.id);if(x.if||x.condition!==void 0||x.conditions){const le=Ja();le?.isEnabled()&&x.if&&le.trackIfCondition(x.id||`if-${Date.now()}`,x.if,P)}return P},[x.if,x.conditions,se,i,x.id]),ve=N.useMemo(()=>{if(!x.slot)return null;const P=x.slot;if(P.startsWith("{{")&&P.endsWith("}}")){const ce=P.slice(2,-2).trim();try{const le={componentId:x.id,componentName:x.name,propName:"slot"},Z=i.evaluateExpression(ce,se,le);return dt.log(`[Slot] 표현식 평가: "${ce}" => "${Z}" (컴포넌트: ${x.id})`),typeof Z=="string"?Z:null}catch(le){return dt.warn(`slot 표현식 평가 실패 (컴포넌트: ${x.id}):`,le),null}}return dt.log(`[Slot] 정적 슬롯 ID: "${P}" (컴포넌트: ${x.id})`),P},[x.slot,x.id,se,i]),He=N.useMemo(()=>!ve||!x.id?"":`${x.id}-${ve}-${JSON.stringify(x.slotOrder??0)}`,[ve,x.id,x.slotOrder]),Ae=N.useRef(null);N.useEffect(()=>{const P=window.__slotContextValue,ce=P?.isEnabled??!1;if(x.slot&&dt.log(`[Slot Registration] 컴포넌트: ${x.id}, isSlotEnabled: ${ce}, shouldRender: ${Ne}, resolvedSlotId: ${ve}`),!ce||!Ne){x.slot&&dt.log(`[Slot Registration] 등록 스킵 - isSlotEnabled: ${ce}, shouldRender: ${Ne}`),Ae.current&&x.id&&P&&(P.unregisterFromSlot(Ae.current,x.id),Ae.current=null);return}if(!ve||!x.id){x.slot&&dt.log(`[Slot Registration] 등록 스킵 - resolvedSlotId: ${ve}, id: ${x.id}`),Ae.current&&x.id&&P&&(P.unregisterFromSlot(Ae.current,x.id),Ae.current=null);return}Ae.current&&Ae.current!==ve&&P.unregisterFromSlot(Ae.current,x.id);const le={...x,slot:void 0,slotOrder:void 0};return P.registerToSlot(ve,x.id,{componentDef:le,dataContext:e,order:x.slotOrder??0,parentFormContext:f??null,getParentComponentContext:()=>me,translationContext:a,registrationKey:He}),Ae.current=ve,()=>{const Z=window.__slotContextValue;ve&&x.id&&Z&&Z.unregisterFromSlot(ve,x.id)}},[Ne,ve,x,e,f,me,a,He]);const Et=N.useCallback(P=>{if(typeof P=="string"){if(Qg(P))return ep(P);if(Zg(P)){const ce=[],le=P.replace(new RegExp(`${_l}([^${Vs}]*)${Vs}`,"g"),(be,Se)=>(ce.push(Se),`${Cr}${ce.length-1}${Cr}`));let Z=le;return/\$t:[a-zA-Z0-9._-]+/.test(le)&&(Z=l.resolveTranslations(le,a,se)),Z.replace(new RegExp(`${Cr}(\\d+)${Cr}`,"g"),(be,Se)=>ce[parseInt(Se)])}if(P.startsWith("$t:defer:"))return P;if(/\$t:[a-zA-Z0-9._-]+/.test(P)){const ce=P.trim();return ce.startsWith("{")&&ce.endsWith("}")||ce.startsWith("[")&&ce.endsWith("]")?P:l.resolveTranslations(P,a,se)}return P}if(Array.isArray(P))return P.map(ce=>Et(ce));if(P&&typeof P=="object"){const ce={};for(const[le,Z]of Object.entries(P))ce[le]=Et(Z);return ce}return P},[l,a,se]),Rt=N.useCallback(P=>/[?:|&!+\-*/<>=()]/.test(P),[]),_t=N.useCallback(P=>{if(!P.startsWith("{{")||!P.endsWith("}}"))return null;const ce=P.slice(2,-2);let le=null,Z=0;for(let be=0;be<ce.length;be++){const Se=ce[be];if((be>0?ce[be-1]:"")!=="\\"&&((Se==='"'||Se==="'")&&!le?le=Se:Se===le&&(le=null),!le&&(Se==="{"&&Z++,Se==="}"&&Z--,Z<0)))return null}return Z===0?ce.trim():null},[]),ft=N.useMemo(()=>{let P={...x.props||{}};const ce=["cellChildren","expandChildren","expandContext","render"],Z=r.getMetadata(x.name)?.skipBindingKeys||[],be=[...new Set([...ce,...Z])],Se=b?{skipCache:!0}:void 0,Re=_e=>{if(Se)return Se;if(_e.startsWith("_computed")||_e.startsWith("$computed"))return{skipCache:!0}};for(const[_e,Te]of Object.entries(P))if(!be.includes(_e))if(typeof Te=="string"){const Ue=_t(Te);if(Ue!==null){let st=!1,Dt=Ue;Ue.startsWith(wr)&&(st=!0,Dt=Ue.slice(wr.length));const nn={componentId:x.id,componentName:x.name,propName:_e};let Kt;if(Rt(Dt))try{Kt=i.evaluateExpression(Dt,se,nn)}catch(Pn){dt.warn(`표현식 평가 실패 (컴포넌트: ${x.id}, prop: ${_e}):`,Pn),Kt=void 0}else Kt=i.resolve(Dt,se,Re(Dt),nn);P[_e]=st&&Kt!=null?Ks(Kt):Kt}else{const st={componentId:x.id,componentName:x.name,propName:_e};P[_e]=i.resolveBindings(Te,se,Se,st)}}else Array.isArray(Te)?P[_e]=Te.map(Ue=>typeof Ue=="string"?i.resolveBindings(Ue,se,Se):typeof Ue=="object"&&Ue!==null?i.resolveObject(Ue,se,Se):Ue):Te&&typeof Te=="object"&&(P[_e]=i.resolveObject(Te,se,Se));for(const[_e,Te]of Object.entries(P))P[_e]=Et(Te);if(typeof P.style=="string"&&(P.style=o_(P.style)),P=rd(P,v?void 0:x.actions,se,{componentContext:me,actionDispatcher:u}),x.classMap){const _e=QS(x.classMap,se,i,{skipCache:!0});if(_e){const Te=P.className||"";P.className=Te?`${Te} ${_e}`:_e}}x.style&&(P.style=x.style),x.actions&&x.actions.length>0&&x.type==="composite"&&Object.assign(P,re),x.component_layout&&(P.__componentLayoutDefs=x.component_layout);const xe=x.expandChildren||x.props?.expandChildren,je=x.props?.cellChildren,ze=x.children&&x.children.length>0,Le=x.component_layout,ke=x.slot,We=x.props?.modalId,Fe=x.type==="composite";return(xe||je||ze||Le||ke||We||Fe)&&(P.__componentContext=me),P},[x.props,x.actions,x.style,x.classMap,x.id,se,a,i,l,me,re,Et,Rt,_t,b]),un=N.useRef(null),gt=N.useMemo(()=>un.current&&Qp(un.current,ft)?un.current:(un.current=ft,ft),[ft]),za=N.useMemo(()=>{const P=x.id;if(typeof P!="string"||!P.includes("{{"))return P;const ce=i.resolveBindings(P,se,{skipCache:!0});return typeof ce=="string"?ce:P},[x.id,se,i]),kn=N.useMemo(()=>{const P=x.dataKey,ce=x.trackChanges,le=x.debounce;if(P){const Z=P.startsWith("_global."),be=Z?P.slice(8):P,Se=Z?e._global:se._local;return{dataKey:be,trackChanges:ce??!1,debounce:le,setState:Z?xe=>{e._globalSetState?e._globalSetState(xe):dt.warn("_global.formData 사용 시 _globalSetState가 필요합니다.")}:de,state:Se??{},_isGlobal:Z}}if(ye.dataKey)return ye},[x.dataKey,x.trackChanges,x.debounce,x.id,de,se._local,e._global,e._globalSetState,ye]),Dn=N.useRef(new Set);N.useEffect(()=>{Dn.current.clear()},[e._global?._remountKeys]);const jt=N.useCallback((P,ce)=>{const le=e._global?._remountKeys;return P&&le?.[P]&&!Dn.current.has(P)?(Dn.current.add(P),`${P}-remount-${le[P]}`):P||ce},[e._global?._remountKeys]),On=N.useMemo(()=>{if(x.text!==void 0){if(typeof x.text=="string"){const P=x.text;let ce=P;const le={componentId:x.id,componentName:x.name,propName:"text",skipCache:!0},Z=_t(P);if(Z!==null)if(Jg(Z))ce=i.resolveBindings(P,se,{skipCache:!0},le);else if(Rt(Z))try{ce=i.evaluateExpression(Z,se,le)}catch(be){dt.warn(`text 표현식 평가 실패 (컴포넌트: ${x.id}):`,be),ce=""}else ce=i.resolve(Z,se,{skipCache:!0},le);else P.includes("{{")&&(ce=i.resolveBindings(P,se,{skipCache:!0},le));return ce=Et(ce),ce??""}return x.text}return!x.children||x.children.length===0?null:x.children.map((P,ce)=>{if(typeof P=="string")return P;const le=x.__responsiveChildrenKey,Z=le?`responsive.${le}.children`:"children",be=L?`${L}.${Z}.${ce}`:`${ce}`,Se=P._fromBase?P.id||`child-${ce}`:jt(P.id,`child-${ce}`),Re=!P._fromBase&&M?`${Se}_${M}`:Se;return ut.jsx(Ia,{componentDef:P,dataContext:se,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:me,parentFormContextProp:kn,isInsideIteration:b,isEditMode:v,onComponentSelect:S,onComponentHover:E,componentPath:be,onDragStart:A,onDragEnd:T,layoutKey:M},Re)})},[x.text,x.children,x.id,e,se,a,r,i,l,u,me,kn,_t,Rt,Et,jt,b,v,S,E,L,A,T,M]),ea=N.useMemo(()=>{if(!x.iteration)return null;try{const P=ad(x.iteration.source,se,i);if(!Array.isArray(P))return dt.warn(`iteration source가 배열이 아닙니다 (컴포넌트: ${x.id}):`,P),null;const ce=Ja();return ce?.isEnabled()&&ce.trackIteration(x.id||`iteration-${Date.now()}`,x.iteration.source,x.iteration.item_var,x.iteration.index_var,P.length),P.map((le,Z)=>{const be={...se,[x.iteration.item_var]:le};x.iteration.index_var&&(be[x.iteration.index_var]=Z);const Se=Z===0||Z===P.length-1;ce?.isEnabled()&&Se&&ce.trackNestedContext?.({componentId:`${x.id||"unknown"}-iter-${Z}`,componentType:"iteration",parentContext:{available:Object.keys(se),values:{}},ownContext:{added:[x.iteration.item_var,...x.iteration.index_var?[x.iteration.index_var]:[]],values:{[x.iteration.item_var]:le,...x.iteration.index_var?{[x.iteration.index_var]:Z}:{}}},depth:1});const Re={...x,iteration:void 0,responsive:void 0},xe=L?`${L}.iteration.${Z}`:`iteration.${Z}`,je=`${jt(x.id,"item")}-${Z}`;return ut.jsx(Ia,{componentDef:Re,dataContext:be,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:me,parentFormContextProp:kn,isInsideIteration:!0,isEditMode:v,onComponentSelect:S,onComponentHover:E,componentPath:xe,onDragStart:A,onDragEnd:T,layoutKey:M},je)})}catch(P){return dt.error(`iteration 렌더링 실패 (컴포넌트: ${x.id}):`,P),null}},[x.iteration,x.children,x.id,e,se,a,r,i,l,u,me,kn,jt,v,S,E,L,A,T,M]),[ja,Ft]=N.useState(0),Rr=N.useMemo(()=>{if(!x.sortable||!x.itemTemplate)return null;const{sortable:P,itemTemplate:ce}=x;try{const le=ad(P.source,se,i);if(!Array.isArray(le))return dt.warn(`sortable source가 배열이 아닙니다 (컴포넌트: ${x.id}):`,le),null;if(le.length===0)return null;const Z=P.itemKey||"id",be=P.strategy||"verticalList",Se=P.itemVar||"$item",Re=P.indexVar||"$index",xe=P.handle,je=P.wrapperElement,ze=(We,Fe)=>{const _e=x.actions?.filter(Te=>Te.event==="onSortEnd"||Te.type==="onSortEnd");if(Ft(Te=>Te+1),_e&&_e.length>0&&u){const Te={...se,$sortedItems:We,$sortEvent:Fe};_e.forEach(Ue=>{try{const st=u.createHandler(Ue,Te,me),Dt=new Event("sortend");st(Dt)}catch(st){dt.error(`onSortEnd action failed: ${Ue.handler}`,st)}})}},Le=We=>{const Fe=x.actions?.filter(_e=>_e.event==="onSortStart"||_e.type==="onSortStart");if(Fe&&Fe.length>0&&u){const _e={...se,$activeId:We.activeId};Fe.forEach(Te=>{try{const Ue=u.createHandler(Te,_e,me),st=new Event("sortstart");Ue(st)}catch(Ue){dt.error(`onSortStart action failed: ${Te.handler}`,Ue)}})}},ke=le.map((We,Fe)=>{const _e=String(We[Z]),Te={...se,[Se]:We,[Re]:Fe},Ue=L?`${L}.sortable.${Fe}`:`sortable.${Fe}`,st=`${jt(x.id,"sortable-item")}-v${ja}-${_e}`;return ut.jsx(i_,{id:_e,handle:xe,...je?{as:je}:{},children:(je&&ce.children?ce.children:[ce]).map((Dt,nn)=>ut.jsx(Ia,{componentDef:Dt,dataContext:Te,translationContext:a,registry:r,bindingEngine:i,translationEngine:l,actionDispatcher:u,parentComponentContext:me,parentFormContextProp:void 0,isInsideIteration:!0,isEditMode:v,onComponentSelect:S,onComponentHover:E,componentPath:Ue,onDragStart:A,onDragEnd:T,layoutKey:M},`${st}-child-${nn}`))},st)});return ut.jsx(n_,{items:le,itemKey:Z,strategy:be,onSortEnd:ze,onSortStart:Le,sortVersion:ja,children:ke})}catch(le){return dt.error(`sortable 렌더링 실패 (컴포넌트: ${x.id}):`,le),null}},[x.sortable,x.itemTemplate,x.actions,x.id,e,se,a,r,i,l,u,me,jt,v,S,E,L,A,T,ja,M]),Za=N.useRef(!1);N.useEffect(()=>{if(Za.current)return;Za.current=!0;const P=Ja();if(P?.isEnabled()&&P.trackMount(o.id,{name:o.name,type:o.type||"component",props:gt}),o.lifecycle?.onMount&&o.lifecycle.onMount.length>0)for(const le of o.lifecycle.onMount)try{const Z=u.createHandler(le,se,me),be=new Event("mount");Z(be),dt.log(`Lifecycle onMount executed: ${le.handler} (Component: ${o.id})`)}catch(Z){dt.error(`Lifecycle onMount failed: ${le.handler} (Component: ${o.id})`,Z)}const ce=[];if(o.onComponentEvent&&o.onComponentEvent.length>0){const le=window.G7Core;if(le?.componentEvent?.on)for(const Z of o.onComponentEvent){if(!Z.event){dt.warn(`onComponentEvent: event name is required (Component: ${o.id})`);continue}const be=async Re=>{try{const xe={...se,_eventData:Re},ze=await u.createHandler({handler:Z.handler,params:Z.params,onSuccess:Z.onSuccess,onError:Z.onError},xe,me)(new CustomEvent(Z.event,{detail:Re}));return dt.log(`onComponentEvent "${Z.event}" handled: ${Z.handler} (Component: ${o.id})`,{eventData:Re,result:ze}),ze}catch(xe){throw dt.error(`onComponentEvent "${Z.event}" failed: ${Z.handler} (Component: ${o.id})`,xe),xe}},Se=le.componentEvent.on(Z.event,be);ce.push(Se),dt.log(`onComponentEvent: Subscribed to "${Z.event}" (Component: ${o.id})`)}else dt.warn(`onComponentEvent: G7Core.componentEvent is not available (Component: ${o.id})`)}return()=>{const le=Ja();le?.isEnabled()&&le.trackUnmount(o.id);for(const Z of ce)try{Z()}catch(be){dt.error(`onComponentEvent: Failed to unsubscribe (Component: ${o.id})`,be)}if(ce.length>0&&dt.log(`onComponentEvent: Unsubscribed ${ce.length} event(s) (Component: ${o.id})`),o.lifecycle?.onUnmount&&o.lifecycle.onUnmount.length>0)for(const Z of o.lifecycle.onUnmount)try{const be=u.createHandler(Z,se,me),Se=new Event("unmount");be(Se),dt.log(`Lifecycle onUnmount executed: ${Z.handler} (Component: ${o.id})`)}catch(be){dt.error(`Lifecycle onUnmount failed: ${Z.handler} (Component: ${o.id})`,be)}}},[]);const bn=N.useMemo(()=>{const P=gt.dataKey,ce=gt.trackChanges,le=gt.debounce;return P?{dataKey:P,trackChanges:ce??!1,debounce:le,setState:de,state:re}:null},[gt.dataKey,gt.trackChanges,gt.debounce,de,re]);N.useEffect(()=>{const P=x.dataKey||gt.dataKey;if(!P)return;const ce=Ja();if(!ce?.isEnabled())return;const le=[],Z=Se=>{if(Se)for(const Re of Se){const xe=Re?.props?.name;if(xe&&le.push({name:xe,type:Re.name||Re.type||"unknown"}),Re?.children&&Z(Re.children),Re?.slots)for(const je of Object.values(Re.slots))Array.isArray(je)&&Z(je)}};if(o.children&&Z(o.children),o.slots)for(const Se of Object.values(o.slots))Array.isArray(Se)&&Z(Se);const be=o.id||`form-${P}`;return ce.trackForm(be,P,le),()=>{ce.untrackForm(be)}},[x,gt.dataKey,o.id,o.children]);const en=N.useRef(null),et=N.useRef(void 0);N.useEffect(()=>{const P=gt?.name;if(!P||!ye.dataKey||!ye.setState||gt?.autoBinding===!1)return;const ce=`${ye.dataKey}.${P}`,le=window.__g7AutoBindingPaths??new Map;return window.__g7AutoBindingPaths=le,le.set(ce,(le.get(ce)??0)+1),()=>{const Z=le.get(ce)??0;Z<=1?le.delete(ce):le.set(ce,Z-1)}},[gt?.name,gt?.autoBinding,ye.dataKey,ye.setState]);const ta=N.useMemo(()=>{const{dataKey:P,trackChanges:ce,debounce:le,...Z}=gt,be=Z.name;if(!be||!ye.dataKey||!ye.setState)return Z;if(Z.autoBinding===!1){const{autoBinding:_e,...Te}=Z;return Te}const Se=`${ye.dataKey}.${be}`,Re=aC(ye.state,Se),xe=Re!==void 0?Re:Z.value,ze=r.getMetadata(o.name)?.bindingType,Le=typeof xe=="boolean"&&(ze==="checked"||ze==="checkable"&&["checkbox","radio"].includes(Z?.type)),ke=ye.debounce,We=_e=>{const Te=ye.state||{},Ue=rC(Te,Se,_e);if(ye.trackChanges&&(Ue.hasChanges=!0),window.__g7PendingLocalState=Ue,ye.setState(Ue),ye._isGlobal)return;const st=window.G7Core,Dt={[Se]:_e};ye.trackChanges&&(Dt.hasChanges=!0),st?.state?.setLocal?.(Dt,{render:!1})},Fe=(_e,Te)=>{ke&&ke>0?(en.current&&clearTimeout(en.current),en.current=setTimeout(()=>{We(_e),en.current=null,Te&&(Te(),window.__g7PendingLocalState=null)},ke)):(We(_e),Te&&(Te(),window.__g7PendingLocalState=null))};if(Le)return{...Z,checked:xe,onChange:Te=>{const Ue=Te.target.checked;We(Ue),Z.onChange&&Z.onChange(Te)}};{const _e=Ue=>{const st=Ue?.target?.value!==void 0?Ue.target.value:Ue;ke&&ke>0&&(et.current=st);const Dt=Ue?.target?{target:{value:st,name:Ue.target.name,type:Ue.target.type,checked:Ue.target.checked},currentTarget:Ue.currentTarget?{value:st,name:Ue.currentTarget.name}:void 0}:Ue;Fe(st,()=>{Z.onChange&&Z.onChange(Dt)})};let Te;return et.current!==void 0?en.current!==null?Te=et.current:String(xe??"")===String(et.current)?(et.current=void 0,Te=xe??""):Te=et.current:Te=xe??"",{...Z,value:Te,onChange:_e}}},[gt,ye,ye.state,ye.debounce]),En=N.useMemo(()=>{const P=Ja();if(P?.isEnabled()&&P.trackRender(o.name),!Ne)return null;if(x.sortable&&x.itemTemplate)return Rr;if(x.iteration)return ea;if(x.type==="extension_point"){const{layout:ze,columns:Le,gap:ke,className:We,...Fe}=x.props||{};let _e=We||"";return ze==="grid"&&Le?_e=`${_e} grid grid-cols-${Le} gap-${ke||4}`.trim():ze==="flex"&&(_e=`${_e} flex flex-col gap-${ke||4}`.trim()),ut.jsx("div",{id:za,className:_e||void 0,...Fe,children:On})}const ce=r.getComponent(x.name);if(!ce)return dt.error(`컴포넌트를 찾을 수 없습니다: ${x.name} (ID: ${x.id})`,"componentDef:",JSON.stringify(x,null,2)),null;const le=e._global?._remountKeys,Z={...ta,id:ta.id??za,...le&&Object.keys(le).length>0&&{__remountTrigger:JSON.stringify(le)}};if(he?.listeners&&he.handle&&ta["data-drag-handle"]!==void 0&&(Object.assign(Z,he.listeners),Z.style={...Z.style,cursor:he.isDragging?"grabbing":"grab"}),v){const ze=x.id||`auto_${x.name||x.type||"unknown"}_${Math.random().toString(36).substring(2,8)}`,Le=Fe=>{typeof Fe.preventDefault=="function"&&Fe.preventDefault(),S&&(Fe.stopPropagation(),S(ze,Fe))},ke={"data-editor-id":ze,"data-editor-name":x.name,"data-editor-type":x.type,onClick:Le};L&&(ke["data-editor-path"]=L);const We=x.__editorSlotName??x.slot;typeof We=="string"&&(ke["data-editor-slot"]=We),E&&(ke.onMouseMove=Fe=>{Fe.stopPropagation(),E(ze,Fe)},ke.onMouseLeave=Fe=>{E(null,Fe)}),Object.assign(Z,ke),Z.editorAttrs=ke}const be=x.type==="basic",Se=x.type==="layout",xe=be||Se?(()=>{const ze={};for(const[Le,ke]of Object.entries(Z))Le.startsWith("__")||Le==="editorAttrs"&&be||(ze[Le]=ke);return ze})():Z;let je=ut.jsx(ce,{...xe,children:On});if(kn&&(je=ut.jsx(tC,{value:kn,children:je})),x.isolatedState){const ze=typeof x.isolatedState=="object"?x.isolatedState:{},Le=e?._isolatedInit,ke=Le?{...ze,...Le}:ze;je=ut.jsx(uC,{initialState:ke,scopeId:x.isolatedScopeId,children:je})}return je},[Ne,x.iteration,x.sortable,x.itemTemplate,x.type,x.name,x.id,x.props,x.isolatedState,x.isolatedScopeId,r,ta,On,ea,Rr,he,bn,v,S,E,A,T,L,e._global?._remountKeys]),er=N.useMemo(()=>{const P=x.blur_until_loaded;if(!P||e?._global?.__isPreview)return!1;if(typeof P=="string"){const Z=_t(P);if(Z!==null)try{const be={componentId:x.id,componentName:x.name,propName:"blur_until_loaded"};return!!i.evaluateExpression(Z,se,be)}catch(be){return dt.warn(`blur_until_loaded 표현식 평가 실패 (컴포넌트: ${x.id}):`,be),!1}return!1}if(typeof P=="object"&&P!==null){if(!P.enabled)return!1;if(P.data_sources)return(Array.isArray(P.data_sources)?P.data_sources:[P.data_sources]).some(Re=>e[Re]===void 0);if(Q)return!0;const Z=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(Se=>!Z.includes(Se)&&!Se.startsWith("_")).some(Se=>e[Se]===void 0)}if(Q)return!0;const ce=["route","query","_global","_local","_dataSourceErrors"];return Object.keys(e).filter(Z=>!ce.includes(Z)&&!Z.startsWith("_")).some(Z=>e[Z]===void 0)},[x.blur_until_loaded,x.id,Q,e,se,i,_t]);if(er){const P=x.blur_until_loaded;if(typeof P=="object"&&P?.data_sources){const le=(Array.isArray(P.data_sources)?P.data_sources:[P.data_sources]).reduce((be,Se)=>(be[Se]=e[Se]===void 0?"UNDEFINED":"LOADED",be),{}),Z=Object.keys(e).filter(be=>!be.startsWith("_"));dt.log(`[BLUR APPLIED] Component: ${x.id}, data_sources status:`,le,"Available keys:",Z)}else dt.log(`[BLUR APPLIED] Component: ${x.id}, blur_until_loaded:`,P)}const Ea=N.useMemo(()=>{if(!x.blur_until_loaded)return{wrapperClasses:"",innerClasses:""};const P=ft?.className||"";if(!P)return{wrapperClasses:"",innerClasses:""};const ce=[/^(sm:|md:|lg:|xl:|2xl:)?(col-span-|row-span-|col-start-|col-end-|row-start-|row-end-)/,/^(sm:|md:|lg:|xl:|2xl:)?(self-|place-self-|order-)/,/^(sm:|md:|lg:|xl:|2xl:)?(flex-shrink|flex-grow|flex-\d|basis-)/],le=P.split(/\s+/).filter(Boolean),Z=[],be=[];for(const Se of le)ce.some(xe=>xe.test(Se))?Z.push(Se):be.push(Se);return{wrapperClasses:Z.join(" "),innerClasses:be.join(" ")}},[x.blur_until_loaded,ft?.className]),tn=window.__slotContextValue;return ve&&tn?.isEnabled?null:ut.jsx(l_,{componentId:o.id,componentName:o.name,children:x.blur_until_loaded?ut.jsx("div",{className:[Ea.wrapperClasses,er?"opacity-50 blur-sm transition-all duration-300 pointer-events-none":void 0].filter(Boolean).join(" ")||void 0,children:En}):En})});Ia.displayName="DynamicRenderer",typeof window<"u"&&(window.__DynamicRenderer=Ia);function c_(o){const e={};try{const r=new URL(o,typeof window<"u"?window.location.origin:"http://localhost").searchParams,i=new Set;for(const l of r.keys()){if(i.has(l))continue;i.add(l);const u=r.getAll(l);u.length>1||l.endsWith("[]")?e[l]=u:e[l]=u[0]}}catch{}return e}function u_(o){try{return new URL(o,typeof window<"u"?window.location.origin:"http://localhost").pathname}catch{return o.split("?")[0]}}const gi=class gi{constructor(){$(this,"config",{enabled:!1,maxHistorySize:100,logLevel:"info",serverEndpoint:"/_boost/g7-debug/dump-state",autoCapture:!0});$(this,"stateHistory",[]);$(this,"snapshotIdCounter",0);$(this,"stateWatchers",new Map);$(this,"currentLocalState",{});$(this,"currentComputedState",{});$(this,"currentParentContext");$(this,"actionHistory",[]);$(this,"actionWatchers",new Set);$(this,"cacheStats",{hits:0,misses:0,entries:0});$(this,"cacheDecisions",[]);$(this,"cacheDecisionIdCounter",0);$(this,"maxCacheDecisions",200);$(this,"currentRenderCycleId",null);$(this,"isInActionExecution",!1);$(this,"isInIteration",!1);$(this,"mountedComponents",new Map);$(this,"eventListeners",new Map);$(this,"mountWatchers",new Set);$(this,"unmountWatchers",new Set);$(this,"renderCounts",new Map);$(this,"bindingEvalCount",0);$(this,"profilingData",[]);$(this,"isProfiling",!1);$(this,"profilingStartTime",0);$(this,"activeRequests",new Map);$(this,"requestHistory",[]);$(this,"pendingDataSources",new Set);$(this,"requestWatchers",new Set);$(this,"wsConnections",new Map);$(this,"wsMessageHistory",[]);$(this,"wsMessageWatchers",new Set);$(this,"ifConditions",new Map);$(this,"iterations",new Map);$(this,"conditionWatchers",new Set);$(this,"forms",new Map);$(this,"formWatchers",new Set);$(this,"expressionHistory",[]);$(this,"expressionWatchers",new Set);$(this,"expressionIdCounter",0);$(this,"dataSources",new Map);$(this,"dataPathTransforms",[]);$(this,"maxDataPathTransforms",100);$(this,"nestedContexts",[]);$(this,"nestedContextIdCounter",0);$(this,"maxNestedContexts",100);$(this,"formBindingIssues",[]);$(this,"formBindingValidations",[]);$(this,"formBindingIssueIdCounter",0);$(this,"maxFormBindingIssues",100);$(this,"computedProperties",new Map);$(this,"computedRecalcLogs",[]);$(this,"computedRecalcIdCounter",0);$(this,"maxComputedRecalcLogs",100);$(this,"handlers",new Map);$(this,"componentEventSubscriptions",new Map);$(this,"componentEventEmitHistory",[]);$(this,"componentEventIdCounter",0);$(this,"maxComponentEventHistory",100);$(this,"stateRenderingLogs",[]);$(this,"currentStateChangeContext",null);$(this,"stateRenderingIdCounter",0);$(this,"componentRenderCounts",new Map);$(this,"stateToComponentMap",new Map);$(this,"maxStateRenderingLogs",100);$(this,"componentStateSources",new Map);$(this,"contextFlowNodes",new Map);$(this,"dynamicStates",new Map);$(this,"styleIssues",[]);$(this,"componentStyles",new Map);$(this,"authEvents",[]);$(this,"authHeaderHistory",[]);$(this,"authEventIdCounter",0);$(this,"maxAuthEventHistory",50);$(this,"logHistory",[]);$(this,"logIdCounter",0);$(this,"maxLogHistory",500);$(this,"currentLayout",null);$(this,"layoutHistory",[]);$(this,"layoutIdCounter",0);$(this,"layoutStats",{totalLoads:0,cacheHits:0,apiLoads:0});$(this,"maxLayoutHistory",50);$(this,"executionDetails",new Map);$(this,"stateChangeHistory",[]);$(this,"dataSourceChangeHistory",[]);$(this,"changeAlerts",[]);$(this,"changeExpectations",new Map);$(this,"executionIdCounter",0);$(this,"stateChangeIdCounter",0);$(this,"alertIdCounter",0);$(this,"maxExecutionDetails",100);$(this,"maxStateChangeHistory",200);$(this,"maxChangeAlerts",100);$(this,"sequenceExecutions",[]);$(this,"sequenceExecutionStack",[]);$(this,"sequenceIdCounter",0);$(this,"maxSequenceExecutions",50);$(this,"staleClosureWarnings",[]);$(this,"staleClosureIdCounter",0);$(this,"maxStaleClosureWarnings",100);$(this,"stateCaptureRegistry",new Map);$(this,"modalStates",new Map);$(this,"modalStateIssues",[]);$(this,"modalStateRelations",[]);$(this,"modalStateChangeLogs",[]);$(this,"modalStateIssueIdCounter",0);$(this,"modalStateChangeLogIdCounter",0);$(this,"maxModalStateIssues",100);$(this,"maxModalStateChangeLogs",200);$(this,"namedActionDefinitions",{});$(this,"namedActionRefLogs",[]);$(this,"namedActionRefIdCounter",0);$(this,"maxNamedActionRefLogs",200);$(this,"debounceActionHistory",[]);$(this,"dataSourceUpdateHistory",[]);$(this,"debounceActionIdCounter",0);$(this,"dataSourceUpdateIdCounter",0)}static getInstance(){return gi.instance||(gi.instance=new gi),gi.instance}initialize(){if(this.config.enabled=this.checkDebugMode(),!this.config.enabled){console.log("[G7DevTools] 비활성화됨 (환경설정 > 고급 설정 > 디버그 모드를 켜세요)");return}console.log("[G7DevTools] 활성화됨"),this.setupGlobalErrorHandler()}checkDebugMode(){try{if(window.G7Config?.debug===!0)return!0;const r=window.G7Core?.state?.get?.();return r?.settings?.advanced?.debug_mode===!0||r?._global?.settings?.advanced?.debug_mode===!0}catch{return!1}}isEnabled(){return this.config.enabled}setupGlobalErrorHandler(){window.addEventListener("error",e=>{this.config.enabled&&this.logAction({id:this.generateId(),type:"globalError",startTime:Date.now(),status:"error",error:{name:"Error",message:e.message,stack:e.error?.stack}})}),window.addEventListener("unhandledrejection",e=>{this.config.enabled&&this.logAction({id:this.generateId(),type:"unhandledRejection",startTime:Date.now(),status:"error",error:{name:"UnhandledRejection",message:String(e.reason)}})})}captureStateSnapshot(e){if(!this.config.enabled)return;const a={id:++this.snapshotIdCounter,timestamp:Date.now(),source:e.source,prev:this.sanitizeObject(e.prev),next:this.sanitizeObject(e.next),diff:e.diff};this.stateHistory.push(a),this.stateHistory.length>this.config.maxHistorySize&&this.stateHistory.shift(),this.notifyStateWatchers(a)}getState(){try{const e=window.G7Core,a=e?.state?.get?.()||{},r={};if(e?._isolatedStates&&typeof e._isolatedStates=="object")for(const[i,l]of Object.entries(e._isolatedStates))r[i]=this.sanitizeObject(l);return{_global:a._global||a,_local:this.currentLocalState,_computed:this.currentComputedState,_isolated:Object.keys(r).length>0?r:void 0,$parent:this.currentParentContext}}catch{return{_global:{},_local:this.currentLocalState,_computed:this.currentComputedState}}}updateLocalState(e){this.config.enabled&&(this.currentLocalState=this.sanitizeObject(e))}updateComputedState(e){this.config.enabled&&(this.currentComputedState=this.sanitizeObject(e))}updateParentContext(e){this.config.enabled&&(this.currentParentContext=e?this.sanitizeObject(e):void 0)}getStateHistory(){return[...this.stateHistory]}getDualStorageMismatch(){const e=this.currentLocalState||{};let a={};try{a=(window.G7Core?.state?.get?.()||{})._local||{}}catch{a={}}const r=this.findMismatchedLeafPaths(e,a);return{hasMismatch:r.length>0,mismatchedPaths:r,storageA:e,storageB:a}}findMismatchedLeafPaths(e,a,r=""){const i=[],l=new Set([...Object.keys(e||{}),...Object.keys(a||{})]);for(const u of l){const d=r?`${r}.${u}`:u,f=e?.[u],g=a?.[u],m=f&&typeof f=="object"&&!Array.isArray(f),b=g&&typeof g=="object"&&!Array.isArray(g);if(m&&b)i.push(...this.findMismatchedLeafPaths(f,g,d));else{const v=f===void 0?"__undefined__":JSON.stringify(f),S=g===void 0?"__undefined__":JSON.stringify(g);v!==S&&i.push(d)}}return i}watchState(e,a){return this.stateWatchers.has(e)||this.stateWatchers.set(e,new Set),this.stateWatchers.get(e).add(a),()=>{this.stateWatchers.get(e)?.delete(a)}}notifyStateWatchers(e){if(this.stateWatchers.get("*")?.forEach(a=>{try{a(e.next,e.prev,"*")}catch(r){console.error("[G7DevTools] State watcher error:",r)}}),e.diff)for(const a of e.diff.changed)this.stateWatchers.get(a.path)?.forEach(r=>{try{r(a.newValue,a.oldValue,a.path)}catch(i){console.error("[G7DevTools] State watcher error:",i)}})}diffSnapshots(e,a){const r=this.stateHistory.find(l=>l.id===e),i=this.stateHistory.find(l=>l.id===a);return!r||!i?null:this.calculateDiff(r.next,i.next)}calculateDiff(e,a,r=""){const i={added:[],removed:[],changed:[]},l=new Set(Object.keys(e)),u=new Set(Object.keys(a));for(const d of u){const f=r?`${r}.${d}`:d;l.has(d)?JSON.stringify(e[d])!==JSON.stringify(a[d])&&i.changed.push({path:f,oldValue:e[d],newValue:a[d]}):i.added.push(f)}for(const d of l){const f=r?`${r}.${d}`:d;u.has(d)||i.removed.push(f)}return i}logAction(e){if(!this.config.enabled)return;const a=this.actionHistory.findIndex(r=>r.id===e.id);a>=0?this.actionHistory[a]={...this.actionHistory[a],...e}:(this.actionHistory.push(e),this.actionHistory.length>this.config.maxHistorySize&&this.actionHistory.shift()),this.isProfiling&&this.profilingData.push({type:"action",action:e.type,timestamp:performance.now(),duration:e.duration}),this.notifyActionWatchers(e)}getActionHistory(){return[...this.actionHistory]}watchActions(e){return this.actionWatchers.add(e),()=>{this.actionWatchers.delete(e)}}notifyActionWatchers(e){this.actionWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Action watcher error:",r)}})}getActionMetrics(){const e=this.actionHistory.filter(l=>l.status==="success"),a=this.actionHistory.filter(l=>l.status==="error"),r={};for(const l of this.actionHistory)r[l.type]=(r[l.type]||0)+1;const i=e.reduce((l,u)=>l+(u.duration||0),0);return{totalActions:this.actionHistory.length,successCount:e.length,errorCount:a.length,averageDuration:e.length>0?i/e.length:0,actionsByType:r}}recordCacheHit(){this.config.enabled&&this.cacheStats.hits++}recordCacheMiss(){this.config.enabled&&this.cacheStats.misses++}updateCacheEntries(e){this.config.enabled&&(this.cacheStats.entries=e)}getCacheStats(){const e=this.cacheStats.hits+this.cacheStats.misses;return{...this.cacheStats,hitRate:e>0?this.cacheStats.hits/e:0}}resetCacheStats(){this.cacheStats={hits:0,misses:0,entries:0}}trackCacheDecision(e){if(!this.config.enabled)return;const a={id:`cache-${++this.cacheDecisionIdCounter}`,timestamp:Date.now(),expression:e.expression,decision:e.decision,reason:e.reason,context:{isInIteration:this.isInIteration,isInAction:this.isInActionExecution,renderCycleId:this.currentRenderCycleId||void 0,componentId:e.componentId,skipCacheOption:e.skipCacheOption},cachedValue:e.cachedValue!==void 0?this.safeClone(e.cachedValue):void 0,freshValue:e.freshValue!==void 0?this.safeClone(e.freshValue):void 0,valueMatch:e.cachedValue!==void 0&&e.freshValue!==void 0?JSON.stringify(e.cachedValue)===JSON.stringify(e.freshValue):void 0,duration:e.duration};this.cacheDecisions.push(a),this.cacheDecisions.length>this.maxCacheDecisions&&this.cacheDecisions.shift(),e.decision==="cache_hit"?this.cacheStats.hits++:(e.decision==="cache_miss"||e.decision==="skip_cache")&&this.cacheStats.misses++}startRenderCycle(e){return this.currentRenderCycleId=`render-${Date.now()}-${e||"root"}`,this.currentRenderCycleId}endRenderCycle(){this.currentRenderCycleId=null}startActionContext(){this.isInActionExecution=!0}endActionContext(){this.isInActionExecution=!1}startIterationContext(){this.isInIteration=!0}endIterationContext(){this.isInIteration=!1}getCacheDecisionTrackingInfo(){const e=this.getCacheDecisionStats();return{decisions:[...this.cacheDecisions],stats:e,timestamp:Date.now()}}getCacheDecisionStats(){const e=this.cacheDecisions;let a=0,r=0,i=0,l=0;const u={},d={};for(const g of e)g.decision==="cache_hit"?a++:g.decision==="cache_miss"?r++:g.decision==="skip_cache"?i++:g.decision==="invalidate"&&l++,u[g.reason]=(u[g.reason]||0)+1,g.context.componentId&&(d[g.context.componentId]=(d[g.context.componentId]||0)+1);const f=a+r+i;return{totalDecisions:e.length,cacheHits:a,cacheMisses:r,skipCacheCount:i,invalidateCount:l,byReason:u,byComponent:d,avgHitRate:f>0?a/f:0}}getRecentCacheDecisions(e=20,a){let r=[...this.cacheDecisions];return a&&(r=r.filter(i=>i.decision===a)),r.slice(-e)}clearCacheDecisionData(){this.cacheDecisions=[],this.cacheDecisionIdCounter=0}summarizePropsForLifecycle(e){if(!e||typeof e!="object")return e;const a={},r=["children","ref","key"];for(const[i,l]of Object.entries(e))if(!r.includes(i))if(l==null)a[i]=l;else if(Array.isArray(l))a[i]=`[Array(${l.length})]`;else if(typeof l=="object"){const u=Object.keys(l);u.length<=3?a[i]=`{${u.join(", ")}}`:a[i]=`{${u.slice(0,3).join(", ")}, ... +${u.length-3}}`}else typeof l=="string"&&l.length>50?a[i]=l.substring(0,50)+"...":typeof l=="function"?a[i]="[Function]":a[i]=l;return a}trackMount(e,a){if(!this.config.enabled)return;const r=this.summarizePropsForLifecycle(a.props),i={...a,props:r,id:e,mountTime:Date.now()};this.mountedComponents.set(e,i),this.mountWatchers.forEach(l=>{try{l({componentId:e,componentName:a.name,timestamp:i.mountTime})}catch(u){console.error("[G7DevTools] Mount watcher error:",u)}})}trackUnmount(e){if(!this.config.enabled)return;const a=this.mountedComponents.get(e),r=this.eventListeners.get(e)||[];r.length>0&&console.warn(`[G7DevTools] 컴포넌트 ${e} 언마운트 시 ${r.length}개 리스너 미정리`),a&&this.unmountWatchers.forEach(i=>{try{i({componentId:e,componentName:a.name,timestamp:Date.now(),orphanedListeners:r.length})}catch(l){console.error("[G7DevTools] Unmount watcher error:",l)}}),this.mountedComponents.delete(e)}trackListener(e,a,r){if(!this.config.enabled)return;const i=this.eventListeners.get(e)||[];i.push({type:a,target:r,addedAt:Date.now()}),this.eventListeners.set(e,i)}removeListener(e,a){if(!this.config.enabled)return;const r=this.eventListeners.get(e)||[],i=r.findIndex(l=>l.type===a);i>=0&&r.splice(i,1)}getMountedComponents(){return Array.from(this.mountedComponents.values())}getOrphanedListeners(){const e=[];for(const[a,r]of this.eventListeners)this.mountedComponents.has(a)||e.push(...r.map(i=>({...i,componentId:a})));return e}watchMount(e){return this.mountWatchers.add(e),()=>{this.mountWatchers.delete(e)}}watchUnmount(e){return this.unmountWatchers.add(e),()=>{this.unmountWatchers.delete(e)}}trackRender(e){if(!this.config.enabled)return;const a=this.renderCounts.get(e)||0;this.renderCounts.set(e,a+1),this.isProfiling&&this.profilingData.push({type:"render",component:e,timestamp:performance.now()})}trackBindingEval(e){this.config.enabled&&(this.bindingEvalCount++,this.isProfiling&&e&&this.profilingData.push({type:"binding",expression:e,timestamp:performance.now()}))}getRenderCount(){return new Map(this.renderCounts)}getBindingEvalCount(){return this.bindingEvalCount}getMemoryWarnings(){const e=[];try{const i=this.getState(),l=JSON.stringify(i).length;l>1e6&&e.push({type:"large-state",message:`상태 크기가 ${(l/1024/1024).toFixed(2)}MB입니다`,suggestion:"불필요한 데이터 정리 필요",severity:l>5e6?"error":"warning"})}catch{}this.stateHistory.length>this.config.maxHistorySize*.8&&e.push({type:"large-history",message:`상태 이력이 ${this.stateHistory.length}개입니다`,suggestion:"maxHistory 설정 조정 필요",severity:"warning"});const a=this.getOrphanedListeners().length;a>0&&e.push({type:"orphaned-listeners",message:`${a}개의 정리되지 않은 이벤트 리스너`,suggestion:"useEffect cleanup 또는 removeEventListener 확인",severity:a>10?"error":"warning"});const r=Array.from(this.renderCounts.entries()).filter(([,i])=>i>50);return r.length>0&&e.push({type:"excessive-renders",message:`${r.length}개 컴포넌트가 50회 이상 렌더링`,suggestion:"React.memo, useMemo, useCallback 사용 고려",severity:"warning"}),e}startProfiling(){this.config.enabled&&(this.isProfiling=!0,this.profilingData=[],this.profilingStartTime=performance.now(),console.log("[G7DevTools] 프로파일링 시작"))}stopProfiling(){this.isProfiling=!1;const e=performance.now()-this.profilingStartTime,a=this.analyzeProfile(e);return console.log("[G7DevTools] 프로파일링 완료",a),a}analyzeProfile(e){const a=this.profilingData.filter(g=>g.type==="render"),r=this.profilingData.filter(g=>g.type==="binding"),i=this.profilingData.filter(g=>g.type==="action"),l={};for(const g of a)g.component&&(l[g.component]||(l[g.component]={count:0,durations:[]}),l[g.component].count++,g.duration&&l[g.component].durations.push(g.duration));const u=Object.entries(l).map(([g,m])=>({name:g,renderCount:m.count,avgDuration:m.durations.length>0?m.durations.reduce((b,v)=>b+v,0)/m.durations.length:0})).sort((g,m)=>m.renderCount-g.renderCount).slice(0,10),d={};for(const g of r)g.expression&&(d[g.expression]=(d[g.expression]||0)+1);const f=Object.entries(d).sort(([,g],[,m])=>m-g).slice(0,10).map(([g])=>g);return{duration:e,entries:this.profilingData,summary:{totalRenders:a.length,totalBindings:r.length,totalActions:i.length,slowestComponents:u,hotPaths:f}}}resetPerformanceStats(){this.renderCounts.clear(),this.bindingEvalCount=0,this.profilingData=[]}trackRequest(e,a,r){if(!this.config.enabled)return"";const i=this.generateId(),l=u_(e),u=c_(e);return this.activeRequests.set(i,{id:i,url:l,fullUrl:e,queryParams:u,method:a,startTime:Date.now(),status:"pending",requestBody:r?.requestBody?this.sanitizeObject(r.requestBody):void 0,dataSourceId:r?.dataSourceId}),this.isProfiling&&this.profilingData.push({type:"network",timestamp:performance.now()}),i}completeRequest(e,a,r){if(!this.config.enabled)return;const i=this.activeRequests.get(e);if(!i)return;const l={...i,status:a>=200&&a<300?"success":"error",statusCode:a,duration:Date.now()-i.startTime,endTime:Date.now(),response:this.sanitizeObject(r)};this.requestHistory.push(l),this.activeRequests.delete(e),this.requestHistory.length>this.config.maxHistorySize&&this.requestHistory.shift(),this.notifyRequestWatchers(l)}failRequest(e,a){if(!this.config.enabled)return;const r=this.activeRequests.get(e);if(!r)return;const i={...r,status:"error",error:a,duration:Date.now()-r.startTime,endTime:Date.now()};this.requestHistory.push(i),this.activeRequests.delete(e),this.notifyRequestWatchers(i)}trackDataSource(e){this.config.enabled&&this.pendingDataSources.add(e)}completeDataSource(e){this.config.enabled&&this.pendingDataSources.delete(e)}getActiveRequests(){return Array.from(this.activeRequests.values())}getRequestHistory(){return[...this.requestHistory]}getPendingDataSources(){return Array.from(this.pendingDataSources)}watchRequest(e){return this.requestWatchers.add(e),()=>{this.requestWatchers.delete(e)}}notifyRequestWatchers(e){this.requestWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Request watcher error:",r)}})}trackWebSocketConnection(e,a,r){this.config.enabled&&this.wsConnections.set(e,{id:e,url:a,state:r,connectedAt:r==="open"?Date.now():void 0})}trackWebSocketMessage(e,a,r,i){if(!this.config.enabled)return;const l={id:this.generateId(),connectionId:e,direction:a,type:r,payload:this.sanitizeObject(i),timestamp:Date.now(),sequence:this.wsMessageHistory.length};this.wsMessageHistory.push(l),this.wsMessageHistory.length>this.config.maxHistorySize&&this.wsMessageHistory.shift(),this.notifyWebSocketWatchers(l)}getWebSocketConnections(){return Array.from(this.wsConnections.values())}getWebSocketMessageHistory(){return[...this.wsMessageHistory]}getWebSocketConnectionState(){const e=Array.from(this.wsConnections.values());return e.some(a=>a.state==="open")?"connected":e.some(a=>a.state==="connecting")?"reconnecting":"disconnected"}watchWebSocketMessage(e){return this.wsMessageWatchers.add(e),()=>{this.wsMessageWatchers.delete(e)}}notifyWebSocketWatchers(e){this.wsMessageWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] WebSocket watcher error:",r)}})}trackIfCondition(e,a,r){if(!this.config.enabled)return;const i=this.ifConditions.get(e),l=i?.evaluatedValue;this.ifConditions.set(e,{id:e,expression:a,evaluatedValue:r,evaluationCount:(i?.evaluationCount||0)+1,lastEvaluated:Date.now()}),i&&l!==r&&this.notifyConditionWatchers({id:e,expression:a,oldValue:l,newValue:r,timestamp:Date.now()})}trackIteration(e,a){this.config.enabled&&this.iterations.set(e,{id:e,...a,lastRendered:Date.now()})}getIfConditions(){return Array.from(this.ifConditions.values())}getIterations(){return Array.from(this.iterations.values())}getScopeChain(e){const a=[],r=this.getState();return a.push({name:"_global",value:r._global,source:"global"}),a.push({name:"_local",value:r._local,source:"local"}),a.push({name:"_computed",value:r._computed,source:"computed"}),a}watchConditionChange(e){return this.conditionWatchers.add(e),()=>{this.conditionWatchers.delete(e)}}notifyConditionWatchers(e){this.conditionWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Condition watcher error:",r)}})}trackForm(e,a,r){this.config.enabled&&this.forms.set(e,{id:e,dataKey:a,inputs:r,trackedAt:Date.now()})}trackFormChange(e,a,r){if(!this.config.enabled)return;const i={formId:e,inputName:a,value:r,timestamp:Date.now()};this.notifyFormWatchers(i)}untrackForm(e){this.forms.delete(e)}getForms(){return Array.from(this.forms.values())}getFormState(e){const a=this.getState();return this.getNestedValue(a,e)||{}}getBindingPath(e,a){return`${e}.${a}`}watchFormChange(e){return this.formWatchers.add(e),()=>{this.formWatchers.delete(e)}}notifyFormWatchers(e){this.formWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Form watcher error:",r)}})}trackFormBindingIssue(e,a,r){if(!this.config.enabled)return;const i={id:`form-issue-${++this.formBindingIssueIdCounter}`,timestamp:Date.now(),type:e,severity:a,formId:r.formId,formDataKey:r.formDataKey,inputInfo:r.inputInfo,contextInfo:r.contextInfo,description:r.description,suggestion:r.suggestion,docLink:r.docLink};this.formBindingIssues.push(i),this.formBindingIssues.length>this.maxFormBindingIssues&&this.formBindingIssues.shift()}validateFormBinding(e,a,r,i){const l=r.map(f=>{const g=[];let m=!0;return f.name||(g.push("Input에 name 속성이 없습니다"),m=!1,this.trackFormBindingIssue("missing-input-name","error",{formId:e,formDataKey:a,inputInfo:{name:f.name,type:f.type},description:"Input에 name 속성이 없어 자동 바인딩이 동작하지 않습니다",suggestion:"Input에 name 속성을 추가하세요",docLink:"troubleshooting-components-form.md"})),a||(g.push("Form에 dataKey가 없습니다"),m=!1),{inputName:f.name||"(unnamed)",inputType:f.type,bindingPath:a&&f.name?`${a}.${f.name}`:"-",isValid:m,currentValue:f.value,issues:g}});if(a||this.trackFormBindingIssue("missing-datakey","error",{formId:e,description:"Form에 dataKey가 설정되지 않아 자동 바인딩이 동작하지 않습니다",suggestion:"Form 컴포넌트에 dataKey props를 설정하세요",docLink:"troubleshooting-components-form.md"}),i.isContextBroken){const f=i.breakReason?.includes("sortable")?"sortable-context-break":i.breakReason?.includes("modal")?"modal-context-isolation":"context-not-propagated";this.trackFormBindingIssue(f,"warning",{formId:e,formDataKey:a,contextInfo:{hasParentFormContext:i.hasParentContext,parentFormContextProp:i.parentContextProp,isInsideSortable:i.breakReason?.includes("sortable")||!1,isInsideModal:i.breakReason?.includes("modal")||!1,depth:0},description:i.breakReason||"Form 컨텍스트가 제대로 전파되지 않았습니다",suggestion:"parentFormContextProp={undefined}를 확인하거나 중첩 구조를 검토하세요",docLink:"troubleshooting-components-form.md"})}const u={formId:e,dataKey:a,timestamp:Date.now(),contextPropagation:i,inputBindings:l,isValid:l.every(f=>f.isValid)&&!!a&&!i.isContextBroken,issueCount:l.filter(f=>!f.isValid).length+(a?0:1)+(i.isContextBroken?1:0)},d=this.formBindingValidations.findIndex(f=>f.formId===e);return d>=0?this.formBindingValidations[d]=u:this.formBindingValidations.push(u),u}getFormBindingValidationTrackingInfo(){const e=this.getFormBindingValidationStats();return{issues:[...this.formBindingIssues],validations:[...this.formBindingValidations],stats:e,timestamp:Date.now()}}getFormBindingValidationStats(){const e={"missing-datakey":0,"missing-input-name":0,"context-not-propagated":0,"sortable-context-break":0,"modal-context-isolation":0,"duplicate-input-name":0,"value-type-mismatch":0,"binding-path-invalid":0},a={info:0,warning:0,error:0};for(const i of this.formBindingIssues)e[i.type]++,a[i.severity]++;const r=Object.entries(e).filter(([,i])=>i>0).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i,l])=>({type:i,count:l,description:this.getIssueTypeDescription(i)}));return{totalFormsValidated:this.formBindingValidations.length,validForms:this.formBindingValidations.filter(i=>i.isValid).length,formsWithIssues:this.formBindingValidations.filter(i=>!i.isValid).length,totalIssues:this.formBindingIssues.length,byIssueType:e,bySeverity:a,topIssues:r}}getIssueTypeDescription(e){return{"missing-datakey":"Form에 dataKey 누락","missing-input-name":"Input에 name 속성 누락","context-not-propagated":"Form 컨텍스트 전파 실패","sortable-context-break":"Sortable 컨테이너에서 컨텍스트 단절","modal-context-isolation":"모달에서 부모 Form 컨텍스트 격리","duplicate-input-name":"동일 Form 내 중복 Input name","value-type-mismatch":"값 타입과 Input 타입 불일치","binding-path-invalid":"바인딩 경로 유효하지 않음"}[e]||e}clearFormBindingIssues(){this.formBindingIssues=[],this.formBindingValidations=[],this.formBindingIssueIdCounter=0}trackComputedProperty(e,a,r,i,l,u,d){if(!this.config.enabled)return;const f=`computed-${e}-${u||"global"}`,g={id:f,name:e,expression:a,componentId:u,dependencies:r,currentValue:this.safeClone(i),lastComputedAt:Date.now(),computationTime:l,error:d};this.computedProperties.set(f,g)}trackComputedRecalc(e,a,r,i,l,u,d){if(!this.config.enabled)return;const f=`computed-${e}-${d||"global"}`,g=JSON.stringify(r)!==JSON.stringify(i),m={id:`recalc-${++this.computedRecalcIdCounter}`,computedId:f,computedName:e,timestamp:Date.now(),trigger:a,triggeredBy:u,previousValue:this.safeClone(r),newValue:this.safeClone(i),valueChanged:g,computationTime:l,cascadeCount:0};this.computedRecalcLogs.push(m),this.computedRecalcLogs.length>this.maxComputedRecalcLogs&&this.computedRecalcLogs.shift();const b=this.computedProperties.get(f);b&&(b.currentValue=this.safeClone(i),b.lastComputedAt=Date.now(),b.computationTime=l)}analyzeComputedDependencyChain(e,a){const r=new Set,i=[];let l=!1,u,d=0;const f=(m,b)=>{if(d=Math.max(d,b),r.has(m))return l=!0,u=[...i,m],{name:m,type:"computed",children:[],depth:b};r.add(m),i.push(m);const v=this.computedProperties.get(`computed-${m}-${a||"global"}`),S=[];if(v)for(const E of v.dependencies)E.type==="computed"?S.push(f(E.path,b+1)):S.push({name:E.path,type:E.type,children:[],depth:b+1});return i.pop(),r.delete(m),{name:m,type:"computed",children:S,depth:b}},g=f(e,0);return{root:e,tree:g,hasCycle:l,cyclePath:u,maxDepth:d}}getComputedDependencyTrackingInfo(){const e=Array.from(this.computedProperties.values()),a=this.getComputedDependencyStats(),r=[];for(const i of e){const l=this.analyzeComputedDependencyChain(i.name,i.componentId);r.push(l)}return{properties:e,recalcLogs:[...this.computedRecalcLogs],dependencyChains:r,stats:a,timestamp:Date.now()}}getComputedDependencyStats(){const e={"state-change":0,"datasource-update":0,"dependency-change":0,manual:0,initial:0},a={},r={};let i=0,l=0;for(const g of this.computedRecalcLogs)e[g.trigger]++,g.valueChanged||l++,a[g.computedName]=(a[g.computedName]||0)+1,r[g.computedName]||(r[g.computedName]=[]),r[g.computedName].push(g.computationTime),i+=g.computationTime;const u=Object.entries(a).sort((g,m)=>m[1]-g[1]).slice(0,5).map(([g,m])=>({name:g,count:m})),d=Object.entries(r).map(([g,m])=>({name:g,avgTime:m.reduce((b,v)=>b+v,0)/m.length})).sort((g,m)=>m.avgTime-g.avgTime).slice(0,5);let f=0;for(const g of this.computedProperties.values())this.analyzeComputedDependencyChain(g.name,g.componentId).hasCycle&&f++;return{totalComputed:this.computedProperties.size,totalRecalculations:this.computedRecalcLogs.length,unnecessaryRecalculations:l,avgComputationTime:this.computedRecalcLogs.length>0?i/this.computedRecalcLogs.length:0,topRecalculated:u,slowestComputed:d,cycleDetectionCount:f,byTrigger:e}}clearComputedTracking(){this.computedProperties.clear(),this.computedRecalcLogs=[],this.computedRecalcIdCounter=0}trackModalOpen(e){if(!this.config.enabled)return;const a={modalId:e.modalId,modalName:e.modalName,openedAt:Date.now(),closedAt:null,scopeType:e.scopeType||"isolated",parentModalId:e.parentModalId,componentId:e.componentId,initialState:e.initialState?{...e.initialState}:{},currentState:e.initialState?{...e.initialState}:{},stateChangeCount:0,isolatedStateKeys:e.isolatedStateKeys||[],sharedStateKeys:e.sharedStateKeys||[]};this.modalStates.set(e.modalId,a),this.validateModalDefinitionExists(e.modalId,e.modalName),e.parentModalId&&(this.modalStateRelations.find(i=>i.parentModalId===e.parentModalId&&i.childModalId===e.modalId)||this.modalStateRelations.push({parentModalId:e.parentModalId,childModalId:e.modalId,sharedKeys:e.sharedStateKeys||[],isolatedKeys:e.isolatedStateKeys||[],relationType:"parent-child"}))}trackModalClose(e,a){if(!this.config.enabled)return;const r=this.modalStates.get(e);r&&(r.closedAt=Date.now(),a&&(r.currentState={...a}),this.detectStateLeakage(r))}validateModalDefinitionExists(e,a){const r=this.currentLayout;if(!r?.layoutJson)return;const i=r.layoutJson.modals;if(!i){this.recordModalStateIssue({type:"missing-definition",modalId:e,modalName:a,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 현재 레이아웃에 modals 섹션이 없습니다. 레이아웃 경로: ${r.layoutPath}`,affectedStateKeys:[],expectedValue:`modals 섹션에 id="${e}" 정의 존재`,actualValue:"modals 섹션 없음"});return}const l=Array.isArray(i)?i:Object.values(i);l.some(d=>d?.id===e||d?.props?.id===e)||this.recordModalStateIssue({type:"missing-definition",modalId:e,modalName:a,severity:"error",description:`모달 "${e}"이(가) modalStack에 추가되었으나, 렌더링된 레이아웃의 modals 섹션에 해당 ID의 정의가 없습니다. partial 로딩 실패, 레이아웃 병합 문제, extends 상속 누락 등을 확인하세요. 레이아웃 경로: ${r.layoutPath}`,affectedStateKeys:[],expectedValue:`modals 배열에 id="${e}" 항목 존재`,actualValue:`modals 배열에 ${l.length}개 모달 정의 (${l.map(d=>d?.id||"unknown").join(", ")})`})}trackModalStateChange(e){if(!this.config.enabled)return;const a=this.modalStates.get(e.modalId);if(!a)return;a.stateChangeCount++,a.currentState[e.stateKey]=e.newValue;const r=this.checkIsolationViolation(a,e.stateKey),i={id:`modal-change-${++this.modalStateChangeLogIdCounter}`,modalId:e.modalId,modalName:a.modalName,timestamp:Date.now(),stateKey:e.stateKey,previousValue:e.previousValue,newValue:e.newValue,changeSource:e.changeSource||"user-action",violatesIsolation:r};this.modalStateChangeLogs.push(i),this.modalStateChangeLogs.length>this.maxModalStateChangeLogs&&this.modalStateChangeLogs.shift(),r&&this.recordModalStateIssue({type:"isolation-violation",modalId:e.modalId,modalName:a.modalName,severity:"warning",description:`모달 '${a.modalName}'에서 격리된 상태 키 '${e.stateKey}'가 변경됨`,affectedStateKeys:[e.stateKey]})}detectStateLeakage(e){if(e.scopeType==="isolated")for(const a of e.isolatedStateKeys){const r=e.initialState[a],i=e.currentState[a];if(r!==i&&e.parentModalId){const l=this.modalStates.get(e.parentModalId);l&&l.currentState.hasOwnProperty(a)&&this.recordModalStateIssue({type:"state-leakage",modalId:e.modalId,modalName:e.modalName,severity:"error",description:`모달 닫힘 후 상태 '${a}'가 부모 모달로 유출될 수 있음`,affectedStateKeys:[a],leakedValue:i,expectedValue:r})}}}checkIsolationViolation(e,a){return e.scopeType==="isolated",!1}recordModalStateIssue(e){const a={id:`modal-issue-${++this.modalStateIssueIdCounter}`,type:e.type,modalId:e.modalId,modalName:e.modalName,timestamp:Date.now(),severity:e.severity,description:e.description,affectedStateKeys:e.affectedStateKeys,leakedValue:e.leakedValue,expectedValue:e.expectedValue,actualValue:e.actualValue,stackInfo:e.stackInfo};this.modalStateIssues.push(a),this.modalStateIssues.length>this.maxModalStateIssues&&this.modalStateIssues.shift()}getModalStateScopeTrackingInfo(){const e=Array.from(this.modalStates.values()),a=this.getModalStateScopeStats();return{modals:e,issues:[...this.modalStateIssues],relations:[...this.modalStateRelations],changeLogs:[...this.modalStateChangeLogs],stats:a,timestamp:Date.now()}}getModalStateScopeStats(){const e=Array.from(this.modalStates.values()),a={warning:0,error:0},r={"state-leakage":0,"isolation-violation":0,"parent-mutation":0,"orphaned-state":0,"scope-mismatch":0,"cleanup-failure":0,"missing-definition":0};for(const l of this.modalStateIssues)a[l.severity]++,r[l.type]++;const i={isolated:0,shared:0,inherited:0};for(const l of e)i[l.scopeType]++;return{totalModals:e.length,openModals:e.filter(l=>l.closedAt===null).length,nestedModals:e.filter(l=>l.parentModalId!==void 0).length,totalIssues:this.modalStateIssues.length,issuesBySeverity:a,issuesByType:r,byScope:i,leakageDetectionCount:r["state-leakage"],cleanupFailureCount:r["cleanup-failure"]}}clearModalStateScopeTracking(){this.modalStates.clear(),this.modalStateIssues=[],this.modalStateRelations=[],this.modalStateChangeLogs=[],this.modalStateIssueIdCounter=0,this.modalStateChangeLogIdCounter=0}setNamedActionDefinitions(e){this.config.enabled&&(this.namedActionDefinitions=e||{})}trackNamedActionRef(e){if(!this.config.enabled)return;const a={...e,id:`named_action_ref_${++this.namedActionRefIdCounter}`};this.namedActionRefLogs.push(a),this.namedActionRefLogs.length>this.maxNamedActionRefLogs&&(this.namedActionRefLogs=this.namedActionRefLogs.slice(-this.maxNamedActionRefLogs))}getNamedActionTrackingInfo(){const e={};for(const r of this.namedActionRefLogs)e[r.actionRefName]=(e[r.actionRefName]||0)+1;const a=Object.keys(this.namedActionDefinitions).filter(r=>!e[r]);return{definitions:this.namedActionDefinitions,refLogs:[...this.namedActionRefLogs],stats:{totalDefinitions:Object.keys(this.namedActionDefinitions).length,totalRefs:this.namedActionRefLogs.length,refCountByName:e,unusedDefinitions:a},timestamp:Date.now()}}clearNamedActionTracking(){this.namedActionDefinitions={},this.namedActionRefLogs=[],this.namedActionRefIdCounter=0}trackExpressionEval(e){if(!this.config.enabled)return;const a={...e,id:`expr-${++this.expressionIdCounter}`,timestamp:Date.now(),warning:this.detectExpressionWarning(e)};this.expressionHistory.push(a),this.expressionHistory.length>500&&this.expressionHistory.shift(),this.isProfiling&&this.profilingData.push({type:"binding",expression:e.expression,timestamp:performance.now(),duration:e.duration}),this.notifyExpressionWatchers(a)}detectExpressionWarning(e){const{expression:a,result:r,resultType:i,method:l,duration:u}=e;if(i==="undefined"&&!a.includes("??")&&!a.includes("||")&&/^[a-zA-Z_$][a-zA-Z0-9_$.]*$/.test(a.replace(/{{|}}/g,"").trim()))return{type:"undefined-result",message:"표현식 결과가 undefined입니다",suggestion:`데이터가 로드되었는지 확인하거나 fallback 값을 추가하세요: ${a} ?? ''`};if(i==="null")return{type:"null-result",message:"표현식 결과가 null입니다",suggestion:`nullish coalescing 연산자를 사용하세요: ${a} ?? ''`};if(l==="resolveBindings"&&i==="string"){const d=String(r);if(d.includes("[object Object]")||/^\[.*\]$/.test(d))return{type:"array-to-string",message:"배열/객체가 문자열로 변환되었습니다",suggestion:"evaluateExpression()을 사용하여 원본 타입을 유지하세요"}}if(l==="resolveBindings"&&i==="string"&&String(r).includes("[object Object]"))return{type:"object-to-string",message:"객체가 [object Object]로 변환되었습니다",suggestion:"evaluateExpression()을 사용하거나 특정 속성에 접근하세요"};if(i==="undefined"&&a.includes(".")&&!a.includes("?.")){const d=a.replace(/{{|}}/g,"").trim().split(".");if(d.length>=2)return{type:"missing-optional-chain",message:"Optional chaining(?.) 누락 가능성",suggestion:`안전한 접근을 위해 ?. 사용을 고려하세요: ${d.join("?.")}`}}if((a.includes("{{item.")||a.includes("{{index}}"))&&Array.from(this.iterations.values()).some(g=>g.itemVar!=="item"))return{type:"wrong-iteration-var",message:"'item'/'index' 대신 iteration에서 정의한 변수명을 사용해야 합니다",suggestion:"iteration의 item_var/index_var에 정의된 변수명을 확인하세요"};if(u&&u>10)return{type:"slow-evaluation",message:`표현식 평가에 ${u.toFixed(2)}ms 소요됨`,suggestion:"복잡한 표현식을 단순화하거나 computed 값으로 분리하세요"}}getExpressions(){return[...this.expressionHistory]}getExpressionWarnings(){return this.expressionHistory.filter(e=>e.warning!=null)}searchExpressions(e){const a=e.toLowerCase();return this.expressionHistory.filter(r=>r.expression.toLowerCase().includes(a)||r.componentName?.toLowerCase().includes(a)||r.propName?.toLowerCase().includes(a))}getExpressionStats(){const e=this.expressionHistory,a=new Set(e.map(f=>f.expression)),r=e.filter(f=>f.warning!=null),i=e.filter(f=>f.fromCache),l=e.filter(f=>f.duration!=null).map(f=>f.duration),u={};for(const f of e)u[f.resultType]=(u[f.resultType]||0)+1;const d={};for(const f of r)f.warning&&(d[f.warning.type]=(d[f.warning.type]||0)+1);return{totalEvaluations:e.length,uniqueExpressions:a.size,warningCount:r.length,cacheHitRate:e.length>0?i.length/e.length:0,averageDuration:l.length>0?l.reduce((f,g)=>f+g,0)/l.length:0,byType:u,byWarning:d}}clearExpressions(){this.expressionHistory=[],this.expressionIdCounter=0}watchExpressions(e){return this.expressionWatchers.add(e),()=>{this.expressionWatchers.delete(e)}}notifyExpressionWatchers(e){this.expressionWatchers.forEach(a=>{try{a(e)}catch(r){console.error("[G7DevTools] Expression watcher error:",r)}})}setLogLevel(e){this.config.logLevel=e}setMaxHistory(e){this.config.maxHistorySize=Math.max(10,Math.min(1e3,e))}setServerEndpoint(e){this.config.serverEndpoint=e}getConfig(){return{...this.config}}generateId(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}sanitizeObject(e,a=new WeakSet){if(e===null||typeof e!="object")return e;if(a.has(e))return"[Circular]";if(a.add(e),Array.isArray(e))return e.map(i=>this.sanitizeObject(i,a));const r={};for(const i of Object.keys(e))try{r[i]=this.sanitizeObject(e[i],a)}catch{r[i]="[Unable to serialize]"}return r}getNestedValue(e,a){if(!a)return e;const r=a.split(".");let i=e;for(const l of r){if(i==null)return;i=i[l]}return i}getLifecycleInfo(){return{mountedComponents:Array.from(this.mountedComponents.values()),orphanedListeners:this.getOrphanedListeners()}}getPerformanceInfo(){return{renderCounts:this.renderCounts,bindingEvalCount:this.bindingEvalCount,memoryWarnings:this.getMemoryWarnings()}}getNetworkInfo(){return{activeRequests:Array.from(this.activeRequests.values()),requestHistory:[...this.requestHistory],pendingDataSources:Array.from(this.pendingDataSources)}}getConditionalInfo(){return{ifConditions:Array.from(this.ifConditions.values()),iterations:Array.from(this.iterations.values())}}getFormInfo(){return Array.from(this.forms.values())}getWebSocketInfo(){return{connections:Array.from(this.wsConnections.values()),messageHistory:[...this.wsMessageHistory],connectionState:this.getWebSocketConnectionState()}}getStateAtTime(e){const a=[...this.stateHistory].reverse().find(r=>r.timestamp<=e);if(a)return{_global:a.next,_local:{}}}reset(){this.stateHistory=[],this.actionHistory=[],this.cacheStats={hits:0,misses:0,entries:0},this.cacheDecisions=[],this.cacheDecisionIdCounter=0,this.currentRenderCycleId=null,this.isInActionExecution=!1,this.isInIteration=!1,this.mountedComponents.clear(),this.eventListeners.clear(),this.renderCounts.clear(),this.bindingEvalCount=0,this.profilingData=[],this.activeRequests.clear(),this.requestHistory=[],this.pendingDataSources.clear(),this.wsConnections.clear(),this.wsMessageHistory=[],this.ifConditions.clear(),this.iterations.clear(),this.forms.clear(),this.expressionHistory=[],this.expressionIdCounter=0,this.dataSources.clear(),this.dataPathTransforms=[],this.nestedContexts=[],this.nestedContextIdCounter=0,this.formBindingIssues=[],this.formBindingValidations=[],this.formBindingIssueIdCounter=0,this.computedProperties.clear(),this.computedRecalcLogs=[],this.computedRecalcIdCounter=0,this.modalStates.clear(),this.modalStateIssues=[],this.modalStateRelations=[],this.modalStateChangeLogs=[],this.modalStateIssueIdCounter=0,this.modalStateChangeLogIdCounter=0,this.logHistory=[],this.logIdCounter=0}getExpressionInfo(){return{expressions:this.getExpressions(),stats:this.getExpressionStats()}}trackLog(e,a,r){if(!this.config.enabled)return;const i=r.map(u=>{if(typeof u=="string")return u;try{return JSON.stringify(u)}catch{return String(u)}}).join(" "),l={id:`log-${++this.logIdCounter}`,level:e,prefix:a,message:i,args:this.sanitizeObject(r),timestamp:Date.now(),stack:e==="error"?new Error().stack:void 0};this.logHistory.push(l),this.logHistory.length>this.maxLogHistory&&this.logHistory.shift()}trackAction(e){if(!this.config.enabled)return;const a={id:`debounce-action-${++this.debounceActionIdCounter}`,...e,timestamp:Date.now()};this.debounceActionHistory.push(a),this.debounceActionHistory.length>100&&this.debounceActionHistory.shift()}trackDataSourceUpdate(e){if(!this.config.enabled)return;const a={id:`ds-update-${++this.dataSourceUpdateIdCounter}`,...e};this.dataSourceUpdateHistory.push(a),this.dataSourceUpdateHistory.length>100&&this.dataSourceUpdateHistory.shift()}getDebounceActionHistory(e){let a=[...this.debounceActionHistory];return e?.handler&&(a=a.filter(r=>r.handler.includes(e.handler))),e?.status&&(a=a.filter(r=>r.status===e.status)),e?.limit&&(a=a.slice(-e.limit)),a}getDataSourceUpdateHistory(e){let a=[...this.dataSourceUpdateHistory];return e?.dataSourceId&&(a=a.filter(r=>r.dataSourceId===e.dataSourceId)),e?.updateType&&(a=a.filter(r=>r.updateType===e.updateType)),e?.limit&&(a=a.slice(-e.limit)),a}getLogs(e){let a=[...this.logHistory];if(e?.level){const r=Array.isArray(e.level)?e.level:[e.level];a=a.filter(i=>r.includes(i.level))}if(e?.prefix){const r=e.prefix.toLowerCase();a=a.filter(i=>i.prefix.toLowerCase().includes(r))}if(e?.search){const r=e.search.toLowerCase();a=a.filter(i=>i.message.toLowerCase().includes(r))}return e?.since&&(a=a.filter(r=>r.timestamp>=e.since)),e?.limit&&(a=a.slice(-e.limit)),a}getLogStats(){const a=Date.now()-6e4,r={log:0,warn:0,error:0,debug:0,info:0},i={};let l=0,u=0;for(const d of this.logHistory)r[d.level]++,i[d.prefix]=(i[d.prefix]||0)+1,d.timestamp>=a&&(d.level==="error"&&l++,d.level==="warn"&&u++);return{totalLogs:this.logHistory.length,byLevel:r,byPrefix:i,recentErrors:l,recentWarnings:u}}clearLogs(){this.logHistory=[],this.logIdCounter=0}getLogInfo(){return{entries:this.getLogs(),stats:this.getLogStats()}}trackDataSourceDefinition(e){this.config.enabled&&this.dataSources.set(e.id,{...e,status:"idle"})}trackDataSourceLoading(e){if(!this.config.enabled)return;const a=this.dataSources.get(e);a&&this.dataSources.set(e,{...a,status:"loading"})}trackDataSourceLoaded(e,a,r){if(!this.config.enabled)return;const i=this.dataSources.get(e);if(!i)return;let l,u,d=r;a&&(Array.isArray(a)?(l=a.length,u=a.length>0&&typeof a[0]=="object"?Object.keys(a[0]):void 0):typeof a=="object"&&(Array.isArray(a.data)?(d=d||"data",l=a.data.length,u=a.data.length>0&&typeof a.data[0]=="object"?Object.keys(a.data[0]):void 0):Array.isArray(a.items)?(d=d||"items",l=a.items.length,u=a.items.length>0&&typeof a.items[0]=="object"?Object.keys(a.items[0]):void 0):u=Object.keys(a))),this.dataSources.set(e,{...i,status:"loaded",dataPath:d,itemCount:l,keys:u,lastLoadedAt:Date.now(),error:void 0})}trackDataSourceError(e,a){if(!this.config.enabled)return;const r=this.dataSources.get(e);r&&this.dataSources.set(e,{...r,status:"error",error:a,lastLoadedAt:Date.now()})}untrackDataSource(e){this.dataSources.delete(e)}getDataSources(){return Array.from(this.dataSources.values())}getDataSource(e){return this.dataSources.get(e)}clearDataSources(){this.dataSources.clear()}trackDataPathTransform(e){if(!this.config.enabled)return;let a=this.dataPathTransforms.find(r=>r.dataSourceId===e.dataSourceId);a||(a={dataSourceId:e.dataSourceId,timestamp:Date.now(),transformSteps:[],warnings:[]},this.dataPathTransforms.push(a),this.dataPathTransforms.length>this.maxDataPathTransforms&&this.dataPathTransforms.shift()),a.transformSteps.push({step:e.step,inputPath:e.inputPath,inputValue:this.safeClone(e.inputValue),outputPath:e.outputPath,outputValue:this.safeClone(e.outputValue),config:e.config}),e.warning&&a.warnings.push(e.warning)}setDataPathFinalBinding(e,a){if(!this.config.enabled)return;const r=this.dataPathTransforms.find(i=>i.dataSourceId===e);r&&(r.finalBinding={expression:a.expression,resolvedPath:a.resolvedPath,value:this.safeClone(a.value)})}getDataPathTransformTrackingInfo(){const e=this.getDataPathTransformStats();return{transforms:[...this.dataPathTransforms],stats:e,timestamp:Date.now()}}getDataPathTransformStats(){const e=this.dataPathTransforms,a={};let r=0;const i={};for(const u of e){a[u.dataSourceId]=(a[u.dataSourceId]||0)+1,r+=u.warnings.length;for(const d of u.warnings)i[d]=(i[d]||0)+1}const l=Object.entries(i).map(([u,d])=>({warning:u,count:d})).sort((u,d)=>d.count-u.count).slice(0,10);return{totalTransforms:e.length,byDataSource:a,warningsCount:r,commonWarnings:l}}getDataPathTransformForDataSource(e){return this.dataPathTransforms.find(a=>a.dataSourceId===e)}clearDataPathTransforms(){this.dataPathTransforms=[]}trackNestedContext(e){if(!this.config.enabled)return"";const a=`nested-${++this.nestedContextIdCounter}`,r=[...new Set([...e.parentContext.available,...e.ownContext.added])],i={...e.parentContext.values,...e.ownContext.values},l={id:a,timestamp:Date.now(),componentId:e.componentId,componentType:e.componentType,parentContext:{available:e.parentContext.available,values:this.safeClone(e.parentContext.values)},ownContext:{added:e.ownContext.added,values:this.safeClone(e.ownContext.values)},mergedContext:{all:r,values:this.safeClone(i)},accessAttempts:[],depth:e.depth,parentId:e.parentId};return this.nestedContexts.push(l),this.nestedContexts.length>this.maxNestedContexts&&this.nestedContexts.shift(),a}trackNestedContextAccess(e,a){if(!this.config.enabled)return;const r=this.nestedContexts.find(i=>i.id===e);r&&r.accessAttempts.push({path:a.path,found:a.found,value:a.found?this.safeClone(a.value):void 0,error:a.error})}getNestedContextTrackingInfo(){const e=this.getNestedContextStats();return{contexts:[...this.nestedContexts],stats:e,timestamp:Date.now()}}getNestedContextStats(){const e=this.nestedContexts,a={expandChildren:0,cellChildren:0,iteration:0,modal:0,slot:0};let r=0,i=0;const l={};for(const d of e){a[d.componentType]++,d.depth>r&&(r=d.depth);for(const f of d.accessAttempts)f.found||(i++,l[f.path]=(l[f.path]||0)+1)}const u=Object.entries(l).map(([d,f])=>({path:d,count:f})).sort((d,f)=>f.count-d.count).slice(0,10);return{totalContexts:e.length,byType:a,maxDepth:r,failedAccessCount:i,commonFailedPaths:u}}getNestedContextForComponent(e){return this.nestedContexts.find(a=>a.componentId===e)}clearNestedContexts(){this.nestedContexts=[],this.nestedContextIdCounter=0}trackHandlerRegistration(e,a="custom",r,i){this.isEnabled&&this.handlers.set(e,{name:e,category:a,description:r,registeredAt:Date.now(),source:i})}trackHandlerUnregistration(e){this.isEnabled&&this.handlers.delete(e)}getHandlers(){return Array.from(this.handlers.values())}getHandler(e){return this.handlers.get(e)}getHandlersByCategory(e){return Array.from(this.handlers.values()).filter(a=>a.category===e)}clearHandlers(){this.handlers.clear()}trackEventSubscribe(e){if(!this.isEnabled)return;const a=this.componentEventSubscriptions.get(e),r=Date.now();a?(a.subscriberCount++,a.lastSubscribedAt=r):this.componentEventSubscriptions.set(e,{eventName:e,subscriberCount:1,firstSubscribedAt:r,lastSubscribedAt:r})}trackEventUnsubscribe(e){if(!this.isEnabled)return;const a=this.componentEventSubscriptions.get(e);a&&(a.subscriberCount--,a.subscriberCount<=0&&this.componentEventSubscriptions.delete(e))}trackEventEmit(e,a,r,i,l){if(!this.isEnabled)return;const u={id:`evt_${++this.componentEventIdCounter}`,eventName:e,data:this.sanitizeForLogging(a),timestamp:Date.now(),listenerCount:r,results:i?this.sanitizeForLogging(i):void 0,hasError:!!l,errorMessage:l?.message};this.componentEventEmitHistory.push(u),this.componentEventEmitHistory.length>this.maxComponentEventHistory&&(this.componentEventEmitHistory=this.componentEventEmitHistory.slice(-this.maxComponentEventHistory))}trackEventOff(e){this.isEnabled&&this.componentEventSubscriptions.delete(e)}trackEventClear(){this.isEnabled&&this.componentEventSubscriptions.clear()}getComponentEventInfo(){const e=Array.from(this.componentEventSubscriptions.values());return{subscriptions:e,emitHistory:[...this.componentEventEmitHistory],totalSubscribers:e.reduce((a,r)=>a+r.subscriberCount,0),totalEmits:this.componentEventEmitHistory.length}}getEventEmitHistory(){return[...this.componentEventEmitHistory]}getEventSubscriptions(){return Array.from(this.componentEventSubscriptions.values())}clearComponentEvents(){this.componentEventSubscriptions.clear(),this.componentEventEmitHistory=[],this.componentEventIdCounter=0}sanitizeForLogging(e){if(e==null||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{return"[Circular or Non-serializable]"}}startStateChange(e,a,r,i){if(!this.config.enabled)return"";const l=`setState_${++this.stateRenderingIdCounter}`;this.currentStateChangeContext={setStateId:l,startTime:performance.now(),changedPath:e,trigger:i||{},renderedComponents:[]};const u={id:`sr_${this.stateRenderingIdCounter}`,setStateId:l,statePath:e,oldValue:this.sanitizeForLogging(a),newValue:this.sanitizeForLogging(r),timestamp:Date.now(),triggeredBy:i||{},renderedComponents:[],totalRenderDuration:0,affectedBindingsCount:0};return this.stateRenderingLogs.push(u),this.stateRenderingLogs.length>this.maxStateRenderingLogs&&this.stateRenderingLogs.shift(),l}trackComponentRender(e,a,r,i=[],l=[],u){if(!this.config.enabled)return;const d=this.componentRenderCounts.get(a)||0;this.componentRenderCounts.set(a,d+1);for(const f of i)this.stateToComponentMap.has(f)||this.stateToComponentMap.set(f,new Set),this.stateToComponentMap.get(f).add(a);if(this.currentStateChangeContext){const f={componentId:e,componentName:a,renderDuration:r,accessedStatePaths:i,evaluatedBindings:l,renderOrder:this.currentStateChangeContext.renderedComponents.length,parentId:u};this.currentStateChangeContext.renderedComponents.push(f)}this.trackRender(a)}completeStateChange(e){if(!this.config.enabled||!this.currentStateChangeContext||this.currentStateChangeContext.setStateId!==e)return;const a=this.currentStateChangeContext,i=performance.now()-a.startTime,l=this.stateRenderingLogs.findIndex(u=>u.setStateId===e);if(l>=0){const u=this.stateRenderingLogs[l];u.renderedComponents=a.renderedComponents,u.totalRenderDuration=i,u.affectedBindingsCount=a.renderedComponents.reduce((d,f)=>d+f.evaluatedBindings.length,0)}this.currentStateChangeContext=null}getCurrentStateChangeContext(){return this.currentStateChangeContext}getStateRenderingLogs(){return[...this.stateRenderingLogs]}getStateRenderingInfo(){const e=this.stateRenderingLogs,a=Object.fromEntries(this.componentRenderCounts),r={};for(const[i,l]of this.stateToComponentMap)r[i]=Array.from(l);return{logs:e,componentRenderCounts:a,stateToComponentMap:r,stats:this.calculateStateRenderingStats()}}calculateStateRenderingStats(){const e=this.stateRenderingLogs;if(e.length===0)return{totalStateChanges:0,totalRenders:0,avgRenderDuration:0,avgComponentsPerChange:0,topRenderedComponents:[],topInfluentialPaths:[]};const a=e.reduce((d,f)=>d+f.renderedComponents.length,0),r=e.reduce((d,f)=>d+f.totalRenderDuration,0)/e.length,i=a/e.length,l=Array.from(this.componentRenderCounts.entries()).sort((d,f)=>f[1]-d[1]).slice(0,5).map(([d,f])=>({name:d,count:f})),u=Array.from(this.stateToComponentMap.entries()).sort((d,f)=>f[1].size-d[1].size).slice(0,5).map(([d,f])=>({path:d,affectedComponents:f.size}));return{totalStateChanges:e.length,totalRenders:a,avgRenderDuration:r,avgComponentsPerChange:i,topRenderedComponents:l,topInfluentialPaths:u}}getComponentsAffectedByState(e){const a=this.stateToComponentMap.get(e);return a?Array.from(a):[]}getComponentRenderHistory(e){return this.stateRenderingLogs.filter(a=>a.renderedComponents.some(r=>r.componentName===e))}clearStateRenderingLogs(){this.stateRenderingLogs=[],this.componentRenderCounts.clear(),this.stateToComponentMap.clear(),this.currentStateChangeContext=null,this.stateRenderingIdCounter=0}trackComponentStateSource(e,a,r,i){this.config.enabled&&this.componentStateSources.set(e,{componentId:e,componentName:a,stateSource:r,stateProvider:i})}trackDynamicState(e,a){this.config.enabled&&this.dynamicStates.set(e,a)}trackContextFlow(e,a,r,i,l,u){if(!this.config.enabled)return;const d={component:a,componentId:e,contextReceived:r,passedToChildren:i,usedInRender:l};if(this.contextFlowNodes.set(e,d),u){const f=this.contextFlowNodes.get(u);f&&(f.children||(f.children=[]),f.children.push(d))}}getStateHierarchyInfo(e=!0){const a=this.buildStateHierarchyLayers(),r=this.detectStateConflicts(a),i=Array.from(this.componentStateSources.values());return{layers:e?a.map(u=>({...u,values:this.summarizeValues(u.values,2)})):a,conflicts:r,componentStateSources:i,timestamp:Date.now()}}summarizeValues(e,a,r=0){if(e==null)return e;if(typeof e!="object")return typeof e=="string"&&e.length>100?e.substring(0,100)+`... (${e.length}자)`:e;if(r>=a){if(Array.isArray(e))return`[Array(${e.length})]`;const u=Object.keys(e);return`{${u.slice(0,5).join(", ")}${u.length>5?`, ... +${u.length-5}`:""}}`}if(Array.isArray(e))return e.length<=3?e.map(u=>this.summarizeValues(u,a,r+1)):{__type:"array",__length:e.length,__preview:e.slice(0,3).map(u=>this.summarizeValues(u,a,r+1))};const i={},l=Object.keys(e);for(const u of l)i[u]=this.summarizeValues(e[u],a,r+1);return i}buildStateHierarchyLayers(){const e=[];try{const r=window.G7Core?.state?.get?.();if(!r)return e;r._local&&e.push({name:"Global _local",type:"global",path:"_local",values:r._local,priority:1}),r._global&&e.push({name:"Global _global",type:"global",path:"_global",values:r._global,priority:1});for(const[l,u]of this.dynamicStates)u&&Object.keys(u).length>0&&e.push({name:`DynamicState (${l})`,type:"dynamicState",componentId:l,values:u,priority:2});const i=this.computeEffectiveState(r._local||{});e.push({name:"Effective _local (merged)",type:"effective",values:i,priority:3})}catch(a){console.warn("[G7DevTools] 상태 계층 빌드 실패:",a)}return e}computeEffectiveState(e){const a={...e};for(const[,r]of this.dynamicStates)r._local&&Object.assign(a,r._local);return a}detectStateConflicts(e){const a=[],r=e.find(l=>l.type==="global"&&l.path==="_local");if(!r)return a;const i=e.filter(l=>l.type==="dynamicState");for(const l of i){const u=l.values._local||l.values;for(const[d,f]of Object.entries(u)){const g=r.values[d];if(JSON.stringify(g)!==JSON.stringify(f)){const m=[],b=[];for(const v of this.componentStateSources.values())v.stateSource.local.some(E=>E===`_local.${d}`||E===d)&&(v.stateProvider.type==="dynamicState"?m.push(v.componentName):v.stateProvider.type==="globalState"&&b.push(v.componentName));a.push({path:`_local.${d}`,globalValue:g,dynamicStateValue:f,effectiveValue:f,usedBy:m,notUsedBy:b,severity:b.length>0?"warning":"info",description:b.length>0?`${b.join(", ")}은(는) globalState._local을 읽어 dynamicState 값을 사용하지 못함`:"dynamicState 값이 globalState와 다르지만 모든 컴포넌트가 dynamicState를 사용"})}}}return a}getContextFlowInfo(){const e=[],a=new Set(this.contextFlowNodes.keys());for(const r of this.contextFlowNodes.values())if(r.children)for(const i of r.children)a.delete(i.componentId);for(const r of a){const i=this.contextFlowNodes.get(r);i&&e.push(i)}return{rootComponent:e.length>0?e[0].component:"Unknown",contextFlow:e,timestamp:Date.now()}}clearStateHierarchyData(){this.componentStateSources.clear(),this.contextFlowNodes.clear(),this.dynamicStates.clear()}trackComponentStyle(e,a,r,i){if(!this.config.enabled)return;const l=this.analyzeTailwindClasses(r),u={componentId:e,componentName:a,classes:r,computedStyles:i,tailwindAnalysis:l};this.componentStyles.set(e,u),this.detectStyleIssues(u)}analyzeTailwindClasses(e){const a=[],r=[],i=[],l=[],u=["sm:","md:","lg:","xl:","2xl:"],d=[/bg-\w+-\d+/,/text-\w+-\d+/,/border-\w+-\d+/];for(const f of e){l.push(f),f.startsWith("dark:")&&a.push(f);for(const g of u)if(f.startsWith(g)){r.push(f);break}for(const g of d)if(g.test(f)){i.push(f);break}}return{usedClasses:l,darkClasses:a,responsiveClasses:r,dynamicClasses:i}}detectStyleIssues(e){const{componentId:a,componentName:r,computedStyles:i,tailwindAnalysis:l}=e;(i.opacity==="0"||i.visibility==="hidden"||i.display==="none"||i.width==="0px"&&i.height==="0px")&&this.addStyleIssue({id:this.generateId(),type:"invisible-element",componentId:a,componentName:r,property:i.opacity==="0"?"opacity":i.visibility==="hidden"?"visibility":i.display==="none"?"display":"width/height",currentValue:i.opacity==="0"?"0":i.visibility==="hidden"?"hidden":i.display==="none"?"none":"0px",severity:"warning",description:"요소가 화면에 보이지 않습니다.",suggestion:"opacity, visibility, display, width/height 값을 확인하세요."});const u=l.usedClasses.filter(f=>f.startsWith("bg-")&&!f.startsWith("dark:")),d=l.darkClasses.filter(f=>f.includes("bg-"));u.length>0&&d.length===0&&this.addStyleIssue({id:this.generateId(),type:"dark-mode-missing",componentId:a,componentName:r,property:"background-color",currentValue:u.join(", "),expectedValue:"dark:bg-* 클래스 필요",severity:"info",description:"다크 모드 배경색 클래스가 누락되었습니다.",suggestion:`${u[0]}에 대응하는 dark: 클래스를 추가하세요.`}),l.dynamicClasses.length>0&&this.addStyleIssue({id:this.generateId(),type:"tailwind-purging",componentId:a,componentName:r,property:"class",currentValue:l.dynamicClasses.join(", "),severity:"info",description:"동적으로 생성된 Tailwind 클래스가 있습니다.",suggestion:"tailwind.config.js의 safelist에 추가하거나 전체 클래스명을 상수로 정의하세요."})}addStyleIssue(e){this.styleIssues.some(r=>r.componentId===e.componentId&&r.type===e.type&&r.property===e.property)||this.styleIssues.push(e)}getStyleValidationInfo(){const e=Array.from(this.componentStyles.values());return{issues:[...this.styleIssues],componentStyles:e,stats:{totalComponents:e.length,invisibleCount:this.styleIssues.filter(a=>a.type==="invisible-element").length,tailwindIssueCount:this.styleIssues.filter(a=>a.type==="tailwind-purging").length,darkModeIssueCount:this.styleIssues.filter(a=>a.type==="dark-mode-missing").length},timestamp:Date.now()}}clearStyleValidationData(){this.styleIssues=[],this.componentStyles.clear()}trackAuthEvent(e,a,r,i){if(!this.config.enabled)return;const l={id:`auth_${++this.authEventIdCounter}`,type:e,timestamp:Date.now(),success:a,error:r,details:i};this.authEvents.push(l),this.authEvents.length>this.maxAuthEventHistory&&(this.authEvents=this.authEvents.slice(-this.maxAuthEventHistory))}trackAuthHeader(e,a,r,i,l){if(!this.config.enabled)return;const u={url:e,hasAuthHeader:a,headerType:r,tokenValid:i??!1,responseStatus:l,timestamp:Date.now()};this.authHeaderHistory.push(u),this.authHeaderHistory.length>this.maxAuthEventHistory&&(this.authHeaderHistory=this.authHeaderHistory.slice(-this.maxAuthEventHistory)),l===401&&this.trackAuthEvent("api-unauthorized",!1,`401 Unauthorized: ${e}`,{url:e})}getAuthState(){try{const e=window.G7Core,a=e?.api;let r=e?.auth;!r&&e?.AuthManager?.getInstance&&(r=e.AuthManager.getInstance());const i=a?.getToken?.()||r?.getAccessToken?.()||localStorage.getItem("auth_token")||localStorage.getItem("access_token"),l=r?.getRefreshToken?.()||localStorage.getItem("refresh_token");let u="unknown",d=r?.getUser?.();if(d&&(u="AuthManager"),!d){const S=e?.state?.get?.();d=S?._global?.user||S?._global?.currentUser||S?.user||S?.currentUser,d&&(u="G7Core.state")}const f=r?.isAuthenticated?.()??!1;let g="memory";localStorage.getItem("auth_token")||localStorage.getItem("access_token")?g="localStorage":(sessionStorage.getItem("auth_token")||sessionStorage.getItem("access_token"))&&(g="sessionStorage");const m=!!i&&(!!d||f);let b;i&&typeof i=="string"&&i.length>20?b=`${i.substring(0,10)}...${i.substring(i.length-6)}`:i&&(b="***");const v=d?{id:d.id,email:d.email,name:d.name,roles:d.roles?.map(S=>typeof S=="string"?{name:S}:{id:S.id,name:S.name,guard_name:S.guard_name}),permissions:d.permissions?.map(S=>typeof S=="string"?{name:S}:{id:S.id,name:S.name,guard_name:S.guard_name}),avatar:d.avatar||d.profile_photo_url||d.profile_image,created_at:d.created_at,updated_at:d.updated_at,last_login_at:d.last_login_at,email_verified_at:d.email_verified_at,...d.phone&&{phone:d.phone},...d.nickname&&{nickname:d.nickname},...d.status&&{status:d.status},...d.locale&&{locale:d.locale}}:void 0;return{isAuthenticated:m,user:v,tokens:{hasAccessToken:!!i,hasRefreshToken:!!l,storage:g,accessTokenPreview:b},lastActivity:Date.now(),source:u}}catch{return{isAuthenticated:!1,tokens:{hasAccessToken:!1,hasRefreshToken:!1,storage:"memory"},source:"unknown"}}}getAuthDebugInfo(){const e=[...this.authEvents];return{state:this.getAuthState(),events:e,headerAnalysis:[...this.authHeaderHistory],stats:{loginAttempts:e.filter(a=>a.type==="login").length,successfulLogins:e.filter(a=>a.type==="login"&&a.success).length,failedLogins:e.filter(a=>a.type==="login"&&!a.success).length,tokenRefreshes:e.filter(a=>a.type==="token-refresh").length,unauthorizedResponses:e.filter(a=>a.type==="api-unauthorized").length},timestamp:Date.now()}}clearAuthData(){this.authEvents=[],this.authHeaderHistory=[],this.authEventIdCounter=0}trackLayoutLoad(e,a,r,i="api"){if(!this.config.enabled)return;const l=Date.now();this.currentLayout={layoutPath:e,templateId:a,layoutJson:this.sanitizeObject(r),loadedAt:l,version:r.version,layoutName:r.layout_name,source:i};const u={id:`layout-${++this.layoutIdCounter}`,layoutPath:e,templateId:a,loadedAt:l,source:i,version:r.version};this.layoutHistory.push(u),this.layoutHistory.length>this.maxLayoutHistory&&this.layoutHistory.shift(),this.layoutStats.totalLoads++,i==="cache"?this.layoutStats.cacheHits++:this.layoutStats.apiLoads++}getCurrentLayout(){return this.currentLayout}getLayoutHistory(){return[...this.layoutHistory]}getLayoutDebugInfo(){return{current:this.currentLayout,history:[...this.layoutHistory],stats:{...this.layoutStats}}}clearLayoutData(){this.currentLayout=null,this.layoutHistory=[],this.layoutIdCounter=0,this.layoutStats={totalLoads:0,cacheHits:0,apiLoads:0}}startHandlerExecution(e){if(!this.config.enabled)return"";const a=`exec_${++this.executionIdCounter}_${Date.now()}`,r={handlerName:e,executionId:a,startTime:Date.now(),stateChanges:[],dataSourceChanges:[],alerts:[]};if(this.executionDetails.set(a,r),this.executionDetails.size>this.maxExecutionDetails){const i=Array.from(this.executionDetails.keys());i.slice(0,i.length-this.maxExecutionDetails).forEach(u=>this.executionDetails.delete(u))}return a}endHandlerExecution(e,a,r,i){if(!this.config.enabled||!e)return;const l=this.executionDetails.get(e);if(!l)return;l.endTime=Date.now(),l.duration=l.endTime-l.startTime,l.exitReason=a,l.exitLocation=r,l.exitDescription=i;const u=this.changeExpectations.get(e);u&&(l.expectedChanges=u,this.checkExpectations(e,l,u),this.changeExpectations.delete(e)),a==="normal"&&l.stateChanges.length===0&&l.dataSourceChanges.length===0&&this.addChangeAlert(e,{type:"no-state-change",severity:"warning",message:`핸들러 "${l.handlerName}"이(가) 상태 변경 없이 완료됨`,description:"핸들러가 성공적으로 완료되었지만 상태나 데이터소스 변경이 없습니다. 의도한 동작인지 확인하세요.",handlerName:l.handlerName,suggestion:'핸들러 내부 조건문을 확인하거나 DevTools의 "변경감지" 탭에서 exitLocation을 확인하세요.',docLink:"troubleshooting-state.md"}),(a==="early-return-condition"||a==="early-return-validation")&&this.addChangeAlert(e,{type:"early-return-detected",severity:"info",message:`핸들러 "${l.handlerName}"이(가) early return으로 종료됨`,description:i||`종료 위치: ${r||"알 수 없음"}`,handlerName:l.handlerName,suggestion:a==="early-return-validation"?"검증 실패로 인한 early return입니다. 입력 데이터를 확인하세요.":"조건부 early return입니다. 조건문의 평가 결과를 확인하세요."})}recordExitReason(e,a,r,i){if(!this.config.enabled||!e)return;const l=this.executionDetails.get(e);l&&(l.exitReason=a,l.exitLocation=r,l.exitDescription=i)}recordStateChange(e,a,r,i,l){if(!this.config.enabled)return;const u={id:`sc_${++this.stateChangeIdCounter}`,path:a,changeType:r,oldValue:this.safeClone(i),newValue:this.safeClone(l),timestamp:Date.now(),comparison:this.compareValues(i,l),executionId:e};if(this.stateChangeHistory.push(u),e){const d=this.executionDetails.get(e);d&&d.stateChanges.push(u)}this.stateChangeHistory.length>this.maxStateChangeHistory&&this.stateChangeHistory.splice(0,this.stateChangeHistory.length-this.maxStateChangeHistory),u.comparison.isDeepEqual&&typeof i=="object"&&i!==null&&this.addChangeAlert(e||"",{type:"object-reference-same",severity:"warning",message:`상태 "${a}"가 변경되었으나 값이 동일함`,description:"객체 참조가 동일하거나 깊은 비교 결과 변경이 없습니다. 변경 감지가 실패할 수 있습니다.",handlerName:e&&this.executionDetails.get(e)?.handlerName||"unknown",statePath:a,suggestion:"불변성을 유지하여 새 객체를 생성하세요. 예: { ...oldObject, newField: value }",docLink:"troubleshooting-state.md#object-mutation"})}recordDataSourceChange(e,a,r,i,l){if(!this.config.enabled)return;const u={dataSourceId:a,changeType:r,timestamp:Date.now(),previousStatus:i,newStatus:l,executionId:e};if(this.dataSourceChangeHistory.push(u),e){const d=this.executionDetails.get(e);d&&d.dataSourceChanges.push(u)}this.dataSourceChangeHistory.length>this.maxStateChangeHistory&&this.dataSourceChangeHistory.splice(0,this.dataSourceChangeHistory.length-this.maxStateChangeHistory)}expectChange(e,a,r){if(!this.config.enabled||!e)return;const i=this.executionDetails.get(e);if(!i)return;const l={expectedStatePaths:a,expectedDataSources:r,setAt:Date.now(),source:i.handlerName};this.changeExpectations.set(e,l)}checkExpectations(e,a,r){const i=new Set(a.stateChanges.map(u=>u.path)),l=new Set(a.dataSourceChanges.map(u=>u.dataSourceId));for(const u of r.expectedStatePaths)i.has(u)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 상태 변경 "${u}"가 발생하지 않음`,description:`핸들러 "${a.handlerName}"이(가) "${u}" 변경을 예고했지만 실제로 변경되지 않았습니다.`,handlerName:a.handlerName,statePath:u,suggestion:"핸들러 내부 로직을 확인하세요. early return이나 조건부 분기로 인해 변경이 생략되었을 수 있습니다.",docLink:"troubleshooting-state.md"});for(const u of r.expectedDataSources)l.has(u)||this.addChangeAlert(e,{type:"expected-not-fulfilled",severity:"error",message:`기대한 데이터소스 갱신 "${u}"가 발생하지 않음`,description:`핸들러 "${a.handlerName}"이(가) "${u}" 갱신을 예고했지만 실제로 갱신되지 않았습니다.`,handlerName:a.handlerName,dataSourceId:u,suggestion:"refetchDataSource 호출이 실행되었는지 확인하세요.",docLink:"data-sources.md"})}addChangeAlert(e,a){const r={...a,id:`alert_${++this.alertIdCounter}`,timestamp:Date.now()};if(this.changeAlerts.push(r),e){const i=this.executionDetails.get(e);i&&i.alerts.push(r)}this.changeAlerts.length>this.maxChangeAlerts&&this.changeAlerts.splice(0,this.changeAlerts.length-this.maxChangeAlerts)}compareValues(e,a){const r=this.getValueType(e),i=this.getValueType(a),l=r!==i;let u=!1,d;return!l&&(r==="object"||r==="array")?(u=this.deepEqual(e,a),!u&&r==="object"&&(d=this.getChangedKeys(e,a))):u=e===a,{typeChanged:l,oldType:r,newType:i,isDeepEqual:u,changedKeys:d}}getValueType(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?"array":typeof e}deepEqual(e,a){if(e===a)return!0;if(typeof e!=typeof a)return!1;if(e===null||a===null||typeof e!="object")return e===a;if(Array.isArray(e)!==Array.isArray(a))return!1;const r=Object.keys(e),i=Object.keys(a);if(r.length!==i.length)return!1;for(const l of r)if(!i.includes(l)||!this.deepEqual(e[l],a[l]))return!1;return!0}getChangedKeys(e,a){const r=[],i=new Set([...Object.keys(e),...Object.keys(a)]);for(const l of i)this.deepEqual(e[l],a[l])||r.push(l);return r}getChangeDetectionInfo(){const e=Array.from(this.executionDetails.values()),a={totalExecutions:e.length,executionsWithStateChange:e.filter(r=>r.stateChanges.length>0).length,executionsWithoutStateChange:e.filter(r=>r.stateChanges.length===0&&r.exitReason==="normal").length,earlyReturnCount:e.filter(r=>r.exitReason==="early-return-condition"||r.exitReason==="early-return-validation").length,alertCount:this.changeAlerts.length,alertsByType:this.getAlertsByType()};return{executionDetails:e,stateChangeHistory:[...this.stateChangeHistory],dataSourceChangeHistory:[...this.dataSourceChangeHistory],alerts:[...this.changeAlerts],stats:a,timestamp:Date.now()}}getAlertsByType(){const e={"no-state-change":0,"no-datasource-change":0,"expected-not-fulfilled":0,"object-reference-same":0,"early-return-detected":0,"async-timing-issue":0};for(const a of this.changeAlerts)e[a.type]++;return e}clearChangeDetectionData(){this.executionDetails.clear(),this.stateChangeHistory=[],this.dataSourceChangeHistory=[],this.changeAlerts=[],this.changeExpectations.clear(),this.executionIdCounter=0,this.stateChangeIdCounter=0,this.alertIdCounter=0}getRecentAlerts(e=10,a){let r=[...this.changeAlerts];return a&&(r=r.filter(i=>i.severity===a)),r.slice(-e)}getHandlerExecutions(e,a=10){return Array.from(this.executionDetails.values()).filter(i=>i.handlerName===e).slice(-a)}findExecutionInStack(e){return this.sequenceExecutionStack.find(a=>a.sequenceId===e)}startSequenceExecution(e){if(!this.config.enabled)return"";const a=`seq_${++this.sequenceIdCounter}_${Date.now()}`,r={sequenceId:a,startTime:Date.now(),totalDuration:0,trigger:e,actions:[],status:"running"};return this.sequenceExecutionStack.push(r),a}captureSequenceActionBefore(e,a,r,i,l){if(!this.config.enabled)return;const u=this.findExecutionInStack(e);if(!u)return;const d={index:a,handler:r,params:this.safeClone(i),stateBeforeAction:{_global:this.safeClone(l._global),_local:this.safeClone(l._local),_isolated:l._isolated?this.safeClone(l._isolated):void 0},stateAfterAction:{_global:{},_local:{}},duration:0,status:"success"};u.actions.push(d)}captureSequenceActionAfter(e,a,r,i,l,u){if(!this.config.enabled)return;const d=this.findExecutionInStack(e);if(!d)return;const f=d.actions.find(m=>m.index===a);if(!f)return;f.stateAfterAction={_global:this.safeClone(r._global),_local:this.safeClone(r._local),_isolated:r._isolated?this.safeClone(r._isolated):void 0},f.duration=i,f.result=this.safeClone(l),f.stateDiff={global:this.computeStateDiff(f.stateBeforeAction._global,f.stateAfterAction._global),local:this.computeStateDiff(f.stateBeforeAction._local,f.stateAfterAction._local)},f.stateBeforeAction._isolated&&f.stateAfterAction._isolated&&(f.stateDiff.isolated=this.computeStateDiff(f.stateBeforeAction._isolated,f.stateAfterAction._isolated));const g=window.__g7PendingLocalState;g&&(f.pendingState=this.safeClone(g)),u&&(f.status="error",f.error={name:u.name,message:u.message,stack:u.stack})}endSequenceExecution(e,a){if(!this.config.enabled)return;const r=this.sequenceExecutionStack.findIndex(l=>l.sequenceId===e);if(r===-1)return;const i=this.sequenceExecutionStack[r];if(i.endTime=Date.now(),i.totalDuration=i.endTime-i.startTime,a){i.status="error",i.error={name:a.name,message:a.message,stack:a.stack};const l=i.actions.find(u=>u.status==="error");l&&(i.failedAtIndex=l.index)}else i.status="success";this.sequenceExecutions.push(i),this.sequenceExecutions.length>this.maxSequenceExecutions&&this.sequenceExecutions.shift(),this.sequenceExecutionStack.splice(r,1)}computeStateDiff(e,a){const r=[],i=[],l=[],u=new Set(Object.keys(e)),d=new Set(Object.keys(a));for(const f of d)u.has(f)||r.push(f);for(const f of u)d.has(f)||i.push(f);for(const f of u)if(d.has(f)){const g=e[f],m=a[f];JSON.stringify(g)!==JSON.stringify(m)&&l.push({path:f,oldValue:g,newValue:m})}return{added:r,removed:i,changed:l}}getSequenceTrackingInfo(){const e=this.getSequenceStats(),a=this.sequenceExecutionStack.length>0?this.sequenceExecutionStack[this.sequenceExecutionStack.length-1]:void 0;return{executions:[...this.sequenceExecutions],currentExecution:a,stats:e}}getSequenceStats(){const e=this.sequenceExecutions,a=e.length,r=e.filter(g=>g.status==="success").length,i=e.filter(g=>g.status==="error").length,l=e.reduce((g,m)=>g+m.actions.length,0),u=a>0?e.reduce((g,m)=>g+m.totalDuration,0)/a:0,d={};for(const g of e)for(const m of g.actions)d[m.handler]=(d[m.handler]||0)+1;const f=Object.entries(d).sort(([,g],[,m])=>m-g).slice(0,5).map(([g,m])=>({handler:g,count:m}));return{totalExecutions:a,successCount:r,errorCount:i,totalActions:l,avgDuration:u,topHandlers:f}}clearSequenceData(){this.sequenceExecutions=[],this.sequenceExecutionStack=[],this.sequenceIdCounter=0}getSequenceExecution(e){const a=this.findExecutionInStack(e);return a||this.sequenceExecutions.find(r=>r.sequenceId===e)}getRecentSequences(e=10){return this.sequenceExecutions.slice(-e)}registerStateCaptureForHandler(e,a,r){if(!this.config.enabled)return;const i=new Map,l=Date.now();for(const u of a)i.set(u,{value:this.safeClone(r[u]),capturedAt:l});this.stateCaptureRegistry.set(e,i)}detectStaleClosure(e,a,r,i,l){if(!this.config.enabled)return[];const u=this.stateCaptureRegistry.get(e);if(!u)return[];const d=Date.now(),f=[];for(const[g,m]of u){const b=this.getValueByPath(r,g),v=d-m.capturedAt;if(!this.isDeepEqual(m.value,b)&&v>0){const S=this.createStaleClosureWarning(i,a,g,m.value,m.capturedAt,b,d,v,l);f.push(S),this.addStaleClosureWarning(S)}}return this.stateCaptureRegistry.delete(e),f}trackStaleClosureWarning(e){if(!this.config.enabled)return;const a=Date.now(),r=this.createStaleClosureWarning(e.type,e.location,e.capturedPath,e.capturedValue,e.capturedAt,e.currentValue,a,a-e.capturedAt,e.actionId,e.stackTrace);this.addStaleClosureWarning(r)}createStaleClosureWarning(e,a,r,i,l,u,d,f,g,m){const b=this.getStaleClosureSeverity(e,f),{description:v,suggestion:S,docLink:E}=this.getStaleClosureMessages(e,r,f);return{id:`stale_${++this.staleClosureIdCounter}_${Date.now()}`,timestamp:Date.now(),type:e,location:a,capturedState:{path:r,capturedValue:this.safeClone(i),capturedAt:l},currentState:{path:r,currentValue:this.safeClone(u),retrievedAt:d},timeDiff:f,severity:b,description:v,suggestion:S,docLink:E,actionId:g,stackTrace:m}}getStaleClosureSeverity(e,a){if(a>5e3)return"error";if(a>1e3)return"warning";switch(e){case"async-state-capture":case"sequence-state-mismatch":return"warning";case"callback-state-capture":case"timeout-state-capture":return"info";case"event-handler-stale":return"warning";default:return"info"}}getStaleClosureMessages(e,a,r){const i=r<1e3?`${r}ms`:`${(r/1e3).toFixed(1)}s`;switch(e){case"async-state-capture":return{description:`await 후 ${i} 경과 시점에 '${a}' 상태가 변경됨. 캡처된 상태 대신 최신 상태를 사용해야 함`,suggestion:"await 이후에는 G7Core.state.get()으로 최신 상태를 다시 조회하거나, useRef + getter 패턴을 사용하세요",docLink:"troubleshooting-state-closure.md"};case"callback-state-capture":return{description:`콜백에서 ${i} 전에 캡처된 '${a}' 상태를 사용 중. 최신 상태와 다름`,suggestion:"콜백에서 상태를 참조할 때는 stateRef.current 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};case"timeout-state-capture":return{description:`setTimeout/setInterval 콜백에서 '${a}' 상태가 ${i} 전 값 사용 중`,suggestion:"타이머 콜백 내에서는 G7Core.state.get()으로 최신 상태를 조회하세요",docLink:"troubleshooting-state-closure.md"};case"sequence-state-mismatch":return{description:`sequence 내 '${a}' 상태가 이전 액션 결과와 불일치. context.state 대신 캡처된 값 사용 의심`,suggestion:"sequence 내에서는 context.state 또는 $prev를 사용하여 최신 상태를 참조하세요",docLink:"troubleshooting-state-setstate.md"};case"event-handler-stale":return{description:`이벤트 핸들러에서 ${i} 전에 바인딩된 '${a}' 상태 사용 중`,suggestion:"이벤트 핸들러에서 상태를 참조할 때는 useRef 패턴 또는 G7Core.state.get()를 사용하세요",docLink:"troubleshooting-state-closure.md"};default:return{description:`'${a}' 상태에서 stale closure 감지됨 (${i} 경과)`,suggestion:"상태 참조 시 최신 값을 사용하는지 확인하세요"}}}addStaleClosureWarning(e){this.staleClosureWarnings.push(e),this.staleClosureWarnings.length>this.maxStaleClosureWarnings&&this.staleClosureWarnings.shift()}getValueByPath(e,a){const r=a.split(".");let i=e;for(const l of r){if(i==null)return;i=i[l]}return i}isDeepEqual(e,a){if(e===a)return!0;if(e===null||a===null)return e===a;if(typeof e!=typeof a)return!1;if(typeof e!="object")return e===a;try{return JSON.stringify(e)===JSON.stringify(a)}catch{return!1}}getStaleClosureTrackingInfo(){const e=this.getStaleClosureStats();return{warnings:[...this.staleClosureWarnings],stats:e,timestamp:Date.now()}}getStaleClosureStats(){const e=this.staleClosureWarnings,a={"async-state-capture":0,"callback-state-capture":0,"timeout-state-capture":0,"sequence-state-mismatch":0,"event-handler-stale":0};for(const f of e)a[f.type]++;const r={info:0,warning:0,error:0};for(const f of e)r[f.severity]++;const i={};for(const f of e)i[f.location]=(i[f.location]||0)+1;const l=Object.entries(i).sort(([,f],[,g])=>g-f).slice(0,5).map(([f,g])=>({location:f,count:g})),u={};for(const f of e)u[f.capturedState.path]=(u[f.capturedState.path]||0)+1;const d=Object.entries(u).sort(([,f],[,g])=>g-f).slice(0,5).map(([f,g])=>({path:f,count:g}));return{totalWarnings:e.length,warningsByType:a,warningsBySeverity:r,topLocations:l,topAffectedPaths:d}}clearStaleClosureData(){this.staleClosureWarnings=[],this.staleClosureIdCounter=0,this.stateCaptureRegistry.clear()}getRecentStaleClosureWarnings(e=10,a){let r=[...this.staleClosureWarnings];return a&&(r=r.filter(i=>i.severity===a)),r.slice(-e)}safeClone(e){if(e==null||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{if(Array.isArray(e))return e.map(r=>{try{return JSON.parse(JSON.stringify(r))}catch{return"[Unserializable]"}});const a={};for(const r of Object.keys(e))try{a[r]=JSON.parse(JSON.stringify(e[r]))}catch{a[r]="[Unserializable]"}return a}}};$(gi,"instance");let Ar=gi;const Bn=ct("LayoutLoader");class ba extends Error{constructor(a,r,i){super(a);$(this,"code");$(this,"details");this.code=r,this.details=i,this.name="LayoutLoaderError"}}class Jd{constructor(e){$(this,"componentRegistry");$(this,"currentLayout",null);$(this,"layoutCache",new Map);$(this,"cacheVersion",0);this.componentRegistry=e}setCacheVersion(e){this.cacheVersion!==e&&(Bn.log("Cache version updated:",this.cacheVersion,"->",e),this.cacheVersion=e,this.layoutCache.clear())}getCacheVersion(){return this.cacheVersion}async loadLayout(e,a){const r=`${e}:${a}`;if(this.layoutCache.has(r)){Bn.log("Loading layout from cache:",a);const l=await this.layoutCache.get(r),u=JSON.parse(JSON.stringify(l));return this.currentLayout=u,Ar.getInstance().trackLayoutLoad(a,e,u,"cache"),u}const i=this.fetchLayout(e,a);return this.layoutCache.set(r,i),i.catch(()=>{this.layoutCache.get(r)===i&&this.layoutCache.delete(r)}),i}async fetchLayout(e,a,r=!1){try{let i;a.startsWith("__preview__/")?i=`/api/layouts/preview/${a.replace("__preview__/","")}.json`:i=`/api/layouts/${e}/${a}.json`;const l=this.cacheVersion>0?`${i}?v=${this.cacheVersion}`:i;Bn.log("Fetching layout from API:",l);const u=Ma(),d=r?null:u.getToken(),f={Accept:"application/json"};d&&(f.Authorization=`Bearer ${d}`);const g=await Cl(l,{init:{headers:f},label:`layout: ${a}`});let m;try{m=await g.json()}catch{m=null}if(!g.ok){if(g.status===401&&!r&&d){Bn.log("Token invalid, removing and retrying without token"),u.removeToken();try{return await this.fetchLayout(e,a,!0)}catch(S){throw S instanceof ba&&S.details?.status===401?new ba(S.message,S.code,{...S.details,hadToken:!0}):S}}const v=m?.message||m?.error;throw new ba(`Failed to fetch layout: ${g.status} ${g.statusText}`,"FETCH_FAILED",{status:g.status,statusText:g.statusText,url:l,apiMessage:v})}const b=m.data||m;return this.validateLayoutData(b),this.currentLayout=b,Ar.getInstance().trackLayoutLoad(a,e,b,"api"),Bn.log("Layout fetched and cached successfully:",b.layout_name),b}catch(i){const l=`${e}:${a}`;throw this.layoutCache.delete(l),i instanceof ba?i:new ba("Failed to load layout","LOAD_FAILED",{originalError:i})}}prefetchLayout(e,a){return this.loadLayout(e,a)}validateLayoutData(e){if(!e.version)throw new ba("Layout data missing required field: version","VALIDATION_FAILED",{field:"version"});if(!e.layout_name)throw new ba("Layout data missing required field: layout_name","VALIDATION_FAILED",{field:"layout_name"});if(!Array.isArray(e.components))throw new ba('Layout data field "components" must be an array',"VALIDATION_FAILED",{field:"components",value:e.components});Bn.log("Layout data validation passed")}renderLayout(e,a){try{const r=a||this.currentLayout;if(!r)throw new ba("No layout data to render","NO_LAYOUT_DATA");Bn.log("Rendering layout:",r.layout_name),e.innerHTML="",this.renderComponents(e,r.components),Bn.log("Layout rendered successfully")}catch(r){Bn.error("Render error:",r),this.renderErrorState(e,r)}}renderComponents(e,a){for(const r of a){const i=this.renderComponent(r);i&&e.appendChild(i)}}renderComponent(e){try{if(!this.componentRegistry.getComponent(e.type))return Bn.warn(`Component not found: ${e.type}`),this.createPlaceholderElement(e.type);const r=document.createElement("div");return r.setAttribute("data-component",e.type),e.props&&Object.entries(e.props).forEach(([i,l])=>{r.setAttribute(`data-prop-${i}`,JSON.stringify(l))}),e.children&&e.children.length>0?this.renderComponents(r,e.children):e.text&&(r.textContent=e.text),r}catch(a){return Bn.error(`Error rendering component ${e.type}:`,a),this.createErrorElement(e.type,a)}}createPlaceholderElement(e){const a=document.createElement("div");return a.className="component-placeholder",a.setAttribute("data-component-type",e),a.innerHTML=`
<div style="padding: 1rem; border: 2px dashed #ccc; background: #f9f9f9; text-align: center;">
<p style="margin: 0; color: #666;">Component not found: <strong>${e}</strong></p>
</div>
`,a}createErrorElement(e,a){const r=document.createElement("div");return r.className="component-error",r.setAttribute("data-component-type",e),r.innerHTML=`
<div style="padding: 1rem; border: 2px solid #f44336; background: #ffebee; border-radius: 4px;">
<p style="margin: 0 0 0.5rem 0; color: #c62828; font-weight: bold;">Component Error: ${e}</p>
<p style="margin: 0; color: #666; font-size: 0.875rem;">${a?.message||"Unknown error"}</p>
</div>
`,r}renderErrorState(e,a){const r=a instanceof Error?a.message:String(a),i=a instanceof ba?a.code:"UNKNOWN_ERROR";e.innerHTML=`
<div class="layout-error" data-error-code="${i}" style="
padding: 2rem;
text-align: center;
background: #ffebee;
border: 2px solid #f44336;
border-radius: 8px;
margin: 2rem auto;
max-width: 600px;
">
<h2 style="
margin: 0 0 1rem 0;
color: #c62828;
font-size: 1.5rem;
">레이아웃 로드 실패</h2>
<p style="
margin: 0 0 1rem 0;
color: #666;
font-size: 1rem;
">${r}</p>
<p style="
margin: 0;
color: #999;
font-size: 0.875rem;
">오류 코드: ${i}</p>
<button
onclick="window.location.reload()"
style="
margin-top: 1.5rem;
padding: 0.75rem 1.5rem;
background: #f44336;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
"
>페이지 새로고침</button>
</div>
`,Bn.error("Error state rendered:",i,r)}getCurrentLayout(){return this.currentLayout}clear(){this.currentLayout=null,this.layoutCache.clear(),Bn.log("Layout data and cache cleared")}}const d_=ct("TranslationContext"),Qd=N.createContext(null),sc=({children:o,translationEngine:e,translationContext:a})=>{const r=N.useMemo(()=>(l,u)=>{if(u){const d="|"+Object.entries(u).map(([f,g])=>`${f}=${g}`).join("|");return e.translate(l,a,d)}return e.translate(l,a)},[e,a]),i=N.useMemo(()=>({translationEngine:e,translationContext:a,t:r}),[e,a,r]);return ut.jsx(Qd.Provider,{value:i,children:o})},Um=()=>{const o=N.useContext(Qd);return o||(d_.warn("TranslationProvider 외부에서 호출되었습니다. 키를 그대로 반환합니다."),{t:e=>e,translationEngine:null,translationContext:null})},xr=ct("SlotContext"),f_={registerToSlot:()=>{xr.warn("SlotContext not available: registerToSlot called outside SlotProvider")},unregisterFromSlot:()=>{xr.warn("SlotContext not available: unregisterFromSlot called outside SlotProvider")},getSlotComponents:()=>[],subscribeToSlot:()=>()=>{},clearAllSlots:()=>{},isEnabled:!1},h_=N.createContext(f_),Zd=({children:o})=>{const e=N.useRef(new Map),a=N.useRef(new Map),r=N.useCallback(m=>{const b=a.current.get(m);b&&b.forEach(v=>{try{v()}catch(S){xr.error(`Slot subscriber error (slotId: ${m}):`,S)}})},[]),i=N.useCallback((m,b,v)=>{if(!m||!b){xr.warn("registerToSlot: slotId and componentId are required");return}e.current.has(m)||e.current.set(m,new Map);const S=e.current.get(m),E=S.get(b);E&&E.registrationKey===v.registrationKey||(S.set(b,v),xr.log(`Component registered to slot: ${b} -> ${m} (order: ${v.order})`),r(m))},[r]),l=N.useCallback((m,b)=>{const v=e.current.get(m);v&&v.has(b)&&(v.delete(b),xr.log(`Component unregistered from slot: ${b} <- ${m}`),v.size===0&&e.current.delete(m),r(m))},[r]),u=N.useCallback(m=>{const b=e.current.get(m);return b?Array.from(b.values()).sort((v,S)=>v.order-S.order):[]},[]),d=N.useCallback((m,b)=>{a.current.has(m)||a.current.set(m,new Set);const v=a.current.get(m);return v.add(b),()=>{v.delete(b),v.size===0&&a.current.delete(m)}},[]),f=N.useCallback(()=>{e.current.forEach((m,b)=>{r(b)}),e.current.clear(),a.current.clear(),xr.log("All slots cleared")},[r]),g=N.useMemo(()=>({registerToSlot:i,unregisterFromSlot:l,getSlotComponents:u,subscribeToSlot:d,clearAllSlots:f,isEnabled:!0}),[i,l,u,d,f]);return N.useLayoutEffect(()=>{typeof window<"u"&&(window.__slotContextValue=g,xr.log("SlotContext exposed to window.__slotContextValue"))},[g]),ut.jsx(h_.Provider,{value:g,children:o})};class ef{constructor(){this.notificationCreatedEvent=".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated"}listenForWhisper(e,a){return this.listen(".client-"+e,a)}notification(e){return this.listen(this.notificationCreatedEvent,e)}stopListeningForNotification(e){return this.stopListening(this.notificationCreatedEvent,e)}stopListeningForWhisper(e,a){return this.stopListening(".client-"+e,a)}}class Bm{constructor(e){this.namespace=e}format(e){return[".","\\"].includes(e.charAt(0))?e.substring(1):(this.namespace&&(e=this.namespace+"."+e),e.replace(/\./g,"\\"))}setNamespace(e){this.namespace=e}}function g_(o){try{return Reflect.construct(String,[],o),!0}catch{return!1}}class tf extends ef{constructor(e,a,r){super(),this.name=a,this.pusher=e,this.options=r,this.eventFormatter=new Bm(this.options.namespace),this.subscribe()}subscribe(){this.subscription=this.pusher.subscribe(this.name)}unsubscribe(){this.pusher.unsubscribe(this.name)}listen(e,a){return this.on(this.eventFormatter.format(e),a),this}listenToAll(e){return this.subscription.bind_global((a,r)=>{if(a.startsWith("pusher:"))return;let i=String(this.options.namespace??"").replace(/\./g,"\\"),l=a.startsWith(i)?a.substring(i.length+1):"."+a;e(l,r)}),this}stopListening(e,a){return a?this.subscription.unbind(this.eventFormatter.format(e),a):this.subscription.unbind(this.eventFormatter.format(e)),this}stopListeningToAll(e){return e?this.subscription.unbind_global(e):this.subscription.unbind_global(),this}subscribed(e){return this.on("pusher:subscription_succeeded",()=>{e()}),this}error(e){return this.on("pusher:subscription_error",a=>{e(a)}),this}on(e,a){return this.subscription.bind(e,a),this}}class qm extends tf{whisper(e,a){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,a),this}}class p_ extends tf{whisper(e,a){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,a),this}}class m_ extends qm{here(e){return this.on("pusher:subscription_succeeded",a=>{e(Object.keys(a.members).map(r=>a.members[r]))}),this}joining(e){return this.on("pusher:member_added",a=>{e(a.info)}),this}whisper(e,a){return this.pusher.channels.channels[this.name].trigger(`client-${e}`,a),this}leaving(e){return this.on("pusher:member_removed",a=>{e(a.info)}),this}}class Pm extends ef{constructor(e,a,r){super(),this.events={},this.listeners={},this.name=a,this.socket=e,this.options=r,this.eventFormatter=new Bm(this.options.namespace),this.subscribe()}subscribe(){this.socket.emit("subscribe",{channel:this.name,auth:this.options.auth||{}})}unsubscribe(){this.unbind(),this.socket.emit("unsubscribe",{channel:this.name,auth:this.options.auth||{}})}listen(e,a){return this.on(this.eventFormatter.format(e),a),this}stopListening(e,a){return this.unbindEvent(this.eventFormatter.format(e),a),this}subscribed(e){return this.on("connect",a=>{e(a)}),this}error(e){return this}on(e,a){return this.listeners[e]=this.listeners[e]||[],this.events[e]||(this.events[e]=(r,i)=>{this.name===r&&this.listeners[e]&&this.listeners[e].forEach(l=>l(i))},this.socket.on(e,this.events[e])),this.listeners[e].push(a),this}unbind(){Object.keys(this.events).forEach(e=>{this.unbindEvent(e)})}unbindEvent(e,a){this.listeners[e]=this.listeners[e]||[],a&&(this.listeners[e]=this.listeners[e].filter(r=>r!==a)),(!a||this.listeners[e].length===0)&&(this.events[e]&&(this.socket.removeListener(e,this.events[e]),delete this.events[e]),delete this.listeners[e])}}class Gm extends Pm{whisper(e,a){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:a}),this}}class y_ extends Gm{here(e){return this.on("presence:subscribed",a=>{e(a.map(r=>r.user_info))}),this}joining(e){return this.on("presence:joining",a=>e(a.user_info)),this}whisper(e,a){return this.socket.emit("client event",{channel:this.name,event:`client-${e}`,data:a}),this}leaving(e){return this.on("presence:leaving",a=>e(a.user_info)),this}}class oc extends ef{subscribe(){}unsubscribe(){}listen(e,a){return this}listenToAll(e){return this}stopListening(e,a){return this}subscribed(e){return this}error(e){return this}on(e,a){return this}}class Vm extends oc{whisper(e,a){return this}}class b_ extends oc{whisper(e,a){return this}}class v_ extends Vm{here(e){return this}joining(e){return this}whisper(e,a){return this}leaving(e){return this}}const Fm=class _S{constructor(e){this.setOptions(e),this.connect()}setOptions(e){this.options={..._S._defaultOptions,...e,broadcaster:e.broadcaster};let a=this.csrfToken();a&&(this.options.auth.headers["X-CSRF-TOKEN"]=a,this.options.userAuthentication.headers["X-CSRF-TOKEN"]=a),a=this.options.bearerToken,a&&(this.options.auth.headers.Authorization="Bearer "+a,this.options.userAuthentication.headers.Authorization="Bearer "+a)}csrfToken(){var e,a;return typeof window<"u"&&(e=window.Laravel)!=null&&e.csrfToken?window.Laravel.csrfToken:this.options.csrfToken?this.options.csrfToken:typeof document<"u"&&typeof document.querySelector=="function"?((a=document.querySelector('meta[name="csrf-token"]'))==null?void 0:a.getAttribute("content"))??null:null}};Fm._defaultOptions={auth:{headers:{}},authEndpoint:"/broadcasting/auth",userAuthentication:{endpoint:"/broadcasting/user-auth",headers:{}},csrfToken:null,bearerToken:null,host:null,key:null,namespace:"App.Events"};let nf=Fm;class lc extends nf{constructor(){super(...arguments),this.channels={}}connect(){if(typeof this.options.client<"u")this.pusher=this.options.client;else if(this.options.Pusher)this.pusher=new this.options.Pusher(this.options.key,this.options);else if(typeof window<"u"&&typeof window.Pusher<"u")this.pusher=new window.Pusher(this.options.key,this.options);else throw new Error("Pusher client not found. Should be globally available or passed via options.client")}signin(){this.pusher.signin()}listen(e,a,r){return this.channel(e).listen(a,r)}channel(e){return this.channels[e]||(this.channels[e]=new tf(this.pusher,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new qm(this.pusher,"private-"+e,this.options)),this.channels["private-"+e]}encryptedPrivateChannel(e){return this.channels["private-encrypted-"+e]||(this.channels["private-encrypted-"+e]=new p_(this.pusher,"private-encrypted-"+e,this.options)),this.channels["private-encrypted-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new m_(this.pusher,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"private-encrypted-"+e,"presence-"+e].forEach(a=>{this.leaveChannel(a)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.pusher.connection.socket_id}connectionStatus(){const e=this.pusher.connection.state;switch(e){case"connected":case"connecting":return e;case"failed":case"unavailable":return"failed";default:return"disconnected"}}onConnectionChange(e){const a=()=>{e(this.connectionStatus())},r=["state_change","connected","disconnected"];return r.forEach(i=>{this.pusher.connection.bind(i,a)}),()=>{r.forEach(i=>{this.pusher.connection.unbind(i,a)})}}disconnect(){this.pusher.disconnect()}}class S_ extends nf{constructor(){super(...arguments),this.channels={}}connect(){let e=this.getSocketIO();this.socket=e(this.options.host??void 0,this.options),this.socket.io.on("reconnect",()=>{Object.values(this.channels).forEach(a=>{a.subscribe()})})}getSocketIO(){if(typeof this.options.client<"u")return this.options.client;if(typeof window<"u"&&typeof window.io<"u")return window.io;throw new Error("Socket.io client not found. Should be globally available or passed via options.client")}listen(e,a,r){return this.channel(e).listen(a,r)}channel(e){return this.channels[e]||(this.channels[e]=new Pm(this.socket,e,this.options)),this.channels[e]}privateChannel(e){return this.channels["private-"+e]||(this.channels["private-"+e]=new Gm(this.socket,"private-"+e,this.options)),this.channels["private-"+e]}presenceChannel(e){return this.channels["presence-"+e]||(this.channels["presence-"+e]=new y_(this.socket,"presence-"+e,this.options)),this.channels["presence-"+e]}leave(e){[e,"private-"+e,"presence-"+e].forEach(a=>{this.leaveChannel(a)})}leaveChannel(e){this.channels[e]&&(this.channels[e].unsubscribe(),delete this.channels[e])}socketId(){return this.socket.id}connectionStatus(){return this.socket.connected?"connected":this.socket.io._reconnecting?"reconnecting":this.socket.id!==void 0?"disconnected":"connecting"}onConnectionChange(e){const a=()=>{e(this.connectionStatus())},r=["connect","disconnect","connect_error","reconnect_attempt","reconnect","reconnect_error","reconnect_failed"];return r.forEach(i=>{this.socket.on(i,a)}),()=>{r.forEach(i=>{this.socket.off(i,a)})}}disconnect(){this.socket.disconnect()}}class Km extends nf{constructor(){super(...arguments),this.channels={}}connect(){}listen(e,a,r){return new oc}channel(e){return new oc}privateChannel(e){return new Vm}encryptedPrivateChannel(e){return new b_}presenceChannel(e){return new v_}leave(e){}leaveChannel(e){}socketId(){return"fake-socket-id"}connectionStatus(){return"connected"}onConnectionChange(e){return()=>{}}disconnect(){}}class w_{constructor(e){this.options=e,this.connect(),this.options.withoutInterceptors||this.registerInterceptors()}channel(e){return this.connector.channel(e)}connect(){if(this.options.broadcaster==="reverb")this.connector=new lc({...this.options,cluster:""});else if(this.options.broadcaster==="pusher")this.connector=new lc(this.options);else if(this.options.broadcaster==="ably")this.connector=new lc({...this.options,cluster:"",broadcaster:"pusher"});else if(this.options.broadcaster==="socket.io")this.connector=new S_(this.options);else if(this.options.broadcaster==="null")this.connector=new Km(this.options);else if(typeof this.options.broadcaster=="function"&&g_(this.options.broadcaster))this.connector=new this.options.broadcaster(this.options);else throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} is not supported.`)}disconnect(){this.connector.disconnect()}join(e){return this.connector.presenceChannel(e)}leave(e){this.connector.leave(e)}leaveChannel(e){this.connector.leaveChannel(e)}leaveAllChannels(){for(const e in this.connector.channels)this.leaveChannel(e)}listen(e,a,r){return this.connector.listen(e,a,r)}private(e){return this.connector.privateChannel(e)}encryptedPrivate(e){if(this.connectorSupportsEncryptedPrivateChannels(this.connector))return this.connector.encryptedPrivateChannel(e);throw new Error(`Broadcaster ${typeof this.options.broadcaster} ${String(this.options.broadcaster)} does not support encrypted private channels.`)}connectorSupportsEncryptedPrivateChannels(e){return e instanceof lc||e instanceof Km}socketId(){return this.connector.socketId()}connectionStatus(){return this.connector.connectionStatus()}registerInterceptors(){typeof Vue<"u"&&Vue!=null&&Vue.http&&this.registerVueRequestInterceptor(),typeof axios=="function"&&this.registerAxiosRequestInterceptor(),typeof jQuery=="function"&&this.registerjQueryAjaxSetup(),typeof Turbo=="object"&&this.registerTurboRequestInterceptor()}registerVueRequestInterceptor(){Vue.http.interceptors.push((e,a)=>{this.socketId()&&e.headers.set("X-Socket-ID",this.socketId()),a()})}registerAxiosRequestInterceptor(){axios.interceptors.request.use(e=>(this.socketId()&&(e.headers["X-Socket-Id"]=this.socketId()),e))}registerjQueryAjaxSetup(){typeof jQuery.ajax<"u"&&jQuery.ajaxPrefilter((e,a,r)=>{this.socketId()&&r.setRequestHeader("X-Socket-Id",this.socketId())})}registerTurboRequestInterceptor(){document.addEventListener("turbo:before-fetch-request",e=>{e.detail.fetchOptions.headers["X-Socket-Id"]=this.socketId()})}}var af={exports:{}};var Wm;function C_(){return Wm||(Wm=1,(function(o,e){(function(r,i){o.exports=i()})(self,()=>(()=>{var a={594(u,d){var f=this&&this.__extends||(function(){var M=function(R,D){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(U,j){U.__proto__=j}||function(U,j){for(var q in j)j.hasOwnProperty(q)&&(U[q]=j[q])},M(R,D)};return function(R,D){M(R,D);function U(){this.constructor=R}R.prototype=D===null?Object.create(D):(U.prototype=D.prototype,new U)}})();Object.defineProperty(d,"__esModule",{value:!0});var g=256,m=(function(){function M(R){R===void 0&&(R="="),this._paddingCharacter=R}return M.prototype.encodedLength=function(R){return this._paddingCharacter?(R+2)/3*4|0:(R*8+5)/6|0},M.prototype.encode=function(R){for(var D="",U=0;U<R.length-2;U+=3){var j=R[U]<<16|R[U+1]<<8|R[U+2];D+=this._encodeByte(j>>>18&63),D+=this._encodeByte(j>>>12&63),D+=this._encodeByte(j>>>6&63),D+=this._encodeByte(j>>>0&63)}var q=R.length-U;if(q>0){var j=R[U]<<16|(q===2?R[U+1]<<8:0);D+=this._encodeByte(j>>>18&63),D+=this._encodeByte(j>>>12&63),q===2?D+=this._encodeByte(j>>>6&63):D+=this._paddingCharacter||"",D+=this._paddingCharacter||""}return D},M.prototype.maxDecodedLength=function(R){return this._paddingCharacter?R/4*3|0:(R*6+7)/8|0},M.prototype.decodedLength=function(R){return this.maxDecodedLength(R.length-this._getPaddingLength(R))},M.prototype.decode=function(R){if(R.length===0)return new Uint8Array(0);for(var D=this._getPaddingLength(R),U=R.length-D,j=new Uint8Array(this.maxDecodedLength(U)),q=0,X=0,ge=0,Ee=0,Ce=0,$e=0,qe=0;X<U-4;X+=4)Ee=this._decodeChar(R.charCodeAt(X+0)),Ce=this._decodeChar(R.charCodeAt(X+1)),$e=this._decodeChar(R.charCodeAt(X+2)),qe=this._decodeChar(R.charCodeAt(X+3)),j[q++]=Ee<<2|Ce>>>4,j[q++]=Ce<<4|$e>>>2,j[q++]=$e<<6|qe,ge|=Ee&g,ge|=Ce&g,ge|=$e&g,ge|=qe&g;if(X<U-1&&(Ee=this._decodeChar(R.charCodeAt(X)),Ce=this._decodeChar(R.charCodeAt(X+1)),j[q++]=Ee<<2|Ce>>>4,ge|=Ee&g,ge|=Ce&g),X<U-2&&($e=this._decodeChar(R.charCodeAt(X+2)),j[q++]=Ce<<4|$e>>>2,ge|=$e&g),X<U-3&&(qe=this._decodeChar(R.charCodeAt(X+3)),j[q++]=$e<<6|qe,ge|=qe&g),ge!==0)throw new Error("Base64Coder: incorrect characters for decoding");return j},M.prototype._encodeByte=function(R){var D=R;return D+=65,D+=25-R>>>8&6,D+=51-R>>>8&-75,D+=61-R>>>8&-15,D+=62-R>>>8&3,String.fromCharCode(D)},M.prototype._decodeChar=function(R){var D=g;return D+=(42-R&R-44)>>>8&-g+R-43+62,D+=(46-R&R-48)>>>8&-g+R-47+63,D+=(47-R&R-58)>>>8&-g+R-48+52,D+=(64-R&R-91)>>>8&-g+R-65+0,D+=(96-R&R-123)>>>8&-g+R-97+26,D},M.prototype._getPaddingLength=function(R){var D=0;if(this._paddingCharacter){for(var U=R.length-1;U>=0&&R[U]===this._paddingCharacter;U--)D++;if(R.length<4||D>2)throw new Error("Base64Coder: incorrect padding")}return D},M})();d.Coder=m;var b=new m;function v(M){return b.encode(M)}d.encode=v;function S(M){return b.decode(M)}d.decode=S;var E=(function(M){f(R,M);function R(){return M!==null&&M.apply(this,arguments)||this}return R.prototype._encodeByte=function(D){var U=D;return U+=65,U+=25-D>>>8&6,U+=51-D>>>8&-75,U+=61-D>>>8&-13,U+=62-D>>>8&49,String.fromCharCode(U)},R.prototype._decodeChar=function(D){var U=g;return U+=(44-D&D-46)>>>8&-g+D-45+62,U+=(94-D&D-96)>>>8&-g+D-95+63,U+=(47-D&D-58)>>>8&-g+D-48+52,U+=(64-D&D-91)>>>8&-g+D-65+0,U+=(96-D&D-123)>>>8&-g+D-97+26,U},R})(m);d.URLSafeCoder=E;var A=new E;function T(M){return A.encode(M)}d.encodeURLSafe=T;function L(M){return A.decode(M)}d.decodeURLSafe=L,d.encodedLength=function(M){return b.encodedLength(M)},d.maxDecodedLength=function(M){return b.maxDecodedLength(M)},d.decodedLength=function(M){return b.decodedLength(M)}},978(u,d){var f="utf8: invalid source encoding";function g(m){for(var b=[],v=0;v<m.length;v++){var S=m[v];if(S&128){var E=void 0;if(S<224){if(v>=m.length)throw new Error(f);var A=m[++v];if((A&192)!==128)throw new Error(f);S=(S&31)<<6|A&63,E=128}else if(S<240){if(v>=m.length-1)throw new Error(f);var A=m[++v],T=m[++v];if((A&192)!==128||(T&192)!==128)throw new Error(f);S=(S&15)<<12|(A&63)<<6|T&63,E=2048}else if(S<248){if(v>=m.length-2)throw new Error(f);var A=m[++v],T=m[++v],L=m[++v];if((A&192)!==128||(T&192)!==128||(L&192)!==128)throw new Error(f);S=(S&15)<<18|(A&63)<<12|(T&63)<<6|L&63,E=65536}else throw new Error(f);if(S<E||S>=55296&&S<=57343)throw new Error(f);if(S>=65536){if(S>1114111)throw new Error(f);S-=65536,b.push(String.fromCharCode(55296|S>>10)),S=56320|S&1023}}b.push(String.fromCharCode(S))}return b.join("")}d.D4=g},721(u,d,f){u.exports=f(207).default},207(u,d,f){f.d(d,{default:()=>fs});class g{constructor(y,C){this.lastId=0,this.prefix=y,this.name=C}create(y){this.lastId++;var C=this.lastId,O=this.prefix+C,I=this.name+"["+C+"]",ne=!1,pe=function(){ne||(y.apply(null,arguments),ne=!0)};return this[C]=pe,{number:C,id:O,name:I,callback:pe}}remove(y){delete this[y.number]}}var m=new g("_pusher_script_","Pusher.ScriptReceivers"),b={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const v=b;class S{constructor(y){this.options=y,this.receivers=y.receivers||m,this.loading={}}load(y,C,O){var I=this;if(I.loading[y]&&I.loading[y].length>0)I.loading[y].push(O);else{I.loading[y]=[O];var ne=Be.createScriptRequest(I.getPath(y,C)),pe=I.receivers.create(function(Me){if(I.receivers.remove(pe),I.loading[y]){var Ve=I.loading[y];delete I.loading[y];for(var ot=function(Nt){Nt||ne.cleanup()},pt=0;pt<Ve.length;pt++)Ve[pt](Me,ot)}});ne.send(pe)}}getRoot(y){var C,O=Be.getDocument().location.protocol;return y&&y.useTLS||O==="https:"?C=this.options.cdn_https:C=this.options.cdn_http,C.replace(/\/*$/,"")+"/"+this.options.version}getPath(y,C){return this.getRoot(C)+"/"+y+this.options.suffix+".js"}}var E=new g("_pusher_dependencies","Pusher.DependenciesReceivers"),A=new S({cdn_http:v.cdn_http,cdn_https:v.cdn_https,version:v.VERSION,suffix:v.dependency_suffix,receivers:E});const T={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},M={buildLogSuffix:function(_){const y="See:",C=T.urls[_];if(!C)return"";let O;return C.fullUrl?O=C.fullUrl:C.path&&(O=T.baseUrl+C.path),O?`${y} ${O}`:""}};var R;(function(_){_.UserAuthentication="user-authentication",_.ChannelAuthorization="channel-authorization"})(R||(R={}));class D extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class j extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class q extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class X extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class ge extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class Ee extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class Ce extends Error{constructor(y){super(y),Object.setPrototypeOf(this,new.target.prototype)}}class $e extends Error{constructor(y,C){super(C),this.status=y,Object.setPrototypeOf(this,new.target.prototype)}}const Xe=function(_,y,C,O,I){const ne=Be.createXHR();ne.open("POST",C.endpoint,!0),ne.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var pe in C.headers)ne.setRequestHeader(pe,C.headers[pe]);if(C.headersProvider!=null){let Me=C.headersProvider();for(var pe in Me)ne.setRequestHeader(pe,Me[pe])}return ne.onreadystatechange=function(){if(ne.readyState===4)if(ne.status===200){let Me,Ve=!1;try{Me=JSON.parse(ne.responseText),Ve=!0}catch{I(new $e(200,`JSON returned from ${O.toString()} endpoint was invalid, yet status code was 200. Data was: ${ne.responseText}`),null)}Ve&&I(null,Me)}else{let Me="";switch(O){case R.UserAuthentication:Me=M.buildLogSuffix("authenticationEndpoint");break;case R.ChannelAuthorization:Me=`Clients must be authorized to join private or presence channels. ${M.buildLogSuffix("authorizationEndpoint")}`;break}I(new $e(ne.status,`Unable to retrieve auth string from ${O.toString()} endpoint - received status: ${ne.status} from ${C.endpoint}. ${Me}`),null)}},ne.send(y),ne};function ht(_){return x(te(_))}var Q=String.fromCharCode,fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ye=function(_){var y=_.charCodeAt(0);return y<128?_:y<2048?Q(192|y>>>6)+Q(128|y&63):Q(224|y>>>12&15)+Q(128|y>>>6&63)+Q(128|y&63)},te=function(_){return _.replace(/[^\x00-\x7F]/g,ye)},he=function(_){var y=[0,2,1][_.length%3],C=_.charCodeAt(0)<<16|(_.length>1?_.charCodeAt(1):0)<<8|(_.length>2?_.charCodeAt(2):0),O=[fe.charAt(C>>>18),fe.charAt(C>>>12&63),y>=2?"=":fe.charAt(C>>>6&63),y>=1?"=":fe.charAt(C&63)];return O.join("")},x=window.btoa||function(_){return _.replace(/[\s\S]{1,3}/g,he)};class K{constructor(y,C,O,I){this.clear=C,this.timer=y(()=>{this.timer&&(this.timer=I(this.timer))},O)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const re=K;function de(_){window.clearTimeout(_)}function se(_){window.clearInterval(_)}class me extends re{constructor(y,C){super(setTimeout,de,y,function(O){return C(),null})}}class Ne extends re{constructor(y,C){super(setInterval,se,y,function(O){return C(),O})}}var ve={now(){return Date.now?Date.now():new Date().valueOf()},defer(_){return new me(0,_)},method(_,...y){var C=Array.prototype.slice.call(arguments,1);return function(O){return O[_].apply(O,C.concat(arguments))}}};const He=ve;function Ae(_,...y){for(var C=0;C<y.length;C++){var O=y[C];for(var I in O)O[I]&&O[I].constructor&&O[I].constructor===Object?_[I]=Ae(_[I]||{},O[I]):_[I]=O[I]}return _}function Et(){for(var _=["Pusher"],y=0;y<arguments.length;y++)typeof arguments[y]=="string"?_.push(arguments[y]):_.push(bn(arguments[y]));return _.join(" : ")}function Rt(_,y){var C=Array.prototype.indexOf;if(_===null)return-1;if(C&&_.indexOf===C)return _.indexOf(y);for(var O=0,I=_.length;O<I;O++)if(_[O]===y)return O;return-1}function _t(_,y){for(var C in _)Object.prototype.hasOwnProperty.call(_,C)&&y(_[C],C,_)}function ft(_){var y=[];return _t(_,function(C,O){y.push(O)}),y}function un(_){var y=[];return _t(_,function(C){y.push(C)}),y}function gt(_,y,C){for(var O=0;O<_.length;O++)y.call(C||window,_[O],O,_)}function za(_,y){for(var C=[],O=0;O<_.length;O++)C.push(y(_[O],O,_,C));return C}function kn(_,y){var C={};return _t(_,function(O,I){C[I]=y(O)}),C}function Dn(_,y){y=y||function(I){return!!I};for(var C=[],O=0;O<_.length;O++)y(_[O],O,_,C)&&C.push(_[O]);return C}function jt(_,y){var C={};return _t(_,function(O,I){(y&&y(O,I,_,C)||O)&&(C[I]=O)}),C}function On(_){var y=[];return _t(_,function(C,O){y.push([O,C])}),y}function ea(_,y){for(var C=0;C<_.length;C++)if(y(_[C],C,_))return!0;return!1}function ja(_,y){for(var C=0;C<_.length;C++)if(!y(_[C],C,_))return!1;return!0}function Ft(_){return kn(_,function(y){return typeof y=="object"&&(y=bn(y)),encodeURIComponent(ht(y.toString()))})}function Rr(_){var y=jt(_,function(O){return O!==void 0}),C=za(On(Ft(y)),He.method("join","=")).join("&");return C}function Za(_){var y=[],C=[];return(function O(I,ne){var pe,Me,Ve;switch(typeof I){case"object":if(!I)return null;for(pe=0;pe<y.length;pe+=1)if(y[pe]===I)return{$ref:C[pe]};if(y.push(I),C.push(ne),Object.prototype.toString.apply(I)==="[object Array]")for(Ve=[],pe=0;pe<I.length;pe+=1)Ve[pe]=O(I[pe],ne+"["+pe+"]");else{Ve={};for(Me in I)Object.prototype.hasOwnProperty.call(I,Me)&&(Ve[Me]=O(I[Me],ne+"["+JSON.stringify(Me)+"]"))}return Ve;case"number":case"string":case"boolean":return I}})(_,"$")}function bn(_){try{return JSON.stringify(_)}catch{return JSON.stringify(Za(_))}}class en{constructor(){this.globalLog=y=>{window.console&&window.console.log&&window.console.log(y)}}debug(...y){this.log(this.globalLog,y)}warn(...y){this.log(this.globalLogWarn,y)}error(...y){this.log(this.globalLogError,y)}globalLogWarn(y){window.console&&window.console.warn?window.console.warn(y):this.globalLog(y)}globalLogError(y){window.console&&window.console.error?window.console.error(y):this.globalLogWarn(y)}log(y,...C){var O=Et.apply(this,arguments);fs.log?fs.log(O):fs.logToConsole&&y.bind(this)(O)}}const et=new en;var ta=function(_,y,C,O,I){(C.headers!==void 0||C.headersProvider!=null)&&et.warn(`To send headers with the ${O.toString()} request, you must use AJAX, rather than JSONP.`);var ne=_.nextAuthCallbackID.toString();_.nextAuthCallbackID++;var pe=_.getDocument(),Me=pe.createElement("script");_.auth_callbacks[ne]=function(pt){I(null,pt)};var Ve="Pusher.auth_callbacks['"+ne+"']";Me.src=C.endpoint+"?callback="+encodeURIComponent(Ve)+"&"+y;var ot=pe.getElementsByTagName("head")[0]||pe.documentElement;ot.insertBefore(Me,ot.firstChild)};const En=ta;class er{constructor(y){this.src=y}send(y){var C=this,O="Error loading "+C.src;C.script=document.createElement("script"),C.script.id=y.id,C.script.src=C.src,C.script.type="text/javascript",C.script.charset="UTF-8",C.script.addEventListener?(C.script.onerror=function(){y.callback(O)},C.script.onload=function(){y.callback(null)}):C.script.onreadystatechange=function(){(C.script.readyState==="loaded"||C.script.readyState==="complete")&&y.callback(null)},C.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(C.errorScript=document.createElement("script"),C.errorScript.id=y.id+"_error",C.errorScript.text=y.name+"('"+O+"');",C.script.async=C.errorScript.async=!1):C.script.async=!0;var I=document.getElementsByTagName("head")[0];I.insertBefore(C.script,I.firstChild),C.errorScript&&I.insertBefore(C.errorScript,C.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class Ea{constructor(y,C){this.url=y,this.data=C}send(y){if(!this.request){var C=Rr(this.data),O=this.url+"/"+y.number+"?"+C;this.request=Be.createScriptRequest(O),this.request.send(y)}}cleanup(){this.request&&this.request.cleanup()}}var tn=function(_,y){return function(C,O){var I="http"+(y?"s":"")+"://",ne=I+(_.host||_.options.host)+_.options.path,pe=Be.createJSONPRequest(ne,C),Me=Be.ScriptReceivers.create(function(Ve,ot){m.remove(Me),pe.cleanup(),ot&&ot.host&&(_.host=ot.host),O&&O(Ve,ot)});pe.send(Me)}},_n={name:"jsonp",getAgent:tn};const P=_n;function ce(_,y,C){var O=_+(y.useTLS?"s":""),I=y.useTLS?y.hostTLS:y.hostNonTLS;return O+"://"+I+C}function le(_,y){var C="/app/"+_,O="?protocol="+v.PROTOCOL+"&client=js&version="+v.VERSION+(y?"&"+y:"");return C+O}var Z={getInitial:function(_,y){var C=(y.httpPath||"")+le(_,"flash=false");return ce("ws",y,C)}},be={getInitial:function(_,y){var C=(y.httpPath||"/pusher")+le(_);return ce("http",y,C)}},Se={getInitial:function(_,y){return ce("http",y,y.httpPath||"/pusher")},getPath:function(_,y){return le(_)}};class Re{constructor(){this._callbacks={}}get(y){return this._callbacks[xe(y)]}add(y,C,O){var I=xe(y);this._callbacks[I]=this._callbacks[I]||[],this._callbacks[I].push({fn:C,context:O})}remove(y,C,O){if(!y&&!C&&!O){this._callbacks={};return}var I=y?[xe(y)]:ft(this._callbacks);C||O?this.removeCallback(I,C,O):this.removeAllCallbacks(I)}removeCallback(y,C,O){gt(y,function(I){this._callbacks[I]=Dn(this._callbacks[I]||[],function(ne){return C&&C!==ne.fn||O&&O!==ne.context}),this._callbacks[I].length===0&&delete this._callbacks[I]},this)}removeAllCallbacks(y){gt(y,function(C){delete this._callbacks[C]},this)}}function xe(_){return"_"+_}class je{constructor(y){this.callbacks=new Re,this.global_callbacks=[],this.failThrough=y}bind(y,C,O){return this.callbacks.add(y,C,O),this}bind_global(y){return this.global_callbacks.push(y),this}unbind(y,C,O){return this.callbacks.remove(y,C,O),this}unbind_global(y){return y?(this.global_callbacks=Dn(this.global_callbacks||[],C=>C!==y),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(y,C,O){for(var I=0;I<this.global_callbacks.length;I++)this.global_callbacks[I](y,C);var ne=this.callbacks.get(y),pe=[];if(O?pe.push(C,O):C&&pe.push(C),ne&&ne.length>0)for(var I=0;I<ne.length;I++)ne[I].fn.apply(ne[I].context||window,pe);else this.failThrough&&this.failThrough(y,C);return this}}class ze extends je{constructor(y,C,O,I,ne){super(),this.initialize=Be.transportConnectionInitializer,this.hooks=y,this.name=C,this.priority=O,this.key=I,this.options=ne,this.state="new",this.timeline=ne.timeline,this.activityTimeout=ne.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var y=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(y,this.options)}catch(C){return He.defer(()=>{this.onError(C),this.changeState("closed")}),!1}return this.bindListeners(),et.debug("Connecting",{transport:this.name,url:y}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(y){return this.state==="open"?(He.defer(()=>{this.socket&&this.socket.send(y)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(y){this.emit("error",{type:"WebSocketError",error:y}),this.timeline.error(this.buildTimelineMessage({error:y.toString()}))}onClose(y){y?this.changeState("closed",{code:y.code,reason:y.reason,wasClean:y.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(y){this.emit("message",y)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=y=>{this.onError(y)},this.socket.onclose=y=>{this.onClose(y)},this.socket.onmessage=y=>{this.onMessage(y)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(y,C){this.state=y,this.timeline.info(this.buildTimelineMessage({state:y,params:C})),this.emit(y,C)}buildTimelineMessage(y){return Ae({cid:this.id},y)}}class Le{constructor(y){this.hooks=y}isSupported(y){return this.hooks.isSupported(y)}createConnection(y,C,O,I){return new ze(this.hooks,y,C,O,I)}}var ke=new Le({urls:Z,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!Be.getWebSocketAPI()},isSupported:function(){return!!Be.getWebSocketAPI()},getSocket:function(_){return Be.createWebSocket(_)}}),We={urls:be,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Fe=Ae({getSocket:function(_){return Be.HTTPFactory.createStreamingSocket(_)}},We),_e=Ae({getSocket:function(_){return Be.HTTPFactory.createPollingSocket(_)}},We),Te={isSupported:function(){return Be.isXHRSupported()}},Ue=new Le(Ae({},Fe,Te)),st=new Le(Ae({},_e,Te)),Dt={ws:ke,xhr_streaming:Ue,xhr_polling:st};const nn=Dt;var Kt=new Le({file:"sockjs",urls:Se,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(_,y){return new window.SockJS(_,null,{js_path:A.getPath("sockjs",{useTLS:y.useTLS}),ignore_null_origin:y.ignoreNullOrigin})},beforeOpen:function(_,y){_.send(JSON.stringify({path:y}))}}),Pn={isSupported:function(_){var y=Be.isXDRSupported(_.useTLS);return y}},Ln=new Le(Ae({},Fe,Pn)),an=new Le(Ae({},_e,Pn));nn.xdr_streaming=Ln,nn.xdr_polling=an,nn.sockjs=Kt;const vn=nn;class kr extends je{constructor(){super();var y=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){y.emit("online")},!1),window.addEventListener("offline",function(){y.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var _o=new kr;class df{constructor(y,C,O){this.manager=y,this.transport=C,this.minPingDelay=O.minPingDelay,this.maxPingDelay=O.maxPingDelay,this.pingDelay=void 0}createConnection(y,C,O,I){I=Ae({},I,{activityTimeout:this.pingDelay});var ne=this.transport.createConnection(y,C,O,I),pe=null,Me=function(){ne.unbind("open",Me),ne.bind("closed",Ve),pe=He.now()},Ve=ot=>{if(ne.unbind("closed",Ve),ot.code===1002||ot.code===1003)this.manager.reportDeath();else if(!ot.wasClean&&pe){var pt=He.now()-pe;pt<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(pt/2,this.minPingDelay))}};return ne.bind("open",Me),ne}isSupported(y){return this.manager.isAlive()&&this.transport.isSupported(y)}}const pc={decodeMessage:function(_){try{var y=JSON.parse(_.data),C=y.data;if(typeof C=="string")try{C=JSON.parse(y.data)}catch{}var O={event:y.event,channel:y.channel,data:C};return y.user_id&&(O.user_id=y.user_id),O}catch(I){throw{type:"MessageParseError",error:I,data:_.data}}},encodeMessage:function(_){return JSON.stringify(_)},processHandshake:function(_){var y=pc.decodeMessage(_);if(y.event==="pusher:connection_established"){if(!y.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:y.data.socket_id,activityTimeout:y.data.activity_timeout*1e3}}else{if(y.event==="pusher:error")return{action:this.getCloseAction(y.data),error:this.getCloseError(y.data)};throw"Invalid handshake"}},getCloseAction:function(_){return _.code<4e3?_.code>=1002&&_.code<=1004?"backoff":null:_.code===4e3?"tls_only":_.code<4100?"refused":_.code<4200?"backoff":_.code<4300?"retry":"refused"},getCloseError:function(_){return _.code!==1e3&&_.code!==1001?{type:"PusherError",data:{code:_.code,message:_.reason||_.message}}:null}},Ua=pc;class pi extends je{constructor(y,C){super(),this.id=y,this.transport=C,this.activityTimeout=C.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(y){return this.transport.send(y)}send_event(y,C,O){var I={event:y,data:C};return O&&(I.channel=O),et.debug("Event sent",I),this.send(Ua.encodeMessage(I))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var y={message:O=>{var I;try{I=Ua.decodeMessage(O)}catch(ne){this.emit("error",{type:"MessageParseError",error:ne,data:O.data})}if(I!==void 0){switch(et.debug("Event recd",I),I.event){case"pusher:error":this.emit("error",{type:"PusherError",data:I.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",I)}},activity:()=>{this.emit("activity")},error:O=>{this.emit("error",O)},closed:O=>{C(),O&&O.code&&this.handleCloseEvent(O),this.transport=null,this.emit("closed")}},C=()=>{_t(y,(O,I)=>{this.transport.unbind(I,O)})};_t(y,(O,I)=>{this.transport.bind(I,O)})}handleCloseEvent(y){var C=Ua.getCloseAction(y),O=Ua.getCloseError(y);O&&this.emit("error",O),C&&this.emit(C,{action:C,error:O})}}class Ao{constructor(y,C){this.transport=y,this.callback=C,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=y=>{this.unbindListeners();var C;try{C=Ua.processHandshake(y)}catch(O){this.finish("error",{error:O}),this.transport.close();return}C.action==="connected"?this.finish("connected",{connection:new pi(C.id,this.transport),activityTimeout:C.activityTimeout}):(this.finish(C.action,{error:C.error}),this.transport.close())},this.onClosed=y=>{this.unbindListeners();var C=Ua.getCloseAction(y)||"backoff",O=Ua.getCloseError(y);this.finish(C,{error:O})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(y,C){this.callback(Ae({transport:this.transport,action:y},C))}}class Dr{constructor(y,C){this.timeline=y,this.options=C||{}}send(y,C){this.timeline.isEmpty()||this.timeline.send(Be.TimelineTransport.getAgent(this,y),C)}}class Ba extends je{constructor(y,C){super(function(O,I){et.debug("No callbacks on "+y+" for "+O)}),this.name=y,this.pusher=C,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(y,C){return C(null,{auth:""})}trigger(y,C){if(y.indexOf("client-")!==0)throw new D("Event '"+y+"' does not start with 'client-'");if(!this.subscribed){var O=M.buildLogSuffix("triggeringClientEvents");et.warn(`Client event triggered before channel 'subscription_succeeded' event . ${O}`)}return this.pusher.send_event(y,C,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(y){var C=y.event,O=y.data;if(C==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(y);else if(C==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(y);else if(C.indexOf("pusher_internal:")!==0){var I={};this.emit(C,O,I)}}handleSubscriptionSucceededEvent(y){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",y.data)}handleSubscriptionCountEvent(y){y.data.subscription_count&&(this.subscriptionCount=y.data.subscription_count),this.emit("pusher:subscription_count",y.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(y,C)=>{y?(this.subscriptionPending=!1,et.error(y.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:y.message},y instanceof $e?{status:y.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:C.auth,channel_data:C.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class tr extends Ba{authorize(y,C){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:y},C)}}class Or{constructor(){this.reset()}get(y){return Object.prototype.hasOwnProperty.call(this.members,y)?{id:y,info:this.members[y]}:null}each(y){_t(this.members,(C,O)=>{y(this.get(O))})}setMyID(y){this.myID=y}onSubscription(y){this.members=y.presence.hash,this.count=y.presence.count,this.me=this.get(this.myID)}addMember(y){return this.get(y.user_id)===null&&this.count++,this.members[y.user_id]=y.user_info,this.get(y.user_id)}removeMember(y){var C=this.get(y.user_id);return C&&(delete this.members[y.user_id],this.count--),C}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Wt=function(_,y,C,O){function I(ne){return ne instanceof C?ne:new C(function(pe){pe(ne)})}return new(C||(C=Promise))(function(ne,pe){function Me(pt){try{ot(O.next(pt))}catch(Nt){pe(Nt)}}function Ve(pt){try{ot(O.throw(pt))}catch(Nt){pe(Nt)}}function ot(pt){pt.done?ne(pt.value):I(pt.value).then(Me,Ve)}ot((O=O.apply(_,y||[])).next())})};class mc extends tr{constructor(y,C){super(y,C),this.members=new Or}authorize(y,C){super.authorize(y,(O,I)=>Wt(this,void 0,void 0,function*(){if(!O)if(I=I,I.channel_data!=null){var ne=JSON.parse(I.channel_data);this.members.setMyID(ne.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let pe=M.buildLogSuffix("authorizationEndpoint");et.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${pe}, or the user should be signed in.`),C("Invalid auth response");return}C(O,I)}))}handleEvent(y){var C=y.event;if(C.indexOf("pusher_internal:")===0)this.handleInternalEvent(y);else{var O=y.data,I={};y.user_id&&(I.user_id=y.user_id),this.emit(C,O,I)}}handleInternalEvent(y){var C=y.event,O=y.data;switch(C){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(y);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(y);break;case"pusher_internal:member_added":var I=this.members.addMember(O);this.emit("pusher:member_added",I);break;case"pusher_internal:member_removed":var ne=this.members.removeMember(O);ne&&this.emit("pusher:member_removed",ne);break}}handleSubscriptionSucceededEvent(y){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(y.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var yc=f(978),_a=f(594);class Lr extends tr{constructor(y,C,O){super(y,C),this.key=null,this.nacl=O}authorize(y,C){super.authorize(y,(O,I)=>{if(O){C(O,I);return}let ne=I.shared_secret;if(!ne){C(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,_a.decode)(ne),delete I.shared_secret,C(null,I)})}trigger(y,C){throw new ge("Client events are not currently supported for encrypted channels")}handleEvent(y){var C=y.event,O=y.data;if(C.indexOf("pusher_internal:")===0||C.indexOf("pusher:")===0){super.handleEvent(y);return}this.handleEncryptedEvent(C,O)}handleEncryptedEvent(y,C){if(!this.key){et.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!C.ciphertext||!C.nonce){et.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+C);return}let O=(0,_a.decode)(C.ciphertext);if(O.length<this.nacl.secretbox.overheadLength){et.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${O.length}`);return}let I=(0,_a.decode)(C.nonce);if(I.length<this.nacl.secretbox.nonceLength){et.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${I.length}`);return}let ne=this.nacl.secretbox.open(O,I,this.key);if(ne===null){et.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(pe,Me)=>{if(pe){et.error(`Failed to make a request to the authEndpoint: ${Me}. Unable to fetch new key, so dropping encrypted event`);return}if(ne=this.nacl.secretbox.open(O,I,this.key),ne===null){et.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(y,this.getDataToEmit(ne))});return}this.emit(y,this.getDataToEmit(ne))}getDataToEmit(y){let C=(0,yc.D4)(y);try{return JSON.parse(C)}catch{return C}}}class ff extends je{constructor(y,C){super(),this.state="initialized",this.connection=null,this.key=y,this.options=C,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var O=Be.getNetwork();O.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),O.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(y){this.key=y,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(y){return this.connection?this.connection.send(y):!1}send_event(y,C,O){return this.connection?this.connection.send_event(y,C,O):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var y=(C,O)=>{C?this.runner=this.strategy.connect(0,y):O.action==="error"?(this.emit("error",{type:"HandshakeError",error:O.error}),this.timeline.error({handshakeError:O.error})):(this.abortConnecting(),this.handshakeCallbacks[O.action](O))};this.runner=this.strategy.connect(0,y)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var y=this.abandonConnection();y.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(y){this.timeline.info({action:"retry",delay:y}),y>0&&this.emit("connecting_in",Math.round(y/1e3)),this.retryTimer=new me(y||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new me(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new me(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new me(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(y){return Ae({},y,{message:C=>{this.resetActivityCheck(),this.emit("message",C)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:C=>{this.emit("error",C)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(y){return Ae({},y,{connected:C=>{this.activityTimeout=Math.min(this.options.activityTimeout,C.activityTimeout,C.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(C.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let y=C=>O=>{O.error&&this.emit("error",{type:"WebSocketError",error:O.error}),C(O)};return{tls_only:y(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:y(()=>{this.disconnect()}),backoff:y(()=>{this.retryIn(1e3)}),retry:y(()=>{this.retryIn(0)})}}setConnection(y){this.connection=y;for(var C in this.connectionCallbacks)this.connection.bind(C,this.connectionCallbacks[C]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var y in this.connectionCallbacks)this.connection.unbind(y,this.connectionCallbacks[y]);var C=this.connection;return this.connection=null,C}}updateState(y,C){var O=this.state;if(this.state=y,O!==y){var I=y;I==="connected"&&(I+=" with new socket ID "+C.socket_id),et.debug("State changed",O+" -> "+I),this.timeline.info({state:y,params:C}),this.emit("state_change",{previous:O,current:y}),this.emit(y,C)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class bc{constructor(){this.channels={}}add(y,C){return this.channels[y]||(this.channels[y]=vc(y,C)),this.channels[y]}all(){return un(this.channels)}find(y){return this.channels[y]}remove(y){var C=this.channels[y];return delete this.channels[y],C}disconnect(){_t(this.channels,function(y){y.disconnect()})}}function vc(_,y){if(_.indexOf("private-encrypted-")===0){if(y.config.nacl)return Mn.createEncryptedChannel(_,y,y.config.nacl);let C="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",O=M.buildLogSuffix("encryptedChannelSupport");throw new ge(`${C}. ${O}`)}else{if(_.indexOf("private-")===0)return Mn.createPrivateChannel(_,y);if(_.indexOf("presence-")===0)return Mn.createPresenceChannel(_,y);if(_.indexOf("#")===0)throw new U('Cannot create a channel with name "'+_+'".');return Mn.createChannel(_,y)}}var hf={createChannels(){return new bc},createConnectionManager(_,y){return new ff(_,y)},createChannel(_,y){return new Ba(_,y)},createPrivateChannel(_,y){return new tr(_,y)},createPresenceChannel(_,y){return new mc(_,y)},createEncryptedChannel(_,y,C){return new Lr(_,y,C)},createTimelineSender(_,y){return new Dr(_,y)},createHandshake(_,y){return new Ao(_,y)},createAssistantToTheTransportManager(_,y,C){return new df(_,y,C)}};const Mn=hf;class mi{constructor(y){this.options=y||{},this.livesLeft=this.options.lives||1/0}getAssistant(y){return Mn.createAssistantToTheTransportManager(this,y,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class dn{constructor(y,C){this.strategies=y,this.loop=!!C.loop,this.failFast=!!C.failFast,this.timeout=C.timeout,this.timeoutLimit=C.timeoutLimit}isSupported(){return ea(this.strategies,He.method("isSupported"))}connect(y,C){var O=this.strategies,I=0,ne=this.timeout,pe=null,Me=(Ve,ot)=>{ot?C(null,ot):(I=I+1,this.loop&&(I=I%O.length),I<O.length?(ne&&(ne=ne*2,this.timeoutLimit&&(ne=Math.min(ne,this.timeoutLimit))),pe=this.tryStrategy(O[I],y,{timeout:ne,failFast:this.failFast},Me)):C(!0))};return pe=this.tryStrategy(O[I],y,{timeout:ne,failFast:this.failFast},Me),{abort:function(){pe.abort()},forceMinPriority:function(Ve){y=Ve,pe&&pe.forceMinPriority(Ve)}}}tryStrategy(y,C,O,I){var ne=null,pe=null;return O.timeout>0&&(ne=new me(O.timeout,function(){pe.abort(),I(!0)})),pe=y.connect(C,function(Me,Ve){Me&&ne&&ne.isRunning()&&!O.failFast||(ne&&ne.ensureAborted(),I(Me,Ve))}),{abort:function(){ne&&ne.ensureAborted(),pe.abort()},forceMinPriority:function(Me){pe.forceMinPriority(Me)}}}}class Sn{constructor(y){this.strategies=y}isSupported(){return ea(this.strategies,He.method("isSupported"))}connect(y,C){return Sc(this.strategies,y,function(O,I){return function(ne,pe){if(I[O].error=ne,ne){gf(I)&&C(!0);return}gt(I,function(Me){Me.forceMinPriority(pe.transport.priority)}),C(null,pe)}})}}function Sc(_,y,C){var O=za(_,function(I,ne,pe,Me){return I.connect(y,C(ne,Me))});return{abort:function(){gt(O,xo)},forceMinPriority:function(I){gt(O,function(ne){ne.forceMinPriority(I)})}}}function gf(_){return ja(_,function(y){return!!y.error})}function xo(_){!_.error&&!_.aborted&&(_.abort(),_.aborted=!0)}class wc{constructor(y,C,O){this.strategy=y,this.transports=C,this.ttl=O.ttl||18e5,this.usingTLS=O.useTLS,this.timeline=O.timeline}isSupported(){return this.strategy.isSupported()}connect(y,C){var O=this.usingTLS,I=pf(O),ne=I&&I.cacheSkipCount?I.cacheSkipCount:0,pe=[this.strategy];if(I&&I.timestamp+this.ttl>=He.now()){var Me=this.transports[I.transport];Me&&(["ws","wss"].includes(I.transport)||ne>3?(this.timeline.info({cached:!0,transport:I.transport,latency:I.latency}),pe.push(new dn([Me],{timeout:I.latency*2+1e3,failFast:!0}))):ne++)}var Ve=He.now(),ot=pe.pop().connect(y,function pt(Nt,Ra){Nt?(os(O),pe.length>0?(Ve=He.now(),ot=pe.pop().connect(y,pt)):C(Nt)):($n(O,Ra.transport.name,He.now()-Ve,ne),C(null,Ra))});return{abort:function(){ot.abort()},forceMinPriority:function(pt){y=pt,ot&&ot.forceMinPriority(pt)}}}}function Mr(_){return"pusherTransport"+(_?"TLS":"NonTLS")}function pf(_){var y=Be.getLocalStorage();if(y)try{var C=y[Mr(_)];if(C)return JSON.parse(C)}catch{os(_)}return null}function $n(_,y,C,O){var I=Be.getLocalStorage();if(I)try{I[Mr(_)]=bn({timestamp:He.now(),transport:y,latency:C,cacheSkipCount:O})}catch{}}function os(_){var y=Be.getLocalStorage();if(y)try{delete y[Mr(_)]}catch{}}class yi{constructor(y,{delay:C}){this.strategy=y,this.options={delay:C}}isSupported(){return this.strategy.isSupported()}connect(y,C){var O=this.strategy,I,ne=new me(this.options.delay,function(){I=O.connect(y,C)});return{abort:function(){ne.ensureAborted(),I&&I.abort()},forceMinPriority:function(pe){y=pe,I&&I.forceMinPriority(pe)}}}}class nr{constructor(y,C,O){this.test=y,this.trueBranch=C,this.falseBranch=O}isSupported(){var y=this.test()?this.trueBranch:this.falseBranch;return y.isSupported()}connect(y,C){var O=this.test()?this.trueBranch:this.falseBranch;return O.connect(y,C)}}class $r{constructor(y){this.strategy=y}isSupported(){return this.strategy.isSupported()}connect(y,C){var O=this.strategy.connect(y,function(I,ne){ne&&O.abort(),C(I,ne)});return O}}function Nr(_){return function(){return _.isSupported()}}var Cc=function(_,y,C){var O={};function I(Uo,Ic,Hc,If,Hf){var zc=C(_,Uo,Ic,Hc,If,Hf);return O[Uo]=zc,zc}var ne=Object.assign({},y,{hostNonTLS:_.wsHost+":"+_.wsPort,hostTLS:_.wsHost+":"+_.wssPort,httpPath:_.wsPath}),pe=Object.assign({},ne,{useTLS:!0}),Me=Object.assign({},y,{hostNonTLS:_.httpHost+":"+_.httpPort,hostTLS:_.httpHost+":"+_.httpsPort,httpPath:_.httpPath}),Ve={loop:!0,timeout:15e3,timeoutLimit:6e4},ot=new mi({minPingDelay:1e4,maxPingDelay:_.activityTimeout}),pt=new mi({lives:2,minPingDelay:1e4,maxPingDelay:_.activityTimeout}),Nt=I("ws","ws",3,ne,ot),Ra=I("wss","ws",3,pe,ot),Mf=I("sockjs","sockjs",1,Me),$c=I("xhr_streaming","xhr_streaming",1,Me,pt),$f=I("xdr_streaming","xdr_streaming",1,Me,pt),Ho=I("xhr_polling","xhr_polling",1,Me),Nc=I("xdr_polling","xdr_polling",1,Me),zr=new dn([Nt],Ve),Ei=new dn([Ra],Ve),Nf=new dn([Mf],Ve),_i=new dn([new nr(Nr($c),$c,$f)],Ve),zo=new dn([new nr(Nr(Ho),Ho,Nc)],Ve),jo=new dn([new nr(Nr(_i),new Sn([_i,new yi(zo,{delay:4e3})]),zo)],Ve),Ai=new nr(Nr(jo),jo,Nf),xi;return y.useTLS?xi=new Sn([zr,new yi(Ai,{delay:2e3})]):xi=new Sn([zr,new yi(Ei,{delay:2e3}),new yi(Ai,{delay:5e3})]),new wc(new $r(new nr(Nr(Nt),xi,Ai)),O,{ttl:18e5,timeline:y.timeline,useTLS:y.useTLS})};const Ir=Cc;function mf(){var _=this;_.timeline.info(_.buildTimelineMessage({transport:_.name+(_.options.useTLS?"s":"")})),_.hooks.isInitialized()?_.changeState("initialized"):_.hooks.file?(_.changeState("initializing"),A.load(_.hooks.file,{useTLS:_.options.useTLS},function(y,C){_.hooks.isInitialized()?(_.changeState("initialized"),C(!0)):(y&&_.onError(y),_.onClose(),C(!1))})):_.onClose()}var Ec={getRequest:function(_){var y=new window.XDomainRequest;return y.ontimeout=function(){_.emit("error",new j),_.close()},y.onerror=function(C){_.emit("error",C),_.close()},y.onprogress=function(){y.responseText&&y.responseText.length>0&&_.onChunk(200,y.responseText)},y.onload=function(){y.responseText&&y.responseText.length>0&&_.onChunk(200,y.responseText),_.emit("finished",200),_.close()},y},abortRequest:function(_){_.ontimeout=_.onerror=_.onprogress=_.onload=null,_.abort()}};const _c=Ec,To=256*1024;class yf extends je{constructor(y,C,O){super(),this.hooks=y,this.method=C,this.url=O}start(y){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},Be.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(y)}close(){this.unloader&&(Be.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(y,C){for(;;){var O=this.advanceBuffer(C);if(O)this.emit("chunk",{status:y,data:O});else break}this.isBufferTooLong(C)&&this.emit("buffer_too_long")}advanceBuffer(y){var C=y.slice(this.position),O=C.indexOf(`
`);return O!==-1?(this.position+=O+1,C.slice(0,O)):null}isBufferTooLong(y){return this.position===y.length&&y.length>To}}var Ro;(function(_){_[_.CONNECTING=0]="CONNECTING",_[_.OPEN=1]="OPEN",_[_.CLOSED=3]="CLOSED"})(Ro||(Ro={}));const na=Ro;var Aa=1;class ko{constructor(y,C){this.hooks=y,this.session=ls(1e3)+"/"+xc(8),this.location=Do(C),this.readyState=na.CONNECTING,this.openStream()}send(y){return this.sendRaw(JSON.stringify([y]))}ping(){this.hooks.sendHeartbeat(this)}close(y,C){this.onClose(y,C,!0)}sendRaw(y){if(this.readyState===na.OPEN)try{return Be.createSocketRequest("POST",ar(Hr(this.location,this.session))).start(y),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(y,C,O){this.closeStream(),this.readyState=na.CLOSED,this.onclose&&this.onclose({code:y,reason:C,wasClean:O})}onChunk(y){if(y.status===200){this.readyState===na.OPEN&&this.onActivity();var C,O=y.data.slice(0,1);switch(O){case"o":C=JSON.parse(y.data.slice(1)||"{}"),this.onOpen(C);break;case"a":C=JSON.parse(y.data.slice(1)||"[]");for(var I=0;I<C.length;I++)this.onEvent(C[I]);break;case"m":C=JSON.parse(y.data.slice(1)||"null"),this.onEvent(C);break;case"h":this.hooks.onHeartbeat(this);break;case"c":C=JSON.parse(y.data.slice(1)||"[]"),this.onClose(C[0],C[1],!0);break}}}onOpen(y){this.readyState===na.CONNECTING?(y&&y.hostname&&(this.location.base=Ac(this.location.base,y.hostname)),this.readyState=na.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(y){this.readyState===na.OPEN&&this.onmessage&&this.onmessage({data:y})}onActivity(){this.onactivity&&this.onactivity()}onError(y){this.onerror&&this.onerror(y)}openStream(){this.stream=Be.createSocketRequest("POST",ar(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",y=>{this.onChunk(y)}),this.stream.bind("finished",y=>{this.hooks.onFinished(this,y)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(y){He.defer(()=>{this.onError(y),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Do(_){var y=/([^\?]*)\/*(\??.*)/.exec(_);return{base:y[1],queryString:y[2]}}function Hr(_,y){return _.base+"/"+y+"/xhr_send"}function ar(_){var y=_.indexOf("?")===-1?"?":"&";return _+y+"t="+ +new Date+"&n="+Aa++}function Ac(_,y){var C=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(_);return C[1]+y+C[3]}function ls(_){return Be.randomInt(_)}function xc(_){for(var y=[],C=0;C<_;C++)y.push(ls(32).toString(32));return y.join("")}const bi=ko;var xa={getReceiveURL:function(_,y){return _.base+"/"+y+"/xhr_streaming"+_.queryString},onHeartbeat:function(_){_.sendRaw("[]")},sendHeartbeat:function(_){_.sendRaw("[]")},onFinished:function(_,y){_.onClose(1006,"Connection interrupted ("+y+")",!1)}};const Oo=xa;var vi={getReceiveURL:function(_,y){return _.base+"/"+y+"/xhr"+_.queryString},onHeartbeat:function(){},sendHeartbeat:function(_){_.sendRaw("[]")},onFinished:function(_,y){y===200?_.reconnect():_.onClose(1006,"Connection interrupted ("+y+")",!1)}};const qa=vi;var Lo={getRequest:function(_){var y=Be.getXHRAPI(),C=new y;return C.onreadystatechange=C.onprogress=function(){switch(C.readyState){case 3:C.responseText&&C.responseText.length>0&&_.onChunk(C.status,C.responseText);break;case 4:C.responseText&&C.responseText.length>0&&_.onChunk(C.status,C.responseText),_.emit("finished",C.status),_.close();break}},C},abortRequest:function(_){_.onreadystatechange=null,_.abort()}};const cs=Lo;var Tc={createStreamingSocket(_){return this.createSocket(Oo,_)},createPollingSocket(_){return this.createSocket(qa,_)},createSocket(_,y){return new bi(_,y)},createXHR(_,y){return this.createRequest(cs,_,y)},createRequest(_,y,C){return new yf(_,y,C)}};const Si=Tc;Si.createXDR=function(_,y){return this.createRequest(_c,_,y)};var Rc={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:m,DependenciesReceivers:E,getDefaultStrategy:Ir,Transports:vn,transportConnectionInitializer:mf,HTTPFactory:Si,TimelineTransport:P,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(_){window.Pusher=_;var y=()=>{this.onDocumentBody(_.ready)};window.JSON?y():A.load("json2",{},y)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Xe,jsonp:En}},onDocumentBody(_){document.body?_():setTimeout(()=>{this.onDocumentBody(_)},0)},createJSONPRequest(_,y){return new Ea(_,y)},createScriptRequest(_){return new er(_)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var _=this.getXHRAPI();return new _},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return _o},createWebSocket(_){var y=this.getWebSocketAPI();return new y(_)},createSocketRequest(_,y){if(this.isXHRSupported())return this.HTTPFactory.createXHR(_,y);if(this.isXDRSupported(y.indexOf("https:")===0))return this.HTTPFactory.createXDR(_,y);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var _=this.getXHRAPI();return!!_&&new _().withCredentials!==void 0},isXDRSupported(_){var y=_?"https:":"http:",C=this.getProtocol();return!!window.XDomainRequest&&C===y},addUnloadListener(_){window.addEventListener!==void 0?window.addEventListener("unload",_,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",_)},removeUnloadListener(_){window.addEventListener!==void 0?window.removeEventListener("unload",_,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",_)},randomInt(_){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*_)}};const Be=Rc;var Ta;(function(_){_[_.ERROR=3]="ERROR",_[_.INFO=6]="INFO",_[_.DEBUG=7]="DEBUG"})(Ta||(Ta={}));const rr=Ta;class wi{constructor(y,C,O){this.key=y,this.session=C,this.events=[],this.options=O||{},this.sent=0,this.uniqueID=0}log(y,C){y<=this.options.level&&(this.events.push(Ae({},C,{timestamp:He.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(y){this.log(rr.ERROR,y)}info(y){this.log(rr.INFO,y)}debug(y){this.log(rr.DEBUG,y)}isEmpty(){return this.events.length===0}send(y,C){var O=Ae({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],y(O,(I,ne)=>{I||this.sent++,C&&C(I,ne)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class bf{constructor(y,C,O,I){this.name=y,this.priority=C,this.transport=O,this.options=I||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(y,C){if(this.isSupported()){if(this.priority<y)return us(new q,C)}else return us(new Ce,C);var O=!1,I=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),ne=null,pe=function(){I.unbind("initialized",pe),I.connect()},Me=function(){ne=Mn.createHandshake(I,function(Nt){O=!0,pt(),C(null,Nt)})},Ve=function(Nt){pt(),C(Nt)},ot=function(){pt();var Nt;Nt=bn(I),C(new X(Nt))},pt=function(){I.unbind("initialized",pe),I.unbind("open",Me),I.unbind("error",Ve),I.unbind("closed",ot)};return I.bind("initialized",pe),I.bind("open",Me),I.bind("error",Ve),I.bind("closed",ot),I.initialize(),{abort:()=>{O||(pt(),ne?ne.close():I.close())},forceMinPriority:Nt=>{O||this.priority<Nt&&(ne?ne.close():I.close())}}}}function us(_,y){return He.defer(function(){y(_)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:$o}=Be;var Ci=function(_,y,C,O,I,ne){var pe=$o[C];if(!pe)throw new Ee(C);var Me=(!_.enabledTransports||Rt(_.enabledTransports,y)!==-1)&&(!_.disabledTransports||Rt(_.disabledTransports,y)===-1),Ve;return Me?(I=Object.assign({ignoreNullOrigin:_.ignoreNullOrigin},I),Ve=new bf(y,O,ne?ne.getAssistant(pe):pe,I)):Ve=ds,Ve},ds={isSupported:function(){return!1},connect:function(_,y){var C=He.defer(function(){y(new Ce)});return{abort:function(){C.ensureAborted()},forceMinPriority:function(){}}}};function kc(_){if(_==null)throw"You must pass an options object";if(_.cluster==null)throw"Options object must provide a cluster";"disableStats"in _&&et.warn("The disableStats option is deprecated in favor of enableStats")}const vf=(_,y)=>{var C="socket_id="+encodeURIComponent(_.socketId);for(var O in y.params)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(y.params[O]);if(y.paramsProvider!=null){let I=y.paramsProvider();for(var O in I)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(I[O])}return C},Sf=_=>{if(typeof Be.getAuthorizers()[_.transport]>"u")throw`'${_.transport}' is not a recognized auth transport`;return(y,C)=>{const O=vf(y,_);Be.getAuthorizers()[_.transport](Be,O,_,R.UserAuthentication,C)}},No=(_,y)=>{var C="socket_id="+encodeURIComponent(_.socketId);C+="&channel_name="+encodeURIComponent(_.channelName);for(var O in y.params)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(y.params[O]);if(y.paramsProvider!=null){let I=y.paramsProvider();for(var O in I)C+="&"+encodeURIComponent(O)+"="+encodeURIComponent(I[O])}return C},wf=_=>{if(typeof Be.getAuthorizers()[_.transport]>"u")throw`'${_.transport}' is not a recognized auth transport`;return(y,C)=>{const O=No(y,_);Be.getAuthorizers()[_.transport](Be,O,_,R.ChannelAuthorization,C)}},Cf=(_,y,C)=>{const O={authTransport:y.transport,authEndpoint:y.endpoint,auth:{params:y.params,headers:y.headers}};return(I,ne)=>{const pe=_.channel(I.channelName);C(pe,O).authorize(I.socketId,ne)}};function Dc(_,y){let C={activityTimeout:_.activityTimeout||v.activityTimeout,cluster:_.cluster,httpPath:_.httpPath||v.httpPath,httpPort:_.httpPort||v.httpPort,httpsPort:_.httpsPort||v.httpsPort,pongTimeout:_.pongTimeout||v.pongTimeout,statsHost:_.statsHost||v.stats_host,unavailableTimeout:_.unavailableTimeout||v.unavailableTimeout,wsPath:_.wsPath||v.wsPath,wsPort:_.wsPort||v.wsPort,wssPort:_.wssPort||v.wssPort,enableStats:xf(_),httpHost:Ef(_),useTLS:Af(_),wsHost:Oc(_),userAuthenticator:Io(_),channelAuthorizer:Rf(_,y)};return"disabledTransports"in _&&(C.disabledTransports=_.disabledTransports),"enabledTransports"in _&&(C.enabledTransports=_.enabledTransports),"ignoreNullOrigin"in _&&(C.ignoreNullOrigin=_.ignoreNullOrigin),"timelineParams"in _&&(C.timelineParams=_.timelineParams),"nacl"in _&&(C.nacl=_.nacl),C}function Ef(_){return _.httpHost?_.httpHost:_.cluster?`sockjs-${_.cluster}.pusher.com`:v.httpHost}function Oc(_){return _.wsHost?_.wsHost:_f(_.cluster)}function _f(_){return`ws-${_}.pusher.com`}function Af(_){return Be.getProtocol()==="https:"?!0:_.forceTLS!==!1}function xf(_){return"enableStats"in _?_.enableStats:"disableStats"in _?!_.disableStats:!1}const Lc=_=>"customHandler"in _&&_.customHandler!=null;function Io(_){const y=Object.assign(Object.assign({},v.userAuthentication),_.userAuthentication);return Lc(y)?y.customHandler:Sf(y)}function Tf(_,y){let C;if("channelAuthorization"in _)C=Object.assign(Object.assign({},v.channelAuthorization),_.channelAuthorization);else if(C={transport:_.authTransport||v.authTransport,endpoint:_.authEndpoint||v.authEndpoint},"auth"in _&&("params"in _.auth&&(C.params=_.auth.params),"headers"in _.auth&&(C.headers=_.auth.headers)),"authorizer"in _)return{customHandler:Cf(y,C,_.authorizer)};return C}function Rf(_,y){const C=Tf(_,y);return Lc(C)?C.customHandler:wf(C)}class kf extends je{constructor(y){super(function(C,O){et.debug(`No callbacks on watchlist events for ${C}`)}),this.pusher=y,this.bindWatchlistInternalEvent()}handleEvent(y){y.data.events.forEach(C=>{this.emit(C.name,C)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",y=>{var C=y.event;C==="pusher_internal:watchlist_events"&&this.handleEvent(y)})}}function Mc(){let _,y;return{promise:new Promise((O,I)=>{_=O,y=I}),resolve:_,reject:y}}const Df=Mc;class Of extends je{constructor(y){super(function(C,O){et.debug("No callbacks on user for "+C)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(C,O)=>{if(C){et.warn(`Error during signin: ${C}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:O.auth,user_data:O.user_data})},this.pusher=y,this.pusher.connection.bind("state_change",({previous:C,current:O})=>{C!=="connected"&&O==="connected"&&this._signin(),C==="connected"&&O!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new kf(y),this.pusher.connection.bind("message",C=>{var O=C.event;O==="pusher:signin_success"&&this._onSigninSuccess(C.data),this.serverToUserChannel&&this.serverToUserChannel.name===C.channel&&this.serverToUserChannel.handleEvent(C)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(y){try{this.user_data=JSON.parse(y.user_data)}catch{et.error(`Failed parsing user data after signin: ${y.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){et.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const y=C=>{C.subscriptionPending&&C.subscriptionCancelled?C.reinstateSubscription():!C.subscriptionPending&&this.pusher.connection.state==="connected"&&C.subscribe()};this.serverToUserChannel=new Ba(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((C,O)=>{C.indexOf("pusher_internal:")===0||C.indexOf("pusher:")===0||this.emit(C,O)}),y(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:y,resolve:C}=Df();y.done=!1;const O=()=>{y.done=!0};y.then(O).catch(O),this.signinDonePromise=y,this._signinDoneResolve=C}}class rn{static ready(){rn.isReady=!0;for(var y=0,C=rn.instances.length;y<C;y++)rn.instances[y].connect()}static getClientFeatures(){return ft(jt({ws:Be.Transports.ws},function(y){return y.isSupported({})}))}constructor(y,C){Lf(y),kc(C),this.key=y,this.options=C,this.config=Dc(this.options,this),this.channels=Mn.createChannels(),this.global_emitter=new je,this.sessionID=Be.randomInt(1e9),this.timeline=new wi(this.key,this.sessionID,{cluster:this.config.cluster,features:rn.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:rr.INFO,version:v.VERSION}),this.config.enableStats&&(this.timelineSender=Mn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+Be.TimelineTransport.name}));var O=I=>Be.getDefaultStrategy(this.config,I,Ci);this.connection=Mn.createConnectionManager(this.key,{getStrategy:O,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",I=>{var ne=I.event,pe=ne.indexOf("pusher_internal:")===0;if(I.channel){var Me=this.channel(I.channel);Me&&Me.handleEvent(I)}pe||this.global_emitter.emit(I.event,I.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",I=>{et.warn(I)}),rn.instances.push(this),this.timeline.info({instances:rn.instances.length}),this.user=new Of(this),rn.isReady&&this.connect()}switchCluster(y){const{appKey:C,cluster:O}=y;this.key=C,this.options=Object.assign(Object.assign({},this.options),{cluster:O}),this.config=Dc(this.options,this),this.connection.switchCluster(this.key)}channel(y){return this.channels.find(y)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var y=this.connection.isUsingTLS(),C=this.timelineSender;this.timelineSenderTimer=new Ne(6e4,function(){C.send(y)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(y,C,O){return this.global_emitter.bind(y,C,O),this}unbind(y,C,O){return this.global_emitter.unbind(y,C,O),this}bind_global(y){return this.global_emitter.bind_global(y),this}unbind_global(y){return this.global_emitter.unbind_global(y),this}unbind_all(y){return this.global_emitter.unbind_all(),this}subscribeAll(){var y;for(y in this.channels.channels)this.channels.channels.hasOwnProperty(y)&&this.subscribe(y)}subscribe(y){var C=this.channels.add(y,this);return C.subscriptionPending&&C.subscriptionCancelled?C.reinstateSubscription():!C.subscriptionPending&&this.connection.state==="connected"&&C.subscribe(),C}unsubscribe(y){var C=this.channels.find(y);C&&C.subscriptionPending?C.cancelSubscription():(C=this.channels.remove(y),C&&C.subscribed&&C.unsubscribe())}send_event(y,C,O){return this.connection.send_event(y,C,O)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}rn.instances=[],rn.isReady=!1,rn.logToConsole=!1,rn.Runtime=Be,rn.ScriptReceivers=Be.ScriptReceivers,rn.DependenciesReceivers=Be.DependenciesReceivers,rn.auth_callbacks=Be.auth_callbacks;const fs=rn;function Lf(_){if(_==null)throw"You must pass your app key when you instantiate Pusher."}Be.setup(rn)}},r={};function i(u){var d=r[u];if(d!==void 0)return d.exports;var f=r[u]={exports:{}};return a[u].call(f.exports,f,f.exports,i),f.exports}i.d=(u,d)=>{for(var f in d)i.o(d,f)&&!i.o(u,f)&&Object.defineProperty(u,f,{enumerable:!0,get:d[f]})},i.o=(u,d)=>Object.prototype.hasOwnProperty.call(u,d);var l=i(721);return l})())})(af)),af.exports}var E_=C_();const Ym=Wa(E_),Ht=ct("WebSocketManager");class __{constructor(){$(this,"echo",null);$(this,"subscriptions",new Map);$(this,"initialized",!1);$(this,"config",null)}configure(e){if(this.initialized){Ht.warn("[WebSocketManager] 이미 초기화되어 설정을 변경할 수 없습니다.");return}this.config=e,Ht.log("[WebSocketManager] 설정 완료:",{appKey:e.appKey?"***":"(없음)",host:e.host,port:e.port,scheme:e.scheme})}initialize(){if(this.initialized)return;if(!this.config||!this.config.appKey){Ht.warn("[WebSocketManager] WebSocket 설정이 없습니다. initTemplateApp에서 websocket 옵션을 전달해주세요.");return}const{appKey:e,host:a="localhost",port:r=80,scheme:i="https",authEndpoint:l="/api/broadcasting/auth"}=this.config,u=Number(r)||80,d=i==="https";Ht.log("[WebSocketManager] 연결 설정:",{host:a,port:u,scheme:i,useTLS:d,authEndpoint:l}),window.Pusher=Ym;const f=localStorage.getItem("auth_token"),g={wsHost:a,wsPort:u,wssPort:u,forceTLS:d,disableStats:!0,enabledTransports:["ws","wss"],cluster:"mt1",authEndpoint:l,auth:{headers:{Authorization:f?`Bearer ${f}`:"",Accept:"application/json"}}};Ht.log("[WebSocketManager] Pusher 옵션:",g);const m=new Ym(e,g);m.connection.bind("connecting",()=>{Ht.log("[WebSocketManager] 연결 시도 중...")}),m.connection.bind("connected",()=>{Ht.log("[WebSocketManager] 연결 성공! Socket ID:",m.connection.socket_id)}),m.connection.bind("failed",()=>{Ht.error("[WebSocketManager] 연결 실패 - WebSocket을 사용할 수 없습니다.")}),m.connection.bind("error",b=>{Ht.error("[WebSocketManager] 연결 오류:",b)}),m.connection.bind("state_change",b=>{Ht.log(`[WebSocketManager] 상태 변경: ${b.previous} → ${b.current}`)}),m.connection.bind("unavailable",()=>{Ht.error("[WebSocketManager] WebSocket 사용 불가 - 연결할 수 없습니다.")}),m.connection.bind("disconnected",()=>{Ht.warn("[WebSocketManager] 연결이 끊어졌습니다.")}),Ht.log("[WebSocketManager] 초기 연결 상태:",m.connection.state),this.echo=new w_({broadcaster:"reverb",client:m}),Ht.log("[WebSocketManager] 연결 시작 시도..."),m.connect(),window.Echo=this.echo,this.initialized=!0,Ht.log("[WebSocketManager] Echo 초기화 완료")}subscribe(e,a,r,i={}){if(this.initialize(),!this.echo)return Ht.warn("[WebSocketManager] Echo가 초기화되지 않았습니다."),"";const{channelType:l="private"}=i,u=`${e}:${a}`;if(this.subscriptions.has(u))return Ht.log(`[WebSocketManager] 이미 구독 중: ${u}`),u;let d;switch(l){case"public":d=this.echo.channel(e);break;case"presence":d=this.echo.join(e);break;default:d=this.echo.private(e)}return d.listen(`.${a}`,r),this.subscriptions.set(u,d),Ht.log(`[WebSocketManager] 구독 완료: ${u} (${l})`),u}unsubscribe(e){const a=this.subscriptions.get(e);if(!a)return;const r=e.lastIndexOf(":"),i=r>=0?e.substring(r+1):"";if(i)try{a.stopListening(`.${i}`)}catch(l){Ht.warn(`[WebSocketManager] stopListening 실패: ${e}`,l)}this.subscriptions.delete(e),Ht.log(`[WebSocketManager] 구독 해제: ${e}`)}leaveChannel(e){if(!this.echo)return;this.echo.leave(e);const a=[];this.subscriptions.forEach((r,i)=>{i.startsWith(`${e}:`)&&a.push(i)}),a.forEach(r=>this.subscriptions.delete(r)),Ht.log(`[WebSocketManager] 채널 구독 해제: ${e}`)}disconnect(){this.echo&&(this.echo.disconnect(),this.subscriptions.clear(),this.initialized=!1,Ht.log("[WebSocketManager] 연결 종료"))}getEcho(){return this.echo}isInitialized(){return this.initialized}isConfigured(){return this.config!==null&&!!this.config.appKey}getSubscriptionCount(){return this.subscriptions.size}}const cc=new __,bt=ct("DataSourceManager"),A_=new wn;function uc(o,e){const a=o.match(/^\{\{(.+)\}\}$/);if(a){const r=a[1].trim();try{return A_.evaluateExpression(r,e)}catch(i){return bt.error("Failed to evaluate param expression:",r,i),o}}return Ki(o,e,{skipCache:!0})}function Xm(o){const e={};for(const a of o.keys()){if(a in e)continue;const r=o.getAll(a);r.length>1?e[a]=r:r.length===1&&(a.endsWith("[]")?e[a]=r:e[a]=r[0])}return e}function x_(){try{return window.G7Core?.devTools}catch{return}}const gc=class gc{constructor(e={}){$(this,"options");$(this,"dataCache",new Map);$(this,"bindingEngine");$(this,"globalHeaders",[]);this.options=e,this.bindingEngine=new wn}setGlobalHeaders(e){this.globalHeaders=e||[]}matchesPattern(e,a){if(a==="*")return!0;const r=a.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${r}$`).test(e)}toFormData(e){const a=new FormData;for(const[r,i]of Object.entries(e))i instanceof File||i instanceof Blob?a.append(r,i):i!=null&&a.append(r,typeof i=="object"?JSON.stringify(i):String(i));return a}getMatchingGlobalHeaders(e,a){const r={};for(const i of this.globalHeaders)this.matchesPattern(e,i.pattern)&&Object.entries(i.headers).forEach(([l,u])=>{const d=uc(u,a);d!=null&&d!==""&&(r[l]=String(d))});return r}filterByCondition(e,a={}){const r=new Set,i=[];for(const l of e){if(r.has(l.id))continue;if(!l.if&&!l.conditions){r.add(l.id),i.push(l);continue}Fi({if:l.if,conditions:l.conditions},a,this.bindingEngine,`data_source:${l.id}`)&&(r.add(l.id),i.push(l))}return i}checkErrorCondition(e,a){if(!e.errorCondition?.if||e.errorCondition?.errorCode===void 0)return null;try{const r={response:a};if(Fi({if:e.errorCondition.if},r,this.bindingEngine,`errorCondition:${e.id}`))return bt.log(`errorCondition matched for ${e.id}, triggering error ${e.errorCondition.errorCode}`),e.errorCondition.errorCode}catch(r){bt.error(`Failed to evaluate errorCondition for ${e.id}:`,r)}return null}async fetchDataSources(e,a={},r=new URLSearchParams,i,l){const u={},d=!!this.options.sampleProvider,f=e.filter(g=>(d||g.auto_fetch!==!1)&&g.type!=="websocket");return await Promise.all(f.map(async g=>{try{const m=await this.fetchDataSource(g,a,r,i,l);u[g.id]=m,this.dataCache.set(g.id,{data:m,timestamp:Date.now()});const b=this.checkErrorCondition(g,m);if(b!==null){const v={status:b,message:`Error condition matched for ${g.id}`,data:m},S=pa(),E=S.resolve(b,{errorHandling:g.errorHandling,onError:g.onError});if(E.handler)try{await S.execute(E.handler,v)}catch(A){bt.error(`Error executing errorCondition handler for ${g.id}:`,A)}g.fallback!==void 0&&(u[g.id]=g.fallback,this.dataCache.set(g.id,{data:g.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${g.id} (errorCondition)`));return}if(g.onSuccess)try{const v={data:m,sourceId:g.id};await this.executeOnSuccessHandler(g.onSuccess,v)}catch(v){bt.error(`Error executing onSuccess handler for ${g.id}:`,v)}}catch(m){bt.error(`Failed to fetch data source: ${g.id}`,m);const b=m?.response?.status||m?.status||500,v=m?.response?.data,S=v?.message||m.message||"Unknown error",E={status:b,message:S,errors:v?.errors,data:v,statusText:m?.response?.statusText},A=pa(),T=A.resolve(b,{errorHandling:g.errorHandling,onError:g.onError});if(T.handler)try{await A.execute(T.handler,E)}catch(L){bt.error(`Error executing error handler for ${g.id}:`,L)}g.fallback!==void 0&&(u[g.id]=g.fallback,this.dataCache.set(g.id,{data:g.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${g.id}`)),this.options.onError&&this.options.onError(m,g)}})),u}async fetchDataSourcesWithResults(e,a={},r=new URLSearchParams,i,l,u){if(e.some(m=>m.type==="websocket")){const m=e.filter(b=>b.type==="websocket").map(b=>b.id).join(", ");bt.warn(`fetchDataSourcesWithResults received WebSocket sources (caller should filter them out before calling): ${m}. WebSocket sources are event listeners, not data providers — they should not be passed to fetch.`)}const f=u?.ignoreAutoFetch?e.filter(m=>m.type!=="websocket"):e.filter(m=>m.auto_fetch!==!1&&m.type!=="websocket");return await Promise.all(f.map(async m=>{try{const b=await this.fetchDataSource(m,a,r,i,l);this.dataCache.set(m.id,{data:b,timestamp:Date.now()});const v=this.checkErrorCondition(m,b);if(v!==null){const S={status:v,message:`Error condition matched for ${m.id}`,data:b},E=pa(),A=E.resolve(v,{errorHandling:m.errorHandling,onError:m.onError});let T=!1;if(A.handler)if(m.loading_strategy==="blocking")E.execute(A.handler,S).catch(L=>{bt.error(`Error executing errorCondition handler for ${m.id}:`,L)}),T=!0;else try{await E.execute(A.handler,S),T=!0}catch(L){bt.error(`Error executing errorCondition handler for ${m.id}:`,L)}return m.fallback!==void 0?(this.dataCache.set(m.id,{data:m.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${m.id} (errorCondition)`),{id:m.id,state:"success",data:m.fallback}):{id:m.id,state:"error",error:new Error(`Error condition matched: ${v}`),errorCode:v,errorHandled:T}}if(m.onSuccess)try{const S={data:b,sourceId:m.id};await this.executeOnSuccessHandler(m.onSuccess,S)}catch(S){bt.error(`Error executing onSuccess handler for ${m.id}:`,S)}return{id:m.id,state:"success",data:b}}catch(b){bt.error(`Failed to fetch data source: ${m.id}`,b);const v=b?.response?.status||b?.status||500,S=b?.response?.data,E=S?.message||b.message||"Unknown error",A={status:v,message:E,errors:S?.errors,data:S,statusText:b?.response?.statusText},T=pa(),L=T.resolve(v,{errorHandling:m.errorHandling,onError:m.onError});let M=!1;if(L.handler)if(m.loading_strategy==="blocking")T.execute(L.handler,A).catch(R=>{bt.error(`Error executing error handler for ${m.id}:`,R)}),M=!0;else try{await T.execute(L.handler,A),M=!0}catch(R){bt.error(`Error executing error handler for ${m.id}:`,R)}return m.fallback!==void 0?(this.dataCache.set(m.id,{data:m.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${m.id}`),{id:m.id,state:"success",data:m.fallback}):(this.options.onError&&this.options.onError(b,m),{id:m.id,state:"error",error:b,errorCode:v,errorHandled:M})}}))}fetchDataSourcesInBackground(e,a={},r=new URLSearchParams,i){e.filter(u=>u.auto_fetch!==!1&&u.loading_strategy==="background"&&u.type!=="websocket").forEach(u=>{this.fetchDataSource(u,a,r).then(async d=>{this.dataCache.set(u.id,{data:d,timestamp:Date.now()});const f=this.checkErrorCondition(u,d);if(f!==null){const g={status:f,message:`Error condition matched for ${u.id}`,data:d},m=pa(),b=m.resolve(f,{errorHandling:u.errorHandling,onError:u.onError});if(b.handler)try{await m.execute(b.handler,g)}catch(v){bt.error(`Error executing errorCondition handler for ${u.id}:`,v)}u.fallback!==void 0&&(this.dataCache.set(u.id,{data:u.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${u.id} (errorCondition)`),i&&i(u.id,u.fallback));return}if(u.onSuccess)try{const g={data:d,sourceId:u.id};await this.executeOnSuccessHandler(u.onSuccess,g)}catch(g){bt.error(`Error executing onSuccess handler for ${u.id}:`,g)}i&&i(u.id,d)}).catch(async d=>{bt.error(`Background fetch failed: ${u.id}`,d);const f=d?.response?.status||d?.status||500,g=d?.response?.data,m=g?.message||d.message||"Unknown error",b={status:f,message:m,errors:g?.errors,data:g,statusText:d?.response?.statusText},v=pa(),S=v.resolve(f,{errorHandling:u.errorHandling,onError:u.onError});if(S.handler)try{await v.execute(S.handler,b)}catch(E){bt.error(`Error executing error handler for ${u.id}:`,E)}if(u.fallback!==void 0){this.dataCache.set(u.id,{data:u.fallback,timestamp:Date.now()}),bt.log(`Using fallback data for ${u.id}`),i&&i(u.id,u.fallback);return}this.options.onError&&this.options.onError(d,u)})})}async fetchDataSource(e,a,r,i,l){switch(e.type){case"api":return this.fetchApiDataSource(e,a,r,i,l);case"static":return e.data;case"route_params":return a;case"query_params":return Xm(r);default:throw new Error(`Unknown data source type: ${e.type}`)}}async fetchApiDataSource(e,a,r,i,l){if(this.options.sampleProvider?.has(e.id))return await Promise.resolve(this.options.sampleProvider.resolve(e));if(!e.endpoint)throw new Error(`API data source ${e.id} has no endpoint`);const u={route:a,query:Xm(r)};i&&(u._global=i),l&&(u._local=l);let d=Ki(e.endpoint,u,{skipCache:!0});const f=e.method||"GET",m=(e.contentType?typeof e.contentType=="string"&&e.contentType.includes("{{")?Ki(e.contentType,u,{skipCache:!0}):e.contentType:"application/json")==="multipart/form-data";let b=m?{...e.params||{}}:JSON.parse(JSON.stringify(e.params||{}));Object.entries(b).forEach(([E,A])=>{typeof A=="string"&&(b[E]=uc(A,u))}),Object.keys(b).forEach(E=>{b[E]===""&&delete b[E]});const v=x_();let S=null;if(v?.isEnabled()){v.trackDataSourceDefinition({id:e.id,type:e.type,endpoint:d,method:f,autoFetch:e.auto_fetch,initLocal:e.initLocal,initGlobal:e.initGlobal});let E=d;if(f==="GET"&&Object.keys(b).length>0){const A=new URLSearchParams;Object.entries(b).forEach(([L,M])=>{Array.isArray(M)?M.forEach(R=>A.append(L,String(R))):M!=null&&A.append(L,String(M))});const T=A.toString();E=T?`${d}?${T}`:d}S=v.trackRequest(E,f,{requestBody:f!=="GET"?b:void 0,dataSourceId:e.id}),v.trackDataSourceLoading(e.id)}try{let E;const A=e.auth_mode??(e.auth_required===!0?"required":"none"),T=ha.getInstance().isAuthenticated();if(A==="required"&&!T){bt.log(`[DataSourceManager] Skipping ${e.id}: auth_mode is 'required' but no token available`),v?.isEnabled()&&(v.trackDataSourceError(e.id,"Skipped: auth_mode required but not authenticated"),S&&v.failRequest(S,"Skipped: not authenticated"));const M=new Error("Auth required but not authenticated");throw M.response={status:401,statusText:"Unauthorized",data:null},M.status=401,M._authSkipped=!0,M}const L=A==="required"||A==="optional"&&T;if(L){const M=Ma(),R=d.startsWith("/api/")?d.substring(4):d.startsWith("/api")?d.substring(4)||"/":d;this.options.onError&&bt.log(`[DataSourceManager] Normalized endpoint: ${d} -> ${R}`);const D=this.getMatchingGlobalHeaders(d,u),U={};e.headers&&Object.entries(e.headers).forEach(([ge,Ee])=>{const Ce=uc(Ee,u);Ce!=null&&Ce!==""&&(U[ge]=String(Ce))});const j={...D,...U},q=Object.keys(j).length>0,X=m?this.toFormData(b):b;switch(f){case"GET":E=await M.get(R,{params:b,...q&&{headers:j}});break;case"POST":q?E=await M.post(R,X,{headers:j}):E=await M.post(R,X);break;case"PUT":q?E=await M.put(R,X,{headers:j}):E=await M.put(R,X);break;case"PATCH":q?E=await M.patch(R,X,{headers:j}):E=await M.patch(R,X);break;case"DELETE":E=await M.delete(R,{params:b,...q&&{headers:j}});break;default:throw new Error(`Unsupported HTTP method: ${f}`)}}else{let M=d;if(f==="GET"){const X=new URLSearchParams(b).toString();M=X?`${d}?${X}`:d}const R={...m?{}:{"Content-Type":"application/json"},Accept:"application/json"};if(typeof window<"u"){const X=localStorage.getItem("g7_locale");X&&(R["Accept-Language"]=X)}const D=this.getMatchingGlobalHeaders(d,u);Object.assign(R,D),e.headers&&Object.entries(e.headers).forEach(([X,ge])=>{const Ee=uc(ge,u);Ee!=null&&Ee!==""&&(R[X]=String(Ee))});let U;f!=="GET"&&(m?(U=this.toFormData(b),delete R["Content-Type"]):U=JSON.stringify(b));const j=await fetch(M,{method:f,headers:R,body:U});let q;try{q=await j.json()}catch{q=null}if(S&&v?.isEnabled()&&(v.completeRequest(S,j.status,q),S=null),!j.ok){v?.isEnabled()&&v.trackDataSourceError(e.id,`HTTP ${j.status}: ${j.statusText}`);const X=new Error(`HTTP error! status: ${j.status}`);throw X.response={status:j.status,statusText:j.statusText,data:q},X.status=j.status,X}E=q,v?.isEnabled()&&v.trackDataSourceLoaded(e.id,E)}return L&&S&&v?.isEnabled()&&(v.completeRequest(S,200,E),v.trackDataSourceLoaded(e.id,E)),E}catch(E){if(S&&v?.isEnabled()){const A=E;A?.response?v.completeRequest(S,A.response.status,A.response.data):v.failRequest(S,E instanceof Error?E.message:String(E)),v.trackDataSourceError(e.id,E instanceof Error?E.message:String(E))}throw E}}getCachedData(e){const a=this.dataCache.get(e);if(!a)return;if(Date.now()-a.timestamp>gc.DATA_CACHE_TTL){this.dataCache.delete(e);return}return a.data}clearCache(){this.dataCache.clear()}subscribeWebSockets(e,a,r={}){const i=[],l=e.filter(u=>u.type==="websocket");return l.length===0||l.forEach(u=>{if(!u.channel||!u.event){bt.warn(`WebSocket source ${u.id} missing channel or event`);return}let d,f;try{d=Ki(u.channel,r,{skipCache:!0}),f=Ki(u.event,r,{skipCache:!0})}catch(b){bt.error(`Failed to resolve WebSocket channel/event for source ${u.id}:`,b);return}const g=b=>!!(!b||b.trim()===""||b.includes("{{")||b.endsWith(".")||b.endsWith(":")||b.startsWith(".")||b.startsWith(":")||b.includes("..")||b.includes("::"));if(g(d)||g(f)){bt.warn(`WebSocket source ${u.id} has invalid channel/event after expression resolution, skipping. Original channel="${u.channel}", resolved="${d}". Original event="${u.event}", resolved="${f}". Available context keys: [${Object.keys(r).join(", ")}]`);return}const m=cc.subscribe(d,f,b=>{const v=u.target_source||u.id;this.dataCache.set(v,{data:b,timestamp:Date.now()}),a(v,b)},{channelType:u.channel_type||"private"});m&&i.push(m)}),i}unsubscribeWebSockets(e){e.length!==0&&e.forEach(a=>{cc.unsubscribe(a)})}async executeOnSuccessHandler(e,a){const r=this.options.actionDispatcher??Kp();if(!r){bt.warn("ActionDispatcher not available, skipping onSuccess handler");return}const i=Array.isArray(e)?e:[e];for(const l of i)try{await r.dispatchAction({type:"click",...l},{data:{response:a}})}catch(u){throw bt.error("Failed to execute onSuccess handler:",u),u}}};$(gc,"DATA_CACHE_TTL",3e5);let va=gc;const T_=new va,di=ct("ModalDataSourceWrapper");function R_(o,e){if(!o||!e)return o;const r=e.replace(/\?\./g,".").split(/\.(?![^\[]*\])/).flatMap(l=>{const u=l.match(/^([^\[]*)((?:\[\d+\])*)$/);if(u){const[,d,f]=u,g=[];d&&g.push(d);const m=f.match(/\[\d+\]/g);return m&&g.push(...m),g}return[l]}).filter(l=>l!=="");let i=o;for(const l of r){if(i==null)return;if(l.startsWith("[")&&l.endsWith("]")){const u=parseInt(l.slice(1,-1),10);i=i[u]}else i=i[l]}return i}const Jm=({isOpen:o,modalId:e,dataSources:a,dataContext:r,globalStateUpdater:i,bindingEngine:l,debug:u=!1,children:d})=>{const[f,g]=N.useState(!1),[m,b]=N.useState(!1),v=N.useRef(!1),S=N.useRef(null);S.current||(S.current=new va);const E=N.useCallback(async()=>{if(!(!a||a.length===0)&&S.current){g(!0);try{const A=r.route||{},T=new URLSearchParams(window.location.search),L=a.map(R=>{let D={...R};if(R.endpoint&&l){const U=l.resolveBindings(R.endpoint,r,{skipCache:!0});D.endpoint=U}if(R.params&&l){const U={};Object.entries(R.params).forEach(([j,q])=>{typeof q=="string"?U[j]=l.resolveBindings(q,r,{skipCache:!0}):U[j]=q}),D.params=U}return D});u&&di.log(`[ModalDataSourceWrapper] Modal "${e}" fetching data sources:`,L.map(R=>({id:R.id,endpoint:R.endpoint})));const M=await S.current.fetchDataSourcesWithResults(L,A,T);i&&M.forEach(R=>{if(R.state==="success"&&R.data!==void 0){const D=L.find(U=>U.id===R.id);if(D?.initGlobal){const U=R.data?.data??R.data,j=Array.isArray(D.initGlobal)?D.initGlobal:[D.initGlobal];for(const q of j)if(typeof q=="string")i({[q]:U}),u&&di.log(`[ModalDataSourceWrapper] Modal "${e}" initGlobal: ${R.id}.data -> _global.${q}`);else if(typeof q=="object"&&q.key){const{key:X,path:ge}=q,Ee=ge?R_(U,ge):U;i({[X]:Ee}),u&&di.log(`Modal "${e}" initGlobal: ${R.id}.data${ge?"."+ge:""} -> _global.${X}`)}}}else R.state==="error"&&di.error(`Modal "${e}" data source error:`,R.id,R.error)}),u&&di.log(`Modal "${e}" data sources fetched successfully`)}catch(A){di.error(`Modal "${e}" data source fetch error:`,A)}finally{g(!1),b(!0)}}},[a,r,i,l,e,u]);return N.useEffect(()=>{if(!a||a.length===0)return;const A=window.__templateApp;return A?.registerModalDataSources&&A.registerModalDataSources(e,a),()=>{A?.unregisterModalDataSources&&A.unregisterModalDataSources(e)}},[e,a]),N.useEffect(()=>{!o&&v.current&&(b(!1),u&&di.log(`[ModalDataSourceWrapper] Modal "${e}" closed, reset fetch state`)),o&&!v.current&&a&&a.length>0&&!m&&E(),v.current=o},[o,a,m,E,e,u]),ut.jsx(ut.Fragment,{children:d})};class dc extends Error{constructor(a,r,i={}){super(r);$(this,"code");$(this,"userMessageKey");$(this,"showStack");$(this,"icon");$(this,"recoverable");this.name="TemplateEngineError",this.code=a,this.userMessageKey=r,this.showStack=i.showStack??!0,this.icon=i.icon??"fa-circle-exclamation",this.recoverable=i.recoverable??!0,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}getUserMessage(a,r){if(!r||!a)return this.userMessageKey;try{return r.translate(this.userMessageKey,a)}catch{return this.userMessageKey}}}class k_ extends dc{constructor(){super("TEMPLATE_NOT_FOUND","$t:core.errors.template_not_found",{showStack:!1,icon:"fa-paint-brush",recoverable:!1}),this.name="TemplateNotFoundError"}}function Qm(o){if(o instanceof dc)return o;if(o instanceof Error){const e=new dc("TEMPLATE_INIT_ERROR",o.message||"$t:core.errors.template_init_error",{showStack:!0,icon:"fa-circle-exclamation",recoverable:!0});return e.stack=o.stack,e}return new dc("TEMPLATE_INIT_ERROR","$t:core.errors.template_init_error",{showStack:!1,icon:"fa-circle-exclamation",recoverable:!0})}const D_=ct("ErrorDisplay");class rf{static render(e,a){const r=document.getElementById(e);if(!r){D_.error(`Container #${e} not found`);return}const i=a.debug&&a.showStack&&a.stackTrace,l=window.matchMedia("(prefers-color-scheme: dark)").matches,u={container:`
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background-color: ${l?"#111827":"#f9fafb"};
padding: 1rem;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
`,card:`
max-width: 28rem;
width: 100%;
background-color: ${l?"#1f2937":"#ffffff"};
border-radius: 0.5rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
padding: 2rem;
text-align: center;
`,iconContainer:`
margin-bottom: 1.5rem;
`,icon:`
font-size: 4rem;
color: #ef4444;
`,title:`
font-size: 1.5rem;
font-weight: 700;
color: ${l?"#ffffff":"#111827"};
margin-bottom: 1rem;
`,message:`
color: ${l?"#d1d5db":"#4b5563"};
margin-bottom: 0.5rem;
line-height: 1.625;
`,detailMessage:`
font-size: 0.875rem;
color: ${l?"#9ca3af":"#6b7280"};
margin-bottom: 1.5rem;
background-color: ${l?"#374151":"#f3f4f6"};
padding: 0.5rem 0.75rem;
border-radius: 0.25rem;
`,spacer:`
margin-bottom: 1.5rem;
`,stackContainer:`
margin-top: 1.5rem;
padding: 1rem;
background-color: ${l?"#374151":"#f3f4f6"};
border-radius: 0.375rem;
text-align: left;
`,stackTitle:`
font-size: 0.875rem;
font-weight: 600;
color: ${l?"#e5e7eb":"#374151"};
margin-bottom: 0.5rem;
`,stackTrace:`
font-size: 0.75rem;
color: ${l?"#d1d5db":"#4b5563"};
overflow-x: auto;
white-space: pre-wrap;
word-break: break-word;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
`,buttonContainer:`
margin-top: 1.5rem;
`,button:`
display: inline-flex;
align-items: center;
padding: 0.75rem 1.5rem;
background-color: #2563eb;
color: #ffffff;
font-weight: 500;
border-radius: 0.375rem;
border: none;
cursor: pointer;
transition: background-color 0.2s;
`};r.innerHTML=`
<div style="${u.container}">
<div style="${u.card}">
<!-- 아이콘 -->
<div style="${u.iconContainer}">
<i class="fa-solid ${a.icon}" style="${u.icon}"></i>
</div>
<!-- 제목 -->
<h1 style="${u.title}">
${this.escapeHtml(a.title)}
</h1>
<!-- 사용자 메시지 -->
<p style="${u.message}">
${this.escapeHtml(a.message)}
</p>
<!-- 상세 메시지 (API 응답 등) -->
${a.detailMessage?`
<p style="${u.detailMessage}">
${this.escapeHtml(a.detailMessage)}
</p>
`:`<div style="${u.spacer}"></div>`}
<!-- Stack Trace (디버그 모드일 때만) -->
${i?`
<div style="${u.stackContainer}">
<p style="${u.stackTitle}">
Stack Trace:
</p>
<pre style="${u.stackTrace}">${this.escapeHtml(a.stackTrace)}</pre>
</div>
`:""}
<!-- 새로고침 버튼 (복구 가능할 때만) -->
${a.showReloadButton?`
<div style="${u.buttonContainer}">
<button
onclick="window.location.reload()"
style="${u.button}"
onmouseover="this.style.backgroundColor='#1d4ed8'"
onmouseout="this.style.backgroundColor='#2563eb'"
>
<i class="fa-solid fa-rotate-right" style="margin-right: 0.5rem;"></i>
새로고침
</button>
</div>
`:""}
</div>
</div>
`}static renderFromError(e,a,r,i=!1,l,u,d){let f,g;if(a.userMessageKey.startsWith("$t:"))if(u&&l)try{f=u.translate(a.userMessageKey,l)}catch{f=a.userMessageKey.replace("$t:","")}else f=a.userMessageKey.replace("$t:","");else f=a.userMessageKey;if(d){const m=d;m.details?.apiMessage?g=m.details.apiMessage:m.response?.data?.message&&(g=m.response.data.message)}this.render(e,{title:r,message:f,detailMessage:g,icon:a.icon,showStack:a.showStack,stackTrace:a.stack,showReloadButton:a.recoverable,debug:i})}static escapeHtml(e){if(!e)return"";const a=document.createElement("div");return a.textContent=e,a.innerHTML}}const as=ct("Router");class O_{constructor(e){$(this,"routes",[]);$(this,"templateIdentifier");$(this,"eventHandlers",new Map);$(this,"pendingNavigation",null);$(this,"isNavigating",!1);$(this,"handlePopState",()=>{this.navigateToCurrentPath()});this.templateIdentifier=e,this.initPopstateListener()}initPopstateListener(){window.addEventListener("popstate",this.handlePopState)}on(e,a){this.eventHandlers.has(e)||this.eventHandlers.set(e,[]),this.eventHandlers.get(e).push(a)}async emit(e,...a){const r=this.eventHandlers.get(e);r&&await Promise.all(r.map(i=>i(...a)))}async loadRoutes(e){try{const a=e!==void 0&&e>0?`?v=${e}`:"",r=await fetch(`/api/templates/${this.templateIdentifier}/routes.json${a}`);if(!r.ok)throw new Error(`Failed to load routes: ${r.statusText}`);const i=await r.json();if(!i.success)throw new Error("Failed to load routes from API");if(i.data&&Array.isArray(i.data.routes))this.routes=i.data.routes,as.log(`Loaded ${this.routes.length} routes${e?` (v=${e})`:""}`);else throw new Error("Invalid routes data format")}catch(a){throw as.error("Error loading routes:",a),a}}setRoutes(e){this.routes=e,as.log(`Set ${this.routes.length} routes`)}match(e){for(const a of this.routes){const r=this.matchPattern(a.path,e);if(r!==null)return{route:a,params:r}}return null}matchPattern(e,a){const r=[];let i=e.replace(/:([^/]+)/g,(f,g)=>(r.push(g),"([^/]+)"));i.startsWith("*/")&&(i="(?:/[^/]+)?"+i.slice(1)),i=i.replace(/\//g,"\\/");const l=new RegExp(`^${i}$`),u=a.match(l);if(!u)return null;const d={};return r.forEach((f,g)=>{d[f]=u[g+1]}),d}getRoutes(){return[...this.routes]}getAuthType(e,a){return e.auth_type?e.auth_type:a.startsWith("/admin")?"admin":"user"}async navigateToCurrentPath(){const e=window.location.pathname,a=window.location.search,r=this.match(e);if(!r){as.warn(`No route matched for path: ${e}`),this.emit("routeNotFound",e);return}if(r.route.redirect){as.log(`Redirecting from ${e} to ${r.route.redirect}`),this.navigate(r.route.redirect);return}if(r.route.auth_required){const u=this.getAuthType(r.route,e),d=ha.getInstance();let f=d.isAuthenticated()&&d.getAuthType()===u;if(f||(f=await d.checkAuth(u)),!f){const g=d.getLoginRedirectUrl(u,e+a);as.log(`Not authenticated, redirecting to: ${g}`),window.location.href=g;return}}const i=new URLSearchParams(a),l={};for(const u of i.keys()){if(u in l)continue;const d=i.getAll(u);d.length>1?l[u]=d:d.length===1&&(u.endsWith("[]")?l[u]=d:l[u]=d[0])}await this.emit("routeChange",{path:e,layout:r.route.layout,endpoint:r.route.endpoint,params:{...r.route.params||{},...r.params},query:l,auth_required:r.route.auth_required,auth_type:r.route.auth_type,meta:r.route.meta})}navigate(e){if(this.isNavigating){this.pendingNavigation=e;return}this.executeNavigation(e)}async executeNavigation(e){this.isNavigating=!0,this.pendingNavigation=null;try{window.history.pushState({},"",e),await this.navigateToCurrentPath()}finally{if(this.isNavigating=!1,this.pendingNavigation){const a=this.pendingNavigation;this.executeNavigation(a)}}}}const L_=/^\/admin\/layout-editor\/([^/?#]+)\/?$/;function Zm(o){const e=L_.exec(o);return e?{templateIdentifier:e[1]}:null}const zt=ct("ErrorPageHandler");class M_{constructor(e){$(this,"templateId");$(this,"layoutLoader");$(this,"locale");$(this,"debug");$(this,"renderFunction");$(this,"dataSourceManager");$(this,"globalState");$(this,"errorConfig",null);$(this,"configLoaded",!1);this.templateId=e.templateId,this.layoutLoader=e.layoutLoader,this.locale=e.locale,this.debug=e.debug,this.renderFunction=e.renderFunction,this.dataSourceManager=e.dataSourceManager,this.globalState=e.globalState||{}}async loadConfig(){if(this.configLoaded)return this.errorConfig;try{const e=await fetch(`/api/templates/${this.templateId}/config.json`);if(!e.ok)return this.debug&&zt.warn("Failed to load template config:",e.statusText),this.configLoaded=!0,null;const a=await e.json();if(!a.success||!a.data)return this.debug&&zt.warn("Invalid template config response"),this.configLoaded=!0,null;const r=a.data;return!r.error_config||!r.error_config.layouts?(this.debug&&zt.warn("No error_config found in template.json"),this.configLoaded=!0,null):(this.errorConfig=r.error_config,this.configLoaded=!0,this.debug&&zt.log("Error config loaded:",this.errorConfig),this.errorConfig)}catch(e){return zt.error("Failed to load error config:",e),this.configLoaded=!0,null}}async renderError(e,a="app"){try{const r=await this.loadConfig();if(!r)return this.debug&&zt.warn("No error config available, cannot render error page"),!1;const i=r.layouts[e]||r.layouts[String(e)];if(!i)return this.debug&&zt.warn(`No layout defined for error code: ${e}`),!1;this.debug&&zt.log(`Loading error layout: ${i} for code: ${e}`);const l=await this.layoutLoader.loadLayout(this.templateId,i);if(!l)return this.debug&&zt.error(`Failed to load error layout: ${i}`),!1;this.debug&&zt.log("Error layout loaded:",l);let u={};const d=l.data_sources||[];if(d.length>0){this.debug&&zt.log("Fetching data sources:",d.map(S=>S.id));const m=d.filter(S=>S.loading_strategy==="blocking"),b=d.filter(S=>!S.loading_strategy||S.loading_strategy==="progressive"),v=[...m,...b];if(v.length>0)try{u=await this.dataSourceManager.fetchDataSources(v,{},new URLSearchParams),this.debug&&zt.log("Data sources fetched:",Object.keys(u))}catch(S){zt.error("Failed to fetch data sources:",S)}}const f={};d.length>0&&(this.processInitOptions(d,u,f),this.debug&&zt.log("initOptions processed:",{globalKeys:Object.keys(this.globalState),localKeys:Object.keys(f)}));const g={...u,errorCode:e,_global:{...this.globalState},_local:{...f}};return await this.renderFunction({containerId:a,layoutJson:l,dataContext:g,translationContext:{templateId:this.templateId,locale:this.locale}}),this.debug&&zt.log(`Error page ${e} rendered successfully`),!0}catch(r){return zt.error(`Failed to render error page ${e}:`,r),!1}}processInitOptions(e,a,r){for(const i of e){const l=a[i.id];if(!l)continue;const u=l?.data??l;if(i.initLocal){if(typeof i.initLocal=="string")r[i.initLocal]=u,zt.log(`initLocal: ${i.id}.data -> _local.${i.initLocal}`);else if(typeof i.initLocal=="object"&&"key"in i.initLocal){const{key:d,path:f}=i.initLocal;r[d]=f?this.getValueByPath(u,f):u,zt.log(`initLocal: ${i.id}.data${f?"."+f:""} -> _local.${d}`)}}if(i.initGlobal){const d=Array.isArray(i.initGlobal)?i.initGlobal:[i.initGlobal];for(const f of d)if(typeof f=="string")this.globalState[f]=u,zt.log(`initGlobal: ${i.id}.data -> _global.${f}`);else if(typeof f=="object"&&f!==null&&"key"in f){const{key:g,path:m}=f;this.globalState[g]=m?this.getValueByPath(u,m):u,zt.log(`initGlobal: ${i.id}.data${m?"."+m:""} -> _global.${g}`)}}}}getValueByPath(e,a){return a.split(".").reduce((r,i)=>r?.[i],e)}updateGlobalState(e){this.globalState={...this.globalState,...e}}updateLocale(e){this.locale=e,this.debug&&zt.log("Locale updated:",e)}isConfigLoaded(){return this.configLoaded}async hasErrorLayout(e){const a=await this.loadConfig();return a?!!(a.layouts[e]||a.layouts[String(e)]):!1}clearConfigCache(){this.errorConfig=null,this.configLoaded=!1,this.debug&&zt.log("Config cache cleared")}}const $t=ct("ModuleAssetLoader");class $_{constructor(){$(this,"loadedAssets",new Map);$(this,"loadingPromises",new Map);$(this,"failedJsAssets",new Set)}hasFailedJsAssets(){return this.failedJsAssets.size>0}getFailedJsAssets(){return[...this.failedJsAssets]}async loadActiveExtensionAssets(e){if(!e||e.length===0){$t.log("No module assets to load");return}const a=[...e].sort((d,f)=>d.priority-f.priority);$t.log("Loading module assets:",a.map(d=>d.identifier));const r=a.filter(d=>d.css).map(d=>this.loadCSS(d.identifier,d.css)),i=a.filter(d=>d.js).map(d=>this.loadJS(d.identifier,d.js)),l=await Promise.allSettled([...r,...i]),u=l.filter(d=>d.status==="rejected");if(u.length>0){$t.warn(`Some module assets failed to load (${u.length}/${l.length}); continuing with the rest`,this.getFailedJsAssets());return}$t.log("All module assets loaded successfully")}async loadBundle(e,a,r){const i=[];if(r&&i.push(this.loadBundleCss(e,r)),a&&i.push(this.loadBundleJs(e,a)),i.length===0){$t.log(`No bundle assets to load for: ${e}`);return}await Promise.all(i)}async loadBundleCss(e,a){const r=`ext-bundle-css-${e}`;if(document.getElementById(r)){$t.log(`Bundle CSS already loaded: ${e}`);return}return new Promise(i=>{const l=document.createElement("link");l.rel="stylesheet",l.href=a,l.id=r,l.onload=()=>{$t.log(`Bundle CSS loaded: ${e}`),this.registerLoadedAsset(`bundle-${e}`,{type:"css",element:l}),i()},l.onerror=()=>{$t.warn(`Failed to load bundle CSS: ${e} (${a})`),i()},document.head.appendChild(l)})}async loadBundleJs(e,a){const r=`ext-bundle-js-${e}`;if(document.getElementById(r)){$t.log(`Bundle JS already loaded: ${e}`);return}const i=this.loadingPromises.get(r);if(i)return $t.log(`Bundle JS already loading: ${e}`),i;const l=Fg(a,{id:r},{label:`bundle JS: ${e}`}).then(()=>{$t.log(`Bundle JS loaded: ${e}`);const u=document.getElementById(r);u&&this.registerLoadedAsset(`bundle-${e}`,{type:"js",element:u}),this.loadingPromises.delete(r)}).catch(u=>{throw $t.warn(`Failed to load bundle JS: ${e} (${a})`,u),this.failedJsAssets.add(e),this.loadingPromises.delete(r),u});return this.loadingPromises.set(r,l),l}async loadCSS(e,a){const r=`module-css-${e}`;if(document.getElementById(r)){$t.log(`CSS already loaded: ${e}`);return}return new Promise((i,l)=>{const u=document.createElement("link");u.rel="stylesheet",u.href=a,u.id=r,u.onload=()=>{$t.log(`CSS loaded: ${e}`),this.registerLoadedAsset(e,{type:"css",element:u}),i()},u.onerror=()=>{$t.warn(`Failed to load CSS: ${e} (${a})`),i()},document.head.appendChild(u)})}async loadJS(e,a){const r=`module-js-${e}`;if(document.getElementById(r)){$t.log(`JS already loaded: ${e}`);return}const i=this.loadingPromises.get(e);if(i)return $t.log(`JS already loading: ${e}`),i;const l=Fg(a,{id:r},{label:`JS: ${e}`}).then(()=>{$t.log(`JS loaded: ${e}`);const u=document.getElementById(r);u&&this.registerLoadedAsset(e,{type:"js",element:u}),this.loadingPromises.delete(e)}).catch(u=>{throw $t.warn(`Failed to load JS: ${e} (${a})`,u),this.failedJsAssets.add(e),this.loadingPromises.delete(e),u});return this.loadingPromises.set(e,l),l}registerLoadedAsset(e,a){const r=this.loadedAssets.get(e)||[];r.push(a),this.loadedAssets.set(e,r)}unloadExtensionAsset(e){const a=this.loadedAssets.get(e);if(!a||a.length===0){$t.log(`No assets to unload for: ${e}`);return}a.forEach(r=>{r.element.parentNode&&(r.element.parentNode.removeChild(r.element),$t.log(`${r.type.toUpperCase()} unloaded: ${e}`))}),this.loadedAssets.delete(e),$t.log(`All assets unloaded for: ${e}`)}unloadAllAssets(){Array.from(this.loadedAssets.keys()).forEach(a=>{this.unloadExtensionAsset(a)}),$t.log("All module assets unloaded")}isLoaded(e){return this.loadedAssets.has(e)}getLoadedModules(){return Array.from(this.loadedAssets.keys())}}let sf=null;function of(){return sf||(sf=new $_),sf}function N_(){if(typeof window>"u")return[];const o=window.G7Config;if(!o?.moduleAssets)return[];const e=[];for(const[a,r]of Object.entries(o.moduleAssets)){const i=r;e.push({identifier:a,js:i.js,css:i.css,priority:i.priority,external:i.external})}return e}function I_(){if(typeof window>"u")return null;const o=window.G7Config;return o?.bundleUrls?o.bundleUrls:null}function H_(){if(typeof window>"u")return[];const o=window.G7Config;if(!o?.pluginAssets)return[];const e=[];for(const[a,r]of Object.entries(o.pluginAssets)){const i=r;e.push({identifier:a,js:i.js,css:i.css,priority:i.priority,external:i.external})}return e}const lf=ct("SystemBannerManager");class fc{static show(e){this.banners.set(e.id,e),this.render(),lf.log(`Banner shown: ${e.id}`)}static hide(e){this.banners.delete(e)&&(this.render(),lf.log(`Banner hidden: ${e}`))}static hideAll(){this.banners.clear(),this.render(),lf.log("All banners hidden")}static detectLocale(){try{const a=window.G7Core;if(a?.locale?.current)return a.locale.current()}catch{}return(navigator.language||"ko").split("-")[0]}static resolveMessage(e,a){return typeof e=="string"?e:e[a]||e.en||e.ko||Object.values(e)[0]||""}static render(){if(typeof document>"u")return;let e=document.getElementById(this.containerId);if(this.banners.size===0){e&&(e.remove(),this.adjustAppPadding(0));return}e||(e=document.createElement("div"),e.id=this.containerId,e.style.cssText="position:fixed;top:0;left:0;right:0;z-index:99999;",document.body.prepend(e));const a=Array.from(this.banners.values()).sort((i,l)=>(i.order??0)-(l.order??0)),r=this.detectLocale();e.innerHTML=a.map(i=>{const l=this.resolveMessage(i.message,r),u=i.background||"#f59e0b",d=i.color||"white";return`<div data-banner-id="${i.id}" style="background:${u};color:${d};text-align:center;padding:8px 16px;font-size:14px;font-weight:500;">${l}</div>`}).join(""),requestAnimationFrame(()=>{e&&this.adjustAppPadding(e.offsetHeight)})}static adjustAppPadding(e){const a=document.getElementById("app");a&&(a.style.paddingTop=e>0?`${e}px`:"")}}$(fc,"banners",new Map),$(fc,"containerId","g7-system-banners");const B=ct("TemplateApp");function ey(o){const e={};for(const a of o.keys()){if(a in e)continue;const r=o.getAll(a);r.length>1?e[a]=r:r.length===1&&(a.endsWith("[]")?e[a]=r:e[a]=r[0])}return e}const Ca=class Ca{constructor(e){$(this,"router",null);$(this,"layoutLoader",null);$(this,"errorPageHandler",null);$(this,"config");$(this,"globalState");$(this,"globalStateListeners",new Set);$(this,"currentRouteChangeId",0);$(this,"currentDataSources",[]);$(this,"currentRawDataSources",[]);$(this,"currentRouteParams",{});$(this,"currentQueryParams",new URLSearchParams);$(this,"currentFetchedData",{});$(this,"currentLayoutName","");$(this,"templateErrorHandling",null);$(this,"currentWebSocketSubscriptions",[]);$(this,"extensionCacheVersion",0);$(this,"currentGlobalHeaders",[]);$(this,"transitionOverlayEl",null);$(this,"skeletonOverlayRoot",null);$(this,"skeletonOverlayContainer",null);$(this,"_spinnerState",null);$(this,"modalDataSources",new Map);this.globalState={sidebarOpen:!1},this.loadG7Config(),this.migrateLocaleStorage();const a=this.loadLocaleFromStorage(),r=a||e.locale||"ko";this.config={...e,locale:r},!a&&e.locale&&this.saveLocaleToStorage(e.locale)}loadG7Config(){if(typeof window<"u"&&window.G7Config){const e=window.G7Config;e.settings&&(this.globalState.settings=e.settings,B.log("Loaded settings from G7Config:",Object.keys(e.settings)),e.settings.upload&&(this.globalState.uploadSettings=e.settings.upload)),e.plugins&&(this.globalState.plugins=e.plugins,B.log("Loaded plugin settings from G7Config:",Object.keys(e.plugins))),e.modules&&(this.globalState.modules=e.modules,B.log("Loaded module settings from G7Config:",Object.keys(e.modules))),e.appConfig&&(this.globalState.appConfig=e.appConfig,B.log("Loaded appConfig from G7Config:",Object.keys(e.appConfig)))}}resolveRouteExpressions(e){const a=new wn,r={_global:this.globalState};return e.map(i=>{const l={...i};if(l.path&&l.path.includes("{{")){const u=l.path;l.path=a.resolveBindings(l.path,r),l.path=l.path.replace(/\/\/+/g,"/")||"/",l.path.includes("{{")&&(B.warn("Route expression resolution failed, using fallback:",u),l.path=u.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/")}if(l.redirect&&l.redirect.includes("{{")){const u=l.redirect;l.redirect=a.resolveBindings(l.redirect,r),l.redirect=l.redirect.replace(/\/\/+/g,"/")||"/",l.redirect.includes("{{")&&(B.warn("Route redirect expression resolution failed:",u),l.redirect=u.replace(/\{\{[^}]+\}\}/g,"").replace(/\/\/+/g,"/")||"/")}return l})}migrateLocaleStorage(){const e=["locale","g7_template_locale"];for(const a of e)try{const r=localStorage.getItem(a);r&&r!==localStorage.getItem(Ca.LOCALE_STORAGE_KEY)&&(localStorage.setItem(Ca.LOCALE_STORAGE_KEY,r),B.log(`Migrated locale from '${a}' to '${Ca.LOCALE_STORAGE_KEY}'`)),localStorage.removeItem(a)}catch(r){B.warn(`Failed to migrate locale key '${a}':`,r)}}async init(){try{Ps.getInstance().setDebug(this.config.debug),B.log("Initializing with config:",this.config),$S();const e=da.getInstance(),a=ha.getInstance(),r=this.loadCacheVersionFromStorage()||0,[i,l,u,d,f]=await Promise.all([wo({templateId:this.config.templateId,templateType:this.config.templateType,locale:this.config.locale,debug:this.config.debug,cacheVersion:r}),e.loadComponents(this.config.templateId,this.config.templateType),Cl(`/api/templates/${this.config.templateId}/routes.json${r>0?`?v=${r}`:""}`,{label:"routes.json"}).then(A=>{if(!A.ok)throw new Error(`Failed to load routes: ${A.statusText}`);return A.json()}).then(A=>{if(!A.success)throw new Error("Failed to load routes from API");return A.data}).catch(A=>{throw B.error("Error loading routes:",A),A}),a.preloadAuth(this.config.templateType==="admin"?"admin":"user"),fetch(`/api/templates/${this.config.templateId}/config.json`).then(A=>A.ok?A.json():null).then(A=>!A?.success||!A?.data?null:A.data).catch(A=>(B.warn("Error loading template config:",A),null))]);if(B.log("Template Engine initialized"),B.log("ComponentRegistry loaded"),B.log("Routes data loaded"),B.log("User info preloaded"),B.log("Template config loaded:",f),f?.cache_version!==void 0){const A=this.loadCacheVersionFromStorage();if(this.extensionCacheVersion=f.cache_version,this.saveCacheVersionToStorage(this.extensionCacheVersion),B.log("Extension cache version:",this.extensionCacheVersion),A!==null&&A!==this.extensionCacheVersion){B.log("Cache version changed, reloading routes...");const T=await Cl(`/api/templates/${this.config.templateId}/routes.json?v=${this.extensionCacheVersion}`,{label:"routes.json (reload)"}).then(L=>{if(!L.ok)throw new Error(`Failed to reload routes: ${L.statusText}`);return L.json()}).then(L=>{if(!L.success)throw new Error("Failed to reload routes from API");return L.data});Array.isArray(T.routes)&&(T.routes=this.resolveRouteExpressions(T.routes),Object.assign(u,T),B.log("Routes reloaded with new cache version"));try{const{TranslationEngine:L}=await Promise.resolve().then(()=>Wg),M=L.getInstance();M.setCacheVersion(this.extensionCacheVersion);const R=this.config.locale||"ko",D="en";await M.loadTranslations(this.config.templateId,R,"/api",!0),R!==D&&await M.loadTranslations(this.config.templateId,D,"/api",!0),B.log("Translations reloaded with new cache version")}catch(L){B.error("Failed to reload translations:",L)}}}f?.errorHandling&&(this.templateErrorHandling=f.errorHandling,pa().setTemplateConfig(this.templateErrorHandling),B.log("Template errorHandling registered:",this.templateErrorHandling)),a.on("logout",()=>{B.log("User logged out")}),a.on("authStateChange",A=>{B.log("Auth state changed:",A)}),B.log("AuthManager event handlers registered");const g=Ma(),m=this.config.templateType==="admin"?"admin":"user",b=a.getConfig(m);g.setOnUnauthorized(()=>{B.log("Unauthorized - redirecting to login page"),g.removeToken();const A=window.location.pathname+window.location.search,T=a.getLoginRedirectUrl(m,A,"session_expired");window.location.href=T}),B.log("ApiClient onUnauthorized callback registered"),this.layoutLoader=new Jd(e),this.extensionCacheVersion>0&&this.layoutLoader.setCacheVersion(this.extensionCacheVersion),B.log("LayoutLoader initialized:",this.layoutLoader);const v=new va({onUnauthorized:()=>{B.warn("Unauthorized request in error page")}});if(this.errorPageHandler=new M_({templateId:this.config.templateId,layoutLoader:this.layoutLoader,locale:this.config.locale,debug:this.config.debug,renderFunction:rs,dataSourceManager:v,globalState:this.globalState}),B.log("ErrorPageHandler initialized with DataSourceManager"),await this.handleServerError()){B.log("Server error handled, skipping normal initialization");return}if(this.router=new O_(this.config.templateId),Array.isArray(u.routes)){const A=this.resolveRouteExpressions(u.routes);this.router.setRoutes(A)}else throw new Error("Invalid routes data format");B.log("Router initialized:",this.router),B.log("Routes set:",this.router.getRoutes());const{getActionDispatcher:S}=await Promise.resolve().then(()=>Ha),E=S();if(E&&(E.setDefaultContext({navigate:A=>this.router?.navigate(A)}),E.setGlobalStateUpdater((A,T)=>this.setGlobalState(A,T)),B.log("Navigate function and setGlobalState injected to ActionDispatcher")),await this.loadExtensionAssets(),this.reinitializeTemplateHandlers(),this.router.on("routeChange",A=>this.handleRouteChange(A)),this.router.on("routeNotFound",A=>this.handleRouteNotFound(A)),typeof window<"u"&&Zm(window.location.pathname)){B.log("Layout editor mode detected — skipping router match"),await rs({containerId:"app",layoutJson:{components:[]},dataContext:{},translationContext:{templateId:this.config.templateId,locale:this.config.locale}}),B.log("Template App initialized in layout editor mode");return}this.router.navigateToCurrentPath(),B.log("Template App initialized successfully")}catch(e){B.error("Initialization failed:",e),this.showInitError(e)}}async loadExtensionAssets(){try{const e=of(),a=I_();if(!a){await this.loadExtensionAssetsIndividually();return}await e.loadBundle("module",a.moduleJs,a.moduleCss),await e.loadBundle("plugin",a.pluginJs,a.pluginCss),B.log("Extension bundle assets loaded successfully")}catch(e){B.warn("Failed to load extension assets:",e)}}async loadExtensionAssetsIndividually(){const e=of(),a=N_();a.length>0&&(B.log("Loading module assets (individual fallback):",a.map(i=>i.identifier)),await e.loadActiveExtensionAssets(a));const r=H_();r.length>0&&(B.log("Loading plugin assets (individual fallback):",r.map(i=>i.identifier)),await e.loadActiveExtensionAssets(r))}async handleRouteChange(e){const a=++this.currentRouteChangeId;window.__g7ForcedLocalFields=void 0,window.__g7ActionContext=void 0,window.__g7PendingLocalState=void 0,window.__g7LastSetLocalSnapshot=void 0,window.__g7SetLocalOverrideKeys=void 0,window.__g7SequenceLocalSync=void 0,window.__g7AutoBindingPaths=new Map;try{if(B.log("Route changed:",e,"requestId:",a),!this.layoutLoader)throw new Error("LayoutLoader is not initialized");if(!e.layout)throw new Error("Route layout is not defined");let r=e.layout;const i=r==="__preview__";i&&e.params?.token&&(r=`__preview__/${e.params.token}`);const l=await this.layoutLoader.loadLayout(this.config.templateId,r);if(a!==this.currentRouteChangeId){B.log("Route change cancelled (newer request exists):",a);return}B.log("Layout loaded:",l);const u=pa();l.errorHandling?(u.setLayoutConfig(l.errorHandling),B.log("Layout errorHandling registered:",l.errorHandling)):u.clearLayoutConfig();const d=l.data_sources||[],f=e.query||{},g=new URLSearchParams;for(const[te,he]of Object.entries(f))if(Array.isArray(he))for(const x of he)g.append(te,x);else g.set(te,he);const m={route:e.params||{},query:f,_global:this.globalState};l.scripts&&Array.isArray(l.scripts)&&await this.loadLayoutScripts(l.scripts,m);const{DataSourceManager:b,getActionDispatcher:v}=await Promise.resolve().then(()=>Ha),S=new b;if(i){const te=v();te&&te.setPreviewMode(!0),this.setGlobalState({__isPreview:!0}),fc.show({id:"preview-mode",message:{ko:"⚠ 미리보기 모드 — 페이지 이동이 비활성화됩니다",en:"⚠ Preview Mode — Navigation is disabled"},background:"linear-gradient(90deg, #f59e0b, #d97706)",color:"white"}),B.log("Preview mode activated")}else{const te=v();te?.isPreviewMode()&&(te.setPreviewMode(!1),fc.hide("preview-mode"))}if(this.currentGlobalHeaders=l.globalHeaders||[],this.currentGlobalHeaders.length>0){S.setGlobalHeaders(this.currentGlobalHeaders);const te=v();te&&te.setGlobalHeaders(this.currentGlobalHeaders),B.log("globalHeaders set:",this.currentGlobalHeaders.map(he=>he.pattern))}if(l.named_actions&&Object.keys(l.named_actions).length>0){const te=v();te&&te.setNamedActions(l.named_actions)}const E=S.filterByCondition(d,m);d.length!==E.length&&B.log("Data sources filtered by condition:",{before:d.map(te=>te.id),after:E.map(te=>te.id)});const A=E.filter(te=>te.loading_strategy==="blocking"),T=E.filter(te=>(te.loading_strategy||"progressive")!=="blocking"&&te.type!=="websocket"),L=Array.isArray(l.transition_overlay?.wait_for)?l.transition_overlay.wait_for:[],M=L.length>0&&E.some(te=>L.includes(te.id)&&te.type!=="websocket"&&(te.loading_strategy||"progressive")!=="background");if((A.length>0||M)&&l.transition_overlay){const te=typeof l.transition_overlay=="boolean"?{enabled:l.transition_overlay,style:"opaque"}:l.transition_overlay;te.enabled&&te.style==="skeleton"&&te.skeleton?.component&&te.target?this.renderSkeletonOverlay(te.target,te.skeleton,l,te.fallback_target):te.enabled&&te.style==="spinner"&&te.target&&this.renderSpinnerOverlay(te.target,te.spinner,te.fallback_target)}let R={},D={},U={},j={};this.currentWebSocketSubscriptions.length>0&&(B.log("Unsubscribing previous WebSocket subscriptions:",this.currentWebSocketSubscriptions),S.unsubscribeWebSockets(this.currentWebSocketSubscriptions),this.currentWebSocketSubscriptions=[]),this.currentDataSources=E,this.currentRawDataSources=d,this.currentRouteParams=e.params||{},this.currentQueryParams=g,B.log(`handleRouteChange #${a} - queryObject:`,f),B.log(`handleRouteChange #${a} - queryParams:`,g.toString()),A.length>0&&(B.log("Fetching blocking data sources:",A.map(he=>he.id)),(await S.fetchDataSourcesWithResults(A,e.params||{},g)).forEach(he=>{if(he.state==="success"&&he.data!==void 0)R[he.id]=he.data;else if(he.state==="error"&&he.error){const x=he.error,K=x.response?.data?.message;D[he.id]={message:K||he.error.message,status:x.response?.status||x.status}}}),this.processInitOptions(A,R,U,j),this.currentFetchedData={...R},B.log("Blocking data loaded:",Object.keys(R)),Object.keys(D).length>0&&B.log("Data source errors:",D),Object.keys(U).length>0&&B.log("Local state init (blocking):",Object.keys(U)),Object.keys(j).length>0&&B.log("Isolated state init (blocking):",Object.keys(j)));const q=T.length>0;if(q&&($a.setPending(!0),B.log("Transition started before rendering")),a!==this.currentRouteChangeId){B.log("Route change cancelled after blocking data (newer request exists):",a);return}const{getState:X}=await Promise.resolve().then(()=>Ha),ge=X().currentDataContext||{},Ee=T.map(te=>te.id),Ce={};if(q){Ee.forEach(he=>{ge[he]!==void 0?Ce[he]=ge[he]:Ce[he]=void 0});const te=Object.keys(Ce).filter(he=>Ce[he]!==void 0);te.length>0&&B.log("Preserving previous progressive data:",te),B.log("Progressive data sources initialized:",Ee)}const $e=l.defines||{},qe={...Ce,...e.params,...R,route:{...e.params||{},path:e.path},query:f,_global:{...this.globalState},_globalSetState:te=>this.setGlobalState(te),_dataSourceErrors:Object.keys(D).length>0?D:void 0,_localInit:Object.keys(U).length>0?U:void 0,_isolatedInit:Object.keys(j).length>0?j:void 0,_defines:Object.keys($e).length>0?$e:void 0};if(l.computed&&Object.keys(l.computed).length>0){const te=this.calculateComputed(l.computed,qe);Object.keys(te).length>0&&(qe._computed=te,this.globalState._computed=te,B.log("Computed values calculated:",Object.keys(te))),qe._computedDefinitions=l.computed}const Xe=l.layout_name||e.layout;this.currentLayoutName!==""&&this.currentLayoutName!==Xe&&(B.log("_local reset due to layout change:",{from:this.currentLayoutName,to:Xe}),this.globalState._local={},K0()),this.currentLayoutName=Xe;const Q=l.initLocal||l.state;if(Q&&Object.keys(Q).length>0){this.globalState._local||(this.globalState._local={});for(const[te,he]of Object.entries(Q))this.globalState._local[te]===void 0&&(this.globalState._local[te]=JSON.parse(JSON.stringify(he)));qe._local={...this.globalState._local},B.log("initLocal applied to _local:",Object.keys(Q))}if(l.initGlobal&&Object.keys(l.initGlobal).length>0){for(const[te,he]of Object.entries(l.initGlobal))this.globalState[te]===void 0&&(this.globalState[te]=JSON.parse(JSON.stringify(he)));B.log("initGlobal applied to _global:",Object.keys(l.initGlobal))}if(l.initIsolated&&Object.keys(l.initIsolated).length>0){for(const[te,he]of Object.entries(l.initIsolated))j[te]===void 0&&(j[te]=JSON.parse(JSON.stringify(he)));B.log("initIsolated applied:",Object.keys(l.initIsolated))}qe._global={...this.globalState,layoutWarnings:l.warnings||[]};const fe=l.initActions||l.init_actions;if(fe&&fe.length>0){await this.executeInitActions(fe,qe),B.log("initActions executed before render");const te=this.globalState;if(te._local){if(Object.keys(U).length>0){for(const[he,x]of Object.entries(U))te._local[he]!==void 0?te._local[he]=this.deepMerge(te._local[he],x):te._local[he]=x;B.log("localInit merged into _local after initActions:",Object.keys(U))}qe._local=te._local,B.log("_local merged into dataContext:",te._local)}if(qe._global={...this.globalState,layoutWarnings:l.warnings||[]},B.log("_global merged into dataContext after initActions"),l.computed&&Object.keys(l.computed).length>0){const he=this.calculateComputed(l.computed,qe);Object.keys(he).length>0&&(qe._computed=he,this.globalState._computed=he,B.log("Computed values recalculated after init_actions:",Object.keys(he)))}if(Object.keys(this.currentFetchedData).length>0){for(const[he,x]of Object.entries(this.currentFetchedData))qe[he]=x;B.log("Fetched data sources merged into dataContext after initActions:",Object.keys(this.currentFetchedData))}}if(l.transition_overlay&&!this.skeletonOverlayContainer&&this.showTransitionOverlay(l.transition_overlay,l),await rs({containerId:"app",layoutJson:l,dataContext:qe,translationContext:{templateId:this.config.templateId,locale:this.config.locale}}),B.log("Initial render complete with blocking data"),this.reattachSpinnerOverlay(),T.length>0){if(a!==this.currentRouteChangeId){B.log("Route change cancelled before progressive fetch (newer request exists):",a),$a.setPending(!1),this.hideTransitionOverlay();return}B.log("Fetching progressive/background data sources:",T.map(x=>x.id));const{updateTemplateData:te,getState:he}=await Promise.resolve().then(()=>Ha);try{const x=T.map(async K=>{try{const de=(await S.fetchDataSourcesWithResults([K],e.params||{},g,this.globalState))[0];if(!de){B.log(`Data source ${K.id} skipped (no fetch result)`);return}if(a!==this.currentRouteChangeId){B.log(`Data source ${K.id} fetch cancelled (newer request exists)`);return}if(de.state==="success"&&de.data!==void 0){B.log(`Progressive data source loaded: ${K.id}`),this.currentFetchedData[K.id]=de.data;const se={};this.processInitOptions([K],{[K.id]:de.data},se);const me=he();if(me.bindingEngine){const ve=[K.id];K.initGlobal&&ve.push("_global"),K.initLocal&&ve.push("_local"),me.bindingEngine.invalidateCacheByKeys(ve)}const Ne={[K.id]:de.data};Object.keys(se).length>0&&(Ne._localInit=se,Object.assign(U,se)),K.initGlobal&&(Ne._global={...this.globalState}),te(Ne)}else if(de.state==="error"&&de.error){const se=de.error,me=se.response?.data?.message;D[K.id]={message:me||de.error.message,status:se.response?.status||se.status},B.log(`Progressive data source error: ${K.id}`,D[K.id]),te({[K.id]:null,_dataSourceErrors:{...D}})}}catch(re){B.error(`Failed to fetch data source: ${K.id}`,re)}});if(await Promise.all(x),a!==this.currentRouteChangeId){B.log("Route change cancelled after progressive fetch (newer request exists):",a);return}B.log("All progressive data sources loaded")}finally{$a.setPending(!1),this.hideTransitionOverlay()}}else this.hideTransitionOverlay();const ye=E.filter(te=>te.type==="websocket");if(ye.length>0){B.log("Subscribing WebSocket data sources:",ye.map(K=>K.id));const{updateTemplateData:te,getState:he}=await Promise.resolve().then(()=>Ha),x={...this.currentFetchedData,...e.params,route:{...e.params||{},path:e.path},query:f,_global:{...this.globalState}};B.log("WebSocket binding context keys:",Object.keys(x)),this.currentWebSocketSubscriptions=S.subscribeWebSockets(E,(K,re)=>{B.log(`WebSocket data received for: ${K}`,re),this.currentFetchedData[K]=re;const de=E.find(ve=>ve.id===K),se=he();if(se.bindingEngine){const ve=[K];de?.initGlobal&&ve.push("_global"),de?.initLocal&&ve.push("_local"),se.bindingEngine.invalidateCacheByKeys(ve)}te({[K]:re});const Ne=E.find(ve=>ve.type==="websocket"&&(ve.target_source||ve.id)===K)?.onReceive;Array.isArray(Ne)&&Ne.length>0&&window.G7Core?.dispatch&&(async()=>{for(const He of Ne)try{const Ae=this.getActionDispatcher?.();Ae&&await Ae.dispatchAction(He,{navigate:this.getRouter?.()?(Et,Rt)=>this.getRouter().navigate(Et,Rt):void 0,setState:Et=>this.setGlobalState(Et),state:this.globalState,data:{...this.globalState,$args:[re],$event:re},_isDispatchFallbackContext:!0})}catch(Ae){B.error(`WebSocket onReceive action failed for ${K}:`,Ae)}})()},x),B.log("WebSocket subscriptions established:",this.currentWebSocketSubscriptions)}B.log("Layout rendered successfully")}catch(r){B.error("Route change handling failed:",r),this.hideTransitionOverlay(),this.showRouteError(r)}}processInitOptions(e,a,r,i){e.some(u=>u.refetchOnMount===!0&&u.initLocal)&&(r._forceLocalInit=Date.now(),B.log("refetchOnMount detected, forcing local state init")),e.forEach(u=>{const d=a[u.id];if(!d)return;const f=d.data??d;if(u.initLocal){if(typeof u.initLocal=="string"){let g=f;if(u.initLocalDefaults&&typeof u.initLocalDefaults=="object"){const b=this.evaluateDefaults(u.initLocalDefaults,a);g={...b,...f},B.log(`initLocalDefaults applied for ${u.initLocal}:`,Object.keys(b))}const m=this.globalState._local?.[u.initLocal];m!==void 0&&typeof m=="object"&&typeof g=="object"?(r[u.initLocal]=this.deepMerge(m,g),B.log(`initLocal (merged): ${u.id}.data -> _local.${u.initLocal}`)):(r[u.initLocal]=g,B.log(`initLocal: ${u.id}.data -> _local.${u.initLocal}`))}else if(typeof u.initLocal=="object"&&u.initLocal.key){const{key:g,path:m}=u.initLocal;let b=m?this.extractValueByPathOrExpression(f,m,u.id):f;if(u.initLocalDefaults&&typeof u.initLocalDefaults=="object"){const S=this.evaluateDefaults(u.initLocalDefaults,a);b={...S,...b},B.log(`initLocalDefaults applied for ${g}:`,Object.keys(S))}const v=this.globalState._local?.[g];v!==void 0&&typeof v=="object"&&typeof b=="object"?(r[g]=this.deepMerge(v,b),B.log(`initLocal (merged): ${u.id}.data${m?"."+m:""} -> _local.${g}`)):(r[g]=b,B.log(`initLocal: ${u.id}.data${m?"."+m:""} -> _local.${g}`))}else if(typeof u.initLocal=="object"){const g=u.initLocal._merge||"deep",m=this.flattenNestedObjectToMappings(u.initLocal);for(const{targetPath:b,sourcePath:v}of m){const S=this.extractValueByPathOrExpression(f,v,u.id);if(b.includes(".")){const E=b.split(".")[0];r[E]===void 0&&this.globalState._local?.[E]!==void 0&&(r[E]=JSON.parse(JSON.stringify(this.globalState._local[E]))),this.setValueAtPath(r,b,S,g),B.log(`initLocal map (${g}): ${u.id} ${v} -> _local.${b}`)}else{const E=this.globalState._local?.[b];g==="replace"?(r[b]=S,B.log(`initLocal map (replace): ${u.id} ${v} -> _local.${b}`)):g==="shallow"?E!==void 0&&typeof E=="object"&&typeof S=="object"?(r[b]={...E,...S},B.log(`initLocal map (shallow): ${u.id} ${v} -> _local.${b}`)):(r[b]=S,B.log(`initLocal map: ${u.id} ${v} -> _local.${b}`)):E!==void 0&&typeof E=="object"&&typeof S=="object"?(r[b]=this.deepMerge(E,S),B.log(`initLocal map (deep): ${u.id} ${v} -> _local.${b}`)):(r[b]=S,B.log(`initLocal map: ${u.id} ${v} -> _local.${b}`))}}}}if(u.initGlobal)if(typeof u.initGlobal=="object"&&!Array.isArray(u.initGlobal)&&!("key"in u.initGlobal))for(const[m,b]of Object.entries(u.initGlobal)){if(typeof b!="string"){B.warn(`initGlobal map value must be string, got ${typeof b} for key ${m}`);continue}const v=this.extractValueByPathOrExpression(f,b,u.id),S=this.globalState[m];S!==void 0&&typeof S=="object"&&typeof v=="object"?(this.globalState[m]=this.deepMerge(S,v),B.log(`initGlobal map (merged): ${u.id} ${b} -> _global.${m}`)):(this.globalState[m]=v,B.log(`initGlobal map: ${u.id} ${b} -> _global.${m}`))}else{const m=Array.isArray(u.initGlobal)?u.initGlobal:[u.initGlobal];for(const b of m)if(typeof b=="string"){const v=this.globalState[b];v!==void 0&&typeof v=="object"&&typeof f=="object"?(this.globalState[b]=this.deepMerge(v,f),B.log(`initGlobal (merged): ${u.id}.data -> _global.${b}`)):(this.globalState[b]=f,B.log(`initGlobal: ${u.id}.data -> _global.${b}`))}else if(typeof b=="object"&&b.key){const{key:v,path:S}=b,E=S?this.extractValueByPathOrExpression(f,S,u.id):f,A=this.globalState[v];A!==void 0&&typeof A=="object"&&typeof E=="object"?(this.globalState[v]=this.deepMerge(A,E),B.log(`initGlobal (merged): ${u.id}.data${S?"."+S:""} -> _global.${v}`)):(this.globalState[v]=E,B.log(`initGlobal: ${u.id}.data${S?"."+S:""} -> _global.${v}`))}}if(i&&u.initIsolated){if(typeof u.initIsolated=="string"){const g=i[u.initIsolated];g!==void 0&&typeof g=="object"&&typeof f=="object"?(i[u.initIsolated]=this.deepMerge(g,f),B.log(`initIsolated (merged): ${u.id}.data -> _isolated.${u.initIsolated}`)):(i[u.initIsolated]=f,B.log(`initIsolated: ${u.id}.data -> _isolated.${u.initIsolated}`))}else if(typeof u.initIsolated=="object"&&u.initIsolated.key){const{key:g,path:m}=u.initIsolated,b=m?this.extractValueByPathOrExpression(f,m,u.id):f,v=i[g];v!==void 0&&typeof v=="object"&&typeof b=="object"?(i[g]=this.deepMerge(v,b),B.log(`initIsolated (merged): ${u.id}.data${m?"."+m:""} -> _isolated.${g}`)):(i[g]=b,B.log(`initIsolated: ${u.id}.data${m?"."+m:""} -> _isolated.${g}`))}else if(typeof u.initIsolated=="object")for(const[g,m]of Object.entries(u.initIsolated)){if(typeof m!="string"){B.warn(`initIsolated map value must be string, got ${typeof m} for key ${g}`);continue}const b=this.extractValueByPathOrExpression(f,m,u.id),v=i[g];v!==void 0&&typeof v=="object"&&typeof b=="object"?(i[g]=this.deepMerge(v,b),B.log(`initIsolated map (merged): ${u.id} ${m} -> _isolated.${g}`)):(i[g]=b,B.log(`initIsolated map: ${u.id} ${m} -> _isolated.${g}`))}}})}evaluateDefaults(e,a){const r={};for(const[i,l]of Object.entries(e))if(typeof l=="string"&&l.startsWith("{{")&&l.endsWith("}}")){const u=l.slice(2,-2).trim();r[i]=this.evaluateExpression(u,a)}else r[i]=l;return r}evaluateExpression(e,a){try{const r=e.split("??").map(i=>i.trim());for(const i of r){if(/^['"].*['"]$/.test(i))return i.slice(1,-1);if(i==="true")return!0;if(i==="false")return!1;if(/^-?\d+(\.\d+)?$/.test(i))return Number(i);const l=this.getNestedValue(a,i);if(l!=null)return l}return}catch(r){B.warn(`Expression evaluation failed: ${e}`,r);return}}getNestedValue(e,a){const r=a.replace(/\?\./g,".");let i=e;const l=r.split(/\.(?![^\[]*\])/).flatMap(u=>{const d=u.match(/^([^\[]*)((?:\[\d+\])*)$/);if(d){const[,f,g]=d,m=[];f&&m.push(f);const b=g.match(/\[\d+\]/g);return b&&m.push(...b),m}return[u]}).filter(u=>u!=="");for(const u of l){if(i==null)return;if(u.startsWith("[")&&u.endsWith("]")){const d=parseInt(u.slice(1,-1),10);i=i[d]}else i=i[u]}return i}extractValueByPathOrExpression(e,a,r){const i=a.match(/^\{\{(.+)\}\}$/);if(i){const l=i[1].trim(),u=new wn,d={data:e,_global:this.globalState,_local:this.globalState._local||{}};try{const f=u.evaluateExpression(l,d);return B.log(`initLocal/initGlobal expression evaluated: ${a} -> `,f),f}catch(f){B.warn(`initLocal/initGlobal expression evaluation failed for ${r}:`,a,f);return}}return this.getNestedValue(e,a)}async loadLayoutScripts(e,a){const r=[];for(const i of e){if((i.if!==void 0||i.conditions!==void 0)&&!Fi({if:i.if,conditions:i.conditions},a,this.bindingEngine,`script:${i.id}`)){B.log(`Script skipped (condition not met): ${i.id}`);continue}if(document.getElementById(i.id)){B.log(`Script already loaded: ${i.id}`);continue}const u=new Promise((d,f)=>{const g=document.createElement("script");g.src=i.src,g.id=i.id,g.async=i.async??!0,g.onload=()=>{B.log(`Script loaded successfully: ${i.id}`),d()},g.onerror=()=>{B.warn(`Failed to load script: ${i.id} (${i.src})`),d()},document.head.appendChild(g)});r.push(u)}r.length>0&&(await Promise.all(r),B.log(`All scripts loaded: ${e.filter(i=>!document.getElementById(i.id)||r.length>0).map(i=>i.id).join(", ")}`))}evaluateScriptCondition(e,a){try{if(e.startsWith("{{")&&e.endsWith("}}")){const r=e.slice(2,-2).trim();return new Function("ctx",`
with(ctx) {
try {
return Boolean(${r});
} catch (e) {
return false;
}
}
`)(a)}return!!e}catch(r){return B.warn(`Failed to evaluate script condition: ${e}`,r),!1}}showInitError(e){if(Ju()){B.warn("Init failed while document is unloading — skipping error screen",e);return}const a=Qm(e);rf.renderFromError("app",a,"초기화 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}showTransitionOverlay(e,a){const r=typeof e=="boolean"?{enabled:e,style:"opaque",target:void 0,skeleton:void 0,spinner:void 0}:{enabled:e.enabled,style:e.style||"opaque",target:e.target,skeleton:e.skeleton,spinner:e.spinner,fallback_target:e.fallback_target};if(!r.enabled)return;if(this.hideTransitionOverlay(),r.style==="skeleton"&&r.skeleton?.component&&r.target&&a){this.renderSkeletonOverlay(r.target,r.skeleton,a,r.fallback_target);return}if(r.style==="spinner"&&r.target){this.renderSpinnerOverlay(r.target,r.spinner,r.fallback_target);return}const i=document.documentElement.classList.contains("dark");let l,u="";switch(r.style){case"blur":l=i?"rgba(17,24,39,0.3)":"rgba(255,255,255,0.3)",u="backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);";break;case"fade":l=i?"rgba(17,24,39,0.8)":"rgba(255,255,255,0.8)";break;case"skeleton":l=i?"rgb(17,24,39)":"rgb(249,250,251)";break;default:l=i?"rgb(17,24,39)":"rgb(249,250,251)";break}if(r.target){const d=`#${CSS.escape(r.target)}`,f=document.createElement("style");f.id="g7-transition-overlay",f.textContent=`${d}{position:relative;z-index:0;}${d}::after{content:'';position:absolute;inset:0;background:${l};${u}z-index:2147483647;pointer-events:none;}`,document.head.appendChild(f),this.transitionOverlayEl=f}else{const d=document.createElement("div");d.id="g7-transition-overlay",d.setAttribute("aria-hidden","true"),d.style.position="fixed",d.style.inset="0",d.style.zIndex="9999",d.style.pointerEvents="none",d.style.background=l;for(const f of u.split(";")){const g=f.indexOf(":");g!==-1&&d.style.setProperty(f.slice(0,g).trim(),f.slice(g+1).trim())}document.body.appendChild(d),this.transitionOverlayEl=d}}hideTransitionOverlay(){this.transitionOverlayEl&&(this.transitionOverlayEl.remove(),this.transitionOverlayEl=null),this.hideSkeletonOverlay()}renderSkeletonOverlay(e,a,r,i){const u=da.getInstance().getComponent(a.component);if(!u){B.log(`Skeleton component "${a.component}" not found in registry, falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}let d=document.getElementById(e),f="target";if(!d&&i&&(d=document.getElementById(i),f="fallback"),d||(d=document.getElementById("app"),f="fullpage"),!d){B.log(`Skeleton overlay: no target found (target="#${e}", fallback="${i||"none"}"), falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}this.hideSkeletonOverlay();const m=document.documentElement.classList.contains("dark")?"rgb(17,24,39)":"rgb(249,250,251)",b=f==="fullpage"?"app":f==="fallback"?i:e,v=`#${CSS.escape(b)}`,S=document.createElement("style");S.id="g7-skeleton-overlay-style",S.textContent=`${v}{position:relative;z-index:0;}${v}::after{content:'';position:absolute;inset:0;background:${m};z-index:2147483646;pointer-events:none;}`,document.head.appendChild(S),this.transitionOverlayEl=S;const E=document.createElement("div");if(E.id="g7-skeleton-overlay",E.setAttribute("role","status"),E.setAttribute("aria-busy","true"),E.setAttribute("aria-label","Loading..."),f==="fullpage")E.style.cssText=["position:fixed","inset:0","z-index:20","overflow:hidden","pointer-events:none",`background:${m}`].join(";")+";";else{const R=d.getBoundingClientRect(),D=window.scrollX||document.documentElement.scrollLeft,U=window.scrollY||document.documentElement.scrollTop;E.style.cssText=["position:absolute",`top:${R.top+U}px`,`left:${R.left+D}px`,`width:${R.width}px`,`height:${R.height}px`,"z-index:20","overflow:hidden","pointer-events:none",`background:${m}`].join(";")+";"}document.body.appendChild(E),this.skeletonOverlayContainer=E;const A=r.components||[];let T;if(f==="fullpage")T=A;else{const R=f==="fallback"?i:e;T=this.findComponentChildrenById(A,R)}const L=Ku.createRoot(E);this.skeletonOverlayRoot=L,Er.flushSync(()=>{L.render(Ye.createElement(u,{components:T,options:{animation:a.animation||"pulse",iteration_count:a.iteration_count||5}}))});const M=f==="fullpage"?"fullpage (#app)":f==="fallback"?`fallback (#${i})`:`target (#${e})`;B.log(`Skeleton overlay rendered [${M}] with "${a.component}" (${T.length} components)`)}findComponentChildrenById(e,a){const r=i=>{for(const l of i){if(l.id===a)return l.children||[];if(l.children&&Array.isArray(l.children)){const u=r(l.children);if(u!==null)return u}}return null};return r(e)||e}renderSpinnerOverlay(e,a,r){let i=document.getElementById(e),l="target";if(!i&&r&&(i=document.getElementById(r),l="fallback"),i||(i=document.getElementById("app"),l="fullpage"),!i){B.log(`Spinner overlay: no target found (target="#${e}", fallback="${r||"none"}"), falling back to opaque overlay`),this.showTransitionOverlay({enabled:!0,style:"opaque",target:e});return}this.hideSkeletonOverlay();const u=l==="fullpage"?"app":l==="fallback"?r:e,d=`#${CSS.escape(u)}`,f=document.createElement("style");f.id="g7-skeleton-overlay-style",f.textContent=[`${d}{position:relative;}`,"@keyframes g7-spin{to{transform:rotate(360deg)}}"].join(""),document.head.appendChild(f),this.transitionOverlayEl=f;const g=a?.text||window.G7Core?.t?.("nav.loading")||"";this._spinnerState={target:e,fallbackTarget:r,spinnerConfig:a,resolvedText:g},this._mountSpinnerInTarget(i);const m=l==="fullpage"?"fullpage (#app)":l==="fallback"?`fallback (#${r})`:`target (#${e})`,b=a?.component||"default spinner";B.log(`Spinner overlay rendered [${m}] with "${b}"`)}_mountSpinnerInTarget(e){if(!this._spinnerState)return;const{spinnerConfig:a,resolvedText:r}=this._spinnerState;if(this.skeletonOverlayRoot){try{this.skeletonOverlayRoot.unmount()}catch{}this.skeletonOverlayRoot=null}if(this.skeletonOverlayContainer){try{this.skeletonOverlayContainer.remove()}catch{}this.skeletonOverlayContainer=null}const i=document.createElement("div");if(i.id="g7-skeleton-overlay",i.setAttribute("role","status"),i.setAttribute("aria-busy","true"),e.appendChild(i),this.skeletonOverlayContainer=i,a?.component){const u=da.getInstance().getComponent(a.component);if(u){const d=Ku.createRoot(i);this.skeletonOverlayRoot=d,Er.flushSync(()=>{d.render(Ye.createElement(u,{options:{text:r}}))});return}B.log(`Spinner component "${a.component}" not found in registry, using default spinner`)}i.innerHTML='<div style="position:absolute;inset:0;z-index:2147483647;overflow:hidden;background:var(--g7-overlay-bg, rgb(249,250,251));display:flex;align-items:center;justify-content:center;"><div style="width:32px;height:32px;border:3px solid var(--g7-spinner-color, #9ca3af);border-top-color:transparent;border-radius:50%;animation:g7-spin 0.8s linear infinite;"></div></div>'}reattachSpinnerOverlay(){if(!this._spinnerState)return;const{target:e,fallbackTarget:a}=this._spinnerState;let r=document.getElementById(e);!r&&a&&(r=document.getElementById(a)),r||(r=document.getElementById("app")),r&&(this._mountSpinnerInTarget(r),B.log("Spinner overlay reattached to new DOM target"))}hideSkeletonOverlay(){if(this.skeletonOverlayRoot){try{this.skeletonOverlayRoot.unmount()}catch{}this.skeletonOverlayRoot=null}if(this.skeletonOverlayContainer){try{this.skeletonOverlayContainer.parentNode&&this.skeletonOverlayContainer.remove()}catch{}this.skeletonOverlayContainer=null}const e=document.getElementById("g7-skeleton-overlay-style");e&&e.remove(),this._spinnerState=null}showRouteError(e){if(e instanceof ba&&e.details?.status===401){const r=this.config.templateId||"",i=window.location.pathname,l=r.includes("admin")||i.startsWith("/admin")?"admin":"user",u=i+window.location.search,d=!!Ma().getToken()||e.details?.hadToken===!0,f=ha.getInstance().getLoginRedirectUrl(l,u,d?"session_expired":void 0);window.location.href=f;return}const a=Qm(e);rf.renderFromError("app",a,"페이지 로딩 실패",this.config.debug,{templateId:this.config.templateId,locale:this.config.locale},void 0,e)}async handleServerError(){const e=window.G7Error;if(!e)return!1;B.warn("Server error detected:",e);try{return this.errorPageHandler&&(e.data&&(this.globalState.errorData=e.data),this.errorPageHandler.updateGlobalState(this.globalState),this.errorPageHandler.updateLocale(this.config.locale),await this.errorPageHandler.renderError(e.code,"app"))?(B.log(`${e.code} error page rendered successfully`),!0):(B.log(`Falling back to ErrorDisplay for ${e.code}`),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0)}catch(a){return B.error(`Failed to render ${e.code} page:`,a),this.showInitError(new Error(`Service unavailable (${e.code})`)),!0}}async handleRouteNotFound(e){B.warn("Route not found:",e);try{if(this.errorPageHandler&&(this.errorPageHandler.updateGlobalState(this.globalState),this.errorPageHandler.updateLocale(this.config.locale),await this.errorPageHandler.renderError(404,"app"))){B.log("404 error page rendered successfully");return}B.log("Falling back to ErrorDisplay for 404"),this.showRouteError(new Error(`Page not found: ${e}`))}catch(a){B.error("Failed to render 404 page:",a),this.showRouteError(new Error(`Page not found: ${e}`))}}getRouter(){return this.router}getConfig(){return this.config}getLayoutLoader(){return this.layoutLoader}async reloadExtensionState(){B.log("reloadExtensionState: start");let e;try{const a=await fetch(`/api/templates/${this.config.templateId}/config.json?_=${Date.now()}`);if(a.ok){const r=await a.json();r?.success&&r?.data?.cache_version!==void 0&&(e=r.data.cache_version)}}catch(a){B.warn("reloadExtensionState: failed to fetch config.json",a)}e!==void 0&&e!==this.extensionCacheVersion&&(B.log(`reloadExtensionState: cache version ${this.extensionCacheVersion} -> ${e}`),this.extensionCacheVersion=e,this.saveCacheVersionToStorage(e));try{this.router&&(await this.router.loadRoutes(this.extensionCacheVersion),B.log("reloadExtensionState: routes reloaded"))}catch(a){B.error("reloadExtensionState: routes reload failed",a)}try{this.layoutLoader&&(this.extensionCacheVersion>0&&this.layoutLoader.setCacheVersion(this.extensionCacheVersion),this.layoutLoader.clear(),B.log("reloadExtensionState: layout cache cleared"))}catch(a){B.error("reloadExtensionState: layout cache clear failed",a)}try{const{TranslationEngine:a}=await Promise.resolve().then(()=>Wg),r=a.getInstance();this.extensionCacheVersion>0&&r.setCacheVersion(this.extensionCacheVersion);const i=this.config.locale||"ko",l="en";await r.loadTranslations(this.config.templateId,i,"/api",!0),i!==l&&await r.loadTranslations(this.config.templateId,l,"/api",!0),B.log("reloadExtensionState: translations reloaded")}catch(a){B.error("reloadExtensionState: translations reload failed",a)}try{const a=await fetch(`/api/locales/active?_=${Date.now()}`);if(a.ok){const i=(await a.json())?.data?.locales;if(Array.isArray(i)&&i.length>0){const l=this.globalState.appConfig??{};this.setGlobalState({appConfig:{...l,supportedLocales:i}}),B.log("reloadExtensionState: supportedLocales refreshed",i)}}}catch(a){B.warn("reloadExtensionState: supportedLocales refresh failed",a)}B.log("reloadExtensionState: done")}getActionDispatcher(){return Qa().actionDispatcher}async changeLocale(e){try{if(B.log("Changing locale to:",e),this.config.locale===e){B.log("Locale is already",e);return}this.config.locale=e,this.saveLocaleToStorage(e),await this.saveLocaleToDatabase(e),this.layoutLoader&&(this.layoutLoader.clear(),B.log("Layout cache cleared")),this.errorPageHandler&&(this.errorPageHandler.updateLocale(e),B.log("ErrorPageHandler locale updated")),hc(),await wo({templateId:this.config.templateId,templateType:this.config.templateType,locale:e,debug:this.config.debug,cacheVersion:this.extensionCacheVersion}),B.log("Template Engine re-initialized with new locale");const{getActionDispatcher:a}=await Promise.resolve().then(()=>Ha),r=a();r&&(r.setDefaultContext({navigate:i=>this.router?.navigate(i)}),r.setGlobalStateUpdater((i,l)=>this.setGlobalState(i,l)),B.log("Navigate function and setGlobalState re-injected to ActionDispatcher")),this.reinitializeModuleHandlers(),B.log("Module handlers re-initialized"),this.reinitializeTemplateHandlers(),B.log("Template handlers re-initialized"),this.reinitializePluginHandlers(),B.log("Plugin handlers re-initialized"),this.router&&this.router.navigateToCurrentPath(),B.log("Locale changed successfully to",e)}catch(a){throw B.error("Failed to change locale:",a),a}}loadLocaleFromStorage(){try{return localStorage.getItem(Ca.LOCALE_STORAGE_KEY)}catch(e){return B.warn("Failed to load locale from storage:",e),null}}saveLocaleToStorage(e){try{localStorage.setItem(Ca.LOCALE_STORAGE_KEY,e)}catch(a){B.warn("Failed to save locale to storage:",a)}}async saveLocaleToDatabase(e){const a=localStorage.getItem("auth_token");if(!a){B.log("No auth token, skipping DB locale save");return}let r,i;if(this.config.localeApi)r=this.config.localeApi.endpoint,i=this.config.localeApi.method;else{const l=this.config.templateType==="admin";r=l?"/api/admin/users/me/language":"/api/user/profile/update-language",i=l?"PATCH":"POST"}try{const l=this.getXsrfToken(),u=await fetch(r,{method:i,headers:{"Content-Type":"application/json",Accept:"application/json",...l&&{"X-XSRF-TOKEN":l},Authorization:`Bearer ${a}`},credentials:"include",body:JSON.stringify({language:e})});u.ok?B.log("Locale saved to DB:",e):B.warn("Failed to save locale to DB (UI will still change):",u.statusText)}catch(l){B.warn("Failed to call locale API (UI will still change):",l)}}getXsrfToken(){if(typeof document>"u")return null;const a=`; ${document.cookie}`.split("; XSRF-TOKEN=");return a.length===2?decodeURIComponent(a.pop()?.split(";").shift()||""):null}loadCacheVersionFromStorage(){try{const e=localStorage.getItem(Ca.CACHE_VERSION_STORAGE_KEY);return e?parseInt(e,10):null}catch(e){return B.warn("Failed to load cache version from storage:",e),null}}saveCacheVersionToStorage(e){try{localStorage.setItem(Ca.CACHE_VERSION_STORAGE_KEY,String(e))}catch(a){B.warn("Failed to save cache version to storage:",a)}}reinitializeModuleHandlers(){if(typeof window>"u")return;const e="__",a=window;Object.keys(a).forEach(r=>{if(r.startsWith(e)&&typeof a[r]?.initModule=="function")try{a[r].initModule(),B.log(`Module handler re-initialized: ${r}`)}catch(i){B.warn(`Failed to re-initialize module handlers for ${r}:`,i)}})}reinitializeTemplateHandlers(){if(typeof window>"u")return;const e=window.G7TemplateHandlers;if(!e){B.warn("Template handlers not found on window.G7TemplateHandlers");return}const a=this.getActionDispatcher();if(!a){B.warn("ActionDispatcher not available for template handler registration");return}Object.entries(e).forEach(([r,i])=>{a.registerHandler(r,i)}),B.log(`${Object.keys(e).length} template handler(s) re-registered:`,Object.keys(e))}reinitializePluginHandlers(){if(typeof window>"u")return;const e="__",a=window;Object.keys(a).forEach(r=>{if(r.startsWith(e)&&typeof a[r]?.initPlugin=="function")try{a[r].initPlugin(),B.log(`Plugin handler re-initialized: ${r}`)}catch(i){B.warn(`Failed to re-initialize plugin handlers for ${r}:`,i)}})}getLocale(){return this.config.locale}getErrorPageHandler(){return this.errorPageHandler}getGlobalState(){return{...this.globalState}}setGlobalState(e,a){const r={...this.globalState};typeof e=="function"?this.globalState=e(this.globalState):this.globalState={...this.globalState,...e},B.log("Global state updated:",this.globalState),window.G7Core?.devTools?.captureStateSnapshot?.({source:"setGlobalState",prev:r,next:this.globalState}),this.globalStateListeners.forEach(l=>{l(this.globalState)}),a?.render!==!1&&Promise.resolve().then(()=>Ha).then(({updateTemplateData:l,getState:u})=>{const d=u();d.reactRoot&&d.currentLayoutJson&&l({_global:{...this.globalState},_local:this.globalState._local||{}})})}onGlobalStateChange(e){this.globalStateListeners.add(e)}offGlobalStateChange(e){this.globalStateListeners.delete(e)}async refetchDataSource(e,a){let r=this.currentDataSources.find(i=>i.id===e);if(!r)for(const[,i]of this.modalDataSources){const l=i.find(u=>u.id===e);if(l){r=l;break}}if(!r){B.warn(`Data source not found: ${e}`);return}B.log(`Refetching data source: ${e}`,a?.sync?"(sync mode)":"",a?.globalStateOverride?"(with global override)":"",a?.localStateOverride?"(with local override)":""),$a.setPending(!0);try{const i=new va;this.currentGlobalHeaders.length>0&&i.setGlobalHeaders(this.currentGlobalHeaders);const l=Qa(),u=l.currentDataContext?._global||{},d=a?.globalStateOverride?{...u,...a.globalStateOverride}:u,f=l.currentDataContext?._local||{},g=a?.localStateOverride?{...f,...a.localStateOverride}:f,b=(await i.fetchDataSourcesWithResults([r],this.currentRouteParams,this.currentQueryParams,d,g,{ignoreAutoFetch:!0}))[0];if(b.state==="success"&&b.data!==void 0){this.currentFetchedData[e]=b.data;const v={};this.processInitOptions([r],{[e]:b.data},v);const S=Qa();if(S.bindingEngine){const A=[e];r.initGlobal&&A.push("_global"),r.initLocal&&A.push("_local"),S.bindingEngine.invalidateCacheByKeys(A)}const E={[e]:b.data};return Object.keys(v).length>0&&(E._localInit=v),r.initGlobal&&(E._global={...this.globalState}),is(E,a?.sync?{sync:!0}:void 0),B.log(`Data source refetched successfully: ${e}`),b.data}else if(b.state==="error"){B.error(`Failed to refetch data source: ${e}`,b.error);return}}catch(i){B.error(`Error refetching data source: ${e}`,i);return}finally{$a.setPending(!1)}}registerModalDataSources(e,a){this.modalDataSources.set(e,a),B.log(`Modal data sources registered: ${e} (${a.length} sources)`)}unregisterModalDataSources(e){this.modalDataSources.delete(e),B.log(`Modal data sources unregistered: ${e}`)}getDataSource(e){return this.currentFetchedData[e]}setDataSource(e,a,r){if(!e){B.warn("setDataSource: dataSourceId is required");return}const{merge:i=!1,sync:l=!1}=r||{};i&&this.currentFetchedData[e]?this.currentFetchedData[e]={...this.currentFetchedData[e],...a}:this.currentFetchedData[e]=a,Promise.resolve().then(()=>Ha).then(({updateTemplateData:u})=>{u({[e]:this.currentFetchedData[e]},l?{sync:!0}:void 0)}),B.log(`setDataSource: Updated ${e}`,i?"(merged)":"(replaced)")}updateDataSourceItem(e,a,r,i,l){const{idField:u="id",merge:d=!0,skipRender:f=!1}=l||{},g=this.currentFetchedData[e];if(!g)return B.warn(`updateDataSourceItem: DataSource '${e}' not found`),!1;const m=this.parseItemPath(a);let b=g;for(const E of m)if(b=b?.[E],b===void 0)return B.warn(`updateDataSourceItem: Path '${a}' not found in dataSource`),!1;if(!Array.isArray(b))return B.warn(`updateDataSourceItem: Target at '${a}' is not an array`),!1;const v=b.findIndex(E=>String(E[u])===String(r));if(v===-1)return B.warn(`updateDataSourceItem: Item with ${u}='${r}' not found`),!1;d?b[v]=this.deepMerge(b[v],i):b[v]={...b[v],...i};const S=window.G7Core?.devTools;return S?.isEnabled?.()&&S.trackDataSourceUpdate?.({dataSourceId:e,updateType:"partial",itemPath:a,itemId:r,updates:i,timestamp:Date.now()}),f||Promise.resolve().then(()=>Ha).then(({updateTemplateData:E})=>{E({[e]:this.currentFetchedData[e]},{sync:!1})}),B.log(`updateDataSourceItem: Updated ${e}.${a}[${u}=${r}]`),!0}parseItemPath(e){const a=[],r=/([^\.\[\]]+)|\[(\d+)\]/g;let i;for(;(i=r.exec(e))!==null;)i[1]!==void 0?a.push(i[1]):i[2]!==void 0&&a.push(parseInt(i[2],10));return a}deepMerge(e,a){if(a==null)return e;if(typeof a!="object"||Array.isArray(a))return a;const r={...e};for(const i of Object.keys(a))typeof a[i]=="object"&&a[i]!==null&&!Array.isArray(a[i])?r[i]=this.deepMerge(r[i]||{},a[i]):r[i]=a[i];return r}setValueAtPath(e,a,r,i="deep"){const l=a.split(".");let u=e;for(let g=0;g<l.length-1;g++){const m=l[g];(u[m]===void 0||u[m]===null||typeof u[m]!="object")&&(u[m]={}),u=u[m]}const d=l[l.length-1],f=u[d];i==="replace"||f===void 0?u[d]=r:i==="shallow"?typeof f=="object"&&typeof r=="object"&&!Array.isArray(r)?u[d]={...f,...r}:u[d]=r:typeof f=="object"&&typeof r=="object"&&!Array.isArray(r)?u[d]=this.deepMerge(f,r):u[d]=r}flattenNestedObjectToMappings(e,a=""){const r=[];for(const[i,l]of Object.entries(e)){if(i==="_merge")continue;const u=a?`${a}.${i}`:i;typeof l=="string"?r.push({targetPath:u,sourcePath:l}):typeof l=="object"&&l!==null&&!Array.isArray(l)&&r.push(...this.flattenNestedObjectToMappings(l,u))}return r}async updateQueryParams(e,a){B.log("updateQueryParams:",e);const r=new URL(e,window.location.origin),i=new URLSearchParams(r.search);window.history.replaceState(null,"",e),B.log("URL updated via replaceState"),this.currentQueryParams=i,B.log("currentQueryParams updated:",Object.fromEntries(i.entries()));const l=new va,u=Qa().currentDataContext?._global||this.globalState||{},d={route:this.currentRouteParams||{},query:ey(this.currentQueryParams),_global:u},f=Array.isArray(this.currentRawDataSources)&&this.currentRawDataSources.length>0?l.filterByCondition(this.currentRawDataSources,d):this.currentDataSources;this.currentDataSources=f;const g=f.filter(A=>A.auto_fetch!==!1&&A.type!=="websocket");if(g.length===0){B.log("No auto_fetch data sources to refetch");return}B.log(`Refetching ${g.length} auto_fetch data sources`),$a.setPending(!0);const m=Qa().currentLayoutJson,b=m?.transition_overlay,v=Array.isArray(b?.wait_for)?b.wait_for:[],S=g.some(A=>(A.loading_strategy||"progressive")==="blocking"),E=v.length>0&&g.some(A=>v.includes(A.id)&&A.type!=="websocket"&&(A.loading_strategy||"progressive")!=="background");if((S||E)&&b&&typeof b=="object"){const A=a?.transitionOverlayTarget||b.target;b.enabled&&b.style==="skeleton"&&b.skeleton?.component&&A?this.renderSkeletonOverlay(A,b.skeleton,m,b.fallback_target):b.enabled&&b.style==="spinner"&&A&&this.renderSpinnerOverlay(A,b.spinner,b.fallback_target)}try{const A=new va;this.currentGlobalHeaders.length>0&&A.setGlobalHeaders(this.currentGlobalHeaders);const T=Qa(),L=T.currentDataContext?._global||{},M=await A.fetchDataSourcesWithResults(g,this.currentRouteParams,this.currentQueryParams,L,void 0,{ignoreAutoFetch:!1}),R={},D={},U=new Map(g.map(j=>[j.id,j]));for(const j of M){const q=U.get(j.id);if(!q){B.warn(`Refetch result id not found in autoFetchDataSources: ${j.id}`);continue}const X=j.id;j.state==="success"&&j.data!==void 0?(this.currentFetchedData[X]=j.data,R[X]=j.data,this.processInitOptions([q],{[X]:j.data},D),B.log(`Data source refetched: ${X}`)):j.state==="error"&&B.error(`Failed to refetch data source: ${X}`,j.error)}if(T.bindingEngine){const j=Object.keys(R);j.push("query"),T.bindingEngine.invalidateCacheByKeys(j)}if(Object.keys(D).length>0&&(R._localInit=D),Object.keys(R).length>0){if(R.query=ey(this.currentQueryParams),T.currentLayoutJson?.computed&&Object.keys(T.currentLayoutJson.computed).length>0){const j={...T.currentDataContext,...R,query:R.query},q=this.calculateComputed(T.currentLayoutJson.computed,j);Object.keys(q).length>0&&(R._computed=q,this.globalState._computed=q,B.log("Computed values recalculated in updateQueryParams:",Object.keys(q)))}is(R,{sync:!0}),B.log("Template data updated with new query params")}}catch(A){B.error("Error in updateQueryParams:",A)}finally{$a.setPending(!1),this.hideTransitionOverlay()}}calculateComputed(e,a){const r={},i=new wn;for(const[l,u]of Object.entries(e))try{let d;if(this.isComputedSwitchDefinition(u))d=i.resolveSwitch(u,a,{skipCache:!0});else if(typeof u=="string")if(u.startsWith("{{")&&u.endsWith("}}")){const f=u.slice(2,-2).trim();d=this.evaluateComputedExpression(f,a)}else d=u;r[l]=d,B.log(`Computed ${l}:`,d)}catch(d){B.warn(`Failed to calculate computed value: ${l}`,d),r[l]=void 0}return r}isComputedSwitchDefinition(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&"$switch"in e&&"$cases"in e}evaluateComputedExpression(e,a){try{return new Function("ctx",`
with(ctx) {
try {
return ${e};
} catch (e) {
return undefined;
}
}
`)(a)}catch(r){B.warn(`Expression evaluation failed: ${e}`,r);return}}async executeInitActions(e,a={}){const{getActionDispatcher:r}=await Promise.resolve().then(()=>Ha),i=r();if(!i){B.warn("ActionDispatcher not available for init_actions");return}B.log("Executing init_actions:",e.map(d=>d.handler)),B.log("Init actions dataContext:",a),B.log("Init actions dataContext._global:",a._global);const l=e.map(d=>d.handler).filter(d=>d.includes("."));l.length>0&&await this.waitForHandlers(i,l);let u={...a};for(const d of e)try{const f={type:"click",handler:d.handler,target:d.target,params:d.params,resultTo:d.resultTo,onSuccess:d.onSuccess,onError:d.onError,if:d.if,conditions:d.conditions,auth_mode:d.auth_mode,auth_required:d.auth_required},g=i.createHandler(f,u),m=new Event("init");await g(m),B.log(`Init action executed: ${d.handler}`);const b=this.globalState;u={...u,_global:{...b},_local:b._local||u._local||{}},B.log(`Data context refreshed after ${d.handler}:`,{cartKey:u._global?.cartKey})}catch(f){B.error(`Failed to execute init action: ${d.handler}`,f)}}async waitForHandlers(e,a,r=5e3){const i=Date.now(),l=50,u=()=>a.every(f=>e.customHandlers?.has(f));if(u()){B.log("All module handlers already registered");return}const d=of().getFailedJsAssets();if(d.length>0){const f=d.some(b=>b==="module"||b==="plugin"),g=a.filter(b=>!e.customHandlers?.has(b)),m=g.length>0&&g.every(b=>d.some(v=>b.startsWith(`${v}.`)));if(f||m){B.warn("Extension asset load failed — not waiting for handlers that will never register:",{pending:g,failedAssets:d});return}}return B.log("Waiting for module handlers:",a),new Promise(f=>{const g=()=>{if(u()){B.log("All module handlers now registered"),f();return}if(Date.now()-i>=r){const m=a.filter(b=>!e.customHandlers?.has(b));B.warn("Timeout waiting for handlers:",m),f();return}setTimeout(g,l)};g()})}};$(Ca,"LOCALE_STORAGE_KEY","g7_locale"),$(Ca,"CACHE_VERSION_STORAGE_KEY","g7_cache_version");let mo=Ca;function cf(o){const e=new mo(o);return o.websocket&&(cc.configure(o.websocket),B.log("WebSocket 설정 완료")),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{e.init(),window.__templateApp=e}):(e.init(),window.__templateApp=e),e}typeof window<"u"&&(window.G7Core=window.G7Core||{},window.G7Core.initTemplateApp=cf,window.G7Core.dataSource={refetch:async(o,e)=>{const a=window.__templateApp;if(!a){B.warn("TemplateApp not initialized (G7Core.dataSource.refetch)");return}return a.refetchDataSource(o,e)},get:o=>{const e=window.__templateApp;if(!e){B.warn("TemplateApp not initialized (G7Core.dataSource.get)");return}return e.getDataSource(o)}});function z_(o={}){const{checked:e,value:a,name:r,type:i="checkbox"}=o,u=a!==void 0?a:i==="checkbox"||i==="radio"?e??!1:String(e??""),d={checked:e??!1,value:u,name:r??"",type:i};return{target:d,currentTarget:d,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("change"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"change",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{}}}function j_(o={}){const{button:e=0,clientX:a=0,clientY:r=0}=o;return{button:e,clientX:a,clientY:r,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new MouseEvent("click"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"click",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div")}}function U_(){return{preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new Event("submit"),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:"submit",isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("form"),currentTarget:document.createElement("form")}}function B_(o,e="keydown"){return{key:o,code:o.length===1?`Key${o.toUpperCase()}`:o,preventDefault:()=>{},stopPropagation:()=>{},nativeEvent:new KeyboardEvent(e,{key:o}),bubbles:!0,cancelable:!0,defaultPrevented:!1,eventPhase:Event.AT_TARGET,isTrusted:!1,timeStamp:Date.now(),type:e,isDefaultPrevented:()=>!1,isPropagationStopped:()=>!1,persist:()=>{},target:document.createElement("div"),currentTarget:document.createElement("div"),altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,repeat:!1}}const q_={justify:/^justify-(start|end|center|between|around|evenly)$/,items:/^items-(start|end|center|baseline|stretch)$/,content:/^content-(start|end|center|between|around|evenly|stretch)$/,self:/^self-(auto|start|end|center|stretch|baseline)$/,flex:/^flex-(row|row-reverse|col|col-reverse|wrap|wrap-reverse|nowrap|1|auto|initial|none)$/,grow:/^(grow|grow-0)$/,shrink:/^(shrink|shrink-0)$/,basis:/^basis-/,order:/^(order-|-)order-/,gap:/^gap(-x|-y)?-/,gridCols:/^grid-cols-/,gridRows:/^grid-rows-/,colSpan:/^col-(span-|start-|end-)/,rowSpan:/^row-(span-|start-|end-)/,display:/^(block|inline-block|inline|flex|inline-flex|table|inline-table|table-caption|table-cell|table-column|table-column-group|table-footer-group|table-header-group|table-row-group|table-row|flow-root|grid|inline-grid|contents|list-item|hidden)$/,position:/^(static|fixed|absolute|relative|sticky)$/,inset:/^(inset|top|right|bottom|left)-/,zIndex:/^z-/,width:/^w-/,minWidth:/^min-w-/,maxWidth:/^max-w-/,height:/^h-/,minHeight:/^min-h-/,maxHeight:/^max-h-/,padding:/^p[xytblr]?-/,margin:/^-?m[xytblr]?-/,space:/^space-(x|y)-/,fontSize:/^text-(xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/,fontWeight:/^font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/,fontStyle:/^(italic|not-italic)$/,fontFamily:/^font-(sans|serif|mono)/,textAlign:/^text-(left|center|right|justify|start|end)$/,textColor:/^text-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,textDecoration:/^(underline|overline|line-through|no-underline)$/,textTransform:/^(uppercase|lowercase|capitalize|normal-case)$/,lineHeight:/^leading-/,letterSpacing:/^tracking-/,textOverflow:/^(truncate|text-ellipsis|text-clip)$/,whitespace:/^whitespace-/,wordBreak:/^break-/,bgColor:/^bg-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,bgGradient:/^bg-gradient-/,bgSize:/^bg-(auto|cover|contain)$/,bgPosition:/^bg-(bottom|center|left|left-bottom|left-top|right|right-bottom|right-top|top)$/,bgRepeat:/^bg-(repeat|no-repeat|repeat-x|repeat-y|repeat-round|repeat-space)$/,bgAttachment:/^bg-(fixed|local|scroll)$/,bgClip:/^bg-clip-/,bgOrigin:/^bg-origin-/,borderWidth:/^border(-[xytblr])?(-0|-2|-4|-8)?$/,borderColor:/^border-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,borderStyle:/^border-(solid|dashed|dotted|double|hidden|none)$/,borderRadius:/^rounded(-[tblrse]{1,2})?(-none|-sm|-md|-lg|-xl|-2xl|-3xl|-full)?$/,ringWidth:/^ring(-0|-1|-2|-4|-8|-inset)?$/,ringColor:/^ring-(inherit|current|transparent|black|white|slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-/,ringOffset:/^ring-offset-/,shadow:/^shadow(-sm|-md|-lg|-xl|-2xl|-inner|-none)?$/,opacity:/^opacity-/,mixBlend:/^mix-blend-/,bgBlend:/^bg-blend-/,blur:/^blur(-none|-sm|-md|-lg|-xl|-2xl|-3xl)?$/,brightness:/^brightness-/,contrast:/^contrast-/,grayscale:/^grayscale(-0)?$/,hueRotate:/^-?hue-rotate-/,invert:/^invert(-0)?$/,saturate:/^saturate-/,sepia:/^sepia(-0)?$/,backdropBlur:/^backdrop-blur-/,backdropBrightness:/^backdrop-brightness-/,backdropContrast:/^backdrop-contrast-/,backdropGrayscale:/^backdrop-grayscale-/,backdropHueRotate:/^backdrop-hue-rotate-/,backdropInvert:/^backdrop-invert-/,backdropOpacity:/^backdrop-opacity-/,backdropSaturate:/^backdrop-saturate-/,backdropSepia:/^backdrop-sepia-/,scale:/^scale(-x|-y)?-/,rotate:/^-?rotate-/,translate:/^-?translate-[xy]-/,skew:/^-?skew-[xy]-/,transformOrigin:/^origin-/,transition:/^transition(-none|-all|-colors|-opacity|-shadow|-transform)?$/,duration:/^duration-/,ease:/^ease-(linear|in|out|in-out)$/,delay:/^delay-/,animate:/^animate-/,cursor:/^cursor-/,userSelect:/^select-/,pointerEvents:/^pointer-events-/,resize:/^resize(-none|-x|-y)?$/,scrollBehavior:/^scroll-(auto|smooth)$/,touchAction:/^touch-/,overflow:/^overflow(-x|-y)?-(auto|hidden|clip|visible|scroll)$/,overscroll:/^overscroll(-x|-y)?-(auto|contain|none)$/,visibility:/^(visible|invisible|collapse)$/,aspectRatio:/^aspect-/,columns:/^columns-/,breakAfter:/^break-after-/,breakBefore:/^break-before-/,breakInside:/^break-inside-/,boxDecorationBreak:/^box-decoration-/,boxSizing:/^box-(border|content)$/,float:/^float-(right|left|none)$/,clear:/^clear-(left|right|both|none)$/,isolation:/^(isolate|isolation-auto)$/,objectFit:/^object-(contain|cover|fill|none|scale-down)$/,objectPosition:/^object-/};function ty(o){const e=o.replace(/^(dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+/,"");for(const[a,r]of Object.entries(q_))if(r.test(e))return a;return null}function ny(o){const e=o.match(/^((dark:|hover:|focus:|active:|disabled:|group-hover:|sm:|md:|lg:|xl:|2xl:)+)/);return e?e[1]:""}function P_(o,e){if(!e||e.trim()==="")return o;if(!o||o.trim()==="")return e;const a=o.split(/\s+/).filter(Boolean),r=e.split(/\s+/).filter(Boolean),i=new Map;for(const u of r){const d=ty(u);if(d){const f=ny(u),g=`${d}:${f}`;i.set(g,u)}}return[...a.filter(u=>{const d=ty(u);if(!d)return!0;const f=ny(u),g=`${d}:${f}`;return!i.has(g)}),...r].join(" ")}function G_(o){return Object.entries(o).filter(([,e])=>e).map(([e])=>e).join(" ")}function V_(...o){return o.filter(e=>typeof e=="string"&&e.length>0).join(" ")}const we=ct("G7CoreGlobals");function F_(){window.React=Ye,window.ReactDOM={...Wu,createPortal:Er.createPortal,unstable_batchedUpdates:o=>o()},window.ReactJSXRuntime=q0,we.log("전역 객체 window.React, window.ReactDOM, window.ReactJSXRuntime에 노출됨")}function K_(o){const e=new Map,a=Ar.getInstance();o.componentEvent={on:(r,i)=>(e.has(r)||e.set(r,new Set),e.get(r).add(i),a.trackEventSubscribe(r),()=>{e.get(r)?.delete(i),a.trackEventUnsubscribe(r)}),emit:async(r,i)=>{const l=e.get(r),u=l?.size??0;if(!l||l.size===0)return a.trackEventEmit(r,i,0),[];let d,f=[];try{f=await Promise.all(Array.from(l).map(async g=>{try{return await g(i)}catch(m){throw we.error(`componentEvent: Error in listener for "${r}":`,m),m}}))}catch(g){d=g instanceof Error?g:new Error(String(g))}if(a.trackEventEmit(r,i,u,f,d),d)throw d;return f},off:r=>{e.delete(r),a.trackEventOff(r)},clear:()=>{e.clear(),a.trackEventClear()}},we.log("전역 객체 window.G7Core.componentEvent에 노출됨")}function W_(o){o.__runtime||(o.__runtime={DynamicRenderer:Ia,ComponentRegistry:da,TranslationEngine:Sr,DataSourceManager:va,dataSourceManager:T_,DataBindingEngine:wn,dataBindingEngine:BS,ActionDispatcher:ro,TranslationReactContext:Qd,TranslationProvider:sc,useTranslation:Um,ResponsiveContext:kd,ResponsiveProvider:Kl,useResponsive:Dd,responsiveManager:oi,BREAKPOINT_PRESETS:xl,AuthManager:ha,createLogger:ct,G7DevToolsCore:Ar},we.log("전역 객체 window.G7Core.__runtime(코어 런타임 표면)에 노출됨"))}function Y_(o){if(o.layoutEditor&&o.layoutEditor.__isStub!==!0||o.layoutEditor&&o.layoutEditor.__isStub===!0)return;const e=[],a=[];o.layoutEditor={__isStub:!0,__queue:e,__readyCallbacks:a,registerWidget:(r,i)=>e.push(["widget",r,i]),registerNodeEditor:(r,i)=>e.push(["nodeEditor",r,i]),registerCanvasOverlay:(r,i)=>e.push(["canvasOverlay",r,i]),onReady:r=>{typeof r=="function"&&a.push(r)}},we.log("전역 객체 window.G7Core.layoutEditor 예약 접수함(stub) 노출됨")}function X_(o,e){o.useTranslation=Um,o.t=(a,r)=>{const i=e.getState();if(!i.translationEngine||!i.translationContext)return a;if(r){const l="|"+Object.entries(r).map(([u,d])=>`${u}=${d}`).join("|");return i.translationEngine.translate(a,i.translationContext,l)}return i.translationEngine.translate(a,i.translationContext)},we.log("전역 객체 window.G7Core.useTranslation에 노출됨")}function J_(o,e){o.createChangeEvent=z_,o.createClickEvent=j_,o.createSubmitEvent=U_,o.createKeyboardEvent=B_,o.uuid=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)}),o.createLogger=ct,we.log("전역 객체 window.G7Core.createLogger에 노출됨"),o.renderItemChildren=(a,r,i,l,u)=>{const d=e.getState(),m={_global:window.__templateApp?.getGlobalState?.()||{},_local:r._local||{},_computed:r._computed||{},...r},b=new Set,v=(E,A)=>{const T=m._global?._remountKeys;return E&&T?.[E]&&!b.has(E)?(b.add(E),`${E}-remount-${T[E]}`):E||A},S={translationContext:d.translationContext,translationEngine:d.translationEngine,bindingEngine:d.bindingEngine,actionDispatcher:d.actionDispatcher,getRemountKey:v,...u};return Ys(a,m,i,l,S)},o.getComponentMap=()=>da.getInstance().getComponentMap(),o.renderComponentLayout=(a,r,i)=>{if(!a||!Array.isArray(a)||a.length===0)return null;const l=da.getInstance().getComponentMap(),u=e.getState(),f=window.__templateApp?.getGlobalState?.()||{},g={_global:f._global||{},_local:f._local||{},_computed:f._computed||{},...r},m=new Set,b=(v,S)=>{const E=g._global?._remountKeys;return v&&E?.[v]&&!m.has(v)?(m.add(v),`${v}-remount-${E[v]}`):v||S};return Ys(a,g,l,i,{translationContext:u.translationContext,translationEngine:u.translationEngine,bindingEngine:u.bindingEngine,actionDispatcher:u.actionDispatcher,getRemountKey:b})},o.renderExpandContent=a=>{const{children:r,row:i,expandContext:l,componentContext:u,keyPrefix:d}=a;if(!r||!Array.isArray(r)||r.length===0)return null;const f=a.componentMap||da.getInstance().getComponentMap(),g=e.getState(),m=o.state?.get?.()||{},b=u?.stateRef?.current??u?.state??{},v={...m._local||{},...b},S=u?.computedRef?.current??m._computed??{},E=g.bindingEngine??o.getDataBindingEngine?.(),A={...m,_local:v,_computed:S,row:i,item:i,$item:i};let T={};if(l&&typeof l=="object"&&E)try{for(const[D,U]of Object.entries(l))if(typeof U=="string"){const j=U.match(/^\{\{([^}]+)\}\}$/);if(j){const q=j[1].trim();try{T[D]=E.evaluateExpression(q,A,{skipCache:!0})}catch{T[D]=void 0}}else T[D]=E.resolveBindings(U,A,{skipCache:!0})}else T[D]=U}catch(D){we.warn("renderExpandContent: expandContext 평가 오류:",D)}const L={row:i,item:i,$item:i,_local:v,_global:m._global||{},_computed:m._computed||{},...T},M=new Set,R=(D,U)=>{const j=L._global?._remountKeys;return D&&j?.[D]&&!M.has(D)?(M.add(D),`${D}-remount-${j[D]}`):D||U};return Ys(r,L,f,d,{translationContext:g.translationContext,translationEngine:g.translationEngine??void 0,bindingEngine:g.bindingEngine??void 0,actionDispatcher:g.actionDispatcher,componentContext:u,getRemountKey:R})},o.$get=function(r,i,l=void 0){if(r==null)return l;const u=Array.isArray(i)?i:[i];if(u.length===0)return r;let d=r;for(const f of u){if(d==null||f==null)return l;d=d[f]}return d??l},we.log("전역 객체 window.G7Core.renderItemChildren에 노출됨"),we.log("전역 객체 window.G7Core.renderComponentLayout에 노출됨"),we.log("전역 객체 window.G7Core.renderExpandContent에 노출됨"),we.log("전역 객체 window.G7Core.$get에 노출됨")}function Q_(o){o.dispatch=async(e,a)=>{const r=window.__templateApp;if(!r)return we.warn("G7Core.dispatch: TemplateApp이 초기화되지 않았습니다."),{success:!1,error:new Error("TemplateApp이 초기화되지 않았습니다.")};const i=r.getActionDispatcher?.();if(!i)return we.warn("G7Core.dispatch: ActionDispatcher를 찾을 수 없습니다."),{success:!1,error:new Error("ActionDispatcher를 찾을 수 없습니다.")};const l=r.getRouter?.(),u=r.getGlobalState?.(),d=r.setGlobalState?.bind(r),g=a?.componentContext||window.__g7ActionContext,m=window.__g7PendingLocalState;let b=g?.state??u;m&&g&&(b=m,we.log("[dispatch] Using __g7PendingLocalState for context.state:",m));let v=g?.data??u;m&&g?.data?._local&&(v={...g.data,_local:m},we.log("[dispatch] Updated context.data._local with pendingLocalState"));const S={navigate:l?(E,A)=>l.navigate(E,A):void 0,setState:g?.setState??d,state:b,data:v,_isDispatchFallbackContext:!g?.setState};if(e.debounce){const E=e.debounceKey||`dispatch-${e.handler}`,A=typeof e.debounce=="number"?e.debounce:e.debounce.delay;return i.debouncedCall(E,A,()=>{const{debounce:T,debounceKey:L,...M}=e;i.dispatchAction(M,S)}),{success:!0,debounced:!0}}try{return await i.dispatchAction(e,S)}catch(E){return we.error("G7Core.dispatch: 액션 실행 오류:",E),{success:!1,error:E instanceof Error?E:new Error(String(E))}}},we.log("전역 객체 window.G7Core.dispatch에 노출됨")}function yo(o){const e={};for(const[a,r]of Object.entries(o))if(a.includes(".")){const i=a.split(".");let l=e;for(let u=0;u<i.length-1;u++){const d=i[u];d in l?(typeof l[d]!="object"||l[d]===null)&&(l[d]={}):l[d]={},l=l[d]}l[i[i.length-1]]=r}else e[a]=r;return e}function ay(o,e=""){const a=[];if(!o||typeof o!="object")return a;for(const r of Object.keys(o)){const i=e?`${e}.${r}`:r,l=o[r];l&&typeof l=="object"&&!Array.isArray(l)?a.push(...ay(l,i)):a.push(i)}return a}function Z_(o){const e=Object.keys(o);return e.length>0&&e.every(a=>/^\d+$/.test(a))}function ry(o,e){const a={...o};for(const r of Object.keys(e))r in a?a[r]!==null&&typeof a[r]=="object"&&!Array.isArray(a[r])&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])&&(a[r]=ry(a[r],e[r])):a[r]=e[r];return a}function Zn(o,e){if(Array.isArray(o)&&!Array.isArray(e)&&Z_(e)){const r=Object.keys(e).map(l=>parseInt(l,10));if(!((r.length>0?Math.max(...r):0)>=o.length+r.length+10)){const l=[...o];for(const[u,d]of Object.entries(e)){const f=parseInt(u,10);f>=0&&f<l.length?d!==null&&typeof d=="object"&&!Array.isArray(d)&&l[f]!==null&&typeof l[f]=="object"?l[f]=Zn(l[f],d):l[f]=d:f>=l.length&&(l[f]=d)}return l}}const a={...o};for(const[r,i]of Object.entries(e))i!==null&&typeof i=="object"&&!Array.isArray(i)?a[r]!==null&&typeof a[r]=="object"?a[r]=Zn(a[r],i):a[r]={...i}:a[r]=i;return a}function eA(o){o.state={get:()=>window.__templateApp?.getGlobalState?.()||{},set:(e,a)=>{const r=window.__templateApp;if(r?.setGlobalState&&r?.getGlobalState){const i=a?.merge||"deep",l=yo(e);let u;if(i==="replace")u=l;else if(i==="shallow")u={...r.getGlobalState(),...l};else{const d=r.getGlobalState();u=Zn(d,l)}r.setGlobalState(u,{render:a?.render})}else we.warn("G7Core.state.set: TemplateApp이 초기화되지 않았습니다.")},setLocal:(e,a)=>{const r=window.__templateApp;if(a?.render===!1&&!a?.selfManaged){const T=window.__g7AutoBindingPaths;T&&T.size>0&&ay(yo(e)).some(M=>T.has(M))&&(we.log("[setLocal] render:false + 자동바인딩 경로 겹침 감지 → render:true 자동 승격 (engine-v1.43.0)"),a={...a,render:!0})}if(a?.debounce){const T=r?.getActionDispatcher?.();if(T){const L=a.debounceKey||`setLocal-${Object.keys(e).join(",")}`,{debounce:M,debounceKey:R,...D}=a;T.debouncedCall(L,a.debounce,()=>{o.state.setLocal(e,D)});return}}const i=a?.scope??"current",l=a?.merge||"deep",u=window.__g7ActionContext,d=yo(e);if(i==="parent"||i==="root"){const T=window.__g7LayoutContextStack||[];if(T.length>0){const L=i==="parent"?T[T.length-1]:T[0];if(L?.setState){L.setState(M=>l==="replace"?d:l==="shallow"?{...M||{},...d}:Zn(M||{},d)),we.log(`[setLocal] scope=${i}: 타겟 컨텍스트에 상태 업데이트 (mergeMode=${l})`,d);return}}we.warn(`[setLocal] scope=${i}: 레이아웃 컨텍스트 스택이 비어있습니다. current로 폴백합니다.`)}const f=window.__g7PendingLocalState,g=r?.getGlobalState?.()?._local||{},v=!((window.__g7LayoutContextStack||[]).length>0)&&u?.state?u.state:void 0,S=v?ry(g,v):g,E=f||S;let A;if(l==="replace"?A=d:l==="shallow"?A={...E,...d}:A=Zn(E,d),r?.setGlobalState&&(r.setGlobalState({_local:A},{render:a?.render}),we.log(`[setLocal] globalLocal updated via setGlobalState (mergeMode=${l}, render=${a?.render??!0}):`,d)),window.__g7PendingLocalState=A,we.log("[setLocal] __g7PendingLocalState updated:",A),window.__g7SequenceLocalSync=A,window.__g7LastSetLocalSnapshot=A,l==="replace")window.__g7ForcedLocalFields=d;else{const T=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Zn(T,d)}if(we.log("[setLocal] __g7ForcedLocalFields updated:",d),l==="replace")window.__g7SetLocalOverrideKeys=d;else{const T=window.__g7SetLocalOverrideKeys||{};window.__g7SetLocalOverrideKeys=Zn(T,d)}we.log("[setLocal] __g7SetLocalOverrideKeys updated:",d),u?.setState&&u.setState(T=>l==="replace"?d:l==="shallow"?{...T||{},...d}:Zn(T||{},d)),r?.setGlobalState||we.warn("G7Core.state.setLocal: TemplateApp이 없습니다.")},getLocal:()=>{const r=(window.__templateApp?.getGlobalState?.()||{})._local||{},i=window.__g7PendingLocalState;if(i)return Zn(r,i);const l=window.__g7LastSetLocalSnapshot;return l&&l!==r?Zn(r,l):r},update:e=>{const a=window.__templateApp;if(a?.getGlobalState&&a?.setGlobalState){const r=a.getGlobalState(),i=e(r);a.setGlobalState(i)}else we.warn("G7Core.state.update: TemplateApp이 초기화되지 않았습니다.")},subscribe:e=>{const a=window.__templateApp;return a?.onGlobalStateChange?a.onGlobalStateChange(e):(we.warn("G7Core.state.subscribe: TemplateApp이 초기화되지 않았습니다."),()=>{})},getDataSource:e=>window.__templateApp?.getDataSource?.(e),getIsolated:e=>e?window.__g7IsolatedStates?.[e]?.state??null:window.__g7ActionContext?.isolatedContext?.state??null,setIsolated:(e,a,r)=>{let i,l,u;typeof e=="string"?(i=e,l=a||{},u=r):(l=e,u=a&&typeof a=="object"&&"merge"in a?a:r);const d=u?.merge||"deep",f=yo(l);if(i){const b=window.__g7IsolatedStates?.[i];b?.mergeState?b.mergeState(f,d):we.warn(`G7Core.state.setIsolated: scopeId '${i}'를 찾을 수 없습니다.`);return}const g=window.__g7ActionContext;g?.isolatedContext?.mergeState?g.isolatedContext.mergeState(f,d):we.warn("G7Core.state.setIsolated: 액션 컨텍스트에 isolatedContext가 없습니다.")},getParent:()=>{const e=window.__g7LayoutContextStack||[];if(e.length===0)return we.log("[getParent] 레이아웃 컨텍스트 스택이 비어있습니다."),null;const a=e[e.length-1];if(!a)return null;const r=a.dataContext||{};return{_local:a.state||r._local||{},_global:r._global||o.state.get()||{},setState:a.setState}},setParentLocal:(e,a,r)=>{const i=window.__g7LayoutContextStack||[];if(i.length===0){we.warn("[setParentLocal] 레이아웃 컨텍스트 스택이 비어있습니다.");return}const l=i[i.length-1];if(!l?.setState){we.warn("[setParentLocal] 부모 컨텍스트에 setState가 없습니다.");return}let u,d;typeof e=="string"?(u={[e]:a},d=r):(u=e,d=a&&typeof a=="object"&&"merge"in a?a:r);const f=d?.merge||"deep",g=yo(u),m=l.state?._local!==void 0,b=m?l.state._local:l.state||{};let v;f==="replace"?v=g:f==="shallow"?v={...b,...g}:v=Zn(b,g),window.__g7PendingLocalState=v;const S=window.__templateApp;if(S?.setGlobalState&&S.setGlobalState({_local:v}),l.setState(v),m?l.state._local=v:l.state=v,l.dataContext&&(l.dataContext._local=v),f==="replace")window.__g7ForcedLocalFields=g;else{const E=window.__g7ForcedLocalFields||{};window.__g7ForcedLocalFields=Zn(E,g)}xd()},setParentGlobal:(e,a)=>{let r;typeof e=="string"?r={[e]:a}:r=e,o.state.set(r),we.log("[setParentGlobal] 전역 상태 업데이트:",r)}},window.__g7IsolatedStates||(window.__g7IsolatedStates={}),o.state.getGlobal=o.state.get,o.state.setGlobal=o.state.set,we.log("전역 객체 window.G7Core.state에 노출됨")}function tA(o){o.dataSource={get:e=>window.__templateApp?.getDataSource?.(e),set:(e,a,r)=>{const i=window.__templateApp;i?.setDataSource?i.setDataSource(e,a,r):we.warn("G7Core.dataSource.set: TemplateApp이 초기화되지 않았습니다.")},refetch:async(e,a)=>{const r=window.__templateApp;if(r?.refetchDataSource)return r.refetchDataSource(e,a);we.warn("G7Core.dataSource.refetch: TemplateApp이 초기화되지 않았습니다.")},updateItem:(e,a,r,i,l)=>{const u=window.__templateApp;return u?.updateDataSourceItem?u.updateDataSourceItem(e,a,r,i,l):(we.warn("G7Core.dataSource.updateItem: TemplateApp이 초기화되지 않았습니다."),!1)},updateData:(e,a,r,i="append")=>{const l=window.__templateApp;if(!l?.getDataSource||!l?.setDataSource)return we.warn("G7Core.dataSource.updateData: TemplateApp이 초기화되지 않았습니다."),!1;const u=l.getDataSource(e);if(!u)return we.warn(`G7Core.dataSource.updateData: 데이터 소스 '${e}'를 찾을 수 없습니다.`),!1;let d,f=u,g=null;if(a){const b=a.split(".");g=b.pop();for(const v of b)if(f&&typeof f=="object"&&v in f)f=f[v];else return we.warn(`G7Core.dataSource.updateData: 경로 '${a}'를 찾을 수 없습니다.`),!1;d=f[g]}else d=u;if(!Array.isArray(d))return we.warn("G7Core.dataSource.updateData: 대상 경로의 데이터가 배열이 아닙니다."),!1;if(!Array.isArray(r))return we.warn("G7Core.dataSource.updateData: newData가 배열이 아닙니다."),!1;const m=i==="prepend"?[...r,...d]:[...d,...r];return a&&g?(f[g]=m,l.setDataSource(e,u,{merge:!1})):l.setDataSource(e,m,{merge:!1}),we.log(`G7Core.dataSource.updateData: '${e}'에 ${r.length}개 항목 ${i==="prepend"?"앞에":"뒤에"} 추가됨`),!0}},we.log("전역 객체 window.G7Core.dataSource에 노출됨")}function nA(o,e){o.locale={current:()=>window.__templateApp?.getLocale?.()||"ko",supported:()=>{const r=window.__templateApp?.globalState?.appConfig?.supportedLocales;return Array.isArray(r)&&r.length>0?r:e.getState().templateMetadata?.locales||["ko","en"]},change:async a=>{const r=window.__templateApp;r?.changeLocale?await r.changeLocale(a):we.warn("G7Core.locale.change: TemplateApp이 초기화되지 않았습니다.")}},we.log("전역 객체 window.G7Core.locale에 노출됨")}function aA(o){o.toast={show:(e,a)=>{o.dispatch({handler:"toast",params:{message:e,type:a?.type||"info",...a?.duration&&{duration:a.duration}}})},success:(e,a)=>{o.toast.show(e,{type:"success",duration:a})},error:(e,a)=>{o.toast.show(e,{type:"error",duration:a})},warning:(e,a)=>{o.toast.show(e,{type:"warning",duration:a})},info:(e,a)=>{o.toast.show(e,{type:"info",duration:a})}},we.log("전역 객체 window.G7Core.toast에 노출됨")}function rA(o){o.modal={open:e=>{o.dispatch({handler:"openModal",target:e})},close:e=>{o.dispatch({handler:"closeModal",...e&&{target:e}})},closeAll:()=>{o.dispatch({handler:"closeAllModals"})},isOpen:e=>{const a=o.state.get();return a._global?.activeModal===e||a._global?.modalStack?.includes(e)||!1},getStack:()=>o.state.get()._global?.modalStack||[]},we.log("전역 객체 window.G7Core.modal에 노출됨")}function iA(o){o.style={mergeClasses:P_,conditionalClass:G_,joinClasses:V_},we.log("전역 객체 window.G7Core.style에 노출됨")}function sA(o,e){const{webSocketManager:a}=e;o.websocket={manager:a,subscribe:(r,i,l,u)=>a.subscribe(r,i,l,u),unsubscribe:r=>a.unsubscribe(r),leaveChannel:r=>a.leaveChannel(r),disconnect:()=>a.disconnect(),isInitialized:()=>a.isInitialized(),getSubscriptionCount:()=>a.getSubscriptionCount()},we.log("전역 객체 window.G7Core.websocket에 노출됨")}function oA(o,e){const{transitionManager:a}=e;o.navigation={isPending:()=>a?.getIsPending?.()||!1,onComplete:r=>{if(!a)return r(),()=>{};let i=a.getIsPending();const l=a.subscribe(u=>{u?i=!0:i&&(r(),l())});return l}},we.log("전역 객체 window.G7Core.navigation에 노출됨")}function lA(o){o.plugin={getSettings:e=>window.G7Config?.plugins?.[e],get:(e,a,r)=>window.G7Config?.plugins?.[e]?.[a]??r,getAll:()=>window.G7Config?.plugins??{}},we.log("전역 객체 window.G7Core.plugin에 노출됨")}function cA(o){o.module={getSettings:e=>window.G7Config?.modules?.[e],get:(e,a,r)=>window.G7Config?.modules?.[e]?.[a]??r,getAll:()=>window.G7Config?.modules??{}},we.log("전역 객체 window.G7Core.module에 노출됨")}function uA(o,e){const{transitionManager:a,responsiveManager:r}=e;o.AuthManager=ha,o.api=Ma(),o.TransitionManager=a,o.useTransitionState=Xp,o.ResponsiveManager=r,o.useResponsive=Dd,o.useControllableState=Z0,o.shallowArrayEqual=eC,o.shallowObjectEqual=Qp,o.updateQueryParams=async(i,l)=>{const u=window.__templateApp;if(u?.updateQueryParams)return u.updateQueryParams(i,l);we.warn("G7Core.updateQueryParams: TemplateApp이 초기화되지 않았습니다.")},we.log("전역 객체 window.G7Core.AuthManager에 노출됨"),we.log("전역 객체 window.G7Core.api에 노출됨"),we.log("전역 객체 window.G7Core.ResponsiveManager에 노출됨"),we.log("전역 객체 window.G7Core.useResponsive에 노출됨"),we.log("전역 객체 window.G7Core.useControllableState에 노출됨"),we.log("전역 객체 window.G7Core.updateQueryParams에 노출됨")}function dA(o,e){o.getSlotContext=()=>window.__slotContextValue??null,o.getDynamicRenderer=()=>window.__DynamicRenderer??null,o.getComponentRegistry=()=>e.getComponentRegistry?.()??da.getInstance(),o.getDataBindingEngine=()=>e.getDataBindingEngine?.()??e.getState().bindingEngine,o.getTranslationEngine=()=>e.getTranslationEngine?.()??e.getState().translationEngine,o.getActionDispatcher=()=>e.getActionDispatcher?.()??e.getState().actionDispatcher,we.log("전역 객체 window.G7Core 슬롯 API에 노출됨 (getSlotContext, getDynamicRenderer 등)")}function fA(o){o.identity={setLauncher:St.setLauncher.bind(St),handle:St.handle.bind(St),isIdentityRequired:St.isIdentityRequired.bind(St),hasLauncher:St.hasLauncher.bind(St),markDomainNoticeShown:St.markDomainNoticeShown.bind(St),redirectExternally:St.redirectExternally.bind(St),createDeferred:St.createDeferred.bind(St),resolveDeferred:St.resolveDeferred.bind(St),reset:St.reset.bind(St),redirectStashKey:Sd},we.log("전역 객체 window.G7Core 본인인증(IDV) API에 노출됨 (identity)")}function hA(o){if(typeof window>"u")return;F_(),window.G7Core||(window.G7Core={});const e=window.G7Core;W_(e),K_(e),Y_(e),uA(e,o),X_(e,o),J_(e,o),Q_(e),eA(e),tA(e),nA(e,o),aA(e),rA(e),iA(e),sA(e,o),oA(e,o),lA(e),cA(e),dA(e,o),fA(e),we.log("G7Core 전역 객체 초기화 완료")}function gA(){const o=window.G7Core;if(!o){we.warn("G7Core가 초기화되지 않았습니다.");return}const e=()=>Ar.getInstance(),a={isEnabled:()=>{try{return e().isEnabled()}catch{return!1}},trackRender:r=>{try{e().isEnabled()&&e().trackRender(r)}catch{}},trackIteration:(r,i,l,u,d)=>{try{e().isEnabled()&&e().trackIteration(r,{source:i,itemVar:l,indexVar:u,sourceLength:d})}catch{}},trackIfCondition:(r,i,l,u)=>{try{e().isEnabled()&&e().trackIfCondition(r,i,l)}catch{}},trackMount:(r,i)=>{try{e().isEnabled()&&e().trackMount(r,{...i,id:r})}catch{}},trackUnmount:r=>{try{e().isEnabled()&&e().trackUnmount(r)}catch{}},trackExpressionEval:r=>{try{e().isEnabled()&&e().trackExpressionEval(r)}catch{}},trackBindingEval:r=>{try{e().isEnabled()&&e().trackBindingEval(r)}catch{}},recordCacheHit:()=>{try{e().isEnabled()&&e().recordCacheHit()}catch{}},recordCacheMiss:()=>{try{e().isEnabled()&&e().recordCacheMiss()}catch{}},trackHandlerRegistration:(r,i,l,u)=>{try{e().isEnabled()&&e().trackHandlerRegistration(r,i,l,u)}catch{}},trackHandlerUnregistration:r=>{try{e().isEnabled()&&e().trackHandlerUnregistration(r)}catch{}},logAction:r=>{try{e().isEnabled()&&e().logAction(r)}catch{}},trackRequest:(r,i)=>{try{return e().isEnabled()?e().trackRequest(r,i):""}catch{return""}},completeRequest:(r,i,l)=>{try{e().isEnabled()&&e().completeRequest(r,i,l)}catch{}},failRequest:(r,i)=>{try{e().isEnabled()&&e().failRequest(r,i)}catch{}},trackDataSourceDefinition:r=>{try{e().isEnabled()&&e().trackDataSourceDefinition(r)}catch{}},trackDataSourceLoading:r=>{try{e().isEnabled()&&e().trackDataSourceLoading(r)}catch{}},trackDataSourceLoaded:(r,i,l)=>{try{e().isEnabled()&&e().trackDataSourceLoaded(r,i,l)}catch{}},trackDataSourceError:(r,i)=>{try{e().isEnabled()&&e().trackDataSourceError(r,i)}catch{}},trackForm:(r,i,l)=>{try{e().isEnabled()&&e().trackForm(r,i,l)}catch{}},untrackForm:r=>{try{e().isEnabled()&&e().untrackForm(r)}catch{}},startStateChange:(r,i,l,u)=>{try{return e().isEnabled()?e().startStateChange(r,i,l,u):""}catch{return""}},completeStateChange:r=>{try{e().isEnabled()&&e().completeStateChange(r)}catch{}},trackComponentRender:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().trackComponentRender(r,i,l,u,d,f)}catch{}},updateLocalState:r=>{try{e().isEnabled()&&e().updateLocalState(r)}catch{}},updateComputedState:r=>{try{e().isEnabled()&&e().updateComputedState(r)}catch{}},updateParentContext:r=>{try{e().isEnabled()&&e().updateParentContext(r)}catch{}},trackComponentStateSource:(r,i,l,u)=>{try{e().isEnabled()&&e().trackComponentStateSource(r,i,l,u)}catch{}},trackDynamicState:(r,i)=>{try{e().isEnabled()&&e().trackDynamicState(r,i)}catch{}},trackContextFlow:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().trackContextFlow(r,i,l,u,d,f)}catch{}},trackComponentStyle:(r,i,l,u)=>{try{e().isEnabled()&&e().trackComponentStyle(r,i,l,u)}catch{}},trackAuthEvent:(r,i,l,u)=>{try{e().isEnabled()&&e().trackAuthEvent(r,i,l,u)}catch{}},trackAuthHeader:(r,i,l,u,d)=>{try{e().isEnabled()&&e().trackAuthHeader(r,i,l,u,d)}catch{}},trackLog:(r,i,l)=>{try{e().isEnabled()&&e().trackLog(r,i,l)}catch{}},trackAction:r=>{try{e().isEnabled()&&e().trackAction?.(r)}catch{}},trackDataSourceUpdate:r=>{try{e().isEnabled()&&e().trackDataSourceUpdate?.(r)}catch{}},startSequenceExecution:r=>{try{return e().isEnabled()?e().startSequenceExecution(r):""}catch{return""}},captureSequenceActionBefore:(r,i,l,u,d)=>{try{e().isEnabled()&&e().captureSequenceActionBefore(r,i,l,u,d)}catch{}},captureSequenceActionAfter:(r,i,l,u,d,f)=>{try{e().isEnabled()&&e().captureSequenceActionAfter(r,i,l,u,d,f)}catch{}},endSequenceExecution:(r,i)=>{try{e().isEnabled()&&e().endSequenceExecution(r,i)}catch{}},registerStateCaptureForHandler:(r,i,l)=>{try{e().isEnabled()&&e().registerStateCaptureForHandler(r,i,l)}catch{}},detectStaleClosure:(r,i,l,u,d)=>{try{return e().isEnabled()?e().detectStaleClosure(r,i,l,u,d):[]}catch{return[]}},trackStaleClosureWarning:r=>{try{e().isEnabled()&&e().trackStaleClosureWarning(r)}catch{}},trackModalOpen:r=>{try{e().isEnabled()&&e().trackModalOpen(r)}catch{}},trackModalClose:(r,i)=>{try{e().isEnabled()&&e().trackModalClose(r,i)}catch{}},trackModalStateChange:r=>{try{e().isEnabled()&&e().trackModalStateChange(r)}catch{}},trackNestedContext:r=>{try{return e().isEnabled()?e().trackNestedContext(r):""}catch{return""}},trackNestedContextAccess:(r,i)=>{try{e().isEnabled()&&e().trackNestedContextAccess(r,i)}catch{}},trackComputedProperty:(r,i,l,u,d,f,g)=>{try{e().isEnabled()&&e().trackComputedProperty(r,i,l,u,d,f,g)}catch{}},trackComputedRecalc:(r,i,l,u,d,f,g)=>{try{e().isEnabled()&&e().trackComputedRecalc(r,i,l,u,d,f,g)}catch{}},setNamedActionDefinitions:r=>{try{e().isEnabled()&&e().setNamedActionDefinitions(r)}catch{}},trackNamedActionRef:r=>{try{e().isEnabled()&&e().trackNamedActionRef(r)}catch{}}};o.devTools=a,we.log("G7Core.devTools 인터페이스 초기화 완료")}let bo=null;function pA(){const o=window.G7Core;return o?.__devtools?Promise.resolve(o.__devtools):bo||(bo=new Promise((e,a)=>{const r=window.G7Config?.coreDevToolsAsset||"/build/core/devtools.min.js",i="g7-devtools-bundle",l=()=>{const f=window.G7Core?.__devtools;f?e(f):a(new Error("DevTools 번들 로드됨 — 그러나 __devtools 미노출"))};window.G7Core=window.G7Core||{},window.G7Core.__onDevToolsReady=l;const u=document.getElementById(i);if(u){u.addEventListener("load",l,{once:!0}),u.addEventListener("error",()=>a(new Error(`DevTools 번들 로드 실패: ${r}`)),{once:!0});return}const d=document.createElement("script");d.id=i,d.src=r,d.async=!1,d.addEventListener("load",l,{once:!0}),d.addEventListener("error",()=>{bo=null,a(new Error(`DevTools 번들 로드 실패: ${r}`))},{once:!0}),document.head.appendChild(d)}),bo)}function mA(){const o=window.G7Core;if(!o){we.warn("G7Core가 초기화되지 않았습니다.");return}const e=Ar.getInstance();if(e.initialize(),!e.isEnabled()){window.G7DevTools={isEnabled:()=>!1,enable:()=>{we.log("환경설정 > 고급 설정 > 디버그 모드를 켜세요")}},Xu(),we.log("G7DevTools 비활성화됨 (디버그 모드 꺼짐)");return}yA(o,e)}async function yA(o,e){let a;try{a=await pA()}catch(g){we.warn("DevTools 번들 로드 실패 — 최소 API 로 폴백:",g),window.G7DevTools={isEnabled:()=>!1,enable:()=>{}},Xu();return}const{DiagnosticEngine:r,getServerConnector:i,getStyleTracker:l}=a;gA(),Xu();try{l().enable(),we.log("StyleTracker 활성화됨")}catch(g){we.warn("StyleTracker 활성화 실패:",g)}const u=new r,d=i(),f={isEnabled:()=>e.isEnabled(),state:{get:()=>e.getState(),getHistory:()=>e.getStateHistory(),watch:(g,m)=>e.watchState(g,m)},actions:{getHistory:()=>e.getActionHistory(),watch:g=>e.watchActions(g),getMetrics:()=>e.getActionMetrics()},binding:{evaluate:g=>{const m=o.getDataBindingEngine?.();if(!m){we.warn("DataBindingEngine이 없습니다.");return}return m.evaluateExpression(g,e.getState())},getCacheStats:()=>e.getCacheStats(),clearStats:()=>{e.resetCacheStats(),we.log("캐시 통계 초기화됨")}},diagnose:{analyze:g=>u.analyze(g),suggestFix:g=>u.suggestFix(g),getCommonIssues:()=>u.getCommonIssues(),getRulesByCategory:g=>u.getRulesByCategory(g)},server:{dumpState:g=>d.dumpState(g),sendLog:g=>d.sendLog(g),sendError:(g,m)=>d.sendError(g,m),isConnected:()=>d.isConnected(),testConnection:()=>d.testConnection()},config:{isDebugMode:()=>e.isEnabled(),setLogLevel:g=>e.setLogLevel(g),setMaxHistory:g=>e.setMaxHistory(g)},lifecycle:{getMountedComponents:()=>e.getLifecycleInfo().mountedComponents,getOrphanedListeners:()=>e.getLifecycleInfo().orphanedListeners},performance:{getRenderCount:()=>e.getPerformanceInfo().renderCounts,getBindingEvalCount:()=>e.getPerformanceInfo().bindingEvalCount,getMemoryWarnings:()=>e.getPerformanceInfo().memoryWarnings,startProfiling:()=>e.startProfiling(),stopProfiling:()=>e.stopProfiling()},network:{getActiveRequests:()=>e.getNetworkInfo().activeRequests,getRequestHistory:()=>e.getNetworkInfo().requestHistory,getPendingDataSources:()=>e.getNetworkInfo().pendingDataSources},conditional:{getIfConditions:()=>e.getConditionalInfo().ifConditions,getIterations:()=>e.getConditionalInfo().iterations},form:{getForms:()=>e.getFormInfo()},websocket:{getInfo:()=>e.getWebSocketInfo()}};window.G7DevTools=f,o.devtools=f,we.log("G7DevTools 전역 객체 초기화 완료 (window.G7DevTools)"),bA(a.DevToolsPanel)}function bA(o){if(document.getElementById("g7-devtools-root")){we.log("DevToolsPanel 이미 렌더링됨");return}const e=document.createElement("div");e.id="g7-devtools-root",document.body.appendChild(e);try{Wu.createRoot(e).render(Ye.createElement(o)),we.log("DevToolsPanel UI 렌더링 완료")}catch(a){we.error("DevToolsPanel UI 렌더링 실패:",a)}}const Ze=ct("TemplateEngine"),ie={templateId:null,locale:"ko",isInitialized:!1,reactRoot:null,containerId:null,currentLayoutJson:null,currentDataContext:{},translationContext:{templateId:"",locale:"ko"},registry:null,bindingEngine:null,translationEngine:null,actionDispatcher:null,templateMetadata:null};let vo=!1;const So=[];async function vA(o){try{Ze.log("템플릿 메타데이터 로드 중...",o);const e=o.split("-").map(r=>r.split("_").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join("")).join(""),a=window[e];return a?.templateMetadata?(Ze.log("템플릿 메타데이터 로드 완료 (전역 변수)",a.templateMetadata),a.templateMetadata):(Ze.warn(`템플릿 번들에 메타데이터가 없습니다. 전역 변수: ${e}`),{identifier:o,locales:["ko","en"],name:{ko:o,en:o},description:{ko:"",en:""},version:"1.0.0",type:"admin"})}catch(e){return Ze.error("템플릿 메타데이터 로드 실패",e),{identifier:o,locales:["ko","en"],name:{ko:o,en:o},description:{ko:"",en:""},version:"1.0.0",type:"admin"}}}function iy(){const e=(typeof window<"u"?window.__templateApp:void 0)?.globalState?.appConfig?.supportedLocales,a=ie.templateMetadata?.locales;return{$locale:ie.locale,$locales:Array.isArray(e)&&e.length>0?e:a||["ko","en"],$templateLocales:a||["ko","en"],$templateId:ie.templateId}}async function wo(o){try{if(Ze.log("템플릿 엔진 초기화 시작",o),ie.isInitialized)throw new Error("템플릿 엔진이 이미 초기화되었습니다. destroyTemplate()을 먼저 호출하세요.");if(!o.templateId)throw new k_;vo=o.debug??!1,typeof window<"u"&&(window.G7Config||(window.G7Config={}),window.G7Config.debug=vo),mA(),ie.templateId=o.templateId,ie.locale=o.locale||"ko",Ze.log("엔진 인스턴스 생성 중..."),ie.registry=da.getInstance(),ie.bindingEngine=new wn,ie.translationEngine=Sr.getInstance(),o.cacheVersion!==void 0&&o.cacheVersion>0&&ie.translationEngine.setCacheVersion(o.cacheVersion),ie.translationContext={templateId:o.templateId,locale:ie.locale},ie.actionDispatcher=new ro({},ie.translationEngine,ie.translationContext),V0(ie.actionDispatcher),Ze.log("다국어 파일 로드 중...",o.templateId,ie.locale);const e="en",a=[ie.translationEngine.loadTranslations(o.templateId,ie.locale).then(()=>{Ze.log(`다국어 파일 로드 완료: ${ie.locale}`)}).catch(r=>{Ze.warn(`다국어 파일 로드 실패 (${ie.locale}):`,r instanceof Error?r.message:r)})];ie.locale!==e&&a.push(ie.translationEngine.loadTranslations(o.templateId,e).then(()=>{Ze.log(`폴백 다국어 파일 로드 완료: ${e}`)}).catch(r=>{Ze.warn(`폴백 다국어 파일 로드 실패 (${e}):`,r instanceof Error?r.message:r)})),await Promise.allSettled(a),Ze.log("템플릿 메타데이터 로드 중...",o.templateId),ie.templateMetadata=await vA(o.templateId),ie.isInitialized=!0,Ze.log("템플릿 엔진 초기화 완료 (ComponentRegistry는 별도 로드)")}catch(e){throw Ze.error("템플릿 엔진 초기화 실패",e),ie.isInitialized=!1,ie.registry=null,ie.bindingEngine=null,ie.translationEngine=null,ie.actionDispatcher=null,e}}let Co=null;function uf(){const o=window.G7Core;return o?.__LayoutEditorChrome?Promise.resolve(o.__LayoutEditorChrome):Co||(Co=new Promise((e,a)=>{const r=window.G7Config?.coreEditorAsset||"/build/core/layout-editor.min.js",i="g7-layout-editor-bundle",l=document.getElementById(i),u=()=>{const f=window.G7Core?.__LayoutEditorChrome;f?e(f):a(new Error("편집기 번들 로드됨 — 그러나 __LayoutEditorChrome 미노출"))};if(window.G7Core=window.G7Core||{},window.G7Core.__onChromeReady=u,l){l.addEventListener("load",u,{once:!0}),l.addEventListener("error",()=>a(new Error(`편집기 번들 로드 실패: ${r}`)),{once:!0});return}const d=document.createElement("script");d.id=i,d.src=r,d.async=!1,d.addEventListener("load",u,{once:!0}),d.addEventListener("error",()=>{Co=null,a(new Error(`편집기 번들 로드 실패: ${r}`))},{once:!0}),document.head.appendChild(d)}),Co)}async function rs(o){try{if(Ze.log("템플릿 렌더링 시작",o),!ie.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다. initTemplateEngine()을 먼저 호출하세요.");if(!o.containerId)throw new Error("containerId는 필수입니다.");if(!o.layoutJson)throw new Error("layoutJson은 필수입니다.");const e=document.getElementById(o.containerId);if(!e)throw new Error(`컨테이너를 찾을 수 없습니다: #${o.containerId}`);const a=iy();if(ie.containerId=o.containerId,ie.currentLayoutJson=o.layoutJson,ie.currentDataContext={...a,...o.dataContext||{}},ie.translationContext=o.translationContext||{templateId:ie.templateId||"",locale:ie.locale},ie.reactRoot||(Ze.log("React Root 생성"),ie.reactRoot=Wu.createRoot(e)),typeof window<"u"){const l=Zm(window.location.pathname);if(l){Ze.log("레이아웃 편집기 모드 진입",l);let u;try{u=await uf()}catch(f){Ze.error("레이아웃 편집기 번들 로드 실패",f),rf.render(o.containerId,{title:"레이아웃 편집기 로드 실패",message:f instanceof Error?f.message:"편집기 번들을 불러오지 못했습니다.",icon:"fas fa-triangle-exclamation",showStack:!1,showReloadButton:!0,debug:vo});return}const d=Ye.createElement(u,{templateIdentifier:l.templateIdentifier,initialLocale:ie.locale});ie.reactRoot.render(Ye.createElement(sc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext,children:Ye.createElement(Td,{children:Ye.createElement(Kl,{children:Ye.createElement(Zd,{children:d})})})}));return}}const r=o.layoutJson.components||[];if(r.length===0){Ze.warn("렌더링할 컴포넌트가 없습니다.");return}const i=o.layoutJson.modals||[];if(Ze.log("modals 배열:",i),Ze.log("modals 개수:",i.length),Ze.log("DynamicRenderer로 렌더링 시작"),ie.reactRoot.render(Ye.createElement(sc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext},Ye.createElement(Td,null,Ye.createElement(Kl,null,Ye.createElement(Zd,null,[...r.map((l,u)=>{const d=ie.currentLayoutJson?.layout_name||"";return Ye.createElement(Ia,{key:d&&!l._fromBase?`${l.id}_${d}`:l.id,componentDef:l,dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,isRootRenderer:u===0,layoutKey:d})}),Ye.createElement(Vp,{key:"__modal_parent_context_provider"},i.map(l=>{const u=ie.currentDataContext._global?.modalStack||[],f=u.includes(l.id)||ie.currentDataContext._global?.activeModal===l.id,g=u.indexOf(l.id),m=g>=0?50+g:50,b=window.__g7LayoutContextStack||[],S=b[b.length-1]?.dataContext,E=Ye.createElement(Ia,{key:`modal_${l.id}_renderer`,componentDef:{...l,props:{...l.props,isOpen:f,style:{...l.props?.style,zIndex:m},onClose:ie.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ie.currentDataContext)}},dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,parentDataContext:S});return l.data_sources&&l.data_sources.length>0?Ye.createElement(Jm,{key:`modal_${l.id}`,isOpen:f,modalId:l.id,dataSources:l.data_sources,dataContext:ie.currentDataContext,globalStateUpdater:ie.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ie.bindingEngine,debug:vo,children:E}):E}))]))))),Ze.log("템플릿 렌더링 완료"),So.length>0){Ze.log(`대기 중인 데이터 업데이트 ${So.length}건 적용`);const l=[...So];So.length=0;for(const{data:u,options:d}of l)is(u,d)}}catch(e){throw Ze.error("템플릿 렌더링 실패",e),e}}function is(o,e){try{if(Ze.log("템플릿 데이터 업데이트 시작",Object.keys(o)),!ie.isInitialized)throw new Error("템플릿 엔진이 초기화되지 않았습니다.");if(!ie.reactRoot||!ie.currentLayoutJson){Ze.log("React 미준비 - 데이터 업데이트 큐잉:",Object.keys(o)),So.push({data:o,options:e});return}const a=iy(),r={...ie.currentDataContext._global||{},...o._global||{}},i=J0(ie.currentDataContext._localInit,o._localInit);ie.currentDataContext={...a,...ie.currentDataContext,...o,_global:r,_localInit:i},r._local!==void 0&&(ie.currentDataContext._local=r._local),r._computed!==void 0&&(ie.currentDataContext._computed=r._computed);const l=ie.currentLayoutJson.components||[],u=ie.currentLayoutJson.modals||[];Ze.log("updateTemplateData - modals 배열:",u),Ze.log("updateTemplateData - modals 개수:",u.length),Ze.log("updateTemplateData - activeModal:",ie.currentDataContext._global?.activeModal);const d=()=>{ie.reactRoot.render(Ye.createElement(sc,{translationEngine:ie.translationEngine,translationContext:ie.translationContext},Ye.createElement(Td,null,Ye.createElement(Kl,null,Ye.createElement(Zd,null,[...l.map((f,g)=>{const m=ie.currentLayoutJson?.layout_name||"";return Ye.createElement(Ia,{key:m&&!f._fromBase?`${f.id}_${m}`:f.id,componentDef:f,dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,isRootRenderer:g===0,layoutKey:m})}),Ye.createElement(Vp,{key:"__modal_parent_context_provider_update"},u.map(f=>{const g=ie.currentDataContext._global?.modalStack||[],b=g.includes(f.id)||ie.currentDataContext._global?.activeModal===f.id,v=g.indexOf(f.id),S=v>=0?50+v:50,E=window.__g7LayoutContextStack||[],T=E[E.length-1]?.dataContext,L=Ye.createElement(Ia,{key:`modal_${f.id}_renderer`,componentDef:{...f,props:{...f.props,isOpen:b,style:{...f.props?.style,zIndex:S},onClose:ie.actionDispatcher?.createHandler({type:"click",handler:"closeModal"},ie.currentDataContext)}},dataContext:ie.currentDataContext,translationContext:ie.translationContext,registry:ie.registry,bindingEngine:ie.bindingEngine,translationEngine:ie.translationEngine,actionDispatcher:ie.actionDispatcher,parentDataContext:T});return f.data_sources&&f.data_sources.length>0?Ye.createElement(Jm,{key:`modal_${f.id}`,isOpen:b,modalId:f.id,dataSources:f.data_sources,dataContext:ie.currentDataContext,globalStateUpdater:ie.actionDispatcher?.getGlobalStateUpdater(),bindingEngine:ie.bindingEngine,debug:vo,children:L}):L}))])))))};e?.sync?(Ze.log("재렌더링 시작 (sync mode - 즉시 렌더링)"),d()):(Ze.log("재렌더링 시작 (with startTransition)"),N.startTransition(()=>{d()})),Ze.log("템플릿 데이터 업데이트 완료")}catch(a){throw Ze.error("템플릿 데이터 업데이트 실패",a),a}}function hc(){try{Ze.log("템플릿 정리 시작"),ie.reactRoot&&(Ze.log("React Root 언마운트"),ie.reactRoot.unmount(),ie.reactRoot=null),ie.templateId=null,ie.locale="ko",ie.isInitialized=!1,ie.containerId=null,ie.currentLayoutJson=null,ie.currentDataContext={},ie.translationContext={templateId:"",locale:"ko"},ie.registry=null,ie.bindingEngine=null,ie.translationEngine=null,ie.actionDispatcher=null,ie.templateMetadata=null,Ze.log("템플릿 정리 완료")}catch(o){throw Ze.error("템플릿 정리 실패",o),o}}function Qa(){return Object.freeze({...ie})}function sy(){return ie.actionDispatcher}const Eo={initTemplateEngine:wo,renderTemplate:rs,updateTemplateData:is,destroyTemplate:hc,getState:Qa};typeof window<"u"&&(window.G7Core||(window.G7Core={}),window.G7Core.TemplateEngine=Eo,hA({getState:()=>({translationEngine:ie.translationEngine,translationContext:ie.translationContext,bindingEngine:ie.bindingEngine,actionDispatcher:ie.actionDispatcher,templateMetadata:ie.templateMetadata}),transitionManager:$a,responsiveManager:oi,webSocketManager:cc}),Ze.log("전역 객체 window.G7Core.TemplateEngine에 노출됨"));const Ha=Object.freeze(Object.defineProperty({__proto__:null,DataSourceManager:va,LayoutLoader:Jd,TemplateApp:mo,TemplateEngine:Eo,default:Eo,destroyTemplate:hc,getActionDispatcher:sy,getState:Qa,initTemplateApp:cf,initTemplateEngine:wo,loadLayoutEditorBundle:uf,renderTemplate:rs,updateTemplateData:is},Symbol.toStringTag,{value:"Module"}));Vt.DataSourceManager=va,Vt.LayoutLoader=Jd,Vt.TemplateApp=mo,Vt.TemplateEngine=Eo,Vt.default=Eo,Vt.destroyTemplate=hc,Vt.getActionDispatcher=sy,Vt.getState=Qa,Vt.initTemplateApp=cf,Vt.initTemplateEngine=wo,Vt.loadLayoutEditorBundle=uf,Vt.renderTemplate=rs,Vt.updateTemplateData=is,Object.defineProperties(Vt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})(this.G7Core=this.G7Core||{});