@pie-players/pie-section-player 0.3.73 → 0.3.75

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.
Files changed (145) hide show
  1. package/README.md +395 -149
  2. package/dist/browser/assets/evaluation-worker-CORp9m0K.js +156459 -0
  3. package/dist/browser/chunks/ItemToolBar-jx38w99s-58defccc.js +1 -0
  4. package/dist/browser/chunks/PUA-tLuTiQ7--f2b27953.js +1 -0
  5. package/dist/browser/chunks/ToolCoordinator-cc2dc319.js +1 -0
  6. package/dist/browser/chunks/accents-BTUYmhn9-cafeb96e.js +1 -0
  7. package/dist/browser/chunks/accents-b-i-CngHZsLL-e0eb98fd.js +1 -0
  8. package/dist/browser/chunks/arabic-BzEHMVZD-30ac1ade.js +1 -0
  9. package/dist/browser/chunks/arrows-VjxlU-jv-2e17c192.js +1 -0
  10. package/dist/browser/chunks/base-dfd67c41.js +1 -0
  11. package/dist/browser/chunks/braille-BeWC_Ruq-a3bb8ef9.js +1 -0
  12. package/dist/browser/chunks/braille-d-Dk6J96GO-d832bfbf.js +1 -0
  13. package/dist/browser/chunks/browser-a3c32178.js +37 -0
  14. package/dist/browser/chunks/calculator-element-271c142f.js +13 -0
  15. package/dist/browser/chunks/calligraphic-Cew9cU3x-04cf0735.js +1 -0
  16. package/dist/browser/chunks/catalog-context-46d3e50e.js +1 -0
  17. package/dist/browser/chunks/catalog-owner-d602f784.js +1 -0
  18. package/dist/browser/chunks/cherokee-Cny3FYho-4da7d2f3.js +1 -0
  19. package/dist/browser/chunks/classPrivateFieldGet2-338e0179.js +1 -0
  20. package/dist/browser/chunks/cyrillic-CfCDulXU-5550df0b.js +1 -0
  21. package/dist/browser/chunks/cyrillic-ss-lU7bNGG9-12eb0188.js +1 -0
  22. package/dist/browser/chunks/defineProperty-a20a667d.js +1 -0
  23. package/dist/browser/chunks/devanagari-CDIz2h-r-18c38725.js +1 -0
  24. package/dist/browser/chunks/dist-41b39e7f.js +1 -0
  25. package/dist/browser/chunks/dist-59132a53.js +1 -0
  26. package/dist/browser/chunks/dist-60d7afef.js +1 -0
  27. package/dist/browser/chunks/dist-ca9b9622.js +1 -0
  28. package/dist/browser/chunks/double-struck-BpJEQk8y-500ce8dd.js +1 -0
  29. package/dist/browser/chunks/en-5ff22e17.js +1 -0
  30. package/dist/browser/chunks/es-a0ba6cb6.js +1 -0
  31. package/dist/browser/chunks/focus-trap-44913bf3.js +1 -0
  32. package/dist/browser/chunks/fraktur-rLEq9DEH-44cc14d8.js +1 -0
  33. package/dist/browser/chunks/greek-BlraJTyL-90ce8924.js +1 -0
  34. package/dist/browser/chunks/greek-ss-D-EN2PK0-91610739.js +1 -0
  35. package/dist/browser/chunks/hebrew-GiQZeybp-b583f555.js +1 -0
  36. package/dist/browser/chunks/latin-b-BhEnC7R2-d13e06ff.js +1 -0
  37. package/dist/browser/chunks/latin-bi-DqiIKv3U-1dec8705.js +1 -0
  38. package/dist/browser/chunks/latin-i-B1xtwaE1-21637466.js +1 -0
  39. package/dist/browser/chunks/latin-xfWFlLkD-5bcea5cf.js +1 -0
  40. package/dist/browser/chunks/logger-8b07fb72.js +1 -0
  41. package/dist/browser/chunks/marrows-DD1NgMQi-15b63755.js +1 -0
  42. package/dist/browser/chunks/math-DpWn1mbG-38eeb914.js +1 -0
  43. package/dist/browser/chunks/math-rendering-ready-9a0fd90a.js +1 -0
  44. package/dist/browser/chunks/mathjax-BKrHE4xs-3ca05bf6.js +232 -0
  45. package/dist/browser/chunks/module-0191e321.js +74 -0
  46. package/dist/browser/chunks/module-shim-58659a86.js +0 -0
  47. package/dist/browser/chunks/module-shim-b4470740.js +12 -0
  48. package/dist/browser/chunks/monospace-D116QD2a-98d484fd.js +1 -0
  49. package/dist/browser/chunks/monospace-ex-DcXpouKS-456b403c.js +1 -0
  50. package/dist/browser/chunks/monospace-l-Ct5wkMDs-f34a4a9e.js +1 -0
  51. package/dist/browser/chunks/mshapes-DCp86WSX-c0055952.js +1 -0
  52. package/dist/browser/chunks/nl-NL-364d61b9.js +1 -0
  53. package/dist/browser/chunks/nl-NL-8b7e6d4b.js +1 -0
  54. package/dist/browser/chunks/overlay-containment-edaaff13.js +1 -0
  55. package/dist/browser/chunks/overlay-placement-e8058232.js +1 -0
  56. package/dist/browser/chunks/phonetics-BwOCw2Y9-d2e3af59.js +1 -0
  57. package/dist/browser/chunks/phonetics-ss-CRtMn02f-579b6135.js +1 -0
  58. package/dist/browser/chunks/pie-api-client-687c319a.js +1 -0
  59. package/dist/browser/chunks/pointer-gesture-ce75f0a7.js +1 -0
  60. package/dist/browser/chunks/preload-helper-6ad28da3.js +1 -0
  61. package/dist/browser/chunks/provider-4c704118.js +1 -0
  62. package/dist/browser/chunks/rolldown-runtime-1287ba31.js +1 -0
  63. package/dist/browser/chunks/runtime-wcU7KOFU-ac86d7b8.js +8536 -0
  64. package/dist/browser/chunks/sanitize-svg-icon-b9082bba.js +3 -0
  65. package/dist/browser/chunks/sans-serif-BYPZKlE9-2efdbcd9.js +1 -0
  66. package/dist/browser/chunks/sans-serif-b-B0kRKiC--b5530dce.js +1 -0
  67. package/dist/browser/chunks/sans-serif-bi-DXWul6mu-5370dba4.js +1 -0
  68. package/dist/browser/chunks/sans-serif-ex-Boux1kMP-aa178f31.js +1 -0
  69. package/dist/browser/chunks/sans-serif-i-676RFaSO-2db54474.js +1 -0
  70. package/dist/browser/chunks/sans-serif-r-DrN9xdZt-0fc72eea.js +1 -0
  71. package/dist/browser/chunks/script-0ohehnXc-526904f4.js +1 -0
  72. package/dist/browser/chunks/shapes-BG47NodJ-d59b0eca.js +1 -0
  73. package/dist/browser/chunks/src-BcptuNS5-ed25d7fd.js +191 -0
  74. package/dist/browser/chunks/sre-0162a7a9.js +53 -0
  75. package/dist/browser/chunks/sre-engine-ace23548.js +1 -0
  76. package/dist/browser/chunks/sre-engine-jd8cc08x-42d270e5.js +1 -0
  77. package/dist/browser/chunks/sre-locales-112320af.js +1 -0
  78. package/dist/browser/chunks/symbols-BqnUxf_t-83087e87.js +1 -0
  79. package/dist/browser/chunks/symbols-b-i-eg9k5hmF-9c461ac2.js +1 -0
  80. package/dist/browser/chunks/tool-annotation-toolbar-997438b4.js +249 -0
  81. package/dist/browser/chunks/tool-answer-eliminator-35483abd.js +13 -0
  82. package/dist/browser/chunks/tool-color-scheme-b7de5cdf.js +26 -0
  83. package/dist/browser/chunks/tool-dictionary-cecff3b4.js +7 -0
  84. package/dist/browser/chunks/tool-graph-cb0338e8.js +11 -0
  85. package/dist/browser/chunks/tool-host-contract-b93b482c.js +1 -0
  86. package/dist/browser/chunks/tool-instance-id-2a92deb0.js +1 -0
  87. package/dist/browser/chunks/tool-line-reader-f8ef3c6a.js +62 -0
  88. package/dist/browser/chunks/tool-periodic-table-43b133b8.js +153 -0
  89. package/dist/browser/chunks/tool-picture-dictionary-33721e91.js +4 -0
  90. package/dist/browser/chunks/tool-protractor-23f77028.js +17 -0
  91. package/dist/browser/chunks/tool-ruler-1d9a03a6.js +15 -0
  92. package/dist/browser/chunks/tool-tts-inline-98c2ce7a.js +179 -0
  93. package/dist/browser/chunks/tts-runtime-config-a7ab1ad4.js +194 -0
  94. package/dist/browser/chunks/variants-2LRNhOUP-966fc49d.js +1 -0
  95. package/dist/browser/chunks/versioned-tag-54a76be9.js +1 -0
  96. package/dist/browser/pie-section-player.js +1727 -0
  97. package/dist/browser.d.ts +10 -0
  98. package/dist/chunks/ItemToolBar-jx38w99s-1287ba31.js +28 -0
  99. package/dist/chunks/module-shim-58659a86.js +2129 -0
  100. package/dist/chunks/{nl-NL-9312c316.js → nl-NL-364d61b9.js} +9 -26
  101. package/dist/chunks/sre-engine-jd8cc08x-42d270e5.js +8 -0
  102. package/dist/components/shared/composition.d.ts +3 -2
  103. package/dist/components/shared/framework-error-latch.d.ts +32 -0
  104. package/dist/components/shared/host-element.d.ts +10 -0
  105. package/dist/components/shared/kernel-host-default-body.d.ts +14 -0
  106. package/dist/components/shared/layout-host-methods.d.ts +385 -0
  107. package/dist/components/shared/missing-tool-providers.d.ts +16 -0
  108. package/dist/components/shared/player-preload.d.ts +14 -10
  109. package/dist/components/shared/section-player-backend-delivery.d.ts +1 -1
  110. package/dist/components/shared/section-player-card-context.d.ts +5 -1
  111. package/dist/components/shared/section-player-host-runtime.d.ts +32 -19
  112. package/dist/components/shared/section-player-layout-context.d.ts +77 -0
  113. package/dist/components/shared/section-player-own-event.d.ts +10 -0
  114. package/dist/components/shared/section-player-runtime-callbacks.d.ts +1 -1
  115. package/dist/components/shared/section-player-shell-layout.svelte.d.ts +3 -11
  116. package/dist/components/shared/section-player-view-state.d.ts +6 -1
  117. package/dist/components/shared/toolkit-ready-wait.d.ts +16 -0
  118. package/dist/contracts/host-hooks.d.ts +4 -12
  119. package/dist/contracts/host-hooks.js +0 -0
  120. package/dist/contracts/runtime-host-contract.d.ts +0 -5
  121. package/dist/contracts/runtime-host-contract.js +0 -0
  122. package/dist/controllers/SectionController.d.ts +14 -0
  123. package/dist/controllers/toolkit-section-contracts.d.ts +1 -17
  124. package/dist/controllers/types.d.ts +25 -11
  125. package/dist/item-section/index.d.ts +22 -0
  126. package/dist/item-section/index.js +37 -0
  127. package/dist/pie-section-player.d.ts +4 -6
  128. package/dist/pie-section-player.js +22006 -41076
  129. package/dist/policies/index.d.ts +5 -16
  130. package/dist/policies/index.js +17 -0
  131. package/dist/policies/types.d.ts +0 -4
  132. package/package.json +33 -68
  133. package/dist/chunks/module-a516757f.js +0 -73997
  134. package/dist/chunks/nl-NL-ef6dd604.js +0 -505
  135. package/dist/chunks/pie-api-client-22de9d9c.js +0 -168
  136. package/dist/chunks/rolldown-runtime-1287ba31.js +0 -20
  137. package/dist/chunks/sre-0162a7a9.js +0 -17637
  138. package/dist/components/item-shell-element.d.ts +0 -1
  139. package/dist/components/shared/shell-registration.d.ts +0 -55
  140. package/dist/contracts/layout-contract.d.ts +0 -17
  141. package/dist/contracts/layout-parity-metadata.d.ts +0 -4
  142. package/dist/contracts/public-events.d.ts +0 -93
  143. package/dist/contracts/stages.d.ts +0 -10
  144. package/dist/policies/guards.d.ts +0 -2
  145. package/dist/utils/z-index.d.ts +0 -5
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-1287ba31.js";import{n as t}from"./sre-locales-112320af.js";import{t as o}from"./sre-0162a7a9.js";var r=e(o(),1),a=r.default??r;a.setupEngine(t());export{a as default};
@@ -0,0 +1 @@
1
+ import{i as a}from"./rolldown-runtime-1287ba31.js";import{n as e}from"./ItemToolBar-jx38w99s-58defccc.js";import{t as o}from"./sre-0162a7a9.js";var r=a(o(),1),t=r.default??r;t.setupEngine(e());var p=t;export{p as default};
@@ -0,0 +1 @@
1
+ import{t as a}from"./preload-helper-6ad28da3.js";var n={base:()=>a(()=>import("./base-dfd67c41.js"),[],import.meta.url),en:()=>a(()=>import("./en-5ff22e17.js"),[],import.meta.url),es:()=>a(()=>import("./es-a0ba6cb6.js"),[],import.meta.url)},u=async e=>{if(!Object.hasOwn(n,e))throw new Error(`no speech-rule-engine locale table is packaged for "${e}"; name a source with mathSpeech.engineOptions.json or .custom`);return(await n[e]()).default},c=()=>typeof window<"u"&&typeof window.document<"u"||typeof globalThis.DedicatedWorkerGlobalScope<"u",s=(e={})=>{const{json:t,custom:o}=e;return t||o?{...t?{json:t}:{},...o?{custom:o}:{}}:c()?{custom:u}:{}},r,p=e=>{r=s(e)},_=()=>(r??(r=s()),r);export{_ as n,p as t};
@@ -0,0 +1 @@
1
+ import{a as i,i as c,n as a}from"./mathjax-BKrHE4xs-3ca05bf6.js";a.dynamicSetup("","symbols",c({SY:{normal:{161:[.5,.216,.278],162:[.476,.045,.444],164:[.491,-.01,.778],166:[.75,.25,.278],169:[.683,0,.683],170:[.705,-.333,.449],171:[.483,0,.556],173:[.245,-.187,.333],174:[.683,0,.683],178:[.705,-.306,.359],179:[.705,-.293,.359],185:[.705,-.306,.366],186:[.705,-.333,.419],187:[.483,0,.556],188:[.705,0,.825],189:[.705,0,.825],190:[.705,0,.825],191:[.5,.205,.472],3647:[.728,.045,.708],8215:[-.103,.293,.504],8218:[.104,.195,.278],8219:[.693,-.394,.262],8222:[.104,.195,.472],8223:[.693,-.394,.472],8226:[.445,-.055,.5],8227:[.45,-.052,.5],8228:[.106,0,.277],8229:[.106,0,.557],8233:[.694,.195,.472],8240:[.75,.056,1.14],8241:[.75,.056,1.457],8248:[.116,.063,.523],8249:[.483,0,.389],8250:[.483,0,.389],8251:[.492,-.009,.778],8252:[.716,0,.478],8253:[.756,0,.472],8254:[.802,-.762,.68],8255:[-.079,.272,.6],8256:[.74,-.547,.6],8257:[.402,.189,.562],8258:[.549,.028,.665],8259:[.266,-.16,.5],8261:[.75,.25,.278],8262:[.75,.25,.278],8263:[.705,0,.891],8264:[.716,0,.648],8265:[.716,0,.648],8266:[.529,.153,.442],8267:[.694,.194,.611],8268:[.428,-.066,.572],8269:[.428,-.066,.572],8270:[.269,.028,.335],8271:[.431,.193,.278],8272:[.725,-.023,.717],8273:[.589,.028,.335],8274:[.751,-.001,.5],8275:[.309,-.191,.556,{ic:.001}],8276:[-.08,.273,.6],8277:[.394,-.096,.335],8278:[.474,-.012,.345],8280:[.474,-.012,.516],8281:[.474,-.012,.516],8282:[.554,-.012,.175],8283:[.594,.028,.476],8284:[.483,-.017,.588],8285:[.554,-.012,.175],8286:[.554,-.012,.175],8319:[.553,-.287,.333],8320:[.347,.055,.389],8353:[.728,.045,.722],8358:[.683,0,.75],8361:[.683,.022,1.028],8362:[.682,.005,1.042],8363:[.694,.03,.556],8369:[.683,0,.681],8370:[.75,.055,.785],8448:[.683,.082,1.141],8449:[.683,.098,1.109],8451:[.705,.022,1.03],8452:[.683,0,.711],8453:[.683,.05,1.141],8454:[.683,.049,1.227],8456:[.706,.022,.72],8457:[.683,0,.98],8468:[.705,.012,.978],8470:[.695,.01,.916],8471:[.683,0,.683],8478:[.683,.022,.736],8479:[.833,.153,.736],8480:[.683,-.247,.883],8481:[.677,0,1.582],8482:[.687,-.277,.983],8483:[.833,.153,.75],8485:[.671,.365,.444],8489:[.441,.013,.25],8494:[.701,.01,.676],8505:[.685,0,.319],8506:[.671,0,.985],8507:[.68,0,1.399],8522:[.694,0,.632],8523:[.716,.022,.778],8524:[.7,.006,.806,{ic:.001}],8525:[.774,.12,1.019],8526:[.519,0,.46],8527:[.512,.01,1.258],8960:[.597,.097,.778],8961:[.389,0,.902],8962:[.725,-.001,.652],8963:[.802,-.524,.778],8964:[.192,.085,.778],8965:[.27,.163,.778],8966:[.367,.26,.778],8977:[.432,-.071,.572],8978:[.619,-.448,.778],8979:[.604,-.36,.667],8980:[.468,.057,.778],8981:[.599,-.094,.587],8982:[.703,.203,.986],8983:[.58,.086,.778],8984:[.575,.061,.738],8986:[.693,.191,.778],8987:[.698,0,.658],8996:[.266,.037,.778],8997:[.267,0,.759],8998:[.505,.005,.984],8999:[.483,-.017,.726],9e3:[.483,-.007,1.046],9003:[.505,.005,.984],9004:[.755,.131,.93],9005:[.597,.097,.81],9006:[.599,-.049,.655],9007:[.384,-.116,.68],9008:[.766,.011,1.137],9009:[.731,.231,1.15],9010:[.547,.047,.738],9011:[.547,-.23,.738],9012:[.131,0,.5],9013:[.202,.09,.529],9014:[.664,.024,.578],9015:[.666,0,.386],9016:[.773,.083,.618],9017:[.773,.083,.618],9018:[.773,.083,.618],9019:[.773,.083,.618],9020:[.773,.083,.618],9021:[.731,.231,.778],9022:[.592,.092,.796],9023:[.603,.103,.568],9024:[.603,.103,.568],9025:[.773,.083,.618],9026:[.773,.083,.618],9027:[.773,.083,.618],9028:[.773,.083,.618],9029:[.75,.25,.72],9030:[.75,.25,.72],9031:[.773,.083,.618],9032:[.773,.083,.618],9033:[.673,.173,.778],9034:[.684,0,.778],9035:[.81,.19,.778,{ic:.007}],9036:[.773,.083,.618],9037:[.773,.083,.618],9038:[.684,0,.778],9039:[.552,.052,.72],9040:[.773,.083,.618],9041:[.684,0,.778],9042:[.81,.19,.778,{ic:.007}],9043:[.773,.083,.618],9044:[.773,.083,.618],9045:[.684,0,.778],9046:[.552,.052,.72],9047:[.773,.083,.618],9048:[.705,0,.278],9049:[.615,0,.618],9050:[.668,0,.568],9051:[.575,0,.588],9052:[.63,0,.551],9053:[.604,.02,.667],9054:[.773,.083,.618],9055:[.445,-.055,.5],9056:[.773,.083,.618],9057:[.802,.02,.778],9058:[.802,.033,1],9059:[.572,.07,.827],9060:[.552,-.108,.618],9061:[.592,-.055,.5],9062:[.75,.25,.667],9063:[.75,.25,.778],9064:[.592,-.191,.556,{ic:.001}],9065:[.592,.058,.778],9066:[.46,-.007,.278],9067:[.683,.033,1],9068:[.666,.022,.6],9069:[.75,.25,.6],9070:[.431,.193,.33],9071:[.773,.083,.618],9072:[.773,.083,.618],9073:[.583,.023,.642],9074:[.574,.032,.642],9075:[.442,.011,.308,{ic:.004}],9076:[.442,.216,.488],9077:[.442,.011,.641],9078:[.442,.19,.641,{ic:.018}],9079:[.453,.19,.471],9080:[.442,.19,.331],9081:[.442,.19,.641],9082:[.442,.011,.641,{ic:.018}],9083:[.699,.027,.833],9084:[.679,.262,.957],9085:[.174,0,.52],9086:[.454,0,.667],9087:[.75,.25,.278],9088:[.632,.02,.623],9089:[.462,0,.965],9090:[.462,0,1.076],9091:[.54,-.007,1.31],9092:[.483,-.017,.786],9093:[.75,.25,.566],9094:[.574,.073,.756],9095:[.343,0,.767],9096:[.59,.09,.788],9097:[.445,-.055,.5],9098:[.445,-.055,.5],9099:[.47,-.055,.5],9100:[.637,-.108,1.028],9101:[.703,0,.613],9102:[.703,-.001,.589],9103:[.605,.073,.756],9104:[.607,.071,.756],9105:[.605,.073,.756],9106:[.607,.071,.756],9107:[.367,-.133,.778],9108:[.755,.131,.93],9109:[.773,.083,.618],9110:[.452,.004,.738],9111:[.626,0,.748],9112:[.626,0,.748],9113:[.723,.011,.777],9114:[.494,.011,.777],9142:[.469,-.031,1.066],9146:[.472,-.432,.396],9147:[.328,-.288,.396],9148:[.184,-.144,.396],9149:[.04,0,.396],9150:[.75,.05,.444],9151:[.75,.05,.444],9152:[.65,.1,.551],9153:[.65,.1,.551],9154:[.65,.1,.551],9155:[.75,.19,.734],9156:[.75,.19,.734],9157:[.75,.19,.734],9158:[.75,.19,.6],9159:[.75,.19,.65],9160:[.75,.19,.65],9161:[.75,.19,.734],9162:[.75,.19,.734],9163:[.75,.05,.444],9164:[.75,.05,.444],9165:[.617,-.017,.566],9167:[.442,0,.668],9169:[.38,-.208,.5],9170:[.473,-.208,.5],9171:[.47,-.206,.5],9172:[.473,-.208,.848],9173:[.47,-.206,.848],9174:[.38,-.208,.848],9175:[.471,-.229,.636],9176:[.471,-.229,.636],9177:[.471,-.229,.636],9178:[.75,.03,.734],9179:[.388,-.022,.967],9186:[.583,.083,1.184],9187:[.755,.131,.93],9188:[.27,-.23,.856],9189:[.423,.083,1.07],9190:[.442,.011,1],9191:[.859,.083,.948],9192:[.209,.204,.746],9193:[.422,-.078,.591],9194:[.422,-.082,.591],9195:[.52,0,.591],9196:[.52,0,.591],9197:[.422,-.078,.499],9198:[.422,-.082,.645],9199:[.422,-.078,.645],9200:[.693,.146,.778],9201:[.693,.092,.778],9202:[.592,.092,.778],9203:[.698,0,.658],9208:[.415,-.085,.239],9209:[.415,-.085,.428],9210:[.413,-.087,.428],9211:[.481,-.036,.5],9212:[.445,-.055,.5],9213:[.367,-.135,.5],9214:[.582,.031,.667],9215:[.52,.02,.778],9250:[.694,.011,.556],9251:[.25,.105,.5],11159:[.562,.064,.766],11193:[.508,-.002,.978],11209:[.679,.162,.778],11216:[.583,.083,.778],11217:[.573,.073,.778],11218:[.673,.173,.744],11219:[.463,.313,.778],11220:[.713,0,.674],11221:[.582,0,.712],11222:[.563,.063,.712],11223:[.706,-.004,.485,{ic:.016}],11224:[.75,0,.614],11225:[.799,.049,.558],11226:[.742,.144,.346],11227:[.778,0,.626],11228:[.752,0,.57],11229:[.668,.25,.712],11230:[.631,.25,.6],11231:[.38,.25,.712],11232:[.77,.135,.801],11233:[.684,.097,.553],11234:[.737,-.009,.841],11235:[.725,-.081,.717],11236:[.77,.082,.801],11237:[.685,.084,.485],11238:[.706,0,.893],11239:[.625,-.023,.717],11240:[.568,.07,.826],11241:[.568,.07,.826],11248:[.7,.02,.585],11249:[.725,-.023,.485],11250:[.712,-.112,.713],11251:[.497,.015,.778],11252:[.557,0,.496],11253:[.575,.008,.504],11254:[.497,0,.778],11255:[.565,.007,.325],11256:[.377,.015,.456],11257:[.747,.011,1],11258:[.445,-.055,.952],11259:[.445,-.055,1.212],11260:[.67,.17,.486],11261:[.706,-.004,.485,{ic:.016}],11262:[.679,-.013,.778],11263:[.683,-.001,.377],11800:[.5,.256,.472],12306:[.622,.018,.793],12310:[.77,.27,.458],12311:[.77,.27,.458],12336:[.319,-.151,1.216],64256:[.705,0,.583,{ic:.045}],64257:[.705,0,.556],64258:[.705,0,.556],64259:[.705,0,.833],64260:[.705,0,.833],64261:[.705,.011,.669],64262:[.708,.011,.783],65126:[.34,-.086,.333],65279:[0,0,0],127:[.66,0,1.418]}}},"NCM"),{8215:{dir:i,stretch:[0,8215],HDW:[-.103,.293,.504],ext:.112,hd:[-.103,.293]}},["MJX-NCM-SY"]);
@@ -0,0 +1 @@
1
+ import{i,n as c}from"./mathjax-BKrHE4xs-3ca05bf6.js";c.dynamicSetup("","symbols-b-i",i({SYB:{bold:{161:[.5,.205,.35],162:[.516,.072,.511],164:[.543,.042,.894],166:[.75,.25,.319],169:[.686,0,.686],170:[.697,-.292,.496],171:[.472,0,.639],173:[.271,-.174,.383],174:[.686,0,.686],186:[.697,-.292,.482],187:[.472,0,.639],188:[.697,.01,.983],189:[.697,.01,.983],190:[.697,.01,.983],191:[.5,.2,.543],3647:[.758,.072,.818],8218:[.154,.196,.319],8219:[.694,-.346,.319],8222:[.154,.196,.571],8223:[.694,-.346,.411,{ic:.024}],8226:[.381,-.077,.894],8233:[.694,.195,.543],8240:[.75,.056,1.288],8241:[.75,.056,1.667],8249:[.472,0,.445],8250:[.472,0,.445],8251:[.543,.042,.894],8253:[.769,0,.543],8255:[-.068,.194,.732],8256:[.668,-.542,.732],8261:[.751,.257,.415],8262:[.751,.25,.415],8274:[.751,-.001,.575],8276:[-.068,.194,.732],8319:[.568,-.297,.383],8320:[.347,.055,.447],8353:[.758,.072,.831],8358:[.686,0,.9],8361:[.686,.008,1.189],8362:[.696,.005,1.042],8363:[.694,.048,.639],8369:[.686,0,.786],8370:[.75,.055,.904],8451:[.699,.01,1.086],8470:[.693,.005,1.103],8471:[.686,0,.686],8478:[.686,.011,.863],8480:[.686,-.261,1.038],8482:[.693,-.281,1.135],8494:[.696,.005,.795],8960:[.633,.132,.894],9250:[.694,.006,.639],9251:[.253,.11,.575],11800:[.499,.205,.543],64256:[.7,0,.671,{ic:.075}],64257:[.7,0,.639],64258:[.7,0,.639],64259:[.7,0,.958],64260:[.7,0,.958],64261:[.7,.006,.797],64262:[.708,.006,.867],65126:[.404,-.084,.383]}},SYI:{italic:{161:[.5,.216,.307,{ic:.013}],162:[.476,.045,.46,{ic:.01}],164:[.48,-.018,.767],166:[.75,.25,.278,{ic:.066}],169:[.683,0,.683],170:[.705,-.337,.473,{ic:.07}],171:[.483,0,.562],173:[.243,-.187,.358],174:[.683,0,.683],186:[.705,-.337,.429,{ic:.091}],187:[.483,0,.562],188:[.705,.116,.807,{ic:.031}],189:[.705,.013,.807],190:[.705,.116,.807,{ic:.031}],191:[.5,.216,.511],3647:[.728,.045,.704,{ic:.03}],8218:[.104,.195,.307],8219:[.694,-.396,.307,{ic:.08}],8222:[.104,.195,.49],8223:[.694,-.396,.361,{ic:.151}],8226:[.379,-.081,.767],8233:[.694,.194,.485,{ic:.116}],8240:[.75,.056,1.083],8241:[.75,.056,1.379,{ic:.007}],8249:[.483,0,.358,{ic:.016}],8250:[.483,0,.358],8251:[.471,-.018,.767],8253:[.756,0,.511,{ic:.04}],8255:[.327,-.077,.358,{ic:.001}],8256:[.666,-.538,.691,{ic:.001}],8261:[.751,.252,.383,{ic:.093}],8262:[.751,.249,.383,{ic:.063}],8274:[.751,-.001,.511,{ic:.105}],8276:[-.066,.194,.691],8320:[.347,.055,.409],8353:[.728,.045,.716,{ic:.096}],8358:[.683,0,.743,{ic:.109}],8361:[.683,.022,.999,{ic:.125}],8363:[.694,.03,.511,{ic:.056}],8369:[.683,0,.678,{ic:.052}],8370:[.749,.055,.773,{ic:.037}],8451:[.706,.021,.92,{ic:.096}],8470:[.695,.01,.894,{ic:.009}],8471:[.683,0,.683],8478:[.683,.022,.729],8480:[.683,-.247,.875,{ic:.083}],8482:[.687,-.277,.967,{ic:.098}],8494:[.701,.01,.673,{ic:.056}],8960:[.557,.057,.767,{ic:.063}],9250:[.694,.011,.46],9251:[.251,.105,.511],11800:[.499,.216,.511],64256:[.705,.205,.613,{ic:.145}],64257:[.705,.205,.562,{ic:.034}],64258:[.705,.205,.588,{ic:.049}],64259:[.705,.205,.882,{ic:.034}],64260:[.705,.205,.894,{ic:.049}],64261:[.705,.205,.612,{ic:.041}],64262:[.708,.011,.741,{ic:.041}],65126:[.325,-.075,.358],163:[.706,.011,.769],165:[.683,0,.743,{ic:.131}],167:[.713,.213,.49,{ic:.047}],172:[.367,-.133,.767,{ic:.014}],177:[.614,0,.767],181:[.441,.216,.511,{ic:.024}],182:[.694,.194,.611,{ic:.144}],183:[.346,-.24,.278],215:[.471,-.018,.767],240:[.695,.011,.511,{ic:.024}],247:[.46,-.04,.767],8224:[.705,.216,.444,{ic:.052}],8225:[.705,.205,.444,{ic:.064}]}},SYBI:{"bold-italic":{161:[.5,.211,.386],162:[.516,.072,.532,{ic:.004}],164:[.516,.015,.886],166:[.75,.25,.319,{ic:.059}],169:[.686,0,.686],170:[.703,-.318,.544,{ic:.073}],171:[.472,0,.65],173:[.269,-.175,.414],174:[.686,0,.686],186:[.703,-.318,.496,{ic:.095}],187:[.472,0,.65],188:[.703,.116,.966,{ic:.002}],189:[.703,.01,.966],190:[.703,.116,.966,{ic:.002}],191:[.5,.211,.591],3647:[.758,.072,.817,{ic:.014}],8218:[.144,.197,.356],8219:[.695,-.354,.355,{ic:.081}],8222:[.144,.197,.59],8223:[.695,-.354,.444,{ic:.163}],8226:[.386,-.072,.886],8233:[.694,.194,.562,{ic:.103}],8240:[.75,.056,1.222],8241:[.75,.056,1.578],8249:[.472,0,.409],8250:[.472,0,.409],8251:[.516,.015,.886],8253:[.775,0,.591,{ic:.023}],8255:[-.068,.194,.798],8256:[.668,-.542,.798],8261:[.751,.257,.444,{ic:.084}],8262:[.751,.249,.444,{ic:.062}],8274:[.75,-.001,.591,{ic:.089}],8276:[-.068,.194,.798],8320:[.347,.055,.473],8353:[.758,.072,.827,{ic:.082}],8358:[.686,0,.896,{ic:.107}],8361:[.686,.017,1.16,{ic:.114}],8362:[.696,.005,1.042,{ic:.046}],8363:[.695,.048,.591,{ic:.031}],8369:[.686,0,.787,{ic:.038}],8370:[.75,.055,.895,{ic:.013}],8451:[.709,.021,1.062,{ic:.083}],8470:[.698,.01,1.087],8471:[.686,0,.686],8478:[.686,.017,.859],8480:[.686,-.254,1.034,{ic:.076}],8482:[.693,-.281,1.121,{ic:.094}],8494:[.704,.01,.796,{ic:.047}],8960:[.603,.102,.886,{ic:.059}],9250:[.695,.008,.532,{ic:.005}],9251:[.253,.11,.591],11800:[.5,.216,.591],64256:[.702,.202,.756,{ic:.138}],64257:[.702,.202,.674,{ic:.034}],64258:[.702,.202,.704,{ic:.045}],64259:[.702,.202,1.045,{ic:.034}],64260:[.702,.202,1.059,{ic:.045}],64261:[.702,.202,.735,{ic:.034}],64262:[.708,.008,.85,{ic:.034}],65126:[.382,-.066,.414],163:[.706,.008,.869],165:[.686,0,.866,{ic:.119}],167:[.714,.214,.685,{ic:.026}],172:[.393,-.108,.886,{ic:.006}],177:[.693,0,.886],181:[.455,.216,.591,{ic:.034}],182:[.694,.194,.703,{ic:.141}],183:[.387,-.24,.278,{ic:.025}],215:[.516,.015,.886],240:[.695,.011,.591,{ic:.022}],247:[.558,.057,.886],8224:[.702,.211,.511,{ic:.054}],8225:[.702,.202,.511,{ic:.062}]}}},"NCM"),{},["MJX-NCM-SYB","MJX-NCM-SYI","MJX-NCM-SYBI"]);
@@ -0,0 +1,249 @@
1
+ import{t as dt}from"./defineProperty-a20a667d.js";import{i as aa,m as sa,n as la,r as ca}from"./tool-host-contract-b93b482c.js";import{t as ha}from"./sanitize-svg-icon-b9082bba.js";import{i as ua}from"./provider-4c704118.js";import{a as fa,i as da,l as yt,n as va,o as Qe,r as pa,s as yr,u as ga}from"./catalog-context-46d3e50e.js";var ar=" >>> ",ba=class{serialize(t,e){return{startContainer:this.getNodePath(t.startContainer,e),startOffset:t.startOffset,endContainer:this.getNodePath(t.endContainer,e),endOffset:t.endOffset,text:t.toString()}}deserialize(t,e){const n=this.findNodeByPath(t.startContainer,e),r=this.findNodeByPath(t.endContainer,e);if(!n||!r)return null;try{const o=new Range;return o.setStart(n,t.startOffset),o.setEnd(r,t.endOffset),o.toString()===t.text?o:null}catch(o){return console.warn("Failed to deserialize range:",o),null}}getNodePath(t,e){if(t===e)return"";if(t.nodeType===Node.TEXT_NODE){const n=t.parentNode;if(!n)throw new Error("Text node has no parent");const r=Array.from(n.childNodes).filter(o=>o.nodeType===Node.TEXT_NODE).indexOf(t);return`${yt(n)?this.getShadowRootPath(n,e):this.getElementPath(n,e)}::text[${r}]`}if(t.nodeType===Node.ELEMENT_NODE)return this.getElementPath(t,e);if(yt(t))return this.getShadowRootPath(t,e);throw new Error(`Unsupported node type: ${t.nodeType}`)}getElementPath(t,e){if(t===e)return"";const n=e.getRootNode?.(),r=[];let o=[],i=t;const a=s=>{r.unshift(o.join(" > ")),o=[],i=s.host};for(;i&&i!==e;){if(i.id){o.unshift(`#${i.id}`);const w=i.getRootNode?.();if(yt(w)&&w!==n){a(w);continue}break}const s=i.parentElement,u=i.parentNode,h=s??(yt(u)?u:null);if(!h)break;const f=i.tagName,v=Array.from(h.children).filter(w=>w.tagName===f),b=v.indexOf(i),d=v.length>1?`${f.toLowerCase()}:nth-of-type(${b+1})`:f.toLowerCase();o.unshift(d),s?i=s:a(h)}return r.unshift(o.join(" > ")),r.join(ar)}getShadowRootPath(t,e){return`${this.getElementPath(t.host,e)}${ar}`}resolveElementPath(t,e){let n=e;const r=t.split(ar);for(let o=0;o<r.length;o++){if(o>0){const s=yt(n)?null:n.shadowRoot;if(!s)return null;n=s}const i=r[o].trim();if(!i)continue;const a=n.querySelector(i);if(!a)return null;n=a}return n}findNodeByPath(t,e){if(t==="")return e;if(t.includes("::text[")){const n=t.lastIndexOf("::text["),r=t.slice(0,n),o=t.slice(n+7),i=Number.parseInt(o.replace("]",""),10);let a;try{a=this.resolveElementPath(r,e)}catch(s){return console.warn("Invalid selector path:",t,s),null}return a&&Array.from(a.childNodes).filter(s=>s.nodeType===Node.TEXT_NODE)[i]||null}try{return this.resolveElementPath(t,e)}catch(n){return console.warn("Invalid selector path:",t,n),null}}serializeMany(t,e){return t.map(n=>this.serialize(n,e))}deserializeMany(t,e){return t.map(n=>this.deserialize(n,e))}},Bt;(function(t){t.TTS_WORD="tts-word",t.TTS_SENTENCE="tts-sentence",t.ANNOTATION="annotation"})(Bt||(Bt={}));var wt;(function(t){t.YELLOW="yellow",t.GREEN="green",t.BLUE="blue",t.PINK="pink",t.ORANGE="orange",t.UNDERLINE="underline"})(wt||(wt={}));var qo=`
2
+ /* TTS highlights - temporary */
3
+ ::highlight(tts-word) {
4
+ background-color: var(--pie-tts-word-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 68%, transparent));
5
+ text-decoration: underline 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));
6
+ text-underline-offset: 2px;
7
+ text-shadow: 0 0 1px var(--pie-tts-word-shadow, color-mix(in srgb, var(--pie-text, #111827) 35%, transparent));
8
+ color: inherit;
9
+ }
10
+
11
+ /* tts-sentence registry id: coarse read-along band (visual line boxes in layout) */
12
+ ::highlight(tts-sentence) {
13
+ background-color: var(--pie-tts-line-highlight, var(--pie-tts-sentence-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 38%, transparent)));
14
+ color: inherit;
15
+ }
16
+
17
+ [data-pie-tts-sentence-element="true"] {
18
+ background-color: var(--pie-tts-line-highlight, var(--pie-tts-sentence-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 38%, transparent)));
19
+ border-radius: 0.12em;
20
+ box-decoration-break: clone;
21
+ -webkit-box-decoration-break: clone;
22
+ }
23
+
24
+ [data-pie-tts-word-element="true"] {
25
+ background-color: var(--pie-tts-word-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 68%, transparent));
26
+ text-decoration: underline 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));
27
+ text-underline-offset: 2px;
28
+ text-shadow: 0 0 1px var(--pie-tts-word-shadow, color-mix(in srgb, var(--pie-text, #111827) 35%, transparent));
29
+ border-bottom: 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));
30
+ padding-bottom: 1px;
31
+ border-radius: 0.12em;
32
+ box-decoration-break: clone;
33
+ -webkit-box-decoration-break: clone;
34
+ }
35
+
36
+ /* Annotation highlights - persistent */
37
+ ::highlight(annotation-yellow) {
38
+ background-color: var(--pie-annotation-yellow-highlight, rgba(253, 233, 149, 0.5));
39
+ color: inherit;
40
+ }
41
+
42
+ ::highlight(annotation-green) {
43
+ background-color: var(--pie-annotation-green-highlight, rgba(166, 225, 197, 0.5));
44
+ color: inherit;
45
+ }
46
+
47
+ ::highlight(annotation-blue) {
48
+ background-color: var(--pie-annotation-blue-highlight, rgba(167, 224, 246, 0.5));
49
+ color: inherit;
50
+ }
51
+
52
+ ::highlight(annotation-pink) {
53
+ background-color: var(--pie-annotation-pink-highlight, rgba(255, 159, 174, 0.5));
54
+ color: inherit;
55
+ }
56
+
57
+ ::highlight(annotation-orange) {
58
+ background-color: var(--pie-annotation-orange-highlight, rgba(255, 165, 0, 0.5));
59
+ color: inherit;
60
+ }
61
+
62
+ /* The base light/dark pair is fixed: #4221d5 on light, #9c89ec on dark.
63
+ One value cannot serve both -- #4221d5 is 2.41:1 on black and #9c89ec is
64
+ 2.85:1 on white -- so neither of those two consults the theme accent,
65
+ which is chosen against one background and illegible on the other.
66
+
67
+ Each state has its own token so overriding one never silently moves the
68
+ other, and so either can beat a host-set pie-primary: a var() fallback
69
+ can never override a value the host actually set. */
70
+ ::highlight(annotation-underline) {
71
+ background-color: transparent;
72
+ text-decoration: underline 2px solid var(--pie-annotation-underline, #4221d5);
73
+ text-underline-offset: 2px;
74
+ color: inherit;
75
+ }
76
+
77
+ /* The blocks below cover annotation swatches, print, and reduced motion.
78
+ They deliberately do NOT retune the TTS layers: applyAdaptiveTTSStyle()
79
+ writes the pie-tts custom properties inline on documentElement on every
80
+ paint and on theme change, so a media query that only varies a var()
81
+ fallback for those can never take effect. Annotation colours have no such
82
+ adaptive path -- they are fixed swatches a student chose -- so a media
83
+ query is the only way to adjust them, and each keeps its var() so a host
84
+ override still wins.
85
+
86
+ The names above are spelled without their leading dashes on purpose.
87
+ check-theme-tokens scans comments, and its token pattern stops at the
88
+ first non-alphanumeric character, so writing the wildcard form reads as
89
+ consumption of a shorter token that is not in the registry and fails the
90
+ check. Spell property names in full, or omit the dashes. */
91
+
92
+ @media (prefers-color-scheme: dark) {
93
+ ::highlight(annotation-yellow) {
94
+ background-color: var(--pie-annotation-yellow-highlight, rgba(139, 117, 0, 0.6));
95
+ }
96
+ ::highlight(annotation-green) {
97
+ background-color: var(--pie-annotation-green-highlight, rgba(45, 92, 63, 0.6));
98
+ }
99
+ ::highlight(annotation-blue) {
100
+ background-color: var(--pie-annotation-blue-highlight, rgba(0, 102, 170, 0.6));
101
+ }
102
+ ::highlight(annotation-pink) {
103
+ background-color: var(--pie-annotation-pink-highlight, rgba(139, 51, 74, 0.6));
104
+ }
105
+ ::highlight(annotation-orange) {
106
+ background-color: var(--pie-annotation-orange-highlight, rgba(154, 99, 0, 0.6));
107
+ }
108
+ ::highlight(annotation-underline) {
109
+ text-decoration-color: var(--pie-annotation-underline-dark, #9c89ec);
110
+ }
111
+ }
112
+
113
+ /* The media query above reports the OS preference, which is only a guess
114
+ at what the page is actually showing. An app that declares a theme has
115
+ the final say, so the rules below override it. pie-theme always stamps
116
+ data-theme on documentElement (scope="document") or on its own host, and
117
+ resolves to a dark palette only for the literal value "dark" -- every
118
+ other value, including DaisyUI theme ids, maps to a light base.
119
+
120
+ The three cases are mutually exclusive, so they never fight each other.
121
+ All carry attribute selectors, which outrank the bare ::highlight() rules
122
+ above -- including the one inside the media query, since a media query
123
+ adds no specificity -- whatever the source order. */
124
+ [data-theme="light"] ::highlight(annotation-underline) {
125
+ text-decoration-color: var(--pie-annotation-underline, #4221d5);
126
+ }
127
+
128
+ [data-theme="dark"] ::highlight(annotation-underline) {
129
+ text-decoration-color: var(--pie-annotation-underline-dark, #9c89ec);
130
+ }
131
+
132
+ /* A host or DaisyUI palette: follow its accent so the mark belongs to that
133
+ theme, falling back to the light default when it declares none. */
134
+ [data-theme]:not([data-theme="light"]):not([data-theme="dark"]) ::highlight(annotation-underline) {
135
+ text-decoration-color: var(--pie-annotation-underline, var(--pie-primary, #4221d5));
136
+ }
137
+
138
+ /* WCAG 2.2 SC 1.4.11 non-text contrast: a highlight is the only indication
139
+ that text is annotated, so the swatches saturate and the underline
140
+ thickens when the user asks for more contrast.
141
+
142
+ The value is "more", not "high". The stylesheet this was recovered from
143
+ used prefers-contrast: high, which is not a valid value for the feature
144
+ -- the keywords are no-preference, more, less, custom. An invalid query
145
+ evaluates to "not all", so that block could never have matched in any
146
+ browser even had the file been loaded. Verified with matchMedia under
147
+ emulation: "high" stays false where "more" flips true. */
148
+ @media (prefers-contrast: more) {
149
+ ::highlight(annotation-yellow) {
150
+ background-color: var(--pie-annotation-yellow-highlight, rgba(255, 255, 0, 0.7));
151
+ }
152
+ ::highlight(annotation-green) {
153
+ background-color: var(--pie-annotation-green-highlight, rgba(0, 255, 127, 0.7));
154
+ }
155
+ ::highlight(annotation-blue) {
156
+ background-color: var(--pie-annotation-blue-highlight, rgba(0, 191, 255, 0.7));
157
+ }
158
+ ::highlight(annotation-pink) {
159
+ background-color: var(--pie-annotation-pink-highlight, rgba(255, 105, 180, 0.7));
160
+ }
161
+ ::highlight(annotation-orange) {
162
+ background-color: var(--pie-annotation-orange-highlight, rgba(255, 165, 0, 0.85));
163
+ }
164
+ ::highlight(annotation-underline) {
165
+ text-decoration-thickness: 3px;
166
+ }
167
+ }
168
+
169
+ @media print {
170
+ /* TTS highlighting is a transient read-along cue, not content. */
171
+ ::highlight(tts-word),
172
+ ::highlight(tts-sentence),
173
+ [data-pie-tts-word-element="true"],
174
+ [data-pie-tts-sentence-element="true"] {
175
+ background-color: transparent;
176
+ text-decoration: none;
177
+ text-shadow: none;
178
+ border-bottom: none;
179
+ }
180
+
181
+ /* Annotations are student work and must survive printing, but a fill
182
+ that reads fine on screen can print as an illegible wash, so each
183
+ becomes an underline that keeps its colour coding. */
184
+ ::highlight(annotation-yellow),
185
+ ::highlight(annotation-green),
186
+ ::highlight(annotation-blue),
187
+ ::highlight(annotation-pink),
188
+ ::highlight(annotation-orange) {
189
+ background-color: transparent;
190
+ border-bottom: 2px solid currentColor;
191
+ }
192
+ ::highlight(annotation-yellow) { border-bottom-color: #ffeb3b; }
193
+ ::highlight(annotation-green) { border-bottom-color: #a6e1c5; }
194
+ ::highlight(annotation-blue) { border-bottom-color: #a7e0f6; }
195
+ ::highlight(annotation-pink) { border-bottom-color: #ff9fae; }
196
+ ::highlight(annotation-orange) { border-bottom-color: #ffa500; }
197
+ ::highlight(annotation-underline) {
198
+ text-decoration-color: #000;
199
+ border-bottom: none;
200
+ }
201
+ }
202
+
203
+ /* text-shadow is a direct property rather than a var(), so unlike the
204
+ other TTS rules this one is not overridden by the adaptive path. */
205
+ @media (prefers-reduced-motion: reduce) {
206
+ ::highlight(tts-word),
207
+ [data-pie-tts-word-element="true"] {
208
+ text-shadow: none;
209
+ }
210
+ }
211
+ `,lo=Symbol.for("@pie-players/pie-assessment-toolkit/highlight-stylesheet"),co=Symbol.for("@pie-players/pie-assessment-toolkit/highlight-stylesheet-adopted"),ho=t=>!!t&&typeof t.replaceSync=="function",ma=()=>{const t=globalThis,e=t[lo];if(ho(e))return e;const n=globalThis.CSSStyleSheet;if(typeof n!="function")return null;try{const r=new n;return ho(r)?(r.replaceSync(qo),t[lo]=r,r):null}catch{return null}},Fe=t=>{const e=t?.getRootNode?.();if(!yt(e))return;const n=e,r=n.adoptedStyleSheets;if(!r||typeof r!="object")return;const o=Array.from(r),i=n[co];if(i&&o.includes(i))return;const a=ma();if(a)try{n.adoptedStyleSheets=[...o,a],n[co]=a}catch{}},sr="tts-word",lr="tts-sentence",ke=t=>`annotation-${t}`,ie=t=>{const e=CSS.highlights.get(t);if(e)return e;const n=new Highlight;return CSS.highlights.set(t,n),n},ze=(t,e)=>{const n=CSS.highlights.get(t);if(n)for(const r of e)n.delete(r)},uo=t=>{const e=t[0]?.startContainer;return e?e.nodeType===Node.ELEMENT_NODE?e:yr(e):null},zt={source:null,override:null},Ho=class Sr{constructor(){if(dt(this,"ttsWordRanges",new Set),dt(this,"ttsSentenceRanges",new Set),dt(this,"ttsWordElementHighlights",new Set),dt(this,"ttsSentenceElementHighlights",new Set),dt(this,"annotations",new Map),dt(this,"ttsStyleSource",null),dt(this,"nextAnnotationId",1),dt(this,"supported",!1),dt(this,"rangeSerializer",void 0),dt(this,"themeObserver",null),this.rangeSerializer=new ba,typeof CSS>"u"||!("highlights"in CSS)){console.warn("CSS Custom Highlight API not supported (SSR or unsupported browser)");return}this.supported=!0,this.initializeHighlights(),this.registerStyles(),this.applyAdaptiveTTSStyle(),this.setupThemeObservation()}setupThemeObservation(){if(typeof document>"u"||typeof MutationObserver>"u")return;const e=()=>this.applyAdaptiveTTSStyle();this.themeObserver=new MutationObserver(e),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["style","data-theme","data-color-scheme","class"]});for(const n of document.querySelectorAll("pie-theme"))this.themeObserver.observe(n,{attributes:!0,attributeFilter:["theme","scheme","provider","variables","style","data-theme","data-color-scheme"]})}parseColor(e){if(!e)return null;const n=e.trim();if(!n)return null;const r=/^#([a-f\d]{3}|[a-f\d]{6})$/i.exec(n);if(r){const i=r[1];return i.length===3?[parseInt(i[0]+i[0],16),parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16)]:[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16)]}const o=/^rgba?\((.+)\)$/i.exec(n);if(o){const i=o[1].replace(/\//g,",").split(/[,\s]+/).map(h=>h.trim()).filter(Boolean),a=Number(i[0]),s=Number(i[1]),u=Number(i[2]);if(Number.isFinite(a)&&Number.isFinite(s)&&Number.isFinite(u))return[a,s,u]}if(typeof document<"u"){const i=document.createElement("span");if(i.style.color=n,typeof i.style.color=="string"&&i.style.color){document.body?.appendChild(i);const a=typeof getComputedStyle=="function"?getComputedStyle(i).color:"";i.remove();const s=a.trim();if(s&&s!==n)return this.parseColor(a)}}return null}relativeLuminance([e,n,r]){const o=u=>{const h=u/255;return h<=.03928?h/12.92:((h+.055)/1.055)**2.4},i=o(e),a=o(n),s=o(r);return .2126*i+.7152*a+.0722*s}contrastRatio(e,n){const r=this.relativeLuminance(e),o=this.relativeLuminance(n),i=Math.max(r,o),a=Math.min(r,o);return(i+.05)/(a+.05)}blend(e,n,r){return[Math.round(e[0]*r+n[0]*(1-r)),Math.round(e[1]*r+n[1]*(1-r)),Math.round(e[2]*r+n[2]*(1-r))]}resolveAdaptiveTTSStyle(e){const n=[255,235,59],r=[17,24,39],o=[255,255,255],i=e||(typeof document<"u"?document.documentElement:null),a=i&&typeof getComputedStyle=="function"?getComputedStyle(i):null,s=this.parseColor(a?.getPropertyValue("--pie-background")||a?.backgroundColor)||o,u=this.parseColor(a?.getPropertyValue("--pie-text"))||r,h=zt.override,f=h?this.parseColor(h.color)||n:this.parseColor(a?.getPropertyValue("--pie-missing"))||n,v=h?[Math.max(.3,Math.min(.95,h.opacity))]:[.8,.72,.68,.62,.56,.5];let b=v[v.length-1],d=-1/0;for(const D of v){const H=this.blend(f,s,D),G=this.contrastRatio(H,s),K=this.contrastRatio(H,u),J=G*1.2+K*.8;if(G>=1.25&&K>=2.4){b=D;break}J>d&&(d=J,b=D)}const w=Math.max(.24,Math.min(.85,b*.55)),T=Math.max(.55,Math.min(.95,b+.2)),g=Math.max(.22,Math.min(.6,b*.45)),y=u,L=this.blend(y,s,T),O=this.contrastRatio(L,s),x=this.relativeLuminance(s)>.45?[0,0,0]:[255,255,255],W=O>=1.35?y:x;return{wordHighlight:`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${b})`,sentenceHighlight:`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${w})`,wordUnderline:`rgba(${W[0]}, ${W[1]}, ${W[2]}, ${T})`,wordShadow:`rgba(${W[0]}, ${W[1]}, ${W[2]}, ${g})`}}applyAdaptiveTTSStyle(e){if(typeof document>"u")return;e&&(this.ttsStyleSource=e,zt.source=e);const n=e??(zt.source?.isConnected?zt.source:null),r=this.resolveAdaptiveTTSStyle(n),o=document.documentElement.style,i=[["--pie-tts-word-highlight",r.wordHighlight],["--pie-tts-sentence-highlight",r.sentenceHighlight],["--pie-tts-line-highlight",r.sentenceHighlight],["--pie-tts-word-underline",r.wordUnderline],["--pie-tts-word-shadow",r.wordShadow]];for(const[a,s]of i)o.getPropertyValue?.(a)!==s&&o.setProperty(a,s)}initializeHighlights(){if(this.supported){ie(sr),ie(lr);for(const e of Object.values(wt))ie(ke(e))}}registerStyles(){if(!this.supported||typeof document>"u"||document.getElementById("pie-highlight-styles"))return;const e=document.createElement("style");e.id="pie-highlight-styles",e.textContent=qo,document.head.appendChild(e)}highlightTTSWord(e){if(!this.supported)return;this.applyAdaptiveTTSStyle(uo(e)),this.clearTTSWord();const n=ie(sr);for(const r of e)Fe(r.startContainer),n.add(r),this.ttsWordRanges.add(r);this.highlightTTSWordElementFallbacks(e.filter(r=>r.startContainer!==r.endContainer||r.startContainer.nodeType!==Node.TEXT_NODE))}highlightTTSWordElement(e){this.supported&&(this.applyAdaptiveTTSStyle(e),Fe(e),this.clearTTSWord(),e.setAttribute("data-pie-tts-word-element","true"),this.ttsWordElementHighlights.add(e))}highlightTTSSentence(e){if(!this.supported)return;this.applyAdaptiveTTSStyle(uo(e)),this.clearTTSSentence();const n=ie(lr);for(const r of e)Fe(r.startContainer),n.add(r),this.ttsSentenceRanges.add(r);this.highlightTTSElementFallbacks(e)}highlightTTSSentenceElements(e){if(this.supported){this.applyAdaptiveTTSStyle(e[0]||null),this.clearTTSSentence();for(const n of e)Fe(n),n.setAttribute("data-pie-tts-sentence-element","true"),this.ttsSentenceElementHighlights.add(n)}}highlightTTSElementFallbacks(e){typeof Element>"u"||this.highlightElementFallbacks(e,"data-pie-tts-sentence-element",this.ttsSentenceElementHighlights,Sr.SENTENCE_FALLBACK_SELECTOR)}highlightTTSWordElementFallbacks(e){typeof Element>"u"||this.highlightElementFallbacks(e,"data-pie-tts-word-element",this.ttsWordElementHighlights,Sr.WORD_FALLBACK_SELECTOR)}highlightElementFallbacks(e,n,r,o){const i=a=>a.nodeType===Node.ELEMENT_NODE?a:yr(a);for(const a of e){const s=a.commonAncestorContainer,u=yt(s)?s:i(s);if(!u)continue;const h=[],f=i(a.startContainer),v=i(a.endContainer);for(const b of[f,v]){let d=b;for(;d;)d.matches?.(o)&&h.push(d),d=yr(d)}!yt(u)&&u.matches?.(o)&&h.push(u),h.push(...Array.from(u.querySelectorAll(o)));for(const b of new Set(h)){try{if(!a.intersectsNode(b)&&!Qe(b,f)&&!Qe(b,v))continue}catch{continue}b.setAttribute(n,"true"),r.add(b)}}}clearTTSWord(){if(this.supported){ze(sr,this.ttsWordRanges),this.ttsWordRanges.clear();for(const e of this.ttsWordElementHighlights)e.removeAttribute("data-pie-tts-word-element");this.ttsWordElementHighlights.clear()}}clearTTSSentence(){if(this.supported){ze(lr,this.ttsSentenceRanges),this.ttsSentenceRanges.clear();for(const e of this.ttsSentenceElementHighlights)e.removeAttribute("data-pie-tts-sentence-element");this.ttsSentenceElementHighlights.clear()}}clearTTS(){this.clearTTSWord(),this.clearTTSSentence(),zt.source===this.ttsStyleSource&&(zt.source=null),this.ttsStyleSource=null}addAnnotation(e,n=wt.YELLOW){const r=`annotation-${this.nextAnnotationId++}`,o=e.cloneRange();Fe(o.startContainer);const i={id:r,range:o,type:Bt.ANNOTATION,color:n,timestamp:Date.now()};return this.annotations.set(r,i),this.supported&&ie(ke(n)).add(o),r}removeAnnotation(e){const n=this.annotations.get(e);if(!n){console.warn(`[HighlightCoordinator] Annotation ${e} not found`);return}this.supported&&ze(ke(n.color),[n.range]),this.annotations.delete(e)}clearAnnotations(){if(this.supported)for(const e of this.annotations.values())ze(ke(e.color),[e.range]);this.annotations.clear()}getAnnotations(){return Array.from(this.annotations.values())}getAnnotation(e){return this.annotations.get(e)??null}changeAnnotationColor(e,n){const r=this.annotations.get(e);if(!r)return;const o=r.color;o!==n&&(r.color=n,this.supported&&(ze(ke(o),[r.range]),ie(ke(n)).add(r.range)))}exportAnnotations(e=document.body){return this.getAnnotations().map(n=>({...this.rangeSerializer.serialize(n.range,e),id:n.id,color:n.color,timestamp:n.timestamp}))}importAnnotations(e,n=document.body){let r=0;for(const o of e){const i=this.rangeSerializer.deserialize(o,n);i&&(this.addAnnotation(i,o.color),r++)}return r}highlightRange(e,n,r=wt.YELLOW){if(this.supported)switch(n){case Bt.TTS_WORD:this.highlightTTSWord([e]);break;case Bt.TTS_SENTENCE:this.highlightTTSSentence([e]);break;case Bt.ANNOTATION:this.addAnnotation(e,r)}}clearHighlights(e){if(this.supported)switch(e){case Bt.TTS_WORD:this.clearTTSWord();break;case Bt.TTS_SENTENCE:this.clearTTSSentence();break;case Bt.ANNOTATION:this.clearAnnotations()}}clearAll(){this.supported&&(this.clearTTS(),this.clearAnnotations())}isSupported(){return this.supported}updateTTSHighlightStyle(e,n){if(!this.supported||typeof document>"u"||!document.getElementById("pie-highlight-styles"))return;const o=(i=>{const a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return a?{r:parseInt(a[1],16),g:parseInt(a[2],16),b:parseInt(a[3],16)}:null})(e);o&&(zt.override={color:`rgb(${o.r}, ${o.g}, ${o.b})`,opacity:Math.max(.2,Math.min(.95,n)),owner:this},this.applyAdaptiveTTSStyle())}destroy(){this.supported&&(this.clearTTS(),this.clearAnnotations(),zt.override?.owner===this&&(zt.override=null),this.themeObserver?.disconnect(),this.themeObserver=null)}};dt(Ho,"SENTENCE_FALLBACK_SELECTOR","math, mjx-container, svg, img, canvas, [role='img']");dt(Ho,"WORD_FALLBACK_SELECTOR","svg, img, canvas, [role='img']");function wa(t){return typeof t=="object"&&t!==null&&t.code==="tts-start-failed"}if(typeof window<"u"){var fo,vo;((fo=(vo=window).__svelte??(vo.__svelte={})).v??(fo.v=new Set)).add("5")}var me={},B=Symbol("uninitialized"),ya="http://www.w3.org/2000/svg",Sa="http://www.w3.org/1998/Math/MathML",Fo=Array.isArray,Ta=Array.prototype.indexOf,Tr=Array.prototype.includes,Xn=Array.from,Pn=Object.keys,tn=Object.defineProperty,ve=Object.getOwnPropertyDescriptor,ka=Object.getOwnPropertyDescriptors,xa=Object.prototype,$a=Array.prototype,zo=Object.getPrototypeOf,po=Object.isExtensible,_a=()=>{};function Ea(t){for(var e=0;e<t.length;e++)t[e]()}function Vo(){var t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}function en(t){"@babel/helpers - typeof";return en=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},en(t)}function Aa(t,e){if(en(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(en(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Na(t){var e=Aa(t,"string");return en(e)=="symbol"?e:e+""}function I(t,e,n){return(e=Na(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var pt=1024,_t=2048,ye=4096,qr=8192,Ca=16384,Hr=32768,go=1<<25,Fr=65536,We=1<<19,Ra=1<<20,Xe=1<<25,bo=1<<21,Ma=1<<22,In=1<<23,Je=Symbol("$state"),jo=Symbol("component"),Bo=Symbol("legacy props"),Oa=Symbol(""),kr=Symbol("attributes"),xr=Symbol("class"),$r=Symbol("style"),Mn=Symbol("text"),ln=new class extends Error{constructor(...t){super(...t),I(this,"name","StaleReactionError"),I(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},La=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");function Wa(){console.warn("https://svelte.dev/e/derived_inert")}function cn(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function Pa(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var A=!1;function Ut(t){A=t}var R;function Y(t){if(t===null)throw cn(),me;return R=t}function Ce(){return Y(Et(R))}function Be(t){if(A){if(Et(R)!==null)throw cn(),me;R=t}}function Ia(t=1){if(A){for(var e=t,n=R;e--;)n=Et(n);R=n}}function Dn(t=!0){for(var e=0,n=R;;){if(n.nodeType===8){var r=n.data;if(r==="]"){if(e===0)return n;e-=1}else(r==="["||r==="[!"||r[0]==="["&&!isNaN(Number(r.slice(1))))&&(e+=1)}var o=Et(n);t&&n.remove(),n=o}}function Uo(t){if(!t||t.nodeType!==8)throw cn(),me;return t.data}function Go(t){return t===this.v}function Da(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Ko(t){return!Da(t,this.v)}function qa(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ha(t,e,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Fa(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function za(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Va(t){throw new Error("https://svelte.dev/e/effect_orphan")}function ja(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ba(){throw new Error("https://svelte.dev/e/hydration_failed")}function Ua(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ga(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ka(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Xa(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Ja(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var hn=!1,Jn=!1,z=null;function Re(t){z=t}function Xo(t,e=!1,n){z={p:z,i:!1,c:null,e:null,s:t,x:null,r:_,l:Jn&&!e?{s:null,u:null,$:[]}:null}}function Jo(t){var e=z,n=e.e;if(n!==null){e.e=null;for(var r of n)bi(r)}return t!==void 0&&(e.x=t),e.i=!0,z=e.p,zr(t)}function zr(t={}){return tn(t,jo,{value:!0}),t}function un(){return!Jn||z!==null&&z.l===null}var ue=[];function Zo(){var t=ue;ue=[],Ea(t)}function re(t){if(ue.length===0&&!Ze){var e=ue;queueMicrotask(()=>{e===ue&&Zo()})}ue.push(t)}function Za(){for(;ue.length>0;)Zo()}var Ya=~(_t|ye|pt);function V(t,e){t.f=t.f&Ya|e}function Vr(t){(t.f&512)!==0||t.deps===null?V(t,pt):V(t,ye)}function Yo(t,e,n){(t.f&2048)!==0?e.add(t):t.f&4096&&n.add(t),V(t,pt)}function Zn(t){var e=N,n=_;bt(null),Dt(null);try{return t()}finally{bt(e),Dt(n)}}function Qa(t,e,n,r){const o=un()?nn:jr;var i=t.filter(d=>!d.settled),a=e.map(o);if(n.length===0&&i.length===0){r(a);return}var s=_,u=ts(),h=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(d=>d.promise)):null;function f(d){if((s.f&16384)===0){u();try{r([...a,...d])}catch(w){It(w,s)}qn()}}var v=Qo();if(n.length===0){h.then(()=>f([])).finally(v);return}function b(){Promise.all(n.map(d=>es(d))).then(f).catch(d=>It(d,s)).finally(v)}h?h.then(()=>{u(),b(),qn()}):b()}function ts(){var t=_,e=N,n=z,r=E;return function(o=!0){Dt(t),bt(e),Re(n),o&&!(t.f&16384)&&(r?.activate(),r?.apply())}}function qn(t=!0){Dt(null),bt(null),Re(null),t&&E?.deactivate()}function Qo(){var t=_,e=t.b,n=E,r=!!e?.is_rendered();return e?.update_pending_count(1,n),n.increment(r,t),()=>{e?.update_pending_count(-1,n),n.decrement(r,t)}}function nn(t){var e=2|_t;return _!==null&&(_.f|=We),{ctx:z,deps:null,effects:null,equals:Go,f:e,fn:t,reactions:null,rv:0,v:B,wv:0,parent:_,ac:null}}var Ue=Symbol("obsolete");function es(t,e,n){let r=_;r===null&&qa();var o=void 0,i=we(B),a=!N,s=new Set;return bs(()=>{var u=_,h=Vo();o=h.promise;try{Promise.resolve(t()).then(h.resolve,d=>{d!==ln&&h.reject(d)}).finally(qn)}catch(d){h.reject(d),qn()}var f=E;if(a){if((u.f&32768)!==0)var v=Qo();if(r.b?.is_rendered())f.async_deriveds.get(u)?.reject(Ue);else for(const d of s.values())d.reject(Ue);s.add(h),f.async_deriveds.set(u,h)}const b=(d,w=void 0)=>{v?.(),s.delete(h),w!==Ue&&(f.activate(),w?(i.f|=In,Oe(i,w)):(i.f&8388608&&(i.f^=In),Oe(i,d)),f.deactivate())};h.promise.then(b,d=>b(null,d||"unknown"))}),vs(()=>{for(const u of s)u.reject(Ue)}),new Promise(u=>{function h(f){function v(){f===o?u(i):h(o)}f.then(v,v)}h(o)})}function Ct(t){const e=nn(t);return xi(e),e}function jr(t){const e=nn(t);return e.equals=Ko,e}function ns(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n<e.length;n+=1)rt(e[n])}}function Br(t){var e,n=_,r=t.parent;if(!Xt&&r!==null&&t.v!==B&&(r.f&24576)!==0)return Wa(),t.v;Dt(r);try{ns(t),e=Ai(t)}finally{Dt(n)}return e}function ti(t){var e=Br(t);if(!t.equals(e)&&(t.wv=_i(),(!E?.is_fork||t.deps===null)&&(E!==null?(E.capture(t,e,!0),Er?.capture(t,e,!0)):t.v=e,t.deps===null))){V(t,pt);return}Xt||(nt!==null?(Gr()||E?.is_fork)&&nt.set(t,e):Vr(t))}function rs(t){if(t.effects!==null)for(const e of t.effects)(e.teardown||e.ac)&&(e.teardown?.(),e.ac!==null&&Zn(()=>{e.ac.abort(ln),e.ac=null}),e.fn!==null&&(e.teardown=_a),on(e,0),Jr(e))}function ei(t){if(t.effects!==null)for(const e of t.effects)e.teardown&&e.fn!==null&&Le(e)}function ni(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ur(t,e){ni(t,e),e.add(t)}function k(t,e,n){ni(t,e),e.set(t,n)}function $(t,e,n){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function S(t,e,n){return t.set($(t,e),n),n}function l(t,e){return t.get($(t,e))}var ri,_r=null,xe=null,E=null,Er=null,nt=null,Ar=null,Ze=!1,cr=!1,rn=null,Hn=null,oi=0,os=1,Nr=new WeakMap,pe=new WeakMap,Ae=new WeakMap,Fn=new WeakMap,Tn=new WeakMap,$e=new WeakMap,ce=new WeakMap,Ge=new WeakMap,Lt=new WeakMap,mo=new WeakMap,Me=new WeakMap,Gt=new WeakMap,ee=new WeakMap,hr=new WeakMap,kn=new WeakMap,j=new WeakSet,Se=class ii{constructor(){Ur(this,j),I(this,"id",os++),k(this,Nr,!1),I(this,"linked",!0),k(this,pe,null),k(this,Ae,null),I(this,"async_deriveds",new Map),I(this,"current",new Map),I(this,"previous",new Map),k(this,Fn,new Set),k(this,Tn,new Set),k(this,$e,0),k(this,ce,new Map),k(this,Ge,null),k(this,Lt,[]),k(this,mo,[]),k(this,Me,new Set),k(this,Gt,new Set),k(this,ee,new Map),k(this,hr,new Set),I(this,"is_fork",!1),k(this,kn,!1),xe===null?_r=xe=this:(S(Ae,xe,this),S(pe,this,xe)),xe=this}skip_effect(e){l(ee,this).has(e)||l(ee,this).set(e,{d:[],m:[]}),l(hr,this).delete(e)}unskip_effect(e,n=r=>this.schedule(r)){var r=l(ee,this).get(e);if(r){l(ee,this).delete(e);for(var o of r.d)V(o,_t),n(o);for(o of r.m)V(o,ye),n(o)}l(hr,this).add(e)}capture(e,n,r=!1){e.v!==B&&!this.previous.has(e)&&this.previous.set(e,e.v),!(e.f&8388608)&&(this.current.set(e,[n,r]),nt?.set(e,n)),this.is_fork||(e.v=n)}activate(){E=this}deactivate(){E=null,nt=null}flush(){try{cr=!0,E=this,$(j,this,zn).call(this)}finally{oi=0,Ar=null,rn=null,Hn=null,cr=!1,E=null,nt=null,Pt.clear()}}discard(){for(const e of l(Tn,this))e(this);l(Tn,this).clear();for(const e of this.async_deriveds.values())e.reject(Ue);$(j,this,Vn).call(this),l(Ge,this)?.resolve()}register_created_effect(e){l(mo,this).push(e)}increment(e,n){if(S($e,this,l($e,this)+1),e){let r=l(ce,this).get(n)??0;l(ce,this).set(n,r+1)}}decrement(e,n){if(S($e,this,l($e,this)-1),e){let r=l(ce,this).get(n)??0;r===1?l(ce,this).delete(n):l(ce,this).set(n,r-1)}l(kn,this)||(S(kn,this,!0),re(()=>{S(kn,this,!1),this.linked&&this.flush()}))}transfer_effects(e,n){for(const r of e)l(Me,this).add(r);for(const r of n)l(Gt,this).add(r);e.clear(),n.clear()}oncommit(e){l(Fn,this).add(e)}ondiscard(e){l(Tn,this).add(e)}settled(){return(l(Ge,this)??S(Ge,this,Vo())).promise}static ensure(){if(E===null){const e=E=new ii;!cr&&!Ze&&re(()=>{l(Nr,e)||e.flush()})}return E}apply(){if(!hn||!this.is_fork&&l(pe,this)===null&&l(Ae,this)===null){nt=null;return}nt=new Map;for(const[n,[r]]of this.current)nt.set(n,r);for(let n=_r;n!==null;n=l(Ae,n))if(!(n===this||n.is_fork)){var e=!1;if(n.id<this.id){for(const[r,[,o]]of n.current)if(!o&&this.current.has(r)){e=!0;break}}if(!e)for(const[r,o]of n.previous)nt.has(r)||nt.set(r,o)}}schedule(e){if(Ar=e,e.b?.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}l(Lt,this).push(e)}};ri=Se;function wo(){if(this.is_fork)return!0;for(const n of l(ce,this).keys()){for(var t=n,e=!1;t.parent!==null;){if(l(ee,this).has(t)){e=!0;break}t=t.parent}if(!e)return!0}return!1}function is(){var t=[];for(const o of l(Lt,this))if(!((o.f&16384)!==0||(o.f&6144)===0)){for(var e=o,n=!1;e.parent!==null;){e=e.parent;var r=e.f;if((r&96)!==0){if((r&1024)===0){n=!0;break}e.f^=pt}}n||t.push(e)}return S(Lt,this,[]),t}function zn(){S(Nr,this,!0);for(const a of l(Me,this))l(Gt,this).delete(a),V(a,_t),this.schedule(a);for(const a of l(Gt,this))V(a,ye),this.schedule(a);this.apply();for(var t=rn=[],e=[],n=Hn=[];l(Lt,this).length>0;){oi++>1e3&&($(j,this,Vn).call(this),cs());for(const a of $(j,this,is).call(this))try{$(j,this,as).call(this,a,t,e)}catch(s){throw li(a),$(j,this,wo).call(this)||this.discard(),s}}if(E=null,n.length>0){var r=ri.ensure();for(const a of n)r.schedule(a)}if(rn=null,Hn=null,$(j,this,wo).call(this)){$(j,this,xn).call(this,e),$(j,this,xn).call(this,t);for(const[a,s]of l(ee,this))si(a,s);n.length>0&&$(j,E,zn).call(E);return}const o=$(j,this,ss).call(this);if(o){$(j,this,xn).call(this,e),$(j,this,xn).call(this,t),$(j,o,ls).call(o,this);return}l(Me,this).clear(),l(Gt,this).clear();for(const a of l(Fn,this))a(this);l(Fn,this).clear(),Er=this,yo(e),yo(t),Er=null,l(Ge,this)?.resolve();var i=E;if(l($e,this)===0&&(l(Lt,this).length===0||i!==null)&&$(j,this,Vn).call(this),l(Lt,this).length>0)if(i!==null){for(const a of l(Lt,this))l(Lt,i).push(a);S(Lt,this,[])}else i=this;i!==null&&(Pt.clear(),$(j,i,zn).call(i))}function as(t,e,n){t.f^=pt;for(var r=t.first;r!==null;){var o=r.f,i=(o&96)!==0;if(!(i&&(o&1024)!==0||(o&8192)!==0||l(ee,this).has(r))&&r.fn!==null){i?r.f^=pt:(o&4)!==0?e.push(r):hn&&(o&16777224)!==0?n.push(r):fn(r)&&(o&16&&l(Gt,this).add(r),Le(r));var a=r.first;if(a!==null){r=a;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}function ss(){for(var t=l(pe,this);t!==null;){if(!t.is_fork){for(const[e,[,n]]of this.current)if(t.current.has(e)&&!n)return t}t=l(pe,t)}return null}function ls(t){for(const[n,r]of t.current)!this.previous.has(n)&&t.previous.has(n)&&this.previous.set(n,t.previous.get(n)),this.current.set(n,r);for(const[n,r]of t.async_deriveds){const o=this.async_deriveds.get(n);o&&r.promise.then(o.resolve).catch(o.reject)}t.async_deriveds.clear(),this.transfer_effects(l(Me,t),l(Gt,t));const e=n=>{var r=n.reactions;if(r!==null&&!((n.f&2)!==0&&(n.f&6144)===0))for(const a of r){var o=a.f;if((o&2)!==0)e(a);else{var i=a;o&4194320&&!this.async_deriveds.has(i)&&(l(Gt,this).delete(i),V(i,_t),this.schedule(i))}}};for(const n of this.current.keys())e(n);this.oncommit(()=>t.discard()),$(j,t,Vn).call(t),E=this,$(j,this,zn).call(this)}function xn(t){for(var e=0;e<t.length;e+=1)Yo(t[e],l(Me,this),l(Gt,this))}function Vn(){if(this.linked){var t=l(pe,this),e=l(Ae,this);t===null?_r=e:S(Ae,t,e),e===null?xe=t:S(pe,e,t),this.linked=!1}}function jn(t){var e=Ze;Ze=!0;try{var n;for(t&&(E!==null&&!E.is_fork&&E.flush(),n=t());;){if(Za(),E===null)return n;E.flush()}}finally{Ze=e}}function cs(){try{ja()}catch(t){It(t,Ar)}}var Ot=null;function yo(t){var e=t.length;if(e!==0){for(var n=0;n<e;){var r=t[n++];if((r.f&24576)===0&&fn(r)&&(Ot=new Set,Le(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Si(r),Ot?.size>0)){Pt.clear();for(const o of Ot){if((o.f&24576)!==0)continue;const i=[o];let a=o.parent;for(;a!==null;)Ot.has(a)&&(Ot.delete(a),i.push(a)),a=a.parent;for(let s=i.length-1;s>=0;s--){const u=i[s];!(u.f&24576)&&Le(u)}}Ot.clear()}}Ot=null}}function ai(t){E.schedule(t)}function si(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):t.f&4096&&e.m.push(t),V(t,pt);for(var n=t.first;n!==null;)si(n,e),n=n.next}}function li(t){V(t,pt);for(var e=t.first;e!==null;)li(e),e=e.next}var Bn=new Set,Pt=new Map,ci=!1;function we(t,e){return{f:0,v:t,reactions:null,equals:Go,rv:0,wv:0}}function F(t,e){const n=we(t,e);return xi(n),n}function hi(t,e=!1,n=!0){const r=we(t);if(e||(r.equals=Ko),Jn&&n&&z!==null&&z.l!==null){var o;((o=z.l).s??(o.s=[])).push(r)}return r}function M(t,e,n=!1){return N!==null&&(!St||N.f&131072)&&un()&&N.f&4325394&&(kt===null||!kt.has(t))&&Xa(),Oe(t,n?fe(e):e,Hn)}var he=null,Cr=0;function Oe(t,e,n=null){if(!t.equals(e)){Xt?Pt.set(t,e):Pt.has(t)||Pt.set(t,t.v);var r=Se.ensure();if(r.capture(t,e),(t.f&2)!==0){const o=t;t.f&2048&&Br(o),nt===null&&Vr(o)}t.wv=_i(),he=null,Cr=0,ui(t,_t,n),he=null,un()&&_!==null&&_.f&1024&&!(_.f&96)&&(vt===null?ys([t]):vt.push(t)),!r.is_fork&&Bn.size>0&&!ci&&hs()}return e}function hs(){ci=!1;for(const t of Bn){t.f&1024&&V(t,ye);let e;try{e=fn(t)}catch{e=!0}e&&Le(t)}Bn.clear()}function Ye(t){M(t,t.v+1)}function ui(t,e,n){var r=t.reactions;if(r!==null){var o=un(),i=r.length;if(Cr+=i,Cr>1e5&&he===null&&(he=new Set),he!==null){if(he.has(t))return;he.add(t)}for(var a=0;a<i;a++){var s=r[a],u=s.f;if(!(!o&&s===_)){var h=(u&_t)===0;if(h&&V(s,e),(u&131072)!==0)Bn.add(s);else if((u&2)!==0){var f=s;nt?.delete(f),ui(f,ye,n)}else if(h){var v=s;u&16&&Ot!==null&&Ot.add(v),n!==null?n.push(v):ai(v)}}}}}function fe(t){if(typeof t!="object"||t===null||Je in t||jo in t)return t;const e=zo(t);if(e!==xa&&e!==$a)return t;var n=new Map,r=Fo(t),o=F(0),i=null,a=ge,s=u=>{if(ge===a)return u();var h=N,f=ge;bt(null),ko(a);var v=u();return bt(h),ko(f),v};return r&&n.set("length",F(t.length,i)),new Proxy(t,{defineProperty(u,h,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&Ga();var v=n.get(h);return v===void 0?s(()=>{var b=F(f.value,i);return n.set(h,b),b}):M(v,f.value,!0),!0},deleteProperty(u,h){var f=n.get(h);if(f===void 0){if(h in u){const v=s(()=>F(B,i));n.set(h,v),Ye(o)}}else M(f,B),Ye(o);return!0},get(u,h,f){if(h===Je)return t;var v=n.get(h),b=h in u;if(v===void 0&&(!b||ve(u,h)?.writable)&&(v=s(()=>F(fe(b?u[h]:B),i)),n.set(h,v)),v!==void 0){var d=c(v);return d===B?void 0:d}return Reflect.get(u,h,f)},getOwnPropertyDescriptor(u,h){this.has?.(u,h);var f=Reflect.getOwnPropertyDescriptor(u,h),v=n.get(h);if(v!==void 0){var b=c(v);if(b===B)return;if(f&&"value"in f)f.value=b;else return{enumerable:!0,configurable:!0,value:b,writable:!0}}return f},has(u,h){if(h===Je)return!0;var f=n.get(h),v=f!==void 0&&f.v!==B||Reflect.has(u,h);return(f!==void 0||_!==null&&(!v||ve(u,h)?.writable))&&(f===void 0&&(f=s(()=>F(v?fe(u[h]):B,i)),n.set(h,f)),c(f)===B)?!1:v},set(u,h,f,v){var b=n.get(h),d=h in u;if(r&&h==="length")for(var w=f;w<b.v;w+=1){var T=n.get(w+"");T!==void 0?M(T,B):w in u&&(T=s(()=>F(B,i)),n.set(w+"",T))}if(b===void 0)(!d||ve(u,h)?.writable)&&(b=s(()=>F(void 0,i)),M(b,fe(f)),n.set(h,b));else{d=b.v!==B;var g=s(()=>fe(f));M(b,g)}var y=Reflect.getOwnPropertyDescriptor(u,h);if(y?.set&&y.set.call(v,f),!d){if(r&&typeof h=="string"){var L=n.get("length"),O=Number(h);Number.isInteger(O)&&O>=L.v&&M(L,O+1)}Ye(o)}return!0},ownKeys(u){c(o);var h=Reflect.ownKeys(u).filter(b=>{var d=n.get(b);return d===void 0||d.v!==B});for(var[f,v]of n)v.v!==B&&!(f in u)&&h.push(f);return h},setPrototypeOf(){Ka()}})}var So,fi,di,vi;function Rr(){if(So===void 0){So=window,fi=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;di=ve(e,"firstChild").get,vi=ve(e,"nextSibling").get,po(t)&&(t[xr]=void 0,t[kr]=null,t[$r]=void 0,t.__e=void 0),po(n)&&(n[Mn]=void 0)}}function lt(t=""){return document.createTextNode(t)}function at(t){return di.call(t)}function Et(t){return vi.call(t)}function On(t,e){if(!A)return at(t);var n=at(R);if(n===null)n=R.appendChild(lt());else if(e&&n.nodeType!==3){var r=lt();return n?.before(r),Y(r),r}return e&&Qn(n),Y(n),n}function $n(t,e=!1){if(!A){var n=at(t);return n instanceof Comment&&n.data===""?Et(n):n}if(e){if(R?.nodeType!==3){var r=lt();return R?.before(r),Y(r),r}Qn(R)}return R}function ur(t,e=!1){if(!A)return at(t);var n=On(t,e);return Be(t),n}function Rt(t,e=1,n=!1){let r=A?R:t;for(var o;e--;)o=r,r=Et(r);if(!A)return r;if(n){if(r?.nodeType!==3){var i=lt();return r===null?o?.after(i):r.before(i),Y(i),i}Qn(r)}return Y(r),r}function pi(t){t.textContent=""}function gi(){return!hn||Ot!==null?!1:(_.f&Hr)!==0}function Yn(t,e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?n?document.createElement(t,{is:n}):document.createElement(t):n?document.createElementNS(e,t,{is:n}):document.createElementNS(e,t)}function Qn(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===3;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function us(t){var e=_;if(e===null)return N.f|=In,t;if((e.f&32768)===0&&(e.f&4)===0)throw t;It(t,e)}function It(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(n){t=n}}e=e.parent}throw t}}function fs(t){_===null&&(N===null&&Va(t),za()),Xt&&Fa(t)}function ds(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function qt(t,e){var n=_;n!==null&&n.f&8192&&(t|=qr);var r={ctx:z,deps:null,nodes:null,f:t|_t|512,first:null,fn:e,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};E?.register_created_effect(r);var o=r;if((t&4)!==0)rn!==null?rn.push(r):Se.ensure().schedule(r);else if(e!==null){try{Le(r)}catch(a){throw rt(r),a}o.deps===null&&o.teardown===null&&o.nodes===null&&o.first===o.last&&!(o.f&524288)&&(o=o.first,t&16&&t&65536&&o!==null&&(o.f|=Fr))}if(o!==null&&(o.parent=n,n!==null&&ds(o,n),N!==null&&(N.f&2)!==0&&(t&64)===0)){var i=N;(i.effects??(i.effects=[])).push(o)}return r}function Gr(){return N!==null&&!St}function vs(t){const e=qt(8,null);return V(e,pt),e.teardown=t,e}function _n(t){fs("$effect");var e=_.f;if(!N&&(e&32)!==0&&z!==null&&!z.i){var n=z;(n.e??(n.e=[])).push(t)}else return bi(t)}function bi(t){return qt(4|Ra,t)}function ps(t){Se.ensure();const e=qt(64|We,t);return()=>{rt(e)}}function gs(t){Se.ensure();const e=qt(64|We,t);return(n={})=>new Promise(r=>{n.outro?Te(e,()=>{rt(e),r(void 0)}):(rt(e),r(void 0))})}function mi(t){return qt(4,t)}function bs(t){return qt(Ma|We,t)}function Kr(t,e=0){return qt(8|e,t)}function jt(t,e=[],n=[],r=[]){Qa(r,e,n,o=>{qt(8,()=>{t(...o.map(c))})})}function Xr(t,e=0){return qt(16|e,t)}function gt(t){return qt(32|We,t)}function wi(t){var e=t.teardown;if(e!==null){const n=Xt,r=N;To(!0),bt(null);try{e.call(null)}catch(o){It(o,t.parent)}finally{To(n),bt(r)}}}function Jr(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const o=n.ac;o!==null&&Zn(()=>{o.abort(ln)});var r=n.next;(n.f&64)!==0?n.parent=null:rt(n,e),n=r}}function ms(t){for(var e=t.first;e!==null;){var n=e.next;!(e.f&32)&&rt(e),e=n}}function rt(t,e=!0){var n=!1;(e||t.f&262144)&&t.nodes!==null&&t.nodes.end!==null&&(yi(t.nodes.start,t.nodes.end),n=!0),t.f|=go,Jr(t,e&&!n),on(t,0);var r=t.nodes&&t.nodes.t;if(r!==null)for(const i of r)i.stop();wi(t),t.f^=go,t.f|=Ca;var o=t.parent;o!==null&&o.first!==null&&Si(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function yi(t,e){for(;t!==null;){var n=t===e?null:Et(t);t.remove(),t=n}}function Si(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function Te(t,e,n=!0){var r=[];t.f|=256,Ti(t,r,!0);var o=()=>{n&&rt(t),e&&e()},i=r.length;if(i>0){var a=()=>--i||o();for(var s of r)s.out(a)}else o()}function Ti(t,e,n){if((t.f&8192)===0){t.f^=qr;var r=t.nodes&&t.nodes.t;if(r!==null)for(const s of r)(s.is_global||n)&&e.push(s);for(var o=t.first;o!==null;){var i=o.next;if((o.f&64)===0){var a=(o.f&65536)!==0||(o.f&32)!==0&&(t.f&16)!==0;Ti(o,e,a?n:!1)}o=i}}}function Un(t){t.f&=-257,ki(t,!0)}function ki(t,e){if((t.f&256)===0&&(t.f&8192)!==0){t.f^=qr,!(t.f&1024)&&(V(t,_t),Se.ensure().schedule(t));for(var n=t.first;n!==null;){var r=n.next,o=(n.f&65536)!==0||(n.f&32)!==0;ki(n,o?e:!1),n=r}var i=t.nodes&&t.nodes.t;if(i!==null)for(const a of i)(a.is_global||e)&&a.in()}}function Zr(t,e){if(t.nodes)for(var n=t.nodes.start,r=t.nodes.end;n!==null;){var o=n===r?null:Et(n);e.append(n),n=o}}var ws=null,Ln=!1,Xt=!1;function To(t){Xt=t}var N=null,St=!1;function bt(t){N=t}var _=null;function Dt(t){_=t}var kt=null;function xi(t){N!==null&&(N.f&2097152||N.f&2)&&(kt??(kt=new Set)).add(t)}var ot=null,it=0,vt=null;function ys(t){vt=t}var $i=1,de=0,ge=de;function ko(t){ge=t}function _i(){return++$i}function fn(t){var e=t.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var n=t.deps,r=n.length,o=0;o<r;o++){var i=n[o];if(fn(i)&&ti(i),i.wv>t.wv)return!0}e&512&&nt===null&&V(t,pt)}return!1}function Ei(t,e,n=!0){var r=t.reactions;if(r!==null&&!(!hn&&kt!==null&&kt.has(t)))for(var o=0;o<r.length;o++){var i=r[o];(i.f&2)!==0?Ei(i,e,!1):e===i&&(n?V(i,_t):i.f&1024&&V(i,ye),ai(i))}}function Ai(t){var e=ot,n=it,r=vt,o=N,i=kt,a=z,s=St,u=ge,h=t.f;ot=null,it=0,vt=null,N=(h&96)===0?t:null,kt=null,Re(t.ctx),St=!1,ge=++de,t.ac!==null&&(Zn(()=>{t.ac.abort(ln)}),t.ac=null);try{t.f|=bo;var f=t.fn,v=f();t.f|=Hr;var b=xo(t);if(un()&&vt!==null&&!St&&b!==null&&(t.f&6146)===0)for(var d=0;d<vt.length;d++)Ei(vt[d],t);if(o!==null&&o!==t){if(de++,o.deps!==null)for(let w=0;w<n;w+=1)o.deps[w].rv=de;if(e!==null)for(const w of e)w.rv=de;vt!==null&&(r===null?r=vt:r.push(...vt))}return t.f&8388608&&(t.f^=In),v}catch(w){return xo(t),us(w)}finally{t.f^=bo,ot=e,it=n,vt=r,N=o,kt=i,Re(a),St=s,ge=u}}function xo(t){var e=t.deps,n=E?.is_fork;if(ot!==null){var r;if(n||on(t,it),e!==null&&it>0)for(e.length=it+ot.length,r=0;r<ot.length;r++)e[it+r]=ot[r];else t.deps=e=ot;if(Gr()&&(t.f&512)!==0)for(r=it;r<e.length;r++){var o;((o=e[r]).reactions??(o.reactions=[])).push(t)}}else!n&&e!==null&&it<e.length&&(on(t,it),e.length=it);return e}function Ss(t,e){let n=e.reactions;if(n!==null){var r=Ta.call(n,t);if(r!==-1){var o=n.length-1;o===0?n=e.reactions=null:(n[r]=n[o],n.pop())}}if(n===null&&(e.f&2)!==0&&(ot===null||!Tr.call(ot,e))){var i=e;i.f&512&&(i.f^=512),i.v!==B&&Vr(i),i.ac!==null&&Zn(()=>{i.ac.abort(ln),i.ac=null,V(i,_t)}),rs(i),on(i,0)}}function on(t,e){var n=t.deps;if(n!==null)for(var r=e;r<n.length;r++)Ss(t,n[r])}function Le(t){var e=t.f;if((e&16384)===0){V(t,pt);var n=_,r=Ln;_=t,Ln=(e&96)===0;try{(e&16777232)!==0?ms(t):Jr(t),wi(t);var o=Ai(t);t.teardown=typeof o=="function"?o:null,t.wv=$i}finally{Ln=r,_=n}}}async function Ts(){if(hn)return new Promise(t=>{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),jn()}function c(t){var e=(t.f&2)!==0;if(ws?.add(t),N!==null&&!St&&!(_!==null&&(_.f&16384)!==0)&&(kt===null||!kt.has(t))){var n=N.deps;if((N.f&2097152)!==0)t.rv<de&&(t.rv=de,ot===null&&n!==null&&n[it]===t?it++:ot===null?ot=[t]:ot.push(t));else{var r;(r=N).deps??(r.deps=[]),Tr.call(N.deps,t)||N.deps.push(t);var o=t.reactions;o===null?t.reactions=[N]:Tr.call(o,N)||o.push(N)}}if(Xt&&Pt.has(t))return Pt.get(t);if(e){var i=t;if(Xt){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Ci(i))&&(a=Br(i)),Pt.set(i,a),a}var s=(i.f&512)===0&&!St&&N!==null&&(Ln||(N.f&512)!==0),u=(i.f&Hr)===0;fn(i)&&(s&&(i.f|=512),ti(i)),s&&!u&&(ei(i),Ni(i))}if(nt?.has(t))return nt.get(t);if((t.f&8388608)!==0)throw t.v;return t.v}function Ni(t){if(t.f|=512,t.deps!==null)for(const e of t.deps)(e.reactions??(e.reactions=[])).push(t),e.f&2&&!(e.f&512)&&(ei(e),Ni(e))}function Ci(t){if(t.v===B)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(Pt.has(e)||(e.f&2)!==0&&Ci(e))return!0;return!1}function an(t){var e=St;try{return St=!0,t()}finally{St=e}}var Ne=Symbol("events"),Ri=new Set,Mr=new Set;function Yt(t,e,n){(e[Ne]??(e[Ne]={}))[t]=n}function ks(t){for(var e=0;e<t.length;e++)Ri.add(t[e]);for(var n of Mr)n(t)}var fr=null,dr=!1;function $o(t){var e=this,n=e.ownerDocument,r=t.type,o=t.composedPath?.()||[],i=o[0]||t.target;fr=t,dr||(dr=!0,setTimeout(()=>{dr=!1,fr=null}));var a=0,s=fr===t&&t[Ne];if(s){var u=o.indexOf(s);if(u!==-1&&(e===document||e===window)){t[Ne]=e;return}var h=o.indexOf(e);if(h===-1)return;u<=h&&(a=u)}if(i=o[a]||t.target,i!==e){tn(t,"currentTarget",{configurable:!0,get(){return i||n}});var f=N,v=_;bt(null),Dt(null);try{for(var b,d=[];i!==null&&i!==e;){try{var w=i[Ne]?.[r];w!=null&&(!i.disabled||t.target===i)&&w.call(i,t)}catch(T){b?d.push(T):b=T}if(t.cancelBubble)break;a++,i=a<o.length?o[a]:null}if(b){for(let T of d)queueMicrotask(()=>{throw T});throw b}}finally{t[Ne]=e,delete t.currentTarget,bt(f),Dt(v)}}}var xs=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function $s(t){return xs?.createHTML(t)??t}function _s(t){var e=Yn("template");return e.innerHTML=$s(t.replaceAll("<!>","<!---->")),e.content}function Kt(t,e){var n=_;n.nodes===null&&(n.nodes={start:t,end:e,a:null,t:null})}function Ht(t,e){var n=(e&1)!==0,r=(e&2)!==0,o,i=!t.startsWith("<!>");return()=>{if(A)return Kt(R,null),R;o===void 0&&(o=_s(i?t:"<!>"+t),n||(o=at(o)));var a=r||fi?document.importNode(o,!0):o.cloneNode(!0);if(n){var s=at(a),u=a.lastChild;Kt(s,u)}else Kt(a,a);return a}}function Es(t=""){if(!A){var e=lt(t+"");return Kt(e,e),e}var n=R;return n.nodeType!==3?(n.before(n=lt()),Y(n)):Qn(n),Kt(n,n),n}function ft(t,e){if(A){var n=_;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=R),Ce();return}t!==null&&t.before(e)}var As=["touchstart","touchmove"];function Ns(t){return As.includes(t)}function Cs(t){let e=0,n=we(0),r;return()=>{Gr()&&(c(n),Kr(()=>(e===0&&(r=an(()=>t(()=>Ye(n)))),e+=1,()=>{re(()=>{e-=1,e===0&&(r?.(),r=void 0,Ye(n))})})))}}var Rs=Fr|We;function Ms(t,e,n,r){new Os(t,e,n,r)}var xt=new WeakMap,Or=new WeakMap,Wt=new WeakMap,sn=new WeakMap,st=new WeakMap,$t=new WeakMap,ct=new WeakMap,Tt=new WeakMap,ne=new WeakMap,_e=new WeakMap,be=new WeakMap,En=new WeakMap,Lr=new WeakMap,Wr=new WeakMap,ae=new WeakMap,_o=new WeakMap,U=new WeakSet,Os=class{constructor(t,e,n,r){Ur(this,U),I(this,"parent",void 0),I(this,"is_pending",!1),I(this,"transform_error",void 0),k(this,xt,void 0),k(this,Or,A?R:null),k(this,Wt,void 0),k(this,sn,void 0),k(this,st,void 0),k(this,$t,null),k(this,ct,null),k(this,Tt,null),k(this,ne,null),k(this,_e,0),k(this,be,0),k(this,En,!1),k(this,Lr,new Set),k(this,Wr,new Set),k(this,ae,null),k(this,_o,Cs(()=>(S(ae,this,we(l(_e,this))),()=>{S(ae,this,null)}))),S(xt,this,t),S(Wt,this,e),S(sn,this,o=>{var i=_;i.b=this,i.f|=128,n(o)}),this.parent=_.b,this.transform_error=r??this.parent?.transform_error??(o=>o),S(st,this,Xr(()=>{if(A){const o=l(Or,this);Ce();const i=o.data==="[!";if(o.data.startsWith("[?")){const a=JSON.parse(o.data.slice(2));$(U,this,Ws).call(this,a)}else i?$(U,this,Ps).call(this):$(U,this,Ls).call(this)}else $(U,this,Oi).call(this)},Rs)),A&&S(xt,this,R)}defer_effect(t){Yo(t,l(Lr,this),l(Wr,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!l(Wt,this).pending}update_pending_count(t,e){$(U,this,Li).call(this,t,e),S(_e,this,l(_e,this)+t),l(ae,this)&&!l(En,this)&&(S(En,this,!0),re(()=>{S(En,this,!1),l(ae,this)&&Oe(l(ae,this),l(_e,this))}))}get_effect_pending(){return l(_o,this).call(this),c(l(ae,this))}error(t){if(!l(Wt,this).onerror&&!l(Wt,this).failed)throw t;E?.is_fork?(l($t,this)&&E.skip_effect(l($t,this)),l(ct,this)&&E.skip_effect(l(ct,this)),l(Tt,this)&&E.skip_effect(l(Tt,this)),E.oncommit(()=>{$(U,this,Eo).call(this,t)})):$(U,this,Eo).call(this,t)}};function Ls(){try{S($t,this,gt(()=>l(sn,this).call(this,l(xt,this))))}catch(t){this.error(t)}}function Ws(t){const e=l(Wt,this).failed,{reset:n,invoke_onerror:r}=$(U,this,Mi).call(this,t);re(r),e&&S(Tt,this,gt(()=>{e(l(xt,this),()=>t,()=>n)}))}function Mi(t){var e=!1,n=!1;const r=()=>{if(e){Pa();return}e=!0,n&&Ja(),l(Tt,this)!==null&&Te(l(Tt,this),()=>{S(Tt,this,null)}),$(U,this,Yr).call(this,()=>{$(U,this,Oi).call(this)})};return{reset:r,invoke_onerror:()=>{try{n=!0,l(Wt,this).onerror?.(t,r),n=!1}catch(o){It(o,l(st,this)&&l(st,this).parent)}}}}function Ps(){const t=l(Wt,this).pending;t&&(this.is_pending=!0,S(ct,this,gt(()=>t(l(xt,this)))),re(()=>{var e=S(ne,this,document.createDocumentFragment()),n=lt(),r=!1;if(e.append(n),S($t,this,$(U,this,Yr).call(this,()=>{try{return gt(()=>l(sn,this).call(this,n))}catch(o){try{this.error(o),r=!0}catch(i){It(i,l(st,this).parent)}return null}})),l($t,this)===null){S(ne,this,null),r&&$(U,this,Gn).call(this,E);return}l(be,this)===0&&(l(xt,this).before(e),S(ne,this,null),Te(l(ct,this),()=>{S(ct,this,null)}),$(U,this,Gn).call(this,E))}))}function Oi(){try{if(this.is_pending=this.has_pending_snippet(),S(be,this,0),S(_e,this,0),S($t,this,gt(()=>{l(sn,this).call(this,l(xt,this))})),l(be,this)>0){var t=S(ne,this,document.createDocumentFragment());Zr(l($t,this),t);const e=l(Wt,this).pending;S(ct,this,gt(()=>e(l(xt,this))))}else $(U,this,Gn).call(this,E)}catch(e){this.error(e)}}function Gn(t){this.is_pending=!1,t.transfer_effects(l(Lr,this),l(Wr,this))}function Yr(t){var e=_,n=N,r=z;Dt(l(st,this)),bt(l(st,this)),Re(l(st,this).ctx);try{return Se.ensure(),t()}finally{Dt(e),bt(n),Re(r)}}function Li(t,e){if(!this.has_pending_snippet()){if(this.parent){var n;$(U,n=this.parent,Li).call(n,t,e)}return}S(be,this,l(be,this)+t),l(be,this)===0&&($(U,this,Gn).call(this,e),l(ct,this)&&Te(l(ct,this),()=>{S(ct,this,null)}),l(ne,this)&&(l(xt,this).before(l(ne,this)),S(ne,this,null)))}function Eo(t){l($t,this)&&(rt(l($t,this)),S($t,this,null)),l(ct,this)&&(rt(l(ct,this)),S(ct,this,null)),l(Tt,this)&&(rt(l(Tt,this)),S(Tt,this,null)),A&&(Y(l(Or,this)),Ia(),Y(Dn()));let e=l(Wt,this).failed;const n=r=>{const{reset:o,invoke_onerror:i}=$(U,this,Mi).call(this,r);i(),e&&S(Tt,this,$(U,this,Yr).call(this,()=>{try{return gt(()=>{var a=_;a.b=this,a.f|=128,e(l(xt,this),()=>r,()=>o)})}catch(a){return It(a,l(st,this).parent),null}}))};re(()=>{var r;try{r=this.transform_error(t)}catch(o){It(o,l(st,this)&&l(st,this).parent);return}r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(n,o=>It(o,l(st,this)&&l(st,this).parent)):n(r)})}function An(t,e){var n=e==null?"":typeof e=="object"?`${e}`:e;n!==(t[Mn]??(t[Mn]=t.nodeValue))&&(t[Mn]=n,t.nodeValue=`${n}`)}function Wi(t,e){return Pi(t,e)}function Is(t,e){Rr(),e.intro=e.intro??!1;const n=e.target,r=A,o=R;try{for(var i=at(n);i&&(i.nodeType!==8||i.data!=="[");)i=Et(i);if(!i)throw me;Ut(!0),Y(i);const a=Pi(t,{...e,anchor:i});return Ut(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
212
+ `).some(s=>s.startsWith("https://svelte.dev/e/")))throw a;return a!==me&&console.warn("Failed to hydrate: ",a),e.recover===!1&&Ba(),Rr(),pi(n),Ut(!1),Wi(t,e)}finally{Ut(r),Y(o)}}var Nn=new Map;function Pi(t,{target:e,anchor:n,props:r={},events:o,context:i,intro:a=!0,transformError:s}){Rr();var u=void 0,h=gs(()=>{var f=n??e.appendChild(lt());Ms(f,{pending:()=>{}},d=>{Xo({});var w=z;if(i&&(w.c=i),o&&(r.$$events=o),A&&Kt(d,null),u=t(d,r)||zr(),A&&(_.nodes.end=R,R===null||R.nodeType!==8||R.data!=="]"))throw cn(),me;Jo()},s);var v=new Set,b=d=>{for(var w=0;w<d.length;w++){var T=d[w];if(!v.has(T)){v.add(T);var g=Ns(T);for(const O of[e,document]){var y=Nn.get(O);y===void 0&&(y=new Map,Nn.set(O,y));var L=y.get(T);L===void 0?(O.addEventListener(T,$o,{passive:g}),y.set(T,1)):y.set(T,L+1)}}}};return b(Xn(Ri)),Mr.add(b),()=>{for(var d of v)for(const g of[e,document]){var w=Nn.get(g),T=w.get(d);--T==0?(g.removeEventListener(d,$o),w.delete(d),w.size===0&&Nn.delete(g)):w.set(d,T)}Mr.delete(b),f!==n&&f.parentNode?.removeChild(f)}});return Pr.set(u,h),u}var Pr=new WeakMap;function Ds(t,e){const n=Pr.get(t);return n?(Pr.delete(t),n(e)):Promise.resolve()}var Vt=new WeakMap,Qt=new WeakMap,mt=new WeakMap,Ve=new WeakMap,vr=new WeakMap,pr=new WeakMap,Ao=new WeakMap,qs=class{constructor(t,e=!0){I(this,"anchor",void 0),k(this,Vt,new Map),k(this,Qt,new Map),k(this,mt,new Map),k(this,Ve,new Set),k(this,vr,!0),k(this,pr,n=>{if(l(Vt,this).has(n)){var r=l(Vt,this).get(n),o=l(Qt,this).get(r);if(o)Un(o),l(Ve,this).delete(r);else{var i=l(mt,this).get(r);i&&(Un(i.effect),l(Qt,this).set(r,i.effect),l(mt,this).delete(r),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),o=i.effect)}for(const[a,s]of l(Vt,this)){if(l(Vt,this).delete(a),a===n)break;const u=l(mt,this).get(s);u&&(rt(u.effect),l(mt,this).delete(s))}for(const[a,s]of l(Qt,this)){if(a===r||l(Ve,this).has(a))continue;const u=()=>{if(Array.from(l(Vt,this).values()).includes(a)){var h=document.createDocumentFragment();Zr(s,h),h.append(lt()),l(mt,this).set(a,{effect:s,fragment:h})}else rt(s);l(Ve,this).delete(a),l(Qt,this).delete(a)};l(vr,this)||!o?(l(Ve,this).add(a),Te(s,u,!1)):u()}}}),k(this,Ao,n=>{l(Vt,this).delete(n);const r=Array.from(l(Vt,this).values());for(const[o,i]of l(mt,this))r.includes(o)||(rt(i.effect),l(mt,this).delete(o))}),this.anchor=t,S(vr,this,e)}ensure(t,e){var n=E,r=gi();if(e&&!l(Qt,this).has(t)&&!l(mt,this).has(t))if(r){var o=document.createDocumentFragment(),i=lt();o.append(i),l(mt,this).set(t,{effect:gt(()=>e(i)),fragment:o})}else l(Qt,this).set(t,gt(()=>e(this.anchor)));if(l(Vt,this).set(n,t),r){for(const[a,s]of l(Qt,this))a===t?n.unskip_effect(s):n.skip_effect(s);for(const[a,s]of l(mt,this))a===t?n.unskip_effect(s.effect):n.skip_effect(s.effect);n.oncommit(l(pr,this)),n.ondiscard(l(Ao,this))}else A&&(this.anchor=R),l(pr,this).call(this,n)}};function se(t,e,n=!1){var r;A&&(r=R,Ce());var o=new qs(t),i=n?Fr:0;function a(s,u){if(A){var h=Uo(r);if(s!==parseInt(h.substring(1))){var f=Dn();Y(f),o.anchor=f,Ut(!1),o.ensure(s,u),Ut(!0);return}}o.ensure(s,u)}Xr(()=>{var s=!1;e((u,h=0)=>{s=!0,a(h,u)}),s||a(-1,null)},i)}function Hs(t,e){return e}function Fs(t,e,n){for(var r=[],o=e.length,i,a=e.length,s=0;s<o;s++){let v=e[s];Te(v,()=>{if(i){if(i.pending.delete(v),i.done.add(v),i.pending.size===0){var b=t.outrogroups;Ir(t,Xn(i.done)),b.delete(i),b.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var u=r.length===0&&n!==null&&t.pending.size===0;if(u){var h=n,f=h.parentNode;pi(f),f.append(h),t.items.clear()}Ir(t,e,!u)}else i={pending:new Set(e),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(i)}function Ir(t,e,n=!0){var r;if(t.pending.size>0){r=new Set;for(const a of t.pending.values())for(const s of a)r.add(t.items.get(s).e)}for(var o=0;o<e.length;o++){var i=e[o];r?.has(i)?(i.f|=Xe,Zr(i,document.createDocumentFragment())):rt(e[o],n)}}var Cn;function No(t,e,n,r,o,i=null){var a=t,s=new Map;if((e&4)!==0){var u=t;a=A?Y(at(u)):u.appendChild(lt())}A&&Ce();var h=null,f=jr(()=>{var y=n();return Fo(y)?y:y==null?[]:Xn(y)}),v,b=new Map,d=!0;function w(y){!(g.effect.f&16384)&&(g.pending.delete(y),g.fallback=h,zs(g,v,a,e,r),h!==null&&(v.length===0?(h.f&33554432)===0?Un(h):(h.f^=Xe,Ke(h,null,a)):Te(h,()=>{h=null})))}function T(y){g.pending.delete(y)}var g={effect:Xr(()=>{v=c(f);var y=v.length;let L=!1;A&&Uo(a)==="[!"!=(y===0)&&(a=Dn(),Y(a),Ut(!1),L=!0);for(var O=new Set,x=E,W=gi(),D=0;D<y;D+=1){A&&R.nodeType===8&&R.data==="]"&&(a=R,L=!0,Ut(!1));var H=v[D],G=r(H,D),K=d?null:s.get(G);K?(K.v&&Oe(K.v,H),K.i&&Oe(K.i,D),W&&x.unskip_effect(K.e)):(K=Vs(s,d?a:Cn??(Cn=lt()),H,G,D,o,e,n),d||(K.e.f|=Xe),s.set(G,K)),O.add(G)}if(y===0&&i&&!h&&(d?h=gt(()=>i(a)):(h=gt(()=>i(Cn??(Cn=lt()))),h.f|=Xe)),y>O.size&&Ha("","",""),A&&y>0&&Y(Dn()),!d)if(b.set(x,O),W){for(const[J,ht]of s)O.has(J)||x.skip_effect(ht.e);x.oncommit(w),x.ondiscard(T)}else w(x);L&&Ut(!0),c(f)}),flags:e,items:s,pending:b,outrogroups:null,fallback:h};d=!1,A&&(a=R)}function je(t){for(;t!==null&&(t.f&32)===0;)t=t.next;return t}function zs(t,e,n,r,o){var i=(r&8)!==0,a=e.length,s=t.items,u=je(t.effect.first),h,f=null,v,b=[],d=[],w,T,g,y;if(i)for(y=0;y<a;y+=1)w=e[y],T=o(w,y),g=s.get(T).e,!(g.f&33554432)&&(g.nodes?.a?.measure(),(v??(v=new Set)).add(g));for(y=0;y<a;y+=1){if(w=e[y],T=o(w,y),g=s.get(T).e,t.outrogroups!==null)for(const J of t.outrogroups)J.pending.delete(g),J.done.delete(g);if(g.f&8192&&(Un(g),i&&(g.nodes?.a?.unfix(),(v??(v=new Set)).delete(g))),(g.f&33554432)!==0)if(g.f^=Xe,g===u)Ke(g,null,n);else{var L=f?f.next:u;g===t.effect.last&&(t.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),te(t,f,g),te(t,g,L),Ke(g,L,n),f=g,b=[],d=[],u=je(f.next);continue}if(g!==u){if(h!==void 0&&h.has(g)){if(b.length<d.length){var O=d[0],x;f=O.prev;var W=b[0],D=b[b.length-1];for(x=0;x<b.length;x+=1)Ke(b[x],O,n);for(x=0;x<d.length;x+=1)h.delete(d[x]);te(t,W.prev,D.next),te(t,f,W),te(t,D,O),u=O,f=D,y-=1,b=[],d=[]}else h.delete(g),Ke(g,u,n),te(t,g.prev,g.next),te(t,g,f===null?t.effect.first:f.next),te(t,f,g),f=g;continue}for(b=[],d=[];u!==null&&u!==g;)(h??(h=new Set)).add(u),d.push(u),u=je(u.next);if(u===null)continue}!(g.f&33554432)&&b.push(g),f=g,u=je(g.next)}if(t.outrogroups!==null){for(const J of t.outrogroups)J.pending.size===0&&(Ir(t,Xn(J.done)),t.outrogroups?.delete(J));t.outrogroups.size===0&&(t.outrogroups=null)}if(u!==null||h!==void 0){var H=[];if(h!==void 0)for(g of h)!(g.f&8192)&&H.push(g);for(;u!==null;)!(u.f&8192)&&u!==t.fallback&&H.push(u),u=je(u.next);var G=H.length;if(G>0){var K=(r&4)!==0&&a===0?n:null;if(i){for(y=0;y<G;y+=1)H[y].nodes?.a?.measure();for(y=0;y<G;y+=1)H[y].nodes?.a?.fix()}Fs(t,H,K)}}i&&re(()=>{if(v!==void 0)for(g of v)g.nodes?.a?.apply()})}function Vs(t,e,n,r,o,i,a,s){var u=(a&1)!==0?(a&16)===0?hi(n,!1,!1):we(n):null,h=(a&2)!==0?we(o):null;return{v:u,i:h,e:gt(()=>(i(e,u??n,h??o,s),()=>{t.delete(r)}))}}function Ke(t,e,n){if(t.nodes)for(var r=t.nodes.start,o=t.nodes.end,i=e&&(e.f&33554432)===0?e.nodes.start:n;r!==null;){var a=Et(r);if(i.before(r),r===o)return;r=a}}function te(t,e,n){e===null?t.effect.first=n:e.next=n,n===null?t.effect.last=e:n.prev=e}function js(t,e,n=!1,r=!1,o=!1,i=!1){var a=t,s="";if(n){var u=t;A&&(a=Y(at(u)))}jt(()=>{var h=_;if(s===(s=e()??"")){A&&Ce();return}if(n&&!A){h.nodes=null,u.innerHTML=s,s!==""&&Kt(at(u),u.lastChild);return}if(h.nodes!==null&&(yi(h.nodes.start,h.nodes.end),h.nodes=null),s!==""){if(A){for(var f=R.data,v=Ce(),b=v;v!==null&&(v.nodeType!==8||v.data!=="");)b=v,v=Et(v);if(v===null)throw cn(),me;Kt(R,b),a=Y(v);return}var d=Yn(r?"svg":o?"math":"template",r?ya:o?Sa:void 0);d.innerHTML=s;var w=r||o?d:d.content;if(Kt(at(w),w.lastChild),r||o)for(;at(w);)a.before(at(w));else a.before(w)}})}function Bs(t,e){mi(()=>{t=_?.parent?.nodes?.start??t;var n=t.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector("#"+e.hash)){const o=Yn("style");o.id=e.hash,o.textContent=e.code,r.appendChild(o)}})}var Co=[...`
213
+ \r\f \v\uFEFF`];function Us(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var o of Object.keys(n))if(n[o])r=r?r+" "+o:o;else if(r.length)for(var i=o.length,a=0;(a=r.indexOf(o,a))>=0;){var s=a+i;(a===0||Co.includes(r[a-1]))&&(s===r.length||Co.includes(r[s]))?r=(a===0?"":r.substring(0,a))+r.substring(s+1):a=s}}return r===""?null:r}function Ro(t,e=!1){var n=e?" !important;":";",r="";for(var o of Object.keys(t)){var i=t[o];i!=null&&i!==""&&(r+=" "+o+": "+i+n)}return r}function gr(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Gs(t,e){if(e){var n="",r,o;if(Array.isArray(e)?(r=e[0],o=e[1]):r=e,t){t=String(t).replaceAll(/\/\*.*?\*\//g,"").trim();var i=!1,a=0,s=!1,u=[];r&&u.push(...Object.keys(r).map(gr)),o&&u.push(...Object.keys(o).map(gr));var h=0,f=-1;const T=t.length;for(var v=0;v<T;v++){var b=t[v];if(s?b==="/"&&t[v-1]==="*"&&(s=!1):i?i===b&&(i=!1):b==="/"&&t[v+1]==="*"?s=!0:b==='"'||b==="'"?i=b:b==="("?a++:b===")"&&a--,!s&&i===!1&&a===0){if(b===":"&&f===-1)f=v;else if(b===";"||v===T-1){if(f!==-1){var d=gr(t.substring(h,f).trim());if(!u.includes(d)){b!==";"&&v++;var w=t.substring(h,v).trim();n+=" "+w+";"}}h=v+1,f=-1}}}}return r&&(n+=Ro(r)),o&&(n+=Ro(o,!0)),n=n.trim(),n===""?null:n}return t==null?null:String(t)}function Ks(t,e,n,r,o,i){var a=t[xr];if(A||a!==n||a===void 0){var s=Us(n,r,i);(!A||s!==t.getAttribute("class"))&&(s==null?t.removeAttribute("class"):e?t.className=s:t.setAttribute("class",s)),t[xr]=n}else if(i&&o!==i)for(var u in i){var h=!!i[u];(o==null||h!==!!o[u])&&t.classList.toggle(u,h)}return i}function br(t,e={},n,r){for(var o in n){var i=n[o];e[o]!==i&&(n[o]==null?t.style.removeProperty(o):t.style.setProperty(o,i,r))}}function Mo(t,e,n,r){var o=t[$r];if(A||o!==e){var i=Gs(e,r);(!A||i!==t.getAttribute("style"))&&(i==null?t.removeAttribute("style"):t.style.cssText=i),t[$r]=e}else r&&(Array.isArray(r)?(br(t,n?.[0],r[0]),br(t,n?.[1],r[1],"important")):br(t,n,r));return r}var Xs=Symbol("is custom element"),Js=Symbol("is html"),Zs=La?"link":"LINK";function X(t,e,n,r){var o=Ys(t);A&&(o[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===Zs)||o[e]!==(o[e]=n)&&(e==="loading"&&(t[Oa]=n),n==null?t.removeAttribute(e):typeof n!="string"&&Qs(t).has(e)?t[e]=n:t.setAttribute(e,n))}function Ys(t){return t[kr]??(t[kr]={[Xs]:t.nodeName.includes("-"),[Js]:t.namespaceURI==="http://www.w3.org/1999/xhtml"})}var Oo=new Map;function Qs(t){var e=t.getAttribute("is")||t.nodeName,n=Oo.get(e);if(n)return n;Oo.set(e,n=new Set);for(var r,o=t,i=Element.prototype;i!==o;){r=ka(o);for(var a in r)r[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&n.add(a);o=zo(o)}return n}var Ii,Ee=new WeakMap,Kn=new WeakMap,mr=new WeakMap,Lo=new WeakSet,Di=class{constructor(t){Ur(this,Lo),k(this,Ee,new WeakMap),k(this,Kn,void 0),k(this,mr,void 0),S(mr,this,t)}observe(t,e){var n=l(Ee,this).get(t)||new Set;return n.add(e),l(Ee,this).set(t,n),$(Lo,this,tl).call(this).observe(t,l(mr,this)),()=>{var r=l(Ee,this).get(t);r.delete(e),r.size===0&&(l(Ee,this).delete(t),l(Kn,this).unobserve(t))}}};Ii=Di;function tl(){return l(Kn,this)??S(Kn,this,new ResizeObserver(t=>{for(var e of t){Ii.entries.set(e.target,e);for(var n of l(Ee,this).get(e.target)||[])n(e)}}))}I(Di,"entries",new WeakMap);function wr(t,e){return t===e||t?.[Je]===e}function Wo(t=zr(),e,n,r){var o=z.r,i=_;return mi(()=>{var a,s;return Kr(()=>{a=s,s=r?.()||[],an(()=>{wr(n(...s),t)||(e(t,...s),a&&wr(n(...a),t)&&e(null,...a))})}),()=>{let u=i;for(;u!==o&&u.parent!==null&&u.parent.f&33554432;)u=u.parent;const h=()=>{s&&wr(n(...s),t)&&e(null,...s)},f=u.teardown;u.teardown=()=>{h(),f?.()}}}),t}var Rn=!1;function el(t){var e=Rn;try{return Rn=!1,[t(),Rn]}finally{Rn=e}}function Po(t,e,n,r){var o=!Jn||(n&2)!==0,i=(n&8)!==0,a=(n&16)!==0,s=r,u=!0,h=void 0,f=()=>a&&o?(h??(h=nn(r)),c(h)):(u&&(u=!1,s=a?an(r):r),s);let v;if(i){var b=Je in t||Bo in t;v=ve(t,e)?.set??(b&&e in t?x=>t[e]=x:void 0)}var d,w=!1;i?[d,w]=el(()=>t[e]):d=t[e],d===void 0&&r!==void 0&&(d=f(),v&&(o&&Ua(e),v(d)));var T;if(o?T=()=>{var x=t[e];return x===void 0?f():(u=!0,x)}:T=()=>{var x=t[e];return x!==void 0&&(s=void 0),x===void 0?s:x},o&&(n&4)===0)return T;if(v){var g=t.$$legacy;return(function(x,W){return arguments.length>0?((!o||!W||g||w)&&v(W?T():x),x):T()})}var y=!1,L=((n&1)!==0?nn:jr)(()=>(y=!1,T()));i&&c(L);var O=_;return(function(x,W){if(arguments.length>0){const D=W?c(L):o&&i?fe(x):x;return M(L,D),y=!0,s!==void 0&&(s=D),x}return Xt&&y||(O.f&16384)!==0?L.v:c(L)})}function nl(t){return new rl(t)}var le=new WeakMap,Mt=new WeakMap,rl=class{constructor(t){k(this,le,void 0),k(this,Mt,void 0);var e=new Map,n=(o,i)=>{var a=hi(i,!1,!1);return e.set(o,a),a};const r=new Proxy({...t.props||{},$$events:{}},{get(o,i){return c(e.get(i)??n(i,Reflect.get(o,i)))},has(o,i){return i===Bo?!0:(c(e.get(i)??n(i,Reflect.get(o,i))),Reflect.has(o,i))},set(o,i,a){return M(e.get(i)??n(i,a),a),Reflect.set(o,i,a)}});S(Mt,this,(t.hydrate?Is:Wi)(t.component,{target:t.target,anchor:t.anchor,props:r,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!t?.props?.$$host||t.sync===!1)&&jn(),S(le,this,r.$$events);for(const o of Object.keys(l(Mt,this)))o==="$set"||o==="$destroy"||o==="$on"||tn(this,o,{get(){return l(Mt,this)[o]},set(i){l(Mt,this)[o]=i},enumerable:!0});l(Mt,this).$set=o=>{Object.assign(r,o)},l(Mt,this).$destroy=()=>{Ds(l(Mt,this))}}$set(t){l(Mt,this).$set(t)}$on(t,e){l(le,this)[t]=l(le,this)[t]||[];const n=(...r)=>e.call(this,...r);return l(le,this)[t].push(n),()=>{l(le,this)[t]=l(le,this)[t].filter(r=>r!==n)}}$destroy(){l(Mt,this).$destroy()}},qi;typeof HTMLElement=="function"&&(qi=class extends HTMLElement{constructor(t,e,n){super(),I(this,"$$ctor",void 0),I(this,"$$s",void 0),I(this,"$$c",void 0),I(this,"$$cn",!1),I(this,"$$d",{}),I(this,"$$r",!1),I(this,"$$p_d",{}),I(this,"$$l",{}),I(this,"$$l_u",new Map),I(this,"$$me",void 0),I(this,"$$shadowRoot",null),this.$$ctor=t,this.$$s=e,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const r=this.$$c.$on(t,e);this.$$l_u.set(e,r)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const r=this.$$l_u.get(e);r&&(r(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(r){return o=>{const i=Yn("slot");r!=="default"&&(i.name=r),ft(o,i)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},n=ol(this);for(const r of this.$$s)r in n&&(r==="default"&&!this.$$d.children?(this.$$d.children=t(r),e.default=!0):e[r]=t(r));for(const r of this.attributes){const o=this.$$g_p(r.name);o in this.$$d||(this.$$d[o]=Wn(o,r.value,this.$$p_d,"toProp"))}for(const r in this.$$p_d)!(r in this.$$d)&&this[r]!==void 0&&(this.$$d[r]=this[r],delete this[r]);this.$$c=nl({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:e,$$host:this}}),this.$$me=ps(()=>{Kr(()=>{this.$$r=!0;for(const r of Pn(this.$$c)){if(!this.$$p_d[r]?.reflect)continue;this.$$d[r]=this.$$c[r];const o=Wn(r,this.$$d[r],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[r].attribute||r):this.setAttribute(this.$$p_d[r].attribute||r,o)}this.$$r=!1})});for(const r in this.$$l)for(const o of this.$$l[r]){const i=this.$$c.$on(r,o);this.$$l_u.set(o,i)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Wn(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return Pn(this.$$p_d).find(e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t)||t}});function Wn(t,e,n,r){const o=n[t]?.type;if(e=o==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(o){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(o){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function ol(t){const e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}function il(t,e,n,r,o,i){let a=class extends qi{constructor(){super(t,n,o),this.$$p_d=e}static get observedAttributes(){return Pn(e).map(s=>(e[s].attribute||s).toLowerCase())}};return Pn(e).forEach(s=>{tn(a.prototype,s,{get(){return this.$$c&&s in this.$$c?this.$$c[s]:this.$$d[s]},set(u){u=Wn(s,u,e),this.$$d[s]=u;var h=this.$$c;h&&(ve(h,s)?.get?h[s]=u:h.$set({[s]:u}))}})}),r.forEach(s=>{tn(a.prototype,s,{get(){return this.$$c?.[s]}})}),i&&(a=i(a)),t.element=a,a}function al(t){return t.key==="ContextMenu"?!0:t.key==="F10"&&t.shiftKey===!0}function sl({key:t,activeIndex:e,count:n,direction:r}){if(n<=0)return null;const o=Dr(e,n);return t===(r==="rtl"?"ArrowLeft":"ArrowRight")?(o+1)%n:t===(r==="rtl"?"ArrowRight":"ArrowLeft")?(o-1+n)%n:t==="Home"?0:t==="End"?n-1:null}function Dr(t,e){return e<=0||!Number.isFinite(t)||t<0?0:Math.min(Math.trunc(t),e-1)}function ll(t,e){return t.bottom<0||t.top>e.height||t.right<0||t.left>e.width}var cl=2e3;function hl(t,e,n=cl){if(t===null)return!1;const r=e-t;return r<0?!0:r<n}function ul(t,e,n={width:0,height:0},r=8){const o=t.left+(t.right-t.left)/2-n.width/2,i=t.top-r-n.height,a=i<4&&t.bottom+r+n.height<=e.height,s=a?t.bottom+r:i;return{x:Io(o,n.width,e.width,4),y:Io(s,n.height,e.height,4),below:a}}function Io(t,e,n,r){const o=n-e-r;return o<=r?r:Math.min(Math.max(t,r),o)}function fl(t){if(!t||typeof t!="object")return!1;const e=t;return!(typeof e.id!="string"||e.id.trim().length===0||typeof e.label!="string"||e.label.trim().length===0||e.label.length>40||typeof e.run!="function"||e.iconSvg!==void 0&&typeof e.iconSvg!="string"||e.tooltip!==void 0&&typeof e.tooltip!="string"||e.isAvailable!==void 0&&typeof e.isAvailable!="function")}function dl(t){if(typeof t.isAvailable!="function")return!0;try{return t.isAvailable()!==!1}catch(e){return console.warn(`[AnnotationToolbar] Selection action "${t.id}" failed its availability check:`,e),!1}}function vl(t){if(!Array.isArray(t))return[];const e=new Set,n=[];return t.forEach((r,o)=>{if(!fl(r)){console.warn(`[AnnotationToolbar] Ignoring invalid selection action at index ${o}. Expected { id, label, run } with valid types.`);return}if(e.has(r.id)){console.warn(`[AnnotationToolbar] Ignoring duplicate selection action id "${r.id}".`);return}dl(r)&&(e.add(r.id),n.push(r))}),n}function pl(t,e){if(!t)return!1;const n=e?.canRequestTool;if(typeof n!="function")return!1;try{return n.call(e,"textToSpeech")===!0}catch(r){return console.warn("[AnnotationToolbar] Read-aloud failed its availability check:",r),!1}}var gl=t=>{const e=[];for(const n of t){let r=n?.getRootNode?.();for(;yt(r);)e.includes(r)||e.push(r),r=r.host.getRootNode?.()}return e},bl=(t,e)=>{const n=t.getComposedRanges;if(typeof n!="function"||e.length===0)return null;try{return n.call(t,{shadowRoots:e})[0]??null}catch{try{return n.call(t,...e)[0]??null}catch{return null}}},ml=t=>{const{startContainer:e,startOffset:n,endContainer:r,endOffset:o}=t,i=e.ownerDocument;if(!i)return null;try{const a=i.createRange();a.setStart(e,n);const s=e.getRootNode();if(r.getRootNode()===s)return a.setEnd(r,o),a;const u=ga(r,s);if(u)a.setEndBefore(u);else if(yt(s))a.setEnd(s,s.childNodes.length);else return null;return a}catch{return null}},wl=t=>{if(t.rangeCount===0)return null;const e=t.getRangeAt(0),n=bl(t,gl([t.anchorNode,t.focusNode,e.startContainer,e.endContainer])),r=n?ml(n):null;return!n||!r?{range:e,text:t.toString()}:{range:r,text:n.startContainer.getRootNode()===n.endContainer.getRootNode()?t.toString():r.toString()}},Do=t=>{const e=t.startContainer,n=pa(e);if(!n)return null;const r=da(n,e);return!Qe(r,e)||!Qe(r,t.endContainer)?null:r},yl=Ht('<button class="pie-tool-annotation-toolbar__highlight-swatch svelte-1qnnvrt"><span class="pie-sr-only svelte-1qnnvrt"> </span></button>'),Sl=Ht('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--icon svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z"></path></svg></button>',1),Tl=Ht('<span class="pie-tool-annotation-toolbar__action-icon svelte-1qnnvrt" aria-hidden="true"></span>'),kl=Ht("<button><!></button>"),xl=Ht('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <!>',1),$l=Ht('<button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--warning svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"></path></svg></button>'),_l=Ht('<button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--danger svelte-1qnnvrt"> </button>'),El=Ht('<div class="divider divider-horizontal mx-0 w-px svelte-1qnnvrt"></div> <!> <!>',1),Al=Ht('<div class="pie-tool-annotation-toolbar notranslate svelte-1qnnvrt" role="toolbar" translate="no" tabindex="-1"><!> <button class="pie-tool-annotation-toolbar__button pie-tool-annotation-toolbar__button--icon svelte-1qnnvrt"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor" aria-hidden="true" class="svelte-1qnnvrt"><path d="M5,21H19V19H5V21M12,17A6,6 0 0,0 18,11V3H15.5V11A3.5,3.5 0 0,1 12,14.5A3.5,3.5 0 0,1 8.5,11V3H6V11A6,6 0 0,0 12,17Z"></path></svg></button> <!> <!> <!></div>'),Nl=Ht('<div style="display: none;" aria-hidden="true"></div> <!> <div role="status" aria-live="polite" aria-atomic="true" class="pie-sr-only svelte-1qnnvrt"> </div>',1),Cl={hash:"svelte-1qnnvrt",code:`.pie-tool-annotation-toolbar.svelte-1qnnvrt {position:fixed;z-index:4200;display:flex;gap:0.25rem;padding:0.5rem;border-radius:0.5rem;background:var(--pie-background, #fff);color:var(--pie-text, #111827);
214
+ /* WCAG 2.2 SC 1.4.11: this stroke is the only boundary between a floating
215
+ toolbar and the content behind it, so it has to clear 3:1 against both.
216
+ It cannot come from --pie-border, because the DaisyUI bridge maps that
217
+ token to --color-base-300 -- a surface tint rather than a boundary
218
+ colour: #eeeeee at 1.16:1 on the light base, #15191e at 1.12:1 on the
219
+ dark one.
220
+
221
+ A boundary on a light surface has to be dark and one on a dark surface
222
+ has to be light, so the light-dark() arms below are the dark grey first
223
+ and the light grey second. Both are measured against the surfaces the
224
+ toolbar is actually drawn on rather than against pure white and pure
225
+ black: real theme bases are off-white and off-black, and a grey chosen
226
+ at the edge of passing against an extreme drops under threshold on
227
+ everything else. Across DaisyUI's 21 light and 14 dark themes plus the
228
+ PIE light and dark palettes, every light surface needs a grey no
229
+ lighter than #828282 and every dark surface one no darker than
230
+ #878787 -- disjoint ranges, which is why one value cannot serve both
231
+ and light-dark() is the mechanism. #5c5c5c holds 5.22:1 as the worst
232
+ case on the light surfaces, #949494 holds 3.56:1 on the dark ones.
233
+
234
+ light-dark() keys off the declared color-scheme, so every dark DaisyUI
235
+ theme takes the dark value, not only the one named "dark". Palettes
236
+ that pick their own boundary colour -- the data-color-scheme
237
+ accessibility schemes -- set the token themselves in
238
+ @pie-players/pie-theme, which is why this is a token and not a literal;
239
+ several of their backgrounds are mid-tone and defeat both greys. */border:1px solid
240
+ var(--pie-tool-annotation-toolbar-border, light-dark(#5c5c5c, #949494));box-shadow:0 10px 25px -8px rgb(0 0 0 / 0.3);user-select:none;}.pie-tool-annotation-toolbar__highlight-swatch.svelte-1qnnvrt {width:2.5rem;height:2rem;border:2px solid color-mix(in srgb, var(--pie-border-dark, #111827) 20%, transparent);border-radius:0.375rem;cursor:pointer;transition:all 0.15s ease;display:flex;align-items:center;justify-content:center;padding:0;}.pie-tool-annotation-toolbar__highlight-swatch.svelte-1qnnvrt:hover {transform:scale(1.1);border-color:color-mix(in srgb, var(--pie-border-dark, #111827) 45%, transparent);box-shadow:0 2px 8px rgb(0 0 0 / 0.15);}.pie-tool-annotation-toolbar__highlight-swatch.svelte-1qnnvrt:focus-visible {outline:2px solid var(--pie-button-focus-outline, var(--pie-primary, #3f51b5));outline-offset:2px;}.pie-tool-annotation-toolbar.svelte-1qnnvrt .divider-horizontal:where(.svelte-1qnnvrt) {height:auto;width:1px;background-color:color-mix(in srgb, var(--pie-border, #d1d5db) 70%, transparent);}
241
+
242
+ /* Screen reader only content */.pie-sr-only.svelte-1qnnvrt {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;}
243
+
244
+ /* Button styling */.pie-tool-annotation-toolbar__button.svelte-1qnnvrt {display:inline-flex;align-items:center;justify-content:center;gap:0.35rem;padding:0.4rem 0.55rem;border:1px solid var(--pie-button-border, #d1d5db);border-radius:0.4rem;background:var(--pie-button-bg, #fff);color:var(--pie-button-color, var(--pie-text, #111827));cursor:pointer;}.pie-tool-annotation-toolbar__button--icon.svelte-1qnnvrt {min-width:2rem;min-height:2rem;padding:0.45rem;}.pie-tool-annotation-toolbar__button.svelte-1qnnvrt:hover {background:var(--pie-button-hover-bg, #f9fafb);color:var(--pie-button-hover-color, var(--pie-text, #111827));border-color:var(--pie-button-hover-border, #9ca3af);}.pie-tool-annotation-toolbar__button.svelte-1qnnvrt:focus-visible {outline:2px solid var(--pie-button-focus-outline, var(--pie-primary, #3f51b5));outline-offset:2px;}.pie-tool-annotation-toolbar__button.svelte-1qnnvrt:disabled,
245
+ .pie-tool-annotation-toolbar__button[aria-disabled='true'].svelte-1qnnvrt {opacity:0.6;cursor:not-allowed;}.pie-tool-annotation-toolbar__button--warning.svelte-1qnnvrt {color:var(--pie-missing-icon, #92400e);}.pie-tool-annotation-toolbar__button--danger.svelte-1qnnvrt {color:var(--pie-incorrect-icon, #b91c1c);}.pie-tool-annotation-toolbar__button.svelte-1qnnvrt svg:where(.svelte-1qnnvrt) {width:18px;height:18px;}
246
+
247
+ /* Composer-supplied icons carry their own viewBox but rarely their own size, so
248
+ the box is set here to keep an action button the same height as the built-in
249
+ ones — a strip of mismatched buttons reads as broken. */.pie-tool-annotation-toolbar__action-icon.svelte-1qnnvrt {display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;}.pie-tool-annotation-toolbar__action-icon.svelte-1qnnvrt svg {width:100%;height:100%;}`};function Rl(t,e){Xo(e,!0),Bs(t,Cl);let n=Po(e,"enabled",7,!0),r=Po(e,"selectionActions",7,null);const o=typeof window<"u",i="pie-annotations",a=["button","input","select","textarea",'[contenteditable="true"]',".pie-tool-annotation-toolbar",".pie-tool-toolbar",'[role="button"]','[role="textbox"]'];let s=F(null),u=F(null);const h=Ct(()=>ua(c(u))),f=Ct(()=>c(u)?.highlightCoordinator??null),v=Ct(()=>c(u)?.ttsService??null),b=Ct(()=>[{name:wt.YELLOW,hex:"#fde995",label:c(h).t("tools.annotationToolbar.highlightYellowA11y")},{name:wt.PINK,hex:"#ff9fae",label:c(h).t("tools.annotationToolbar.highlightPinkA11y")},{name:wt.BLUE,hex:"#a7e0f6",label:c(h).t("tools.annotationToolbar.highlightBlueA11y")},{name:wt.GREEN,hex:"#a6e1c5",label:c(h).t("tools.annotationToolbar.highlightGreenA11y")}]);let d=F(null),w=F(null),T=F(null),g=F(fe({isVisible:!1,selectedText:"",selectedRange:null,toolbarPosition:{x:0,y:0,below:!1}})),y=F(!1),L=F(!1),O=F(""),x=F(0),W=F(null),D=null,H=null,G=null,K=null,J=null,ht=F(0),Pe=null;function Ie(p,m){G!==null&&clearTimeout(G),M(O,p,!0),G=setTimeout(()=>{M(O,""),G=null},m)}let dn=Ct(()=>(c(g).isVisible,vl(r()))),tr=Ct(()=>(c(g).isVisible,pl(c(v),c(u)?.toolkitCoordinator))),vn=Ct(()=>c(x)>0),pn=Ct(()=>c(W)!==null),gn=Ct(()=>c(T)?.scopeElement||c(w)?.scopeElement||null);function er(){const p=c(s)?.ownerDocument;return c(gn)||p?.documentElement||document.documentElement}function nr(){const p=c(w)?.canonicalItemId||c(w)?.itemId||"global";return`${i}:${p}`}function Hi(p){if(!c(f))return null;const m=c(f).getAnnotations();for(const C of m){if(p.startContainer.getRootNode()!==C.range.startContainer.getRootNode())continue;const P=p.compareBoundaryPoints(Range.START_TO_START,C.range),tt=p.compareBoundaryPoints(Range.END_TO_END,C.range),De=p.compareBoundaryPoints(Range.START_TO_END,C.range),Sn=p.compareBoundaryPoints(Range.END_TO_START,C.range);if(P>=0&&tt<=0||P<=0&&tt>=0||De>0&&Sn<0)return C.id}return null}function Fi(p){const m=yt(p)?p.host:p;return m.nodeType!==Node.ELEMENT_NODE&&m.nodeType!==Node.TEXT_NODE?!1:!a.some(C=>{try{return fa(m,C)!==null}catch{return!1}})}function zi(p){return c(gn)?Qe(c(gn),p.commonAncestorContainer):!0}function Qr(){if(!(!o||!c(f)))try{const p=er(),m=c(f).exportAnnotations(p);sessionStorage.setItem(nr(),JSON.stringify(m))}catch(p){console.error("[AnnotationToolbar] Failed to save annotations:",p)}}function Vi(){if(!(!o||!c(f)))try{const p=sessionStorage.getItem(nr());if(!p)return;const m=JSON.parse(p),C=er();c(f).importAnnotations(m,C),M(x,c(f).getAnnotations().length,!0)}catch(p){console.error("[AnnotationToolbar] Failed to load annotations:",p)}}function rr(){!o||H!==null||(H=(typeof requestAnimationFrame=="function"?requestAnimationFrame:p=>setTimeout(p,16))(()=>{H=null,to()}))}function to(p={}){if(!n()||!o||hl(D,Date.now()))return;const m=window.getSelection(),C=m?wl(m):null;if(!C)return oe();const{range:P}=C,tt=C.text.trim();if(!tt||!zi(P)||!Do(P)||!Fi(P.commonAncestorContainer))return oe();if(J!==null&&(p.force||J!==tt)&&(J=null),J===tt)return;M(W,Hi(P),!0);const De=c(g).isVisible;c(g).isVisible=!0,c(g).selectedText=tt,c(g).selectedRange=P.cloneRange(),or(P),K!==tt&&(K=tt,Ie(`Annotation toolbar available for "${tt.length>30?tt.substring(0,30)+"...":tt}". Press Shift+F10 for annotation tools.`,4e3)),De||(M(L,!0),setTimeout(()=>{M(L,!1)},100))}function or(p=c(g).selectedRange){if(!p)return;const m=p.getBoundingClientRect(),C={width:window.innerWidth||0,height:window.innerHeight||0};if(ll(m,C)){c(g).isVisible=!1;return}c(g).isVisible=!0,c(g).toolbarPosition=ul(m,C,ji())}function ji(){return c(d)?{width:c(d).offsetWidth,height:c(d).offsetHeight}:{width:0,height:0}}function bn(){!c(g).isVisible&&!c(g).selectedRange||or()}function eo(){D=Date.now()}function mn(){D=null,rr()}function wn(){J=c(g).selectedText||null,oe()}function oe(){c(y)&&c(v)&&(c(v).stop(),M(y,!1)),Bi(),c(g).isVisible=!1,c(g).selectedText="",c(g).selectedRange=null,K=null,M(ht,0)}function Bi(){const p=Pe;Pe=null,p&&no()&&typeof p.focus=="function"&&p.isConnected&&p.focus({preventScroll:!0})}function no(){if(!c(d)||!o)return!1;const p=c(d).getRootNode().activeElement;return!!p&&c(d).contains(p)}function ir(){return c(d)?Array.from(c(d).querySelectorAll("button:not([disabled])")):[]}function Ui(){const p=ir();if(p.length){if(!no()&&o){const m=c(d)?.getRootNode()?.activeElement;Pe=m instanceof HTMLElement?m:null}M(ht,Dr(c(ht),p.length),!0),p[c(ht)]?.focus()}}function ro(p){if(!c(g).selectedRange||!c(f))return;const m=c(g).selectedText;c(f).addAnnotation(c(g).selectedRange,p),M(x,c(f).getAnnotations().length,!0),Qr();const C=p===wt.UNDERLINE?"underlined":`highlighted in ${p}`;Ie(`"${m.length>30?m.substring(0,30)+"...":m}" ${C}`,3e3),wn()}function Gi(){if(!c(W)||!c(f)){console.warn("[AnnotationToolbar] No overlapping annotation to remove");return}const p=c(f).getAnnotation(c(W));if(!p){console.warn("[AnnotationToolbar] Annotation not found:",c(W));return}const m=p.range.toString();c(f).removeAnnotation(c(W)),M(x,c(f).getAnnotations().length,!0),Qr(),Ie(`Removed annotation from "${m.length>30?m.substring(0,30)+"...":m}"`,3e3),wn()}function Ki(){const p=c(x);c(f)?.clearAnnotations(),M(x,0),sessionStorage.removeItem(nr()),Ie(`${p} annotation${p===1?"":"s"} cleared`,3e3),wn()}function Xi(p){return p.iconSvg?ha(p.iconSvg):""}function Ji(p){const m=c(g).selectedText,C=c(g).selectedRange;try{p.run({text:m,range:C})}catch(P){console.error(`[AnnotationToolbar] Selection action "${p.id}" threw:`,P)}wn()}async function Zi(){if(!(c(y)||!c(g).selectedRange||!c(v)||!c(tr))){M(y,!0);try{const p=c(g).selectedRange;await c(v).speak(p,{contentRoot:Do(p)??er(),language:c(u)?.contentLanguage,catalogContext:va(p.startContainer,c(u))})}catch(p){console.error("[AnnotationToolbar] TTS error:",p),wa(p)&&Ie(c(h).t("tools.textToSpeech.inline.initFailed"),5e3)}finally{M(y,!1)}}}function oo(p){if(p.key==="Escape"&&c(g).isVisible){p.preventDefault(),oe();return}al(p)&&(c(g).isVisible||to({force:!0}),c(g).isVisible&&(p.preventDefault(),Ts().then(()=>Ui())))}function Yi(p){if(p.key==="Escape"){p.preventDefault(),oe();return}const m=ir(),C=sl({key:p.key,activeIndex:c(ht),count:m.length,direction:o&&c(d)&&getComputedStyle(c(d)).direction==="rtl"?"rtl":"ltr"});C!==null&&(p.preventDefault(),M(ht,C,!0),m[C]?.focus())}function Qi(p){const m=p.relatedTarget;m instanceof Node&&c(d)?.contains(m)||(Pe=null,oe())}function yn(p){if(!c(g).isVisible||c(L)||!c(d))return;const m=(typeof p.composedPath=="function"?p.composedPath():[]).filter(C=>!!C);m.includes(c(d))||m.length===0&&c(d).contains(p.target)||(Pe=null,oe())}_n(()=>{if(!o)return;const p=setTimeout(()=>{Vi()},2e3),m=c(gn)||document;return m.addEventListener("click",yn),m.addEventListener("touchstart",yn),document.addEventListener("selectionchange",rr),m.addEventListener("pointerdown",eo),document.addEventListener("pointerup",mn),document.addEventListener("pointercancel",mn),document.addEventListener("keydown",oo),window.addEventListener("scroll",bn,!0),window.addEventListener("resize",bn),()=>{clearTimeout(p),G!==null&&clearTimeout(G),H!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(H),H=null),m.removeEventListener("click",yn),m.removeEventListener("touchstart",yn),document.removeEventListener("selectionchange",rr),m.removeEventListener("pointerdown",eo),document.removeEventListener("pointerup",mn),document.removeEventListener("pointercancel",mn),document.removeEventListener("keydown",oo),window.removeEventListener("scroll",bn,!0),window.removeEventListener("resize",bn)}}),_n(()=>{c(g).isVisible,c(d),c(dn),c(pn),c(vn),c(tr),an(()=>{!c(g).isVisible||!c(d)||or()})}),_n(()=>{c(g).isVisible,c(ht),c(pn),c(vn),c(y),c(dn),an(()=>{const p=ir();if(p.length===0)return;const m=Dr(c(ht),p.length);m!==c(ht)&&M(ht,m,!0),p.forEach((C,P)=>{C.tabIndex=P===m?0:-1})})}),_n(()=>{if(!c(s))return;const p=aa(c(s),P=>{M(w,P,!0)}),m=la(c(s),P=>{M(T,P,!0)}),C=ca(c(s),P=>{M(u,P,!0)});return()=>{C(),m(),p()}});var ta={get enabled(){return n()},set enabled(p=!0){n(p),jn()},get selectionActions(){return r()},set selectionActions(p=null){r(p),jn()}},io=Nl(),ao=$n(io);Wo(ao,p=>M(s,p),()=>c(s));var so=Rt(ao,2),ea=p=>{var m=Al(),C=On(m);No(C,17,()=>c(b),Hs,(Z,Q)=>{var q=yl(),et=ur(On(q),!0);Be(q),jt(()=>{Mo(q,`background-color: ${c(Q).hex??""};`),X(q,"aria-label",c(Q).label),X(q,"title",c(Q).label),An(et,c(Q).label)}),Yt("click",q,()=>ro(c(Q).name)),ft(Z,q)});var P=Rt(C,2),tt=Rt(P,2),De=Z=>{var Q=Sl(),q=Rt($n(Q),2);jt((et,Ft)=>{X(q,"aria-disabled",c(y)),X(q,"aria-label",et),X(q,"title",Ft)},[()=>c(h).t("tools.annotationToolbar.readAloudA11y"),()=>c(h).t("tools.annotationToolbar.readAloud")]),Yt("click",q,Zi),ft(Z,Q)};se(tt,Z=>{c(tr)&&Z(De)});var Sn=Rt(tt,2),ra=Z=>{var Q=xl();No(Rt($n(Q),2),17,()=>c(dn),q=>q.id,(q,et)=>{const Ft=Ct(()=>Xi(c(et)));var At=kl();let Nt;var ut=On(At),qe=Jt=>{var Zt=Tl();js(Zt,()=>c(Ft),!0),Be(Zt),ft(Jt,Zt)},He=Jt=>{var Zt=Es();jt(()=>An(Zt,c(et).label)),ft(Jt,Zt)};se(ut,Jt=>{c(Ft)?Jt(qe):Jt(He,-1)}),Be(At),jt(()=>{Nt=Ks(At,1,"pie-tool-annotation-toolbar__button svelte-1qnnvrt",null,Nt,{"pie-tool-annotation-toolbar__button--icon":!!c(Ft)}),X(At,"data-pie-selection-action",c(et).id),X(At,"aria-label",c(et).label),X(At,"title",c(et).tooltip||c(et).label)}),Yt("click",At,()=>Ji(c(et))),ft(q,At)}),ft(Z,Q)};se(Sn,Z=>{c(dn).length>0&&Z(ra)});var oa=Rt(Sn,2),ia=Z=>{var Q=El(),q=Rt($n(Q),2),et=Nt=>{var ut=$l();jt((qe,He)=>{X(ut,"aria-label",qe),X(ut,"title",He)},[()=>c(h).t("tools.annotationToolbar.removeA11y"),()=>c(h).t("tools.annotationToolbar.remove")]),Yt("click",ut,Gi),ft(Nt,ut)};se(q,Nt=>{c(pn)&&Nt(et)});var Ft=Rt(q,2),At=Nt=>{var ut=_l(),qe=ur(ut,!0);jt((He,Jt,Zt)=>{X(ut,"aria-label",He),X(ut,"title",Jt),An(qe,Zt)},[()=>c(h).t("tools.annotationToolbar.clearAllA11y"),()=>c(h).t("tools.annotationToolbar.clearAll"),()=>c(h).t("tools.annotationToolbar.clearAll")]),Yt("click",ut,Ki),ft(Nt,ut)};se(Ft,Nt=>{c(vn)&&Nt(At)}),ft(Z,Q)};se(oa,Z=>{(c(pn)||c(vn))&&Z(ia)}),Be(m),Wo(m,Z=>M(d,Z),()=>c(d)),jt((Z,Q,q,et,Ft)=>{X(m,"data-pie-placement",c(g).toolbarPosition.below?"below":"above"),Mo(m,`left:${c(g).toolbarPosition.x}px; top:${c(g).toolbarPosition.y}px;`),X(m,"lang",Z),X(m,"dir",Q),X(m,"aria-label",q),X(P,"aria-label",et),X(P,"title",Ft),m.dir=m.dir},[()=>c(h).getLocale(),()=>c(h).getDirection?.()??"ltr",()=>c(h).t("tools.annotationToolbar.toolbarA11y"),()=>c(h).t("tools.annotationToolbar.underlineA11y"),()=>c(h).t("tools.annotationToolbar.underline")]),Yt("keydown",m,Yi),Yt("focusout",m,Qi),Yt("click",P,()=>ro(wt.UNDERLINE)),ft(p,m)};se(so,p=>{c(g).isVisible&&p(ea)});var na=ur(Rt(so,2),!0);return jt(()=>An(na,c(O))),ft(t,io),Jo(ta)}ks(["keydown","focusout","click"]);Ml("pie-tool-annotation-toolbar",il(Rl,{enabled:{attribute:"enabled",type:"Boolean"},selectionActions:{type:"Object"}},[],[],{mode:"open"},sa));function Ml(t,e){customElements.get(t)||customElements.define(t,e)}export{Rl as default};