@readerseye2/cr_viewer 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.js +1910 -1880
- package/dist/recording/DirectPlaybackController.d.ts.map +1 -1
- package/dist/utils/calcPage.util.d.ts.map +1 -1
- package/package.json +70 -70
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";._run_zzb61_3{cursor:pointer}._runWrap_zzb61_7{position:relative;isolation:isolate;z-index:0}._highlight_zzb61_13:before,._highlightleft_zzb61_14:before,._highlightright_zzb61_15:before,._highlightcenter_zzb61_16:before{content:"";position:absolute;z-index:-1;top:-4px;bottom:-4px;background:var(--hl-color, pink);pointer-events:none}._highlight_zzb61_13:before{left:-4px;right:-4px}._highlightleft_zzb61_14:before{left:-4px;right:0}._highlightright_zzb61_15:before{left:0;right:-4px}._highlightcenter_zzb61_16:before{left:0;right:0}._underline_zzb61_48:after,._underlineleft_zzb61_49:after,._underlineright_zzb61_50:after,._underlinecenter_zzb61_51:after{content:"";position:absolute;left:0;right:0;height:var(--ul-thickness, .2em);bottom:calc(-1 * var(--ul-offset, .35em));background:var(--ul-color, red);pointer-events:none}._underline_zzb61_48:after{left:-4px;right:-4px}._underlineleft_zzb61_49:after{left:-4px;right:0}._underlineright_zzb61_50:after{left:0;right:0}._underlinecenter_zzb61_51:after{left:0;right:0}._scroller_kqkmq_3{height:100%;overflow-y:auto;overflow-x:hidden;outline:none;scrollbar-width:none;-ms-overflow-style:none}._scroller_kqkmq_3::-webkit-scrollbar{width:0;height:0;background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-track{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-thumb{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-button,._scroller_kqkmq_3::-webkit-scrollbar-corner{display:none;pointer-events:none}@media(forced-colors:active){._scroller_kqkmq_3{scrollbar-width:auto}}._navBtn_1fciy_2{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;flex-shrink:0;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._navBtn_1fciy_2:hover:not(:disabled){background:#0000000f}._navBtn_1fciy_2:active:not(:disabled){background:#0000001a}._navBtn_1fciy_2:disabled,._navBtn_1fciy_2._disabled_1fciy_26{opacity:.4;cursor:not-allowed;transform:none}._label_1fciy_32{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center}._navGroup_1fciy_40{display:flex;gap:8px}._wrap_1hfub_4{position:absolute;left:0;right:0;bottom:0;height:auto;display:flex;flex-direction:column;padding:8px 8px 10px;box-sizing:border-box;background:#fff;color:#333;border-top:1px solid #ddd;transition:opacity .15s ease;opacity:0;pointer-events:none;container-type:inline-size;container-name:bottombar}._visible_1hfub_25{opacity:1;pointer-events:auto}._compact_1hfub_31{padding:6px 8px 8px}._compact_1hfub_31 ._row2_1hfub_34{display:none}@container bottombar (min-width: 600px){._compact_1hfub_31 ._row2_1hfub_34{display:contents}}._controls_1hfub_44{display:flex;flex-wrap:wrap;align-items:center;gap:4px}._row1_1hfub_52,._row2_1hfub_34{display:flex;align-items:center;justify-content:space-between;width:100%;gap:4px}._row2_1hfub_34{margin-top:4px}@container bottombar (min-width: 500px){._row1_1hfub_52,._row2_1hfub_34{display:contents}._controls_1hfub_44{flex-wrap:nowrap;justify-content:space-between}._row2_1hfub_34{margin-top:0}}._groupExpand_1hfub_80,._groupPlayback_1hfub_81,._groupSpeed_1hfub_82,._groupFeatures_1hfub_83,._groupNav_1hfub_84{display:flex;align-items:center;flex-shrink:0}._groupExpand_1hfub_80{gap:0}._groupPlayback_1hfub_81{gap:2px}._groupSpeed_1hfub_82{gap:0}._groupFeatures_1hfub_83,._groupNav_1hfub_84{gap:2px}._btn_1hfub_116{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease;flex-shrink:0}._btn_1hfub_116:hover{background:#0000000f}._btn_1hfub_116:active{background:#0000001f}._btnForbidden_1hfub_141{opacity:.4;cursor:not-allowed;background:#f2f2f2!important}._btnActive_1hfub_147{background:#333;color:#fff}._btnActive_1hfub_147:hover{background:#555}._btnActive_1hfub_147:active{background:#666}._label_1hfub_158{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center;font-variant-numeric:tabular-nums;white-space:nowrap}._compactBtn_1hfub_168{display:flex;align-items:center;justify-content:center;width:34px;height:34px;border:none;border-radius:4px;background:none;color:#000;cursor:pointer;padding:2px;flex-shrink:0}._compactBtn_1hfub_168:hover{background:#0000000f}._compactBtn_1hfub_168:active{background:#0000001f}._scrubberWrap_uw0cd_2{display:grid;gap:8px;-webkit-user-select:none;user-select:none;margin-bottom:6px}._labels_uw0cd_9{display:flex;justify-content:space-between;font-size:12px;color:var(--text-subtle, #666)}._labels_uw0cd_9 ._index_uw0cd_15{font-variant-numeric:tabular-nums}._controls_uw0cd_19{display:grid;grid-template-columns:1fr 40px;align-items:center;gap:8px}._controls_uw0cd_19 ._percent_uw0cd_25{display:flex;justify-content:flex-end;font-size:.8rem;font-variant-numeric:tabular-nums}._stepBtn_uw0cd_32{height:28px;border:1px solid var(--line, #ddd);background:var(--bg, #fff);border-radius:8px;font-size:16px;line-height:1;cursor:pointer}._stepBtn_uw0cd_32:disabled{opacity:.5;cursor:not-allowed}._range_uw0cd_46{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:6px;border-radius:999px;background:linear-gradient(to right,currentColor var(--pct, 50%),#e5e7eb 0);outline:none}._range_uw0cd_46::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:999px;background:currentColor;cursor:pointer}._range_uw0cd_46::-moz-range-thumb{width:16px;height:16px;border-radius:999px;background:currentColor;border:none;cursor:pointer}._WPMSpeedButtonsWrap_r3byt_1{float:right;box-sizing:border-box;display:flex;flex-direction:column}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7{box-sizing:border-box;padding:2px;display:flex;gap:1px;align-items:center}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._label_r3byt_14{font-size:.55rem;display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:24px}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22{padding:2px;border-radius:4px;border:1px solid #888;background:none;width:34px;height:34px;flex-shrink:0;cursor:pointer;transition:all .15s ease}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:hover{background:#0000000f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:active{background:#0000001f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22 img{width:100%;height:100%;object-fit:contain}._StepBtn_15t0r_1{background:none;border:none;border-radius:8px;font-size:1.6rem;display:flex;justify-content:center;align-items:center;color:#000;flex-shrink:0;width:34px;height:34px;cursor:pointer;transition:all .15s ease}._StepBtn_15t0r_1:hover{background:#0000000f}._StepBtn_15t0r_1:active{background:#0000001f}._GCPlayBtn_n54mc_1{width:var(--btn-size);height:var(--btn-size);box-sizing:border-box;border:none;outline:none;position:relative;background:none;border-radius:8px;transition:all .15s ease;cursor:pointer}._GCPlayBtn_n54mc_1:hover{background:#0000000f}._GCPlayBtn_n54mc_1:active{background:#0000001f}._GCPlayBtn_n54mc_1:focus{outline:none}._GCPlayBtn_n54mc_1:before{content:"";position:absolute;top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .34);height:0;border-style:solid;border-width:calc(var(--btn-size) * .2) 0 calc(var(--btn-size) * .2) calc(var(--btn-size) * .4);border-color:transparent transparent transparent var(--icon-color);transition:.2s ease;transform:scale(1.3)}._GCPlayBtn_n54mc_1._playing_n54mc_34:before{top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .32);width:calc(var(--btn-size) * .12);height:calc(var(--btn-size) * .4);border:none;background-color:var(--icon-color);box-shadow:calc(var(--btn-size) * .18) 0 0 0 var(--icon-color)}._host_v5qx1_3{position:absolute;left:0;right:0;top:0;z-index:30}._topbar_v5qx1_11{position:absolute;left:0;right:0;top:0;height:48px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#fff;color:#033233;-webkit-backdrop-filter:saturate(120%) blur(6px);backdrop-filter:saturate(120%) blur(6px);transition:opacity .15s ease;opacity:0;pointer-events:none;border-bottom:4px solid #033233;box-sizing:border-box}._visible_v5qx1_32{opacity:1;pointer-events:auto}._backBtn_v5qx1_37{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._backBtn_v5qx1_37:hover{background:#0000000d}._backBtn_v5qx1_37:active{background:#0000004d}._title_v5qx1_58{font-size:18px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}._settingsBtn_v5qx1_67{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._settingsBtn_v5qx1_67:hover{background:#0000000d}._settingsBtn_v5qx1_67:active{background:#0000004d}._wrap_62su0_7{position:absolute;pointer-events:auto;background:#fff;color:#111;box-shadow:0 -6px 24px #0000001f;padding:20px 0;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:10px;overflow-y:auto;left:0;right:0;bottom:0;max-height:70%;border-top:1px solid rgba(0,0,0,.08);border-radius:16px 16px 0 0}._wrapHidden_62su0_29{transform:translateY(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translateY(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}@container viewer (min-aspect-ratio: 1/1){._wrap_62su0_7{left:auto;right:0;top:0;bottom:0;max-height:100%;width:400px;max-width:60%;border-top:none;border-left:1px solid rgba(0,0,0,.08);border-radius:0;box-shadow:-6px 0 24px #0000001f;padding:20px}._wrapHidden_62su0_29{transform:translate(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translate(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}}._scrollArea_62su0_71{width:100%;display:flex;flex-direction:column;max-width:400px;padding:0 20px;gap:10px;box-sizing:border-box}._row_62su0_81{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:45px}._label_62su0_89{width:78px;flex:0 0 78px;font-weight:700}._btn_62su0_95{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:8px 10px;font-size:13px}._btnActive_62su0_106{background:#00000014}._btnSmall_62su0_110{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:4px 8px;font-size:14px;line-height:1}._pill_62su0_122{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;background:#fff;color:#111;border:1px solid rgba(0,0,0,.16);border-radius:999px;padding:8px 12px;font-size:13px}._themeCircle_62su0_133{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:600;cursor:pointer;transition:all .2s ease;border:1px solid rgba(0,0,0,.15)}._themeCircleActive_62su0_146{border:2px solid #007aff;box-shadow:0 0 0 2px #007aff40}._stepRow_62su0_151{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px}._stepLabel_62su0_159{width:78px;flex:0 0 78px;font-weight:700}._stepValue_62su0_165{margin-left:auto;width:72px;text-align:right;font-variant-numeric:tabular-nums}._levelBox_62su0_172{width:28px;text-align:center}._inlineFlex_62su0_177{display:flex;align-items:center;gap:6px;flex-wrap:wrap}._wrapper_dbk3n_1{display:grid;place-items:center;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;pointer-events:none}._spinner_dbk3n_10{border-radius:50%;border:3px solid #e5e7eb;border-top-color:#3b82f6;animation:_spin_dbk3n_10 linear infinite}@keyframes _spin_dbk3n_10{to{transform:rotate(360deg)}}._Overlay_ybic8_3{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;background:#11182773;display:flex;align-items:center;justify-content:center;z-index:50}._Dialog_ybic8_15{width:min(760px,90%);max-height:80vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 24px 48px #00000040;padding:20px}._Body_ybic8_25{margin-left:20px;margin-right:20px;display:block}._Header_ybic8_32{display:flex;align-items:center;gap:12px;margin-bottom:12px}._Paging_ybic8_39{font-weight:700;font-size:1rem;color:#333;display:flex;justify-content:center;width:100%}._Remaining_ybic8_48{margin-left:auto;font-weight:700;font-size:1rem;color:#fff}._RemainingDanger_ybic8_55{color:#dc2626}._NextBtn_ybic8_59{padding:10px 16px;border-radius:10px;border:none;background:#2563eb;color:#fff;font-size:1.2rem;font-weight:700;cursor:pointer;width:100%}@keyframes _nextbtn-blink_ybic8_1{0%,49%{transform:none;box-shadow:0 0 #dc262600;outline:0 solid rgba(220,38,38,0);filter:none}50%,to{box-shadow:0 0 0 2px #dc262659,0 6px 14px #dc262640;outline:2px solid rgba(220,38,38,.45)}}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55){animation:_nextbtn-blink_ybic8_1 1s steps(2,start) infinite}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):hover,._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):focus-visible{animation-play-state:running}._CloseBtn_ybic8_96{margin-left:8px;border:none;background:transparent;color:#6b7280;cursor:pointer;font-size:14px}._Title_ybic8_106{font-weight:700;font-size:18px;margin-bottom:8px;color:#111827}._Question_ybic8_113{font-size:1.2rem;color:#111827;font-weight:700;display:flex;justify-content:center;align-items:center}._Score_ybic8_123{display:flex;justify-content:center;align-items:center;margin-bottom:16px}._Image_ybic8_130{width:100%;display:flex;justify-content:center}._Image_ybic8_130 img{width:80%}._Options_ybic8_140{display:grid;gap:8px}._OptionBtn_ybic8_145{text-align:left;padding:12px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer;font-size:1rem;transition:box-shadow .15s ease,border-color .15s ease,background .15s ease;display:flex;justify-content:center;align-items:center}._OptionBtn_ybic8_145:hover{border-color:#cbd5e1;background:#f9fafb}._OptionBtnActive_ybic8_165{border-color:#2563eb;background:#2563eb14;box-shadow:0 4px 10px #2563eb33}._Footer_ybic8_172{display:flex;justify-content:space-between;margin-top:16px;gap:8px}._PrevBtn_ybic8_179{flex:0 0 auto;padding:10px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._PrevBtn_ybic8_179:disabled{cursor:not-allowed;opacity:.6}._OptionBtnCorrect_ybic8_195{border-color:#16a34a!important;box-shadow:0 4px 10px #16a34a33}._Judge_ybic8_201{margin:6px 0 10px;font-weight:700;font-size:1.5rem;padding:4px;width:100%;border-radius:10px;display:flex;justify-content:center;color:#fff}._Judge_ybic8_201._Correct_ybic8_212{background:#16a34a}._Judge_ybic8_201._Incorrect_ybic8_215{background:#dc2626}._ResultHeader_ybic8_220{font-weight:800;font-size:20px;margin-bottom:8px;color:#111827}._ResultText_ybic8_227{font-size:16px;margin-bottom:12px;color:#111827}._ResultActions_ybic8_233{display:flex;justify-content:flex-end;gap:8px}._CloseBtnSoft_ybic8_239{padding:10px 16px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._SummaryGrid_ybic8_249{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:12px 0 16px}._StatCard_ybic8_257{border:1px solid #e5e7eb;border-radius:12px;padding:12px 14px;background:#fff;box-shadow:0 2px 6px #1118270f}._StatLabel_ybic8_265{font-size:12px;color:#6b7280}._StatValue_ybic8_270{font-size:22px;font-weight:800;margin-top:4px;color:#111827}._StatSub_ybic8_277{font-size:12px;color:#6b7280}._SplitGrid_ybic8_282{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._SplitBox_ybic8_289{border:1px dashed #e5e7eb;border-radius:10px;padding:10px 12px}._SplitTitle_ybic8_295{font-size:12px;color:#6b7280}._SplitText_ybic8_300{font-size:16px;font-weight:700;color:#111827;margin-top:2px}._Pairs_ybic8_307{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._PairItem_ybic8_314{border:1px solid #f3f4f6;border-radius:10px;padding:10px 12px;background:#fafafa}._PairLabel_ybic8_321{font-size:12px;color:#6b7280}._PairValue_ybic8_326{font-size:15px;font-weight:700;margin-top:2px;color:#111827}._WrongBox_ybic8_333{margin-top:8px;border-top:1px solid #e5e7eb;padding-top:10px}._WrongTitle_ybic8_339{font-weight:700;font-size:14px;color:#111827;margin-bottom:6px}._WrongList_ybic8_346{list-style:none;padding:0;margin:0}._WrongList_ybic8_346 li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px dashed #f3f4f6}._Badge_ybic8_360{display:inline-block;font-size:12px;padding:2px 6px;border-radius:999px;background:#eef2ff;color:#3730a3;font-weight:700}._WrongName_ybic8_370{flex:1;color:#111827;font-size:14px}._WrongTime_ybic8_376{font-size:12px;color:#6b7280}._Empty_ybic8_381{color:#6b7280;font-size:13px}._Hint_ybic8_387{margin-top:8px;font-size:12px;color:#6b7280}._handle_1ihf3_1{position:absolute;width:26px;height:26px;background-color:#3b82f6;box-shadow:0 2px 4px #0000004d;cursor:grab;z-index:10001;touch-action:none}._handle_1ihf3_1:active{cursor:grabbing;background-color:#2563eb}._handleStart_1ihf3_16{border-radius:13px 0 13px 13px}._handleEnd_1ihf3_21{border-radius:0 13px 13px}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var Ps=Object.defineProperty;var Bs=(e,t,n)=>t in e?Ps(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ir=(e,t,n)=>Bs(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),p=require("react"),zs=require("react-dom");function As(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $e=As(p),ir=p.createContext(void 0);var Yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qt={exports:{}},Sn={},Zt={exports:{}},yn={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var
|
|
10
|
+
*/var kr;function Ls(){if(kr)return yn;kr=1;var e=p;function t(S,g){return S===g&&(S!==0||1/S===1/g)||S!==S&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(S,g){var v=g(),x=r({inst:{value:v,getSnapshot:g}}),w=x[0].inst,u=x[1];return s(function(){w.value=v,w.getSnapshot=g,l(w)&&u({inst:w})},[S,v,g]),o(function(){return l(w)&&u({inst:w}),S(function(){l(w)&&u({inst:w})})},[S]),i(v),v}function l(S){var g=S.getSnapshot;S=S.value;try{var v=g();return!n(S,v)}catch{return!0}}function a(S,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:c;return yn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,yn}var wn={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* use-sync-external-store-shim.development.js
|
|
13
13
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var Tr;function Gs(){return Tr||(Tr=1,process.env.NODE_ENV!=="production"&&(function(){function e(v,x){return v===x&&(v!==0||1/v===1/x)||v!==v&&x!==x}function t(v,x){d||o.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var w=x();if(!S){var u=x();s(w,u)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),S=!0)}u=i({inst:{value:w,getSnapshot:x}});var f=u[0].inst,m=u[1];return l(function(){f.value=w,f.getSnapshot=x,n(f)&&m({inst:f})},[v,w,x]),c(function(){return n(f)&&m({inst:f}),v(function(){n(f)&&m({inst:f})})},[v]),a(w),w}function n(v){var x=v.getSnapshot;v=v.value;try{var w=x();return!s(v,w)}catch{return!0}}function r(v,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=p,s=typeof Object.is=="function"?Object.is:e,i=o.useState,c=o.useEffect,l=o.useLayoutEffect,a=o.useDebugValue,d=!1,S=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;wn.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wn}var Rr;function zo(){return Rr||(Rr=1,process.env.NODE_ENV==="production"?Zt.exports=Ls():Zt.exports=Gs()),Zt.exports}/**
|
|
19
19
|
* @license React
|
|
20
20
|
* use-sync-external-store-shim/with-selector.production.js
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the MIT license found in the
|
|
25
25
|
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var
|
|
26
|
+
*/var _r;function Hs(){if(_r)return Sn;_r=1;var e=p,t=zo();function n(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,l=e.useDebugValue;return Sn.useSyncExternalStoreWithSelector=function(a,d,S,g,v){var x=s(null);if(x.current===null){var w={hasValue:!1,value:null};x.current=w}else w=x.current;x=c(function(){function f(I){if(!m){if(m=!0,k=I,I=g(I),v!==void 0&&w.hasValue){var h=w.value;if(v(h,I))return T=h}return T=I}if(h=T,r(k,I))return h;var y=g(I);return v!==void 0&&v(h,y)?(k=I,h):(k=I,T=y)}var m=!1,k,T,_=S===void 0?null:S;return[function(){return f(d())},_===null?void 0:function(){return f(_())}]},[d,S,g,v]);var u=o(a,x[0],x[1]);return i(function(){w.hasValue=!0,w.value=u},[u]),l(u),u},Sn}var Cn={};/**
|
|
27
27
|
* @license React
|
|
28
28
|
* use-sync-external-store-shim/with-selector.development.js
|
|
29
29
|
*
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var _r;function Hs(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&(function(){function e(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,n=Bo(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Cn.useSyncExternalStoreWithSelector=function(a,d,x,h,v){var S=s(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=c(function(){function f(I){if(!m){if(m=!0,k=I,I=h(I),v!==void 0&&w.hasValue){var g=w.value;if(v(g,I))return R=g}return R=I}if(g=R,r(k,I))return g;var y=h(I);return v!==void 0&&v(g,y)?(k=I,g):(k=I,R=y)}var m=!1,k,R,_=x===void 0?null:x;return[function(){return f(d())},_===null?void 0:function(){return f(_())}]},[d,x,h,v]);var u=o(a,S[0],S[1]);return i(function(){w.hasValue=!0,w.value=u},[u]),l(u),u},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Cn}var Mr;function Ns(){return Mr||(Mr=1,process.env.NODE_ENV==="production"?Qt.exports=Gs():Qt.exports=Hs()),Qt.exports}var Fs=Ns();const Ds=Po(Fs),Er=e=>{let t;const n=new Set,r=(a,d)=>{const x=typeof a=="function"?a(t):a;if(!Object.is(x,t)){const h=t;t=d??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(v=>v(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:a=>(n.add(a),()=>n.delete(a))},l=t=e(r,o,c);return c},qt=(e=>e?Er(e):Er),{useSyncExternalStoreWithSelector:Ws}=Ds,$s=e=>e;function pn(e,t=$s,n){const r=Ws(e.subscribe,e.getState,e.getInitialState,t,n);return p.useDebugValue(r),r}function Y(e,t){const n=p.useContext(sr);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return pn(n,e,t)}function hn(){const e=p.useContext(sr);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const St=p.createContext(void 0),zo=p.createContext(void 0);function Vs(){return qt((e,t)=>({emitCallback:null,isPlaybackMode:!1,playbackScale:1,dispatchHandler:null,applySnapshotHandler:null,setEmitCallback:n=>e({emitCallback:n}),emit:(n,r)=>{const{emitCallback:o,isPlaybackMode:s}=t();s||o&&o({...n,timestamp:r??Date.now()})},setPlaybackMode:n=>e({isPlaybackMode:n}),setPlaybackScale:n=>e({playbackScale:n}),setDispatchHandler:n=>e({dispatchHandler:n}),dispatch:n=>{const{dispatchHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] dispatch called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] dispatch called but no handler registered")},setApplySnapshotHandler:n=>e({applySnapshotHandler:n}),applySnapshot:n=>{const{applySnapshotHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] applySnapshot called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] applySnapshot called but no handler registered")}}))}function qs({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=p.useMemo(()=>Vs(),[]);return p.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),p.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),p.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),p.useLayoutEffect(()=>()=>{o&&(o.current=null)},[o]),b.jsx(St.Provider,{value:s,children:b.jsx(zo.Provider,{value:o,children:e})})}function yt(){const e=p.useContext(St);if(!e)throw new Error("useViewerEventBridgeStoreApi must be used inside <ViewerEventBridgeProvider>");return e}const ir=p.createContext(void 0);function xt(){const e=p.useContext(ir);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function q(e,t){const n=p.useContext(ir);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return pn(n,o=>e(o.progress),t)}function Us({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=p.useRef(null);p.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=p.useCallback(c=>{if(!(r!=null&&r(c.target))&&c.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(c)},n)}},[n,e,r]),i=p.useCallback(c=>{r!=null&&r(c.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const on={light:{bg:"#ffffff",fg:"#111827",overlayBg:"#ffffff",overlayFg:"#111827",borderColor:"#333333"},dark:{bg:"#0b0b0b",fg:"#e5e7eb",overlayBg:"#0b0b0b",overlayFg:"#e5e7eb",borderColor:"#ffffff"},sepia:{bg:"#f4ecd8",fg:"#3e2f1c",overlayBg:"#f4ecd8",overlayFg:"#3e2f1c",borderColor:"#bfa87a"},green:{bg:"#e9f5e1",fg:"#1b3d1f",overlayBg:"#e9f5e1",overlayFg:"#1b3d1f",borderColor:"#93b48b"}},In=[8,16,24,40,64],kn=[1.2,1.4,1.6,1.8,2,2.2,2.4],Tn=[4,8,12,16,24],Qn=e=>Math.round(12+(e-1)*(16/11)),Ks=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Qn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},Rn=(e,t)=>{let n=0,r=1/0;return t.forEach((o,s)=>{const i=Math.abs(o-e);i<r&&(r=i,n=s)}),n+1},Ao=[{label:"고딕체",value:"'Noto Sans KR', sans-serif"},{label:"명조체",value:"'Noto Serif KR', serif"},{label:"바탕체",value:"'Nanum Myeongjo', serif"}],He={mode:"page",theme:"light",fontFamily:Ao.find(e=>e.label==="명조체").value,fontSizePx:18,lineHeight:1.8,marginX:20,marginY:24,showOverlays:!0,overlayCompactMode:!0,isSettingsOpen:!1,pointerStyle:"highlight",pointerColor:"#fff59d",breakMarks:{slash:!0},breakGapPx:8,muteAudio:!1,audioSpeed:1,showPointer:!0,showSplit:!0,viewportWidth:0,viewportHeight:0,isDev:!1};function Xs(e){const{init:t,recorderStore:n}=e??{};return qt((r,o)=>({...He,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>{const s=!o().showOverlays;r({showOverlays:s,...s&&{overlayCompactMode:!0}})},setOverlayCompactMode:s=>r({overlayCompactMode:s}),toggleOverlayCompactMode:()=>r({overlayCompactMode:!o().overlayCompactMode}),setSettingsOpen:s=>r({isSettingsOpen:s}),resetToDefaults:()=>r(s=>({mode:He.mode,theme:He.theme,fontFamily:He.fontFamily,fontSizePx:He.fontSizePx,lineHeight:He.lineHeight,marginX:He.marginX,marginY:He.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:He.pointerStyle,pointerColor:He.pointerColor,breakMarks:He.breakMarks,breakGapPx:He.breakGapPx,muteAudio:He.muteAudio,audioSpeed:He.audioSpeed,showPointer:He.showPointer,showSplit:He.showSplit})),maps:{MARGIN_MAP:In,LINEHEIGHT_MAP:kn,BREAK_GAP_MAP:Tn,fontSizeFromLevel:Qn},setPointerStyle:s=>r({pointerStyle:s}),setPointerColor:s=>r({pointerColor:s}),toggleBreakMark:s=>{const i=o().breakMarks;r({breakMarks:{...i,[s]:!i[s]}})},setBreakMarks:s=>{r({breakMarks:{...o().breakMarks,...s}})},setBreakGapPx:s=>r({breakGapPx:s}),setBreakGapLevel:s=>{const i=Tn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>Rn(o().breakGapPx,Tn),getFontLevel:()=>Ks(o().fontSizePx),getLineLevel:()=>Rn(o().lineHeight,kn),getMarginLevel:()=>Rn(o().marginX,In),setFontLevel:s=>r({fontSizePx:Qn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:kn[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=In[Math.max(1,Math.min(5,s))-1];r({marginX:i,marginY:i})},setMuteAudio:s=>{r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},toggleMuteAudio:()=>{const s=!o().muteAudio;r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},setAudioSpeed:s=>{const i=Math.max(.3,Math.min(2,s));r({audioSpeed:i}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:i}})},incAudioSpeed:()=>{const s=Math.min(2,Math.round((o().audioSpeed+.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},decAudioSpeed:()=>{const s=Math.max(.3,Math.round((o().audioSpeed-.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},setShowPointer:s=>r({showPointer:s}),toggleShowPointer:()=>r({showPointer:!o().showPointer}),setShowSplit:s=>r({showSplit:s}),toggleShowSplit:()=>r({showSplit:!o().showSplit}),setViewportSize:(s,i)=>r({viewportWidth:s,viewportHeight:i})}))}const gn=0,pt=1,jt=2,Lo=4;function jr(e){return()=>e}function Ys(e){e()}function Go(e,t){return n=>e(t(n))}function Or(e,t){return()=>e(t)}function Qs(e,t){return n=>e(t,n)}function lr(e){return e!==void 0}function Zs(...e){return()=>{e.map(Ys)}}function Ot(){}function mn(e,t){return t(e),e}function Js(e,t){return t(e)}function ke(...e){return e}function xe(e,t){return e(pt,t)}function fe(e,t){e(gn,t)}function ar(e){e(jt)}function _e(e){return e(Lo)}function J(e,t){return xe(e,Qs(t,gn))}function nt(e,t){const n=e(pt,r=>{n(),t(r)});return n}function Pr(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Ho(e,t){return e===t}function Ie(e=Ho){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ie(e){return t=>n=>{e(n)&&t(n)}}function U(e){return t=>Go(t,e)}function it(e){return t=>()=>{t(e)}}function L(e,...t){const n=ei(...t);return((r,o)=>{switch(r){case jt:ar(e);return;case pt:return xe(e,n(o))}})}function lt(e,t){return n=>r=>{n(t=e(t,r))}}function vt(e){return t=>n=>{e>0?e--:t(n)}}function ct(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function he(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);xe(s,l=>{const a=n;n=n|c,t[i]=l,a!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>{s([i].concat(t))};n===o?c():r=c}}function ei(...e){return t=>e.reduceRight(Js,t)}function ti(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case pt:return s?n===s?void 0:(r(),n=s,t=xe(e,s),t):(r(),Ot);case jt:r(),n=null;return}}}function H(e){let t=e;const n=ge();return((r,o)=>{switch(r){case gn:t=o;break;case pt:{o(t);break}case Lo:return t}return n(r,o)})}function Fe(e,t){return mn(H(t),n=>J(e,n))}function ge(){const e=[];return((t,n)=>{switch(t){case gn:e.slice().forEach(r=>{r(n)});return;case jt:e.splice(0,e.length);return;case pt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Ue(e){return mn(ge(),t=>J(e,t))}function me(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ni(),singleton:n}}const ni=()=>Symbol();function ri(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const c=r(o.map(l=>n(l)));return i&&t.set(s,c),c};return n(e)}function ze(...e){const t=ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);xe(s,l=>{n[i]=l,r=r|c,r===o&&fe(t,n)})}),function(s,i){switch(s){case jt:{ar(t);return}case pt:return r===o&&i(n),xe(t,i)}}}function se(e,t=Ho){return L(e,Ie(t))}function Zn(...e){return function(t,n){switch(t){case jt:return;case pt:return Zs(...e.map(r=>xe(r,n)))}}}var Ve=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ve||{});const oi={0:"debug",3:"error",1:"log",2:"warn"},si=()=>typeof globalThis>"u"?window:globalThis,ht=me(()=>{const e=H(3);return{log:H((t,n,r=1)=>{var o;const s=(o=si().VIRTUOSO_LOG_LEVEL)!=null?o:_e(e);r>=s&&console[oi[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function wt(e,t,n){return cr(e,t,n).callbackRef}function cr(e,t,n){const r=p.useRef(null);let o=i=>{};const s=p.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const c=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?c():requestAnimationFrame(c)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function ii(e,t,n,r,o,s,i,c,l){const a=p.useCallback(d=>{const x=li(d.children,t,c?"offsetWidth":"offsetHeight",o);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const v=h.lastElementChild.dataset.viewportType==="window";let S;v&&(S=h.ownerDocument.defaultView);const w=i?c?i.scrollLeft:i.scrollTop:v?c?S.scrollX||S.document.documentElement.scrollLeft:S.scrollY||S.document.documentElement.scrollTop:c?h.scrollLeft:h.scrollTop,u=i?c?i.scrollWidth:i.scrollHeight:v?c?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight:c?h.scrollWidth:h.scrollHeight,f=i?c?i.offsetWidth:i.offsetHeight:v?c?S.innerWidth:S.innerHeight:c?h.offsetWidth:h.offsetHeight;r({scrollHeight:u,scrollTop:Math.max(w,0),viewportHeight:f}),s==null||s(c?Br("column-gap",getComputedStyle(d).columnGap,o):Br("row-gap",getComputedStyle(d).rowGap,o)),x!==null&&e(x)},[e,t,o,s,i,r,c]);return cr(a,n,l)}function li(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const c=e.item(i);if(c.dataset.index===void 0)continue;const l=parseInt(c.dataset.index),a=parseFloat(c.dataset.knownSize),d=t(c,n);if(d===0&&r("Zero-sized element, this should not happen",{child:c},Ve.ERROR),d===a)continue;const x=s[s.length-1];s.length===0||x.size!==d||x.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function Br(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}function No(e,t,n){const r=p.useRef(null),o=p.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const a=l.getBoundingClientRect(),d=a.width;let x,h;if(t){const v=t.getBoundingClientRect(),S=a.top-v.top;h=v.height-Math.max(0,S),x=S+t.scrollTop}else{const v=i.current.ownerDocument.defaultView;h=v.innerHeight-Math.max(0,a.top),x=a.top+v.scrollY}r.current={offsetTop:x,visibleHeight:h,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:i}=cr(o,!0,n),c=p.useCallback(()=>{o(i.current)},[o,i]);return p.useEffect(()=>{var l;if(t){t.addEventListener("scroll",c);const a=new ResizeObserver(()=>{requestAnimationFrame(c)});return a.observe(t),()=>{t.removeEventListener("scroll",c),a.unobserve(t)}}else{const a=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}}},[c,t,i]),s}const De=me(()=>{const e=ge(),t=ge(),n=H(0),r=ge(),o=H(0),s=ge(),i=ge(),c=H(0),l=H(0),a=H(0),d=H(0),x=ge(),h=ge(),v=H(!1),S=H(!1),w=H(!1);return J(L(e,U(({scrollTop:u})=>u)),t),J(L(e,U(({scrollHeight:u})=>u)),i),J(t,o),{deviation:n,fixedFooterHeight:a,fixedHeaderHeight:l,footerHeight:d,headerHeight:c,horizontalDirection:S,scrollBy:h,scrollContainerState:e,scrollHeight:i,scrollingInProgress:v,scrollTo:x,scrollTop:t,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),Gt={lvl:0};function Fo(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:c,value:l}=t(e[i]);s.push({end:c-1,start:r,value:o}),r=c,o=l}return s.push({end:1/0,start:r,value:o}),s}function ve(e){return e===Gt}function Ht(e,t){if(!ve(e))return t===e.k?e.v:t<e.k?Ht(e.l,t):Ht(e.r,t)}function rt(e,t,n="k"){if(ve(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=rt(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return rt(e.l,t,n)}function qe(e,t,n){return ve(e)?$o(t,n,1):t===e.k?Le(e,{k:t,v:n}):t<e.k?zr(Le(e,{l:qe(e.l,t,n)})):zr(Le(e,{r:qe(e.r,t,n)}))}function _t(){return Gt}function Mt(e,t,n){if(ve(e))return[];const r=rt(e,t)[0];return ai(er(e,r,n))}function Jn(e,t){if(ve(e))return Gt;const{k:n,l:r,r:o}=e;if(t===n){if(ve(r))return o;if(ve(o))return r;{const[s,i]=Wo(r);return nn(Le(e,{k:s,l:Do(r),v:i}))}}else return t<n?nn(Le(e,{l:Jn(r,t)})):nn(Le(e,{r:Jn(o,t)}))}function bt(e){return ve(e)?[]:[...bt(e.l),{k:e.k,v:e.v},...bt(e.r)]}function er(e,t,n){if(ve(e))return[];const{k:r,l:o,r:s,v:i}=e;let c=[];return r>t&&(c=c.concat(er(o,t,n))),r>=t&&r<=n&&c.push({k:r,v:i}),r<=n&&(c=c.concat(er(s,t,n))),c}function nn(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(_n(t))return Vo(Le(e,{lvl:n-1}));if(!ve(t)&&!ve(t.r))return Le(t.r,{l:Le(t,{r:t.r.l}),lvl:n,r:Le(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(_n(e))return tr(Le(e,{lvl:n-1}));if(!ve(r)&&!ve(r.l)){const o=r.l,s=_n(o)?r.lvl-1:r.lvl;return Le(o,{l:Le(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:tr(Le(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Le(e,t){return $o(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Do(e){return ve(e.r)?e.l:nn(Le(e,{r:Do(e.r)}))}function _n(e){return ve(e)||e.lvl>e.r.lvl}function Wo(e){return ve(e.r)?[e.k,e.v]:Wo(e.r)}function $o(e,t,n,r=Gt,o=Gt){return{k:e,l:r,lvl:n,r:o,v:t}}function zr(e){return tr(Vo(e))}function Vo(e){const{l:t}=e;return!ve(t)&&t.lvl===e.lvl?Le(t,{r:Le(e,{l:t.r})}):e}function tr(e){const{lvl:t,r:n}=e;return!ve(n)&&!ve(n.r)&&n.lvl===t&&n.r.lvl===t?Le(n,{l:Le(e,{r:n.l}),lvl:t+1}):e}function ai(e){return Fo(e,({k:t,v:n})=>({index:t,value:n}))}function qo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Nt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const ur=me(()=>({recalcInProgress:H(!1)}),[],{singleton:!0});function Uo(e,t,n){return e[sn(e,t,n)]}function sn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function ci(e,t,n,r){const o=sn(e,t,r),s=sn(e,n,r,o);return e.slice(o,s+1)}function ft(e,t){return Math.round(e.getBoundingClientRect()[t])}function bn(e){return!ve(e.groupOffsetTree)}function dr({index:e},t){return t===e?0:t<e?-1:1}function ui(){return{groupIndices:[],groupOffsetTree:_t(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:_t()}}function di(e,t){let n=ve(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),ve(e)){e=qe(e,0,s);continue}const c=Mt(e,i-1,o+1);if(c.some(xi(r)))continue;let l=!1,a=!1;for(const{end:d,start:x,value:h}of c)l?(o>=x||s===h)&&(e=Jn(e,x)):(a=h!==s,l=!0),d>o&&o>=x&&h!==s&&(e=qe(e,o+1,h));a&&(e=qe(e,i,s))}return[e,n]}function fi(e){return typeof e.groupIndex<"u"}function pi({offset:e},t){return t===e?0:t<e?-1:1}function Ft(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=Uo(t,e,dr),i=e-r,c=s*i+(i-1)*n+o;return c>0?c+n:c}function Ko(e,t){if(!bn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Xo(e,t,n){if(fi(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Ko(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function hi(e,t,n,r=0){return r>0&&(t=Math.max(t,Uo(e,r,dr).offset)),Fo(ci(e,t,n,pi),bi)}function gi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Ve.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&ve(s)&&t.length===2){const h=t[0].size,v=t[1].size;i=n.reduce((S,w)=>qe(qe(S,w,h),w+1,v),i)}else[i,c]=di(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:a,lastSize:d,offsetTree:x}=nr(e.offsetTree,c,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((h,v)=>qe(h,v,Ft(v,x,o)),_t()),lastIndex:l,lastOffset:a,lastSize:d,offsetTree:x,sizeTree:i}}function mi(e){return bt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function Ar(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function nr(e,t,n,r){let o=e,s=0,i=0,c=0,l=0;if(t!==0){l=sn(o,t-1,dr),c=o[l].offset;const a=rt(n,t-1);s=a[0],i=a[1],o.length&&o[l].size===rt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:a,value:d}of Mt(n,t,1/0)){const x=a-s,h=x*i+c+x*r;o.push({index:a,offset:h,size:d}),s=a,c=h,i=d}return{lastIndex:s,lastOffset:c,lastSize:i,offsetTree:o}}function bi(e){return{index:e.index,value:e}}function xi(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const vi={offsetHeight:"height",offsetWidth:"width"},at=me(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Fe(r,0),s=ge(),i=ge(),c=H(0),l=H([]),a=H(void 0),d=H(void 0),x=H(void 0),h=H(void 0),v=H((g,y)=>ft(g,vi[y])),S=H(void 0),w=H(0),u=ui(),f=Fe(L(n,he(l,e,w),lt(gi,u),Ie()),u),m=Fe(L(l,Ie(),lt((g,y)=>({current:y,prev:g.current}),{current:[],prev:[]}),U(({prev:g})=>g)),[]);J(L(l,ie(g=>g.length>0),he(f,w),U(([g,y,T])=>{const j=g.reduce((O,z,C)=>qe(O,z,Ft(z,y.offsetTree,T)||C),_t());return{...y,groupIndices:g,groupOffsetTree:j}})),f),J(L(r,he(f),ie(([g,{lastIndex:y}])=>g<y),U(([g,{lastIndex:y,lastSize:T}])=>[{endIndex:y,size:T,startIndex:g}])),n),J(a,d);const k=Fe(L(a,U(g=>g===void 0)),!0);J(L(d,ie(g=>g!==void 0&&ve(_e(f).sizeTree)),U(g=>{const y=_e(x),T=_e(l).length>0;return y?T?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:g,startIndex:1}]:[]:[{endIndex:0,size:g,startIndex:0}]})),n),J(L(h,ie(g=>g!==void 0&&g.length>0&&ve(_e(f).sizeTree)),U(g=>{const y=[];let T=g[0],j=0;for(let O=1;O<g.length;O++){const z=g[O];z!==T&&(y.push({endIndex:O-1,size:T,startIndex:j}),T=z,j=O)}return y.push({endIndex:g.length-1,size:T,startIndex:j}),y})),n),J(L(l,he(x,d),ie(([,g,y])=>g!==void 0&&y!==void 0),U(([g,y,T])=>{const j=[];for(let O=0;O<g.length;O++){const z=g[O],C=g[O+1];j.push({startIndex:z,endIndex:z,size:y}),C!==void 0&&j.push({startIndex:z+1,endIndex:C-1,size:T})}return j})),n);const R=Ue(L(n,he(f),lt(({sizes:g},[y,T])=>({changed:T!==g,sizes:T}),{changed:!1,sizes:u}),U(g=>g.changed)));xe(L(c,lt((g,y)=>({diff:g.prev-y,prev:y}),{diff:0,prev:0}),U(g=>g.diff)),g=>{const{groupIndices:y}=_e(f);if(g>0)fe(t,!0),fe(s,g+Ar(g,y));else if(g<0){const T=_e(m);T.length>0&&(g-=Ar(-g,T)),fe(i,g)}}),xe(L(c,he(e)),([g,y])=>{g<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},Ve.ERROR)});const _=Ue(s);J(L(s,he(f),U(([g,y])=>{const T=y.groupIndices.length>0,j=[],O=y.lastSize;if(T){const z=Ht(y.sizeTree,0);let C=0,M=0;for(;C<g;){const G=y.groupIndices[M],E=y.groupIndices.length===M+1?1/0:y.groupIndices[M+1]-G-1;j.push({endIndex:G,size:z,startIndex:G}),j.push({endIndex:G+1+E-1,size:O,startIndex:G+1}),M++,C+=E+1}const P=bt(y.sizeTree);return C!==g&&P.shift(),P.reduce((G,{k:E,v:B})=>{let F=G.ranges;return G.prevSize!==0&&(F=[...G.ranges,{endIndex:E+g-1,size:G.prevSize,startIndex:G.prevIndex}]),{prevIndex:E+g,prevSize:B,ranges:F}},{prevIndex:g,prevSize:0,ranges:j}).ranges}return bt(y.sizeTree).reduce((z,{k:C,v:M})=>({prevIndex:C+g,prevSize:M,ranges:[...z.ranges,{endIndex:C+g-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const I=Ue(L(i,he(f,w),U(([g,{offsetTree:y},T])=>{const j=-g;return Ft(j,y,T)})));return J(L(i,he(f,w),U(([g,y,T])=>{if(y.groupIndices.length>0){if(ve(y.sizeTree))return y;let j=_t();const O=_e(m);let z=0,C=0,M=0;for(;z<-g;){M=O[C];const P=O[C+1]-M-1;C++,z+=P+1}if(j=bt(y.sizeTree).reduce((P,{k:G,v:E})=>qe(P,Math.max(0,G+g),E),j),z!==-g){const P=Ht(y.sizeTree,M);j=qe(j,0,P);const G=rt(y.sizeTree,-g+1)[1];j=qe(j,1,G)}return{...y,sizeTree:j,...nr(y.offsetTree,0,j,T)}}else{const j=bt(y.sizeTree).reduce((O,{k:z,v:C})=>qe(O,Math.max(0,z+g),C),_t());return{...y,sizeTree:j,...nr(y.offsetTree,0,j,T)}}})),f),{beforeUnshiftWith:_,data:S,defaultItemSize:d,firstItemIndex:c,fixedItemSize:a,fixedGroupSize:x,gap:w,groupIndices:l,heightEstimates:h,itemSize:v,listRefresh:R,shiftWith:i,shiftWithOffset:I,sizeRanges:n,sizes:f,statefulTotalCount:o,totalCount:r,trackItemSizes:k,unshiftWith:s}},ke(ht,ur),{singleton:!0});function Si(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Yo=me(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=ge(),i=ge(),c=Ue(L(s,U(Si)));return J(L(c,U(l=>l.totalCount)),n),J(L(c,U(l=>l.groupIndices)),e),J(L(ze(o,t,r),ie(([l,a])=>bn(a)),U(([l,a,d])=>rt(a.groupOffsetTree,Math.max(l-d,0),"v")[0]),Ie(),U(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(at,De)),gt=me(([{log:e}])=>{const t=H(!1),n=Ue(L(t,ie(r=>r),Ie()));return xe(t,r=>{r&&_e(e)("props updated",{},Ve.DEBUG)}),{didMount:n,propsReady:t}},ke(ht),{singleton:!0}),yi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Qo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!yi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Ut=me(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:c,scrollingInProgress:l,scrollTo:a,smoothScrollTargetReached:d,viewportHeight:x},{log:h}])=>{const v=ge(),S=ge(),w=H(0);let u=null,f=null,m=null;function k(){u&&(u(),u=null),m&&(m(),m=null),f&&(clearTimeout(f),f=null),fe(l,!1)}return J(L(v,he(n,x,r,w,c,i,h),he(e,s,o),U(([[R,_,I,g,y,T,j,O],z,C,M])=>{const P=Qo(R),{align:G,behavior:E,offset:B}=P,F=g-1,$=Xo(P,_,F);let V=Ft($,_.offsetTree,z)+T;G==="end"?(V+=C+rt(_.sizeTree,$)[1]-I+M,$===F&&(V+=j)):G==="center"?V+=(C+rt(_.sizeTree,$)[1]-I+M)/2:V-=y,B&&(V+=B);const le=ae=>{k(),ae?(O("retrying to scroll to",{location:R},Ve.DEBUG),fe(v,R)):(fe(S,!0),O("list did not change, scroll successful",{},Ve.DEBUG))};if(k(),E==="smooth"){let ae=!1;m=xe(t,ye=>{ae=ae||ye}),u=nt(d,()=>{le(ae)})}else u=nt(L(t,wi(150)),le);return f=setTimeout(()=>{k()},1200),fe(l,!0),O("scrolling from index to",{behavior:E,index:$,top:V},Ve.DEBUG),{behavior:E,top:V}})),a),{scrollTargetReached:S,scrollToIndex:v,topListHeight:w}},ke(at,De,ht),{singleton:!0});function wi(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function fr(e,t){e==0?t():requestAnimationFrame(()=>{fr(e-1,t)})}function pr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Kt=me(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const c=H(!0),l=H(0),a=H(!0);return J(L(i,he(l),ie(([d,x])=>!!x),it(!1)),c),J(L(i,he(l),ie(([d,x])=>!!x),it(!1)),a),xe(L(ze(t,i),he(c,n,e,a),ie(([[,d],x,{sizeTree:h},v,S])=>d&&(!ve(h)||lr(v))&&!x&&!S),he(l)),([,d])=>{nt(o,()=>{fe(a,!0)}),fr(4,()=>{nt(r,()=>{fe(c,!0)}),fe(s,d)})}),{initialItemFinalLocationReached:a,initialTopMostItemIndex:l,scrolledToInitialItem:c}},ke(at,De,Ut,gt),{singleton:!0});function Zo(e,t){return Math.abs(e-t)<1.01}const Dt="up",At="down",Ci="none",Ii={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},ki=0,Xt=me(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=H(!1),c=H(!0),l=ge(),a=ge(),d=H(4),x=H(ki),h=Fe(L(Zn(L(se(o),vt(1),it(!0)),L(se(o),vt(1),it(!1),Pr(100))),Ie()),!1),v=Fe(L(Zn(L(n,it(!0)),L(n,it(!1),Pr(200))),Ie()),!1);J(L(ze(se(o),se(x)),U(([m,k])=>m<=k),Ie()),c),J(L(c,ct(50)),a);const S=Ue(L(ze(r,se(s),se(t),se(e),se(d)),lt((m,[{scrollHeight:k,scrollTop:R},_,I,g,y])=>{const T=R+_-k>-y,j={scrollHeight:k,scrollTop:R,viewportHeight:_};if(T){let z,C;return R>m.state.scrollTop?(z="SCROLLED_DOWN",C=m.state.scrollTop-R):(z="SIZE_DECREASED",C=m.state.scrollTop-R||m.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:C,state:j}}let O;return j.scrollHeight>m.state.scrollHeight?O="SIZE_INCREASED":_<m.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":R<m.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:j}},Ii),Ie((m,k)=>m&&m.atBottom===k.atBottom))),w=Fe(L(r,lt((m,{scrollHeight:k,scrollTop:R,viewportHeight:_})=>{if(Zo(m.scrollHeight,k))return{changed:!1,jump:0,scrollHeight:k,scrollTop:R};{const I=k-(R+_)<1;return m.scrollTop!==R&&I?{changed:!0,jump:m.scrollTop-R,scrollHeight:k,scrollTop:R}:{changed:!0,jump:0,scrollHeight:k,scrollTop:R}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ie(m=>m.changed),U(m=>m.jump)),0);J(L(S,U(m=>m.atBottom)),i),J(L(i,ct(50)),l);const u=H(At);J(L(r,U(({scrollTop:m})=>m),Ie(),lt((m,k)=>_e(v)?{direction:m.direction,prevScrollTop:k}:{direction:k<m.prevScrollTop?Dt:At,prevScrollTop:k},{direction:At,prevScrollTop:0}),U(m=>m.direction)),u),J(L(r,ct(50),it(Ci)),u);const f=H(0);return J(L(h,ie(m=>!m),it(0)),f),J(L(o,ct(100),he(h),ie(([m,k])=>k),lt(([m,k],[R])=>[k,R],[0,0]),U(([m,k])=>k-m)),f),{atBottomState:S,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:a,atTopThreshold:x,isAtBottom:i,isAtTop:c,isScrolling:h,lastJumpDueToItemResize:w,scrollDirection:u,scrollVelocity:f}},ke(De)),Wt="top",$t="bottom",Lr="none";function Gr(e,t,n){return typeof e=="number"?n===Dt&&t===Wt||n===At&&t===$t?e:0:n===Dt?t===Wt?e.main:e.reverse:t===$t?e.main:e.reverse}function Hr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const hr=me(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=ge(),i=H(0),c=H(0),l=H(0),a=Fe(L(ze(se(r),se(o),se(n),se(s,Nt),se(l),se(i),se(t),se(e),se(c)),U(([d,x,h,[v,S],w,u,f,m,k])=>{const R=d-m,_=u+f,I=Math.max(h-R,0);let g=Lr;const y=Hr(k,Wt),T=Hr(k,$t);return v-=m,v+=h+f,S+=h+f,S-=m,v>d+_-y&&(g=Dt),S<d-I+x+T&&(g=At),g!==Lr?[Math.max(R-h-Gr(w,Wt,g)-y,0),R-I-f+x+Gr(w,$t,g)+T]:null}),ie(d=>d!=null),Ie(Nt)),[0,0]);return{increaseViewportBy:c,listBoundary:s,overscan:l,topListHeight:i,visibleRange:a}},ke(De),{singleton:!0});function Ti(e,t,n){if(bn(t)){const r=Ko(e,t);return[{index:rt(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Mn={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function rn(e,t,n,r,o,s){const{lastIndex:i,lastOffset:c,lastSize:l}=o;let a=0,d=0;if(e.length>0){a=e[0].offset;const w=e[e.length-1];d=w.offset+w.size}const x=n-i,h=c+x*l+(x-1)*r,v=a,S=h-d;return{bottom:d,firstItemIndex:s,items:Nr(e,o,s),offsetBottom:S,offsetTop:a,top:v,topItems:Nr(t,o,s),topListHeight:t.reduce((w,u)=>u.size+w,0),totalCount:n}}function Jo(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const c=e+i,l=pr(t,c),a=Array.from({length:c}).map((d,x)=>({data:s[x+l],index:x+l,offset:0,size:0}));return rn(a,[],c,o,n,r)}function Nr(e,t,n){if(e.length===0)return[];if(!bn(t))return e.map(a=>({...a,index:a.index+n,originalIndex:a.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Mt(t.groupOffsetTree,r,o);let c,l=0;for(const a of e){(!c||c.end<a.index)&&(c=i.shift(),l=t.groupIndices.indexOf(c.start));let d;a.index===c.start?d={index:l,type:"group"}:d={groupIndex:l,index:a.index-(l+1)+n},s.push({...d,data:a.data,offset:a.offset,originalIndex:a.index,size:a.size})}return s}function Fr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const Ct=me(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:c,visibleRange:l},{initialTopMostItemIndex:a,scrolledToInitialItem:d},{topListHeight:x},h,{didMount:v},{recalcInProgress:S}])=>{const w=H([]),u=H(0),f=ge(),m=H(0);J(s.topItemsIndexes,w);const k=Fe(L(ze(v,S,se(l,Nt),se(o),se(r),se(a),d,se(w),se(t),se(n),se(m),e),ie(([g,y,,T,,,,,,,,j])=>{const O=j&&j.length!==T;return g&&!y&&!O}),U(([,,[g,y],T,j,O,z,C,M,P,G,E])=>{var B,F,$,V;const le=j,{offsetTree:ae,sizeTree:ye}=le,we=_e(u);if(T===0)return{...Mn,totalCount:T};if(g===0&&y===0)return we===0?{...Mn,totalCount:T}:Jo(we,O,j,M,P,E||[]);if(ve(ye))return we>0?null:rn(Ti(pr(O,T),le,E),[],T,P,le,M);const Z=[];if(C.length>0){const W=C[0],Q=C[C.length-1];let re=0;for(const te of Mt(ye,W,Q)){const ue=te.value,oe=Math.max(te.start,W),be=Math.min(te.end,Q);for(let pe=oe;pe<=be;pe++)Z.push({data:E==null?void 0:E[pe],index:pe,offset:re,size:ue}),re+=ue}}if(!z)return rn([],Z,T,P,le,M);const X=C.length>0?C[C.length-1]+1:0,A=hi(ae,g,y,X);if(A.length===0)return null;const K=T-1,ee=mn([],W=>{for(const Q of A){const re=Q.value;let te=re.offset,ue=Q.start;const oe=re.size;if(re.offset<g){ue+=Math.floor((g-re.offset+P)/(oe+P));const pe=ue-Q.start;te+=pe*oe+pe*P}ue<X&&(te+=(X-ue)*oe,ue=X);const be=Math.min(Q.end,K);for(let pe=ue;pe<=be&&!(te>=y);pe++)W.push({data:E==null?void 0:E[pe],index:pe,offset:te,size:oe}),te+=oe+P}}),N=Fr(G,Wt),ne=Fr(G,$t);if(ee.length>0&&(N>0||ne>0)){const W=ee[0],Q=ee[ee.length-1];if(N>0&&W.index>X){const re=Math.min(N,W.index-X),te=[];let ue=W.offset;for(let oe=W.index-1;oe>=W.index-re;oe--){const be=(F=(B=Mt(ye,oe,oe)[0])==null?void 0:B.value)!=null?F:W.size;ue-=be+P,te.unshift({data:E==null?void 0:E[oe],index:oe,offset:ue,size:be})}ee.unshift(...te)}if(ne>0&&Q.index<K){const re=Math.min(ne,K-Q.index);let te=Q.offset+Q.size+P;for(let ue=Q.index+1;ue<=Q.index+re;ue++){const oe=(V=($=Mt(ye,ue,ue)[0])==null?void 0:$.value)!=null?V:Q.size;ee.push({data:E==null?void 0:E[ue],index:ue,offset:te,size:oe}),te+=oe+P}}}return rn(ee,Z,T,P,le,M)}),ie(g=>g!==null),Ie()),Mn);J(L(e,ie(lr),U(g=>g==null?void 0:g.length)),o),J(L(k,U(g=>g.topListHeight)),x),J(x,c),J(L(k,U(g=>[g.top,g.bottom])),i),J(L(k,U(g=>g.items)),f);const R=Ue(L(k,ie(({items:g})=>g.length>0),he(o,e),ie(([{items:g},y])=>g[g.length-1].originalIndex===y-1),U(([,g,y])=>[g-1,y]),Ie(Nt),U(([g])=>g))),_=Ue(L(k,ct(200),ie(({items:g,topItems:y})=>g.length>0&&g[0].originalIndex===y.length),U(({items:g})=>g[0].index),Ie())),I=Ue(L(k,ie(({items:g})=>g.length>0),U(({items:g})=>{let y=0,T=g.length-1;for(;g[y].type==="group"&&y<T;)y++;for(;g[T].type==="group"&&T>y;)T--;return{endIndex:g[T].index,startIndex:g[y].index}}),Ie(qo)));return{endReached:R,initialItemCount:u,itemsRendered:f,listState:k,minOverscanItemCount:m,rangeChanged:I,startReached:_,topItemsIndexes:w,...h}},ke(at,Yo,hr,Kt,Ut,Xt,gt,ur),{singleton:!0}),es=me(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=ge(),i=Fe(L(ze(n,e,r,t,o),U(([c,l,a,d,x])=>c+l+a+d+x.offsetBottom+x.bottom)),0);return J(se(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(De,Ct),{singleton:!0}),Ri=me(([{viewportHeight:e},{totalListHeight:t}])=>{const n=H(!1),r=Fe(L(ze(n,e,t),ie(([o])=>o),U(([,o,s])=>Math.max(0,o-s)),ct(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(De,es),{singleton:!0}),ts=me(()=>({context:H(null)})),_i=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,ns=me(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:c,viewportHeight:l},{scrollToIndex:a}])=>{const d=ge();return J(L(d,he(t,l,n,s,o,r,c),he(e),U(([[x,h,v,S,w,u,f,m],k])=>{const{align:R,behavior:_,calculateViewLocation:I=_i,done:g,...y}=x,T=Xo(x,h,S-1),j=Ft(T,h.offsetTree,k)+w+u,O=j+rt(h.sizeTree,T)[1],z=m+u,C=m+v-f,M=I({itemBottom:O,itemTop:j,locationParams:{align:R,behavior:_,...y},viewportBottom:C,viewportTop:z});return M?g&&nt(L(i,ie(P=>!P),vt(_e(i)?1:2)),g):g==null||g(),M}),ie(x=>x!==null)),a),{scrollIntoView:d}},ke(at,De,Ut,Ct,ht),{singleton:!0});function Dr(e){return e?e==="smooth"?"smooth":"auto":!1}const Mi=(e,t)=>typeof e=="function"?Dr(e(t)):t&&Dr(e),Ei=me(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:c},{didMount:l,propsReady:a},{log:d},{scrollingInProgress:x},{context:h},{scrollIntoView:v}])=>{const S=H(!1),w=ge();let u=null;function f(_){fe(i,{align:"end",behavior:_,index:"LAST"})}xe(L(ze(L(se(t),vt(1)),l),he(se(S),s,c,x),U(([[_,I],g,y,T,j])=>{let O=I&&T,z="auto";return O&&(z=Mi(g,y||j),O=O&&!!z),{followOutputBehavior:z,shouldFollow:O,totalCount:_}}),ie(({shouldFollow:_})=>_)),({followOutputBehavior:_,totalCount:I})=>{u&&(u(),u=null),_e(n)?requestAnimationFrame(()=>{_e(d)("following output to ",{totalCount:I},Ve.DEBUG),f(_)}):u=nt(e,()=>{_e(d)("following output to ",{totalCount:I},Ve.DEBUG),f(_),u=null})});function m(_){const I=nt(o,g=>{_&&!g.atBottom&&g.notAtBottomBecause==="SIZE_INCREASED"&&!u&&(_e(d)("scrolling to bottom due to increased size",{},Ve.DEBUG),f("auto"))});setTimeout(I,100)}xe(L(ze(se(S),t,a),ie(([_,,I])=>_&&I),lt(({value:_},[,I])=>({refreshed:_===I,value:I}),{refreshed:!1,value:0}),ie(({refreshed:_})=>_),he(S,t)),([,_])=>{_e(c)&&m(_!==!1)}),xe(w,()=>{m(_e(S)!==!1)}),xe(ze(se(S),o),([_,I])=>{_&&!I.atBottom&&I.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const k=H(null),R=ge();return J(Zn(L(se(r),U(_=>{var I;return(I=_==null?void 0:_.length)!=null?I:0})),L(se(t))),R),xe(L(ze(L(R,vt(1)),l),he(se(k),c,x,h),U(([[_,I],g,y,T,j])=>I&&y&&(g==null?void 0:g({context:j,totalCount:_,scrollingInProgress:T}))),ie(_=>!!_),ct(0)),_=>{u&&(u(),u=null),_e(n)?requestAnimationFrame(()=>{_e(d)("scrolling into view",{}),fe(v,_)}):u=nt(e,()=>{_e(d)("scrolling into view",{}),fe(v,_),u=null})}),{autoscrollToBottom:w,followOutput:S,scrollIntoViewOnChange:k}},ke(at,Xt,Ut,Kt,gt,ht,De,ts,ns)),ji=me(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:c}])=>(J(L(c,he(s),ie(([,l])=>l!==0),he(o,r,t,n,e),U(([[,l],a,d,x,h,v=[]])=>Jo(l,a,d,x,h,v))),i),{}),ke(at,Kt,Ct,gt),{singleton:!0}),Oi=me(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=H(0);return xe(L(e,he(r),ie(([,o])=>o!==0),U(([,o])=>({top:o}))),o=>{nt(L(n,vt(1),ie(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{fe(t,o)})})}),{initialScrollTop:r}},ke(gt,De,Ct),{singleton:!0}),rs=me(([{scrollVelocity:e}])=>{const t=H(!1),n=ge(),r=H(!1);return J(L(e,he(r,t,n),ie(([o,s])=>!!s),U(([o,s,i,c])=>{const{enter:l,exit:a}=s;if(i){if(a(o,c))return!1}else if(l(o,c))return!0;return i}),Ie()),t),xe(L(ze(t,e,n),he(r)),([[o,s,i],c])=>{o&&c&&c.change&&c.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Xt),{singleton:!0}),gr=me(([{scrollContainerState:e,scrollTo:t}])=>{const n=ge(),r=ge(),o=ge(),s=H(!1),i=H(void 0);return J(L(ze(n,r),U(([{scrollHeight:c,scrollTop:l,viewportHeight:a},{offsetTop:d}])=>({scrollHeight:c,scrollTop:Math.max(0,l-d),viewportHeight:a}))),e),J(L(t,he(r),U(([c,{offsetTop:l}])=>({...c,top:c.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(De)),Pi=me(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:c,windowViewportRect:l}])=>{const a=ge(),d=H(void 0),x=H(null),h=H(null);return J(c,x),J(l,h),xe(L(a,he(t,r,i,x,h,n)),([v,S,w,u,f,m,k])=>{const R=mi(S.sizeTree);u&&f!==null&&m!==null&&(w=f.scrollTop-m.offsetTop),w-=k,v({ranges:R,scrollTop:w})}),J(L(d,ie(lr),U(Bi)),o),J(L(s,he(d),ie(([,v])=>v!==void 0),Ie(),U(([,v])=>v.ranges)),e),{getState:a,restoreStateFrom:d}},ke(at,De,Kt,gt,gr));function Bi(e){return{align:"start",index:0,offset:e.scrollTop}}const zi=me(([{topItemsIndexes:e}])=>{const t=H(0);return J(L(t,ie(n=>n>=0),U(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(Ct));function os(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Ai=os(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Li=me(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:c},{listState:l},{beforeUnshiftWith:a,gap:d,shiftWithOffset:x,sizes:h},{log:v},{recalcInProgress:S}])=>{const w=Ue(L(l,he(i),lt(([,f,m,k],[{bottom:R,items:_,offsetBottom:I,totalCount:g},y])=>{const T=R+I;let j=0;return m===g&&f.length>0&&_.length>0&&(_[0].originalIndex===0&&f[0].originalIndex===0||(j=T-k,j!==0&&(j+=y))),[j,_,g,T]},[0,[],0,0]),ie(([f])=>f!==0),he(r,c,n,o,v,S),ie(([,f,m,k,,,R])=>!R&&!k&&f!==0&&m===Dt),U(([[f],,,,,m])=>(m("Upward scrolling compensation",{amount:f},Ve.DEBUG),f))));function u(f){f>0?(fe(t,{behavior:"auto",top:-f}),fe(e,0)):(fe(e,0),fe(t,{behavior:"auto",top:-f}))}return xe(L(w,he(e,s)),([f,m,k])=>{k&&Ai()?fe(e,m-f):u(-f)}),xe(L(ze(Fe(s,!1),e,S),ie(([f,m,k])=>!f&&!k&&m!==0),U(([f,m])=>m),ct(1)),u),J(L(x,U(f=>({top:-f}))),t),xe(L(a,he(h,d),U(([f,{groupIndices:m,lastSize:k,sizeTree:R},_])=>{function I(g){return g*(k+_)}if(m.length===0)return I(f);{let g=0;const y=Ht(R,0);let T=0,j=0;for(;T<f;){T++,g+=y;let O=m.length===j+1?1/0:m[j+1]-m[j]-1;T+O>f&&(g-=y,O=f-T+1),T+=O,g+=I(O),j++}return g}})),f=>{fe(e,f),requestAnimationFrame(()=>{fe(t,{top:f}),requestAnimationFrame(()=>{fe(e,0),fe(S,!1)})})}),{deviation:e}},ke(De,Xt,Ct,at,ht,ur)),Gi=me(([e,t,n,r,o,s,i,c,l,a,d])=>({...e,...t,...n,...r,...o,...s,...i,...c,...l,...a,...d}),ke(hr,ji,gt,rs,es,Oi,Ri,gr,ns,ht,ts)),ss=me(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:c,itemSize:l,sizeRanges:a,sizes:d,statefulTotalCount:x,totalCount:h,trackItemSizes:v},{initialItemFinalLocationReached:S,initialTopMostItemIndex:w,scrolledToInitialItem:u},f,m,k,R,{scrollToIndex:_},I,{topItemCount:g},{groupCounts:y},T])=>{const{listState:j,minOverscanItemCount:O,topItemsIndexes:z,rangeChanged:C,...M}=R;return J(C,T.scrollSeekRangeChanged),J(L(T.windowViewportRect,U(P=>P.visibleHeight)),f.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:y,heightEstimates:c,initialItemFinalLocationReached:S,initialTopMostItemIndex:w,scrolledToInitialItem:u,sizeRanges:a,topItemCount:g,topItemsIndexes:z,totalCount:h,...k,groupIndices:i,itemSize:l,listState:j,minOverscanItemCount:O,scrollToIndex:_,statefulTotalCount:x,trackItemSizes:v,rangeChanged:C,...M,...T,...f,sizes:d,...m}},ke(at,Kt,De,Pi,Ei,Ct,Ut,Li,zi,Yo,Gi));function Hi(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(r,i)||(n[i]=t[i]);return n}const Jt=typeof document<"u"?p.useLayoutEffect:p.useEffect;function is(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),c=p.createContext({});function l(u,f){u.propsReady&&fe(u.propsReady,!1);for(const m of r){const k=u[t.required[m]];fe(k,f[m])}for(const m of o)if(m in f){const k=u[t.optional[m]];fe(k,f[m])}u.propsReady&&fe(u.propsReady,!0)}function a(u){return s.reduce((f,m)=>(f[m]=k=>{const R=u[t.methods[m]];fe(R,k)},f),{})}function d(u){return i.reduce((f,m)=>(f[m]=ti(u[t.events[m]]),f),{})}const x=p.forwardRef((u,f)=>{const{children:m,...k}=u,[R]=p.useState(()=>mn(ri(e),g=>{l(g,k)})),[_]=p.useState(Or(d,R));Jt(()=>{for(const g of i)g in k&&xe(_[g],k[g]);return()=>{Object.values(_).map(ar)}},[k,_,R]),Jt(()=>{l(R,k)}),p.useImperativeHandle(f,jr(a(R)));const I=n;return b.jsx(c.Provider,{value:R,children:n?b.jsx(I,{...Hi([...r,...o,...i],k),children:m}):m})}),h=u=>{const f=p.useContext(c);return p.useCallback(m=>{fe(f[u],m)},[f,u])},v=u=>{const f=p.useContext(c)[u],m=p.useCallback(k=>xe(f,k),[f]);return p.useSyncExternalStore(m,()=>_e(f),()=>_e(f))},S=u=>{const f=p.useContext(c)[u],[m,k]=p.useState(Or(_e,f));return Jt(()=>xe(f,R=>{R!==m&&k(jr(R))}),[f,m]),m},w=p.version.startsWith("18")?v:S;return{Component:x,useEmitter:(u,f)=>{const m=p.useContext(c)[u];Jt(()=>xe(m,f),[f,m])},useEmitterValue:w,usePublisher:h}}const ls=p.createContext(void 0),as=p.createContext(void 0),cs=typeof document<"u"?p.useLayoutEffect:p.useEffect;function En(e){return"self"in e}function Ni(e){return"body"in e}function us(e,t,n,r=Ot,o,s){const i=p.useRef(null),c=p.useRef(null),l=p.useRef(null),a=p.useCallback(h=>{let v,S,w;const u=h.target;if(Ni(u)||En(u)){const m=En(u)?u:u.defaultView;w=s?m.scrollX:m.scrollY,v=s?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight,S=s?m.innerWidth:m.innerHeight}else w=s?u.scrollLeft:u.scrollTop,v=s?u.scrollWidth:u.scrollHeight,S=s?u.offsetWidth:u.offsetHeight;const f=()=>{e({scrollHeight:v,scrollTop:Math.max(w,0),viewportHeight:S})};h.suppressFlushSync?f():Bs.flushSync(f),c.current!==null&&(w===c.current||w<=0||w===v-S)&&(c.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);p.useEffect(()=>{const h=o||i.current;return r(o||i.current),a({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",a,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",a)}},[i,a,n,r,o]);function d(h){const v=i.current;if(!v||(s?"offsetWidth"in v&&v.offsetWidth===0:"offsetHeight"in v&&v.offsetHeight===0))return;const S=h.behavior==="smooth";let w,u,f;En(v)?(u=Math.max(ft(v.document.documentElement,s?"width":"height"),s?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight),w=s?v.innerWidth:v.innerHeight,f=s?window.scrollX:window.scrollY):(u=v[s?"scrollWidth":"scrollHeight"],w=ft(v,s?"width":"height"),f=v[s?"scrollLeft":"scrollTop"]);const m=u-w;if(h.top=Math.ceil(Math.max(Math.min(m,h.top),0)),Zo(w,u)||h.top===f){e({scrollHeight:u,scrollTop:f,viewportHeight:w}),S&&t(!0);return}S?(c.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,c.current=null,t(!0)},1e3)):c.current=null,s&&(h={behavior:h.behavior,left:h.top}),v.scrollTo(h)}function x(h){s&&(h={behavior:h.behavior,left:h.top}),i.current.scrollBy(h)}return{scrollByCallback:x,scrollerRef:i,scrollToCallback:d}}const jn="-webkit-sticky",Wr="sticky",mr=os(()=>{if(typeof document>"u")return Wr;const e=document.createElement("div");return e.style.position=jn,e.style.position===jn?jn:Wr});function br(e){return e}const Fi=me(()=>{const e=H(c=>`Item ${c}`),t=H(c=>`Group ${c}`),n=H({}),r=H(br),o=H("div"),s=H(Ot),i=(c,l=null)=>Fe(L(n,U(a=>a[c]),Ie()),l);return{components:n,computeItemKey:r,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),Di=me(([e,t])=>({...e,...t}),ke(ss,Fi)),Wi=({height:e})=>b.jsx("div",{style:{height:e}}),$i={overflowAnchor:"none",position:mr(),zIndex:1},ds={overflowAnchor:"none"},Vi={...ds,display:"inline-block",height:"100%"},$r=p.memo(function({showTopList:e=!1}){const t=ce("listState"),n=Xe("sizeRanges"),r=ce("useWindowScroll"),o=ce("customScrollParent"),s=Xe("windowScrollContainerState"),i=Xe("scrollContainerState"),c=o||r?s:i,l=ce("itemContent"),a=ce("context"),d=ce("groupContent"),x=ce("trackItemSizes"),h=ce("itemSize"),v=ce("log"),S=Xe("gap"),w=ce("horizontalDirection"),{callbackRef:u}=ii(n,h,x,e?Ot:c,v,S,o,w,ce("skipAnimationFrameInResizeObserver")),[f,m]=p.useState(0);xr("deviation",M=>{f!==M&&m(M)});const k=ce("EmptyPlaceholder"),R=ce("ScrollSeekPlaceholder")||Wi,_=ce("ListComponent"),I=ce("ItemComponent"),g=ce("GroupComponent"),y=ce("computeItemKey"),T=ce("isSeeking"),j=ce("groupIndices").length>0,O=ce("alignToBottom"),z=ce("initialItemFinalLocationReached"),C=e?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:f!==0?f:O?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:f!==0?f:O?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...z?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k?b.jsx(k,{...Ne(k,a)}):b.jsx(_,{...Ne(_,a),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:u,style:C,children:(e?t.topItems:t.items).map(M=>{const P=M.originalIndex,G=y(P+t.firstItemIndex,M.data,a);return T?p.createElement(R,{...Ne(R,a),height:M.size,index:M.index,key:G,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?p.createElement(g,{...Ne(g,a),"data-index":P,"data-item-index":M.index,"data-known-size":M.size,key:G,style:$i},d(M.index,a)):p.createElement(I,{...Ne(I,a),...Xi(I,M.data),"data-index":P,"data-item-group-index":M.groupIndex,"data-item-index":M.index,"data-known-size":M.size,key:G,style:w?Vi:ds},j?l(M.index,M.groupIndex,M.data,a):l(M.index,M.data,a))})})}),qi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ui={outline:"none",overflowX:"auto",position:"relative"},xn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Ki={position:mr(),top:0,width:"100%",zIndex:1};function Ne(e,t){if(typeof e!="string")return{context:t}}function Xi(e,t){return{item:typeof e=="string"?void 0:t}}const Yi=p.memo(function(){const e=ce("HeaderComponent"),t=Xe("headerHeight"),n=ce("HeaderFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null}),Qi=p.memo(function(){const e=ce("FooterComponent"),t=Xe("footerHeight"),n=ce("HeaderFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null});function fs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return p.memo(function({children:r,style:o,context:s,...i}){const c=n("scrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("scrollerRef"),x=t("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:v,scrollToCallback:S}=us(c,a,l,d,void 0,x);return e("scrollTo",S),e("scrollBy",h),b.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:v,style:{...x?Ui:qi,...o},tabIndex:0,...i,...Ne(l,s),children:r})})}function ps({useEmitter:e,useEmitterValue:t,usePublisher:n}){return p.memo(function({children:r,style:o,context:s,...i}){const c=n("windowScrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("totalListHeight"),x=t("deviation"),h=t("customScrollParent"),v=p.useRef(null),S=t("scrollerRef"),{scrollByCallback:w,scrollerRef:u,scrollToCallback:f}=us(c,a,l,S,h);return cs(()=>{var m;return u.current=h||((m=v.current)==null?void 0:m.ownerDocument.defaultView),()=>{u.current=null}},[u,h]),e("windowScrollTo",f),e("scrollBy",w),b.jsx(l,{ref:v,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d!==0?{height:d+x}:{}},...i,...Ne(l,s),children:r})})}const Zi=({children:e})=>{const t=p.useContext(ls),n=Xe("viewportHeight"),r=Xe("fixedItemHeight"),o=ce("alignToBottom"),s=ce("horizontalDirection"),i=p.useMemo(()=>Go(n,l=>ft(l,s?"width":"height")),[n,s]),c=wt(i,!0,ce("skipAnimationFrameInResizeObserver"));return p.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),b.jsx("div",{"data-viewport-type":"element",ref:c,style:xn(o),children:e})},Ji=({children:e})=>{const t=p.useContext(ls),n=Xe("windowViewportRect"),r=Xe("fixedItemHeight"),o=ce("customScrollParent"),s=No(n,o,ce("skipAnimationFrameInResizeObserver")),i=ce("alignToBottom");return p.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),b.jsx("div",{"data-viewport-type":"window",ref:s,style:xn(i),children:e})},el=({children:e})=>{const t=ce("TopItemListComponent")||"div",n=ce("headerHeight"),r={...Ki,marginTop:`${n}px`},o=ce("context");return b.jsx(t,{style:r,...Ne(t,o),children:e})},tl=p.memo(function(e){const t=ce("useWindowScroll"),n=ce("topItemsIndexes").length>0,r=ce("customScrollParent"),o=ce("context");return b.jsxs(r||t?ol:rl,{...e,context:o,children:[n&&b.jsx(el,{children:b.jsx($r,{showTopList:!0})}),b.jsxs(r||t?Ji:Zi,{children:[b.jsx(Yi,{}),b.jsx($r,{}),b.jsx(Qi,{})]})]})}),{Component:nl,useEmitter:xr,useEmitterValue:ce,usePublisher:Xe}=is(Di,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},tl),rl=fs({useEmitter:xr,useEmitterValue:ce,usePublisher:Xe}),ol=ps({useEmitter:xr,useEmitterValue:ce,usePublisher:Xe}),sl=nl,il=me(()=>{const e=H(a=>b.jsxs("td",{children:["Item $",a]})),t=H(null),n=H(a=>b.jsxs("td",{colSpan:1e3,children:["Group ",a]})),r=H(null),o=H(null),s=H({}),i=H(br),c=H(Ot),l=(a,d=null)=>Fe(L(s,U(x=>x[a]),Ie()),d);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ke(ss,il);mr();const Vr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},ll={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:qr,floor:ln,max:Lt,min:On,round:Ur}=Math;function Kr(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function al(e){return{...ll,items:e}}function en(e,t){return e&&e.width===t.width&&e.height===t.height}function cl(e,t){return e&&e.column===t.column&&e.row===t.row}const ul=me(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:c,scrollTo:l,scrollTop:a,smoothScrollTargetReached:d,viewportHeight:x},h,v,{didMount:S,propsReady:w},{customScrollParent:u,useWindowScroll:f,windowScrollContainerState:m,windowScrollTo:k,windowViewportRect:R},_])=>{const I=H(0),g=H(0),y=H(Vr),T=H({height:0,width:0}),j=H({height:0,width:0}),O=ge(),z=ge(),C=H(0),M=H(null),P=H({column:0,row:0}),G=ge(),E=ge(),B=H(!1),F=H(0),$=H(!0),V=H(!1),le=H(!1);xe(L(S,he(F),ie(([A,K])=>!!K)),()=>{fe($,!1)}),xe(L(ze(S,$,j,T,F,V),ie(([A,K,ee,N,,ne])=>A&&!K&&ee.height!==0&&N.height!==0&&!ne)),([,,,,A])=>{fe(V,!0),fr(1,()=>{fe(O,A)}),nt(L(a),()=>{fe(t,[0,0]),fe($,!0)})}),J(L(E,ie(A=>A!=null&&A.scrollTop>0),it(0)),g),xe(L(S,he(E),ie(([,A])=>A!=null)),([,A])=>{A&&(fe(T,A.viewport),fe(j,A.item),fe(P,A.gap),A.scrollTop>0&&(fe(B,!0),nt(L(a,vt(1)),K=>{fe(B,!1)}),fe(l,{top:A.scrollTop})))}),J(L(T,U(({height:A})=>A)),x),J(L(ze(se(T,en),se(j,en),se(P,(A,K)=>A&&A.column===K.column&&A.row===K.row),se(a)),U(([A,K,ee,N])=>({gap:ee,item:K,scrollTop:N,viewport:A}))),G),J(L(ze(se(I),r,se(P,cl),se(j,en),se(T,en),se(M),se(g),se(B),se($),se(F)),ie(([,,,,,,,A])=>!A),U(([A,[K,ee],N,ne,W,Q,re,,te,ue])=>{const{column:oe,row:be}=N,{height:pe,width:Se}=ne,{width:Te}=W;if(re===0&&(A===0||Te===0))return Vr;if(Se===0){const ut=pr(ue,A),Pt=ut+Math.max(re-1,0);return al(Kr(ut,Pt,Q))}const Be=hs(Te,Se,oe);let Ee,Ge;te?K===0&&ee===0&&re>0?(Ee=0,Ge=re-1):(Ee=Be*ln((K+be)/(pe+be)),Ge=Be*qr((ee+be)/(pe+be))-1,Ge=On(A-1,Lt(Ge,Be-1)),Ee=On(Ge,Lt(0,Ee))):(Ee=0,Ge=-1);const ot=Kr(Ee,Ge,Q),{bottom:We,top:Oe}=Xr(W,N,ne,ot),Ze=qr(A/Be),Ke=Ze*pe+(Ze-1)*be-We;return{bottom:We,itemHeight:pe,items:ot,itemWidth:Se,offsetBottom:Ke,offsetTop:Oe,top:Oe}})),y),J(L(M,ie(A=>A!==null),U(A=>A.length)),I),J(L(ze(T,j,y,P),ie(([A,K,{items:ee}])=>ee.length>0&&K.height!==0&&A.height!==0),U(([A,K,{items:ee},N])=>{const{bottom:ne,top:W}=Xr(A,N,K,ee);return[W,ne]}),Ie(Nt)),t);const ae=H(!1);J(L(a,he(ae),U(([A,K])=>K||A!==0)),ae);const ye=Ue(L(ze(y,I),ie(([{items:A}])=>A.length>0),he(ae),ie(([[A,K],ee])=>{const N=A.items[A.items.length-1].index===K-1;return(ee||A.bottom>0&&A.itemHeight>0&&A.offsetBottom===0&&A.items.length===K)&&N}),U(([[,A]])=>A-1),Ie())),we=Ue(L(se(y),ie(({items:A})=>A.length>0&&A[0].index===0),it(0),Ie())),Z=Ue(L(se(y),he(B),ie(([{items:A},K])=>A.length>0&&!K),U(([{items:A}])=>({endIndex:A[A.length-1].index,startIndex:A[0].index})),Ie(qo),ct(0)));J(Z,v.scrollSeekRangeChanged),J(L(O,he(T,j,I,P),U(([A,K,ee,N,ne])=>{const W=Qo(A),{align:Q,behavior:re,offset:te}=W;let ue=W.index;ue==="LAST"&&(ue=N-1),ue=Lt(0,ue,On(N-1,ue));let oe=rr(K,ne,ee,ue);return Q==="end"?oe=Ur(oe-K.height+ee.height):Q==="center"&&(oe=Ur(oe-K.height/2+ee.height/2)),te&&(oe+=te),{behavior:re,top:oe}})),l);const X=Fe(L(y,U(A=>A.offsetBottom+A.bottom)),0);return J(L(R,U(A=>({height:A.visibleHeight,width:A.visibleWidth}))),T),{customScrollParent:u,data:M,deviation:C,footerHeight:o,gap:P,headerHeight:s,increaseViewportBy:e,initialItemCount:g,itemDimensions:j,overscan:n,restoreStateFrom:E,scrollBy:i,scrollContainerState:c,scrollHeight:z,scrollTo:l,scrollToIndex:O,scrollTop:a,smoothScrollTargetReached:d,totalCount:I,useWindowScroll:f,viewportDimensions:T,windowScrollContainerState:m,windowScrollTo:k,windowViewportRect:R,...v,gridState:y,horizontalDirection:le,initialTopMostItemIndex:F,totalListHeight:X,...h,endReached:ye,propsReady:w,rangeChanged:Z,startReached:we,stateChanged:G,stateRestoreInProgress:B,..._}},ke(hr,De,Xt,rs,gt,gr,ht));function hs(e,t,n){return Lt(1,ln((e+n)/(ln(t)+n)))}function Xr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=rr(e,t,n,r[0].index);return{bottom:rr(e,t,n,r[r.length-1].index)+o,top:s}}function rr(e,t,n,r){const o=hs(e.width,n.width,t.column),s=ln(r/o),i=s*n.height+Lt(0,s-1)*t.row;return i>0?i+t.row:i}const dl=me(()=>{const e=H(x=>`Item ${x}`),t=H({}),n=H(null),r=H("virtuoso-grid-item"),o=H("virtuoso-grid-list"),s=H(br),i=H("div"),c=H(Ot),l=(x,h=null)=>Fe(L(t,U(v=>v[x]),Ie()),h),a=H(!1),d=H(!1);return J(se(d),a),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:a,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),fl=me(([e,t])=>({...e,...t}),ke(ul,dl)),pl=p.memo(function(){const e=Re("gridState"),t=Re("listClassName"),n=Re("itemClassName"),r=Re("itemContent"),o=Re("computeItemKey"),s=Re("isSeeking"),i=Ye("scrollHeight"),c=Re("ItemComponent"),l=Re("ListComponent"),a=Re("ScrollSeekPlaceholder"),d=Re("context"),x=Ye("itemDimensions"),h=Ye("gap"),v=Re("log"),S=Re("stateRestoreInProgress"),w=Ye("reportReadyState"),u=wt(p.useMemo(()=>f=>{const m=f.parentElement.parentElement.scrollHeight;i(m);const k=f.firstChild;if(k){const{height:R,width:_}=k.getBoundingClientRect();x({height:R,width:_})}h({column:Yr("column-gap",getComputedStyle(f).columnGap,v),row:Yr("row-gap",getComputedStyle(f).rowGap,v)})},[i,x,h,v]),!0,!1);return cs(()=>{e.itemHeight>0&&e.itemWidth>0&&w(!0)},[e]),S?null:b.jsx(l,{className:t,ref:u,...Ne(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(f=>{const m=o(f.index,f.data,d);return s?b.jsx(a,{...Ne(a,d),height:e.itemHeight,index:f.index,width:e.itemWidth},m):p.createElement(c,{...Ne(c,d),className:n,"data-index":f.index,key:m},r(f.index,f.data,d))})})}),hl=p.memo(function(){const e=Re("HeaderComponent"),t=Ye("headerHeight"),n=Re("headerFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Re("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null}),gl=p.memo(function(){const e=Re("FooterComponent"),t=Ye("footerHeight"),n=Re("headerFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Re("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null}),ml=({children:e})=>{const t=p.useContext(as),n=Ye("itemDimensions"),r=Ye("viewportDimensions"),o=wt(p.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return p.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),b.jsx("div",{ref:o,style:xn(!1),children:e})},bl=({children:e})=>{const t=p.useContext(as),n=Ye("windowViewportRect"),r=Ye("itemDimensions"),o=Re("customScrollParent"),s=No(n,o,!1);return p.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),b.jsx("div",{ref:s,style:xn(!1),children:e})},xl=p.memo(function({...e}){const t=Re("useWindowScroll"),n=Re("customScrollParent"),r=n||t?Sl:vl,o=n||t?bl:ml,s=Re("context");return b.jsx(r,{...e,...Ne(r,s),children:b.jsxs(o,{children:[b.jsx(hl,{}),b.jsx(pl,{}),b.jsx(gl,{})]})})}),{useEmitter:gs,useEmitterValue:Re,usePublisher:Ye}=is(fl,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},xl),vl=fs({useEmitter:gs,useEmitterValue:Re,usePublisher:Ye}),Sl=ps({useEmitter:gs,useEmitterValue:Re,usePublisher:Ye});function Yr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}const vn=p.createContext(void 0);function Ce(e,t){const n=p.useContext(vn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return pn(n,e,t)}function an(){const e=p.useContext(vn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const yl="_run_zzb61_3",wl="_runWrap_zzb61_7",Cl="_highlight_zzb61_13",Il="_highlightleft_zzb61_14",kl="_highlightright_zzb61_15",Tl="_highlightcenter_zzb61_16",Rl="_underline_zzb61_48",_l="_underlineleft_zzb61_49",Ml="_underlineright_zzb61_50",El="_underlinecenter_zzb61_51",st={run:yl,runWrap:wl,highlight:Cl,highlightleft:Il,highlightright:kl,highlightcenter:Tl,underline:Rl,underlineleft:_l,underlineright:Ml,underlinecenter:El},Qr=e=>Symbol.iterator in e,Zr=e=>"entries"in e,Jr=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},jl=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let o=n.next(),s=r.next();for(;!o.done&&!s.done;){if(!Object.is(o.value,s.value))return!1;o=n.next(),s=r.next()}return!!o.done&&!!s.done};function Ol(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Qr(e)&&Qr(t)?Zr(e)&&Zr(t)?Jr(e,t):jl(e,t):Jr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Vt(e){const t=p.useRef(void 0);return n=>{const r=e(n);return Ol(t.current,r)?t.current:t.current=r}}function Pl(e){const t=e.replace("#",""),n=parseInt(t.length===3?t.repeat(2):t,16),r=n>>16&255,o=n>>8&255,s=n&255;return{r,g:o,b:s}}function Bl(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const zl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),ms=p.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=Ce(O=>O.setClipIndex),i=Ce(O=>O.seek),c=q(O=>O.setCurrentGlobalRunIndex),l=an(),a=q(O=>O.rangeStartGI),d=q(O=>O.rangeEndGI),x=q(O=>O.setRange),h=a!=null&&d!=null,v=p.useCallback(O=>{var F;const z=(F=O.target)==null?void 0:F.closest("[data-g]");if(!z)return;const C=Number(z.dataset.g),M=C-r;if(M<0||M>=t.length)return;const P=t[M],G=P.text??"";if(!G.trim()||!/[가-힣a-zA-Z0-9]/.test(G))return;c(C,"program");const E=P.audioChunkIndex,B=P.audioTimeMs;E!=null&&B!=null&&(s(E),i(B))},[t,r,i,s,c]),S=p.useRef(null),w=p.useRef(!1),u=p.useRef({x:0,y:0}),f=p.useCallback(O=>{var P;const z=(P=O.target)==null?void 0:P.closest("[data-g]");if(!z)return;const C=Number(z.dataset.g),M=C-r;M<0||M>=t.length||(w.current=!1,u.current={x:O.clientX,y:O.clientY},S.current&&(window.clearTimeout(S.current),S.current=null),S.current=window.setTimeout(()=>{l.getState().status!=="playing"&&(x(C,C),w.current=!0,S.current=null)},800))},[t,r,x,l]),m=p.useCallback(()=>{S.current&&(window.clearTimeout(S.current),S.current=null)},[]),k=p.useCallback(O=>{if(!S.current)return;const z=O.clientX-u.current.x,C=O.clientY-u.current.y;(Math.abs(z)>5||Math.abs(C)>5)&&m()},[m]),R=p.useCallback(()=>{m()},[m]),_=m,I=m,g=q(O=>O.clearRange),y=p.useCallback(O=>{var M;if(w.current){w.current=!1;return}const z=(M=O.target)==null?void 0:M.closest("[data-g]");if(!z)return;const C=Number(z.dataset.g);isNaN(C)||h&&a!=null&&d!=null&&(g(),O.stopPropagation())},[h,a,d,g]),T=o,j=r+t.length-1;return b.jsx("span",{onClick:y,onDoubleClick:v,onPointerDown:f,onPointerMove:k,onPointerUp:R,onPointerCancel:_,onPointerLeave:I,children:T.map((O,z)=>b.jsx(Ll,{ns:n,group:O,runs:t,paraLastG:j,rangeStartGI:a,rangeEndGI:d},`${n}/grp:${z}-${O.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Al=p.memo(function(){const t=p.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=Y(Vt(t));return n.showSplit?b.jsxs(b.Fragment,{children:[b.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}}),n.slash&&b.jsx("span",{children:" / "}),b.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}})]}):null}),Ll=p.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const c=p.useCallback(u=>{const f=u.currentGlobalRunIndex;return f!=null&&f>=n.startG&&f<=n.endG},[n]),l=q(Vt(c)),a=p.useCallback(u=>l?{showPointer:u.showPointer,pointerStyle:u.pointerStyle,pointerColor:u.pointerColor}:zl,[l]),d=Y(Vt(a)),x=n.r0??0,h=n.len??Math.max(0,n.endG-n.startG+1),v=l&&d.showPointer&&d.pointerStyle!=="underline",S=l&&d.showPointer&&d.pointerStyle==="underline",w=v||S?{"--hl-color":d.pointerColor,"--ul-color":d.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return b.jsx(b.Fragment,{children:Array.from({length:h}).map((u,f)=>{const k=r[x+f],R=n.startG+f,_=`${t}/run:${R}`,I=!!k.split&&R!==o;let g=`${st.runWrap}`;return v&&(h===1?g+=` ${st.highlight}`:f===0?g+=` ${st.highlightleft}`:f+1===h?g+=` ${st.highlightright}`:g+=` ${st.highlightcenter}`),S&&(h===1?g+=` ${st.underline}`:f===0?g+=` ${st.underlineleft}`:f+1===h?g+=` ${st.underlineright}`:g+=` ${st.underlinecenter}`),b.jsxs(p.Fragment,{children:[b.jsx("span",{className:g,style:w,children:b.jsx(Gl,{gi:n.startG,g:R,run:k,active:l,pointerCfg:d,isInRange:s!=null&&i!=null&&R>=s&&R<=i})}),I&&b.jsx(Al,{})]},_)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Gl=p.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const c=p.useMemo(()=>{const l={whiteSpace:"pre-wrap"};if(r.bold&&(l.fontWeight=700),r.italic&&(l.fontStyle="italic"),r.underline&&(l.textDecoration="underline"),o&&s.showPointer){const a=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=a;const d=a.startsWith("#")?Pl(a):Bl(a);d&&(.299*d.r+.587*d.g+.114*d.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return b.jsx("span",{className:st.run,style:c,"data-g":n,"data-gi":t,"data-test":(r==null?void 0:r.audioChunkIndex)||-1,children:r.text||""})},(e,t)=>e.g===t.g&&e.run===t.run&&e.active===t.active&&e.pointerCfg===t.pointerCfg&&e.isInRange===t.isInRange);function Hl({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var a;const i=e.list?e.list.level*24:0,c=((a=e.list)==null?void 0:a.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??c;return b.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:i,textAlign:e.textAlign,boxSizing:"border-box"},children:[e.list?b.jsx("span",{style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:l||""}):null,b.jsx(ms,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Nl=p.memo(Hl,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Fl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return to(e,!1);case"upperalpha":case"upperlatin":return to(e,!0);case"lowerroman":return eo(e,!1);case"upperroman":return eo(e,!0);case"decimalenclosedcircle":return Dl(e);default:return String(e)}}function Dl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function eo(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function to(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function vr(e){const t=new Map;return{next(n,r){const o=`${n}-${r}`,s=(t.get(o)??0)+1;return t.set(o,s),s},reset(){t.clear()}}}function Sr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Fl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Wl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function $l(e){const t=new Array(e.length+1).fill(0);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function Vl(e,t){const n=[];if(!e.length)return n;const r=(o,s,i)=>{n.push({splitIndex:i??o,runs:e.slice(o,s+1),startG:t+o,endG:t+s})};for(let o=0;o<e.length;o++){const s=e[o].splitIndex;if(s===void 0){r(o,o,void 0);continue}let i=o+1;for(;i<e.length&&e[i].splitIndex===s;)i++;r(o,i-1,s),o=i-1}return n}const ql="_scroller_kqkmq_3",Ul={scroller:ql},Kl=p.forwardRef(function({className:t,style:n,...r},o){return b.jsx("div",{ref:o,className:`${Ul.scroller}${t?" "+t:""}`,style:n,...r})}),or=e=>/[가-힣a-zA-Z0-9]/.test(e),Xl=e=>((e==null?void 0:e.textContent)??"").trim(),cn=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Yl(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,c=1/0,l=1/0,a=-1,d=1/0,x=1/0;const h=e.querySelectorAll("[data-g]");for(let v=0;v<h.length;v++){const S=h[v];if(!S||!S.isConnected)continue;const w=Xl(S);if(!w||!or(w))continue;const u=S.getBoundingClientRect();if(u.height<=r||u.width<=r||u.bottom<=o.top||u.top>=o.bottom)continue;if(u.top<s){const k=Math.abs(u.top-s);(k<d||k===d&&(u.top<x||a!==-1&&Number(S.dataset.g)<a))&&(d=k,a=Number(S.dataset.g),x=u.top);continue}const f=Number(S.dataset.g);if(Number.isNaN(f))continue;u.top<l-n?(l=u.top,c=u.top,i=f):u.top<=l+n&&(u.top<c||u.top===c&&(i===-1||f<i))&&(c=u.top,i=f);const m=Math.abs(u.top-s);(m<d||m===d&&(u.top<x||a!==-1&&f<a))&&(d=m,a=f,x=u.top)}return i!==-1?i:a}const bs=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=cn(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=cn(e,t)}return s},no=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const c of o){const l=c.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const a=Number(c.dataset.g);Number.isNaN(a)||(a<s&&(s=a),a>i&&(i=a))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},Ql=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=cn(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),c=s.height*n,l=i.top-(s.top+c);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function Zl(e,t=120){return new Promise(n=>{let r=null;const o=()=>{r!=null&&window.clearTimeout(r),r=window.setTimeout(()=>{e.removeEventListener("scroll",o,{capture:!0}),n()},t)};e.addEventListener("scroll",o,{passive:!0,capture:!0}),o()})}const Pn=async(e,t,{topPaddingRatio:n=.15,behavior:r="smooth",quietMs:o=120}={})=>{if(!Ql(e,t,{topPaddingRatio:n,behavior:r}))return!1;await Zl(e,o);const i=cn(e,t);if(!i)return!1;const c=e.getBoundingClientRect(),l=i.getBoundingClientRect(),a=c.height*n,d=c.top+a,x=l.top-d;return Math.abs(x)<=1},dt=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),yr=p.createContext(null);function xs(){const e=p.useContext(yr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function et(e,t){const n=p.useContext(yr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return pn(n,e,t)}const vs=()=>{const e=q(r=>r.section),t=xs(),n=e.quizzes;return!n||!n.length?null:b.jsxs("button",{onClick:()=>{t.getState().openFromSection(e)},style:{width:300,background:"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:"pointer",boxShadow:"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease"},children:["퀴즈 풀기 (",n.length,")"]})},Jl="_navBtn_1fciy_2",ea="_disabled_1fciy_26",ta="_label_1fciy_32",Et={navBtn:Jl,disabled:ea,label:ta};var Ss={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ro=p.createContext&&p.createContext(Ss),na=["attr","size","title"];function ra(e,t){if(e==null)return{};var n=oa(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oa(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function un(){return un=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},un.apply(this,arguments)}function oo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oo(Object(n),!0).forEach(function(r){sa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sa(e,t,n){return t=ia(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ia(e){var t=la(e,"string");return typeof t=="symbol"?t:t+""}function la(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ys(e){return e&&e.map((t,n)=>p.createElement(t.tag,dn({key:n},t.attr),ys(t.child)))}function Qe(e){return t=>p.createElement(aa,un({attr:dn({},e.attr)},t),ys(e.child))}function aa(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=ra(e,na),c=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),p.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:dn(dn({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),s&&p.createElement("title",null,s),e.children)};return ro!==void 0?p.createElement(ro.Consumer,null,n=>t(n)):t(Ss)}function so(e){return Qe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function io(e){return Qe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const ca=({isIcon:e=!0})=>{const t=q(i=>i.isCanPrev),n=q(i=>i.onSectionNav),r=!t,o=p.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?b.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[b.jsx(so,{size:18}),b.jsx("span",{className:Et.label,children:"이전"})]}):b.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":b.jsxs(b.Fragment,{children:[b.jsx(so,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},fn=({isIcon:e=!0})=>{const t=q(i=>i.isCanNext),n=q(i=>i.onSectionNav),r=!t,o=p.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?b.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[b.jsx(io,{size:18}),b.jsx("span",{className:Et.label,children:"다음"})]}):b.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":b.jsxs(b.Fragment,{children:["NextSection",b.jsx(io,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ws(e,t){let n=0,r=e.length-1;for(;n<r;){const o=Math.floor((n+r+1)/2);e[o]<=t?n=o:r=o-1}return n}function ua({section:e,blocks:t,nsPrefix:n}){const r=p.useMemo(()=>{const T=[],j=vr();return t.forEach((O,z)=>{O.type==="paragraph"&&(T[z]=Sr(O,j))}),T},[t]),o=q(T=>{var j;return((j=T.layout)==null?void 0:j.prefix)??[]}),s=q(T=>{var j;return((j=T.derivedNav)==null?void 0:j.splitGroupsPerBlock)??[]}),i=Y(T=>T.marginX),c=Y(T=>T.viewportHeight),l=p.useRef({start:0,end:0}),a=p.useCallback(T=>{const j=t[T],O=`${n}blk-${j.id}`;if(j.type==="image"){const{src:M,alt:P,width:G,height:E}=j,B=G&&E?`${G} / ${E}`:"4 / 3",F=T>=l.current.start&&T<=l.current.end,$=c>80?Math.floor((c-80)*.6):void 0;return b.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[b.jsx("div",{style:{position:"relative",width:"100%",maxHeight:$,aspectRatio:B},children:b.jsx("img",{src:M,alt:P||"",loading:F?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),P&&b.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:P})]})}const z=r[T]??void 0,C=s[T];return b.jsx("div",{style:{maxWidth:860,display:"flex"},children:b.jsx(Nl,{block:j,computedMarker:z,ns:O,baseIndex:o[T],sectionId:e.section_id,preGroups:C})})},[t,r,o,n,e,s,c]),d=p.useRef(null),x=p.useCallback(T=>{d.current=T},[]),h=p.useMemo(()=>p.memo(T=>{const{style:j,children:O,...z}=T;return b.jsx("div",{...z,style:j,children:b.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:O})})}),[i]),v=p.useRef(null),S=p.useMemo(()=>t.map(T=>T.id),[t]),[w,u]=p.useState(!1);p.useEffect(()=>{u(!1)},[t]);const f=p.useCallback(()=>{u(!0)},[]),m=p.useCallback(()=>{if(!w)return b.jsx("div",{style:{height:40}});const T=e.quizzes,j=Math.max(80,Math.floor(c*.5));return T&&T.length?b.jsxs("div",{style:{display:"block"},children:[b.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:b.jsx(vs,{})}),b.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:b.jsx(fn,{isIcon:!1})}),b.jsx("div",{style:{height:j,width:"100%"}})]}):b.jsxs("div",{children:[b.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:b.jsx(fn,{isIcon:!1})}),b.jsx("div",{style:{height:40}})]})},[w,e,c]),k=p.useMemo(()=>({Item:h,Header:()=>b.jsx("div",{style:{height:40}}),Footer:m,Scroller:Kl}),[m,h]),R=p.useCallback(T=>S[T],[S]),_=xt(),[I]=p.useState(()=>_.getState().progress.currentGlobalRunIndex??0),g=p.useMemo(()=>{if(!o.length)return 0;const T=o[o.length-1],j=Math.max(0,Math.min(I,T));return ws(o,j)},[o,I]);console.log("SectionRenderVirtuoso확인");const y=xt();return p.useEffect(()=>{let T=!1;return(async()=>{let j=d.current;if(!j){for(let M=0;M<20;M++){if(await new Promise(P=>setTimeout(P,50)),T)return;if(j=d.current,j)break}if(!j)return}const O=y.getState().progress.currentGlobalRunIndex,z=y.getState().progress.setSectionLoading,C=O!=null&&O>=0?O:0;await bs(j,C),!T&&(await dt(),await dt(),await dt(),await dt(),!T&&z(!1))})(),()=>{T=!0}},[d,y]),b.jsxs(b.Fragment,{children:[b.jsx(sl,{ref:v,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:R,totalCount:t.length,itemContent:a,initialTopMostItemIndex:g,increaseViewportBy:{top:200,bottom:200},endReached:f,components:k,scrollerRef:x}),b.jsx(da,{scrollContainerRef:d,virtRef:v,prefix:o})]})}const da=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=q(C=>C.setCurrentGlobalRunIndex),o=q(C=>C.registerSectionScrollApi),s=q(C=>C.currentGlobalRunIndex),i=Ce(C=>C.scrollLock),c=Ce(C=>C.syncToGI),l=yt(),a=p.useRef(!1),d=p.useRef(null),x=p.useRef(null),h=p.useRef(null),v=p.useRef(-1),S=p.useCallback(()=>{if(i)return;d.current=null;const C=x.current;if(!C)return;const M=Yl(C,5);M!==-1&&M!==v.current&&(v.current=M,c(M),r(M,"scroll"))},[i,c,r]),w=p.useCallback(C=>{x.current=C,d.current==null&&(d.current=requestAnimationFrame(S))},[S]),u=p.useCallback(C=>{x.current=C,h.current!=null&&(window.clearTimeout(h.current),h.current=null),h.current=window.setTimeout(()=>{h.current=null,S();const M=v.current;if(M===-1)return;const P=C.scrollTop,G=C.scrollHeight-C.clientHeight,E=G>0?P/G:0;let B=0;const F=C.querySelector(`[data-g="${M}"]`);if(F){const $=C.getBoundingClientRect();B=(F.getBoundingClientRect().top-$.top)/$.height}l.getState().emit({type:"scroll",payload:{scrollTop:P,scrollRatio:E,anchorGI:M,anchorOffsetRatio:B}})},100)},[S,l]),f=p.useRef(!1),m=p.useCallback(C=>{i||a.current&&(f.current||(w(C),u(C)))},[i,w,u]),k=p.useRef(void 0),R=p.useRef(void 0),_=p.useRef(void 0),I=p.useRef(void 0);p.useEffect(()=>{const C=e.current;if(C)return k.current=()=>{a.current=!0},R.current=()=>{a.current=!0},_.current=()=>{a.current=!0},I.current=()=>m(C),C.addEventListener("wheel",k.current,{passive:!0}),C.addEventListener("touchmove",R.current,{passive:!0}),window.addEventListener("keydown",_.current,{passive:!0}),C.addEventListener("scroll",I.current,{passive:!0}),()=>{C.removeEventListener("wheel",k.current),C.removeEventListener("touchmove",R.current),window.removeEventListener("keydown",_.current),C.removeEventListener("scroll",I.current),d.current!=null&&cancelAnimationFrame(d.current),h.current!=null&&(clearTimeout(h.current),h.current=null)}},[m,e]),p.useEffect(()=>{const C=e.current;if(!C||!i)return;const M=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},P=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},G=B=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(B.key)&&(B.preventDefault(),B.stopPropagation(),a.current=!1)},E={overscrollBehavior:C.style.overscrollBehavior,touchAction:C.style.touchAction};return C.style.overscrollBehavior="contain",C.style.touchAction="none",C.addEventListener("wheel",M,{passive:!1}),C.addEventListener("touchmove",P,{passive:!1}),window.addEventListener("keydown",G,{passive:!1}),()=>{C.removeEventListener("wheel",M),C.removeEventListener("touchmove",P),window.removeEventListener("keydown",G),C.style.overscrollBehavior=E.overscrollBehavior,C.style.touchAction=E.touchAction}},[i,e]);const g=p.useRef({first:-1,last:-1}),y=p.useRef(!1),T=p.useCallback(()=>{const C=e.current;if(!C)return;const M=no(C),P=(M==null?void 0:M.first)??-1,G=(M==null?void 0:M.last)??-1;g.current={first:P,last:G}},[e]),j=p.useRef(!1),O=p.useCallback(()=>{const C=e.current;if(!C||j.current)return;j.current=!0;const M=Math.min(C.scrollTop+Math.floor(C.clientHeight*.6),C.scrollHeight-C.clientHeight);requestAnimationFrame(()=>{C.scrollTo({top:M,behavior:"instant"})})},[e]);p.useEffect(()=>{!y.current&&i&&(j.current=!1,T()),y.current=i},[i,T]),p.useEffect(()=>{if(i!==!0)return;const C=e.current;if(!C)return;const{first:M,last:P}=g.current;if(M===-1||P===-1){O();return}if(C.scrollTop<=1){(async()=>{try{f.current=!0,await Pn(C,s,{behavior:"smooth",topPaddingRatio:.2})}finally{f.current=!1}T()})();return}if(s<M||s>P){async function E(){if(!C)return;const B=C.scrollTop<=1?0:.2;return await Pn(C,s,{behavior:"smooth",topPaddingRatio:B})}E().then(B=>{B?T():O()})}},[i,s,O,T,e]);const z=p.useCallback(()=>{const C=e.current;if(!C)return;function M(Z,X,A=.2,K=.8){const ee=Z.querySelector(`[data-g="${X}"]`);if(!ee)return!1;const N=Z.getBoundingClientRect(),ne=ee.getBoundingClientRect();if(ne.height<=0||N.height<=0)return!1;const W=(ne.top+ne.height/2-N.top)/N.height;return W>=A&&W<=K}const P=Z=>Z==="instant"?"auto":Z,G=Z=>{const X=C.scrollTop,A=C.scrollHeight-C.clientHeight,K=A>0?X/A:0;let ee=0;const N=C.querySelector(`[data-g="${Z}"]`);if(N){const ne=C.getBoundingClientRect();ee=(N.getBoundingClientRect().top-ne.top)/ne.height}l.getState().emit({type:"scroll",payload:{scrollTop:X,scrollRatio:K,anchorGI:Z,anchorOffsetRatio:ee}})},E=async(Z,X="smooth")=>{var K;const A=ws(n,Z);(K=t.current)==null||K.scrollToIndex({index:A,align:"start",behavior:P(X)}),await bs(C,Z)},B=()=>new Promise(Z=>requestAnimationFrame(()=>Z())),F=async Z=>{if(M(C,Z,.1,.7))return G(Z),!0;f.current=!0;const X=C.querySelector(`[data-g="${Z}"]`),A=C.getBoundingClientRect();let K=C.scrollTop<=1?0:.1;if(X){const N=X.getBoundingClientRect();K=((N.top+N.height/2-A.top)/A.height>.5,.15)}const ee=!!X;return ee?(await Pn(C,Z,{behavior:"smooth",topPaddingRatio:K}),await B()):ee||await E(Z,"auto"),f.current=!1,G(Z),M(C,Z,.1,.7)},$=async Z=>F(Z);return{ensureVisibleGI:F,scrollToGI:$,getVisibleRange:()=>no(C),getScrollTop:()=>C.scrollTop,setScrollTop:Z=>{C.scrollTop=Z},getAnchorOffsetRatio:Z=>{const X=C.querySelector(`[data-g="${Z}"]`);if(!X)return 0;const A=X.getBoundingClientRect(),K=C.getBoundingClientRect();return(A.top-K.top)/K.height},scrollToGIAtOffset:async(Z,X)=>{await $(Z),await new Promise(re=>requestAnimationFrame(()=>requestAnimationFrame(re)));const A=C.querySelector(`[data-g="${Z}"]`);if(!A)return;const K=A.getBoundingClientRect(),ee=C.getBoundingClientRect(),N=ee.height>0?ee.height/C.clientHeight:1,ne=(K.top-ee.top)/N,W=X*C.clientHeight,Q=ne-W;C.scrollTop=C.scrollTop+Q}}},[e,t,n,l]);return p.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(z()),()=>o(void 0)),[z,o]),null};function fa(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function pa(){const e=q(S=>S.section),t=Y(S=>S.theme),n=Y(S=>S.fontFamily),r=Y(S=>S.fontSizePx),o=Y(S=>S.lineHeight),s=on[t],{blocks:i,nsPrefix:c}=p.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=hn(),a=p.useCallback(()=>{const{isSettingsOpen:S,setSettingsOpen:w,toggleOverlays:u}=l.getState();S?w(!1):u()},[l]),{onClick:d,onDoubleClick:x}=Us({onSingle:a,onDouble:()=>{},delay:250,shouldIgnoreTarget:fa}),h=p.useMemo(()=>({flex:1,fontFamily:n,background:s.bg,color:s.fg,fontSize:r,lineHeight:o,overflow:"hidden",WebkitTextSizeAdjust:"none",MozTextSizeAdjust:"none",textSizeAdjust:"none"}),[n,s.bg,s.fg,r,o]),v=p.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),b.jsx("div",{onClick:d,onDoubleClick:x,style:h,children:b.jsx("div",{style:v,children:b.jsx(ua,{section:e,blocks:i,nsPrefix:c})})})}function ha(e){return Qe({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM12.293 7.293a1 1 0 011.414 0L15 8.586l1.293-1.293a1 1 0 111.414 1.414L16.414 10l1.293 1.293a1 1 0 01-1.414 1.414L15 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L13.586 10l-1.293-1.293a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(e)}function ga(e){return Qe({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z",clipRule:"evenodd"},child:[]}]})(e)}function ma(e){return Qe({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(e)}function ba(e){return Qe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3h-3z"},child:[]}]})(e)}function xa(e){return Qe({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z",opacity:".87"},child:[]},{tag:"path",attr:{d:"M17.51 3.87 15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"},child:[]}]})(e)}const va="_wrap_1hfub_4",Sa="_visible_1hfub_25",ya="_compact_1hfub_31",wa="_row2_1hfub_34",Ca="_controls_1hfub_44",Ia="_row1_1hfub_52",ka="_groupExpand_1hfub_80",Ta="_groupPlayback_1hfub_81",Ra="_groupSpeed_1hfub_82",_a="_groupFeatures_1hfub_83",Ma="_groupNav_1hfub_84",Ea="_btn_1hfub_116",ja="_btnForbidden_1hfub_141",Oa="_btnActive_1hfub_147",Pa="_label_1hfub_158",Ba="_compactBtn_1hfub_168",je={wrap:va,visible:Sa,compact:ya,row2:wa,controls:Ca,row1:Ia,groupExpand:ka,groupPlayback:Ta,groupSpeed:Ra,groupFeatures:_a,groupNav:Ma,btn:Ea,btnForbidden:ja,btnActive:Oa,label:Pa,compactBtn:Ba},za=p.memo(function(){const t=p.useRef(null),n=p.useContext(St),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=Ce(y=>y.status),s=Ce(y=>y.currentTimeMs),i=Ce(y=>y.currentClip),c=Ce(y=>y.playbackKind),l=Y(y=>y.muteAudio),a=Y(y=>y.audioSpeed),d=Ce(y=>y.getClipSrc),x=Ce(y=>y._onTime),h=Ce(y=>y._onEnded),v=Ce(y=>y._onError),S=q(y=>y.setCurrentGlobalRunIndex),w=q(y=>y.getSectionScrollApi),u=q(y=>y.snapToReadable),f=q(y=>y.edgeReadable),m=p.useRef(null),k=p.useRef(null),R=p.useRef(!1),_=p.useRef(null);p.useEffect(()=>{c==="real"&&(R.current=!0)},[c]);const I=p.useMemo(()=>{const y=d(i);if(!y)return null;try{return new URL(y,window.location.href).href}catch{return y}},[i,d]);p.useEffect(()=>{R.current=!0},[I]),p.useEffect(()=>{const y=t.current;if(!y)return;const T=()=>{if(y.paused||y.ended)return;const z=y.currentTime*1e3;R.current&&z===0||(z>0&&(R.current=!1),x(z))},j=()=>{var C,M;h();const z=f(1);typeof z=="number"&&z>=0&&(S(z,"audio"),(M=(C=w())==null?void 0:C.ensureVisibleGI)==null||M.call(C,z))},O=z=>{const C=z.currentTarget;console.warn("Audio error",{networkState:C.networkState,readyState:C.readyState}),v()};return y.addEventListener("timeupdate",T),y.addEventListener("ended",j),y.addEventListener("error",O),()=>{y.removeEventListener("timeupdate",T),y.removeEventListener("ended",j),y.removeEventListener("error",O)}},[x,h,v,f,S,w]),p.useEffect(()=>{if(r)return;const y=t.current;if(!y)return;if(!I){try{y.pause()}catch(z){console.log("pause error",z)}k.current=null;return}const T=y.currentSrc||y.src||null,j=!T||T!==I;if(j){try{y.pause()}catch(z){console.log("pause error",z)}y.src=I;try{y.load()}catch(z){console.log("load error",z)}k.current=I}y.muted=!!l,y.volume=1,y.playbackRate=typeof a=="number"?a:1;const O=async()=>{j&&await new Promise(z=>{let C=!1;const M=()=>{C||(C=!0,y.removeEventListener("loadedmetadata",M),y.removeEventListener("canplay",M),z())};y.addEventListener("loadedmetadata",M),y.addEventListener("canplay",M),y.readyState>=1&&M()});try{await y.play()}catch(z){console.warn("el.play() failed",z)}};if(o==="loading"||o==="playing")O();else try{y.pause()}catch(z){console.log("pause error",z)}},[I,l,o,a,r]),p.useEffect(()=>{if(r)return;const y=t.current;if(!y||c!=="real")return;const T=s/1e3;if(Number.isFinite(T)){if(y.readyState<1){m.current=s;const j=()=>{if(m.current!=null){const O=m.current/1e3;try{y.currentTime=O}catch(z){console.log("currentTime보정 오류",z)}m.current=null}y.removeEventListener("loadedmetadata",j),y.removeEventListener("canplay",j)};y.addEventListener("loadedmetadata",j),y.addEventListener("canplay",j);return}if(Math.abs(y.currentTime-T)>.2)try{y.currentTime=T}catch(j){console.log("currentTime보정오류",j)}}},[s,c,r]);const g=Ce(y=>y.getGIFromCT);return p.useEffect(()=>{var j,O;if(r||c!=="real"||o!=="playing"&&o!=="loading")return;const y=g(i,s);if(y<0)return;const T=u(y);T!==_.current&&(_.current=T,S(T,"audio"),T%5===0&&((O=(j=w())==null?void 0:j.ensureVisibleGI)==null||O.call(j,T)))},[o,i,s,c,g,u,S,w,r]),b.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Aa(){return b.jsx(za,{})}const La="_scrubberWrap_uw0cd_2",Ga="_labels_uw0cd_9",Ha="_index_uw0cd_15",Na="_controls_uw0cd_19",Fa="_percent_uw0cd_25",Da="_range_uw0cd_46",kt={scrubberWrap:La,labels:Ga,index:Ha,controls:Na,percent:Fa,range:Da};function Wa(){const e=Y(_=>_.isDev),t=q(_=>_.currentGlobalRunIndex),n=q(_=>_.totalRuns),r=q(_=>_.setCurrentGlobalRunIndex),o=q(_=>_.getSectionScrollApi),s=q(_=>_.giToPercentTotal),i=q(_=>_.percentToGITotal),c=q(_=>_.snapToReadable),l=Ce(_=>_.scrollLock),a=Ce(_=>_.pause),d=Ce(_=>_.play),x=Ce(_=>_.syncToGI),[h,v]=p.useState(()=>s(t||0));p.useEffect(()=>{v(s(t||0))},[t,s]);const S=p.useRef(!1),w=p.useMemo(()=>Math.max(0,Math.min(t??0,Math.max(0,(n??1)-1)))+1,[t,n]),u=p.useCallback(()=>{l&&(a(),S.current=!0)},[l,a]),f=p.useCallback(_=>{v(Number(_.currentTarget.value))},[]),m=p.useCallback(async()=>{const _=i(h),I=c(_);a(),r(I,"scrubber-commit"),x(I);const g=o();g!=null&&g.ensureVisibleGI&&await g.ensureVisibleGI(I),S.current&&(S.current=!1,d())},[h,i,c,a,r,x,o,d]),k=p.useMemo(()=>({"--pct":`${h}%`}),[h]),R=p.useMemo(()=>Math.round(h),[h]);return b.jsxs("div",{className:kt.scrubberWrap,children:[e&&b.jsx("div",{className:kt.labels,children:b.jsxs("span",{className:kt.index,children:[w," / ",n||0]})}),b.jsxs("div",{className:kt.controls,children:[b.jsx("input",{type:"range",className:kt.range,min:0,max:100,step:.5,value:h,style:k,onMouseDown:u,onTouchStart:u,onChange:f,onMouseUp:()=>{m()},onTouchEnd:()=>{m()},onKeyUp:_=>_.key==="Enter"||_.key===" "?void m():void 0,"aria-label":"진행률"}),b.jsxs("span",{className:kt.percent,children:[R,"%"]})]})]})}const $a=p.memo(Wa),Va=p.memo(function(){const t=p.useContext(St),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=Ce(y=>y.playbackKind),o=Ce(y=>y.status),s=Ce(y=>y.fake),i=Y(y=>y.audioSpeed),c=Ce(y=>y.pause),l=q(y=>y.totalRuns),a=q(y=>y.currentGlobalRunIndex),d=q(y=>y.setCurrentGlobalRunIndex),x=q(y=>y.getSectionScrollApi),h=q(y=>y.nextReadableFrom),v=q(y=>y.edgeReadable),S=p.useRef(null),w=p.useRef(null),u=p.useRef(0),f=p.useRef(-1),m=!n&&r==="fake"&&o==="playing",k=Math.max(1,(s==null?void 0:s.totalWords)??1),R=p.useMemo(()=>{const y=200*i;return k/y*6e4},[k,i]),_=p.useMemo(()=>!l||l<=1||R<=0?0:(l-1)/R,[l,R]);p.useEffect(()=>{if(!m)return;const y=Math.max(0,Math.min(a??0,Math.max(0,(l??1)-1)));u.current=y,f.current=y,w.current=null},[m,a,l]);const I=p.useRef(-1);p.useEffect(()=>{if(!l){I.current=-1;return}const y=v(1);I.current=y??-1},[v,l]);const g=p.useCallback(y=>{(async()=>{var G,E;if(!m){S.current=null;return}if(!l||l<=1||_<=0){S.current=null;return}const T=w.current;w.current=y;const j=T==null?0:Math.max(0,y-T),O=l-1;u.current=Math.min(O,u.current+_*j);const z=Math.floor(u.current),C=x(),M=h(z,1);if(M==null){const B=I.current>=0?I.current:z;B!==f.current&&(f.current=B,d(B,"audio"),await((G=C==null?void 0:C.ensureVisibleGI)==null?void 0:G.call(C,B))),c(),S.current=null;return}const P=M;P!==f.current&&(f.current=P,d(P,"audio"),P%5===0&&await((E=C==null?void 0:C.ensureVisibleGI)==null?void 0:E.call(C,P))),S.current=requestAnimationFrame(g)})().catch(console.error)},[m,l,_,h,d,x,c]);return p.useEffect(()=>(m?S.current==null&&(S.current=requestAnimationFrame(g)):(S.current&&(cancelAnimationFrame(S.current),S.current=null),w.current=null),()=>{S.current&&(cancelAnimationFrame(S.current),S.current=null)}),[m,g]),null}),qa=p.memo(function(){return b.jsx(Va,{})}),Ua="data:image/svg+xml,%3csvg%20width='111'%20height='111'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-435%2011)'%3e%3cpath%20d='M532.723%2046.8125C530.242%2046.8292%20527.8%2047.4292%20525.593%2048.5642%20523.298%2049.7713%20520.952%2050.8767%20518.608%2051.8815%20517.451%2031.9953%20500.391%2016.8128%20480.505%2017.9704%20462.359%2019.0268%20447.834%2033.4215%20446.615%2051.5578L438.476%2048.1353%20438.476%2049.9344C438.473%2054.7251%20441.432%2059.0185%20445.91%2060.721%20446.509%2060.9604%20447.138%2061.1708%20447.767%2061.3801%20448.053%2061.4761%20448.339%2061.5709%20448.622%2061.6692L447.745%2066.7254C447.463%2068.2415%20447.818%2069.8071%20448.728%2071.0521%20449.635%2072.2874%20450.984%2073.1242%20452.493%2073.3877L452.768%2073.4282C453.011%2073.488%20453.259%2073.5198%20453.509%2073.523%20456.31%2073.5182%20458.699%2071.4953%20459.166%2068.7338L459.781%2064.8673C468.886%2066.8727%20478.184%2067.875%20487.508%2067.8562%20493.267%2067.8674%20499.021%2067.5125%20504.736%2066.7937%20504.893%2066.7613%20505.041%2066.7405%20505.184%2066.7231L505.562%2068.8379C505.986%2071.6231%20508.396%2073.6706%20511.213%2073.6375%20511.583%2073.648%20511.953%2073.5977%20512.307%2073.4883%20515.422%2072.958%20517.518%2070.0024%20516.988%2066.8869%20516.984%2066.8688%20516.981%2066.8509%20516.978%2066.833L516.758%2065.6767C522.066%2065.3125%20527.42%2065.3125%20532.607%2065.3125L532.723%2065.3125C537.831%2065.6255%20542.226%2061.7378%20542.539%2056.6292%20542.852%2051.5205%20538.965%2047.1255%20533.856%2046.8125%20533.479%2046.7894%20533.1%2046.7894%20532.723%2046.8125ZM516.326%2052.7256C511.914%2054.5082%20507.352%2055.8913%20502.693%2056.858L492.697%2041.007%20501.916%2026.3469C510.579%2032.4029%20515.911%2042.1631%20516.326%2052.7256ZM500.254%2057.3217C497.133%2057.8531%20493.977%2058.1542%20490.811%2058.2224L487.449%2058.2224C480.061%2058.2766%20472.682%2057.6921%20465.394%2056.4753L474.504%2042.1644%20490.692%2042.1644ZM482.602%2020.2188C488.73%2020.2155%20494.742%2021.8953%20499.981%2025.075L490.693%2039.8507%20474.491%2039.8195%20465.194%2025.0415C470.449%2021.8782%20476.468%2020.2107%20482.602%2020.2188ZM463.254%2026.2995%20472.504%2041.0023%20462.938%2056.0267C458.169%2055.1133%20453.47%2053.8672%20448.875%2052.2977%20449.378%2041.8709%20454.689%2032.2672%20463.254%2026.2995ZM456.876%2068.3719C456.595%2070.0115%20455.173%2071.2097%20453.509%2071.2094%20453.431%2071.2042%20453.354%2071.191%20453.278%2071.1701%20453.133%2071.1343%20452.984%2071.1101%20452.835%2071.0972%20451.94%2070.9264%20451.142%2070.4243%20450.601%2069.6912%20450.063%2068.9533%20449.853%2068.0254%20450.023%2067.1278L450.844%2062.3872%20457.525%2064.2962ZM514.123%2069.8103C513.566%2070.5637%20512.74%2071.0728%20511.817%2071.2313L511.657%2071.2718C511.514%2071.32%20511.363%2071.3392%20511.213%2071.3285%20509.525%2071.3698%20508.075%2070.1378%20507.844%2068.4656L507.486%2066.4688%20514.501%2065.8548%20514.701%2067.2527C514.87%2068.1485%20514.661%2069.0742%20514.123%2069.8103ZM532.723%2063%20532.607%2063C526.955%2063%20521.113%2063%20515.284%2063.4625L515.276%2063.4625%20515.276%2063.4625%20505.9%2064.2904%20504.36%2064.5078C498.77%2065.2064%20493.141%2065.5509%20487.508%2065.5391%20477.952%2065.5601%20468.425%2064.4858%20459.114%2062.3375L450.263%2059.8168%20446.738%2058.5658C443.792%2057.4525%20441.62%2054.9086%20440.982%2051.8237%20454.33%2057.5309%20470.023%2060.5383%20486.577%2060.5383%20486.868%2060.5383%20487.161%2060.5383%20487.452%2060.5383L490.828%2060.5383C500.421%2060.2575%20509.874%2058.1665%20518.689%2054.3755L518.797%2054.3304C521.437%2053.2216%20524.086%2051.9728%20526.649%2050.6235%20528.526%2049.6491%20530.608%2049.1354%20532.723%2049.125%20536.554%2048.8199%20539.908%2051.6785%20540.213%2055.5099%20540.518%2059.3414%20537.659%2062.6949%20533.828%2063%20533.46%2063.0293%20533.091%2063.0293%20532.723%2063Z'/%3e%3cpath%20d='M534.442%2053.75C534.442%2055.0272%20533.407%2056.0625%20532.13%2056.0625%20530.852%2056.0625%20529.817%2055.0272%20529.817%2053.75%20529.817%2052.4728%20530.852%2051.4375%20532.13%2051.4375%20533.407%2051.4375%20534.442%2052.4728%20534.442%2053.75Z'/%3e%3c/g%3e%3c/svg%3e",Ka="data:image/svg+xml,%3csvg%20width='159'%20height='159'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-392%20-84)'%3e%3cpath%20d='M496.776%20189.601C496.122%20189.934%20495.77%20190.663%20495.916%20191.383L499.911%20210.219C500.074%20210.985%20500.75%20211.532%20501.533%20211.531L501.929%20211.531C503.729%20211.515%20505.222%20212.919%20505.319%20214.716%20505.389%20216.544%20503.964%20218.083%20502.136%20218.154%20502.093%20218.155%20502.05%20218.156%20502.006%20218.156L497.503%20218.156C495.941%20218.15%20494.594%20217.058%20494.263%20215.531L490.363%20197.147C490.174%20196.252%20489.294%20195.68%20488.4%20195.87%20488.399%20195.87%20488.399%20195.87%20488.399%20195.87%20488.174%20195.918%20487.962%20196.014%20487.776%20196.15L481.184%20200.898C479.925%20201.758%20478.809%20202.45%20477.776%20203.015%20476.998%20203.429%20476.669%20204.372%20477.022%20205.18%20477.402%20206.011%20478.385%20206.378%20479.217%20205.998%20479.253%20205.981%20479.288%20205.964%20479.322%20205.945%20480.618%20205.229%20481.877%20204.447%20483.094%20203.604L487.657%20200.313%20491.031%20216.213C491.677%20219.273%20494.376%20221.464%20497.503%20221.469L501.882%20221.469C505.577%20221.473%20508.587%20218.502%20508.631%20214.807%20508.608%20211.503%20506.158%20208.719%20502.883%20208.277L499.416%20191.93C502.051%20190.581%20506.719%20188.344%20509.619%20188.344%20515.225%20188.346%20520.812%20187.662%20526.252%20186.307%20530.081%20185.36%20533.152%20182.51%20534.381%20178.762L534.535%20178.295C535.676%20175.09%20535.323%20171.542%20533.573%20168.624L525.126%20154.2C522.254%20149.369%20517.625%20145.835%20512.207%20144.337%20512.364%20138.624%20511.516%20132.927%20509.7%20127.508%20504.714%20113.244%20488.452%20105.977%20487.761%20105.669%20487.336%20105.48%20486.851%20105.48%20486.426%20105.669%20485.959%20105.876%20484.987%20106.308%20483.1%20111.962%20482.811%20112.832%20483.281%20113.77%20484.15%20114.059%20485.019%20114.348%20485.958%20113.878%20486.247%20113.009%20486.649%20111.744%20487.129%20110.505%20487.685%20109.299%20491.474%20111.245%20502.818%20117.831%20506.566%20128.543%20508.418%20133.972%20509.183%20139.713%20508.815%20145.437%20508.734%20146.277%20509.297%20147.043%20510.122%20147.217%20515.212%20148.269%20519.626%20151.41%20522.287%20155.875L530.744%20170.299C532.007%20172.379%20532.256%20174.921%20531.42%20177.207L531.254%20177.727C530.378%20180.388%20528.194%20182.41%20525.474%20183.079%20520.288%20184.375%20514.964%20185.031%20509.619%20185.031%20505.93%20185.031%20501.061%20187.35%20496.776%20189.601Z'/%3e%3cpath%20d='M422.439%20192.966C421.946%20190.791%20421.681%20188.571%20421.649%20186.341%20421.7%20185.427%20421.001%20184.643%20420.086%20184.592%20419.171%20184.54%20418.388%20185.239%20418.336%20186.154%20418.324%20187.879%20418.47%20189.602%20418.772%20191.3%20412.577%20189.633%20408.907%20183.26%20410.574%20177.065%20411.942%20171.981%20416.559%20168.453%20421.824%20168.469%20422.661%20168.473%20423.491%20168.611%20424.284%20168.88%20425.056%20169.133%20425.898%20168.787%20426.271%20168.065%20435.26%20150.783%20455.639%20142.806%20473.971%20149.392%20474.837%20150.636%20475.5%20151.557%20475.559%20151.638%20476.094%20152.38%20477.129%20152.549%20477.872%20152.014%20478.614%20151.479%20478.782%20150.444%20478.248%20149.702%20478.216%20149.657%20475.101%20145.338%20473.444%20142.62%20467.845%20132.798%20470.283%20120.115%20471.358%20115.817%20475.617%20117.014%20487.816%20121.194%20493.442%20131.039%20496.082%20135.531%20497.921%20140.449%20498.876%20145.571%20499.017%20146.361%20499.705%20146.936%20500.508%20146.936L503.929%20146.936C504.816%20146.948%20505.561%20146.274%20505.639%20145.391%20505.7%20144.478%20505.01%20143.688%20504.097%20143.627%20504.059%20143.624%20504.021%20143.623%20503.982%20143.623L501.871%20143.623C500.778%20138.613%20498.902%20133.806%20496.312%20129.38%20488.742%20116.13%20471.271%20112.337%20470.533%20112.183%20469.704%20112.01%20468.879%20112.489%20468.618%20113.294%20468.385%20114.011%20463.013%20131.036%20470.568%20144.256%20470.579%20144.276%20470.745%20144.576%20470.978%20144.973%20470.99%20144.991%20470.978%20145.003%20470.96%20144.998%20452.498%20140.481%20433.287%20148.811%20423.966%20165.375%20423.261%20165.231%20422.543%20165.158%20421.824%20165.156%20413.582%20165.183%20406.923%20171.886%20406.95%20180.128%20406.974%20187.414%20412.256%20193.618%20419.446%20194.803L419.446%20194.803C419.532%20195.194%20419.611%20195.585%20419.706%20195.972L419.8%20196.329C422.428%20206.56%20428.796%20215.436%20437.646%20221.204%20437.917%20221.379%20438.232%20221.473%20438.554%20221.474L473.068%20221.474C476.748%20221.495%20479.756%20218.542%20479.801%20214.862%20479.847%20211.242%20476.95%20208.27%20473.329%20208.224%20473.278%20208.223%20473.227%20208.223%20473.176%20208.224L465.158%20208.224C474.765%20201.216%20476.873%20187.747%20469.866%20178.14%20465.812%20172.583%20459.348%20169.297%20452.47%20169.297%20450.573%20169.261%20448.682%20169.507%20446.858%20170.029%20445.981%20170.293%20445.484%20171.219%20445.749%20172.096%20446.013%20172.973%20446.938%20173.47%20447.816%20173.206%20449.328%20172.775%20450.897%20172.574%20452.47%20172.609%20462.532%20172.632%20470.67%20180.807%20470.648%20190.869%20470.63%20198.914%20465.337%20205.995%20457.626%20208.29%20456.784%20208.543%20456.286%20209.408%20456.491%20210.263%20456.686%20211.016%20457.369%20211.54%20458.147%20211.533L473.107%20211.533C474.951%20211.521%20476.458%20213.001%20476.48%20214.845%20476.52%20216.635%20475.102%20218.118%20473.312%20218.158%20473.264%20218.159%20473.216%20218.159%20473.168%20218.158L439.054%20218.158C431.004%20212.776%20425.251%20204.584%20422.922%20195.184%20422.853%20194.889%20422.795%20194.619%20422.733%20194.339Z'/%3e%3cpath%20d='M519.521%20163.831C519.708%20162.011%20518.383%20160.385%20516.563%20160.199%20514.743%20160.012%20513.117%20161.337%20512.931%20163.157%20512.744%20164.977%20514.069%20166.603%20515.889%20166.789%20516.113%20166.812%20516.339%20166.812%20516.563%20166.789%20518.126%20166.629%20519.361%20165.394%20519.521%20163.831Z'/%3e%3c/g%3e%3c/svg%3e",Xa="_WPMSpeedButtonsWrap_r3byt_1",Ya="_btnWrap_r3byt_7",Qa="_label_r3byt_14",Za="_iconBtn_r3byt_22",Bt={WPMSpeedButtonsWrap:Xa,btnWrap:Ya,label:Qa,iconBtn:Za},lo=350,Ja=40,ec=.85,tc=p.memo(function(){const t=Y(h=>h.audioSpeed),n=Y(h=>h.incAudioSpeed),r=Y(h=>h.decAudioSpeed),o=p.useRef(null),s=p.useRef(lo),i=p.useRef(null),c=p.useCallback(h=>{const v=t;if(h==="inc"){if(v>=2)return!1;n()}else{if(v<=.3)return!1;r()}return!0},[t,n,r]),l=p.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),a=p.useCallback(()=>{i.current&&(s.current=Math.max(Ja,Math.floor(s.current*ec)),o.current=window.setTimeout(()=>{c(i.current)?a():l()},s.current))},[c,l]),d=p.useCallback(h=>{if(i.current)return;i.current=h,s.current=lo,c(h)&&a();const S=()=>l();window.addEventListener("mouseup",S,{once:!0}),window.addEventListener("touchend",S,{once:!0})},[a,c,l]);p.useEffect(()=>l,[l]);const x=`${(t*100).toFixed(0)}%`;return b.jsx("div",{onMouseLeave:l,className:Bt.WPMSpeedButtonsWrap,children:b.jsxs("div",{className:Bt.btnWrap,children:[b.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 느리게",onMouseDown:()=>d("dec"),onTouchStart:h=>{h.preventDefault(),d("dec")},onMouseUp:l,children:b.jsx("img",{src:Ua,alt:"느리게"})}),b.jsx("div",{className:Bt.label,style:{minWidth:"44px",textAlign:"center"},children:b.jsx("div",{children:x})}),b.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 빠르게",onMouseDown:()=>d("inc"),onTouchStart:h=>{h.preventDefault(),d("inc")},onMouseUp:l,children:b.jsx("img",{src:Ka,alt:"빠르게"})})]})})}),nc="_StepBtn_15t0r_1",rc={StepBtn:nc};function oc(e){return Qe({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,48V208a8,8,0,0,1-13.66,5.66L128,147.31V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,128,48v60.69l66.34-66.35A8,8,0,0,1,208,48Z"},child:[]}]})(e)}function sc(e){return Qe({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M221.66,133.66l-80,80A8,8,0,0,1,128,208V147.31L61.66,213.66A8,8,0,0,1,48,208V48a8,8,0,0,1,13.66-5.66L128,108.69V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,221.66,133.66Z"},child:[]}]})(e)}function ao({direction:e}){const t=q(x=>x.currentGlobalRunIndex),n=q(x=>x.totalRuns),r=q(x=>x.hasReadableInDir),o=q(x=>x.computeStepTarget),s=q(x=>x.setCurrentGlobalRunIndex),i=Ce(x=>x.syncToGI),c=q(x=>x.getSectionScrollApi),l=p.useCallback(async x=>{var S,w;const h=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),v=o(h,x);s(v,"scrubber-step"),i(v),await((w=(S=c())==null?void 0:S.ensureVisibleGI)==null?void 0:w.call(S,v))},[t,n,o,s,i,c]),a=p.useMemo(()=>{const x=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),h=!n||!r(x,1),v=!n||!r(x,-1);return e==="left"?v:h},[e,n,t,r]),d=p.useCallback(()=>{l(e==="left"?-1:1)},[e,l]);return b.jsx("button",{className:rc.StepBtn,type:"button",onClick:d,disabled:a,title:e==="left"?"이전":"다음",children:e==="left"?b.jsx(oc,{}):b.jsx(sc,{})})}const ic="_GCPlayBtn_n54mc_1",lc="_playing_n54mc_34",co={GCPlayBtn:ic,playing:lc},ac=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>b.jsx("button",{className:`${co.GCPlayBtn} ${r?co.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function cc(e){return Qe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(e)}function uc(e){return Qe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 217.9L383 345c9.4 9.4 24.6 9.4 33.9 0 9.4-9.4 9.3-24.6 0-34L273 167c-9.1-9.1-23.7-9.3-33.1-.7L95 310.9c-4.7 4.7-7 10.9-7 17s2.3 12.3 7 17c9.4 9.4 24.6 9.4 33.9 0l127.1-127z"},child:[]}]})(e)}function dc(){var _;const e=Y(I=>I.showOverlays),t=q(I=>I.section),n=!!t.ast.isAddedSplit,r=!!((_=t.audios)!=null&&_.length),o=Y(I=>I.muteAudio),s=Y(I=>I.showPointer),i=Y(I=>I.showSplit),c=Y(I=>I.toggleMuteAudio),l=Y(I=>I.toggleShowPointer),a=Y(I=>I.toggleShowSplit),d=Y(I=>I.overlayCompactMode),x=Y(I=>I.toggleOverlayCompactMode),h=an(),v=xt();p.useEffect(()=>{const I=h.getState(),{syncToGI:g,useFake:y,useReal:T}=I,j=I.playbackKind,O=v.getState().progress.currentGlobalRunIndex??0;if(!r){j!=="fake"&&y();return}o?j!=="fake"&&(console.log("이부분일까?"),y()):j!=="real"&&(g(O),T())},[r,o,v,h]);const S=Ce(I=>I.play),w=Ce(I=>I.pause),u=Ce(I=>I.status),f=p.useCallback(I=>{I.stopPropagation(),u==="playing"||u==="loading"?w():S()},[u,S,w]),m=an(),k=xt(),R=p.useCallback(async I=>{var F,$;if(I.stopPropagation(),u==="playing"||u==="loading"){w();return}const{progress:g}=k.getState(),{currentGlobalRunIndex:y,snapToReadable:T,edgeReadable:j,setCurrentGlobalRunIndex:O,getSectionScrollApi:z}=g,C=m.getState(),M=C.currentClip,P=z==null?void 0:z(),G=typeof y=="number"?y:0,E=typeof T=="function"?T(G):G,B=typeof j=="function"?j(1):null;if(B!=null&&E>=B){O==null||O(B,"audio"),await((F=P==null?void 0:P.ensureVisibleGI)==null?void 0:F.call(P,B)),C.syncToGI(B);return}O==null||O(E,"audio"),await(($=P==null?void 0:P.ensureVisibleGI)==null?void 0:$.call(P,E)),C.syncToGI(E),S(M)},[u,w,S,m,k]);return b.jsxs("div",{className:`${je.wrap} ${e?je.visible:""} ${d?je.compact:""}`,onClick:I=>{I.stopPropagation()},onTouchStart:I=>{I.stopPropagation()},children:[!d&&b.jsx($a,{}),b.jsx("div",{style:d?{display:"none"}:void 0,children:r&&!o?b.jsx(Aa,{}):b.jsx(qa,{})}),b.jsxs("div",{className:je.controls,children:[b.jsxs("div",{className:je.row1,children:[b.jsx("div",{className:je.groupExpand,children:b.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),x()},className:je.compactBtn,title:d?"오버레이 확대":"오버레이 축소",children:d?b.jsx(uc,{size:24}):b.jsx(cc,{size:24})})}),b.jsxs("div",{className:je.groupPlayback,children:[b.jsx(ao,{direction:"left"}),b.jsx(ac,{size:34,isPlaying:u==="playing",onClick:o?R:f,title:u==="playing"?"일시정지":"재생"}),b.jsx(ao,{direction:"right"})]}),b.jsx("div",{className:je.groupSpeed,children:b.jsx(tc,{})})]}),b.jsxs("div",{className:je.row2,children:[b.jsxs("div",{className:je.groupFeatures,children:[r&&b.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),c()},className:`${je.btn} ${o?"":je.btnActive}`,title:"오디오북 음소거 전환",children:[o?b.jsx(ha,{size:18}):b.jsx(ga,{size:18}),b.jsx("span",{className:je.label,children:"오디오북"})]}),b.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),l()},className:`${je.btn} ${s?je.btnActive:""}`,title:"포인터 표시",children:[b.jsx(ma,{size:18}),b.jsx("span",{className:je.label,children:"포인터"})]}),n&&b.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),a()},disabled:!n,className:`${je.btn} ${i?je.btnActive:""} ${n?"":je.btnForbidden}`,title:"끊어읽기 표시",children:[b.jsx(ba,{size:18}),b.jsx("span",{className:je.label,children:"끊어읽기"})]})]}),b.jsxs("div",{className:je.groupNav,children:[b.jsx(ca,{}),b.jsx(fn,{})]})]})]})]})}const fc=p.memo(dc);function pc(e){return Qe({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z"},child:[]}]})(e)}const hc="_host_v5qx1_3",gc="_topbar_v5qx1_11",mc="_visible_v5qx1_32",bc="_backBtn_v5qx1_37",xc="_title_v5qx1_58",vc="_settingsBtn_v5qx1_67",Tt={host:hc,topbar:gc,visible:mc,backBtn:bc,title:xc,settingsBtn:vc};function Sc(){const e=Y(a=>a.showOverlays),t=Y(a=>a.overlayCompactMode),n=q(a=>a.onViewerClose),o=q(a=>a.section).ast.title,s=Y(a=>a.setSettingsOpen),i=Y(a=>a.setShowOverlays),c=p.useCallback(()=>{n==null||n()},[n]),l=p.useCallback(()=>{s(!0),i(!1)},[s,i]);return b.jsx("div",{className:Tt.host,children:b.jsxs("div",{className:`${Tt.topbar} ${e&&!t?Tt.visible:""}`,children:[b.jsx("button",{type:"button",className:Tt.backBtn,onClick:c,"aria-label":"뒤로가기",children:b.jsx(xa,{size:28})}),b.jsx("div",{className:Tt.title,children:b.jsx("span",{className:"truncate",children:o||"섹션 없음"})}),b.jsx("button",{type:"button",className:Tt.settingsBtn,onClick:l,"aria-label":"뷰어 설정",children:b.jsx(pc,{size:28})})]})})}const yc=p.memo(Sc),wc="_wrap_62su0_7",Cc="_wrapHidden_62su0_29",Ic="_wrapVisible_62su0_35",kc="_scrollArea_62su0_71",Tc="_row_62su0_81",Rc="_label_62su0_89",_c="_btn_62su0_95",Mc="_btnActive_62su0_106",Ec="_btnSmall_62su0_110",jc="_pill_62su0_122",Oc="_themeCircle_62su0_133",Pc="_themeCircleActive_62su0_146",Bc="_stepRow_62su0_151",zc="_stepLabel_62su0_159",Ac="_levelBox_62su0_172",Lc="_inlineFlex_62su0_177",Me={wrap:wc,wrapHidden:Cc,wrapVisible:Ic,scrollArea:kc,row:Tc,label:Rc,btn:_c,btnActive:Mc,btnSmall:Ec,pill:jc,themeCircle:Oc,themeCircleActive:Pc,stepRow:Bc,stepLabel:zc,levelBox:Ac,inlineFlex:Lc};function Gc({visible:e}){const t=Y(g=>g.mode),n=Y(g=>g.setMode),r=Y(g=>g.theme),o=Y(g=>g.setTheme),s=Y(g=>g.fontFamily),i=Y(g=>g.setFontFamily),c=Y(g=>g.resetToDefaults),l=Y(g=>g.getFontLevel()),a=Y(g=>g.getLineLevel()),d=Y(g=>g.getMarginLevel()),x=Y(g=>g.setFontLevel),h=Y(g=>g.setLineLevel),v=Y(g=>g.setMarginLevel),S=Y(g=>g.pointerStyle),w=Y(g=>g.setPointerStyle),u=Y(g=>g.pointerColor),f=Y(g=>g.setPointerColor),m=Y(g=>g.breakMarks),k=Y(g=>g.toggleBreakMark),R=Y(g=>g.getBreakGapLevel()),_=Y(g=>g.setBreakGapLevel),I=`${Me.wrap} ${e?Me.wrapVisible:Me.wrapHidden}`;return b.jsxs("div",{className:I,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[b.jsxs("div",{className:Me.scrollArea,children:[b.jsx(zt,{label:"열람방식",children:b.jsxs("div",{className:Me.inlineFlex,children:[b.jsx(Rt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),b.jsx(Rt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),b.jsx(zt,{label:"테마",children:b.jsx("div",{className:Me.inlineFlex,children:Object.keys(on).map(g=>{const y=g,T=on[y];return b.jsx("button",{type:"button",onClick:()=>o(y),className:`${Me.themeCircle} ${r===g?Me.themeCircleActive:""}`,style:{background:T.bg,color:T.fg,fontFamily:s},title:String(g),"aria-label":`테마: ${String(g)}`,children:"A"},`${g}_tc_button`)})})}),b.jsx(zt,{label:"글꼴",children:b.jsx("div",{className:Me.inlineFlex,children:Ao.map(g=>b.jsx(Rt,{active:s===g.value,onClick:()=>i(g.value),title:g.value,children:g.label},g.label))})}),b.jsx(tn,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>x(Math.max(1,l-1)),onInc:()=>x(Math.min(12,l+1))}),b.jsx(tn,{label:"줄 간격",level:a,min:1,max:7,onDec:()=>h(Math.max(1,a-1)),onInc:()=>h(Math.min(7,a+1))}),b.jsx(tn,{label:"여백",level:d,min:1,max:5,onDec:()=>v(Math.max(1,d-1)),onInc:()=>v(Math.min(5,d+1))}),b.jsx(zt,{label:"포인터",children:b.jsxs("div",{className:Me.inlineFlex,children:[b.jsx(Rt,{active:S==="highlight",onClick:()=>w("highlight"),children:"형광펜"}),b.jsx(Rt,{active:S==="underline",onClick:()=>w("underline"),children:"밑줄"}),b.jsx("input",{type:"color",value:u,onChange:g=>f(g.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),b.jsx(zt,{label:"끊기표시",children:b.jsx("div",{className:Me.inlineFlex,children:b.jsx(Rt,{active:m.slash,onClick:()=>k("slash"),children:"슬래쉬"})})}),b.jsx(tn,{label:"끊기간격",level:R,min:1,max:5,onDec:()=>_(Math.max(1,R-1)),onInc:()=>_(Math.min(5,R+1))})]}),b.jsx("div",{className:Me.inlineFlex,style:{justifyContent:"center"},children:b.jsx("button",{type:"button",onClick:c,className:Me.pill,children:"보기 설정 초기화"})})]})}function zt({label:e,children:t}){return b.jsxs("div",{className:Me.row,children:[b.jsx("label",{className:Me.label,children:e}),t]})}function Rt({active:e,onClick:t,title:n,children:r}){return b.jsx("button",{type:"button",onClick:t,title:n,className:`${Me.btn} ${e?Me.btnActive:""}`,children:r})}function tn({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,c=t>=r;return b.jsxs("div",{className:Me.stepRow,children:[b.jsx("label",{className:Me.stepLabel,children:e}),b.jsxs("div",{className:Me.inlineFlex,children:[b.jsx("button",{type:"button",onClick:o,disabled:i,className:Me.btnSmall,"aria-label":"감소",children:"−"}),b.jsx("div",{className:Me.levelBox,children:t}),b.jsx("button",{type:"button",onClick:s,disabled:c,className:Me.btnSmall,"aria-label":"증가",children:"+"})]})]})}const Hc=p.memo(function(){const t=Y(i=>i.showOverlays),n=Y(i=>i.isSettingsOpen),r=q(i=>i.rangeStartGI),o=q(i=>i.rangeEndGI);return r!=null&&o!=null?null:b.jsxs("div",{"aria-hidden":!0,style:{pointerEvents:"none",position:"absolute",inset:0,containerType:"size",containerName:"viewer"},children:[b.jsx(yc,{}),b.jsx(fc,{}),b.jsx("div",{style:{pointerEvents:"auto"},children:b.jsx(Gc,{visible:!t&&n})})]})}),Nc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,c,l)=>{let a=i;if(c){const d=(l==null?void 0:l.equalityFn)||Object.is;let x=i(r.getState());a=h=>{const v=i(h);if(!d(x,v)){const S=x;c(x=v,S)}},l!=null&&l.fireImmediately&&c(x,x)}return o(a)}),e(t,n,r)},Fc=Nc;function Dc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Wc(e){var o,s,i;if(!e||!/\S/.test(e))return 0;const t=((o=e.match(/[A-Za-z0-9]+(?:['’-][A-Za-z0-9]+)*/g))==null?void 0:o.length)??0,n=((s=e.match(/[\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]+/g))==null?void 0:s.length)??0,r=((i=e.match(/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3040-\u30FF\u31FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F]/g))==null?void 0:i.length)??0;return t+n+Math.floor(r/2)}function $c(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Wc((r==null?void 0:r.text)??"");return t}function Vc(e){const t=e==null?void 0:e.recorderStore;let n=e==null?void 0:e.map,r=e==null?void 0:e.initialIndex;const o=v=>{if(!n)return null;const{g2ct:S}=n;if(!S)return null;const w=S[v];if(w)return{clip:w.clip,t:w.t};for(let u=1;u<=100&&v-u>=0;u++){const f=S[v-u];if(f)return{clip:f.clip,t:f.t}}for(let u=1;u<=100;u++){const f=S[v+u];if(f)return{clip:f.clip,t:f.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,c=0;const l=Math.max(1,$c(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const v=o(e.initialIndex);v&&(i=v.clip,c=v.t,r=void 0)}const a=s.length>0,d=a?"paused":"idle",x=a?"real":"fake",h=a?null:{totalWords:l};return qt(Fc((v,S)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,c),status:d,scrollLock:!1,playbackKind:x,fake:h,useFake:()=>v(w=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:w.status==="playing"})),useReal:()=>v(w=>({playbackKind:"real",fake:{totalWords:l},scrollLock:w.status==="playing"})),injectMap:w=>{if(n=w,typeof r=="number"){const u=o(r);u&&v(f=>({currentClip:Math.max(0,Math.min(u.clip,Math.max(0,f.clips.length-1))),currentTimeMs:Math.max(0,u.t)})),r=void 0}},setClipAndMs:(w,u)=>v(f=>{const m=Math.max(0,f.clips.length-1);return{currentClip:Math.max(0,Math.min(w,m)),currentTimeMs:Math.max(0,u),status:f.status,scrollLock:f.scrollLock}}),setClips:w=>v(u=>{const f=Array.isArray(w)?w:[],m=f.length>0;return{clips:f,currentClip:0,currentTimeMs:0,status:m?"paused":"idle",playbackKind:m?"real":"fake",fake:m?null:u.fake??{totalWords:l},scrollLock:!1}}),clear:()=>v(w=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:w.fake??{totalWords:l},scrollLock:!1})),play:(w,u)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),v(f=>{if(f.playbackKind==="fake")return{status:"playing",scrollLock:!0};const m=typeof w=="number"?w:f.currentClip,k=typeof u=="number"?u:f.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(m,Math.max(0,f.clips.length-1))),currentTimeMs:k,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),v({status:"paused",scrollLock:!1})},seek:w=>v(u=>({currentTimeMs:Math.max(0,w),status:u.status})),stop:()=>v({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>v(w=>{if(w.playbackKind==="fake")return w;const u=Math.max(0,w.clips.length-1);return{currentClip:Math.min(w.currentClip+1,u),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>v(w=>w.playbackKind==="fake"?w:{currentClip:Math.max(0,w.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:w=>v(u=>u.playbackKind==="fake"||w<0||w>=u.clips.length?u:{currentClip:w,currentTimeMs:0}),getClipSrc:w=>{const u=S();if(!u.clips.length)return null;const f=typeof w=="number"?w:u.currentClip;return Dc(u.clips[f])},getGIFromCT:(w,u)=>{if(!n)return-1;const f=n.byClip[w];if(!f||f.length===0)return-1;let m=0,k=f.length-1,R=0;for(;m<=k;){const _=m+k>>1;f[_].t<=u?(R=_,m=_+1):k=_-1}return f[Math.max(0,Math.min(R,f.length-1))].g},getCTFromGI:w=>{if(!n)return null;const{g2ct:u}=n;if(!u)return null;let f=u[w];if(!f){let m=w-1;const k=Math.max(0,w-100);for(;m>=k;){if(u[m]){f=u[m];break}m--}if(!f){let R=w+1;const _=w+100;for(;u[R]==null&&R<=_;)R++;u[R]&&(f=u[R])}}return f?{clip:f.clip,timeMs:f.t}:null},getMetaByGI:w=>{const u=S().getCTFromGI(w);return u?{clipIndex:u.clip,timeMs:u.timeMs}:null},syncToGI:w=>{const u=S().getMetaByGI(w);u&&S().setClipAndMs(u.clipIndex,u.timeMs)},_onTime:w=>v({currentTimeMs:w,status:"playing",scrollLock:!0}),_onEnded:()=>v(w=>{if(w.playbackKind==="fake")return{status:"ended",scrollLock:!1};const u=Math.max(0,w.clips.length-1);return w.currentClip>=u?{status:"ended",scrollLock:!1}:{currentClip:Math.min(w.currentClip+1,u),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>v({status:"error",scrollLock:!1}),_setStatusOnly:w=>v({status:w})})))}function qc({children:e,initialState:t}){const n=p.useContext(St)??void 0,r=p.useMemo(()=>Vc({...t,recorderStore:n}),[t,n]);return b.jsx(vn.Provider,{value:r,children:e})}function Uc(e){var s,i;const t={},n=[],r=((s=e==null?void 0:e.ast)==null?void 0:s.blocks)??[];let o=0;for(const c of r){if((c==null?void 0:c.type)==="image")continue;const l=(c==null?void 0:c.runs)??[];for(let a=0;a<l.length;a++){const d=l[a],x=o+a;d.audioChunkIndex!=null&&d.audioTimeMs!=null&&((t[i=d.audioChunkIndex]||(t[i]=[])).push({t:d.audioTimeMs,g:x}),n[x]={clip:d.audioChunkIndex,t:d.audioTimeMs})}o+=l.length}return Object.values(t).forEach(c=>c.sort((l,a)=>l.t-a.t)),{byClip:t,g2ct:n}}function Kc(e,t,n){if(n<=0)return-1;const r=Math.max(0,Math.min(t,n-1));if(e[r]===1)return r;for(let o=1;o<n;o++){const s=r-o;if(s>=0&&e[s]===1)return s;const i=r+o;return i<n&&e[i]===1?i:-1}return-1}function Xc(e){const t=Wl(e),n=$l(t),r=t.reduce((d,x)=>d+(x||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],c=[];return e.forEach((d,x)=>{var u;if(d.type!=="paragraph")return;const h=n[x]??0,v=d.runs??[];for(let f=0;f<v.length;f++){const m=((u=v[f])==null?void 0:u.text)||"";or(m)&&(s[h+f]=1)}const w=Vl(v,h).map(f=>{var _;const m=f.startG-h,k=f.endG-f.startG+1;let R=-1;for(let I=0;I<k;I++){const g=((_=v[m+I])==null?void 0:_.text)??"";if(or(g)){R=f.startG+I;break}}return{startG:f.startG,endG:f.endG,r0:m,len:k,firstReadableGI:R,splitIndex:f.splitIndex}});c[x]=w;for(const f of w){const m=i.length;for(let k=f.startG;k<=f.endG;k++)o[k]=m;i.push(f)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:c},layout:{prefix:n,totalRuns:r}}}function Yc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:c,initialIndex:l,mountTime:a}=e,d=c.totalRuns??0,x=typeof l=="number"?l:d>0?0:-1,h=x>=0?Kc(i.readableGi,x,d):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:h,lastUpdateBy:"program",totalRuns:d,pageIndex:0,sectionLoading:!0,_loadingStartTime:a,_scrollApi:void 0,derivedNav:i,layout:c,rangeStartGI:null,rangeEndGI:null}}function Qc(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,eventBridgeStore:c}=e,l=t.ast.blocks,{nav:a,layout:d}=Xc(l),x=Date.now(),h=Yc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:a,layout:d,initialIndex:n,mountTime:x});return c&&queueMicrotask(()=>{c.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},x),c.getState().emit({type:"loading_start",payload:{}},x)}),qt((v,S)=>{const w=E=>{v(B=>B.progress._scrollApi===E?B:{progress:{...B.progress,_scrollApi:E}})},u=()=>S().progress._scrollApi,f=E=>{v(B=>{const F=B.progress;if(F.totalRuns===E)return B;const $=F.currentGlobalRunIndex<0&&E>0;return{progress:{...F,totalRuns:E,currentGlobalRunIndex:$?0:F.currentGlobalRunIndex,lastUpdateBy:$?"program":F.lastUpdateBy}}})},m=(E,B="program")=>{const F=S().progress.currentGlobalRunIndex,$=S().progress,V=$.totalRuns>0?Math.max(-1,Math.min(E,$.totalRuns-1)):E;F===V&&$.lastUpdateBy===B||(v(le=>({progress:{...le.progress,currentGlobalRunIndex:V,lastUpdateBy:B}})),F!==V&&c&&c.getState().emit({type:"global_index_change",payload:{globalIndex:V}}))},k=E=>{const{sectionLoading:B,_loadingStartTime:F}=S().progress;if(B===E)return;const $=Date.now();if(E)v(V=>({progress:{...V.progress,sectionLoading:!0,_loadingStartTime:$}})),c&&c.getState().emit({type:"loading_start",payload:{}});else{const le=(F?$-F:0)/1e3;v(ae=>({progress:{...ae.progress,sectionLoading:!1,_loadingStartTime:null}})),c&&c.getState().emit({type:"loading_end",payload:{duration:le}})}},R=E=>{v(B=>({progress:{...B.progress,pageIndex:E}}))},_=(E,B)=>{const $=S().progress.rangeStartGI==null;if(v(V=>({progress:{...V.progress,rangeStartGI:Math.min(E,B),rangeEndGI:Math.max(E,B)}})),c){const V=y();c.getState().emit({type:$?"range_select":"range_change",payload:{startGI:Math.min(E,B),endGI:Math.max(E,B),text:V}})}},I=()=>{v(E=>({progress:{...E.progress,rangeStartGI:null,rangeEndGI:null}})),c&&c.getState().emit({type:"range_clear",payload:{}})},g=E=>{const{rangeStartGI:B,rangeEndGI:F}=S().progress;B==null||F==null||(E<B?v($=>({progress:{...$.progress,rangeStartGI:E}})):E>F?v($=>({progress:{...$.progress,rangeEndGI:E}})):I())},y=()=>{var ye;const{rangeStartGI:E,rangeEndGI:B,section:F,layout:$}=S().progress;if(E==null||B==null||!$)return"";const V=((ye=F.ast)==null?void 0:ye.blocks)??[],le=$.prefix,ae=[];for(let we=0;we<V.length;we++){const Z=V[we];if(Z.type!=="paragraph")continue;const X=Z.runs??[],A=le[we]??0;for(let K=0;K<X.length;K++){const ee=A+K;ee>=E&&ee<=B&&ae.push(X[K].text??"")}}return ae.join("")},T=E=>{const{totalRuns:B,derivedNav:F}=S().progress,$=F==null?void 0:F.readableGi;if(!$||B<=0)return E;const V=B,le=Math.max(0,Math.min(E,V-1));if($[le])return le;let ae=le-1,ye=le+1;for(;ae>=0||ye<V;){if(ye<V&&$[ye])return ye;if(ae>=0&&$[ae])return ae;ye+=1,ae-=1}return le},j=(E,B)=>{const{totalRuns:F,derivedNav:$}=S().progress,V=$==null?void 0:$.readableGi;if(!V||F<=0)return null;if(B>0){for(let le=Math.min(Math.max(E,0),F-1);le<F;le+=1)if(V[le])return le}else for(let le=Math.min(Math.max(E,0),F-1);le>=0;le-=1)if(V[le])return le;return null},O=E=>{const{totalRuns:B,derivedNav:F}=S().progress,$=F==null?void 0:F.readableGi;if(!$||B<=0)return null;if(E>0){for(let V=B-1;V>=0;V-=1)if($[V])return V}else for(let V=0;V<B;V+=1)if($[V])return V;return null};return{progress:{...h,registerSectionScrollApi:w,getSectionScrollApi:u,setTotalRuns:f,setCurrentGlobalRunIndex:m,setSectionLoading:k,setPageIndex:R,setRange:_,clearRange:I,extendRange:g,getRangeText:y,snapToReadable:T,nextReadableFrom:j,edgeReadable:O,hasReadableInDir:(E,B)=>j(E+(B>0?1:-1),B)!=null,computeStepTarget:(E,B)=>{const{totalRuns:F,derivedNav:$}=S().progress;if(!F||F<=0)return E;const V=($==null?void 0:$.groups)??[],le=$==null?void 0:$.giToGroupIdx;if(!V.length||!le){const A=F-1;return T(Math.max(0,Math.min(E+B,A)))}let ae=le[E]??-1;if(ae<0||ae>=V.length)for(let X=0;X<V.length;X+=1){const A=V[X];if(E>=A.startG&&E<=A.endG){ae=X;break}}if(ae<0||ae>=V.length)return O(B)??T(E);const ye=X=>X>=0&&X<V.length&&(V[X].firstReadableGI??-1)>=0;let we=ae+B;for(;we>=0&&we<V.length&&!ye(we);)we+=B;if(we<0||we>=V.length)return O(B)??T(E+B);const Z=V[we].firstReadableGI;return Z>=0?Z:T(E+B)},giToPercentTotal:E=>{const B=S().progress.totalRuns;return!B||B<=1?0:Math.max(0,Math.min(E,B-1))/(B-1)*100},percentToGITotal:E=>{const B=S().progress.totalRuns;if(!B||B<=1)return 0;const F=Math.max(0,Math.min(E,100)),$=Math.round(F/100*(B-1));return Math.max(0,Math.min($,B-1))}}}})}function Zc({children:e,initialState:t}){const n=p.useContext(St),r=p.useMemo(()=>Qc({...t,eventBridgeStore:n}),[t,n]);return b.jsx(ir.Provider,{value:r,children:e})}function Jc({children:e,initialState:t}){const n=p.useContext(St)??void 0,r=p.useRef(Xs({init:t,recorderStore:n}));return b.jsx(sr.Provider,{value:r.current,children:e})}const eu=({pages:e,pageIndex:t,maxWidth:n})=>{const r=q(m=>m.section),o=p.useMemo(()=>{var m;return((m=r.ast)==null?void 0:m.blocks)??[]},[r]),s=Y(m=>m.marginX),i=Y(m=>m.lineHeight),c=Y(m=>m.fontSizePx),l=Y(m=>m.fontFamily),a=Y(m=>m.viewportHeight),d=q(m=>{var k;return((k=m.layout)==null?void 0:k.prefix)??[]}),x=q(m=>{var k;return((k=m.derivedNav)==null?void 0:k.splitGroupsPerBlock)??[]}),h=e[t],v=p.useMemo(()=>{const m=[];return o.forEach((k,R)=>{(k.type==="paragraph"||k.type==="image")&&m.push(R)}),m},[o]),S=p.useMemo(()=>{if(!h)return[];const m=[];for(let k=h.startBlock;k<=h.endBlock;k++){const R=v[k];R!=null&&m.push(R)}return m},[h,v]),w=p.useMemo(()=>{const m=[];for(const k of S){const R=o[k];(R==null?void 0:R.type)==="paragraph"&&m.push({b:R,originalBlockIndex:k})}return m},[S,o]),u=p.useMemo(()=>{const m=[],k=vr();return w.forEach((R,_)=>{m[_]=Sr(R.b,k)}),m},[w]),f=(m,k,R)=>{if(!m||m.length===0)return[];const _=[];for(const I of m){const g=I.startG,y=I.endG;if(y<k||g>R)continue;const T=Math.max(g,k),j=Math.min(y,R),O=T-g|0,z=Math.max(0,j-T+1);if(z<=0)continue;const C=(I.r0??0)+O;_.push({...I,startG:T,endG:j,r0:C,len:z})}return _};return b.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:c,lineHeight:i,boxSizing:"border-box"},children:b.jsxs("div",{style:{width:"100%",maxWidth:n,height:"100%",boxSizing:"border-box",overflow:"hidden",display:"flex",flexDirection:"column",margin:"0 auto"},children:[b.jsx("div",{style:{height:40}}),b.jsx("div",{style:{flex:1,overflow:"hidden"},children:S.map((m,k)=>{var X;const R=o[m],_=k===0,I=k===S.length-1,g={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},y=`sec-${r.section_id}/blk-${R.id??m}`;if(R.type==="image"){const{src:A,alt:K,width:ee,height:N}=R,ne=ee&&N?`${ee} / ${N}`:"4 / 3",W=a>80?Math.floor((a-80)*.6):void 0;return b.jsx("div",{style:g,children:b.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[b.jsx("div",{style:{position:"relative",width:"100%",maxHeight:W,aspectRatio:ne},children:b.jsx("img",{src:A,alt:K||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),K&&b.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:K})]})},y)}const T=R,j=w.findIndex(A=>A.originalBlockIndex===m),O=j>=0?u[j]:void 0,z=T.runs??[],C=z.length;let M=0,P=Math.max(0,C-1);_&&h.startOffsetInBlock!=null&&(M=Math.min(Math.max(0,h.startOffsetInBlock),P)),I&&h.endOffsetInBlock!=null&&(P=Math.max(M,Math.min(h.endOffsetInBlock,P)));const G=M>0,E=d[m]??0,B=x[m]??[],F=E+M,$=E+P;let V=f(B,F,$);const le=E+M;V=V.map(A=>{const K=Math.max(0,(A.startG??F)-le),ee=A.len??Math.max(1,(A.endG??$)-(A.startG??F)+1);return{...A,r0:K,len:ee}});const ae=M<=P?z.slice(M,P+1):[],ye=T.list?T.list.level*24:0,we=((X=T.list)==null?void 0:X.kind)==="bullet"?T.list.glyph??"•":void 0,Z=G?void 0:O??we;return b.jsx("div",{style:g,children:b.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:ye,textAlign:T.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[T.list&&Z?b.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:Z||""}):null,b.jsx(ms,{preGroups:V,runs:ae,ns:y,baseIndex:le,sectionId:String(r.section_id)})]})},y)})})]})})},uo=.5;function tu(e,t){const n=p.useRef(null),r=p.useRef(null),o=p.useRef(!1);p.useEffect(()=>{const s=()=>{n.current==null&&(n.current=requestAnimationFrame(()=>{n.current=null,t(),o.current=!0,requestAnimationFrame(()=>{o.current=!1})}))},i=new ResizeObserver(l=>{if(o.current)return;const a=l[0],{width:d,height:x}=a.contentRect,h=r.current;if(!h){r.current={w:d,h:x};return}Math.abs(h.w-d)<uo&&Math.abs(h.h-x)<uo||(r.current={w:d,h:x},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const c=()=>s();return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function nu(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,shouldIgnoreSwipe:i,horizontalThreshold:c=120,velocityThreshold:l=.6,singleDelayMs:a=250,doubleClickWindowMs:d=300,onDragMove:x,onDragEnd:h,pageTransitionThreshold:v}=e,S=v??c,w=10,u=$e.useRef({touchId:null,startX:0,startY:0,startT:0,swiping:!1,mouseDown:!1,mouseSwiping:!1,mStartX:0,mStartY:0,mStartT:0,capturedEl:null,prevUserSelect:"",lastTapT:0,singleTimer:null,suppressClick:!1}),f=()=>{u.current.singleTimer!=null&&(clearTimeout(u.current.singleTimer),u.current.singleTimer=null)},m=$e.useCallback(M=>{if(s!=null&&s(M))return;const P=performance.now();P-u.current.lastTapT<=d&&u.current.lastTapT>0?(f(),u.current.lastTapT=0,o==null||o()):(f(),r&&(u.current.singleTimer=window.setTimeout(()=>{u.current.singleTimer=null,r()},a)),u.current.lastTapT=P)},[s,d,o,r,a]),k=$e.useCallback((M,P)=>{const G=Math.abs(M)/Math.max(1,P);Math.abs(M)>=S||G>=l?M<0?n():t():h==null||h()},[S,l,n,t,h]),R=$e.useCallback(M=>{if(M.touches.length!==1)return;const P=i??s;if(P!=null&&P(M.target))return;const G=M.touches[0];u.current.touchId=G.identifier,u.current.startX=G.clientX,u.current.startY=G.clientY,u.current.startT=M.timeStamp,u.current.swiping=!1},[i,s]),_=$e.useCallback(M=>{if(u.current.touchId==null)return;const P=Array.from(M.touches).find(F=>F.identifier===u.current.touchId);if(!P)return;const G=P.clientX-u.current.startX,E=Math.abs(G),B=Math.abs(P.clientY-u.current.startY);if(!u.current.swiping)if(E>=w&&E>B)u.current.swiping=!0;else return;x==null||x(G)},[x]),I=$e.useCallback(M=>{if(u.current.touchId==null)return;const P=Array.from(M.changedTouches).find(F=>F.identifier===u.current.touchId);if(!P)return;const G=P.clientX-u.current.startX,E=P.clientY-u.current.startY,B=M.timeStamp-u.current.startT;u.current.swiping?k(G,B):Math.abs(G)<10&&Math.abs(E)<10&&m(M.target),u.current.suppressClick=!0,u.current.touchId=null,u.current.swiping=!1},[k,m]),g=$e.useCallback(()=>{u.current.swiping&&(h==null||h()),u.current.touchId=null,u.current.swiping=!1},[h]),y=$e.useCallback(M=>{if(M.pointerType==="touch"||u.current.mouseDown)return;const P=i??s;P!=null&&P(M.target)||(u.current.mouseDown=!0,u.current.mouseSwiping=!1,u.current.mStartX=M.clientX,u.current.mStartY=M.clientY,u.current.mStartT=M.timeStamp,u.current.suppressClick=!1,u.current.capturedEl=M.currentTarget)},[i,s]),T=$e.useCallback(M=>{if(M.pointerType==="touch"||!u.current.mouseDown)return;const P=M.clientX-u.current.mStartX,G=Math.abs(P),E=Math.abs(M.clientY-u.current.mStartY);if(!u.current.mouseSwiping)if(G>=w&&G>E){u.current.mouseSwiping=!0,u.current.suppressClick=!0;const B=u.current.capturedEl;if(B!=null&&B.setPointerCapture)try{B.setPointerCapture(M.pointerId)}catch{}u.current.prevUserSelect=document.body.style.userSelect,document.body.style.userSelect="none",M.preventDefault()}else return;x==null||x(P),M.preventDefault()},[x]),j=$e.useCallback(M=>{var G;if(M.pointerType==="touch"||!u.current.mouseDown)return;if(u.current.mouseSwiping){const E=M.clientX-u.current.mStartX,B=M.timeStamp-u.current.mStartT;k(E,B),document.body.style.userSelect=u.current.prevUserSelect}const P=u.current.capturedEl;if((G=P==null?void 0:P.hasPointerCapture)!=null&&G.call(P,M.pointerId))try{P.releasePointerCapture(M.pointerId)}catch{}u.current.mouseDown=!1,u.current.mouseSwiping=!1,u.current.capturedEl=null},[k]),O=$e.useCallback(M=>{M.pointerType!=="touch"&&(u.current.mouseSwiping&&(h==null||h(),document.body.style.userSelect=u.current.prevUserSelect),u.current.mouseDown=!1,u.current.mouseSwiping=!1,u.current.capturedEl=null)},[h]),z=$e.useCallback(()=>{u.current.mouseSwiping&&(h==null||h(),document.body.style.userSelect=u.current.prevUserSelect),u.current.mouseDown=!1,u.current.mouseSwiping=!1,u.current.capturedEl=null},[h]),C=$e.useCallback(M=>{if(u.current.suppressClick){u.current.suppressClick=!1;return}m(M.target)},[m]);return $e.useEffect(()=>()=>{f(),document.body.style.userSelect=""},[]),{onTouchStart:R,onTouchMove:_,onTouchEnd:I,onTouchCancel:g,onPointerDown:y,onPointerMove:T,onPointerUp:j,onPointerCancel:O,onLostPointerCapture:z,onClick:C}}var Bn,fo;function Cs(){if(fo)return Bn;fo=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bn=e,Bn}var zn,po;function ru(){if(po)return zn;po=1;var e=typeof Yt=="object"&&Yt&&Yt.Object===Object&&Yt;return zn=e,zn}var An,ho;function Is(){if(ho)return An;ho=1;var e=ru(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return An=n,An}var Ln,go;function ou(){if(go)return Ln;go=1;var e=Is(),t=function(){return e.Date.now()};return Ln=t,Ln}var Gn,mo;function su(){if(mo)return Gn;mo=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Gn=t,Gn}var Hn,bo;function iu(){if(bo)return Hn;bo=1;var e=su(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Hn=n,Hn}var Nn,xo;function ks(){if(xo)return Nn;xo=1;var e=Is(),t=e.Symbol;return Nn=t,Nn}var Fn,vo;function lu(){if(vo)return Fn;vo=1;var e=ks(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var c=n.call(i,o),l=i[o];try{i[o]=void 0;var a=!0}catch{}var d=r.call(i);return a&&(c?i[o]=l:delete i[o]),d}return Fn=s,Fn}var Dn,So;function au(){if(So)return Dn;So=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Dn=n,Dn}var Wn,yo;function cu(){if(yo)return Wn;yo=1;var e=ks(),t=lu(),n=au(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(c){return c==null?c===void 0?o:r:s&&s in Object(c)?t(c):n(c)}return Wn=i,Wn}var $n,wo;function uu(){if(wo)return $n;wo=1;function e(t){return t!=null&&typeof t=="object"}return $n=e,$n}var Vn,Co;function du(){if(Co)return Vn;Co=1;var e=cu(),t=uu(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return Vn=r,Vn}var qn,Io;function fu(){if(Io)return qn;Io=1;var e=iu(),t=Cs(),n=du(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt;function l(a){if(typeof a=="number")return a;if(n(a))return r;if(t(a)){var d=typeof a.valueOf=="function"?a.valueOf():a;a=t(d)?d+"":d}if(typeof a!="string")return a===0?a:+a;a=e(a);var x=s.test(a);return x||i.test(a)?c(a.slice(2),x?2:8):o.test(a)?r:+a}return qn=l,qn}var Un,ko;function pu(){if(ko)return Un;ko=1;var e=Cs(),t=ou(),n=fu(),r="Expected a function",o=Math.max,s=Math.min;function i(c,l,a){var d,x,h,v,S,w,u=0,f=!1,m=!1,k=!0;if(typeof c!="function")throw new TypeError(r);l=n(l)||0,e(a)&&(f=!!a.leading,m="maxWait"in a,h=m?o(n(a.maxWait)||0,l):h,k="trailing"in a?!!a.trailing:k);function R(C){var M=d,P=x;return d=x=void 0,u=C,v=c.apply(P,M),v}function _(C){return u=C,S=setTimeout(y,l),f?R(C):v}function I(C){var M=C-w,P=C-u,G=l-M;return m?s(G,h-P):G}function g(C){var M=C-w,P=C-u;return w===void 0||M>=l||M<0||m&&P>=h}function y(){var C=t();if(g(C))return T(C);S=setTimeout(y,I(C))}function T(C){return S=void 0,k&&d?R(C):(d=x=void 0,v)}function j(){S!==void 0&&clearTimeout(S),u=0,d=w=x=S=void 0}function O(){return S===void 0?v:T(t())}function z(){var C=t(),M=g(C);if(d=arguments,x=this,w=C,M){if(S===void 0)return _(w);if(m)return clearTimeout(S),S=setTimeout(y,l),R(w)}return S===void 0&&(S=setTimeout(y,l)),v}return z.cancel=j,z.flush=O,z}return Un=i,Un}var hu=pu();const gu=Po(hu);function mu(e,t=200,n,r){const o=p.useRef(e),s=p.useRef(n);p.useEffect(()=>{o.current=e},[e]),p.useEffect(()=>{s.current=n},[n]);const i=p.useMemo(()=>{const c=gu((...a)=>{o.current(...a)},t,r),l=((...a)=>{var d;(d=s.current)==null||d.call(s),c(...a)});return l.cancel=c.cancel.bind(c),l.flush=c.flush.bind(c),l},[t,r]);return p.useEffect(()=>()=>i.cancel(),[i]),i}const Ts=new Map,Rs=e=>Ts.get(e)??0,bu=e=>{const t=Rs(e)+1;return Ts.set(e,t),t};class _s extends Error{constructor(){super("calcPages canceled due to a newer invocation");Cr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const tt=(e,t)=>{if(e!==Rs(t))throw new _s},Kn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},To=e=>{const t=e.getClientRects(),n=t.length?t[0].top:e.getBoundingClientRect().top,r=e.querySelectorAll("[data-runbox]"),o=[];return r.forEach((s,i)=>{const c=s.getClientRects(),l=c.length?c[c.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},xu=(e,t,n)=>{if(n<16)return async(o=24)=>{tt(e,t)};let r=0;return async(o=24)=>{r++,r%o===0&&(tt(e,t),await new Promise(s=>requestAnimationFrame(()=>s())),tt(e,t))}};async function vu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:c,lineHeight:l,showSplit:a,breakGapPx:d=0,showSlash:x,paragraphMarkers:h,playbackScale:v=1,viewportHeight:S=0,instanceId:w="default"}){var f,m,k;const u=bu(w);tt(u,w);try{const R=Math.abs(v-1)>.001,_=1/v;R&&(t.style.transform=`scale(${_})`,t.style.transformOrigin="top left");const I=Math.max(0,e.offsetWidth||0),g=Math.max(0,Math.min(I,o));t.style.maxWidth=`${g}px`,tt(u,w);let y=Math.round(n.offsetHeight||0);y||(y=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",v.toFixed(4),R?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",I),console.log("[calcPages] pageBoxWidth:",g),console.log("[calcPages] maxPageHeight:",y),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const T=1.5,j=(N,ne)=>ne+N<=y-T,O=getComputedStyle(e),z={letterSpacing:O.letterSpacing,wordSpacing:O.wordSpacing,fontKerning:O.fontKerning||"normal",fontVariantLigatures:O.fontVariantLigatures||"normal",textTransform:O.textTransform||"none",direction:O.direction||"ltr",wordBreak:O.wordBreak||"keep-all",overflowWrap:O.overflowWrap||O.wordWrap||"break-word",hyphens:O.hyphens||"manual"},C=N=>{N.style.letterSpacing=z.letterSpacing||"",N.style.wordSpacing=z.wordSpacing||"",N.style.fontKerning=z.fontKerning||"",N.style.fontVariantLigatures=z.fontVariantLigatures||"",N.style.textTransform=z.textTransform||"",N.style.direction=z.direction||"",N.style.wordBreak=z.wordBreak||"",N.style.wordWrap=z.overflowWrap||"",N.style.overflowWrap=z.overflowWrap||"",N.style.hyphens=z.hyphens||""},M=g,P=Math.max(0,M-2*(s||0));n.innerHTML="";const G=document.createElement("div");G.style.boxSizing="border-box",G.style.width=`${M}px`,G.style.maxWidth=`${M}px`,G.style.margin="0 auto",G.style.display="flex",n.appendChild(G);const E=document.createElement("div");E.style.boxSizing="border-box",E.style.paddingRight=`${s}px`,E.style.paddingLeft=`${s}px`,E.style.width=`${M}px`,E.style.maxWidth=`${M}px`,E.style.margin="0 auto",E.style.display="flex",E.style.justifyContent="center",E.style.height="auto",G.appendChild(E);const B=new Map,F={},$=xu(u,w,r.length),V=(N,ne)=>{const W=document.createElement("p");return W.style.margin="8px 0",W.style.paddingLeft=ne?`${ne}px`:"0",W.style.textAlign=N.textAlign??"start",W.style.whiteSpace="pre-wrap",W.style.lineHeight=String(l),W.style.fontSize=`${c}px`,W.style.boxSizing="border-box",W.style.fontFamily=i??"",W.style.width="100%",C(W),W},le=(N,ne)=>{const W=ne??[],Q=document.createDocumentFragment();for(let re=0;re<W.length;re++){const te=W[re],ue=document.createElement("span");ue.dataset.runbox=String(re),ue.style.whiteSpace="pre-wrap";const oe=document.createElement("span");if(oe.dataset.run=String(re),oe.textContent=(te==null?void 0:te.text)??"",oe.style.whiteSpace="pre-wrap",te!=null&&te.bold&&(oe.style.fontWeight="700"),te!=null&&te.italic&&(oe.style.fontStyle="italic"),te!=null&&te.underline&&(oe.style.textDecoration="underline"),ue.appendChild(oe),a&&(te!=null&&te.split)&&re!==W.length-1){const be=Math.max(0,(d??0)/2),pe=document.createElement("span");pe.style.display="inline-block",pe.style.width=`${be}px`;const Se=document.createElement("span");if(Se.style.display="inline-block",Se.style.width=`${be}px`,ue.appendChild(pe),x){const Te=document.createElement("span");Te.textContent=" / ",ue.appendChild(Te)}ue.appendChild(Se)}Q.appendChild(ue)}N.appendChild(Q)},ae=S>80?Math.floor((S-80)*.6):void 0,ye=N=>{const ne=N!=null&&N.width&&(N!=null&&N.height)?`${N.width} / ${N.height}`:"4 / 3",W=document.createElement("div");W.style.margin="12px 0",W.style.textAlign="center",W.style.width=`${P}px`;const Q=document.createElement("div");Q.style.position="relative",Q.style.width="100%",ae&&(Q.style.maxHeight=`${ae}px`),Q.style.aspectRatio=ne;const re=document.createElement("div");if(re.style.position="absolute",re.style.inset="0",re.style.width="100%",re.style.height="100%",Q.appendChild(re),W.appendChild(Q),N!=null&&N.alt){const te=document.createElement("div");te.style.fontSize="12px",te.style.color="#6B7280",te.style.marginTop="4px",te.textContent=String(N.alt),C(te),W.appendChild(te)}return W};for(let N=0;N<r.length;N++){tt(u,w);const ne=r[N];if(E.dataset.block=String(N),E.innerHTML="",ne.kind==="image"){const Se=ne.block,Te=ye(Se);E.appendChild(Te);const Be=Te.getBoundingClientRect(),{mt:Ee,mb:Ge}=Kn(Te);F[N]={contentH:Math.ceil(Be.height),mt:Ee,mb:Ge},await $(24);continue}const W=ne.block,Q=W.list?(W.list.level??0)*24:0,re=ne.paraIndex??0,te=h[re]??(((f=W.list)==null?void 0:f.kind)==="bullet"?((m=W.list)==null?void 0:m.glyph)??"•":void 0);if(!!(W.list&&te)){const Se=V(W,Q);Se.dataset.variant="with";const Te=V(W,Q);Te.dataset.variant="no";const Be=document.createElement("span");Be.textContent=`${te} `,Be.style.minWidth="16px",Be.style.display="inline-block",Be.style.whiteSpace="nowrap",Be.style.userSelect="none",Se.appendChild(Be),le(Se,W.runs),le(Te,W.runs);const Ee=document.createDocumentFragment();Ee.appendChild(Se),Ee.appendChild(Te),E.appendChild(Ee)}else{const Se=V(W,Q);Se.dataset.variant="with",le(Se,W.runs),E.appendChild(Se)}const oe=E.querySelector('p[data-variant="with"]'),be=E.querySelector('p[data-variant="no"]'),pe=be??oe;if(oe&&pe){const Se=To(oe),Te=To(pe),{mt:Be,mb:Ee}=Kn(oe),{mt:Ge,mb:ot}=Kn(pe),We=((k=W.runs)==null?void 0:k.length)??0,Oe=be?Te:Se,Ze=be?Ge:Be,Ke=be?ot:Ee;if(N<3){const ut=oe.getBoundingClientRect().height;console.log(`[calcPages] para ${N}: height=${ut.toFixed(2)}, lastBottom=[${Se.slice(-3).map(Pt=>Pt.toFixed(1)).join(",")}], runs=${We}`)}B.set(N,{runsLen:We,lastBottomWith:Se,lastBottomNo:Oe,mtWith:Be,mbWith:Ee,mtNo:Ze,mbNo:Ke})}await $(24)}tt(u,w),E.innerHTML="";const we=(N,ne,W,Q)=>{if(ne>W)return{top:0,content:0,mb:0};const re=Q?N.lastBottomNo:N.lastBottomWith,te=Q?N.mtNo:N.mtWith,ue=Q?N.mbNo:N.mbWith,oe=Q?0:te,be=ne>0?re[ne-1]??0:0,pe=Math.max(0,(re[W]??0)-be);return{top:oe,content:pe,mb:ue}},Z=[];let X=0,A,K=null,ee=null;for(;X<r.length;){tt(u,w);const N=X;let ne=0,W=0,Q=A;Q!=null&&K===X&&ee!=null&&(Q=Math.max(Q,ee+1));let re=-1,te;for(;X<r.length;){if(tt(u,w),r[X].kind==="image"){const Oe=F[X]??{contentH:0,mt:0,mb:0},Ke=(ne===0?Oe.mt:W+Oe.mt)+Oe.contentH;if(j(Ke,ne)){ne+=Ke,re=X,te=void 0,W=Oe.mb,X+=1,A=void 0,K=null,ee=null;continue}if(ne===0){Z.push({startBlock:N,endBlock:X,...Q!=null?{startOffsetInBlock:Q}:{}}),X+=1,A=void 0,K=null,ee=null,W=0;break}break}const oe=B.get(X),be=oe.runsLen,pe=X===N&&Q!=null?Q:0;if(pe>=be){X+=1,A=void 0,K=null,ee=null;continue}const Se=pe>0,Te=we(oe,pe,be-1,Se),Ee=(ne===0?Te.top:W+Te.top)+Te.content;if(j(Ee,ne)){ne+=Ee,re=X,te=be-1,W=Te.mb,X+=1,A=void 0,K=null,ee=null;continue}let Ge=pe,ot=be-1,We=pe-1;for(;Ge<=ot;){tt(u,w);const Oe=Ge+ot>>1,Ze=we(oe,pe,Oe,Se),Ke=(ne===0?Ze.top:W+Ze.top)+Ze.content;j(Ke,ne)?(We=Oe,Ge=Oe+1):ot=Oe-1}if(We>=pe){Z.push({startBlock:N,endBlock:X,...Q!=null?{startOffsetInBlock:Q}:{},endOffsetInBlock:We}),A=We+1,K=X,ee=We,W=0;break}if(ne>0){Z.push({startBlock:N,endBlock:re>=0?re:Math.min(X-1,r.length-1),...Q!=null?{startOffsetInBlock:Q}:{},...te!=null?{endOffsetInBlock:te}:{}}),W=0;break}else{const Oe=pe;Z.push({startBlock:N,endBlock:X,...Q!=null?{startOffsetInBlock:Q}:{},endOffsetInBlock:Oe}),A=Oe+1,K=X,ee=Oe,W=0;break}}(Z.length===0||Z[Z.length-1].startBlock!==N)&&Z.push({startBlock:N,endBlock:re>=0?re:Math.min(X-1,r.length-1),...Q!=null?{startOffsetInBlock:Q}:{},...te!=null?{endOffsetInBlock:te}:{}})}return G.remove(),R&&(t.style.transform="",t.style.transformOrigin=""),tt(u,w),{pages:Z,pageByRunIndex:null}}catch(R){throw console.error(R),R}}function Ro(e,t,n){var r;if(!e)return null;for(let o=e.startBlock;o<=e.endBlock;o++){const s=t[o];if(!s||s.kind!=="paragraph")continue;const i=((r=s.block.runs)==null?void 0:r.length)??0;if(!i)continue;const c=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+c}return null}function Su(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let c=i.startBlock;c<=i.endBlock;c++){const l=n[c];if(!l||l.kind!=="paragraph")continue;const a=((o=l.block.runs)==null?void 0:o.length)??0;if(!a)continue;let d=0,x=a-1;c===i.startBlock&&i.startOffsetInBlock!=null&&(d=Math.max(0,Math.min(i.startOffsetInBlock,x))),c===i.endBlock&&i.endOffsetInBlock!=null&&(x=Math.max(d,Math.min(i.endOffsetInBlock,x)));const h=r[l.originalIndex]??0,v=h+d,S=h+x;if(e>=v&&e<=S)return s}}return-1}function yu(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function wu(e){var n,r;const t=e;return t?((n=t.style)==null?void 0:n.cursor)==="grab"||((r=t.closest)==null?void 0:r.call(t,"[data-range-handle]"))!=null:!1}function Cu(e){const t=[],n=[];let r=0;return e.forEach((o,s)=>{o.type==="paragraph"?(t.push({kind:"paragraph",block:o,originalIndex:s,paraIndex:r}),n.push(s),r+=1):o.type==="image"&&t.push({kind:"image",block:o,originalIndex:s})}),{items:t,paraIndexMap:n}}function Iu(){var wr;const e=p.useId(),t=q(D=>D.section),n=q(D=>D.sectionLoading),r=q(D=>D.rangeStartGI),o=q(D=>D.rangeEndGI),s=r!=null&&o!=null,i=yt(),c=Y(D=>D.theme),l=on[c],a=Y(D=>D.fontFamily),d=Y(D=>D.fontSizePx),x=Y(D=>D.lineHeight),h=Y(D=>D.marginX),v=Y(D=>D.viewportHeight),S=860,w=p.useRef(null),{items:u}=p.useMemo(()=>{var D;return Cu(((D=t==null?void 0:t.ast)==null?void 0:D.blocks)??[])},[t]),f=p.useMemo(()=>{const D=[],Pe=vr();return u.forEach(Ae=>{if(Ae.kind==="paragraph"){const mt=Ae.paraIndex;D[mt]=Sr(Ae.block,Pe)}}),D},[u]),[m,k]=p.useState({pages:[],pageByRunIndex:null}),R=q(D=>D.pageIndex),_=q(D=>D.setPageIndex),I=p.useRef(0),g=p.useRef(null),[y,T]=p.useState(!1),[j,O]=p.useState(null),[z,C]=p.useState(!1),M=p.useMemo(()=>({flex:1,fontFamily:a,background:l.bg,color:l.fg,fontSize:d,lineHeight:x,overflow:"hidden",width:"100%",height:"100%",position:"relative",boxSizing:"border-box",WebkitTextSizeAdjust:"none",MozTextSizeAdjust:"none",textSizeAdjust:"none"}),[a,l.bg,l.fg,d,x]),{showSplit:P,breakGapPx:G,slash:E}=Y(Vt(D=>{var Pe;return{showSplit:D.showSplit,breakGapPx:D.breakGapPx??0,slash:((Pe=D.breakMarks)==null?void 0:Pe.slash)??!1}})),B=xt();p.useEffect(()=>{m&&m.pages.length&&(console.log("그래서 총 페이지",m.pages.length),(async()=>{const D=B.getState().progress.setSectionLoading;await dt(),await dt(),await dt(),await dt(),console.log("recalc종료"),D(!1)})())},[m,B]);const F=p.useCallback(()=>{console.log("@@@@@@recalc호출");const D=w.current,Pe=oe.current,Ae=be.current;if(console.log("showSplit",P),!D||!Pe||!Ae||u.length===0){k({pages:[],pageByRunIndex:null}),_(0);return}(async()=>{const mt=performance.now();try{const Je=i.getState().playbackScale,{pages:It,pageByRunIndex:Es}=await vu({viewHost:D,measureRoot:Pe,contentArea:Ae,items:u,cfgMaxWidth:S,marginX:h,fontFamily:a,fontSizePx:d,lineHeight:x,showSplit:P,breakGapPx:G,showSlash:E,paragraphMarkers:f,playbackScale:Je,viewportHeight:v,instanceId:e}),js=performance.now();console.log(`✅ calcPages 완료: ${(js-mt).toFixed(1)} ms (${It.length} pages)`),k({pages:It,pageByRunIndex:Es}),_(0)}catch(Je){if(Je instanceof _s){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",Je)}})()},[_,u,S,h,a,d,x,P,G,E,f,i,v,e]),$=q(D=>D.setCurrentGlobalRunIndex),V=q(D=>{var Pe;return((Pe=D.layout)==null?void 0:Pe.prefix)??[]}),le=Ce(D=>D.syncToGI),ae=p.useCallback(D=>{const Pe=m.pages.length+1,Ae=R+D;if(Ae<0||Ae>=Pe)return;const mt=R===m.pages.length;if(Ae===m.pages.length){_(Ae);return}if(mt&&D===-1){const It=Ro(m.pages[Ae],u,V);It!=null&&($(It,"scrubber-step"),le(It)),_(Ae);return}const Je=Ro(m.pages[Ae],u,V);Je!=null?($(Je,"scrubber-step"),le(Je)):_(Ae)},[R,m.pages,u,V,$,_,le]),ye=p.useCallback(()=>{y||I.current!==0?(O("prev"),T(!1)):ae(-1)},[y,ae]),we=p.useCallback(()=>{y||I.current!==0?(O("next"),T(!1)):ae(1)},[y,ae]),Z=hn(),X=p.useCallback(()=>{const{isSettingsOpen:D,setSettingsOpen:Pe,toggleOverlays:Ae}=Z.getState();D?Pe(!1):Ae()},[Z]),A=m.pages.length+1,K=((wr=w.current)==null?void 0:wr.clientWidth)||400,ee=p.useCallback(D=>{var Je;const Pe=g.current;if(!Pe)return;const Ae=((Je=w.current)==null?void 0:Je.clientWidth)||1,mt=D/Ae*33.333;Pe.style.transform=`translate3d(${-33.333+mt}%, 0, 0)`},[]),N=p.useCallback(D=>{R===0&&D>0||R>=A-1&&D<0||(I.current=D,ee(D),y||T(!0))},[R,A,ee,y]),ne=p.useCallback(()=>{I.current=0,T(!1);const D=g.current;D&&(D.style.transition="transform 250ms ease-out",D.style.transform="translate3d(-33.333%, 0, 0)")},[]),W=p.useCallback(D=>{if(D.target!==D.currentTarget||D.propertyName!=="transform")return;const Pe=j;C(!0),O(null),I.current=0,Pe==="prev"?ae(-1):Pe==="next"&&ae(1)},[j,ae]);p.useLayoutEffect(()=>{z&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{C(!1)})})},[z]);const Q=an(),re=p.useCallback(D=>s||wu(D)?!0:yu(D),[s]),te=p.useCallback(D=>Q.getState().status==="playing"?!0:re(D),[Q,re]),ue=nu({onPrev:ye,onNext:we,onSingle:X,onDouble:()=>{},shouldIgnoreTarget:re,shouldIgnoreSwipe:te,horizontalThreshold:120,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,onDragMove:N,onDragEnd:ne,pageTransitionThreshold:K*.5}),oe=p.useRef(null),be=p.useRef(null),pe=p.useCallback(()=>{const D=B.getState().progress.setSectionLoading;D(!0)},[B]),Se=p.useMemo(()=>({trailing:!0,leading:!1,maxWait:1e3}),[]),Te=mu(F,200,pe,Se),Be=p.useRef("");p.useEffect(()=>{if(v<=0)return;const D=`${a}|${d}|${x}|${h}|${P}|${G}|${E}|${v}|${t==null?void 0:t.section_id}`;Be.current!==D&&(Be.current=D,console.log("debounceRecalc 취소"),Te.cancel(),pe(),F())},[Te,F,pe,a,d,x,h,P,G,E,v,t==null?void 0:t.section_id]),tu([w],Te);const Ee=q(D=>D.registerSectionScrollApi);p.useEffect(()=>(Ee({ensureVisibleGI:()=>Promise.resolve(!0),scrollToGI:()=>Promise.resolve(!0),getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:()=>Promise.resolve(),stepPage:ae}),()=>Ee(void 0)),[Ee,ae]);const Ge=t.quizzes&&t.quizzes.length>0,ot=m.pages.length>0&&R===m.pages.length,We=R>0?R-1:null,Oe=R<A-1?R+1:null,Ze=p.useMemo(()=>j==="prev"?"translate3d(0%, 0, 0)":j==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[j]),Ke=D=>n?null:D===m.pages.length?b.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[Ge&&b.jsx(vs,{}),b.jsx(fn,{isIcon:!1})]}):b.jsx(eu,{pages:m.pages,pageIndex:D,maxWidth:S}),ut={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},Pt=!z&&(!y||j!==null);return console.log("여기리랜더"),b.jsxs("div",{ref:w,style:{...M,touchAction:"none"},...ue,children:[b.jsxs("div",{ref:g,style:{display:"flex",width:"300%",height:"100%",transform:Ze,transition:Pt?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:j?W:void 0,children:[b.jsx("div",{style:ut,children:We!==null&&Ke(We)}),b.jsx("div",{style:ut,children:Ke(R)}),b.jsx("div",{style:ut,children:Oe!==null&&Ke(Oe)})]}),b.jsx("div",{ref:oe,"aria-hidden":!0,style:{position:"absolute",contain:"layout style paint",left:-999999,top:-999999,zIndex:-999999,opacity:0,width:"100%",maxWidth:S,height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden",fontFamily:a,fontSize:d,lineHeight:x,pointerEvents:"none",background:"pink"},children:b.jsxs("div",{style:{width:"100%",maxWidth:S,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",margin:"0 auto",overflow:"hidden"},children:[b.jsx("div",{style:{height:40,background:"blue"}}),b.jsx("div",{ref:be,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),b.jsx(ku,{pages:m.pages,items:u,onGotoPage:_,currentPageIndex:R,isOnExtraPage:ot})]})}const ku=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=q(a=>a.currentGlobalRunIndex),i=q(a=>a.lastUpdateBy),c=q(a=>{var d;return((d=a.layout)==null?void 0:d.prefix)??[]}),l=p.useRef(null);return p.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const a=Su(s,e,t,c);a>=0&&a!==r&&n(a)},[s,e,t,c,n,r,o,i]),b.jsx(b.Fragment,{})},Tu="_wrapper_dbk3n_1",Ru="_spinner_dbk3n_10",_o={wrapper:Tu,spinner:Ru};function _u({size:e=28,speed:t=.8}){return b.jsx("div",{className:`${_o.wrapper}`,children:b.jsx("div",{className:_o.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Mu(){const e=q(Vt(t=>t.sectionLoading===!0));return b.jsx(b.Fragment,{children:e===!0&&b.jsx(_u,{})})}const Eu="_Overlay_ybic8_3",ju="_Dialog_ybic8_15",Ou="_Body_ybic8_25",Pu="_Header_ybic8_32",Bu="_Paging_ybic8_39",zu="_Remaining_ybic8_48",Au="_RemainingDanger_ybic8_55",Lu="_NextBtn_ybic8_59",Gu="_CloseBtn_ybic8_96",Hu="_Question_ybic8_113",Nu="_Score_ybic8_123",Fu="_Image_ybic8_130",Du="_Options_ybic8_140",Wu="_OptionBtn_ybic8_145",$u="_OptionBtnActive_ybic8_165",Vu="_Footer_ybic8_172",qu="_OptionBtnCorrect_ybic8_195",Uu="_Judge_ybic8_201",Ku="_Correct_ybic8_212",Xu="_Incorrect_ybic8_215",Yu="_ResultHeader_ybic8_220",Qu="_ResultActions_ybic8_233",Zu="_CloseBtnSoft_ybic8_239",Ju="_SummaryGrid_ybic8_249",ed="_StatCard_ybic8_257",td="_StatLabel_ybic8_265",nd="_StatValue_ybic8_270",rd="_StatSub_ybic8_277",de={Overlay:Eu,Dialog:ju,Body:Ou,Header:Pu,Paging:Bu,Remaining:zu,RemainingDanger:Au,NextBtn:Lu,CloseBtn:Gu,Question:Hu,Score:Nu,Image:Fu,Options:Du,OptionBtn:Wu,OptionBtnActive:$u,Footer:Vu,OptionBtnCorrect:qu,Judge:Uu,Correct:Ku,Incorrect:Xu,ResultHeader:Yu,ResultActions:Qu,CloseBtnSoft:Zu,SummaryGrid:Ju,StatCard:ed,StatLabel:td,StatValue:nd,StatSub:rd};function od(e){return e?e.kind==="temp"?e.image_blob_url:e.image_cdn_url:null}function Ms(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function sd(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}const id=p.memo(function(){const t=et(u=>u.phase),n=et(u=>u.quizzes),r=et(u=>u.order),o=et(u=>u.currentIndex),s=et(u=>u.answers),i=et(u=>u.correctCount),c=et(u=>u.remainingSec),l=et(u=>u.uiReveal),a=et(u=>u.startedAt),d=et(u=>u.finishedAt),x=et(u=>u.perQ),h=xs();p.useEffect(()=>{if(t==="idle"||t!=="doing"||c==null)return;const u=window.setInterval(()=>h.getState().tick(),1e3);return()=>window.clearInterval(u)},[t,c,h]);const v=t==="doing"?n[r[o]]:void 0,S=t==="doing"&&v?s[v.qid]??[]:[],w=p.useMemo(()=>{if(t==="idle"||t!=="finished")return;const u=r.map(E=>n[E]),f=u.length,m=u.reduce((E,B)=>E+(B.score??0),0),k=u.reduce((E,B)=>{const F=x[B.qid];return E+(F!=null&&F.isCorrect?B.score??0:0)},0),R=u.map(E=>x[E.qid]).filter(E=>!!E),_=typeof a=="number"&&typeof d=="number"?Math.max(0,d-a):R.reduce((E,B)=>E+(B.ms??0),0),I=f>0?Math.round(_/f):0,g=[...R].sort((E,B)=>E.ms-B.ms),y=g[0],T=g[g.length-1],j=R.filter(E=>!E.multi),O=R.filter(E=>E.multi),z=j.filter(E=>E.isCorrect).length,C=O.filter(E=>E.isCorrect).length,M=R.filter(E=>E.timedOut).length,P=R.filter(E=>E.revealed).length,G=R.filter(E=>!E.isCorrect).sort((E,B)=>B.ms-E.ms).slice(0,3);return{total:f,correct:i,rate:f?Math.round(i/f*100):0,timeMsTotal:_,avgMs:I,totalScore:m,gainedScore:k,fastest:y,slowest:T,singles:{total:j.length,correct:z},multis:{total:O.length,correct:C},timedOut:M,revealed:P,wrongTop3:G}},[t,r,n,x,a,d,i]);return t==="idle"?null:b.jsx("div",{className:de.Overlay,role:"dialog","aria-modal":"true",children:b.jsx("div",{className:de.Dialog,children:t==="doing"&&v?b.jsx(ld,{q:v,index:o,total:r.length,selected:S,uiReveal:l,onSelect:u=>{if(l)return;const f=h.getState();Ms(v)?f.selectToggle(u):f.selectSingle(u)},onBeforeNext:()=>h.getState().setReveal(!0),onNext:()=>h.getState().afterRevealNext(),remainingSec:c,onClose:()=>h.getState().close()}):b.jsx(ad,{total:r.length,correct:i,summary:w,onClose:()=>h.getState().close()})})})});function ld(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:c,onNext:l,remainingSec:a,onClose:d}=e,x=Ms(t),h=p.useMemo(()=>{const u=t.options.map((f,m)=>({opt:f,i:m}));for(let f=u.length-1;f>0;f--){const m=Math.floor(Math.random()*(f+1));[u[f],u[m]]=[u[m],u[f]]}return u},[t.options]),v=p.useMemo(()=>od(t),[t]),S=p.useMemo(()=>sd(t),[t]),w=p.useMemo(()=>{const u=[...o].sort((f,m)=>f-m);if(u.length!==S.length)return!1;for(let f=0;f<u.length;f++)if(u[f]!==S[f])return!1;return!0},[o,S]);return b.jsxs("div",{className:de.Body,children:[b.jsxs("div",{className:de.Header,children:[b.jsx("div",{className:de.Paging,children:`Quiz (${n+1}/${r})`}),b.jsx("button",{type:"button",onClick:d,className:de.CloseBtn,children:"X"})]}),b.jsx("div",{className:de.Question,children:t.question}),b.jsx("div",{className:de.Score,children:` (${t.score}점${x?" ,모두선택":""})`}),b.jsx("div",{className:`${de.Judge}${s?w?` ${de.Correct}`:` ${de.Incorrect}`:""}`,"aria-live":"polite",children:s?w?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),b.jsx("div",{className:de.Image,children:v&&b.jsx("img",{src:v,alt:""})}),b.jsx("div",{className:de.Options,children:h.map(({opt:u,i:f})=>{const m=o.includes(f),k=S.includes(f),R=[de.OptionBtn,m?de.OptionBtnActive:"",s&&k?de.OptionBtnCorrect:""].filter(Boolean).join(" ");return b.jsx("button",{type:"button",onClick:()=>i(f),className:R,disabled:s,children:u},f)})}),b.jsx("div",{className:de.Footer,children:s?b.jsx("button",{type:"button",onClick:l,className:de.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):b.jsxs("button",{type:"button",onClick:c,className:`${de.NextBtn}`,children:["Submit",typeof a=="number"&&b.jsx("span",{className:`${de.Remaining} ${a<=5?de.RemainingDanger:""}`,children:` (${a} s )`})]})})]})}function Mo(e){return e==null?"-":`${Math.round(e/1e3)}s`}function ad(e){const{total:t,correct:n,summary:r,onClose:o}=e,s=(r==null?void 0:r.rate)??(t>0?Math.round(n/t*100):0);return b.jsxs("div",{className:de.Body,children:[b.jsx("div",{className:de.ResultHeader,children:"결과 요약"}),b.jsxs("div",{className:de.SummaryGrid,role:"list",children:[b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"정답률"}),b.jsxs("div",{className:de.StatValue,children:[s,"%"]}),b.jsx("div",{className:de.StatSub,children:`정답수 ${n}/문제수${t}`})]}),b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"총 점수"}),b.jsx("div",{className:de.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),b.jsx("div",{className:de.StatSub,children:"획득점수/최대점수"})]}),b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"총 소요 시간"}),b.jsx("div",{className:de.StatValue,children:Mo(r==null?void 0:r.timeMsTotal)}),b.jsx("div",{className:de.StatSub,children:`평균 ${Mo(r==null?void 0:r.avgMs)}`})]}),b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"타입오버 퀴즈수"}),b.jsx("div",{className:de.StatValue,children:r?`${r.timedOut}`:"-"}),b.jsx("div",{className:de.StatSub,children:"timeout"})]})]}),b.jsx("div",{className:de.ResultActions,children:b.jsx("button",{type:"button",onClick:o,className:de.CloseBtnSoft,children:"닫기"})})]})}function cd(e){return e.map((t,n)=>n)}function ud(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Xn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Yn(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}function Eo(e){if(!e)return{};const t=(e.quizzes??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:cd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function dd(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=Eo(e);return qt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const c=Eo(i);o(c)},openFromSection:i=>{i&&s().hydrateFromSection(i);const c=s();if(!c.quizzes.length)return;const l=c.quizzes[0];o({phase:"doing",startedAt:Date.now(),finishedAt:void 0,questionStartedAt:Date.now(),remainingSec:l.limit_sec||void 0,currentIndex:0,uiReveal:!1})},close:()=>{o({phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}})},selectToggle:i=>{const c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid,d=c.answers[a]??[],x=d.includes(i)?d.filter(h=>h!==i):[...d,i].sort((h,v)=>h-v);o({answers:{...c.answers,[a]:x}})},selectSingle:i=>{const c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid;o({answers:{...c.answers,[a]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const c=i.order[i.currentIndex],l=i.quizzes[c],a=l.qid,d=(i.answers[a]??[]).slice().sort((u,f)=>u-f),x=Yn(l),h=ud(d,x),v=i.questionStartedAt?Date.now()-i.questionStartedAt:0,S=i.perQ[a],w={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Xn(l),selected:d,correctIdxes:x,isCorrect:h,ms:v,revealed:(S==null?void 0:S.revealed)??!1,timedOut:(S==null?void 0:S.timedOut)??!1};if(o({correctCount:i.correctCount+(h?1:0),perQ:{...i.perQ,[a]:w}}),i.currentIndex+1>=i.order.length)o({uiReveal:!1,remainingSec:void 0}),s().finish();else{const u=i.currentIndex+1;o({currentIndex:u,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[u]].limit_sec||void 0,uiReveal:!1})}},setReveal:i=>{const c=s();if(c.phase==="doing"){if(i){const l=c.quizzes[c.order[c.currentIndex]],a=l.qid,d=c.perQ[a],x={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Xn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Yn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:(d==null?void 0:d.timedOut)??!1};o({perQ:{...c.perQ,[a]:x}})}o({uiReveal:i})}},afterRevealNext:()=>{s().phase==="doing"&&s().submitCurrent()},next:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex+1>=i.order.length)return;const c=i.currentIndex+1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const c=i.currentIndex-1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].limit_sec||void 0,uiReveal:!1})},finish:()=>{o({phase:"finished",remainingSec:void 0,uiReveal:!1,finishedAt:Date.now()})},tick:()=>{const i=s();if(i.phase!=="doing"||i.remainingSec==null)return;const c=i.remainingSec-1;if(c<=0){const l=i.quizzes[i.order[i.currentIndex]],a=l.qid,d=i.perQ[a],x={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Xn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Yn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[a]:x}})}else o({remainingSec:c})}}))}function fd({children:e,initialState:t}){const n=p.useMemo(()=>dd(t.section),[t]),r=p.useRef(t.onQuizComplete);return p.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),p.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const c=r.current;if(!c)return;const{sectionId:l,quizzes:a,order:d,perQ:x,startedAt:h,finishedAt:v}=s,S=d.map(I=>a[I]),w=S.length,u=S.filter(I=>{var g;return(g=x[I.qid])==null?void 0:g.isCorrect}).length,f=S.reduce((I,g)=>I+(g.score??0),0),m=S.reduce((I,g)=>{const y=x[g.qid];return I+(y!=null&&y.isCorrect?g.score??0:0)},0),k=typeof h=="number"&&typeof v=="number"?Math.max(0,v-h):0,R=S.map(I=>{const g=x[I.qid];return{qid:I.qid,index:I.index,question:I.question,score:I.score??0,isCorrect:(g==null?void 0:g.isCorrect)??!1,selected:(g==null?void 0:g.selected)??[],correctIdxes:(g==null?void 0:g.correctIdxes)??[],ms:(g==null?void 0:g.ms)??0,timedOut:(g==null?void 0:g.timedOut)??!1}}),_={sectionId:l??"",total:w,correct:u,rate:w>0?Math.round(u/w*100):0,totalScore:f,gainedScore:m,timeMsTotal:k,perQuestion:R};c(_)}});return()=>o()},[n]),b.jsx(yr.Provider,{value:n,children:e})}const jo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","showPointer","showSplit","showOverlays","overlayCompactMode","isSettingsOpen"];function pd({containerRef:e}){const t=yt(),n=hn(),r=p.useRef(null);return p.useEffect(()=>{const o=e.current;if(!o)return;let s=o.clientWidth,i=o.clientHeight;n.getState().setViewportSize(s,i);const c=new ResizeObserver(()=>{const l=o.clientWidth,a=o.clientHeight;(l!==s||a!==i)&&(s=l,i=a,n.getState().setViewportSize(l,a),t.getState().emit({type:"viewport_resize",payload:{width:l,height:a}}))});return c.observe(o),()=>c.disconnect()},[t,n,e]),p.useEffect(()=>{const o=n.getState();r.current={};for(const i of jo)r.current[i]=o[i];const s=n.subscribe(i=>{const c=r.current;if(c)for(const l of jo){const a=c[l],d=i[l];a!==d&&(l==="mode"?t.getState().emit({type:"mode_change",payload:{mode:d}}):t.getState().emit({type:"settings_change",payload:{key:l,value:d}}),c[l]=d)}});return()=>{s(),r.current=null}},[t,n]),null}function hd(){const e=yt(),t=hn(),n=xt(),r=p.useContext(zo),o=p.useContext(vn),s=p.useCallback(l=>{const{viewerState:a}=l;if(a){a.mode&&t.getState().setMode(a.mode);const{...x}=a;t.setState(x)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(a==null?void 0:a.mode)==="scroll"||!(a!=null&&a.mode)){const x=()=>{const h=n.getState().progress.getSectionScrollApi();if(!h)return!1;if(l.scrollY===0)h.setScrollTop(0);else if(h.scrollToGIAtOffset){const v=l.anchorGI??l.globalIndex;if(typeof v=="number"){const S=l.anchorOffsetRatio??0;h.scrollToGIAtOffset(v,S)}}return!0};if(!x()){let h=0;const v=setInterval(()=>{(x()||++h>=10)&&clearInterval(v)},50)}}},[t,n]),i=p.useCallback(()=>{var S,w,u;const l=t.getState(),a=n.getState().progress,d=(S=a.getSectionScrollApi)==null?void 0:S.call(a),x=a.currentGlobalRunIndex??0,h=((w=d==null?void 0:d.getScrollTop)==null?void 0:w.call(d))??0,v=((u=d==null?void 0:d.getAnchorOffsetRatio)==null?void 0:u.call(d,x))??0;return{viewerState:{mode:l.mode,theme:l.theme,fontFamily:l.fontFamily,fontSizePx:l.fontSizePx,lineHeight:l.lineHeight,marginX:l.marginX,marginY:l.marginY,showOverlays:l.showOverlays,isSettingsOpen:l.isSettingsOpen,pointerStyle:l.pointerStyle,pointerColor:l.pointerColor,breakMarks:l.breakMarks,breakGapPx:l.breakGapPx,muteAudio:l.muteAudio,audioSpeed:l.audioSpeed,showPointer:l.showPointer,showSplit:l.showSplit,overlayCompactMode:l.overlayCompactMode,viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight},globalIndex:x,scrollY:h,anchorGI:x,anchorOffsetRatio:v,currentPage:a.pageIndex??0,sectionId:a.sectionId??"",viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight}},[t,n]),c=p.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:a}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(a,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:d,anchorGI:x,anchorOffsetRatio:h}=l.payload,v=n.getState().progress.getSectionScrollApi();v&&(d===0?v.setScrollTop(0):v.scrollToGIAtOffset&&typeof x=="number"&&v.scrollToGIAtOffset(x,h));break}case"settings_change":{const{key:a,value:d}=l.payload,x=t.getState();a in x&&typeof x[a]!="function"&&t.setState({[a]:d});break}case"mode_change":{const{mode:a}=l.payload;t.getState().setMode(a);break}case"audio_control":{if(!o)break;const{action:a}=l.payload;switch(a){case"play":o.getState()._setStatusOnly("playing");break;case"pause":o.getState()._setStatusOnly("paused");break;case"stop":o.getState()._setStatusOnly("idle");break}break}case"page_change":{const{pageIndex:a}=l.payload;n.getState().progress.setPageIndex(a);break}case"range_select":case"range_change":{const{startGI:a,endGI:d}=l.payload;console.log(`[DirectPlayback] ${l.type}: GI ${a}~${d}`),n.getState().progress.setRange(a,d);const x=n.getState().progress;console.log(`[DirectPlayback] after setRange: rangeStartGI=${x.rangeStartGI}, rangeEndGI=${x.rangeEndGI}`);break}case"range_clear":{console.log("[DirectPlayback] range_clear"),n.getState().progress.clearRange();break}case"translate_request":case"translate_loading_start":case"translate_loading_end":case"translate_modal_close":break;case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[DirectPlaybackController] 미처리 이벤트:",l.type)}},[n,t,o]);return p.useLayoutEffect(()=>r?(r.current={dispatch:c,applySnapshot:s,getSnapshot:i,isReady:()=>!n.getState().progress.sectionLoading,waitUntilReady:()=>new Promise(a=>{if(!n.getState().progress.sectionLoading){a();return}const d=n.subscribe(x=>{x.progress.sectionLoading||(d(),a())})})},e.getState().isPlaybackMode&&(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)),()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)}):void 0,[r,e,c,s,i,n]),p.useLayoutEffect(()=>e.subscribe((a,d)=>{a.isPlaybackMode&&!d.isPlaybackMode?(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)):!a.isPlaybackMode&&d.isPlaybackMode&&(e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null))}),[e,c,s]),null}const gd=({containerRef:e,onTranslate:t})=>{const n=q(h=>h.rangeStartGI),r=q(h=>h.rangeEndGI),o=q(h=>h.getRangeText),s=q(h=>h.clearRange),i=yt(),c=n!=null&&r!=null,[l,a]=p.useState(null);p.useEffect(()=>{if(!c)return;const h=e.current;if(!h)return;let v=!0;const S=new ResizeObserver(()=>{if(v){v=!1;return}s()});return S.observe(h),()=>S.disconnect()},[c,s,e]),p.useEffect(()=>{if(!c||n==null||r==null){a(null);return}const h=()=>{const S=e.current;if(!S)return;const w=S.getBoundingClientRect(),f=1/(i.getState().playbackScale||1),m=S.querySelector(`[data-g="${r}"]`);if(!m){a({x:w.width*f/2,y:80});return}const k=m.getBoundingClientRect(),R=S.querySelector(`[data-g="${n}"]`),_=R==null?void 0:R.getBoundingClientRect();let I=(k.left+k.width/2-w.left)*f;_&&(I=((_.left+k.right)/2-w.left)*f);const g=160,y=50,T=16,j=12,O=w.width*f,z=Math.max(T+g/2,Math.min(I,O-T-g/2)),C=(((_==null?void 0:_.top)??k.top)-w.top)*f-y-j;let M=C;C<T&&(M=(k.bottom-w.top)*f+j),a({x:z,y:M})};h();const v=e.current;return v&&v.addEventListener("scroll",h,!0),()=>{v&&v.removeEventListener("scroll",h,!0)}},[c,n,r,e,i]);const d=p.useCallback(()=>{const h=o();h&&navigator.clipboard.writeText(h).catch(v=>{console.error("복사 실패:",v)}),s()},[o,s]),x=p.useCallback(()=>{const h=o();h&&t&&t(h)},[o,t]);return!c||!l?null:b.jsxs("div",{"data-range-menu":!0,style:{position:"absolute",left:l.x,top:l.y,transform:"translateX(-50%)",display:"flex",gap:8,padding:"8px 12px",backgroundColor:"#fff",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",zIndex:1e4},children:[b.jsx("button",{onClick:d,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),b.jsx("button",{onClick:x,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},md="_handleStart_1ihf3_16 _handle_1ihf3_1",bd="_handleEnd_1ihf3_21 _handle_1ihf3_1",Oo={handleStart:md,handleEnd:bd},xd=({containerRef:e})=>{const t=q(f=>f.rangeStartGI),n=q(f=>f.rangeEndGI),r=q(f=>f.setRange),o=yt(),s=t!=null&&n!=null,[i,c]=p.useState(null),[l,a]=p.useState(null),d=p.useRef(null),x=p.useRef(null);p.useEffect(()=>{if(!s||t==null||n==null){c(null),a(null);return}const f=()=>{const k=e.current;if(!k)return;const R=k.getBoundingClientRect(),I=1/(o.getState().playbackScale||1),g=k.querySelector(`[data-g="${t}"]`),y=k.querySelector(`[data-g="${n}"]`);if(g){const T=g.getBoundingClientRect();c({x:(T.left-R.left)*I,y:(T.bottom-R.top)*I})}else c(null);if(y){const T=y.getBoundingClientRect();a({x:(T.right-R.left)*I,y:(T.bottom-R.top)*I})}else a(null)};f();const m=e.current;return m&&m.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{m&&m.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s,t,n,e,o]);const h=p.useCallback((f,m)=>{var R;const k=document.elementsFromPoint(f,m);for(const _ of k){const I=(R=_.getAttribute)==null?void 0:R.call(_,"data-g");if(I!=null)return parseInt(I,10)}return null},[]),v=p.useCallback(f=>m=>{m.preventDefault(),m.stopPropagation(),d.current=f,x.current=f==="start"?t:n,m.target.setPointerCapture(m.pointerId)},[t,n]),S=p.useCallback(f=>{if(!d.current||t==null||n==null)return;const m=h(f.clientX,f.clientY);m!=null&&(d.current==="start"?m<=n?r(m,n):(r(n,m),d.current="end"):m>=t?r(t,m):(r(m,t),d.current="start"))},[t,n,r,h]),w=p.useCallback(f=>{d.current=null,x.current=null,f.target.releasePointerCapture(f.pointerId)},[]);return s?b.jsxs(b.Fragment,{children:[i&&b.jsx("div",{className:Oo.handleStart,"data-range-handle":"start",style:{left:i.x-26,top:i.y},onPointerDown:v("start"),onPointerMove:S,onPointerUp:w,onPointerCancel:w}),l&&b.jsx("div",{className:Oo.handleEnd,"data-range-handle":"end",style:{left:l.x,top:l.y},onPointerDown:v("end"),onPointerMove:S,onPointerUp:w,onPointerCancel:w})]}):null};function vd(){const e=q(o=>o.rangeStartGI),t=q(o=>o.rangeEndGI),n=q(o=>o.clearRange),r=e!=null&&t!=null;return p.useEffect(()=>{if(!r)return;const o=s=>{var c;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(c=i.closest("[data-g]"))==null?void 0:c.getAttribute("data-g");if(l){const a=parseInt(l,10),d=Math.min(e,t),x=Math.max(e,t);if(a>=d&&a<=x)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const Sd=({isOpen:e,onClose:t,text:n})=>e?b.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:10001},onClick:t,children:b.jsxs("div",{style:{position:"relative",backgroundColor:"#fff",borderRadius:12,padding:"24px 32px",minWidth:280,maxWidth:"80%",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.2)"},onClick:r=>r.stopPropagation(),children:[b.jsx("button",{onClick:t,style:{position:"absolute",top:12,right:12,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"50%",cursor:"pointer",fontSize:20,color:"#666"},"aria-label":"닫기",children:"✕"}),b.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:18,fontWeight:600,color:"#333"},children:"번역"}),b.jsx("p",{style:{margin:0,fontSize:16,color:"#666",textAlign:"center",padding:"16px 0"},children:"준비중입니다"}),n&&b.jsxs("div",{style:{marginTop:16,padding:12,backgroundColor:"#f5f5f5",borderRadius:8,fontSize:14,color:"#888",maxHeight:100,overflow:"auto"},children:[b.jsx("span",{style:{fontWeight:500},children:"선택된 텍스트: "}),n]})]})}):null,yd=(e,t,n)=>Math.min(n,Math.max(t,e));function wd({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:c,onViewerEvent:l,viewerRef:a,isPlaybackMode:d=!1,playbackScale:x,isDev:h=!1}){const v=String((e==null?void 0:e.section_id)??"0"),S=p.useMemo(()=>{var R,_;const m=((R=e==null?void 0:e.ast)==null?void 0:R.blocks)??[];let k=0;for(const I of m)(I==null?void 0:I.type)!=="image"&&(k+=((_=I==null?void 0:I.runs)==null?void 0:_.length)??0);return k},[e]),w=p.useMemo(()=>typeof n=="number"?yd(n,S>0?0:-1,Math.max(S-1,-1)):(S>0,0),[n,S]),u=p.useMemo(()=>({section:e,initialIndex:w,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,w,r,o,s,i]),f=p.useMemo(()=>{const m=(e==null?void 0:e.audios)??[],k=m.length>0?Uc(e):void 0;return{clips:m,map:k,initialIndex:w,section:e}},[e,w]);return b.jsx(qs,{onViewerEvent:l,isPlaybackMode:d,playbackScale:x,viewerRef:a,children:b.jsx(Jc,{initialState:{...t,isDev:h},children:b.jsx(Zc,{initialState:u,children:b.jsx(qc,{initialState:f,children:b.jsx(fd,{initialState:{section:e,onQuizComplete:c},children:b.jsx(Cd,{})},v)},v)},v)})})}function Cd(){const e=Y(h=>h.mode),t=p.useRef(null),n=yt(),r=xt(),[o,s]=p.useState(!1),[i,c]=p.useState(),l=p.useCallback(h=>{c(h),s(!0);const{rangeStartGI:v,rangeEndGI:S}=r.getState().progress;n.getState().emit({type:"translate_request",payload:{text:h,startGI:v??0,endGI:S??0}})},[n,r]),a=p.useCallback(()=>{s(!1),c(void 0),n.getState().emit({type:"translate_modal_close",payload:{}})},[n]),d=h=>{h.preventDefault()},x=h=>{h.preventDefault()};return b.jsxs("div",{ref:t,onContextMenu:d,onDragStart:x,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",touchAction:"none"},children:[e==="scroll"?b.jsx(pa,{}):b.jsx(Iu,{}),b.jsx(gd,{containerRef:t,onTranslate:l}),b.jsx(xd,{containerRef:t}),b.jsx(Hc,{}),b.jsx(id,{}),b.jsx(Mu,{}),b.jsx(vd,{}),b.jsx(Sd,{isOpen:o,onClose:a,text:i}),b.jsx(pd,{containerRef:t}),b.jsx(hd,{})]})}exports.CRViewer=wd;
|
|
34
|
+
*/var Mr;function Ns(){return Mr||(Mr=1,process.env.NODE_ENV!=="production"&&(function(){function e(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=p,n=zo(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Cn.useSyncExternalStoreWithSelector=function(a,d,S,g,v){var x=s(null);if(x.current===null){var w={hasValue:!1,value:null};x.current=w}else w=x.current;x=c(function(){function f(I){if(!m){if(m=!0,k=I,I=g(I),v!==void 0&&w.hasValue){var h=w.value;if(v(h,I))return T=h}return T=I}if(h=T,r(k,I))return h;var y=g(I);return v!==void 0&&v(h,y)?(k=I,h):(k=I,T=y)}var m=!1,k,T,_=S===void 0?null:S;return[function(){return f(d())},_===null?void 0:function(){return f(_())}]},[d,S,g,v]);var u=o(a,x[0],x[1]);return i(function(){w.hasValue=!0,w.value=u},[u]),l(u),u},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Cn}var Er;function Fs(){return Er||(Er=1,process.env.NODE_ENV==="production"?Qt.exports=Hs():Qt.exports=Ns()),Qt.exports}var Ds=Fs();const Ws=Bo(Ds),jr=e=>{let t;const n=new Set,r=(a,d)=>{const S=typeof a=="function"?a(t):a;if(!Object.is(S,t)){const g=t;t=d??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(v=>v(t,g))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:a=>(n.add(a),()=>n.delete(a))},l=t=e(r,o,c);return c},qt=(e=>e?jr(e):jr),{useSyncExternalStoreWithSelector:$s}=Ws,Vs=e=>e;function pn(e,t=Vs,n){const r=$s(e.subscribe,e.getState,e.getInitialState,t,n);return p.useDebugValue(r),r}function Y(e,t){const n=p.useContext(ir);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return pn(n,e,t)}function hn(){const e=p.useContext(ir);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const St=p.createContext(void 0),Ao=p.createContext(void 0);function qs(){return qt((e,t)=>({emitCallback:null,isPlaybackMode:!1,playbackScale:1,dispatchHandler:null,applySnapshotHandler:null,setEmitCallback:n=>e({emitCallback:n}),emit:(n,r)=>{const{emitCallback:o,isPlaybackMode:s}=t();s||o&&o({...n,timestamp:r??Date.now()})},setPlaybackMode:n=>e({isPlaybackMode:n}),setPlaybackScale:n=>e({playbackScale:n}),setDispatchHandler:n=>e({dispatchHandler:n}),dispatch:n=>{const{dispatchHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] dispatch called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] dispatch called but no handler registered")},setApplySnapshotHandler:n=>e({applySnapshotHandler:n}),applySnapshot:n=>{const{applySnapshotHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] applySnapshot called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] applySnapshot called but no handler registered")}}))}function Us({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=p.useMemo(()=>qs(),[]);return p.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),p.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),p.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),p.useLayoutEffect(()=>()=>{o&&(o.current=null)},[o]),b.jsx(St.Provider,{value:s,children:b.jsx(Ao.Provider,{value:o,children:e})})}function yt(){const e=p.useContext(St);if(!e)throw new Error("useViewerEventBridgeStoreApi must be used inside <ViewerEventBridgeProvider>");return e}const lr=p.createContext(void 0);function xt(){const e=p.useContext(lr);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function q(e,t){const n=p.useContext(lr);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return pn(n,o=>e(o.progress),t)}function Ks({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=p.useRef(null);p.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=p.useCallback(c=>{if(!(r!=null&&r(c.target))&&c.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(c)},n)}},[n,e,r]),i=p.useCallback(c=>{r!=null&&r(c.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const on={light:{bg:"#ffffff",fg:"#111827",overlayBg:"#ffffff",overlayFg:"#111827",borderColor:"#333333"},dark:{bg:"#0b0b0b",fg:"#e5e7eb",overlayBg:"#0b0b0b",overlayFg:"#e5e7eb",borderColor:"#ffffff"},sepia:{bg:"#f4ecd8",fg:"#3e2f1c",overlayBg:"#f4ecd8",overlayFg:"#3e2f1c",borderColor:"#bfa87a"},green:{bg:"#e9f5e1",fg:"#1b3d1f",overlayBg:"#e9f5e1",overlayFg:"#1b3d1f",borderColor:"#93b48b"}},In=[8,16,24,40,64],kn=[1.2,1.4,1.6,1.8,2,2.2,2.4],Tn=[4,8,12,16,24],Zn=e=>Math.round(12+(e-1)*(16/11)),Xs=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Zn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},Rn=(e,t)=>{let n=0,r=1/0;return t.forEach((o,s)=>{const i=Math.abs(o-e);i<r&&(r=i,n=s)}),n+1},Lo=[{label:"고딕체",value:"'Noto Sans KR', sans-serif"},{label:"명조체",value:"'Noto Serif KR', serif"},{label:"바탕체",value:"'Nanum Myeongjo', serif"}],He={mode:"page",theme:"light",fontFamily:Lo.find(e=>e.label==="명조체").value,fontSizePx:18,lineHeight:1.8,marginX:20,marginY:24,showOverlays:!0,overlayCompactMode:!0,isSettingsOpen:!1,pointerStyle:"highlight",pointerColor:"#fff59d",breakMarks:{slash:!0},breakGapPx:8,muteAudio:!1,audioSpeed:1,showPointer:!0,showSplit:!0,viewportWidth:0,viewportHeight:0,isDev:!1};function Ys(e){const{init:t,recorderStore:n}=e??{};return qt((r,o)=>({...He,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>{const s=!o().showOverlays;r({showOverlays:s,...s&&{overlayCompactMode:!0}})},setOverlayCompactMode:s=>r({overlayCompactMode:s}),toggleOverlayCompactMode:()=>r({overlayCompactMode:!o().overlayCompactMode}),setSettingsOpen:s=>r({isSettingsOpen:s}),resetToDefaults:()=>r(s=>({mode:He.mode,theme:He.theme,fontFamily:He.fontFamily,fontSizePx:He.fontSizePx,lineHeight:He.lineHeight,marginX:He.marginX,marginY:He.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:He.pointerStyle,pointerColor:He.pointerColor,breakMarks:He.breakMarks,breakGapPx:He.breakGapPx,muteAudio:He.muteAudio,audioSpeed:He.audioSpeed,showPointer:He.showPointer,showSplit:He.showSplit})),maps:{MARGIN_MAP:In,LINEHEIGHT_MAP:kn,BREAK_GAP_MAP:Tn,fontSizeFromLevel:Zn},setPointerStyle:s=>r({pointerStyle:s}),setPointerColor:s=>r({pointerColor:s}),toggleBreakMark:s=>{const i=o().breakMarks;r({breakMarks:{...i,[s]:!i[s]}})},setBreakMarks:s=>{r({breakMarks:{...o().breakMarks,...s}})},setBreakGapPx:s=>r({breakGapPx:s}),setBreakGapLevel:s=>{const i=Tn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>Rn(o().breakGapPx,Tn),getFontLevel:()=>Xs(o().fontSizePx),getLineLevel:()=>Rn(o().lineHeight,kn),getMarginLevel:()=>Rn(o().marginX,In),setFontLevel:s=>r({fontSizePx:Zn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:kn[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=In[Math.max(1,Math.min(5,s))-1];r({marginX:i,marginY:i})},setMuteAudio:s=>{r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},toggleMuteAudio:()=>{const s=!o().muteAudio;r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},setAudioSpeed:s=>{const i=Math.max(.3,Math.min(2,s));r({audioSpeed:i}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:i}})},incAudioSpeed:()=>{const s=Math.min(2,Math.round((o().audioSpeed+.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},decAudioSpeed:()=>{const s=Math.max(.3,Math.round((o().audioSpeed-.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},setShowPointer:s=>r({showPointer:s}),toggleShowPointer:()=>r({showPointer:!o().showPointer}),setShowSplit:s=>r({showSplit:s}),toggleShowSplit:()=>r({showSplit:!o().showSplit}),setViewportSize:(s,i)=>r({viewportWidth:s,viewportHeight:i})}))}const gn=0,pt=1,jt=2,Go=4;function Or(e){return()=>e}function Qs(e){e()}function Ho(e,t){return n=>e(t(n))}function Pr(e,t){return()=>e(t)}function Zs(e,t){return n=>e(t,n)}function ar(e){return e!==void 0}function Js(...e){return()=>{e.map(Qs)}}function Ot(){}function mn(e,t){return t(e),e}function ei(e,t){return t(e)}function ke(...e){return e}function xe(e,t){return e(pt,t)}function fe(e,t){e(gn,t)}function cr(e){e(jt)}function _e(e){return e(Go)}function J(e,t){return xe(e,Zs(t,gn))}function nt(e,t){const n=e(pt,r=>{n(),t(r)});return n}function Br(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function No(e,t){return e===t}function Ie(e=No){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ie(e){return t=>n=>{e(n)&&t(n)}}function U(e){return t=>Ho(t,e)}function it(e){return t=>()=>{t(e)}}function L(e,...t){const n=ti(...t);return((r,o)=>{switch(r){case jt:cr(e);return;case pt:return xe(e,n(o))}})}function lt(e,t){return n=>r=>{n(t=e(t,r))}}function vt(e){return t=>n=>{e>0?e--:t(n)}}function ct(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function he(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);xe(s,l=>{const a=n;n=n|c,t[i]=l,a!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>{s([i].concat(t))};n===o?c():r=c}}function ti(...e){return t=>e.reduceRight(ei,t)}function ni(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case pt:return s?n===s?void 0:(r(),n=s,t=xe(e,s),t):(r(),Ot);case jt:r(),n=null;return}}}function H(e){let t=e;const n=ge();return((r,o)=>{switch(r){case gn:t=o;break;case pt:{o(t);break}case Go:return t}return n(r,o)})}function Fe(e,t){return mn(H(t),n=>J(e,n))}function ge(){const e=[];return((t,n)=>{switch(t){case gn:e.slice().forEach(r=>{r(n)});return;case jt:e.splice(0,e.length);return;case pt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Ue(e){return mn(ge(),t=>J(e,t))}function me(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ri(),singleton:n}}const ri=()=>Symbol();function oi(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const c=r(o.map(l=>n(l)));return i&&t.set(s,c),c};return n(e)}function ze(...e){const t=ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const c=Math.pow(2,i);xe(s,l=>{n[i]=l,r=r|c,r===o&&fe(t,n)})}),function(s,i){switch(s){case jt:{cr(t);return}case pt:return r===o&&i(n),xe(t,i)}}}function se(e,t=No){return L(e,Ie(t))}function Jn(...e){return function(t,n){switch(t){case jt:return;case pt:return Js(...e.map(r=>xe(r,n)))}}}var Ve=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ve||{});const si={0:"debug",3:"error",1:"log",2:"warn"},ii=()=>typeof globalThis>"u"?window:globalThis,ht=me(()=>{const e=H(3);return{log:H((t,n,r=1)=>{var o;const s=(o=ii().VIRTUOSO_LOG_LEVEL)!=null?o:_e(e);r>=s&&console[si[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function wt(e,t,n){return ur(e,t,n).callbackRef}function ur(e,t,n){const r=p.useRef(null);let o=i=>{};const s=p.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const c=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?c():requestAnimationFrame(c)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function li(e,t,n,r,o,s,i,c,l){const a=p.useCallback(d=>{const S=ai(d.children,t,c?"offsetWidth":"offsetHeight",o);let g=d.parentElement;for(;!g.dataset.virtuosoScroller;)g=g.parentElement;const v=g.lastElementChild.dataset.viewportType==="window";let x;v&&(x=g.ownerDocument.defaultView);const w=i?c?i.scrollLeft:i.scrollTop:v?c?x.scrollX||x.document.documentElement.scrollLeft:x.scrollY||x.document.documentElement.scrollTop:c?g.scrollLeft:g.scrollTop,u=i?c?i.scrollWidth:i.scrollHeight:v?c?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight:c?g.scrollWidth:g.scrollHeight,f=i?c?i.offsetWidth:i.offsetHeight:v?c?x.innerWidth:x.innerHeight:c?g.offsetWidth:g.offsetHeight;r({scrollHeight:u,scrollTop:Math.max(w,0),viewportHeight:f}),s==null||s(c?zr("column-gap",getComputedStyle(d).columnGap,o):zr("row-gap",getComputedStyle(d).rowGap,o)),S!==null&&e(S)},[e,t,o,s,i,r,c]);return ur(a,n,l)}function ai(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const c=e.item(i);if(c.dataset.index===void 0)continue;const l=parseInt(c.dataset.index),a=parseFloat(c.dataset.knownSize),d=t(c,n);if(d===0&&r("Zero-sized element, this should not happen",{child:c},Ve.ERROR),d===a)continue;const S=s[s.length-1];s.length===0||S.size!==d||S.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function zr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}function Fo(e,t,n){const r=p.useRef(null),o=p.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const a=l.getBoundingClientRect(),d=a.width;let S,g;if(t){const v=t.getBoundingClientRect(),x=a.top-v.top;g=v.height-Math.max(0,x),S=x+t.scrollTop}else{const v=i.current.ownerDocument.defaultView;g=v.innerHeight-Math.max(0,a.top),S=a.top+v.scrollY}r.current={offsetTop:S,visibleHeight:g,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:i}=ur(o,!0,n),c=p.useCallback(()=>{o(i.current)},[o,i]);return p.useEffect(()=>{var l;if(t){t.addEventListener("scroll",c);const a=new ResizeObserver(()=>{requestAnimationFrame(c)});return a.observe(t),()=>{t.removeEventListener("scroll",c),a.unobserve(t)}}else{const a=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}}},[c,t,i]),s}const De=me(()=>{const e=ge(),t=ge(),n=H(0),r=ge(),o=H(0),s=ge(),i=ge(),c=H(0),l=H(0),a=H(0),d=H(0),S=ge(),g=ge(),v=H(!1),x=H(!1),w=H(!1);return J(L(e,U(({scrollTop:u})=>u)),t),J(L(e,U(({scrollHeight:u})=>u)),i),J(t,o),{deviation:n,fixedFooterHeight:a,fixedHeaderHeight:l,footerHeight:d,headerHeight:c,horizontalDirection:x,scrollBy:g,scrollContainerState:e,scrollHeight:i,scrollingInProgress:v,scrollTo:S,scrollTop:t,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),Gt={lvl:0};function Do(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:c,value:l}=t(e[i]);s.push({end:c-1,start:r,value:o}),r=c,o=l}return s.push({end:1/0,start:r,value:o}),s}function ve(e){return e===Gt}function Ht(e,t){if(!ve(e))return t===e.k?e.v:t<e.k?Ht(e.l,t):Ht(e.r,t)}function rt(e,t,n="k"){if(ve(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=rt(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return rt(e.l,t,n)}function qe(e,t,n){return ve(e)?Vo(t,n,1):t===e.k?Le(e,{k:t,v:n}):t<e.k?Ar(Le(e,{l:qe(e.l,t,n)})):Ar(Le(e,{r:qe(e.r,t,n)}))}function _t(){return Gt}function Mt(e,t,n){if(ve(e))return[];const r=rt(e,t)[0];return ci(tr(e,r,n))}function er(e,t){if(ve(e))return Gt;const{k:n,l:r,r:o}=e;if(t===n){if(ve(r))return o;if(ve(o))return r;{const[s,i]=$o(r);return nn(Le(e,{k:s,l:Wo(r),v:i}))}}else return t<n?nn(Le(e,{l:er(r,t)})):nn(Le(e,{r:er(o,t)}))}function bt(e){return ve(e)?[]:[...bt(e.l),{k:e.k,v:e.v},...bt(e.r)]}function tr(e,t,n){if(ve(e))return[];const{k:r,l:o,r:s,v:i}=e;let c=[];return r>t&&(c=c.concat(tr(o,t,n))),r>=t&&r<=n&&c.push({k:r,v:i}),r<=n&&(c=c.concat(tr(s,t,n))),c}function nn(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(_n(t))return qo(Le(e,{lvl:n-1}));if(!ve(t)&&!ve(t.r))return Le(t.r,{l:Le(t,{r:t.r.l}),lvl:n,r:Le(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(_n(e))return nr(Le(e,{lvl:n-1}));if(!ve(r)&&!ve(r.l)){const o=r.l,s=_n(o)?r.lvl-1:r.lvl;return Le(o,{l:Le(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:nr(Le(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Le(e,t){return Vo(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Wo(e){return ve(e.r)?e.l:nn(Le(e,{r:Wo(e.r)}))}function _n(e){return ve(e)||e.lvl>e.r.lvl}function $o(e){return ve(e.r)?[e.k,e.v]:$o(e.r)}function Vo(e,t,n,r=Gt,o=Gt){return{k:e,l:r,lvl:n,r:o,v:t}}function Ar(e){return nr(qo(e))}function qo(e){const{l:t}=e;return!ve(t)&&t.lvl===e.lvl?Le(t,{r:Le(e,{l:t.r})}):e}function nr(e){const{lvl:t,r:n}=e;return!ve(n)&&!ve(n.r)&&n.lvl===t&&n.r.lvl===t?Le(n,{l:Le(e,{r:n.l}),lvl:t+1}):e}function ci(e){return Do(e,({k:t,v:n})=>({index:t,value:n}))}function Uo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Nt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const dr=me(()=>({recalcInProgress:H(!1)}),[],{singleton:!0});function Ko(e,t,n){return e[sn(e,t,n)]}function sn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function ui(e,t,n,r){const o=sn(e,t,r),s=sn(e,n,r,o);return e.slice(o,s+1)}function ft(e,t){return Math.round(e.getBoundingClientRect()[t])}function bn(e){return!ve(e.groupOffsetTree)}function fr({index:e},t){return t===e?0:t<e?-1:1}function di(){return{groupIndices:[],groupOffsetTree:_t(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:_t()}}function fi(e,t){let n=ve(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),ve(e)){e=qe(e,0,s);continue}const c=Mt(e,i-1,o+1);if(c.some(vi(r)))continue;let l=!1,a=!1;for(const{end:d,start:S,value:g}of c)l?(o>=S||s===g)&&(e=er(e,S)):(a=g!==s,l=!0),d>o&&o>=S&&g!==s&&(e=qe(e,o+1,g));a&&(e=qe(e,i,s))}return[e,n]}function pi(e){return typeof e.groupIndex<"u"}function hi({offset:e},t){return t===e?0:t<e?-1:1}function Ft(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=Ko(t,e,fr),i=e-r,c=s*i+(i-1)*n+o;return c>0?c+n:c}function Xo(e,t){if(!bn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Yo(e,t,n){if(pi(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Xo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function gi(e,t,n,r=0){return r>0&&(t=Math.max(t,Ko(e,r,fr).offset)),Do(ui(e,t,n,hi),xi)}function mi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Ve.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&ve(s)&&t.length===2){const g=t[0].size,v=t[1].size;i=n.reduce((x,w)=>qe(qe(x,w,g),w+1,v),i)}else[i,c]=fi(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:a,lastSize:d,offsetTree:S}=rr(e.offsetTree,c,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((g,v)=>qe(g,v,Ft(v,S,o)),_t()),lastIndex:l,lastOffset:a,lastSize:d,offsetTree:S,sizeTree:i}}function bi(e){return bt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function Lr(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function rr(e,t,n,r){let o=e,s=0,i=0,c=0,l=0;if(t!==0){l=sn(o,t-1,fr),c=o[l].offset;const a=rt(n,t-1);s=a[0],i=a[1],o.length&&o[l].size===rt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:a,value:d}of Mt(n,t,1/0)){const S=a-s,g=S*i+c+S*r;o.push({index:a,offset:g,size:d}),s=a,c=g,i=d}return{lastIndex:s,lastOffset:c,lastSize:i,offsetTree:o}}function xi(e){return{index:e.index,value:e}}function vi(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const Si={offsetHeight:"height",offsetWidth:"width"},at=me(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Fe(r,0),s=ge(),i=ge(),c=H(0),l=H([]),a=H(void 0),d=H(void 0),S=H(void 0),g=H(void 0),v=H((h,y)=>ft(h,Si[y])),x=H(void 0),w=H(0),u=di(),f=Fe(L(n,he(l,e,w),lt(mi,u),Ie()),u),m=Fe(L(l,Ie(),lt((h,y)=>({current:y,prev:h.current}),{current:[],prev:[]}),U(({prev:h})=>h)),[]);J(L(l,ie(h=>h.length>0),he(f,w),U(([h,y,R])=>{const j=h.reduce((O,z,C)=>qe(O,z,Ft(z,y.offsetTree,R)||C),_t());return{...y,groupIndices:h,groupOffsetTree:j}})),f),J(L(r,he(f),ie(([h,{lastIndex:y}])=>h<y),U(([h,{lastIndex:y,lastSize:R}])=>[{endIndex:y,size:R,startIndex:h}])),n),J(a,d);const k=Fe(L(a,U(h=>h===void 0)),!0);J(L(d,ie(h=>h!==void 0&&ve(_e(f).sizeTree)),U(h=>{const y=_e(S),R=_e(l).length>0;return y?R?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:h,startIndex:1}]:[]:[{endIndex:0,size:h,startIndex:0}]})),n),J(L(g,ie(h=>h!==void 0&&h.length>0&&ve(_e(f).sizeTree)),U(h=>{const y=[];let R=h[0],j=0;for(let O=1;O<h.length;O++){const z=h[O];z!==R&&(y.push({endIndex:O-1,size:R,startIndex:j}),R=z,j=O)}return y.push({endIndex:h.length-1,size:R,startIndex:j}),y})),n),J(L(l,he(S,d),ie(([,h,y])=>h!==void 0&&y!==void 0),U(([h,y,R])=>{const j=[];for(let O=0;O<h.length;O++){const z=h[O],C=h[O+1];j.push({startIndex:z,endIndex:z,size:y}),C!==void 0&&j.push({startIndex:z+1,endIndex:C-1,size:R})}return j})),n);const T=Ue(L(n,he(f),lt(({sizes:h},[y,R])=>({changed:R!==h,sizes:R}),{changed:!1,sizes:u}),U(h=>h.changed)));xe(L(c,lt((h,y)=>({diff:h.prev-y,prev:y}),{diff:0,prev:0}),U(h=>h.diff)),h=>{const{groupIndices:y}=_e(f);if(h>0)fe(t,!0),fe(s,h+Lr(h,y));else if(h<0){const R=_e(m);R.length>0&&(h-=Lr(-h,R)),fe(i,h)}}),xe(L(c,he(e)),([h,y])=>{h<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},Ve.ERROR)});const _=Ue(s);J(L(s,he(f),U(([h,y])=>{const R=y.groupIndices.length>0,j=[],O=y.lastSize;if(R){const z=Ht(y.sizeTree,0);let C=0,M=0;for(;C<h;){const G=y.groupIndices[M],E=y.groupIndices.length===M+1?1/0:y.groupIndices[M+1]-G-1;j.push({endIndex:G,size:z,startIndex:G}),j.push({endIndex:G+1+E-1,size:O,startIndex:G+1}),M++,C+=E+1}const P=bt(y.sizeTree);return C!==h&&P.shift(),P.reduce((G,{k:E,v:B})=>{let F=G.ranges;return G.prevSize!==0&&(F=[...G.ranges,{endIndex:E+h-1,size:G.prevSize,startIndex:G.prevIndex}]),{prevIndex:E+h,prevSize:B,ranges:F}},{prevIndex:h,prevSize:0,ranges:j}).ranges}return bt(y.sizeTree).reduce((z,{k:C,v:M})=>({prevIndex:C+h,prevSize:M,ranges:[...z.ranges,{endIndex:C+h-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const I=Ue(L(i,he(f,w),U(([h,{offsetTree:y},R])=>{const j=-h;return Ft(j,y,R)})));return J(L(i,he(f,w),U(([h,y,R])=>{if(y.groupIndices.length>0){if(ve(y.sizeTree))return y;let j=_t();const O=_e(m);let z=0,C=0,M=0;for(;z<-h;){M=O[C];const P=O[C+1]-M-1;C++,z+=P+1}if(j=bt(y.sizeTree).reduce((P,{k:G,v:E})=>qe(P,Math.max(0,G+h),E),j),z!==-h){const P=Ht(y.sizeTree,M);j=qe(j,0,P);const G=rt(y.sizeTree,-h+1)[1];j=qe(j,1,G)}return{...y,sizeTree:j,...rr(y.offsetTree,0,j,R)}}else{const j=bt(y.sizeTree).reduce((O,{k:z,v:C})=>qe(O,Math.max(0,z+h),C),_t());return{...y,sizeTree:j,...rr(y.offsetTree,0,j,R)}}})),f),{beforeUnshiftWith:_,data:x,defaultItemSize:d,firstItemIndex:c,fixedItemSize:a,fixedGroupSize:S,gap:w,groupIndices:l,heightEstimates:g,itemSize:v,listRefresh:T,shiftWith:i,shiftWithOffset:I,sizeRanges:n,sizes:f,statefulTotalCount:o,totalCount:r,trackItemSizes:k,unshiftWith:s}},ke(ht,dr),{singleton:!0});function yi(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Qo=me(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=ge(),i=ge(),c=Ue(L(s,U(yi)));return J(L(c,U(l=>l.totalCount)),n),J(L(c,U(l=>l.groupIndices)),e),J(L(ze(o,t,r),ie(([l,a])=>bn(a)),U(([l,a,d])=>rt(a.groupOffsetTree,Math.max(l-d,0),"v")[0]),Ie(),U(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(at,De)),gt=me(([{log:e}])=>{const t=H(!1),n=Ue(L(t,ie(r=>r),Ie()));return xe(t,r=>{r&&_e(e)("props updated",{},Ve.DEBUG)}),{didMount:n,propsReady:t}},ke(ht),{singleton:!0}),wi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Zo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!wi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Ut=me(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:c,scrollingInProgress:l,scrollTo:a,smoothScrollTargetReached:d,viewportHeight:S},{log:g}])=>{const v=ge(),x=ge(),w=H(0);let u=null,f=null,m=null;function k(){u&&(u(),u=null),m&&(m(),m=null),f&&(clearTimeout(f),f=null),fe(l,!1)}return J(L(v,he(n,S,r,w,c,i,g),he(e,s,o),U(([[T,_,I,h,y,R,j,O],z,C,M])=>{const P=Zo(T),{align:G,behavior:E,offset:B}=P,F=h-1,$=Yo(P,_,F);let V=Ft($,_.offsetTree,z)+R;G==="end"?(V+=C+rt(_.sizeTree,$)[1]-I+M,$===F&&(V+=j)):G==="center"?V+=(C+rt(_.sizeTree,$)[1]-I+M)/2:V-=y,B&&(V+=B);const le=ae=>{k(),ae?(O("retrying to scroll to",{location:T},Ve.DEBUG),fe(v,T)):(fe(x,!0),O("list did not change, scroll successful",{},Ve.DEBUG))};if(k(),E==="smooth"){let ae=!1;m=xe(t,ye=>{ae=ae||ye}),u=nt(d,()=>{le(ae)})}else u=nt(L(t,Ci(150)),le);return f=setTimeout(()=>{k()},1200),fe(l,!0),O("scrolling from index to",{behavior:E,index:$,top:V},Ve.DEBUG),{behavior:E,top:V}})),a),{scrollTargetReached:x,scrollToIndex:v,topListHeight:w}},ke(at,De,ht),{singleton:!0});function Ci(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function pr(e,t){e==0?t():requestAnimationFrame(()=>{pr(e-1,t)})}function hr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Kt=me(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const c=H(!0),l=H(0),a=H(!0);return J(L(i,he(l),ie(([d,S])=>!!S),it(!1)),c),J(L(i,he(l),ie(([d,S])=>!!S),it(!1)),a),xe(L(ze(t,i),he(c,n,e,a),ie(([[,d],S,{sizeTree:g},v,x])=>d&&(!ve(g)||ar(v))&&!S&&!x),he(l)),([,d])=>{nt(o,()=>{fe(a,!0)}),pr(4,()=>{nt(r,()=>{fe(c,!0)}),fe(s,d)})}),{initialItemFinalLocationReached:a,initialTopMostItemIndex:l,scrolledToInitialItem:c}},ke(at,De,Ut,gt),{singleton:!0});function Jo(e,t){return Math.abs(e-t)<1.01}const Dt="up",At="down",Ii="none",ki={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Ti=0,Xt=me(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=H(!1),c=H(!0),l=ge(),a=ge(),d=H(4),S=H(Ti),g=Fe(L(Jn(L(se(o),vt(1),it(!0)),L(se(o),vt(1),it(!1),Br(100))),Ie()),!1),v=Fe(L(Jn(L(n,it(!0)),L(n,it(!1),Br(200))),Ie()),!1);J(L(ze(se(o),se(S)),U(([m,k])=>m<=k),Ie()),c),J(L(c,ct(50)),a);const x=Ue(L(ze(r,se(s),se(t),se(e),se(d)),lt((m,[{scrollHeight:k,scrollTop:T},_,I,h,y])=>{const R=T+_-k>-y,j={scrollHeight:k,scrollTop:T,viewportHeight:_};if(R){let z,C;return T>m.state.scrollTop?(z="SCROLLED_DOWN",C=m.state.scrollTop-T):(z="SIZE_DECREASED",C=m.state.scrollTop-T||m.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:C,state:j}}let O;return j.scrollHeight>m.state.scrollHeight?O="SIZE_INCREASED":_<m.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":T<m.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:j}},ki),Ie((m,k)=>m&&m.atBottom===k.atBottom))),w=Fe(L(r,lt((m,{scrollHeight:k,scrollTop:T,viewportHeight:_})=>{if(Jo(m.scrollHeight,k))return{changed:!1,jump:0,scrollHeight:k,scrollTop:T};{const I=k-(T+_)<1;return m.scrollTop!==T&&I?{changed:!0,jump:m.scrollTop-T,scrollHeight:k,scrollTop:T}:{changed:!0,jump:0,scrollHeight:k,scrollTop:T}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ie(m=>m.changed),U(m=>m.jump)),0);J(L(x,U(m=>m.atBottom)),i),J(L(i,ct(50)),l);const u=H(At);J(L(r,U(({scrollTop:m})=>m),Ie(),lt((m,k)=>_e(v)?{direction:m.direction,prevScrollTop:k}:{direction:k<m.prevScrollTop?Dt:At,prevScrollTop:k},{direction:At,prevScrollTop:0}),U(m=>m.direction)),u),J(L(r,ct(50),it(Ii)),u);const f=H(0);return J(L(g,ie(m=>!m),it(0)),f),J(L(o,ct(100),he(g),ie(([m,k])=>k),lt(([m,k],[T])=>[k,T],[0,0]),U(([m,k])=>k-m)),f),{atBottomState:x,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:a,atTopThreshold:S,isAtBottom:i,isAtTop:c,isScrolling:g,lastJumpDueToItemResize:w,scrollDirection:u,scrollVelocity:f}},ke(De)),Wt="top",$t="bottom",Gr="none";function Hr(e,t,n){return typeof e=="number"?n===Dt&&t===Wt||n===At&&t===$t?e:0:n===Dt?t===Wt?e.main:e.reverse:t===$t?e.main:e.reverse}function Nr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const gr=me(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=ge(),i=H(0),c=H(0),l=H(0),a=Fe(L(ze(se(r),se(o),se(n),se(s,Nt),se(l),se(i),se(t),se(e),se(c)),U(([d,S,g,[v,x],w,u,f,m,k])=>{const T=d-m,_=u+f,I=Math.max(g-T,0);let h=Gr;const y=Nr(k,Wt),R=Nr(k,$t);return v-=m,v+=g+f,x+=g+f,x-=m,v>d+_-y&&(h=Dt),x<d-I+S+R&&(h=At),h!==Gr?[Math.max(T-g-Hr(w,Wt,h)-y,0),T-I-f+S+Hr(w,$t,h)+R]:null}),ie(d=>d!=null),Ie(Nt)),[0,0]);return{increaseViewportBy:c,listBoundary:s,overscan:l,topListHeight:i,visibleRange:a}},ke(De),{singleton:!0});function Ri(e,t,n){if(bn(t)){const r=Xo(e,t);return[{index:rt(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Mn={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function rn(e,t,n,r,o,s){const{lastIndex:i,lastOffset:c,lastSize:l}=o;let a=0,d=0;if(e.length>0){a=e[0].offset;const w=e[e.length-1];d=w.offset+w.size}const S=n-i,g=c+S*l+(S-1)*r,v=a,x=g-d;return{bottom:d,firstItemIndex:s,items:Fr(e,o,s),offsetBottom:x,offsetTop:a,top:v,topItems:Fr(t,o,s),topListHeight:t.reduce((w,u)=>u.size+w,0),totalCount:n}}function es(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const c=e+i,l=hr(t,c),a=Array.from({length:c}).map((d,S)=>({data:s[S+l],index:S+l,offset:0,size:0}));return rn(a,[],c,o,n,r)}function Fr(e,t,n){if(e.length===0)return[];if(!bn(t))return e.map(a=>({...a,index:a.index+n,originalIndex:a.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Mt(t.groupOffsetTree,r,o);let c,l=0;for(const a of e){(!c||c.end<a.index)&&(c=i.shift(),l=t.groupIndices.indexOf(c.start));let d;a.index===c.start?d={index:l,type:"group"}:d={groupIndex:l,index:a.index-(l+1)+n},s.push({...d,data:a.data,offset:a.offset,originalIndex:a.index,size:a.size})}return s}function Dr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const Ct=me(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:c,visibleRange:l},{initialTopMostItemIndex:a,scrolledToInitialItem:d},{topListHeight:S},g,{didMount:v},{recalcInProgress:x}])=>{const w=H([]),u=H(0),f=ge(),m=H(0);J(s.topItemsIndexes,w);const k=Fe(L(ze(v,x,se(l,Nt),se(o),se(r),se(a),d,se(w),se(t),se(n),se(m),e),ie(([h,y,,R,,,,,,,,j])=>{const O=j&&j.length!==R;return h&&!y&&!O}),U(([,,[h,y],R,j,O,z,C,M,P,G,E])=>{var B,F,$,V;const le=j,{offsetTree:ae,sizeTree:ye}=le,we=_e(u);if(R===0)return{...Mn,totalCount:R};if(h===0&&y===0)return we===0?{...Mn,totalCount:R}:es(we,O,j,M,P,E||[]);if(ve(ye))return we>0?null:rn(Ri(hr(O,R),le,E),[],R,P,le,M);const Z=[];if(C.length>0){const W=C[0],Q=C[C.length-1];let re=0;for(const te of Mt(ye,W,Q)){const ue=te.value,oe=Math.max(te.start,W),be=Math.min(te.end,Q);for(let pe=oe;pe<=be;pe++)Z.push({data:E==null?void 0:E[pe],index:pe,offset:re,size:ue}),re+=ue}}if(!z)return rn([],Z,R,P,le,M);const X=C.length>0?C[C.length-1]+1:0,A=gi(ae,h,y,X);if(A.length===0)return null;const K=R-1,ee=mn([],W=>{for(const Q of A){const re=Q.value;let te=re.offset,ue=Q.start;const oe=re.size;if(re.offset<h){ue+=Math.floor((h-re.offset+P)/(oe+P));const pe=ue-Q.start;te+=pe*oe+pe*P}ue<X&&(te+=(X-ue)*oe,ue=X);const be=Math.min(Q.end,K);for(let pe=ue;pe<=be&&!(te>=y);pe++)W.push({data:E==null?void 0:E[pe],index:pe,offset:te,size:oe}),te+=oe+P}}),N=Dr(G,Wt),ne=Dr(G,$t);if(ee.length>0&&(N>0||ne>0)){const W=ee[0],Q=ee[ee.length-1];if(N>0&&W.index>X){const re=Math.min(N,W.index-X),te=[];let ue=W.offset;for(let oe=W.index-1;oe>=W.index-re;oe--){const be=(F=(B=Mt(ye,oe,oe)[0])==null?void 0:B.value)!=null?F:W.size;ue-=be+P,te.unshift({data:E==null?void 0:E[oe],index:oe,offset:ue,size:be})}ee.unshift(...te)}if(ne>0&&Q.index<K){const re=Math.min(ne,K-Q.index);let te=Q.offset+Q.size+P;for(let ue=Q.index+1;ue<=Q.index+re;ue++){const oe=(V=($=Mt(ye,ue,ue)[0])==null?void 0:$.value)!=null?V:Q.size;ee.push({data:E==null?void 0:E[ue],index:ue,offset:te,size:oe}),te+=oe+P}}}return rn(ee,Z,R,P,le,M)}),ie(h=>h!==null),Ie()),Mn);J(L(e,ie(ar),U(h=>h==null?void 0:h.length)),o),J(L(k,U(h=>h.topListHeight)),S),J(S,c),J(L(k,U(h=>[h.top,h.bottom])),i),J(L(k,U(h=>h.items)),f);const T=Ue(L(k,ie(({items:h})=>h.length>0),he(o,e),ie(([{items:h},y])=>h[h.length-1].originalIndex===y-1),U(([,h,y])=>[h-1,y]),Ie(Nt),U(([h])=>h))),_=Ue(L(k,ct(200),ie(({items:h,topItems:y})=>h.length>0&&h[0].originalIndex===y.length),U(({items:h})=>h[0].index),Ie())),I=Ue(L(k,ie(({items:h})=>h.length>0),U(({items:h})=>{let y=0,R=h.length-1;for(;h[y].type==="group"&&y<R;)y++;for(;h[R].type==="group"&&R>y;)R--;return{endIndex:h[R].index,startIndex:h[y].index}}),Ie(Uo)));return{endReached:T,initialItemCount:u,itemsRendered:f,listState:k,minOverscanItemCount:m,rangeChanged:I,startReached:_,topItemsIndexes:w,...g}},ke(at,Qo,gr,Kt,Ut,Xt,gt,dr),{singleton:!0}),ts=me(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=ge(),i=Fe(L(ze(n,e,r,t,o),U(([c,l,a,d,S])=>c+l+a+d+S.offsetBottom+S.bottom)),0);return J(se(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(De,Ct),{singleton:!0}),_i=me(([{viewportHeight:e},{totalListHeight:t}])=>{const n=H(!1),r=Fe(L(ze(n,e,t),ie(([o])=>o),U(([,o,s])=>Math.max(0,o-s)),ct(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(De,ts),{singleton:!0}),ns=me(()=>({context:H(null)})),Mi=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,rs=me(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:c,viewportHeight:l},{scrollToIndex:a}])=>{const d=ge();return J(L(d,he(t,l,n,s,o,r,c),he(e),U(([[S,g,v,x,w,u,f,m],k])=>{const{align:T,behavior:_,calculateViewLocation:I=Mi,done:h,...y}=S,R=Yo(S,g,x-1),j=Ft(R,g.offsetTree,k)+w+u,O=j+rt(g.sizeTree,R)[1],z=m+u,C=m+v-f,M=I({itemBottom:O,itemTop:j,locationParams:{align:T,behavior:_,...y},viewportBottom:C,viewportTop:z});return M?h&&nt(L(i,ie(P=>!P),vt(_e(i)?1:2)),h):h==null||h(),M}),ie(S=>S!==null)),a),{scrollIntoView:d}},ke(at,De,Ut,Ct,ht),{singleton:!0});function Wr(e){return e?e==="smooth"?"smooth":"auto":!1}const Ei=(e,t)=>typeof e=="function"?Wr(e(t)):t&&Wr(e),ji=me(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:c},{didMount:l,propsReady:a},{log:d},{scrollingInProgress:S},{context:g},{scrollIntoView:v}])=>{const x=H(!1),w=ge();let u=null;function f(_){fe(i,{align:"end",behavior:_,index:"LAST"})}xe(L(ze(L(se(t),vt(1)),l),he(se(x),s,c,S),U(([[_,I],h,y,R,j])=>{let O=I&&R,z="auto";return O&&(z=Ei(h,y||j),O=O&&!!z),{followOutputBehavior:z,shouldFollow:O,totalCount:_}}),ie(({shouldFollow:_})=>_)),({followOutputBehavior:_,totalCount:I})=>{u&&(u(),u=null),_e(n)?requestAnimationFrame(()=>{_e(d)("following output to ",{totalCount:I},Ve.DEBUG),f(_)}):u=nt(e,()=>{_e(d)("following output to ",{totalCount:I},Ve.DEBUG),f(_),u=null})});function m(_){const I=nt(o,h=>{_&&!h.atBottom&&h.notAtBottomBecause==="SIZE_INCREASED"&&!u&&(_e(d)("scrolling to bottom due to increased size",{},Ve.DEBUG),f("auto"))});setTimeout(I,100)}xe(L(ze(se(x),t,a),ie(([_,,I])=>_&&I),lt(({value:_},[,I])=>({refreshed:_===I,value:I}),{refreshed:!1,value:0}),ie(({refreshed:_})=>_),he(x,t)),([,_])=>{_e(c)&&m(_!==!1)}),xe(w,()=>{m(_e(x)!==!1)}),xe(ze(se(x),o),([_,I])=>{_&&!I.atBottom&&I.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const k=H(null),T=ge();return J(Jn(L(se(r),U(_=>{var I;return(I=_==null?void 0:_.length)!=null?I:0})),L(se(t))),T),xe(L(ze(L(T,vt(1)),l),he(se(k),c,S,g),U(([[_,I],h,y,R,j])=>I&&y&&(h==null?void 0:h({context:j,totalCount:_,scrollingInProgress:R}))),ie(_=>!!_),ct(0)),_=>{u&&(u(),u=null),_e(n)?requestAnimationFrame(()=>{_e(d)("scrolling into view",{}),fe(v,_)}):u=nt(e,()=>{_e(d)("scrolling into view",{}),fe(v,_),u=null})}),{autoscrollToBottom:w,followOutput:x,scrollIntoViewOnChange:k}},ke(at,Xt,Ut,Kt,gt,ht,De,ns,rs)),Oi=me(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:c}])=>(J(L(c,he(s),ie(([,l])=>l!==0),he(o,r,t,n,e),U(([[,l],a,d,S,g,v=[]])=>es(l,a,d,S,g,v))),i),{}),ke(at,Kt,Ct,gt),{singleton:!0}),Pi=me(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=H(0);return xe(L(e,he(r),ie(([,o])=>o!==0),U(([,o])=>({top:o}))),o=>{nt(L(n,vt(1),ie(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{fe(t,o)})})}),{initialScrollTop:r}},ke(gt,De,Ct),{singleton:!0}),os=me(([{scrollVelocity:e}])=>{const t=H(!1),n=ge(),r=H(!1);return J(L(e,he(r,t,n),ie(([o,s])=>!!s),U(([o,s,i,c])=>{const{enter:l,exit:a}=s;if(i){if(a(o,c))return!1}else if(l(o,c))return!0;return i}),Ie()),t),xe(L(ze(t,e,n),he(r)),([[o,s,i],c])=>{o&&c&&c.change&&c.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Xt),{singleton:!0}),mr=me(([{scrollContainerState:e,scrollTo:t}])=>{const n=ge(),r=ge(),o=ge(),s=H(!1),i=H(void 0);return J(L(ze(n,r),U(([{scrollHeight:c,scrollTop:l,viewportHeight:a},{offsetTop:d}])=>({scrollHeight:c,scrollTop:Math.max(0,l-d),viewportHeight:a}))),e),J(L(t,he(r),U(([c,{offsetTop:l}])=>({...c,top:c.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(De)),Bi=me(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:c,windowViewportRect:l}])=>{const a=ge(),d=H(void 0),S=H(null),g=H(null);return J(c,S),J(l,g),xe(L(a,he(t,r,i,S,g,n)),([v,x,w,u,f,m,k])=>{const T=bi(x.sizeTree);u&&f!==null&&m!==null&&(w=f.scrollTop-m.offsetTop),w-=k,v({ranges:T,scrollTop:w})}),J(L(d,ie(ar),U(zi)),o),J(L(s,he(d),ie(([,v])=>v!==void 0),Ie(),U(([,v])=>v.ranges)),e),{getState:a,restoreStateFrom:d}},ke(at,De,Kt,gt,mr));function zi(e){return{align:"start",index:0,offset:e.scrollTop}}const Ai=me(([{topItemsIndexes:e}])=>{const t=H(0);return J(L(t,ie(n=>n>=0),U(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(Ct));function ss(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Li=ss(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Gi=me(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:c},{listState:l},{beforeUnshiftWith:a,gap:d,shiftWithOffset:S,sizes:g},{log:v},{recalcInProgress:x}])=>{const w=Ue(L(l,he(i),lt(([,f,m,k],[{bottom:T,items:_,offsetBottom:I,totalCount:h},y])=>{const R=T+I;let j=0;return m===h&&f.length>0&&_.length>0&&(_[0].originalIndex===0&&f[0].originalIndex===0||(j=R-k,j!==0&&(j+=y))),[j,_,h,R]},[0,[],0,0]),ie(([f])=>f!==0),he(r,c,n,o,v,x),ie(([,f,m,k,,,T])=>!T&&!k&&f!==0&&m===Dt),U(([[f],,,,,m])=>(m("Upward scrolling compensation",{amount:f},Ve.DEBUG),f))));function u(f){f>0?(fe(t,{behavior:"auto",top:-f}),fe(e,0)):(fe(e,0),fe(t,{behavior:"auto",top:-f}))}return xe(L(w,he(e,s)),([f,m,k])=>{k&&Li()?fe(e,m-f):u(-f)}),xe(L(ze(Fe(s,!1),e,x),ie(([f,m,k])=>!f&&!k&&m!==0),U(([f,m])=>m),ct(1)),u),J(L(S,U(f=>({top:-f}))),t),xe(L(a,he(g,d),U(([f,{groupIndices:m,lastSize:k,sizeTree:T},_])=>{function I(h){return h*(k+_)}if(m.length===0)return I(f);{let h=0;const y=Ht(T,0);let R=0,j=0;for(;R<f;){R++,h+=y;let O=m.length===j+1?1/0:m[j+1]-m[j]-1;R+O>f&&(h-=y,O=f-R+1),R+=O,h+=I(O),j++}return h}})),f=>{fe(e,f),requestAnimationFrame(()=>{fe(t,{top:f}),requestAnimationFrame(()=>{fe(e,0),fe(x,!1)})})}),{deviation:e}},ke(De,Xt,Ct,at,ht,dr)),Hi=me(([e,t,n,r,o,s,i,c,l,a,d])=>({...e,...t,...n,...r,...o,...s,...i,...c,...l,...a,...d}),ke(gr,Oi,gt,os,ts,Pi,_i,mr,rs,ht,ns)),is=me(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:c,itemSize:l,sizeRanges:a,sizes:d,statefulTotalCount:S,totalCount:g,trackItemSizes:v},{initialItemFinalLocationReached:x,initialTopMostItemIndex:w,scrolledToInitialItem:u},f,m,k,T,{scrollToIndex:_},I,{topItemCount:h},{groupCounts:y},R])=>{const{listState:j,minOverscanItemCount:O,topItemsIndexes:z,rangeChanged:C,...M}=T;return J(C,R.scrollSeekRangeChanged),J(L(R.windowViewportRect,U(P=>P.visibleHeight)),f.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:y,heightEstimates:c,initialItemFinalLocationReached:x,initialTopMostItemIndex:w,scrolledToInitialItem:u,sizeRanges:a,topItemCount:h,topItemsIndexes:z,totalCount:g,...k,groupIndices:i,itemSize:l,listState:j,minOverscanItemCount:O,scrollToIndex:_,statefulTotalCount:S,trackItemSizes:v,rangeChanged:C,...M,...R,...f,sizes:d,...m}},ke(at,Kt,De,Bi,ji,Ct,Ut,Gi,Ai,Qo,Hi));function Ni(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(r,i)||(n[i]=t[i]);return n}const Jt=typeof document<"u"?p.useLayoutEffect:p.useEffect;function ls(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),c=p.createContext({});function l(u,f){u.propsReady&&fe(u.propsReady,!1);for(const m of r){const k=u[t.required[m]];fe(k,f[m])}for(const m of o)if(m in f){const k=u[t.optional[m]];fe(k,f[m])}u.propsReady&&fe(u.propsReady,!0)}function a(u){return s.reduce((f,m)=>(f[m]=k=>{const T=u[t.methods[m]];fe(T,k)},f),{})}function d(u){return i.reduce((f,m)=>(f[m]=ni(u[t.events[m]]),f),{})}const S=p.forwardRef((u,f)=>{const{children:m,...k}=u,[T]=p.useState(()=>mn(oi(e),h=>{l(h,k)})),[_]=p.useState(Pr(d,T));Jt(()=>{for(const h of i)h in k&&xe(_[h],k[h]);return()=>{Object.values(_).map(cr)}},[k,_,T]),Jt(()=>{l(T,k)}),p.useImperativeHandle(f,Or(a(T)));const I=n;return b.jsx(c.Provider,{value:T,children:n?b.jsx(I,{...Ni([...r,...o,...i],k),children:m}):m})}),g=u=>{const f=p.useContext(c);return p.useCallback(m=>{fe(f[u],m)},[f,u])},v=u=>{const f=p.useContext(c)[u],m=p.useCallback(k=>xe(f,k),[f]);return p.useSyncExternalStore(m,()=>_e(f),()=>_e(f))},x=u=>{const f=p.useContext(c)[u],[m,k]=p.useState(Pr(_e,f));return Jt(()=>xe(f,T=>{T!==m&&k(Or(T))}),[f,m]),m},w=p.version.startsWith("18")?v:x;return{Component:S,useEmitter:(u,f)=>{const m=p.useContext(c)[u];Jt(()=>xe(m,f),[f,m])},useEmitterValue:w,usePublisher:g}}const as=p.createContext(void 0),cs=p.createContext(void 0),us=typeof document<"u"?p.useLayoutEffect:p.useEffect;function En(e){return"self"in e}function Fi(e){return"body"in e}function ds(e,t,n,r=Ot,o,s){const i=p.useRef(null),c=p.useRef(null),l=p.useRef(null),a=p.useCallback(g=>{let v,x,w;const u=g.target;if(Fi(u)||En(u)){const m=En(u)?u:u.defaultView;w=s?m.scrollX:m.scrollY,v=s?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight,x=s?m.innerWidth:m.innerHeight}else w=s?u.scrollLeft:u.scrollTop,v=s?u.scrollWidth:u.scrollHeight,x=s?u.offsetWidth:u.offsetHeight;const f=()=>{e({scrollHeight:v,scrollTop:Math.max(w,0),viewportHeight:x})};g.suppressFlushSync?f():zs.flushSync(f),c.current!==null&&(w===c.current||w<=0||w===v-x)&&(c.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);p.useEffect(()=>{const g=o||i.current;return r(o||i.current),a({suppressFlushSync:!0,target:g}),g.addEventListener("scroll",a,{passive:!0}),()=>{r(null),g.removeEventListener("scroll",a)}},[i,a,n,r,o]);function d(g){const v=i.current;if(!v||(s?"offsetWidth"in v&&v.offsetWidth===0:"offsetHeight"in v&&v.offsetHeight===0))return;const x=g.behavior==="smooth";let w,u,f;En(v)?(u=Math.max(ft(v.document.documentElement,s?"width":"height"),s?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight),w=s?v.innerWidth:v.innerHeight,f=s?window.scrollX:window.scrollY):(u=v[s?"scrollWidth":"scrollHeight"],w=ft(v,s?"width":"height"),f=v[s?"scrollLeft":"scrollTop"]);const m=u-w;if(g.top=Math.ceil(Math.max(Math.min(m,g.top),0)),Jo(w,u)||g.top===f){e({scrollHeight:u,scrollTop:f,viewportHeight:w}),x&&t(!0);return}x?(c.current=g.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,c.current=null,t(!0)},1e3)):c.current=null,s&&(g={behavior:g.behavior,left:g.top}),v.scrollTo(g)}function S(g){s&&(g={behavior:g.behavior,left:g.top}),i.current.scrollBy(g)}return{scrollByCallback:S,scrollerRef:i,scrollToCallback:d}}const jn="-webkit-sticky",$r="sticky",br=ss(()=>{if(typeof document>"u")return $r;const e=document.createElement("div");return e.style.position=jn,e.style.position===jn?jn:$r});function xr(e){return e}const Di=me(()=>{const e=H(c=>`Item ${c}`),t=H(c=>`Group ${c}`),n=H({}),r=H(xr),o=H("div"),s=H(Ot),i=(c,l=null)=>Fe(L(n,U(a=>a[c]),Ie()),l);return{components:n,computeItemKey:r,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),Wi=me(([e,t])=>({...e,...t}),ke(is,Di)),$i=({height:e})=>b.jsx("div",{style:{height:e}}),Vi={overflowAnchor:"none",position:br(),zIndex:1},fs={overflowAnchor:"none"},qi={...fs,display:"inline-block",height:"100%"},Vr=p.memo(function({showTopList:e=!1}){const t=ce("listState"),n=Ye("sizeRanges"),r=ce("useWindowScroll"),o=ce("customScrollParent"),s=Ye("windowScrollContainerState"),i=Ye("scrollContainerState"),c=o||r?s:i,l=ce("itemContent"),a=ce("context"),d=ce("groupContent"),S=ce("trackItemSizes"),g=ce("itemSize"),v=ce("log"),x=Ye("gap"),w=ce("horizontalDirection"),{callbackRef:u}=li(n,g,S,e?Ot:c,v,x,o,w,ce("skipAnimationFrameInResizeObserver")),[f,m]=p.useState(0);vr("deviation",M=>{f!==M&&m(M)});const k=ce("EmptyPlaceholder"),T=ce("ScrollSeekPlaceholder")||$i,_=ce("ListComponent"),I=ce("ItemComponent"),h=ce("GroupComponent"),y=ce("computeItemKey"),R=ce("isSeeking"),j=ce("groupIndices").length>0,O=ce("alignToBottom"),z=ce("initialItemFinalLocationReached"),C=e?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:f!==0?f:O?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:f!==0?f:O?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...z?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k?b.jsx(k,{...Ne(k,a)}):b.jsx(_,{...Ne(_,a),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:u,style:C,children:(e?t.topItems:t.items).map(M=>{const P=M.originalIndex,G=y(P+t.firstItemIndex,M.data,a);return R?p.createElement(T,{...Ne(T,a),height:M.size,index:M.index,key:G,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?p.createElement(h,{...Ne(h,a),"data-index":P,"data-item-index":M.index,"data-known-size":M.size,key:G,style:Vi},d(M.index,a)):p.createElement(I,{...Ne(I,a),...Yi(I,M.data),"data-index":P,"data-item-group-index":M.groupIndex,"data-item-index":M.index,"data-known-size":M.size,key:G,style:w?qi:fs},j?l(M.index,M.groupIndex,M.data,a):l(M.index,M.data,a))})})}),Ui={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ki={outline:"none",overflowX:"auto",position:"relative"},xn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Xi={position:br(),top:0,width:"100%",zIndex:1};function Ne(e,t){if(typeof e!="string")return{context:t}}function Yi(e,t){return{item:typeof e=="string"?void 0:t}}const Qi=p.memo(function(){const e=ce("HeaderComponent"),t=Ye("headerHeight"),n=ce("HeaderFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null}),Zi=p.memo(function(){const e=ce("FooterComponent"),t=Ye("footerHeight"),n=ce("HeaderFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null});function ps({useEmitter:e,useEmitterValue:t,usePublisher:n}){return p.memo(function({children:r,style:o,context:s,...i}){const c=n("scrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("scrollerRef"),S=t("horizontalDirection")||!1,{scrollByCallback:g,scrollerRef:v,scrollToCallback:x}=ds(c,a,l,d,void 0,S);return e("scrollTo",x),e("scrollBy",g),b.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:v,style:{...S?Ki:Ui,...o},tabIndex:0,...i,...Ne(l,s),children:r})})}function hs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return p.memo(function({children:r,style:o,context:s,...i}){const c=n("windowScrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("totalListHeight"),S=t("deviation"),g=t("customScrollParent"),v=p.useRef(null),x=t("scrollerRef"),{scrollByCallback:w,scrollerRef:u,scrollToCallback:f}=ds(c,a,l,x,g);return us(()=>{var m;return u.current=g||((m=v.current)==null?void 0:m.ownerDocument.defaultView),()=>{u.current=null}},[u,g]),e("windowScrollTo",f),e("scrollBy",w),b.jsx(l,{ref:v,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d!==0?{height:d+S}:{}},...i,...Ne(l,s),children:r})})}const Ji=({children:e})=>{const t=p.useContext(as),n=Ye("viewportHeight"),r=Ye("fixedItemHeight"),o=ce("alignToBottom"),s=ce("horizontalDirection"),i=p.useMemo(()=>Ho(n,l=>ft(l,s?"width":"height")),[n,s]),c=wt(i,!0,ce("skipAnimationFrameInResizeObserver"));return p.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),b.jsx("div",{"data-viewport-type":"element",ref:c,style:xn(o),children:e})},el=({children:e})=>{const t=p.useContext(as),n=Ye("windowViewportRect"),r=Ye("fixedItemHeight"),o=ce("customScrollParent"),s=Fo(n,o,ce("skipAnimationFrameInResizeObserver")),i=ce("alignToBottom");return p.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),b.jsx("div",{"data-viewport-type":"window",ref:s,style:xn(i),children:e})},tl=({children:e})=>{const t=ce("TopItemListComponent")||"div",n=ce("headerHeight"),r={...Xi,marginTop:`${n}px`},o=ce("context");return b.jsx(t,{style:r,...Ne(t,o),children:e})},nl=p.memo(function(e){const t=ce("useWindowScroll"),n=ce("topItemsIndexes").length>0,r=ce("customScrollParent"),o=ce("context");return b.jsxs(r||t?sl:ol,{...e,context:o,children:[n&&b.jsx(tl,{children:b.jsx(Vr,{showTopList:!0})}),b.jsxs(r||t?el:Ji,{children:[b.jsx(Qi,{}),b.jsx(Vr,{}),b.jsx(Zi,{})]})]})}),{Component:rl,useEmitter:vr,useEmitterValue:ce,usePublisher:Ye}=ls(Wi,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},nl),ol=ps({useEmitter:vr,useEmitterValue:ce,usePublisher:Ye}),sl=hs({useEmitter:vr,useEmitterValue:ce,usePublisher:Ye}),il=rl,ll=me(()=>{const e=H(a=>b.jsxs("td",{children:["Item $",a]})),t=H(null),n=H(a=>b.jsxs("td",{colSpan:1e3,children:["Group ",a]})),r=H(null),o=H(null),s=H({}),i=H(xr),c=H(Ot),l=(a,d=null)=>Fe(L(s,U(S=>S[a]),Ie()),d);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ke(is,ll);br();const qr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},al={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Ur,floor:ln,max:Lt,min:On,round:Kr}=Math;function Xr(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function cl(e){return{...al,items:e}}function en(e,t){return e&&e.width===t.width&&e.height===t.height}function ul(e,t){return e&&e.column===t.column&&e.row===t.row}const dl=me(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:c,scrollTo:l,scrollTop:a,smoothScrollTargetReached:d,viewportHeight:S},g,v,{didMount:x,propsReady:w},{customScrollParent:u,useWindowScroll:f,windowScrollContainerState:m,windowScrollTo:k,windowViewportRect:T},_])=>{const I=H(0),h=H(0),y=H(qr),R=H({height:0,width:0}),j=H({height:0,width:0}),O=ge(),z=ge(),C=H(0),M=H(null),P=H({column:0,row:0}),G=ge(),E=ge(),B=H(!1),F=H(0),$=H(!0),V=H(!1),le=H(!1);xe(L(x,he(F),ie(([A,K])=>!!K)),()=>{fe($,!1)}),xe(L(ze(x,$,j,R,F,V),ie(([A,K,ee,N,,ne])=>A&&!K&&ee.height!==0&&N.height!==0&&!ne)),([,,,,A])=>{fe(V,!0),pr(1,()=>{fe(O,A)}),nt(L(a),()=>{fe(t,[0,0]),fe($,!0)})}),J(L(E,ie(A=>A!=null&&A.scrollTop>0),it(0)),h),xe(L(x,he(E),ie(([,A])=>A!=null)),([,A])=>{A&&(fe(R,A.viewport),fe(j,A.item),fe(P,A.gap),A.scrollTop>0&&(fe(B,!0),nt(L(a,vt(1)),K=>{fe(B,!1)}),fe(l,{top:A.scrollTop})))}),J(L(R,U(({height:A})=>A)),S),J(L(ze(se(R,en),se(j,en),se(P,(A,K)=>A&&A.column===K.column&&A.row===K.row),se(a)),U(([A,K,ee,N])=>({gap:ee,item:K,scrollTop:N,viewport:A}))),G),J(L(ze(se(I),r,se(P,ul),se(j,en),se(R,en),se(M),se(h),se(B),se($),se(F)),ie(([,,,,,,,A])=>!A),U(([A,[K,ee],N,ne,W,Q,re,,te,ue])=>{const{column:oe,row:be}=N,{height:pe,width:Se}=ne,{width:Te}=W;if(re===0&&(A===0||Te===0))return qr;if(Se===0){const ut=hr(ue,A),Pt=ut+Math.max(re-1,0);return cl(Xr(ut,Pt,Q))}const Be=gs(Te,Se,oe);let Ee,Ge;te?K===0&&ee===0&&re>0?(Ee=0,Ge=re-1):(Ee=Be*ln((K+be)/(pe+be)),Ge=Be*Ur((ee+be)/(pe+be))-1,Ge=On(A-1,Lt(Ge,Be-1)),Ee=On(Ge,Lt(0,Ee))):(Ee=0,Ge=-1);const ot=Xr(Ee,Ge,Q),{bottom:We,top:Oe}=Yr(W,N,ne,ot),Je=Ur(A/Be),Ke=Je*pe+(Je-1)*be-We;return{bottom:We,itemHeight:pe,items:ot,itemWidth:Se,offsetBottom:Ke,offsetTop:Oe,top:Oe}})),y),J(L(M,ie(A=>A!==null),U(A=>A.length)),I),J(L(ze(R,j,y,P),ie(([A,K,{items:ee}])=>ee.length>0&&K.height!==0&&A.height!==0),U(([A,K,{items:ee},N])=>{const{bottom:ne,top:W}=Yr(A,N,K,ee);return[W,ne]}),Ie(Nt)),t);const ae=H(!1);J(L(a,he(ae),U(([A,K])=>K||A!==0)),ae);const ye=Ue(L(ze(y,I),ie(([{items:A}])=>A.length>0),he(ae),ie(([[A,K],ee])=>{const N=A.items[A.items.length-1].index===K-1;return(ee||A.bottom>0&&A.itemHeight>0&&A.offsetBottom===0&&A.items.length===K)&&N}),U(([[,A]])=>A-1),Ie())),we=Ue(L(se(y),ie(({items:A})=>A.length>0&&A[0].index===0),it(0),Ie())),Z=Ue(L(se(y),he(B),ie(([{items:A},K])=>A.length>0&&!K),U(([{items:A}])=>({endIndex:A[A.length-1].index,startIndex:A[0].index})),Ie(Uo),ct(0)));J(Z,v.scrollSeekRangeChanged),J(L(O,he(R,j,I,P),U(([A,K,ee,N,ne])=>{const W=Zo(A),{align:Q,behavior:re,offset:te}=W;let ue=W.index;ue==="LAST"&&(ue=N-1),ue=Lt(0,ue,On(N-1,ue));let oe=or(K,ne,ee,ue);return Q==="end"?oe=Kr(oe-K.height+ee.height):Q==="center"&&(oe=Kr(oe-K.height/2+ee.height/2)),te&&(oe+=te),{behavior:re,top:oe}})),l);const X=Fe(L(y,U(A=>A.offsetBottom+A.bottom)),0);return J(L(T,U(A=>({height:A.visibleHeight,width:A.visibleWidth}))),R),{customScrollParent:u,data:M,deviation:C,footerHeight:o,gap:P,headerHeight:s,increaseViewportBy:e,initialItemCount:h,itemDimensions:j,overscan:n,restoreStateFrom:E,scrollBy:i,scrollContainerState:c,scrollHeight:z,scrollTo:l,scrollToIndex:O,scrollTop:a,smoothScrollTargetReached:d,totalCount:I,useWindowScroll:f,viewportDimensions:R,windowScrollContainerState:m,windowScrollTo:k,windowViewportRect:T,...v,gridState:y,horizontalDirection:le,initialTopMostItemIndex:F,totalListHeight:X,...g,endReached:ye,propsReady:w,rangeChanged:Z,startReached:we,stateChanged:G,stateRestoreInProgress:B,..._}},ke(gr,De,Xt,os,gt,mr,ht));function gs(e,t,n){return Lt(1,ln((e+n)/(ln(t)+n)))}function Yr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=or(e,t,n,r[0].index);return{bottom:or(e,t,n,r[r.length-1].index)+o,top:s}}function or(e,t,n,r){const o=gs(e.width,n.width,t.column),s=ln(r/o),i=s*n.height+Lt(0,s-1)*t.row;return i>0?i+t.row:i}const fl=me(()=>{const e=H(S=>`Item ${S}`),t=H({}),n=H(null),r=H("virtuoso-grid-item"),o=H("virtuoso-grid-list"),s=H(xr),i=H("div"),c=H(Ot),l=(S,g=null)=>Fe(L(t,U(v=>v[S]),Ie()),g),a=H(!1),d=H(!1);return J(se(d),a),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:a,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),pl=me(([e,t])=>({...e,...t}),ke(dl,fl)),hl=p.memo(function(){const e=Re("gridState"),t=Re("listClassName"),n=Re("itemClassName"),r=Re("itemContent"),o=Re("computeItemKey"),s=Re("isSeeking"),i=Qe("scrollHeight"),c=Re("ItemComponent"),l=Re("ListComponent"),a=Re("ScrollSeekPlaceholder"),d=Re("context"),S=Qe("itemDimensions"),g=Qe("gap"),v=Re("log"),x=Re("stateRestoreInProgress"),w=Qe("reportReadyState"),u=wt(p.useMemo(()=>f=>{const m=f.parentElement.parentElement.scrollHeight;i(m);const k=f.firstChild;if(k){const{height:T,width:_}=k.getBoundingClientRect();S({height:T,width:_})}g({column:Qr("column-gap",getComputedStyle(f).columnGap,v),row:Qr("row-gap",getComputedStyle(f).rowGap,v)})},[i,S,g,v]),!0,!1);return us(()=>{e.itemHeight>0&&e.itemWidth>0&&w(!0)},[e]),x?null:b.jsx(l,{className:t,ref:u,...Ne(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(f=>{const m=o(f.index,f.data,d);return s?b.jsx(a,{...Ne(a,d),height:e.itemHeight,index:f.index,width:e.itemWidth},m):p.createElement(c,{...Ne(c,d),className:n,"data-index":f.index,key:m},r(f.index,f.data,d))})})}),gl=p.memo(function(){const e=Re("HeaderComponent"),t=Qe("headerHeight"),n=Re("headerFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Re("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null}),ml=p.memo(function(){const e=Re("FooterComponent"),t=Qe("footerHeight"),n=Re("headerFooterTag"),r=wt(p.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Re("context");return e?b.jsx(n,{ref:r,children:b.jsx(e,{...Ne(e,o)})}):null}),bl=({children:e})=>{const t=p.useContext(cs),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=wt(p.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return p.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),b.jsx("div",{ref:o,style:xn(!1),children:e})},xl=({children:e})=>{const t=p.useContext(cs),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Re("customScrollParent"),s=Fo(n,o,!1);return p.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),b.jsx("div",{ref:s,style:xn(!1),children:e})},vl=p.memo(function({...e}){const t=Re("useWindowScroll"),n=Re("customScrollParent"),r=n||t?yl:Sl,o=n||t?xl:bl,s=Re("context");return b.jsx(r,{...e,...Ne(r,s),children:b.jsxs(o,{children:[b.jsx(gl,{}),b.jsx(hl,{}),b.jsx(ml,{})]})})}),{useEmitter:ms,useEmitterValue:Re,usePublisher:Qe}=ls(pl,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},vl),Sl=ps({useEmitter:ms,useEmitterValue:Re,usePublisher:Qe}),yl=hs({useEmitter:ms,useEmitterValue:Re,usePublisher:Qe});function Qr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}const vn=p.createContext(void 0);function Ce(e,t){const n=p.useContext(vn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return pn(n,e,t)}function an(){const e=p.useContext(vn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const wl="_run_zzb61_3",Cl="_runWrap_zzb61_7",Il="_highlight_zzb61_13",kl="_highlightleft_zzb61_14",Tl="_highlightright_zzb61_15",Rl="_highlightcenter_zzb61_16",_l="_underline_zzb61_48",Ml="_underlineleft_zzb61_49",El="_underlineright_zzb61_50",jl="_underlinecenter_zzb61_51",st={run:wl,runWrap:Cl,highlight:Il,highlightleft:kl,highlightright:Tl,highlightcenter:Rl,underline:_l,underlineleft:Ml,underlineright:El,underlinecenter:jl},Zr=e=>Symbol.iterator in e,Jr=e=>"entries"in e,eo=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},Ol=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let o=n.next(),s=r.next();for(;!o.done&&!s.done;){if(!Object.is(o.value,s.value))return!1;o=n.next(),s=r.next()}return!!o.done&&!!s.done};function Pl(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Zr(e)&&Zr(t)?Jr(e)&&Jr(t)?eo(e,t):Ol(e,t):eo({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Vt(e){const t=p.useRef(void 0);return n=>{const r=e(n);return Pl(t.current,r)?t.current:t.current=r}}function Bl(e){const t=e.replace("#",""),n=parseInt(t.length===3?t.repeat(2):t,16),r=n>>16&255,o=n>>8&255,s=n&255;return{r,g:o,b:s}}function zl(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const Al=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),bs=p.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=Ce(O=>O.setClipIndex),i=Ce(O=>O.seek),c=q(O=>O.setCurrentGlobalRunIndex),l=an(),a=q(O=>O.rangeStartGI),d=q(O=>O.rangeEndGI),S=q(O=>O.setRange),g=a!=null&&d!=null,v=p.useCallback(O=>{var F;const z=(F=O.target)==null?void 0:F.closest("[data-g]");if(!z)return;const C=Number(z.dataset.g),M=C-r;if(M<0||M>=t.length)return;const P=t[M],G=P.text??"";if(!G.trim()||!/[가-힣a-zA-Z0-9]/.test(G))return;c(C,"program");const E=P.audioChunkIndex,B=P.audioTimeMs;E!=null&&B!=null&&(s(E),i(B))},[t,r,i,s,c]),x=p.useRef(null),w=p.useRef(!1),u=p.useRef({x:0,y:0}),f=p.useCallback(O=>{var P;const z=(P=O.target)==null?void 0:P.closest("[data-g]");if(!z)return;const C=Number(z.dataset.g),M=C-r;M<0||M>=t.length||(w.current=!1,u.current={x:O.clientX,y:O.clientY},x.current&&(window.clearTimeout(x.current),x.current=null),x.current=window.setTimeout(()=>{l.getState().status!=="playing"&&(S(C,C),w.current=!0,x.current=null)},800))},[t,r,S,l]),m=p.useCallback(()=>{x.current&&(window.clearTimeout(x.current),x.current=null)},[]),k=p.useCallback(O=>{if(!x.current)return;const z=O.clientX-u.current.x,C=O.clientY-u.current.y;(Math.abs(z)>5||Math.abs(C)>5)&&m()},[m]),T=p.useCallback(()=>{m()},[m]),_=m,I=m,h=q(O=>O.clearRange),y=p.useCallback(O=>{var M;if(w.current){w.current=!1;return}const z=(M=O.target)==null?void 0:M.closest("[data-g]");if(!z)return;const C=Number(z.dataset.g);isNaN(C)||g&&a!=null&&d!=null&&(h(),O.stopPropagation())},[g,a,d,h]),R=o,j=r+t.length-1;return b.jsx("span",{onClick:y,onDoubleClick:v,onPointerDown:f,onPointerMove:k,onPointerUp:T,onPointerCancel:_,onPointerLeave:I,children:R.map((O,z)=>b.jsx(Gl,{ns:n,group:O,runs:t,paraLastG:j,rangeStartGI:a,rangeEndGI:d},`${n}/grp:${z}-${O.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Ll=p.memo(function(){const t=p.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=Y(Vt(t));return n.showSplit?b.jsxs(b.Fragment,{children:[b.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}}),n.slash&&b.jsx("span",{children:" / "}),b.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}})]}):null}),Gl=p.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const c=p.useCallback(u=>{const f=u.currentGlobalRunIndex;return f!=null&&f>=n.startG&&f<=n.endG},[n]),l=q(Vt(c)),a=p.useCallback(u=>l?{showPointer:u.showPointer,pointerStyle:u.pointerStyle,pointerColor:u.pointerColor}:Al,[l]),d=Y(Vt(a)),S=n.r0??0,g=n.len??Math.max(0,n.endG-n.startG+1),v=l&&d.showPointer&&d.pointerStyle!=="underline",x=l&&d.showPointer&&d.pointerStyle==="underline",w=v||x?{"--hl-color":d.pointerColor,"--ul-color":d.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return b.jsx(b.Fragment,{children:Array.from({length:g}).map((u,f)=>{const k=r[S+f],T=n.startG+f,_=`${t}/run:${T}`,I=!!k.split&&T!==o;let h=`${st.runWrap}`;return v&&(g===1?h+=` ${st.highlight}`:f===0?h+=` ${st.highlightleft}`:f+1===g?h+=` ${st.highlightright}`:h+=` ${st.highlightcenter}`),x&&(g===1?h+=` ${st.underline}`:f===0?h+=` ${st.underlineleft}`:f+1===g?h+=` ${st.underlineright}`:h+=` ${st.underlinecenter}`),b.jsxs(p.Fragment,{children:[b.jsx("span",{className:h,style:w,children:b.jsx(Hl,{gi:n.startG,g:T,run:k,active:l,pointerCfg:d,isInRange:s!=null&&i!=null&&T>=s&&T<=i})}),I&&b.jsx(Ll,{})]},_)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Hl=p.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const c=p.useMemo(()=>{const l={whiteSpace:"pre-wrap"};if(r.bold&&(l.fontWeight=700),r.italic&&(l.fontStyle="italic"),r.underline&&(l.textDecoration="underline"),o&&s.showPointer){const a=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=a;const d=a.startsWith("#")?Bl(a):zl(a);d&&(.299*d.r+.587*d.g+.114*d.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return b.jsx("span",{className:st.run,style:c,"data-g":n,"data-gi":t,"data-test":(r==null?void 0:r.audioChunkIndex)||-1,children:r.text||""})},(e,t)=>e.g===t.g&&e.run===t.run&&e.active===t.active&&e.pointerCfg===t.pointerCfg&&e.isInRange===t.isInRange);function Nl({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var a;const i=e.list?e.list.level*24:0,c=((a=e.list)==null?void 0:a.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??c;return b.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:i,textAlign:e.textAlign,boxSizing:"border-box"},children:[e.list?b.jsx("span",{style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:l||""}):null,b.jsx(bs,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Fl=p.memo(Nl,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Dl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return no(e,!1);case"upperalpha":case"upperlatin":return no(e,!0);case"lowerroman":return to(e,!1);case"upperroman":return to(e,!0);case"decimalenclosedcircle":return Wl(e);default:return String(e)}}function Wl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function to(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function no(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function Sr(e){const t=new Map;return{next(n,r){const o=`${n}-${r}`,s=(t.get(o)??0)+1;return t.set(o,s),s},reset(){t.clear()}}}function yr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Dl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function $l(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function Vl(e){const t=new Array(e.length+1).fill(0);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function ql(e,t){const n=[];if(!e.length)return n;const r=(o,s,i)=>{n.push({splitIndex:i??o,runs:e.slice(o,s+1),startG:t+o,endG:t+s})};for(let o=0;o<e.length;o++){const s=e[o].splitIndex;if(s===void 0){r(o,o,void 0);continue}let i=o+1;for(;i<e.length&&e[i].splitIndex===s;)i++;r(o,i-1,s),o=i-1}return n}const Ul="_scroller_kqkmq_3",Kl={scroller:Ul},Xl=p.forwardRef(function({className:t,style:n,...r},o){return b.jsx("div",{ref:o,className:`${Kl.scroller}${t?" "+t:""}`,style:n,...r})}),sr=e=>/[가-힣a-zA-Z0-9]/.test(e),Yl=e=>((e==null?void 0:e.textContent)??"").trim(),cn=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Ql(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,c=1/0,l=1/0,a=-1,d=1/0,S=1/0;const g=e.querySelectorAll("[data-g]");for(let v=0;v<g.length;v++){const x=g[v];if(!x||!x.isConnected)continue;const w=Yl(x);if(!w||!sr(w))continue;const u=x.getBoundingClientRect();if(u.height<=r||u.width<=r||u.bottom<=o.top||u.top>=o.bottom)continue;if(u.top<s){const k=Math.abs(u.top-s);(k<d||k===d&&(u.top<S||a!==-1&&Number(x.dataset.g)<a))&&(d=k,a=Number(x.dataset.g),S=u.top);continue}const f=Number(x.dataset.g);if(Number.isNaN(f))continue;u.top<l-n?(l=u.top,c=u.top,i=f):u.top<=l+n&&(u.top<c||u.top===c&&(i===-1||f<i))&&(c=u.top,i=f);const m=Math.abs(u.top-s);(m<d||m===d&&(u.top<S||a!==-1&&f<a))&&(d=m,a=f,S=u.top)}return i!==-1?i:a}const xs=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=cn(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=cn(e,t)}return s},ro=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const c of o){const l=c.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const a=Number(c.dataset.g);Number.isNaN(a)||(a<s&&(s=a),a>i&&(i=a))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},Zl=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=cn(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),c=s.height*n,l=i.top-(s.top+c);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function Jl(e,t=120){return new Promise(n=>{let r=null;const o=()=>{r!=null&&window.clearTimeout(r),r=window.setTimeout(()=>{e.removeEventListener("scroll",o,{capture:!0}),n()},t)};e.addEventListener("scroll",o,{passive:!0,capture:!0}),o()})}const Pn=async(e,t,{topPaddingRatio:n=.15,behavior:r="smooth",quietMs:o=120}={})=>{if(!Zl(e,t,{topPaddingRatio:n,behavior:r}))return!1;await Jl(e,o);const i=cn(e,t);if(!i)return!1;const c=e.getBoundingClientRect(),l=i.getBoundingClientRect(),a=c.height*n,d=c.top+a,S=l.top-d;return Math.abs(S)<=1},dt=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),wr=p.createContext(null);function vs(){const e=p.useContext(wr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function tt(e,t){const n=p.useContext(wr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return pn(n,e,t)}const Ss=()=>{const e=q(r=>r.section),t=vs(),n=e.quizzes;return!n||!n.length?null:b.jsxs("button",{onClick:()=>{t.getState().openFromSection(e)},style:{width:300,background:"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:"pointer",boxShadow:"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease"},children:["퀴즈 풀기 (",n.length,")"]})},ea="_navBtn_1fciy_2",ta="_disabled_1fciy_26",na="_label_1fciy_32",Et={navBtn:ea,disabled:ta,label:na};var ys={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},oo=p.createContext&&p.createContext(ys),ra=["attr","size","title"];function oa(e,t){if(e==null)return{};var n=sa(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sa(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function un(){return un=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},un.apply(this,arguments)}function so(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?so(Object(n),!0).forEach(function(r){ia(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):so(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ia(e,t,n){return t=la(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function la(e){var t=aa(e,"string");return typeof t=="symbol"?t:t+""}function aa(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ws(e){return e&&e.map((t,n)=>p.createElement(t.tag,dn({key:n},t.attr),ws(t.child)))}function Ze(e){return t=>p.createElement(ca,un({attr:dn({},e.attr)},t),ws(e.child))}function ca(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=oa(e,ra),c=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),p.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:dn(dn({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),s&&p.createElement("title",null,s),e.children)};return oo!==void 0?p.createElement(oo.Consumer,null,n=>t(n)):t(ys)}function io(e){return Ze({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function lo(e){return Ze({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const ua=({isIcon:e=!0})=>{const t=q(i=>i.isCanPrev),n=q(i=>i.onSectionNav),r=!t,o=p.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?b.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[b.jsx(io,{size:18}),b.jsx("span",{className:Et.label,children:"이전"})]}):b.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":b.jsxs(b.Fragment,{children:[b.jsx(io,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},fn=({isIcon:e=!0})=>{const t=q(i=>i.isCanNext),n=q(i=>i.onSectionNav),r=!t,o=p.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?b.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[b.jsx(lo,{size:18}),b.jsx("span",{className:Et.label,children:"다음"})]}):b.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":b.jsxs(b.Fragment,{children:["NextSection",b.jsx(lo,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function Cs(e,t){let n=0,r=e.length-1;for(;n<r;){const o=Math.floor((n+r+1)/2);e[o]<=t?n=o:r=o-1}return n}function da({section:e,blocks:t,nsPrefix:n}){const r=p.useMemo(()=>{const R=[],j=Sr();return t.forEach((O,z)=>{O.type==="paragraph"&&(R[z]=yr(O,j))}),R},[t]),o=q(R=>{var j;return((j=R.layout)==null?void 0:j.prefix)??[]}),s=q(R=>{var j;return((j=R.derivedNav)==null?void 0:j.splitGroupsPerBlock)??[]}),i=Y(R=>R.marginX),c=Y(R=>R.viewportHeight),l=p.useRef({start:0,end:0}),a=p.useCallback(R=>{const j=t[R],O=`${n}blk-${j.id}`;if(j.type==="image"){const{src:M,alt:P,width:G,height:E}=j,B=G&&E?`${G} / ${E}`:"4 / 3",F=R>=l.current.start&&R<=l.current.end,$=c>80?Math.floor((c-80)*.6):void 0;return b.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[b.jsx("div",{style:{position:"relative",width:"100%",maxHeight:$,aspectRatio:B},children:b.jsx("img",{src:M,alt:P||"",loading:F?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),P&&b.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:P})]})}const z=r[R]??void 0,C=s[R];return b.jsx("div",{style:{maxWidth:860,display:"flex"},children:b.jsx(Fl,{block:j,computedMarker:z,ns:O,baseIndex:o[R],sectionId:e.section_id,preGroups:C})})},[t,r,o,n,e,s,c]),d=p.useRef(null),S=p.useCallback(R=>{d.current=R},[]),g=p.useMemo(()=>p.memo(R=>{const{style:j,children:O,...z}=R;return b.jsx("div",{...z,style:j,children:b.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:O})})}),[i]),v=p.useRef(null),x=p.useMemo(()=>t.map(R=>R.id),[t]),[w,u]=p.useState(!1);p.useEffect(()=>{u(!1)},[t]);const f=p.useCallback(()=>{u(!0)},[]),m=p.useCallback(()=>{if(!w)return b.jsx("div",{style:{height:40}});const R=e.quizzes,j=Math.max(80,Math.floor(c*.5));return R&&R.length?b.jsxs("div",{style:{display:"block"},children:[b.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:b.jsx(Ss,{})}),b.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:b.jsx(fn,{isIcon:!1})}),b.jsx("div",{style:{height:j,width:"100%"}})]}):b.jsxs("div",{children:[b.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:b.jsx(fn,{isIcon:!1})}),b.jsx("div",{style:{height:40}})]})},[w,e,c]),k=p.useMemo(()=>({Item:g,Header:()=>b.jsx("div",{style:{height:40}}),Footer:m,Scroller:Xl}),[m,g]),T=p.useCallback(R=>x[R],[x]),_=xt(),[I]=p.useState(()=>_.getState().progress.currentGlobalRunIndex??0),h=p.useMemo(()=>{if(!o.length)return 0;const R=o[o.length-1],j=Math.max(0,Math.min(I,R));return Cs(o,j)},[o,I]);console.log("SectionRenderVirtuoso확인");const y=xt();return p.useEffect(()=>{let R=!1;return(async()=>{let j=d.current;if(!j){for(let M=0;M<20;M++){if(await new Promise(P=>setTimeout(P,50)),R)return;if(j=d.current,j)break}if(!j)return}const O=y.getState().progress.currentGlobalRunIndex,z=y.getState().progress.setSectionLoading,C=O!=null&&O>=0?O:0;await xs(j,C),!R&&(await dt(),await dt(),await dt(),await dt(),!R&&z(!1))})(),()=>{R=!0}},[d,y]),b.jsxs(b.Fragment,{children:[b.jsx(il,{ref:v,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:T,totalCount:t.length,itemContent:a,initialTopMostItemIndex:h,increaseViewportBy:{top:200,bottom:200},endReached:f,components:k,scrollerRef:S}),b.jsx(fa,{scrollContainerRef:d,virtRef:v,prefix:o})]})}const fa=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=q(C=>C.setCurrentGlobalRunIndex),o=q(C=>C.registerSectionScrollApi),s=q(C=>C.currentGlobalRunIndex),i=Ce(C=>C.scrollLock),c=Ce(C=>C.syncToGI),l=yt(),a=p.useRef(!1),d=p.useRef(null),S=p.useRef(null),g=p.useRef(null),v=p.useRef(-1),x=p.useCallback(()=>{if(i)return;d.current=null;const C=S.current;if(!C)return;const M=Ql(C,5);M!==-1&&M!==v.current&&(v.current=M,c(M),r(M,"scroll"))},[i,c,r]),w=p.useCallback(C=>{S.current=C,d.current==null&&(d.current=requestAnimationFrame(x))},[x]),u=p.useCallback(C=>{S.current=C,g.current!=null&&(window.clearTimeout(g.current),g.current=null),g.current=window.setTimeout(()=>{g.current=null,x();const M=v.current;if(M===-1)return;const P=C.scrollTop,G=C.scrollHeight-C.clientHeight,E=G>0?P/G:0;let B=0;const F=C.querySelector(`[data-g="${M}"]`);if(F){const $=C.getBoundingClientRect();B=(F.getBoundingClientRect().top-$.top)/$.height}l.getState().emit({type:"scroll",payload:{scrollTop:P,scrollRatio:E,anchorGI:M,anchorOffsetRatio:B}})},100)},[x,l]),f=p.useRef(!1),m=p.useCallback(C=>{i||a.current&&(f.current||(w(C),u(C)))},[i,w,u]),k=p.useRef(void 0),T=p.useRef(void 0),_=p.useRef(void 0),I=p.useRef(void 0);p.useEffect(()=>{const C=e.current;if(C)return k.current=()=>{a.current=!0},T.current=()=>{a.current=!0},_.current=()=>{a.current=!0},I.current=()=>m(C),C.addEventListener("wheel",k.current,{passive:!0}),C.addEventListener("touchmove",T.current,{passive:!0}),window.addEventListener("keydown",_.current,{passive:!0}),C.addEventListener("scroll",I.current,{passive:!0}),()=>{C.removeEventListener("wheel",k.current),C.removeEventListener("touchmove",T.current),window.removeEventListener("keydown",_.current),C.removeEventListener("scroll",I.current),d.current!=null&&cancelAnimationFrame(d.current),g.current!=null&&(clearTimeout(g.current),g.current=null)}},[m,e]),p.useEffect(()=>{const C=e.current;if(!C||!i)return;const M=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},P=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},G=B=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(B.key)&&(B.preventDefault(),B.stopPropagation(),a.current=!1)},E={overscrollBehavior:C.style.overscrollBehavior,touchAction:C.style.touchAction};return C.style.overscrollBehavior="contain",C.style.touchAction="none",C.addEventListener("wheel",M,{passive:!1}),C.addEventListener("touchmove",P,{passive:!1}),window.addEventListener("keydown",G,{passive:!1}),()=>{C.removeEventListener("wheel",M),C.removeEventListener("touchmove",P),window.removeEventListener("keydown",G),C.style.overscrollBehavior=E.overscrollBehavior,C.style.touchAction=E.touchAction}},[i,e]);const h=p.useRef({first:-1,last:-1}),y=p.useRef(!1),R=p.useCallback(()=>{const C=e.current;if(!C)return;const M=ro(C),P=(M==null?void 0:M.first)??-1,G=(M==null?void 0:M.last)??-1;h.current={first:P,last:G}},[e]),j=p.useRef(!1),O=p.useCallback(()=>{const C=e.current;if(!C||j.current)return;j.current=!0;const M=Math.min(C.scrollTop+Math.floor(C.clientHeight*.6),C.scrollHeight-C.clientHeight);requestAnimationFrame(()=>{C.scrollTo({top:M,behavior:"instant"})})},[e]);p.useEffect(()=>{!y.current&&i&&(j.current=!1,R()),y.current=i},[i,R]),p.useEffect(()=>{if(i!==!0)return;const C=e.current;if(!C)return;const{first:M,last:P}=h.current;if(M===-1||P===-1){O();return}if(C.scrollTop<=1){(async()=>{try{f.current=!0,await Pn(C,s,{behavior:"smooth",topPaddingRatio:.2})}finally{f.current=!1}R()})();return}if(s<M||s>P){async function E(){if(!C)return;const B=C.scrollTop<=1?0:.2;return await Pn(C,s,{behavior:"smooth",topPaddingRatio:B})}E().then(B=>{B?R():O()})}},[i,s,O,R,e]);const z=p.useCallback(()=>{const C=e.current;if(!C)return;function M(Z,X,A=.2,K=.8){const ee=Z.querySelector(`[data-g="${X}"]`);if(!ee)return!1;const N=Z.getBoundingClientRect(),ne=ee.getBoundingClientRect();if(ne.height<=0||N.height<=0)return!1;const W=(ne.top+ne.height/2-N.top)/N.height;return W>=A&&W<=K}const P=Z=>Z==="instant"?"auto":Z,G=Z=>{const X=C.scrollTop,A=C.scrollHeight-C.clientHeight,K=A>0?X/A:0;let ee=0;const N=C.querySelector(`[data-g="${Z}"]`);if(N){const ne=C.getBoundingClientRect();ee=(N.getBoundingClientRect().top-ne.top)/ne.height}l.getState().emit({type:"scroll",payload:{scrollTop:X,scrollRatio:K,anchorGI:Z,anchorOffsetRatio:ee}})},E=async(Z,X="smooth")=>{var K;const A=Cs(n,Z);(K=t.current)==null||K.scrollToIndex({index:A,align:"start",behavior:P(X)}),await xs(C,Z)},B=()=>new Promise(Z=>requestAnimationFrame(()=>Z())),F=async Z=>{if(M(C,Z,.1,.7))return G(Z),!0;f.current=!0;const X=C.querySelector(`[data-g="${Z}"]`),A=C.getBoundingClientRect();let K=C.scrollTop<=1?0:.1;if(X){const N=X.getBoundingClientRect();K=((N.top+N.height/2-A.top)/A.height>.5,.15)}const ee=!!X;return ee?(await Pn(C,Z,{behavior:"smooth",topPaddingRatio:K}),await B()):ee||await E(Z,"auto"),f.current=!1,G(Z),M(C,Z,.1,.7)},$=async Z=>F(Z);return{ensureVisibleGI:F,scrollToGI:$,getVisibleRange:()=>ro(C),getScrollTop:()=>C.scrollTop,setScrollTop:Z=>{C.scrollTop=Z},getAnchorOffsetRatio:Z=>{const X=C.querySelector(`[data-g="${Z}"]`);if(!X)return 0;const A=X.getBoundingClientRect(),K=C.getBoundingClientRect();return(A.top-K.top)/K.height},scrollToGIAtOffset:async(Z,X)=>{await $(Z),await new Promise(re=>requestAnimationFrame(()=>requestAnimationFrame(re)));const A=C.querySelector(`[data-g="${Z}"]`);if(!A)return;const K=A.getBoundingClientRect(),ee=C.getBoundingClientRect(),N=ee.height>0?ee.height/C.clientHeight:1,ne=(K.top-ee.top)/N,W=X*C.clientHeight,Q=ne-W;C.scrollTop=C.scrollTop+Q}}},[e,t,n,l]);return p.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(z()),()=>o(void 0)),[z,o]),null};function pa(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function ha(){const e=q(x=>x.section),t=Y(x=>x.theme),n=Y(x=>x.fontFamily),r=Y(x=>x.fontSizePx),o=Y(x=>x.lineHeight),s=on[t],{blocks:i,nsPrefix:c}=p.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=hn(),a=p.useCallback(()=>{const{isSettingsOpen:x,setSettingsOpen:w,toggleOverlays:u}=l.getState();x?w(!1):u()},[l]),{onClick:d,onDoubleClick:S}=Ks({onSingle:a,onDouble:()=>{},delay:250,shouldIgnoreTarget:pa}),g=p.useMemo(()=>({flex:1,fontFamily:n,background:s.bg,color:s.fg,fontSize:r,lineHeight:o,overflow:"hidden",WebkitTextSizeAdjust:"none",MozTextSizeAdjust:"none",textSizeAdjust:"none"}),[n,s.bg,s.fg,r,o]),v=p.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),b.jsx("div",{onClick:d,onDoubleClick:S,style:g,children:b.jsx("div",{style:v,children:b.jsx(da,{section:e,blocks:i,nsPrefix:c})})})}function ga(e){return Ze({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM12.293 7.293a1 1 0 011.414 0L15 8.586l1.293-1.293a1 1 0 111.414 1.414L16.414 10l1.293 1.293a1 1 0 01-1.414 1.414L15 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L13.586 10l-1.293-1.293a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(e)}function ma(e){return Ze({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z",clipRule:"evenodd"},child:[]}]})(e)}function ba(e){return Ze({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(e)}function xa(e){return Ze({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3h-3z"},child:[]}]})(e)}function va(e){return Ze({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z",opacity:".87"},child:[]},{tag:"path",attr:{d:"M17.51 3.87 15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"},child:[]}]})(e)}const Sa="_wrap_1hfub_4",ya="_visible_1hfub_25",wa="_compact_1hfub_31",Ca="_row2_1hfub_34",Ia="_controls_1hfub_44",ka="_row1_1hfub_52",Ta="_groupExpand_1hfub_80",Ra="_groupPlayback_1hfub_81",_a="_groupSpeed_1hfub_82",Ma="_groupFeatures_1hfub_83",Ea="_groupNav_1hfub_84",ja="_btn_1hfub_116",Oa="_btnForbidden_1hfub_141",Pa="_btnActive_1hfub_147",Ba="_label_1hfub_158",za="_compactBtn_1hfub_168",je={wrap:Sa,visible:ya,compact:wa,row2:Ca,controls:Ia,row1:ka,groupExpand:Ta,groupPlayback:Ra,groupSpeed:_a,groupFeatures:Ma,groupNav:Ea,btn:ja,btnForbidden:Oa,btnActive:Pa,label:Ba,compactBtn:za},Aa=p.memo(function(){const t=p.useRef(null),n=p.useContext(St),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=Ce(y=>y.status),s=Ce(y=>y.currentTimeMs),i=Ce(y=>y.currentClip),c=Ce(y=>y.playbackKind),l=Y(y=>y.muteAudio),a=Y(y=>y.audioSpeed),d=Ce(y=>y.getClipSrc),S=Ce(y=>y._onTime),g=Ce(y=>y._onEnded),v=Ce(y=>y._onError),x=q(y=>y.setCurrentGlobalRunIndex),w=q(y=>y.getSectionScrollApi),u=q(y=>y.snapToReadable),f=q(y=>y.edgeReadable),m=p.useRef(null),k=p.useRef(null),T=p.useRef(!1),_=p.useRef(null);p.useEffect(()=>{c==="real"&&(T.current=!0)},[c]);const I=p.useMemo(()=>{const y=d(i);if(!y)return null;try{return new URL(y,window.location.href).href}catch{return y}},[i,d]);p.useEffect(()=>{T.current=!0},[I]),p.useEffect(()=>{const y=t.current;if(!y)return;const R=()=>{if(y.paused||y.ended)return;const z=y.currentTime*1e3;T.current&&z===0||(z>0&&(T.current=!1),S(z))},j=()=>{var C,M;g();const z=f(1);typeof z=="number"&&z>=0&&(x(z,"audio"),(M=(C=w())==null?void 0:C.ensureVisibleGI)==null||M.call(C,z))},O=z=>{const C=z.currentTarget;console.warn("Audio error",{networkState:C.networkState,readyState:C.readyState}),v()};return y.addEventListener("timeupdate",R),y.addEventListener("ended",j),y.addEventListener("error",O),()=>{y.removeEventListener("timeupdate",R),y.removeEventListener("ended",j),y.removeEventListener("error",O)}},[S,g,v,f,x,w]),p.useEffect(()=>{if(r)return;const y=t.current;if(!y)return;if(!I){try{y.pause()}catch(z){console.log("pause error",z)}k.current=null;return}const R=y.currentSrc||y.src||null,j=!R||R!==I;if(j){try{y.pause()}catch(z){console.log("pause error",z)}y.src=I;try{y.load()}catch(z){console.log("load error",z)}k.current=I}y.muted=!!l,y.volume=1,y.playbackRate=typeof a=="number"?a:1;const O=async()=>{j&&await new Promise(z=>{let C=!1;const M=()=>{C||(C=!0,y.removeEventListener("loadedmetadata",M),y.removeEventListener("canplay",M),z())};y.addEventListener("loadedmetadata",M),y.addEventListener("canplay",M),y.readyState>=1&&M()});try{await y.play()}catch(z){console.warn("el.play() failed",z)}};if(o==="loading"||o==="playing")O();else try{y.pause()}catch(z){console.log("pause error",z)}},[I,l,o,a,r]),p.useEffect(()=>{if(r)return;const y=t.current;if(!y||c!=="real")return;const R=s/1e3;if(Number.isFinite(R)){if(y.readyState<1){m.current=s;const j=()=>{if(m.current!=null){const O=m.current/1e3;try{y.currentTime=O}catch(z){console.log("currentTime보정 오류",z)}m.current=null}y.removeEventListener("loadedmetadata",j),y.removeEventListener("canplay",j)};y.addEventListener("loadedmetadata",j),y.addEventListener("canplay",j);return}if(Math.abs(y.currentTime-R)>.2)try{y.currentTime=R}catch(j){console.log("currentTime보정오류",j)}}},[s,c,r]);const h=Ce(y=>y.getGIFromCT);return p.useEffect(()=>{var j,O;if(r||c!=="real"||o!=="playing"&&o!=="loading")return;const y=h(i,s);if(y<0)return;const R=u(y);R!==_.current&&(_.current=R,x(R,"audio"),R%5===0&&((O=(j=w())==null?void 0:j.ensureVisibleGI)==null||O.call(j,R)))},[o,i,s,c,h,u,x,w,r]),b.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function La(){return b.jsx(Aa,{})}const Ga="_scrubberWrap_uw0cd_2",Ha="_labels_uw0cd_9",Na="_index_uw0cd_15",Fa="_controls_uw0cd_19",Da="_percent_uw0cd_25",Wa="_range_uw0cd_46",kt={scrubberWrap:Ga,labels:Ha,index:Na,controls:Fa,percent:Da,range:Wa};function $a(){const e=Y(_=>_.isDev),t=q(_=>_.currentGlobalRunIndex),n=q(_=>_.totalRuns),r=q(_=>_.setCurrentGlobalRunIndex),o=q(_=>_.getSectionScrollApi),s=q(_=>_.giToPercentTotal),i=q(_=>_.percentToGITotal),c=q(_=>_.snapToReadable),l=Ce(_=>_.scrollLock),a=Ce(_=>_.pause),d=Ce(_=>_.play),S=Ce(_=>_.syncToGI),[g,v]=p.useState(()=>s(t||0));p.useEffect(()=>{v(s(t||0))},[t,s]);const x=p.useRef(!1),w=p.useMemo(()=>Math.max(0,Math.min(t??0,Math.max(0,(n??1)-1)))+1,[t,n]),u=p.useCallback(()=>{l&&(a(),x.current=!0)},[l,a]),f=p.useCallback(_=>{v(Number(_.currentTarget.value))},[]),m=p.useCallback(async()=>{const _=i(g),I=c(_);a(),r(I,"scrubber-commit"),S(I);const h=o();h!=null&&h.ensureVisibleGI&&await h.ensureVisibleGI(I),x.current&&(x.current=!1,d())},[g,i,c,a,r,S,o,d]),k=p.useMemo(()=>({"--pct":`${g}%`}),[g]),T=p.useMemo(()=>Math.round(g),[g]);return b.jsxs("div",{className:kt.scrubberWrap,children:[e&&b.jsx("div",{className:kt.labels,children:b.jsxs("span",{className:kt.index,children:[w," / ",n||0]})}),b.jsxs("div",{className:kt.controls,children:[b.jsx("input",{type:"range",className:kt.range,min:0,max:100,step:.5,value:g,style:k,onMouseDown:u,onTouchStart:u,onChange:f,onMouseUp:()=>{m()},onTouchEnd:()=>{m()},onKeyUp:_=>_.key==="Enter"||_.key===" "?void m():void 0,"aria-label":"진행률"}),b.jsxs("span",{className:kt.percent,children:[T,"%"]})]})]})}const Va=p.memo($a),qa=p.memo(function(){const t=p.useContext(St),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=Ce(y=>y.playbackKind),o=Ce(y=>y.status),s=Ce(y=>y.fake),i=Y(y=>y.audioSpeed),c=Ce(y=>y.pause),l=q(y=>y.totalRuns),a=q(y=>y.currentGlobalRunIndex),d=q(y=>y.setCurrentGlobalRunIndex),S=q(y=>y.getSectionScrollApi),g=q(y=>y.nextReadableFrom),v=q(y=>y.edgeReadable),x=p.useRef(null),w=p.useRef(null),u=p.useRef(0),f=p.useRef(-1),m=!n&&r==="fake"&&o==="playing",k=Math.max(1,(s==null?void 0:s.totalWords)??1),T=p.useMemo(()=>{const y=200*i;return k/y*6e4},[k,i]),_=p.useMemo(()=>!l||l<=1||T<=0?0:(l-1)/T,[l,T]);p.useEffect(()=>{if(!m)return;const y=Math.max(0,Math.min(a??0,Math.max(0,(l??1)-1)));u.current=y,f.current=y,w.current=null},[m,a,l]);const I=p.useRef(-1);p.useEffect(()=>{if(!l){I.current=-1;return}const y=v(1);I.current=y??-1},[v,l]);const h=p.useCallback(y=>{(async()=>{var G,E;if(!m){x.current=null;return}if(!l||l<=1||_<=0){x.current=null;return}const R=w.current;w.current=y;const j=R==null?0:Math.max(0,y-R),O=l-1;u.current=Math.min(O,u.current+_*j);const z=Math.floor(u.current),C=S(),M=g(z,1);if(M==null){const B=I.current>=0?I.current:z;B!==f.current&&(f.current=B,d(B,"audio"),await((G=C==null?void 0:C.ensureVisibleGI)==null?void 0:G.call(C,B))),c(),x.current=null;return}const P=M;P!==f.current&&(f.current=P,d(P,"audio"),P%5===0&&await((E=C==null?void 0:C.ensureVisibleGI)==null?void 0:E.call(C,P))),x.current=requestAnimationFrame(h)})().catch(console.error)},[m,l,_,g,d,S,c]);return p.useEffect(()=>(m?x.current==null&&(x.current=requestAnimationFrame(h)):(x.current&&(cancelAnimationFrame(x.current),x.current=null),w.current=null),()=>{x.current&&(cancelAnimationFrame(x.current),x.current=null)}),[m,h]),null}),Ua=p.memo(function(){return b.jsx(qa,{})}),Ka="data:image/svg+xml,%3csvg%20width='111'%20height='111'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-435%2011)'%3e%3cpath%20d='M532.723%2046.8125C530.242%2046.8292%20527.8%2047.4292%20525.593%2048.5642%20523.298%2049.7713%20520.952%2050.8767%20518.608%2051.8815%20517.451%2031.9953%20500.391%2016.8128%20480.505%2017.9704%20462.359%2019.0268%20447.834%2033.4215%20446.615%2051.5578L438.476%2048.1353%20438.476%2049.9344C438.473%2054.7251%20441.432%2059.0185%20445.91%2060.721%20446.509%2060.9604%20447.138%2061.1708%20447.767%2061.3801%20448.053%2061.4761%20448.339%2061.5709%20448.622%2061.6692L447.745%2066.7254C447.463%2068.2415%20447.818%2069.8071%20448.728%2071.0521%20449.635%2072.2874%20450.984%2073.1242%20452.493%2073.3877L452.768%2073.4282C453.011%2073.488%20453.259%2073.5198%20453.509%2073.523%20456.31%2073.5182%20458.699%2071.4953%20459.166%2068.7338L459.781%2064.8673C468.886%2066.8727%20478.184%2067.875%20487.508%2067.8562%20493.267%2067.8674%20499.021%2067.5125%20504.736%2066.7937%20504.893%2066.7613%20505.041%2066.7405%20505.184%2066.7231L505.562%2068.8379C505.986%2071.6231%20508.396%2073.6706%20511.213%2073.6375%20511.583%2073.648%20511.953%2073.5977%20512.307%2073.4883%20515.422%2072.958%20517.518%2070.0024%20516.988%2066.8869%20516.984%2066.8688%20516.981%2066.8509%20516.978%2066.833L516.758%2065.6767C522.066%2065.3125%20527.42%2065.3125%20532.607%2065.3125L532.723%2065.3125C537.831%2065.6255%20542.226%2061.7378%20542.539%2056.6292%20542.852%2051.5205%20538.965%2047.1255%20533.856%2046.8125%20533.479%2046.7894%20533.1%2046.7894%20532.723%2046.8125ZM516.326%2052.7256C511.914%2054.5082%20507.352%2055.8913%20502.693%2056.858L492.697%2041.007%20501.916%2026.3469C510.579%2032.4029%20515.911%2042.1631%20516.326%2052.7256ZM500.254%2057.3217C497.133%2057.8531%20493.977%2058.1542%20490.811%2058.2224L487.449%2058.2224C480.061%2058.2766%20472.682%2057.6921%20465.394%2056.4753L474.504%2042.1644%20490.692%2042.1644ZM482.602%2020.2188C488.73%2020.2155%20494.742%2021.8953%20499.981%2025.075L490.693%2039.8507%20474.491%2039.8195%20465.194%2025.0415C470.449%2021.8782%20476.468%2020.2107%20482.602%2020.2188ZM463.254%2026.2995%20472.504%2041.0023%20462.938%2056.0267C458.169%2055.1133%20453.47%2053.8672%20448.875%2052.2977%20449.378%2041.8709%20454.689%2032.2672%20463.254%2026.2995ZM456.876%2068.3719C456.595%2070.0115%20455.173%2071.2097%20453.509%2071.2094%20453.431%2071.2042%20453.354%2071.191%20453.278%2071.1701%20453.133%2071.1343%20452.984%2071.1101%20452.835%2071.0972%20451.94%2070.9264%20451.142%2070.4243%20450.601%2069.6912%20450.063%2068.9533%20449.853%2068.0254%20450.023%2067.1278L450.844%2062.3872%20457.525%2064.2962ZM514.123%2069.8103C513.566%2070.5637%20512.74%2071.0728%20511.817%2071.2313L511.657%2071.2718C511.514%2071.32%20511.363%2071.3392%20511.213%2071.3285%20509.525%2071.3698%20508.075%2070.1378%20507.844%2068.4656L507.486%2066.4688%20514.501%2065.8548%20514.701%2067.2527C514.87%2068.1485%20514.661%2069.0742%20514.123%2069.8103ZM532.723%2063%20532.607%2063C526.955%2063%20521.113%2063%20515.284%2063.4625L515.276%2063.4625%20515.276%2063.4625%20505.9%2064.2904%20504.36%2064.5078C498.77%2065.2064%20493.141%2065.5509%20487.508%2065.5391%20477.952%2065.5601%20468.425%2064.4858%20459.114%2062.3375L450.263%2059.8168%20446.738%2058.5658C443.792%2057.4525%20441.62%2054.9086%20440.982%2051.8237%20454.33%2057.5309%20470.023%2060.5383%20486.577%2060.5383%20486.868%2060.5383%20487.161%2060.5383%20487.452%2060.5383L490.828%2060.5383C500.421%2060.2575%20509.874%2058.1665%20518.689%2054.3755L518.797%2054.3304C521.437%2053.2216%20524.086%2051.9728%20526.649%2050.6235%20528.526%2049.6491%20530.608%2049.1354%20532.723%2049.125%20536.554%2048.8199%20539.908%2051.6785%20540.213%2055.5099%20540.518%2059.3414%20537.659%2062.6949%20533.828%2063%20533.46%2063.0293%20533.091%2063.0293%20532.723%2063Z'/%3e%3cpath%20d='M534.442%2053.75C534.442%2055.0272%20533.407%2056.0625%20532.13%2056.0625%20530.852%2056.0625%20529.817%2055.0272%20529.817%2053.75%20529.817%2052.4728%20530.852%2051.4375%20532.13%2051.4375%20533.407%2051.4375%20534.442%2052.4728%20534.442%2053.75Z'/%3e%3c/g%3e%3c/svg%3e",Xa="data:image/svg+xml,%3csvg%20width='159'%20height='159'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-392%20-84)'%3e%3cpath%20d='M496.776%20189.601C496.122%20189.934%20495.77%20190.663%20495.916%20191.383L499.911%20210.219C500.074%20210.985%20500.75%20211.532%20501.533%20211.531L501.929%20211.531C503.729%20211.515%20505.222%20212.919%20505.319%20214.716%20505.389%20216.544%20503.964%20218.083%20502.136%20218.154%20502.093%20218.155%20502.05%20218.156%20502.006%20218.156L497.503%20218.156C495.941%20218.15%20494.594%20217.058%20494.263%20215.531L490.363%20197.147C490.174%20196.252%20489.294%20195.68%20488.4%20195.87%20488.399%20195.87%20488.399%20195.87%20488.399%20195.87%20488.174%20195.918%20487.962%20196.014%20487.776%20196.15L481.184%20200.898C479.925%20201.758%20478.809%20202.45%20477.776%20203.015%20476.998%20203.429%20476.669%20204.372%20477.022%20205.18%20477.402%20206.011%20478.385%20206.378%20479.217%20205.998%20479.253%20205.981%20479.288%20205.964%20479.322%20205.945%20480.618%20205.229%20481.877%20204.447%20483.094%20203.604L487.657%20200.313%20491.031%20216.213C491.677%20219.273%20494.376%20221.464%20497.503%20221.469L501.882%20221.469C505.577%20221.473%20508.587%20218.502%20508.631%20214.807%20508.608%20211.503%20506.158%20208.719%20502.883%20208.277L499.416%20191.93C502.051%20190.581%20506.719%20188.344%20509.619%20188.344%20515.225%20188.346%20520.812%20187.662%20526.252%20186.307%20530.081%20185.36%20533.152%20182.51%20534.381%20178.762L534.535%20178.295C535.676%20175.09%20535.323%20171.542%20533.573%20168.624L525.126%20154.2C522.254%20149.369%20517.625%20145.835%20512.207%20144.337%20512.364%20138.624%20511.516%20132.927%20509.7%20127.508%20504.714%20113.244%20488.452%20105.977%20487.761%20105.669%20487.336%20105.48%20486.851%20105.48%20486.426%20105.669%20485.959%20105.876%20484.987%20106.308%20483.1%20111.962%20482.811%20112.832%20483.281%20113.77%20484.15%20114.059%20485.019%20114.348%20485.958%20113.878%20486.247%20113.009%20486.649%20111.744%20487.129%20110.505%20487.685%20109.299%20491.474%20111.245%20502.818%20117.831%20506.566%20128.543%20508.418%20133.972%20509.183%20139.713%20508.815%20145.437%20508.734%20146.277%20509.297%20147.043%20510.122%20147.217%20515.212%20148.269%20519.626%20151.41%20522.287%20155.875L530.744%20170.299C532.007%20172.379%20532.256%20174.921%20531.42%20177.207L531.254%20177.727C530.378%20180.388%20528.194%20182.41%20525.474%20183.079%20520.288%20184.375%20514.964%20185.031%20509.619%20185.031%20505.93%20185.031%20501.061%20187.35%20496.776%20189.601Z'/%3e%3cpath%20d='M422.439%20192.966C421.946%20190.791%20421.681%20188.571%20421.649%20186.341%20421.7%20185.427%20421.001%20184.643%20420.086%20184.592%20419.171%20184.54%20418.388%20185.239%20418.336%20186.154%20418.324%20187.879%20418.47%20189.602%20418.772%20191.3%20412.577%20189.633%20408.907%20183.26%20410.574%20177.065%20411.942%20171.981%20416.559%20168.453%20421.824%20168.469%20422.661%20168.473%20423.491%20168.611%20424.284%20168.88%20425.056%20169.133%20425.898%20168.787%20426.271%20168.065%20435.26%20150.783%20455.639%20142.806%20473.971%20149.392%20474.837%20150.636%20475.5%20151.557%20475.559%20151.638%20476.094%20152.38%20477.129%20152.549%20477.872%20152.014%20478.614%20151.479%20478.782%20150.444%20478.248%20149.702%20478.216%20149.657%20475.101%20145.338%20473.444%20142.62%20467.845%20132.798%20470.283%20120.115%20471.358%20115.817%20475.617%20117.014%20487.816%20121.194%20493.442%20131.039%20496.082%20135.531%20497.921%20140.449%20498.876%20145.571%20499.017%20146.361%20499.705%20146.936%20500.508%20146.936L503.929%20146.936C504.816%20146.948%20505.561%20146.274%20505.639%20145.391%20505.7%20144.478%20505.01%20143.688%20504.097%20143.627%20504.059%20143.624%20504.021%20143.623%20503.982%20143.623L501.871%20143.623C500.778%20138.613%20498.902%20133.806%20496.312%20129.38%20488.742%20116.13%20471.271%20112.337%20470.533%20112.183%20469.704%20112.01%20468.879%20112.489%20468.618%20113.294%20468.385%20114.011%20463.013%20131.036%20470.568%20144.256%20470.579%20144.276%20470.745%20144.576%20470.978%20144.973%20470.99%20144.991%20470.978%20145.003%20470.96%20144.998%20452.498%20140.481%20433.287%20148.811%20423.966%20165.375%20423.261%20165.231%20422.543%20165.158%20421.824%20165.156%20413.582%20165.183%20406.923%20171.886%20406.95%20180.128%20406.974%20187.414%20412.256%20193.618%20419.446%20194.803L419.446%20194.803C419.532%20195.194%20419.611%20195.585%20419.706%20195.972L419.8%20196.329C422.428%20206.56%20428.796%20215.436%20437.646%20221.204%20437.917%20221.379%20438.232%20221.473%20438.554%20221.474L473.068%20221.474C476.748%20221.495%20479.756%20218.542%20479.801%20214.862%20479.847%20211.242%20476.95%20208.27%20473.329%20208.224%20473.278%20208.223%20473.227%20208.223%20473.176%20208.224L465.158%20208.224C474.765%20201.216%20476.873%20187.747%20469.866%20178.14%20465.812%20172.583%20459.348%20169.297%20452.47%20169.297%20450.573%20169.261%20448.682%20169.507%20446.858%20170.029%20445.981%20170.293%20445.484%20171.219%20445.749%20172.096%20446.013%20172.973%20446.938%20173.47%20447.816%20173.206%20449.328%20172.775%20450.897%20172.574%20452.47%20172.609%20462.532%20172.632%20470.67%20180.807%20470.648%20190.869%20470.63%20198.914%20465.337%20205.995%20457.626%20208.29%20456.784%20208.543%20456.286%20209.408%20456.491%20210.263%20456.686%20211.016%20457.369%20211.54%20458.147%20211.533L473.107%20211.533C474.951%20211.521%20476.458%20213.001%20476.48%20214.845%20476.52%20216.635%20475.102%20218.118%20473.312%20218.158%20473.264%20218.159%20473.216%20218.159%20473.168%20218.158L439.054%20218.158C431.004%20212.776%20425.251%20204.584%20422.922%20195.184%20422.853%20194.889%20422.795%20194.619%20422.733%20194.339Z'/%3e%3cpath%20d='M519.521%20163.831C519.708%20162.011%20518.383%20160.385%20516.563%20160.199%20514.743%20160.012%20513.117%20161.337%20512.931%20163.157%20512.744%20164.977%20514.069%20166.603%20515.889%20166.789%20516.113%20166.812%20516.339%20166.812%20516.563%20166.789%20518.126%20166.629%20519.361%20165.394%20519.521%20163.831Z'/%3e%3c/g%3e%3c/svg%3e",Ya="_WPMSpeedButtonsWrap_r3byt_1",Qa="_btnWrap_r3byt_7",Za="_label_r3byt_14",Ja="_iconBtn_r3byt_22",Bt={WPMSpeedButtonsWrap:Ya,btnWrap:Qa,label:Za,iconBtn:Ja},ao=350,ec=40,tc=.85,nc=p.memo(function(){const t=Y(g=>g.audioSpeed),n=Y(g=>g.incAudioSpeed),r=Y(g=>g.decAudioSpeed),o=p.useRef(null),s=p.useRef(ao),i=p.useRef(null),c=p.useCallback(g=>{const v=t;if(g==="inc"){if(v>=2)return!1;n()}else{if(v<=.3)return!1;r()}return!0},[t,n,r]),l=p.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),a=p.useCallback(()=>{i.current&&(s.current=Math.max(ec,Math.floor(s.current*tc)),o.current=window.setTimeout(()=>{c(i.current)?a():l()},s.current))},[c,l]),d=p.useCallback(g=>{if(i.current)return;i.current=g,s.current=ao,c(g)&&a();const x=()=>l();window.addEventListener("mouseup",x,{once:!0}),window.addEventListener("touchend",x,{once:!0})},[a,c,l]);p.useEffect(()=>l,[l]);const S=`${(t*100).toFixed(0)}%`;return b.jsx("div",{onMouseLeave:l,className:Bt.WPMSpeedButtonsWrap,children:b.jsxs("div",{className:Bt.btnWrap,children:[b.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 느리게",onMouseDown:()=>d("dec"),onTouchStart:g=>{g.preventDefault(),d("dec")},onMouseUp:l,children:b.jsx("img",{src:Ka,alt:"느리게"})}),b.jsx("div",{className:Bt.label,style:{minWidth:"44px",textAlign:"center"},children:b.jsx("div",{children:S})}),b.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 빠르게",onMouseDown:()=>d("inc"),onTouchStart:g=>{g.preventDefault(),d("inc")},onMouseUp:l,children:b.jsx("img",{src:Xa,alt:"빠르게"})})]})})}),rc="_StepBtn_15t0r_1",oc={StepBtn:rc};function sc(e){return Ze({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,48V208a8,8,0,0,1-13.66,5.66L128,147.31V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,128,48v60.69l66.34-66.35A8,8,0,0,1,208,48Z"},child:[]}]})(e)}function ic(e){return Ze({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M221.66,133.66l-80,80A8,8,0,0,1,128,208V147.31L61.66,213.66A8,8,0,0,1,48,208V48a8,8,0,0,1,13.66-5.66L128,108.69V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,221.66,133.66Z"},child:[]}]})(e)}function co({direction:e}){const t=q(S=>S.currentGlobalRunIndex),n=q(S=>S.totalRuns),r=q(S=>S.hasReadableInDir),o=q(S=>S.computeStepTarget),s=q(S=>S.setCurrentGlobalRunIndex),i=Ce(S=>S.syncToGI),c=q(S=>S.getSectionScrollApi),l=p.useCallback(async S=>{var x,w;const g=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),v=o(g,S);s(v,"scrubber-step"),i(v),await((w=(x=c())==null?void 0:x.ensureVisibleGI)==null?void 0:w.call(x,v))},[t,n,o,s,i,c]),a=p.useMemo(()=>{const S=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),g=!n||!r(S,1),v=!n||!r(S,-1);return e==="left"?v:g},[e,n,t,r]),d=p.useCallback(()=>{l(e==="left"?-1:1)},[e,l]);return b.jsx("button",{className:oc.StepBtn,type:"button",onClick:d,disabled:a,title:e==="left"?"이전":"다음",children:e==="left"?b.jsx(sc,{}):b.jsx(ic,{})})}const lc="_GCPlayBtn_n54mc_1",ac="_playing_n54mc_34",uo={GCPlayBtn:lc,playing:ac},cc=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>b.jsx("button",{className:`${uo.GCPlayBtn} ${r?uo.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function uc(e){return Ze({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(e)}function dc(e){return Ze({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 217.9L383 345c9.4 9.4 24.6 9.4 33.9 0 9.4-9.4 9.3-24.6 0-34L273 167c-9.1-9.1-23.7-9.3-33.1-.7L95 310.9c-4.7 4.7-7 10.9-7 17s2.3 12.3 7 17c9.4 9.4 24.6 9.4 33.9 0l127.1-127z"},child:[]}]})(e)}function fc(){var _;const e=Y(I=>I.showOverlays),t=q(I=>I.section),n=!!t.ast.isAddedSplit,r=!!((_=t.audios)!=null&&_.length),o=Y(I=>I.muteAudio),s=Y(I=>I.showPointer),i=Y(I=>I.showSplit),c=Y(I=>I.toggleMuteAudio),l=Y(I=>I.toggleShowPointer),a=Y(I=>I.toggleShowSplit),d=Y(I=>I.overlayCompactMode),S=Y(I=>I.toggleOverlayCompactMode),g=an(),v=xt();p.useEffect(()=>{const I=g.getState(),{syncToGI:h,useFake:y,useReal:R}=I,j=I.playbackKind,O=v.getState().progress.currentGlobalRunIndex??0;if(!r){j!=="fake"&&y();return}o?j!=="fake"&&(console.log("이부분일까?"),y()):j!=="real"&&(h(O),R())},[r,o,v,g]);const x=Ce(I=>I.play),w=Ce(I=>I.pause),u=Ce(I=>I.status),f=p.useCallback(I=>{I.stopPropagation(),u==="playing"||u==="loading"?w():x()},[u,x,w]),m=an(),k=xt(),T=p.useCallback(async I=>{var F,$;if(I.stopPropagation(),u==="playing"||u==="loading"){w();return}const{progress:h}=k.getState(),{currentGlobalRunIndex:y,snapToReadable:R,edgeReadable:j,setCurrentGlobalRunIndex:O,getSectionScrollApi:z}=h,C=m.getState(),M=C.currentClip,P=z==null?void 0:z(),G=typeof y=="number"?y:0,E=typeof R=="function"?R(G):G,B=typeof j=="function"?j(1):null;if(B!=null&&E>=B){O==null||O(B,"audio"),await((F=P==null?void 0:P.ensureVisibleGI)==null?void 0:F.call(P,B)),C.syncToGI(B);return}O==null||O(E,"audio"),await(($=P==null?void 0:P.ensureVisibleGI)==null?void 0:$.call(P,E)),C.syncToGI(E),x(M)},[u,w,x,m,k]);return b.jsxs("div",{className:`${je.wrap} ${e?je.visible:""} ${d?je.compact:""}`,onClick:I=>{I.stopPropagation()},onTouchStart:I=>{I.stopPropagation()},children:[!d&&b.jsx(Va,{}),b.jsx("div",{style:d?{display:"none"}:void 0,children:r&&!o?b.jsx(La,{}):b.jsx(Ua,{})}),b.jsxs("div",{className:je.controls,children:[b.jsxs("div",{className:je.row1,children:[b.jsx("div",{className:je.groupExpand,children:b.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),S()},className:je.compactBtn,title:d?"오버레이 확대":"오버레이 축소",children:d?b.jsx(dc,{size:24}):b.jsx(uc,{size:24})})}),b.jsxs("div",{className:je.groupPlayback,children:[b.jsx(co,{direction:"left"}),b.jsx(cc,{size:34,isPlaying:u==="playing",onClick:o?T:f,title:u==="playing"?"일시정지":"재생"}),b.jsx(co,{direction:"right"})]}),b.jsx("div",{className:je.groupSpeed,children:b.jsx(nc,{})})]}),b.jsxs("div",{className:je.row2,children:[b.jsxs("div",{className:je.groupFeatures,children:[r&&b.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),c()},className:`${je.btn} ${o?"":je.btnActive}`,title:"오디오북 음소거 전환",children:[o?b.jsx(ga,{size:18}):b.jsx(ma,{size:18}),b.jsx("span",{className:je.label,children:"오디오북"})]}),b.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),l()},className:`${je.btn} ${s?je.btnActive:""}`,title:"포인터 표시",children:[b.jsx(ba,{size:18}),b.jsx("span",{className:je.label,children:"포인터"})]}),n&&b.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),a()},disabled:!n,className:`${je.btn} ${i?je.btnActive:""} ${n?"":je.btnForbidden}`,title:"끊어읽기 표시",children:[b.jsx(xa,{size:18}),b.jsx("span",{className:je.label,children:"끊어읽기"})]})]}),b.jsxs("div",{className:je.groupNav,children:[b.jsx(ua,{}),b.jsx(fn,{})]})]})]})]})}const pc=p.memo(fc);function hc(e){return Ze({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z"},child:[]}]})(e)}const gc="_host_v5qx1_3",mc="_topbar_v5qx1_11",bc="_visible_v5qx1_32",xc="_backBtn_v5qx1_37",vc="_title_v5qx1_58",Sc="_settingsBtn_v5qx1_67",Tt={host:gc,topbar:mc,visible:bc,backBtn:xc,title:vc,settingsBtn:Sc};function yc(){const e=Y(a=>a.showOverlays),t=Y(a=>a.overlayCompactMode),n=q(a=>a.onViewerClose),o=q(a=>a.section).ast.title,s=Y(a=>a.setSettingsOpen),i=Y(a=>a.setShowOverlays),c=p.useCallback(()=>{n==null||n()},[n]),l=p.useCallback(()=>{s(!0),i(!1)},[s,i]);return b.jsx("div",{className:Tt.host,children:b.jsxs("div",{className:`${Tt.topbar} ${e&&!t?Tt.visible:""}`,children:[b.jsx("button",{type:"button",className:Tt.backBtn,onClick:c,"aria-label":"뒤로가기",children:b.jsx(va,{size:28})}),b.jsx("div",{className:Tt.title,children:b.jsx("span",{className:"truncate",children:o||"섹션 없음"})}),b.jsx("button",{type:"button",className:Tt.settingsBtn,onClick:l,"aria-label":"뷰어 설정",children:b.jsx(hc,{size:28})})]})})}const wc=p.memo(yc),Cc="_wrap_62su0_7",Ic="_wrapHidden_62su0_29",kc="_wrapVisible_62su0_35",Tc="_scrollArea_62su0_71",Rc="_row_62su0_81",_c="_label_62su0_89",Mc="_btn_62su0_95",Ec="_btnActive_62su0_106",jc="_btnSmall_62su0_110",Oc="_pill_62su0_122",Pc="_themeCircle_62su0_133",Bc="_themeCircleActive_62su0_146",zc="_stepRow_62su0_151",Ac="_stepLabel_62su0_159",Lc="_levelBox_62su0_172",Gc="_inlineFlex_62su0_177",Me={wrap:Cc,wrapHidden:Ic,wrapVisible:kc,scrollArea:Tc,row:Rc,label:_c,btn:Mc,btnActive:Ec,btnSmall:jc,pill:Oc,themeCircle:Pc,themeCircleActive:Bc,stepRow:zc,stepLabel:Ac,levelBox:Lc,inlineFlex:Gc};function Hc({visible:e}){const t=Y(h=>h.mode),n=Y(h=>h.setMode),r=Y(h=>h.theme),o=Y(h=>h.setTheme),s=Y(h=>h.fontFamily),i=Y(h=>h.setFontFamily),c=Y(h=>h.resetToDefaults),l=Y(h=>h.getFontLevel()),a=Y(h=>h.getLineLevel()),d=Y(h=>h.getMarginLevel()),S=Y(h=>h.setFontLevel),g=Y(h=>h.setLineLevel),v=Y(h=>h.setMarginLevel),x=Y(h=>h.pointerStyle),w=Y(h=>h.setPointerStyle),u=Y(h=>h.pointerColor),f=Y(h=>h.setPointerColor),m=Y(h=>h.breakMarks),k=Y(h=>h.toggleBreakMark),T=Y(h=>h.getBreakGapLevel()),_=Y(h=>h.setBreakGapLevel),I=`${Me.wrap} ${e?Me.wrapVisible:Me.wrapHidden}`;return b.jsxs("div",{className:I,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[b.jsxs("div",{className:Me.scrollArea,children:[b.jsx(zt,{label:"열람방식",children:b.jsxs("div",{className:Me.inlineFlex,children:[b.jsx(Rt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),b.jsx(Rt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),b.jsx(zt,{label:"테마",children:b.jsx("div",{className:Me.inlineFlex,children:Object.keys(on).map(h=>{const y=h,R=on[y];return b.jsx("button",{type:"button",onClick:()=>o(y),className:`${Me.themeCircle} ${r===h?Me.themeCircleActive:""}`,style:{background:R.bg,color:R.fg,fontFamily:s},title:String(h),"aria-label":`테마: ${String(h)}`,children:"A"},`${h}_tc_button`)})})}),b.jsx(zt,{label:"글꼴",children:b.jsx("div",{className:Me.inlineFlex,children:Lo.map(h=>b.jsx(Rt,{active:s===h.value,onClick:()=>i(h.value),title:h.value,children:h.label},h.label))})}),b.jsx(tn,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>S(Math.max(1,l-1)),onInc:()=>S(Math.min(12,l+1))}),b.jsx(tn,{label:"줄 간격",level:a,min:1,max:7,onDec:()=>g(Math.max(1,a-1)),onInc:()=>g(Math.min(7,a+1))}),b.jsx(tn,{label:"여백",level:d,min:1,max:5,onDec:()=>v(Math.max(1,d-1)),onInc:()=>v(Math.min(5,d+1))}),b.jsx(zt,{label:"포인터",children:b.jsxs("div",{className:Me.inlineFlex,children:[b.jsx(Rt,{active:x==="highlight",onClick:()=>w("highlight"),children:"형광펜"}),b.jsx(Rt,{active:x==="underline",onClick:()=>w("underline"),children:"밑줄"}),b.jsx("input",{type:"color",value:u,onChange:h=>f(h.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),b.jsx(zt,{label:"끊기표시",children:b.jsx("div",{className:Me.inlineFlex,children:b.jsx(Rt,{active:m.slash,onClick:()=>k("slash"),children:"슬래쉬"})})}),b.jsx(tn,{label:"끊기간격",level:T,min:1,max:5,onDec:()=>_(Math.max(1,T-1)),onInc:()=>_(Math.min(5,T+1))})]}),b.jsx("div",{className:Me.inlineFlex,style:{justifyContent:"center"},children:b.jsx("button",{type:"button",onClick:c,className:Me.pill,children:"보기 설정 초기화"})})]})}function zt({label:e,children:t}){return b.jsxs("div",{className:Me.row,children:[b.jsx("label",{className:Me.label,children:e}),t]})}function Rt({active:e,onClick:t,title:n,children:r}){return b.jsx("button",{type:"button",onClick:t,title:n,className:`${Me.btn} ${e?Me.btnActive:""}`,children:r})}function tn({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,c=t>=r;return b.jsxs("div",{className:Me.stepRow,children:[b.jsx("label",{className:Me.stepLabel,children:e}),b.jsxs("div",{className:Me.inlineFlex,children:[b.jsx("button",{type:"button",onClick:o,disabled:i,className:Me.btnSmall,"aria-label":"감소",children:"−"}),b.jsx("div",{className:Me.levelBox,children:t}),b.jsx("button",{type:"button",onClick:s,disabled:c,className:Me.btnSmall,"aria-label":"증가",children:"+"})]})]})}const Nc=p.memo(function(){const t=Y(i=>i.showOverlays),n=Y(i=>i.isSettingsOpen),r=q(i=>i.rangeStartGI),o=q(i=>i.rangeEndGI);return r!=null&&o!=null?null:b.jsxs("div",{"aria-hidden":!0,style:{pointerEvents:"none",position:"absolute",inset:0,containerType:"size",containerName:"viewer"},children:[b.jsx(wc,{}),b.jsx(pc,{}),b.jsx("div",{style:{pointerEvents:"auto"},children:b.jsx(Hc,{visible:!t&&n})})]})}),Fc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,c,l)=>{let a=i;if(c){const d=(l==null?void 0:l.equalityFn)||Object.is;let S=i(r.getState());a=g=>{const v=i(g);if(!d(S,v)){const x=S;c(S=v,x)}},l!=null&&l.fireImmediately&&c(S,S)}return o(a)}),e(t,n,r)},Dc=Fc;function Wc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function $c(e){var o,s,i;if(!e||!/\S/.test(e))return 0;const t=((o=e.match(/[A-Za-z0-9]+(?:['’-][A-Za-z0-9]+)*/g))==null?void 0:o.length)??0,n=((s=e.match(/[\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]+/g))==null?void 0:s.length)??0,r=((i=e.match(/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3040-\u30FF\u31FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F]/g))==null?void 0:i.length)??0;return t+n+Math.floor(r/2)}function Vc(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=$c((r==null?void 0:r.text)??"");return t}function qc(e){const t=e==null?void 0:e.recorderStore;let n=e==null?void 0:e.map,r=e==null?void 0:e.initialIndex;const o=v=>{if(!n)return null;const{g2ct:x}=n;if(!x)return null;const w=x[v];if(w)return{clip:w.clip,t:w.t};for(let u=1;u<=100&&v-u>=0;u++){const f=x[v-u];if(f)return{clip:f.clip,t:f.t}}for(let u=1;u<=100;u++){const f=x[v+u];if(f)return{clip:f.clip,t:f.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,c=0;const l=Math.max(1,Vc(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const v=o(e.initialIndex);v&&(i=v.clip,c=v.t,r=void 0)}const a=s.length>0,d=a?"paused":"idle",S=a?"real":"fake",g=a?null:{totalWords:l};return qt(Dc((v,x)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,c),status:d,scrollLock:!1,playbackKind:S,fake:g,useFake:()=>v(w=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:w.status==="playing"})),useReal:()=>v(w=>({playbackKind:"real",fake:{totalWords:l},scrollLock:w.status==="playing"})),injectMap:w=>{if(n=w,typeof r=="number"){const u=o(r);u&&v(f=>({currentClip:Math.max(0,Math.min(u.clip,Math.max(0,f.clips.length-1))),currentTimeMs:Math.max(0,u.t)})),r=void 0}},setClipAndMs:(w,u)=>v(f=>{const m=Math.max(0,f.clips.length-1);return{currentClip:Math.max(0,Math.min(w,m)),currentTimeMs:Math.max(0,u),status:f.status,scrollLock:f.scrollLock}}),setClips:w=>v(u=>{const f=Array.isArray(w)?w:[],m=f.length>0;return{clips:f,currentClip:0,currentTimeMs:0,status:m?"paused":"idle",playbackKind:m?"real":"fake",fake:m?null:u.fake??{totalWords:l},scrollLock:!1}}),clear:()=>v(w=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:w.fake??{totalWords:l},scrollLock:!1})),play:(w,u)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),v(f=>{if(f.playbackKind==="fake")return{status:"playing",scrollLock:!0};const m=typeof w=="number"?w:f.currentClip,k=typeof u=="number"?u:f.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(m,Math.max(0,f.clips.length-1))),currentTimeMs:k,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),v({status:"paused",scrollLock:!1})},seek:w=>v(u=>({currentTimeMs:Math.max(0,w),status:u.status})),stop:()=>v({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>v(w=>{if(w.playbackKind==="fake")return w;const u=Math.max(0,w.clips.length-1);return{currentClip:Math.min(w.currentClip+1,u),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>v(w=>w.playbackKind==="fake"?w:{currentClip:Math.max(0,w.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:w=>v(u=>u.playbackKind==="fake"||w<0||w>=u.clips.length?u:{currentClip:w,currentTimeMs:0}),getClipSrc:w=>{const u=x();if(!u.clips.length)return null;const f=typeof w=="number"?w:u.currentClip;return Wc(u.clips[f])},getGIFromCT:(w,u)=>{if(!n)return-1;const f=n.byClip[w];if(!f||f.length===0)return-1;let m=0,k=f.length-1,T=0;for(;m<=k;){const _=m+k>>1;f[_].t<=u?(T=_,m=_+1):k=_-1}return f[Math.max(0,Math.min(T,f.length-1))].g},getCTFromGI:w=>{if(!n)return null;const{g2ct:u}=n;if(!u)return null;let f=u[w];if(!f){let m=w-1;const k=Math.max(0,w-100);for(;m>=k;){if(u[m]){f=u[m];break}m--}if(!f){let T=w+1;const _=w+100;for(;u[T]==null&&T<=_;)T++;u[T]&&(f=u[T])}}return f?{clip:f.clip,timeMs:f.t}:null},getMetaByGI:w=>{const u=x().getCTFromGI(w);return u?{clipIndex:u.clip,timeMs:u.timeMs}:null},syncToGI:w=>{const u=x().getMetaByGI(w);u&&x().setClipAndMs(u.clipIndex,u.timeMs)},_onTime:w=>v({currentTimeMs:w,status:"playing",scrollLock:!0}),_onEnded:()=>v(w=>{if(w.playbackKind==="fake")return{status:"ended",scrollLock:!1};const u=Math.max(0,w.clips.length-1);return w.currentClip>=u?{status:"ended",scrollLock:!1}:{currentClip:Math.min(w.currentClip+1,u),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>v({status:"error",scrollLock:!1}),_setStatusOnly:w=>v({status:w})})))}function Uc({children:e,initialState:t}){const n=p.useContext(St)??void 0,r=p.useMemo(()=>qc({...t,recorderStore:n}),[t,n]);return b.jsx(vn.Provider,{value:r,children:e})}function Kc(e){var s,i;const t={},n=[],r=((s=e==null?void 0:e.ast)==null?void 0:s.blocks)??[];let o=0;for(const c of r){if((c==null?void 0:c.type)==="image")continue;const l=(c==null?void 0:c.runs)??[];for(let a=0;a<l.length;a++){const d=l[a],S=o+a;d.audioChunkIndex!=null&&d.audioTimeMs!=null&&((t[i=d.audioChunkIndex]||(t[i]=[])).push({t:d.audioTimeMs,g:S}),n[S]={clip:d.audioChunkIndex,t:d.audioTimeMs})}o+=l.length}return Object.values(t).forEach(c=>c.sort((l,a)=>l.t-a.t)),{byClip:t,g2ct:n}}function Xc(e,t,n){if(n<=0)return-1;const r=Math.max(0,Math.min(t,n-1));if(e[r]===1)return r;for(let o=1;o<n;o++){const s=r-o;if(s>=0&&e[s]===1)return s;const i=r+o;return i<n&&e[i]===1?i:-1}return-1}function Yc(e){const t=$l(e),n=Vl(t),r=t.reduce((d,S)=>d+(S||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],c=[];return e.forEach((d,S)=>{var u;if(d.type!=="paragraph")return;const g=n[S]??0,v=d.runs??[];for(let f=0;f<v.length;f++){const m=((u=v[f])==null?void 0:u.text)||"";sr(m)&&(s[g+f]=1)}const w=ql(v,g).map(f=>{var _;const m=f.startG-g,k=f.endG-f.startG+1;let T=-1;for(let I=0;I<k;I++){const h=((_=v[m+I])==null?void 0:_.text)??"";if(sr(h)){T=f.startG+I;break}}return{startG:f.startG,endG:f.endG,r0:m,len:k,firstReadableGI:T,splitIndex:f.splitIndex}});c[S]=w;for(const f of w){const m=i.length;for(let k=f.startG;k<=f.endG;k++)o[k]=m;i.push(f)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:c},layout:{prefix:n,totalRuns:r}}}function Qc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:c,initialIndex:l,mountTime:a}=e,d=c.totalRuns??0,S=typeof l=="number"?l:d>0?0:-1,g=S>=0?Xc(i.readableGi,S,d):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:g,lastUpdateBy:"program",totalRuns:d,pageIndex:0,sectionLoading:!0,_loadingStartTime:a,_scrollApi:void 0,derivedNav:i,layout:c,rangeStartGI:null,rangeEndGI:null}}function Zc(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,eventBridgeStore:c}=e,l=t.ast.blocks,{nav:a,layout:d}=Yc(l),S=Date.now(),g=Qc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:a,layout:d,initialIndex:n,mountTime:S});return c&&queueMicrotask(()=>{c.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},S),c.getState().emit({type:"loading_start",payload:{}},S)}),qt((v,x)=>{const w=E=>{v(B=>B.progress._scrollApi===E?B:{progress:{...B.progress,_scrollApi:E}})},u=()=>x().progress._scrollApi,f=E=>{v(B=>{const F=B.progress;if(F.totalRuns===E)return B;const $=F.currentGlobalRunIndex<0&&E>0;return{progress:{...F,totalRuns:E,currentGlobalRunIndex:$?0:F.currentGlobalRunIndex,lastUpdateBy:$?"program":F.lastUpdateBy}}})},m=(E,B="program")=>{const F=x().progress.currentGlobalRunIndex,$=x().progress,V=$.totalRuns>0?Math.max(-1,Math.min(E,$.totalRuns-1)):E;F===V&&$.lastUpdateBy===B||(v(le=>({progress:{...le.progress,currentGlobalRunIndex:V,lastUpdateBy:B}})),F!==V&&c&&c.getState().emit({type:"global_index_change",payload:{globalIndex:V}}))},k=E=>{const{sectionLoading:B,_loadingStartTime:F}=x().progress;if(B===E)return;const $=Date.now();if(E)v(V=>({progress:{...V.progress,sectionLoading:!0,_loadingStartTime:$}})),c&&c.getState().emit({type:"loading_start",payload:{}});else{const le=(F?$-F:0)/1e3;v(ae=>({progress:{...ae.progress,sectionLoading:!1,_loadingStartTime:null}})),c&&c.getState().emit({type:"loading_end",payload:{duration:le}})}},T=E=>{v(B=>({progress:{...B.progress,pageIndex:E}}))},_=(E,B)=>{const $=x().progress.rangeStartGI==null;if(v(V=>({progress:{...V.progress,rangeStartGI:Math.min(E,B),rangeEndGI:Math.max(E,B)}})),c){const V=y();c.getState().emit({type:$?"range_select":"range_change",payload:{startGI:Math.min(E,B),endGI:Math.max(E,B),text:V}})}},I=()=>{v(E=>({progress:{...E.progress,rangeStartGI:null,rangeEndGI:null}})),c&&c.getState().emit({type:"range_clear",payload:{}})},h=E=>{const{rangeStartGI:B,rangeEndGI:F}=x().progress;B==null||F==null||(E<B?v($=>({progress:{...$.progress,rangeStartGI:E}})):E>F?v($=>({progress:{...$.progress,rangeEndGI:E}})):I())},y=()=>{var ye;const{rangeStartGI:E,rangeEndGI:B,section:F,layout:$}=x().progress;if(E==null||B==null||!$)return"";const V=((ye=F.ast)==null?void 0:ye.blocks)??[],le=$.prefix,ae=[];for(let we=0;we<V.length;we++){const Z=V[we];if(Z.type!=="paragraph")continue;const X=Z.runs??[],A=le[we]??0;for(let K=0;K<X.length;K++){const ee=A+K;ee>=E&&ee<=B&&ae.push(X[K].text??"")}}return ae.join("")},R=E=>{const{totalRuns:B,derivedNav:F}=x().progress,$=F==null?void 0:F.readableGi;if(!$||B<=0)return E;const V=B,le=Math.max(0,Math.min(E,V-1));if($[le])return le;let ae=le-1,ye=le+1;for(;ae>=0||ye<V;){if(ye<V&&$[ye])return ye;if(ae>=0&&$[ae])return ae;ye+=1,ae-=1}return le},j=(E,B)=>{const{totalRuns:F,derivedNav:$}=x().progress,V=$==null?void 0:$.readableGi;if(!V||F<=0)return null;if(B>0){for(let le=Math.min(Math.max(E,0),F-1);le<F;le+=1)if(V[le])return le}else for(let le=Math.min(Math.max(E,0),F-1);le>=0;le-=1)if(V[le])return le;return null},O=E=>{const{totalRuns:B,derivedNav:F}=x().progress,$=F==null?void 0:F.readableGi;if(!$||B<=0)return null;if(E>0){for(let V=B-1;V>=0;V-=1)if($[V])return V}else for(let V=0;V<B;V+=1)if($[V])return V;return null};return{progress:{...g,registerSectionScrollApi:w,getSectionScrollApi:u,setTotalRuns:f,setCurrentGlobalRunIndex:m,setSectionLoading:k,setPageIndex:T,setRange:_,clearRange:I,extendRange:h,getRangeText:y,snapToReadable:R,nextReadableFrom:j,edgeReadable:O,hasReadableInDir:(E,B)=>j(E+(B>0?1:-1),B)!=null,computeStepTarget:(E,B)=>{const{totalRuns:F,derivedNav:$}=x().progress;if(!F||F<=0)return E;const V=($==null?void 0:$.groups)??[],le=$==null?void 0:$.giToGroupIdx;if(!V.length||!le){const A=F-1;return R(Math.max(0,Math.min(E+B,A)))}let ae=le[E]??-1;if(ae<0||ae>=V.length)for(let X=0;X<V.length;X+=1){const A=V[X];if(E>=A.startG&&E<=A.endG){ae=X;break}}if(ae<0||ae>=V.length)return O(B)??R(E);const ye=X=>X>=0&&X<V.length&&(V[X].firstReadableGI??-1)>=0;let we=ae+B;for(;we>=0&&we<V.length&&!ye(we);)we+=B;if(we<0||we>=V.length)return O(B)??R(E+B);const Z=V[we].firstReadableGI;return Z>=0?Z:R(E+B)},giToPercentTotal:E=>{const B=x().progress.totalRuns;return!B||B<=1?0:Math.max(0,Math.min(E,B-1))/(B-1)*100},percentToGITotal:E=>{const B=x().progress.totalRuns;if(!B||B<=1)return 0;const F=Math.max(0,Math.min(E,100)),$=Math.round(F/100*(B-1));return Math.max(0,Math.min($,B-1))}}}})}function Jc({children:e,initialState:t}){const n=p.useContext(St),r=p.useMemo(()=>Zc({...t,eventBridgeStore:n}),[t,n]);return b.jsx(lr.Provider,{value:r,children:e})}function eu({children:e,initialState:t}){const n=p.useContext(St)??void 0,r=p.useRef(Ys({init:t,recorderStore:n}));return b.jsx(ir.Provider,{value:r.current,children:e})}const tu=({pages:e,pageIndex:t,maxWidth:n})=>{const r=q(m=>m.section),o=p.useMemo(()=>{var m;return((m=r.ast)==null?void 0:m.blocks)??[]},[r]),s=Y(m=>m.marginX),i=Y(m=>m.lineHeight),c=Y(m=>m.fontSizePx),l=Y(m=>m.fontFamily),a=Y(m=>m.viewportHeight),d=q(m=>{var k;return((k=m.layout)==null?void 0:k.prefix)??[]}),S=q(m=>{var k;return((k=m.derivedNav)==null?void 0:k.splitGroupsPerBlock)??[]}),g=e[t],v=p.useMemo(()=>{const m=[];return o.forEach((k,T)=>{(k.type==="paragraph"||k.type==="image")&&m.push(T)}),m},[o]),x=p.useMemo(()=>{if(!g)return[];const m=[];for(let k=g.startBlock;k<=g.endBlock;k++){const T=v[k];T!=null&&m.push(T)}return m},[g,v]),w=p.useMemo(()=>{const m=[];for(const k of x){const T=o[k];(T==null?void 0:T.type)==="paragraph"&&m.push({b:T,originalBlockIndex:k})}return m},[x,o]),u=p.useMemo(()=>{const m=[],k=Sr();return w.forEach((T,_)=>{m[_]=yr(T.b,k)}),m},[w]),f=(m,k,T)=>{if(!m||m.length===0)return[];const _=[];for(const I of m){const h=I.startG,y=I.endG;if(y<k||h>T)continue;const R=Math.max(h,k),j=Math.min(y,T),O=R-h|0,z=Math.max(0,j-R+1);if(z<=0)continue;const C=(I.r0??0)+O;_.push({...I,startG:R,endG:j,r0:C,len:z})}return _};return b.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:c,lineHeight:i,boxSizing:"border-box"},children:b.jsxs("div",{style:{width:"100%",maxWidth:n,height:"100%",boxSizing:"border-box",overflow:"hidden",display:"flex",flexDirection:"column",margin:"0 auto"},children:[b.jsx("div",{style:{height:40}}),b.jsx("div",{style:{flex:1,overflow:"hidden"},children:x.map((m,k)=>{var X;const T=o[m],_=k===0,I=k===x.length-1,h={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},y=`sec-${r.section_id}/blk-${T.id??m}`;if(T.type==="image"){const{src:A,alt:K,width:ee,height:N}=T,ne=ee&&N?`${ee} / ${N}`:"4 / 3",W=a>80?Math.floor((a-80)*.6):void 0;return b.jsx("div",{style:h,children:b.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[b.jsx("div",{style:{position:"relative",width:"100%",maxHeight:W,aspectRatio:ne},children:b.jsx("img",{src:A,alt:K||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),K&&b.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:K})]})},y)}const R=T,j=w.findIndex(A=>A.originalBlockIndex===m),O=j>=0?u[j]:void 0,z=R.runs??[],C=z.length;let M=0,P=Math.max(0,C-1);_&&g.startOffsetInBlock!=null&&(M=Math.min(Math.max(0,g.startOffsetInBlock),P)),I&&g.endOffsetInBlock!=null&&(P=Math.max(M,Math.min(g.endOffsetInBlock,P)));const G=M>0,E=d[m]??0,B=S[m]??[],F=E+M,$=E+P;let V=f(B,F,$);const le=E+M;V=V.map(A=>{const K=Math.max(0,(A.startG??F)-le),ee=A.len??Math.max(1,(A.endG??$)-(A.startG??F)+1);return{...A,r0:K,len:ee}});const ae=M<=P?z.slice(M,P+1):[],ye=R.list?R.list.level*24:0,we=((X=R.list)==null?void 0:X.kind)==="bullet"?R.list.glyph??"•":void 0,Z=G?void 0:O??we;return b.jsx("div",{style:h,children:b.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:ye,textAlign:R.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[R.list&&Z?b.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:Z||""}):null,b.jsx(bs,{preGroups:V,runs:ae,ns:y,baseIndex:le,sectionId:String(r.section_id)})]})},y)})})]})})},fo=.5;function nu(e,t){const n=p.useRef(null),r=p.useRef(null),o=p.useRef(!1);p.useEffect(()=>{const s=()=>{n.current==null&&(n.current=requestAnimationFrame(()=>{n.current=null,t(),o.current=!0,requestAnimationFrame(()=>{o.current=!1})}))},i=new ResizeObserver(l=>{if(o.current)return;const a=l[0],{width:d,height:S}=a.contentRect,g=r.current;if(!g){r.current={w:d,h:S};return}Math.abs(g.w-d)<fo&&Math.abs(g.h-S)<fo||(r.current={w:d,h:S},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const c=()=>s();return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function ru(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,shouldIgnoreSwipe:i,horizontalThreshold:c=120,velocityThreshold:l=.6,singleDelayMs:a=250,doubleClickWindowMs:d=300,onDragMove:S,onDragEnd:g,pageTransitionThreshold:v}=e,x=v??c,w=10,u=$e.useRef({touchId:null,startX:0,startY:0,startT:0,swiping:!1,mouseDown:!1,mouseSwiping:!1,mStartX:0,mStartY:0,mStartT:0,capturedEl:null,prevUserSelect:"",lastTapT:0,singleTimer:null,suppressClick:!1}),f=()=>{u.current.singleTimer!=null&&(clearTimeout(u.current.singleTimer),u.current.singleTimer=null)},m=$e.useCallback(M=>{if(s!=null&&s(M))return;const P=performance.now();P-u.current.lastTapT<=d&&u.current.lastTapT>0?(f(),u.current.lastTapT=0,o==null||o()):(f(),r&&(u.current.singleTimer=window.setTimeout(()=>{u.current.singleTimer=null,r()},a)),u.current.lastTapT=P)},[s,d,o,r,a]),k=$e.useCallback((M,P)=>{const G=Math.abs(M)/Math.max(1,P);Math.abs(M)>=x||G>=l?M<0?n():t():g==null||g()},[x,l,n,t,g]),T=$e.useCallback(M=>{if(M.touches.length!==1)return;const P=i??s;if(P!=null&&P(M.target))return;const G=M.touches[0];u.current.touchId=G.identifier,u.current.startX=G.clientX,u.current.startY=G.clientY,u.current.startT=M.timeStamp,u.current.swiping=!1},[i,s]),_=$e.useCallback(M=>{if(u.current.touchId==null)return;const P=Array.from(M.touches).find(F=>F.identifier===u.current.touchId);if(!P)return;const G=P.clientX-u.current.startX,E=Math.abs(G),B=Math.abs(P.clientY-u.current.startY);if(!u.current.swiping)if(E>=w&&E>B)u.current.swiping=!0;else return;S==null||S(G)},[S]),I=$e.useCallback(M=>{if(u.current.touchId==null)return;const P=Array.from(M.changedTouches).find(F=>F.identifier===u.current.touchId);if(!P)return;const G=P.clientX-u.current.startX,E=P.clientY-u.current.startY,B=M.timeStamp-u.current.startT;u.current.swiping?k(G,B):Math.abs(G)<10&&Math.abs(E)<10&&m(M.target),u.current.suppressClick=!0,u.current.touchId=null,u.current.swiping=!1},[k,m]),h=$e.useCallback(()=>{u.current.swiping&&(g==null||g()),u.current.touchId=null,u.current.swiping=!1},[g]),y=$e.useCallback(M=>{if(M.pointerType==="touch"||u.current.mouseDown)return;const P=i??s;P!=null&&P(M.target)||(u.current.mouseDown=!0,u.current.mouseSwiping=!1,u.current.mStartX=M.clientX,u.current.mStartY=M.clientY,u.current.mStartT=M.timeStamp,u.current.suppressClick=!1,u.current.capturedEl=M.currentTarget)},[i,s]),R=$e.useCallback(M=>{if(M.pointerType==="touch"||!u.current.mouseDown)return;const P=M.clientX-u.current.mStartX,G=Math.abs(P),E=Math.abs(M.clientY-u.current.mStartY);if(!u.current.mouseSwiping)if(G>=w&&G>E){u.current.mouseSwiping=!0,u.current.suppressClick=!0;const B=u.current.capturedEl;if(B!=null&&B.setPointerCapture)try{B.setPointerCapture(M.pointerId)}catch{}u.current.prevUserSelect=document.body.style.userSelect,document.body.style.userSelect="none",M.preventDefault()}else return;S==null||S(P),M.preventDefault()},[S]),j=$e.useCallback(M=>{var G;if(M.pointerType==="touch"||!u.current.mouseDown)return;if(u.current.mouseSwiping){const E=M.clientX-u.current.mStartX,B=M.timeStamp-u.current.mStartT;k(E,B),document.body.style.userSelect=u.current.prevUserSelect}const P=u.current.capturedEl;if((G=P==null?void 0:P.hasPointerCapture)!=null&&G.call(P,M.pointerId))try{P.releasePointerCapture(M.pointerId)}catch{}u.current.mouseDown=!1,u.current.mouseSwiping=!1,u.current.capturedEl=null},[k]),O=$e.useCallback(M=>{M.pointerType!=="touch"&&(u.current.mouseSwiping&&(g==null||g(),document.body.style.userSelect=u.current.prevUserSelect),u.current.mouseDown=!1,u.current.mouseSwiping=!1,u.current.capturedEl=null)},[g]),z=$e.useCallback(()=>{u.current.mouseSwiping&&(g==null||g(),document.body.style.userSelect=u.current.prevUserSelect),u.current.mouseDown=!1,u.current.mouseSwiping=!1,u.current.capturedEl=null},[g]),C=$e.useCallback(M=>{if(u.current.suppressClick){u.current.suppressClick=!1;return}m(M.target)},[m]);return $e.useEffect(()=>()=>{f(),document.body.style.userSelect=""},[]),{onTouchStart:T,onTouchMove:_,onTouchEnd:I,onTouchCancel:h,onPointerDown:y,onPointerMove:R,onPointerUp:j,onPointerCancel:O,onLostPointerCapture:z,onClick:C}}var Bn,po;function Is(){if(po)return Bn;po=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bn=e,Bn}var zn,ho;function ou(){if(ho)return zn;ho=1;var e=typeof Yt=="object"&&Yt&&Yt.Object===Object&&Yt;return zn=e,zn}var An,go;function ks(){if(go)return An;go=1;var e=ou(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return An=n,An}var Ln,mo;function su(){if(mo)return Ln;mo=1;var e=ks(),t=function(){return e.Date.now()};return Ln=t,Ln}var Gn,bo;function iu(){if(bo)return Gn;bo=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Gn=t,Gn}var Hn,xo;function lu(){if(xo)return Hn;xo=1;var e=iu(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Hn=n,Hn}var Nn,vo;function Ts(){if(vo)return Nn;vo=1;var e=ks(),t=e.Symbol;return Nn=t,Nn}var Fn,So;function au(){if(So)return Fn;So=1;var e=Ts(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var c=n.call(i,o),l=i[o];try{i[o]=void 0;var a=!0}catch{}var d=r.call(i);return a&&(c?i[o]=l:delete i[o]),d}return Fn=s,Fn}var Dn,yo;function cu(){if(yo)return Dn;yo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Dn=n,Dn}var Wn,wo;function uu(){if(wo)return Wn;wo=1;var e=Ts(),t=au(),n=cu(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(c){return c==null?c===void 0?o:r:s&&s in Object(c)?t(c):n(c)}return Wn=i,Wn}var $n,Co;function du(){if(Co)return $n;Co=1;function e(t){return t!=null&&typeof t=="object"}return $n=e,$n}var Vn,Io;function fu(){if(Io)return Vn;Io=1;var e=uu(),t=du(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return Vn=r,Vn}var qn,ko;function pu(){if(ko)return qn;ko=1;var e=lu(),t=Is(),n=fu(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt;function l(a){if(typeof a=="number")return a;if(n(a))return r;if(t(a)){var d=typeof a.valueOf=="function"?a.valueOf():a;a=t(d)?d+"":d}if(typeof a!="string")return a===0?a:+a;a=e(a);var S=s.test(a);return S||i.test(a)?c(a.slice(2),S?2:8):o.test(a)?r:+a}return qn=l,qn}var Un,To;function hu(){if(To)return Un;To=1;var e=Is(),t=su(),n=pu(),r="Expected a function",o=Math.max,s=Math.min;function i(c,l,a){var d,S,g,v,x,w,u=0,f=!1,m=!1,k=!0;if(typeof c!="function")throw new TypeError(r);l=n(l)||0,e(a)&&(f=!!a.leading,m="maxWait"in a,g=m?o(n(a.maxWait)||0,l):g,k="trailing"in a?!!a.trailing:k);function T(C){var M=d,P=S;return d=S=void 0,u=C,v=c.apply(P,M),v}function _(C){return u=C,x=setTimeout(y,l),f?T(C):v}function I(C){var M=C-w,P=C-u,G=l-M;return m?s(G,g-P):G}function h(C){var M=C-w,P=C-u;return w===void 0||M>=l||M<0||m&&P>=g}function y(){var C=t();if(h(C))return R(C);x=setTimeout(y,I(C))}function R(C){return x=void 0,k&&d?T(C):(d=S=void 0,v)}function j(){x!==void 0&&clearTimeout(x),u=0,d=w=S=x=void 0}function O(){return x===void 0?v:R(t())}function z(){var C=t(),M=h(C);if(d=arguments,S=this,w=C,M){if(x===void 0)return _(w);if(m)return clearTimeout(x),x=setTimeout(y,l),T(w)}return x===void 0&&(x=setTimeout(y,l)),v}return z.cancel=j,z.flush=O,z}return Un=i,Un}var gu=hu();const mu=Bo(gu);function bu(e,t=200,n,r){const o=p.useRef(e),s=p.useRef(n);p.useEffect(()=>{o.current=e},[e]),p.useEffect(()=>{s.current=n},[n]);const i=p.useMemo(()=>{const c=mu((...a)=>{o.current(...a)},t,r),l=((...a)=>{var d;(d=s.current)==null||d.call(s),c(...a)});return l.cancel=c.cancel.bind(c),l.flush=c.flush.bind(c),l},[t,r]);return p.useEffect(()=>()=>i.cancel(),[i]),i}const xu="https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@400;700&family=Noto+Sans+KR:wght@300;400;500;700&family=Noto+Serif+KR:wght@400;700&display=swap";let Kn=!1;function vu(){if(Kn||typeof document>"u")return;if(document.querySelector('link[href*="fonts.googleapis.com"][href*="Noto"]')){Kn=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=xu,document.head.appendChild(t),Kn=!0}const Rs=new Map,_s=e=>Rs.get(e)??0,Su=e=>{const t=_s(e)+1;return Rs.set(e,t),t};class Ms extends Error{constructor(){super("calcPages canceled due to a newer invocation");Ir(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const Xe=(e,t)=>{if(e!==_s(t))throw new Ms},Xn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},Ro=e=>{const t=e.getClientRects(),n=t.length?t[0].top:e.getBoundingClientRect().top,r=e.querySelectorAll("[data-runbox]"),o=[];return r.forEach((s,i)=>{const c=s.getClientRects(),l=c.length?c[c.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},yu=(e,t,n)=>{if(n<16)return async(o=24)=>{Xe(e,t)};let r=0;return async(o=24)=>{r++,r%o===0&&(Xe(e,t),await new Promise(s=>requestAnimationFrame(()=>s())),Xe(e,t))}};async function wu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:c,lineHeight:l,showSplit:a,breakGapPx:d=0,showSlash:S,paragraphMarkers:g,playbackScale:v=1,viewportHeight:x=0,instanceId:w="default"}){var f,m,k;const u=Su(w);if(Xe(u,w),i&&typeof document<"u"&&document.fonts){vu();try{const T=`${c}px ${i}`;await document.fonts.load(T),document.fonts.check(T)||await document.fonts.ready}catch{}}Xe(u,w);try{const T=Math.abs(v-1)>.001,_=1/v;T&&(t.style.transform=`scale(${_})`,t.style.transformOrigin="top left");const I=Math.max(0,e.offsetWidth||0),h=Math.max(0,Math.min(I,o));t.style.maxWidth=`${h}px`,Xe(u,w);let y=Math.round(n.offsetHeight||0);y||(y=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",v.toFixed(4),T?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",I),console.log("[calcPages] pageBoxWidth:",h),console.log("[calcPages] maxPageHeight:",y),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const R=1.5,j=(N,ne)=>ne+N<=y-R,O=getComputedStyle(e),z={letterSpacing:O.letterSpacing,wordSpacing:O.wordSpacing,fontKerning:O.fontKerning||"normal",fontVariantLigatures:O.fontVariantLigatures||"normal",textTransform:O.textTransform||"none",direction:O.direction||"ltr",wordBreak:O.wordBreak||"keep-all",overflowWrap:O.overflowWrap||O.wordWrap||"break-word",hyphens:O.hyphens||"manual"},C=N=>{N.style.letterSpacing=z.letterSpacing||"",N.style.wordSpacing=z.wordSpacing||"",N.style.fontKerning=z.fontKerning||"",N.style.fontVariantLigatures=z.fontVariantLigatures||"",N.style.textTransform=z.textTransform||"",N.style.direction=z.direction||"",N.style.wordBreak=z.wordBreak||"",N.style.wordWrap=z.overflowWrap||"",N.style.overflowWrap=z.overflowWrap||"",N.style.hyphens=z.hyphens||""},M=h,P=Math.max(0,M-2*(s||0));n.innerHTML="";const G=document.createElement("div");G.style.boxSizing="border-box",G.style.width=`${M}px`,G.style.maxWidth=`${M}px`,G.style.margin="0 auto",G.style.display="flex",n.appendChild(G);const E=document.createElement("div");E.style.boxSizing="border-box",E.style.paddingRight=`${s}px`,E.style.paddingLeft=`${s}px`,E.style.width=`${M}px`,E.style.maxWidth=`${M}px`,E.style.margin="0 auto",E.style.display="flex",E.style.justifyContent="center",E.style.height="auto",G.appendChild(E);const B=new Map,F={},$=yu(u,w,r.length),V=(N,ne)=>{const W=document.createElement("p");return W.style.margin="8px 0",W.style.paddingLeft=ne?`${ne}px`:"0",W.style.textAlign=N.textAlign??"start",W.style.whiteSpace="pre-wrap",W.style.lineHeight=String(l),W.style.fontSize=`${c}px`,W.style.boxSizing="border-box",W.style.fontFamily=i??"",W.style.width="100%",C(W),W},le=(N,ne)=>{const W=ne??[],Q=document.createDocumentFragment();for(let re=0;re<W.length;re++){const te=W[re],ue=document.createElement("span");ue.dataset.runbox=String(re),ue.style.whiteSpace="pre-wrap";const oe=document.createElement("span");if(oe.dataset.run=String(re),oe.textContent=(te==null?void 0:te.text)??"",oe.style.whiteSpace="pre-wrap",te!=null&&te.bold&&(oe.style.fontWeight="700"),te!=null&&te.italic&&(oe.style.fontStyle="italic"),te!=null&&te.underline&&(oe.style.textDecoration="underline"),ue.appendChild(oe),a&&(te!=null&&te.split)&&re!==W.length-1){const be=Math.max(0,(d??0)/2),pe=document.createElement("span");pe.style.display="inline-block",pe.style.width=`${be}px`;const Se=document.createElement("span");if(Se.style.display="inline-block",Se.style.width=`${be}px`,ue.appendChild(pe),S){const Te=document.createElement("span");Te.textContent=" / ",ue.appendChild(Te)}ue.appendChild(Se)}Q.appendChild(ue)}N.appendChild(Q)},ae=x>80?Math.floor((x-80)*.6):void 0,ye=N=>{const ne=N!=null&&N.width&&(N!=null&&N.height)?`${N.width} / ${N.height}`:"4 / 3",W=document.createElement("div");W.style.margin="12px 0",W.style.textAlign="center",W.style.width=`${P}px`;const Q=document.createElement("div");Q.style.position="relative",Q.style.width="100%",ae&&(Q.style.maxHeight=`${ae}px`),Q.style.aspectRatio=ne;const re=document.createElement("div");if(re.style.position="absolute",re.style.inset="0",re.style.width="100%",re.style.height="100%",Q.appendChild(re),W.appendChild(Q),N!=null&&N.alt){const te=document.createElement("div");te.style.fontSize="12px",te.style.color="#6B7280",te.style.marginTop="4px",te.textContent=String(N.alt),C(te),W.appendChild(te)}return W};for(let N=0;N<r.length;N++){Xe(u,w);const ne=r[N];if(E.dataset.block=String(N),E.innerHTML="",ne.kind==="image"){const Se=ne.block,Te=ye(Se);E.appendChild(Te);const Be=Te.getBoundingClientRect(),{mt:Ee,mb:Ge}=Xn(Te);F[N]={contentH:Math.ceil(Be.height),mt:Ee,mb:Ge},await $(24);continue}const W=ne.block,Q=W.list?(W.list.level??0)*24:0,re=ne.paraIndex??0,te=g[re]??(((f=W.list)==null?void 0:f.kind)==="bullet"?((m=W.list)==null?void 0:m.glyph)??"•":void 0);if(!!(W.list&&te)){const Se=V(W,Q);Se.dataset.variant="with";const Te=V(W,Q);Te.dataset.variant="no";const Be=document.createElement("span");Be.textContent=`${te} `,Be.style.minWidth="16px",Be.style.display="inline-block",Be.style.whiteSpace="nowrap",Be.style.userSelect="none",Se.appendChild(Be),le(Se,W.runs),le(Te,W.runs);const Ee=document.createDocumentFragment();Ee.appendChild(Se),Ee.appendChild(Te),E.appendChild(Ee)}else{const Se=V(W,Q);Se.dataset.variant="with",le(Se,W.runs),E.appendChild(Se)}const oe=E.querySelector('p[data-variant="with"]'),be=E.querySelector('p[data-variant="no"]'),pe=be??oe;if(oe&&pe){const Se=Ro(oe),Te=Ro(pe),{mt:Be,mb:Ee}=Xn(oe),{mt:Ge,mb:ot}=Xn(pe),We=((k=W.runs)==null?void 0:k.length)??0,Oe=be?Te:Se,Je=be?Ge:Be,Ke=be?ot:Ee;if(N<3){const ut=oe.getBoundingClientRect().height;console.log(`[calcPages] para ${N}: height=${ut.toFixed(2)}, lastBottom=[${Se.slice(-3).map(Pt=>Pt.toFixed(1)).join(",")}], runs=${We}`)}B.set(N,{runsLen:We,lastBottomWith:Se,lastBottomNo:Oe,mtWith:Be,mbWith:Ee,mtNo:Je,mbNo:Ke})}await $(24)}Xe(u,w),E.innerHTML="";const we=(N,ne,W,Q)=>{if(ne>W)return{top:0,content:0,mb:0};const re=Q?N.lastBottomNo:N.lastBottomWith,te=Q?N.mtNo:N.mtWith,ue=Q?N.mbNo:N.mbWith,oe=Q?0:te,be=ne>0?re[ne-1]??0:0,pe=Math.max(0,(re[W]??0)-be);return{top:oe,content:pe,mb:ue}},Z=[];let X=0,A,K=null,ee=null;for(;X<r.length;){Xe(u,w);const N=X;let ne=0,W=0,Q=A;Q!=null&&K===X&&ee!=null&&(Q=Math.max(Q,ee+1));let re=-1,te;for(;X<r.length;){if(Xe(u,w),r[X].kind==="image"){const Oe=F[X]??{contentH:0,mt:0,mb:0},Ke=(ne===0?Oe.mt:W+Oe.mt)+Oe.contentH;if(j(Ke,ne)){ne+=Ke,re=X,te=void 0,W=Oe.mb,X+=1,A=void 0,K=null,ee=null;continue}if(ne===0){Z.push({startBlock:N,endBlock:X,...Q!=null?{startOffsetInBlock:Q}:{}}),X+=1,A=void 0,K=null,ee=null,W=0;break}break}const oe=B.get(X),be=oe.runsLen,pe=X===N&&Q!=null?Q:0;if(pe>=be){X+=1,A=void 0,K=null,ee=null;continue}const Se=pe>0,Te=we(oe,pe,be-1,Se),Ee=(ne===0?Te.top:W+Te.top)+Te.content;if(j(Ee,ne)){ne+=Ee,re=X,te=be-1,W=Te.mb,X+=1,A=void 0,K=null,ee=null;continue}let Ge=pe,ot=be-1,We=pe-1;for(;Ge<=ot;){Xe(u,w);const Oe=Ge+ot>>1,Je=we(oe,pe,Oe,Se),Ke=(ne===0?Je.top:W+Je.top)+Je.content;j(Ke,ne)?(We=Oe,Ge=Oe+1):ot=Oe-1}if(We>=pe){Z.push({startBlock:N,endBlock:X,...Q!=null?{startOffsetInBlock:Q}:{},endOffsetInBlock:We}),A=We+1,K=X,ee=We,W=0;break}if(ne>0){Z.push({startBlock:N,endBlock:re>=0?re:Math.min(X-1,r.length-1),...Q!=null?{startOffsetInBlock:Q}:{},...te!=null?{endOffsetInBlock:te}:{}}),W=0;break}else{const Oe=pe;Z.push({startBlock:N,endBlock:X,...Q!=null?{startOffsetInBlock:Q}:{},endOffsetInBlock:Oe}),A=Oe+1,K=X,ee=Oe,W=0;break}}(Z.length===0||Z[Z.length-1].startBlock!==N)&&Z.push({startBlock:N,endBlock:re>=0?re:Math.min(X-1,r.length-1),...Q!=null?{startOffsetInBlock:Q}:{},...te!=null?{endOffsetInBlock:te}:{}})}return G.remove(),T&&(t.style.transform="",t.style.transformOrigin=""),Xe(u,w),{pages:Z,pageByRunIndex:null}}catch(T){throw console.error(T),T}}function _o(e,t,n){var r;if(!e)return null;for(let o=e.startBlock;o<=e.endBlock;o++){const s=t[o];if(!s||s.kind!=="paragraph")continue;const i=((r=s.block.runs)==null?void 0:r.length)??0;if(!i)continue;const c=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+c}return null}function Cu(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let c=i.startBlock;c<=i.endBlock;c++){const l=n[c];if(!l||l.kind!=="paragraph")continue;const a=((o=l.block.runs)==null?void 0:o.length)??0;if(!a)continue;let d=0,S=a-1;c===i.startBlock&&i.startOffsetInBlock!=null&&(d=Math.max(0,Math.min(i.startOffsetInBlock,S))),c===i.endBlock&&i.endOffsetInBlock!=null&&(S=Math.max(d,Math.min(i.endOffsetInBlock,S)));const g=r[l.originalIndex]??0,v=g+d,x=g+S;if(e>=v&&e<=x)return s}}return-1}function Iu(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function ku(e){var n,r;const t=e;return t?((n=t.style)==null?void 0:n.cursor)==="grab"||((r=t.closest)==null?void 0:r.call(t,"[data-range-handle]"))!=null:!1}function Tu(e){const t=[],n=[];let r=0;return e.forEach((o,s)=>{o.type==="paragraph"?(t.push({kind:"paragraph",block:o,originalIndex:s,paraIndex:r}),n.push(s),r+=1):o.type==="image"&&t.push({kind:"image",block:o,originalIndex:s})}),{items:t,paraIndexMap:n}}function Ru(){var Cr;const e=p.useId(),t=q(D=>D.section),n=q(D=>D.sectionLoading),r=q(D=>D.rangeStartGI),o=q(D=>D.rangeEndGI),s=r!=null&&o!=null,i=yt(),c=Y(D=>D.theme),l=on[c],a=Y(D=>D.fontFamily),d=Y(D=>D.fontSizePx),S=Y(D=>D.lineHeight),g=Y(D=>D.marginX),v=Y(D=>D.viewportHeight),x=860,w=p.useRef(null),{items:u}=p.useMemo(()=>{var D;return Tu(((D=t==null?void 0:t.ast)==null?void 0:D.blocks)??[])},[t]),f=p.useMemo(()=>{const D=[],Pe=Sr();return u.forEach(Ae=>{if(Ae.kind==="paragraph"){const mt=Ae.paraIndex;D[mt]=yr(Ae.block,Pe)}}),D},[u]),[m,k]=p.useState({pages:[],pageByRunIndex:null}),T=q(D=>D.pageIndex),_=q(D=>D.setPageIndex),I=p.useRef(0),h=p.useRef(null),[y,R]=p.useState(!1),[j,O]=p.useState(null),[z,C]=p.useState(!1),M=p.useMemo(()=>({flex:1,fontFamily:a,background:l.bg,color:l.fg,fontSize:d,lineHeight:S,overflow:"hidden",width:"100%",height:"100%",position:"relative",boxSizing:"border-box",WebkitTextSizeAdjust:"none",MozTextSizeAdjust:"none",textSizeAdjust:"none"}),[a,l.bg,l.fg,d,S]),{showSplit:P,breakGapPx:G,slash:E}=Y(Vt(D=>{var Pe;return{showSplit:D.showSplit,breakGapPx:D.breakGapPx??0,slash:((Pe=D.breakMarks)==null?void 0:Pe.slash)??!1}})),B=xt();p.useEffect(()=>{m&&m.pages.length&&(console.log("그래서 총 페이지",m.pages.length),(async()=>{const D=B.getState().progress.setSectionLoading;await dt(),await dt(),await dt(),await dt(),console.log("recalc종료"),D(!1)})())},[m,B]);const F=p.useCallback(()=>{console.log("@@@@@@recalc호출");const D=w.current,Pe=oe.current,Ae=be.current;if(console.log("showSplit",P),!D||!Pe||!Ae||u.length===0){k({pages:[],pageByRunIndex:null}),_(0);return}(async()=>{const mt=performance.now();try{const et=i.getState().playbackScale,{pages:It,pageByRunIndex:js}=await wu({viewHost:D,measureRoot:Pe,contentArea:Ae,items:u,cfgMaxWidth:x,marginX:g,fontFamily:a,fontSizePx:d,lineHeight:S,showSplit:P,breakGapPx:G,showSlash:E,paragraphMarkers:f,playbackScale:et,viewportHeight:v,instanceId:e}),Os=performance.now();console.log(`✅ calcPages 완료: ${(Os-mt).toFixed(1)} ms (${It.length} pages)`),k({pages:It,pageByRunIndex:js}),_(0)}catch(et){if(et instanceof Ms){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",et)}})()},[_,u,x,g,a,d,S,P,G,E,f,i,v,e]),$=q(D=>D.setCurrentGlobalRunIndex),V=q(D=>{var Pe;return((Pe=D.layout)==null?void 0:Pe.prefix)??[]}),le=Ce(D=>D.syncToGI),ae=p.useCallback(D=>{const Pe=m.pages.length+1,Ae=T+D;if(Ae<0||Ae>=Pe)return;const mt=T===m.pages.length;if(Ae===m.pages.length){_(Ae);return}if(mt&&D===-1){const It=_o(m.pages[Ae],u,V);It!=null&&($(It,"scrubber-step"),le(It)),_(Ae);return}const et=_o(m.pages[Ae],u,V);et!=null?($(et,"scrubber-step"),le(et)):_(Ae)},[T,m.pages,u,V,$,_,le]),ye=p.useCallback(()=>{y||I.current!==0?(O("prev"),R(!1)):ae(-1)},[y,ae]),we=p.useCallback(()=>{y||I.current!==0?(O("next"),R(!1)):ae(1)},[y,ae]),Z=hn(),X=p.useCallback(()=>{const{isSettingsOpen:D,setSettingsOpen:Pe,toggleOverlays:Ae}=Z.getState();D?Pe(!1):Ae()},[Z]),A=m.pages.length+1,K=((Cr=w.current)==null?void 0:Cr.clientWidth)||400,ee=p.useCallback(D=>{var et;const Pe=h.current;if(!Pe)return;const Ae=((et=w.current)==null?void 0:et.clientWidth)||1,mt=D/Ae*33.333;Pe.style.transform=`translate3d(${-33.333+mt}%, 0, 0)`},[]),N=p.useCallback(D=>{T===0&&D>0||T>=A-1&&D<0||(I.current=D,ee(D),y||R(!0))},[T,A,ee,y]),ne=p.useCallback(()=>{I.current=0,R(!1);const D=h.current;D&&(D.style.transition="transform 250ms ease-out",D.style.transform="translate3d(-33.333%, 0, 0)")},[]),W=p.useCallback(D=>{if(D.target!==D.currentTarget||D.propertyName!=="transform")return;const Pe=j;C(!0),O(null),I.current=0,Pe==="prev"?ae(-1):Pe==="next"&&ae(1)},[j,ae]);p.useLayoutEffect(()=>{z&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{C(!1)})})},[z]);const Q=an(),re=p.useCallback(D=>s||ku(D)?!0:Iu(D),[s]),te=p.useCallback(D=>Q.getState().status==="playing"?!0:re(D),[Q,re]),ue=ru({onPrev:ye,onNext:we,onSingle:X,onDouble:()=>{},shouldIgnoreTarget:re,shouldIgnoreSwipe:te,horizontalThreshold:120,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,onDragMove:N,onDragEnd:ne,pageTransitionThreshold:K*.5}),oe=p.useRef(null),be=p.useRef(null),pe=p.useCallback(()=>{const D=B.getState().progress.setSectionLoading;D(!0)},[B]),Se=p.useMemo(()=>({trailing:!0,leading:!1,maxWait:1e3}),[]),Te=bu(F,200,pe,Se),Be=p.useRef("");p.useEffect(()=>{if(v<=0)return;const D=`${a}|${d}|${S}|${g}|${P}|${G}|${E}|${v}|${t==null?void 0:t.section_id}`;Be.current!==D&&(Be.current=D,console.log("debounceRecalc 취소"),Te.cancel(),pe(),F())},[Te,F,pe,a,d,S,g,P,G,E,v,t==null?void 0:t.section_id]),nu([w],Te);const Ee=q(D=>D.registerSectionScrollApi);p.useEffect(()=>(Ee({ensureVisibleGI:()=>Promise.resolve(!0),scrollToGI:()=>Promise.resolve(!0),getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:()=>Promise.resolve(),stepPage:ae}),()=>Ee(void 0)),[Ee,ae]);const Ge=t.quizzes&&t.quizzes.length>0,ot=m.pages.length>0&&T===m.pages.length,We=T>0?T-1:null,Oe=T<A-1?T+1:null,Je=p.useMemo(()=>j==="prev"?"translate3d(0%, 0, 0)":j==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[j]),Ke=D=>n?null:D===m.pages.length?b.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[Ge&&b.jsx(Ss,{}),b.jsx(fn,{isIcon:!1})]}):b.jsx(tu,{pages:m.pages,pageIndex:D,maxWidth:x}),ut={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},Pt=!z&&(!y||j!==null);return console.log("여기리랜더"),b.jsxs("div",{ref:w,style:{...M,touchAction:"none"},...ue,children:[b.jsxs("div",{ref:h,style:{display:"flex",width:"300%",height:"100%",transform:Je,transition:Pt?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:j?W:void 0,children:[b.jsx("div",{style:ut,children:We!==null&&Ke(We)}),b.jsx("div",{style:ut,children:Ke(T)}),b.jsx("div",{style:ut,children:Oe!==null&&Ke(Oe)})]}),b.jsx("div",{ref:oe,"aria-hidden":!0,style:{position:"absolute",contain:"layout style paint",left:-999999,top:-999999,zIndex:-999999,opacity:0,width:"100%",maxWidth:x,height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden",fontFamily:a,fontSize:d,lineHeight:S,pointerEvents:"none",background:"pink"},children:b.jsxs("div",{style:{width:"100%",maxWidth:x,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",margin:"0 auto",overflow:"hidden"},children:[b.jsx("div",{style:{height:40,background:"blue"}}),b.jsx("div",{ref:be,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),b.jsx(_u,{pages:m.pages,items:u,onGotoPage:_,currentPageIndex:T,isOnExtraPage:ot})]})}const _u=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=q(a=>a.currentGlobalRunIndex),i=q(a=>a.lastUpdateBy),c=q(a=>{var d;return((d=a.layout)==null?void 0:d.prefix)??[]}),l=p.useRef(null);return p.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const a=Cu(s,e,t,c);a>=0&&a!==r&&n(a)},[s,e,t,c,n,r,o,i]),b.jsx(b.Fragment,{})},Mu="_wrapper_dbk3n_1",Eu="_spinner_dbk3n_10",Mo={wrapper:Mu,spinner:Eu};function ju({size:e=28,speed:t=.8}){return b.jsx("div",{className:`${Mo.wrapper}`,children:b.jsx("div",{className:Mo.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Ou(){const e=q(Vt(t=>t.sectionLoading===!0));return b.jsx(b.Fragment,{children:e===!0&&b.jsx(ju,{})})}const Pu="_Overlay_ybic8_3",Bu="_Dialog_ybic8_15",zu="_Body_ybic8_25",Au="_Header_ybic8_32",Lu="_Paging_ybic8_39",Gu="_Remaining_ybic8_48",Hu="_RemainingDanger_ybic8_55",Nu="_NextBtn_ybic8_59",Fu="_CloseBtn_ybic8_96",Du="_Question_ybic8_113",Wu="_Score_ybic8_123",$u="_Image_ybic8_130",Vu="_Options_ybic8_140",qu="_OptionBtn_ybic8_145",Uu="_OptionBtnActive_ybic8_165",Ku="_Footer_ybic8_172",Xu="_OptionBtnCorrect_ybic8_195",Yu="_Judge_ybic8_201",Qu="_Correct_ybic8_212",Zu="_Incorrect_ybic8_215",Ju="_ResultHeader_ybic8_220",ed="_ResultActions_ybic8_233",td="_CloseBtnSoft_ybic8_239",nd="_SummaryGrid_ybic8_249",rd="_StatCard_ybic8_257",od="_StatLabel_ybic8_265",sd="_StatValue_ybic8_270",id="_StatSub_ybic8_277",de={Overlay:Pu,Dialog:Bu,Body:zu,Header:Au,Paging:Lu,Remaining:Gu,RemainingDanger:Hu,NextBtn:Nu,CloseBtn:Fu,Question:Du,Score:Wu,Image:$u,Options:Vu,OptionBtn:qu,OptionBtnActive:Uu,Footer:Ku,OptionBtnCorrect:Xu,Judge:Yu,Correct:Qu,Incorrect:Zu,ResultHeader:Ju,ResultActions:ed,CloseBtnSoft:td,SummaryGrid:nd,StatCard:rd,StatLabel:od,StatValue:sd,StatSub:id};function ld(e){return e?e.kind==="temp"?e.image_blob_url:e.image_cdn_url:null}function Es(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function ad(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}const cd=p.memo(function(){const t=tt(u=>u.phase),n=tt(u=>u.quizzes),r=tt(u=>u.order),o=tt(u=>u.currentIndex),s=tt(u=>u.answers),i=tt(u=>u.correctCount),c=tt(u=>u.remainingSec),l=tt(u=>u.uiReveal),a=tt(u=>u.startedAt),d=tt(u=>u.finishedAt),S=tt(u=>u.perQ),g=vs();p.useEffect(()=>{if(t==="idle"||t!=="doing"||c==null)return;const u=window.setInterval(()=>g.getState().tick(),1e3);return()=>window.clearInterval(u)},[t,c,g]);const v=t==="doing"?n[r[o]]:void 0,x=t==="doing"&&v?s[v.qid]??[]:[],w=p.useMemo(()=>{if(t==="idle"||t!=="finished")return;const u=r.map(E=>n[E]),f=u.length,m=u.reduce((E,B)=>E+(B.score??0),0),k=u.reduce((E,B)=>{const F=S[B.qid];return E+(F!=null&&F.isCorrect?B.score??0:0)},0),T=u.map(E=>S[E.qid]).filter(E=>!!E),_=typeof a=="number"&&typeof d=="number"?Math.max(0,d-a):T.reduce((E,B)=>E+(B.ms??0),0),I=f>0?Math.round(_/f):0,h=[...T].sort((E,B)=>E.ms-B.ms),y=h[0],R=h[h.length-1],j=T.filter(E=>!E.multi),O=T.filter(E=>E.multi),z=j.filter(E=>E.isCorrect).length,C=O.filter(E=>E.isCorrect).length,M=T.filter(E=>E.timedOut).length,P=T.filter(E=>E.revealed).length,G=T.filter(E=>!E.isCorrect).sort((E,B)=>B.ms-E.ms).slice(0,3);return{total:f,correct:i,rate:f?Math.round(i/f*100):0,timeMsTotal:_,avgMs:I,totalScore:m,gainedScore:k,fastest:y,slowest:R,singles:{total:j.length,correct:z},multis:{total:O.length,correct:C},timedOut:M,revealed:P,wrongTop3:G}},[t,r,n,S,a,d,i]);return t==="idle"?null:b.jsx("div",{className:de.Overlay,role:"dialog","aria-modal":"true",children:b.jsx("div",{className:de.Dialog,children:t==="doing"&&v?b.jsx(ud,{q:v,index:o,total:r.length,selected:x,uiReveal:l,onSelect:u=>{if(l)return;const f=g.getState();Es(v)?f.selectToggle(u):f.selectSingle(u)},onBeforeNext:()=>g.getState().setReveal(!0),onNext:()=>g.getState().afterRevealNext(),remainingSec:c,onClose:()=>g.getState().close()}):b.jsx(dd,{total:r.length,correct:i,summary:w,onClose:()=>g.getState().close()})})})});function ud(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:c,onNext:l,remainingSec:a,onClose:d}=e,S=Es(t),g=p.useMemo(()=>{const u=t.options.map((f,m)=>({opt:f,i:m}));for(let f=u.length-1;f>0;f--){const m=Math.floor(Math.random()*(f+1));[u[f],u[m]]=[u[m],u[f]]}return u},[t.options]),v=p.useMemo(()=>ld(t),[t]),x=p.useMemo(()=>ad(t),[t]),w=p.useMemo(()=>{const u=[...o].sort((f,m)=>f-m);if(u.length!==x.length)return!1;for(let f=0;f<u.length;f++)if(u[f]!==x[f])return!1;return!0},[o,x]);return b.jsxs("div",{className:de.Body,children:[b.jsxs("div",{className:de.Header,children:[b.jsx("div",{className:de.Paging,children:`Quiz (${n+1}/${r})`}),b.jsx("button",{type:"button",onClick:d,className:de.CloseBtn,children:"X"})]}),b.jsx("div",{className:de.Question,children:t.question}),b.jsx("div",{className:de.Score,children:` (${t.score}점${S?" ,모두선택":""})`}),b.jsx("div",{className:`${de.Judge}${s?w?` ${de.Correct}`:` ${de.Incorrect}`:""}`,"aria-live":"polite",children:s?w?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),b.jsx("div",{className:de.Image,children:v&&b.jsx("img",{src:v,alt:""})}),b.jsx("div",{className:de.Options,children:g.map(({opt:u,i:f})=>{const m=o.includes(f),k=x.includes(f),T=[de.OptionBtn,m?de.OptionBtnActive:"",s&&k?de.OptionBtnCorrect:""].filter(Boolean).join(" ");return b.jsx("button",{type:"button",onClick:()=>i(f),className:T,disabled:s,children:u},f)})}),b.jsx("div",{className:de.Footer,children:s?b.jsx("button",{type:"button",onClick:l,className:de.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):b.jsxs("button",{type:"button",onClick:c,className:`${de.NextBtn}`,children:["Submit",typeof a=="number"&&b.jsx("span",{className:`${de.Remaining} ${a<=5?de.RemainingDanger:""}`,children:` (${a} s )`})]})})]})}function Eo(e){return e==null?"-":`${Math.round(e/1e3)}s`}function dd(e){const{total:t,correct:n,summary:r,onClose:o}=e,s=(r==null?void 0:r.rate)??(t>0?Math.round(n/t*100):0);return b.jsxs("div",{className:de.Body,children:[b.jsx("div",{className:de.ResultHeader,children:"결과 요약"}),b.jsxs("div",{className:de.SummaryGrid,role:"list",children:[b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"정답률"}),b.jsxs("div",{className:de.StatValue,children:[s,"%"]}),b.jsx("div",{className:de.StatSub,children:`정답수 ${n}/문제수${t}`})]}),b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"총 점수"}),b.jsx("div",{className:de.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),b.jsx("div",{className:de.StatSub,children:"획득점수/최대점수"})]}),b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"총 소요 시간"}),b.jsx("div",{className:de.StatValue,children:Eo(r==null?void 0:r.timeMsTotal)}),b.jsx("div",{className:de.StatSub,children:`평균 ${Eo(r==null?void 0:r.avgMs)}`})]}),b.jsxs("div",{className:de.StatCard,role:"listitem",children:[b.jsx("div",{className:de.StatLabel,children:"타입오버 퀴즈수"}),b.jsx("div",{className:de.StatValue,children:r?`${r.timedOut}`:"-"}),b.jsx("div",{className:de.StatSub,children:"timeout"})]})]}),b.jsx("div",{className:de.ResultActions,children:b.jsx("button",{type:"button",onClick:o,className:de.CloseBtnSoft,children:"닫기"})})]})}function fd(e){return e.map((t,n)=>n)}function pd(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Qn(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}function jo(e){if(!e)return{};const t=(e.quizzes??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:fd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function hd(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=jo(e);return qt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const c=jo(i);o(c)},openFromSection:i=>{i&&s().hydrateFromSection(i);const c=s();if(!c.quizzes.length)return;const l=c.quizzes[0];o({phase:"doing",startedAt:Date.now(),finishedAt:void 0,questionStartedAt:Date.now(),remainingSec:l.limit_sec||void 0,currentIndex:0,uiReveal:!1})},close:()=>{o({phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}})},selectToggle:i=>{const c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid,d=c.answers[a]??[],S=d.includes(i)?d.filter(g=>g!==i):[...d,i].sort((g,v)=>g-v);o({answers:{...c.answers,[a]:S}})},selectSingle:i=>{const c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid;o({answers:{...c.answers,[a]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const c=i.order[i.currentIndex],l=i.quizzes[c],a=l.qid,d=(i.answers[a]??[]).slice().sort((u,f)=>u-f),S=Qn(l),g=pd(d,S),v=i.questionStartedAt?Date.now()-i.questionStartedAt:0,x=i.perQ[a],w={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Yn(l),selected:d,correctIdxes:S,isCorrect:g,ms:v,revealed:(x==null?void 0:x.revealed)??!1,timedOut:(x==null?void 0:x.timedOut)??!1};if(o({correctCount:i.correctCount+(g?1:0),perQ:{...i.perQ,[a]:w}}),i.currentIndex+1>=i.order.length)o({uiReveal:!1,remainingSec:void 0}),s().finish();else{const u=i.currentIndex+1;o({currentIndex:u,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[u]].limit_sec||void 0,uiReveal:!1})}},setReveal:i=>{const c=s();if(c.phase==="doing"){if(i){const l=c.quizzes[c.order[c.currentIndex]],a=l.qid,d=c.perQ[a],S={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Yn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Qn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:(d==null?void 0:d.timedOut)??!1};o({perQ:{...c.perQ,[a]:S}})}o({uiReveal:i})}},afterRevealNext:()=>{s().phase==="doing"&&s().submitCurrent()},next:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex+1>=i.order.length)return;const c=i.currentIndex+1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const c=i.currentIndex-1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].limit_sec||void 0,uiReveal:!1})},finish:()=>{o({phase:"finished",remainingSec:void 0,uiReveal:!1,finishedAt:Date.now()})},tick:()=>{const i=s();if(i.phase!=="doing"||i.remainingSec==null)return;const c=i.remainingSec-1;if(c<=0){const l=i.quizzes[i.order[i.currentIndex]],a=l.qid,d=i.perQ[a],S={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Yn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Qn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[a]:S}})}else o({remainingSec:c})}}))}function gd({children:e,initialState:t}){const n=p.useMemo(()=>hd(t.section),[t]),r=p.useRef(t.onQuizComplete);return p.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),p.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const c=r.current;if(!c)return;const{sectionId:l,quizzes:a,order:d,perQ:S,startedAt:g,finishedAt:v}=s,x=d.map(I=>a[I]),w=x.length,u=x.filter(I=>{var h;return(h=S[I.qid])==null?void 0:h.isCorrect}).length,f=x.reduce((I,h)=>I+(h.score??0),0),m=x.reduce((I,h)=>{const y=S[h.qid];return I+(y!=null&&y.isCorrect?h.score??0:0)},0),k=typeof g=="number"&&typeof v=="number"?Math.max(0,v-g):0,T=x.map(I=>{const h=S[I.qid];return{qid:I.qid,index:I.index,question:I.question,score:I.score??0,isCorrect:(h==null?void 0:h.isCorrect)??!1,selected:(h==null?void 0:h.selected)??[],correctIdxes:(h==null?void 0:h.correctIdxes)??[],ms:(h==null?void 0:h.ms)??0,timedOut:(h==null?void 0:h.timedOut)??!1}}),_={sectionId:l??"",total:w,correct:u,rate:w>0?Math.round(u/w*100):0,totalScore:f,gainedScore:m,timeMsTotal:k,perQuestion:T};c(_)}});return()=>o()},[n]),b.jsx(wr.Provider,{value:n,children:e})}const Oo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","showPointer","showSplit","showOverlays","overlayCompactMode","isSettingsOpen"];function md({containerRef:e}){const t=yt(),n=hn(),r=p.useRef(null);return p.useEffect(()=>{const o=e.current;if(!o)return;let s=o.clientWidth,i=o.clientHeight;n.getState().setViewportSize(s,i);const c=new ResizeObserver(()=>{const l=o.clientWidth,a=o.clientHeight;(l!==s||a!==i)&&(s=l,i=a,n.getState().setViewportSize(l,a),t.getState().emit({type:"viewport_resize",payload:{width:l,height:a}}))});return c.observe(o),()=>c.disconnect()},[t,n,e]),p.useEffect(()=>{const o=n.getState();r.current={};for(const i of Oo)r.current[i]=o[i];const s=n.subscribe(i=>{const c=r.current;if(c)for(const l of Oo){const a=c[l],d=i[l];a!==d&&(l==="mode"?t.getState().emit({type:"mode_change",payload:{mode:d}}):t.getState().emit({type:"settings_change",payload:{key:l,value:d}}),c[l]=d)}});return()=>{s(),r.current=null}},[t,n]),null}function bd(){const e=yt(),t=hn(),n=xt(),r=p.useContext(Ao),o=p.useContext(vn),s=p.useCallback(l=>{const{viewerState:a}=l;if(a){a.mode&&t.getState().setMode(a.mode);const{...g}=a;t.setState(g)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(a==null?void 0:a.mode)==="scroll"||!(a!=null&&a.mode)){const g=()=>{const v=n.getState().progress.getSectionScrollApi();if(!v)return!1;if(l.scrollY===0)v.setScrollTop(0);else if(v.scrollToGIAtOffset){const x=l.anchorGI??l.globalIndex;if(typeof x=="number"){const w=l.anchorOffsetRatio??0;v.scrollToGIAtOffset(x,w)}}return!0};if(!g()){let v=0;const x=setInterval(()=>{(g()||++v>=10)&&clearInterval(x)},50)}}l.audio&&o&&o.getState()._setStatusOnly(l.audio.status);const S=n.getState().progress;l.range?S.setRange(l.range.startGI,l.range.endGI):S.clearRange()},[t,n,o]),i=p.useCallback(()=>{var k,T,_;const l=t.getState(),a=n.getState().progress,d=(k=a.getSectionScrollApi)==null?void 0:k.call(a),S=a.currentGlobalRunIndex??0,g=((T=d==null?void 0:d.getScrollTop)==null?void 0:T.call(d))??0,v=((_=d==null?void 0:d.getAnchorOffsetRatio)==null?void 0:_.call(d,S))??0,x=o==null?void 0:o.getState(),w=x?{status:x.status,currentClip:x.currentClip,currentTimeMs:x.currentTimeMs}:void 0,{rangeStartGI:u,rangeEndGI:f}=a,m=u!=null&&f!=null?{startGI:u,endGI:f,text:a.getRangeText()}:null;return{viewerState:{mode:l.mode,theme:l.theme,fontFamily:l.fontFamily,fontSizePx:l.fontSizePx,lineHeight:l.lineHeight,marginX:l.marginX,marginY:l.marginY,showOverlays:l.showOverlays,isSettingsOpen:l.isSettingsOpen,pointerStyle:l.pointerStyle,pointerColor:l.pointerColor,breakMarks:l.breakMarks,breakGapPx:l.breakGapPx,muteAudio:l.muteAudio,audioSpeed:l.audioSpeed,showPointer:l.showPointer,showSplit:l.showSplit,overlayCompactMode:l.overlayCompactMode,viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight},globalIndex:S,scrollY:g,anchorGI:S,anchorOffsetRatio:v,currentPage:a.pageIndex??0,sectionId:a.sectionId??"",viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight,audio:w,range:m}},[t,n,o]),c=p.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:a}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(a,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:d,anchorGI:S,anchorOffsetRatio:g}=l.payload,v=n.getState().progress.getSectionScrollApi();v&&(d===0?v.setScrollTop(0):v.scrollToGIAtOffset&&typeof S=="number"&&v.scrollToGIAtOffset(S,g));break}case"settings_change":{const{key:a,value:d}=l.payload,S=t.getState();a in S&&typeof S[a]!="function"&&t.setState({[a]:d});break}case"mode_change":{const{mode:a}=l.payload;t.getState().setMode(a);break}case"audio_control":{if(!o)break;const{action:a}=l.payload;switch(a){case"play":o.getState()._setStatusOnly("playing");break;case"pause":o.getState()._setStatusOnly("paused");break;case"stop":o.getState()._setStatusOnly("idle");break}break}case"page_change":{const{pageIndex:a}=l.payload;n.getState().progress.setPageIndex(a);break}case"range_select":case"range_change":{const{startGI:a,endGI:d}=l.payload;console.log(`[DirectPlayback] ${l.type}: GI ${a}~${d}`),n.getState().progress.setRange(a,d);const S=n.getState().progress;console.log(`[DirectPlayback] after setRange: rangeStartGI=${S.rangeStartGI}, rangeEndGI=${S.rangeEndGI}`);break}case"range_clear":{console.log("[DirectPlayback] range_clear"),n.getState().progress.clearRange();break}case"translate_request":case"translate_loading_start":case"translate_loading_end":case"translate_modal_close":break;case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[DirectPlaybackController] 미처리 이벤트:",l.type)}},[n,t,o]);return p.useLayoutEffect(()=>r?(r.current={dispatch:c,applySnapshot:s,getSnapshot:i,isReady:()=>!n.getState().progress.sectionLoading,waitUntilReady:()=>new Promise(a=>{if(!n.getState().progress.sectionLoading){a();return}const d=n.subscribe(S=>{S.progress.sectionLoading||(d(),a())})})},e.getState().isPlaybackMode&&(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)),()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)}):void 0,[r,e,c,s,i,n]),p.useLayoutEffect(()=>e.subscribe((a,d)=>{a.isPlaybackMode&&!d.isPlaybackMode?(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)):!a.isPlaybackMode&&d.isPlaybackMode&&(e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null))}),[e,c,s]),null}const xd=({containerRef:e,onTranslate:t})=>{const n=q(g=>g.rangeStartGI),r=q(g=>g.rangeEndGI),o=q(g=>g.getRangeText),s=q(g=>g.clearRange),i=yt(),c=n!=null&&r!=null,[l,a]=p.useState(null);p.useEffect(()=>{if(!c)return;const g=e.current;if(!g)return;let v=!0;const x=new ResizeObserver(()=>{if(v){v=!1;return}s()});return x.observe(g),()=>x.disconnect()},[c,s,e]),p.useEffect(()=>{if(!c||n==null||r==null){a(null);return}const g=()=>{const x=e.current;if(!x)return;const w=x.getBoundingClientRect(),f=1/(i.getState().playbackScale||1),m=x.querySelector(`[data-g="${r}"]`);if(!m){a({x:w.width*f/2,y:80});return}const k=m.getBoundingClientRect(),T=x.querySelector(`[data-g="${n}"]`),_=T==null?void 0:T.getBoundingClientRect();let I=(k.left+k.width/2-w.left)*f;_&&(I=((_.left+k.right)/2-w.left)*f);const h=160,y=50,R=16,j=12,O=w.width*f,z=Math.max(R+h/2,Math.min(I,O-R-h/2)),C=(((_==null?void 0:_.top)??k.top)-w.top)*f-y-j;let M=C;C<R&&(M=(k.bottom-w.top)*f+j),a({x:z,y:M})};g();const v=e.current;return v&&v.addEventListener("scroll",g,!0),()=>{v&&v.removeEventListener("scroll",g,!0)}},[c,n,r,e,i]);const d=p.useCallback(()=>{const g=o();g&&navigator.clipboard.writeText(g).catch(v=>{console.error("복사 실패:",v)}),s()},[o,s]),S=p.useCallback(()=>{const g=o();g&&t&&t(g)},[o,t]);return!c||!l?null:b.jsxs("div",{"data-range-menu":!0,style:{position:"absolute",left:l.x,top:l.y,transform:"translateX(-50%)",display:"flex",gap:8,padding:"8px 12px",backgroundColor:"#fff",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",zIndex:1e4},children:[b.jsx("button",{onClick:d,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),b.jsx("button",{onClick:S,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},vd="_handleStart_1ihf3_16 _handle_1ihf3_1",Sd="_handleEnd_1ihf3_21 _handle_1ihf3_1",Po={handleStart:vd,handleEnd:Sd},yd=({containerRef:e})=>{const t=q(f=>f.rangeStartGI),n=q(f=>f.rangeEndGI),r=q(f=>f.setRange),o=yt(),s=t!=null&&n!=null,[i,c]=p.useState(null),[l,a]=p.useState(null),d=p.useRef(null),S=p.useRef(null);p.useEffect(()=>{if(!s||t==null||n==null){c(null),a(null);return}const f=()=>{const k=e.current;if(!k)return;const T=k.getBoundingClientRect(),I=1/(o.getState().playbackScale||1),h=k.querySelector(`[data-g="${t}"]`),y=k.querySelector(`[data-g="${n}"]`);if(h){const R=h.getBoundingClientRect();c({x:(R.left-T.left)*I,y:(R.bottom-T.top)*I})}else c(null);if(y){const R=y.getBoundingClientRect();a({x:(R.right-T.left)*I,y:(R.bottom-T.top)*I})}else a(null)};f();const m=e.current;return m&&m.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{m&&m.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s,t,n,e,o]);const g=p.useCallback((f,m)=>{var T;const k=document.elementsFromPoint(f,m);for(const _ of k){const I=(T=_.getAttribute)==null?void 0:T.call(_,"data-g");if(I!=null)return parseInt(I,10)}return null},[]),v=p.useCallback(f=>m=>{m.preventDefault(),m.stopPropagation(),d.current=f,S.current=f==="start"?t:n,m.target.setPointerCapture(m.pointerId)},[t,n]),x=p.useCallback(f=>{if(!d.current||t==null||n==null)return;const m=g(f.clientX,f.clientY);m!=null&&(d.current==="start"?m<=n?r(m,n):(r(n,m),d.current="end"):m>=t?r(t,m):(r(m,t),d.current="start"))},[t,n,r,g]),w=p.useCallback(f=>{d.current=null,S.current=null,f.target.releasePointerCapture(f.pointerId)},[]);return s?b.jsxs(b.Fragment,{children:[i&&b.jsx("div",{className:Po.handleStart,"data-range-handle":"start",style:{left:i.x-26,top:i.y},onPointerDown:v("start"),onPointerMove:x,onPointerUp:w,onPointerCancel:w}),l&&b.jsx("div",{className:Po.handleEnd,"data-range-handle":"end",style:{left:l.x,top:l.y},onPointerDown:v("end"),onPointerMove:x,onPointerUp:w,onPointerCancel:w})]}):null};function wd(){const e=q(o=>o.rangeStartGI),t=q(o=>o.rangeEndGI),n=q(o=>o.clearRange),r=e!=null&&t!=null;return p.useEffect(()=>{if(!r)return;const o=s=>{var c;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(c=i.closest("[data-g]"))==null?void 0:c.getAttribute("data-g");if(l){const a=parseInt(l,10),d=Math.min(e,t),S=Math.max(e,t);if(a>=d&&a<=S)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const Cd=({isOpen:e,onClose:t,text:n})=>e?b.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:10001},onClick:t,children:b.jsxs("div",{style:{position:"relative",backgroundColor:"#fff",borderRadius:12,padding:"24px 32px",minWidth:280,maxWidth:"80%",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.2)"},onClick:r=>r.stopPropagation(),children:[b.jsx("button",{onClick:t,style:{position:"absolute",top:12,right:12,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"50%",cursor:"pointer",fontSize:20,color:"#666"},"aria-label":"닫기",children:"✕"}),b.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:18,fontWeight:600,color:"#333"},children:"번역"}),b.jsx("p",{style:{margin:0,fontSize:16,color:"#666",textAlign:"center",padding:"16px 0"},children:"준비중입니다"}),n&&b.jsxs("div",{style:{marginTop:16,padding:12,backgroundColor:"#f5f5f5",borderRadius:8,fontSize:14,color:"#888",maxHeight:100,overflow:"auto"},children:[b.jsx("span",{style:{fontWeight:500},children:"선택된 텍스트: "}),n]})]})}):null,Id=(e,t,n)=>Math.min(n,Math.max(t,e));function kd({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:c,onViewerEvent:l,viewerRef:a,isPlaybackMode:d=!1,playbackScale:S,isDev:g=!1}){const v=String((e==null?void 0:e.section_id)??"0"),x=p.useMemo(()=>{var T,_;const m=((T=e==null?void 0:e.ast)==null?void 0:T.blocks)??[];let k=0;for(const I of m)(I==null?void 0:I.type)!=="image"&&(k+=((_=I==null?void 0:I.runs)==null?void 0:_.length)??0);return k},[e]),w=p.useMemo(()=>typeof n=="number"?Id(n,x>0?0:-1,Math.max(x-1,-1)):(x>0,0),[n,x]),u=p.useMemo(()=>({section:e,initialIndex:w,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,w,r,o,s,i]),f=p.useMemo(()=>{const m=(e==null?void 0:e.audios)??[],k=m.length>0?Kc(e):void 0;return{clips:m,map:k,initialIndex:w,section:e}},[e,w]);return b.jsx(Us,{onViewerEvent:l,isPlaybackMode:d,playbackScale:S,viewerRef:a,children:b.jsx(eu,{initialState:{...t,isDev:g},children:b.jsx(Jc,{initialState:u,children:b.jsx(Uc,{initialState:f,children:b.jsx(gd,{initialState:{section:e,onQuizComplete:c},children:b.jsx(Td,{})},v)},v)},v)})})}function Td(){const e=Y(g=>g.mode),t=p.useRef(null),n=yt(),r=xt(),[o,s]=p.useState(!1),[i,c]=p.useState(),l=p.useCallback(g=>{c(g),s(!0);const{rangeStartGI:v,rangeEndGI:x}=r.getState().progress;n.getState().emit({type:"translate_request",payload:{text:g,startGI:v??0,endGI:x??0}})},[n,r]),a=p.useCallback(()=>{s(!1),c(void 0),n.getState().emit({type:"translate_modal_close",payload:{}})},[n]),d=g=>{g.preventDefault()},S=g=>{g.preventDefault()};return b.jsxs("div",{ref:t,onContextMenu:d,onDragStart:S,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none",touchAction:"none"},children:[e==="scroll"?b.jsx(ha,{}):b.jsx(Ru,{}),b.jsx(xd,{containerRef:t,onTranslate:l}),b.jsx(yd,{containerRef:t}),b.jsx(Nc,{}),b.jsx(cd,{}),b.jsx(Ou,{}),b.jsx(wd,{}),b.jsx(Cd,{isOpen:o,onClose:a,text:i}),b.jsx(md,{containerRef:t}),b.jsx(bd,{})]})}exports.CRViewer=kd;
|