egatari 0.6.14 → 0.6.15

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 (246) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/components.lock.json +507 -153
  3. package/components2.lock.json +1710 -33
  4. package/kit/check-messages.mjs +11 -2
  5. package/kit/core/article-render.mjs +1 -1
  6. package/kit/core/article-text.mjs +3 -1
  7. package/kit/core/build-core.mjs +23 -1
  8. package/kit/core/check-parity.mjs +1 -1
  9. package/kit/core/check-rules.mjs +1 -1
  10. package/kit/core/colab-core.mjs +1 -1
  11. package/kit/core/comment-core.mjs +6 -0
  12. package/kit/core/layout-scan.mjs +67 -2
  13. package/kit/core/llm-fix.mjs +12 -1
  14. package/kit/core/llm-pack-assemble.mjs +5 -2
  15. package/kit/core/llm-pack-data.mjs +218 -32
  16. package/kit/core/llm-pack.mjs +3 -3
  17. package/kit/core/new-deck.mjs +17 -3
  18. package/kit/core/part-labels.mjs +6 -0
  19. package/kit/core/player.mjs +18 -0
  20. package/kit/core/portable.mjs +21 -3
  21. package/kit/core/tier-a.mjs +14 -2
  22. package/kit/instruction-version.json +1 -1
  23. package/kit/player.json +1 -1
  24. package/kit/player.lock.json +2 -2
  25. package/kit/presenter.js +3 -1
  26. package/kit/tools.js +9 -2
  27. package/package.json +4 -2
  28. package/server/dev.mjs +3 -2
  29. package/server/editor-ui.js +8 -3
  30. package/server/hints.js +22 -2
  31. package/vendor/components/CATALOG.md +21 -14
  32. package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/README.en.md +40 -0
  33. package/vendor/components/sha256/000cc8b85d22854d93587d53fe07585e0d9f0abee86d863c5ed1f6c53967912b/index.js +408 -0
  34. package/vendor/components/sha256/0396a1895978803ae342b7f598f187b17ead47800e8f8317a5cb041111349813/index.js +278 -0
  35. package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/README.en.md +26 -0
  36. package/vendor/components/sha256/07b8bfd9240585ee76082632c6f9483017d46ad3c74e509e715c27294970606c/index.js +322 -0
  37. package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/README.en.md +54 -0
  38. package/vendor/components/sha256/08778858e2fb42765077b50e08f848089b1d11ea394909a4f611557b94b3acf2/index.js +470 -0
  39. package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/README.en.md +18 -0
  40. package/vendor/components/sha256/0a08eb254e59cb306adb32c940ffe54e88efa3c9b7ef05ee021c38995996e742/index.js +279 -0
  41. package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/README.en.md +31 -0
  42. package/vendor/components/sha256/1001b3cfcd3fbc34370accbb37aa550c8cadbb54bf8e8155d417219de3797be9/index.js +267 -0
  43. package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/README.en.md +53 -0
  44. package/vendor/components/sha256/109c302247e0c62720872be35392a73bea72804b0ed421ef8ced3f030f72e537/index.js +171 -0
  45. package/vendor/components/sha256/1117758820dc561f41cf9d1cc0bab8cf3173cde7771ac10a12b94c96007c0f55/index.js +268 -0
  46. package/vendor/components/sha256/137017ad452afe209bdff81bc02ffae99c6b60a1c4aed2383515974f65511ff2/index.js +205 -0
  47. package/vendor/components/sha256/1a1471ba5f68e54304825a64e736afeda421e3763cdcbcdab2e45509562a0291/index.js +607 -0
  48. package/vendor/components/sha256/1b15fcc12b2fa43821e6299e87aae31aa69dbbc5a0d1b80088a5d7c5f8b8f7f5/index.js +429 -0
  49. package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/README.en.md +23 -0
  50. package/vendor/components/sha256/1cc1732d052e58f7913ee50c0fc834d896db6b00ba779164de11b442347863db/index.js +147 -0
  51. package/vendor/components/sha256/21c099461befc0d382ddfe982f2a6cd8eeb6dd731252164ac619525e4bacdf0d/index.js +242 -0
  52. package/vendor/components/sha256/2352e0e22460f4a3c46dca6cef27cd9c63f161a411f1cf56c75c585e9124503c/index.js +315 -0
  53. package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/README.en.md +53 -0
  54. package/vendor/components/sha256/2564dd8096be4cb3ba43703dc76029c1ba3965b831e430597c754865df4b67f4/index.js +171 -0
  55. package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/README.en.md +38 -0
  56. package/vendor/components/sha256/2bae0f89ba91574c6ffb654e246365acd9aaf16a7aae92d95e1bad045671fbd2/index.js +414 -0
  57. package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/README.en.md +45 -0
  58. package/vendor/components/sha256/2c68c355d60fdc879728c39245b7cf964b193628b63e9ab87df09c6bc2bfa7d3/index.js +211 -0
  59. package/vendor/components/sha256/2f111b900898579b3ec1611c2110db336a46d9133171a0cbb125ee37bd1f24f8/index.js +592 -0
  60. package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/README.en.md +45 -0
  61. package/vendor/components/sha256/2fd81df4107ecb28c0dcecfdb3fd8fb9a474b5a7e0aeb16d8c0c6b1275c3a178/index.js +211 -0
  62. package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/README.en.md +20 -0
  63. package/vendor/components/sha256/337febae1374670413653c453feee7cec169892e130248617c6642a91678564e/index.js +310 -0
  64. package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/README.en.md +35 -0
  65. package/vendor/components/sha256/38f6385118112c679b520909d677935176e0c7aa2183a877324eeb5108606eae/index.js +179 -0
  66. package/vendor/components/sha256/3af0b84b1799fc64ec74d6da9cbd343eccd89e8a11c81bfb444562c911284442/index.js +342 -0
  67. package/vendor/components/sha256/3c69bf3b3c6b9f76048fbc0839b3aa9699723570086d3d44bac799230ed6de5b/index.js +121 -0
  68. package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/README.en.md +37 -0
  69. package/vendor/components/sha256/3f2f66da34496213cf6140ae041122c31f13c77e5ee18ad11a3390fbc4a6ecca/index.js +501 -0
  70. package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/README.en.md +38 -0
  71. package/vendor/components/sha256/41b82d13037c4597e560cf2b3adebea4495ebb4711a8bb82b1a84495839b8fc8/index.js +414 -0
  72. package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/README.en.md +30 -0
  73. package/vendor/components/sha256/4220949efd68ff86e73ee6a0920b9f5b53f445cfcd657db72ecb2b55da1cc019/index.js +305 -0
  74. package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/README.en.md +31 -0
  75. package/vendor/components/sha256/47f7ea3e2551abb250a9f5883716791026f0f54ae9cca6d82fabdb92478c69ae/index.js +236 -0
  76. package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/README.en.md +21 -0
  77. package/vendor/components/sha256/4b515bfb3a39a6c1e2b04f235affc5bc84e74d80bfd7f9e6d9b5d84d0a9eeb57/index.js +108 -0
  78. package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/README.en.md +28 -0
  79. package/vendor/components/sha256/4e7ba7759ddebfa5432b733e5f10abfd336ef7d6cc4d46305d5ff7d00ed3a423/index.js +213 -0
  80. package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/README.en.md +35 -0
  81. package/vendor/components/sha256/52149f061935e65502b8353cf70285bba93ab24451d2daac26b994d3901d3864/index.js +179 -0
  82. package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/README.en.md +53 -0
  83. package/vendor/components/sha256/5644e63364f46ee53d5f8623355149753147cdc4720e4c66fc9b8a32627e68a5/index.js +171 -0
  84. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ABCJS-ADAPTER.md +101 -0
  85. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/LICENSE-abcjs.txt +21 -0
  86. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/chords.json +89 -0
  87. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/doremi.json +261 -0
  88. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/extras.json +192 -0
  89. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/kaeru.json +521 -0
  90. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/rhythm.json +248 -0
  91. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/fixtures/ties.json +360 -0
  92. package/vendor/components/sha256/5662bea8cc48f484ccf14c5a8ac12d64b2c5ab032a26176d133ed3a8eb33a557/index.js +508 -0
  93. package/vendor/components/sha256/59996a56df462b36e24a928d4397c9308d9e39ad8224ebd19fb5c981608ef458/index.js +521 -0
  94. package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/README.en.md +30 -0
  95. package/vendor/components/sha256/5afcaf27e9209a32a8a8e6667b637ea434326b76f563689552716de953c94a98/index.js +305 -0
  96. package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/README.en.md +30 -0
  97. package/vendor/components/sha256/5cf9baec12bac716d9218d6fbc4f95446adf31658da62564aa403bb5bdee542e/index.js +192 -0
  98. package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/README.en.md +20 -0
  99. package/vendor/components/sha256/5ffac218340cc51ce842a530f6021fc916090376b243e2ad5d4c0ef48a040ce9/index.js +307 -0
  100. package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/README.en.md +24 -0
  101. package/vendor/components/sha256/6084fd3102b7d450db3804120ac27aa585ab44937734d980fb50c51f39fc98a7/index.js +554 -0
  102. package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/README.en.md +25 -0
  103. package/vendor/components/sha256/60e3e41c34034e16f9f7ee9ce6c8d669ebb753614989fc2e5e181ef295e83631/index.js +316 -0
  104. package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/README.en.md +18 -0
  105. package/vendor/components/sha256/6156a8a03235e1ed92d3cd3ba1f40df86667059003d82e47297bd3917ef562b8/index.js +279 -0
  106. package/vendor/components/sha256/624acb997c4975ace65570b529b3ba00baa421c80ecb7fc80f392a64e8c573a7/index.js +107 -0
  107. package/vendor/components/sha256/62602488ee33dd4bdef8516de16da5ab27d7f7265d5041681beab80e08f1d482/index.js +97 -0
  108. package/vendor/components/sha256/67eaf344bddac79b74ed03fdcd70285c7b52b160e6c5ffbd6897848179aa5230/index.js +818 -0
  109. package/vendor/components/sha256/682c9c8871eccd19ff1264e0323a2e4c5798b0488b612ba0339c6fe85aab5914/index.js +926 -0
  110. package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/README.en.md +51 -0
  111. package/vendor/components/sha256/6937967bbf62098aca7cef99f14f97fa11c861a12da6a1d8fe5fa55a6b4551f2/index.js +230 -0
  112. package/vendor/components/sha256/72138936ed0b8fd3cb0214ae7ed250ae3f1f8b21ed6fd593544947774064ba0d/index.js +250 -0
  113. package/vendor/components/sha256/74c1a0f3ed1370c5003aa5770ee28cea2ce994d415680116a92fdbcd5854ba62/index.js +198 -0
  114. package/vendor/components/sha256/76125035eb153b98befa9c735bcd9fc4f99f774dc1d082fdae40acaadfe7d95b/index.js +818 -0
  115. package/vendor/components/sha256/7728cf7dde88a6688aba0ed70f23f7e21362a147beac09c1fa1a4b773e08e93b/index.js +354 -0
  116. package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/README.en.md +23 -0
  117. package/vendor/components/sha256/7822f137d446604a83c1dbc3b40fdb455001dc55da12276ff3e7079d270dd143/index.js +289 -0
  118. package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/README.en.md +31 -0
  119. package/vendor/components/sha256/7c2b93508a09a5dd36639ab1329ca6d00487b326c53db436b14295174dc03369/index.js +236 -0
  120. package/vendor/components/sha256/7d50e50fbb6c5ec636b62509bd88ddaac1870e0522cf11bcc293ce924d48072d/index.js +312 -0
  121. package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/README.en.md +42 -0
  122. package/vendor/components/sha256/82ffee434e7f2213031190f832f3a75a8cdf59554fdbc092c0b079d6b0753cad/index.js +549 -0
  123. package/vendor/components/sha256/87fc302c41b2bfeea88951ed689ec01b4dc79218c4bc69b310dc2228dfa2e153/index.js +926 -0
  124. package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/README.en.md +24 -0
  125. package/vendor/components/sha256/8886ccd82d68dc1bbf5b7ffcef746074ce8a3d26414d55691dc5e691e4976ded/index.js +103 -0
  126. package/vendor/components/sha256/89c8c16788e24df17920542ed6eb6557dea4a10e835de8fe839e439ccbba8014/index.js +69 -0
  127. package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/README.en.md +44 -0
  128. package/vendor/components/sha256/8beed7e471fa0d6b801b5c540f69ab77220e228c58ff16b0bc2b1a6eef30800e/index.js +304 -0
  129. package/vendor/components/sha256/8d9af78aef44ad2f98101c67d32473373d39725a09c923969aa621d5f5b124bb/index.js +121 -0
  130. package/vendor/components/sha256/8f861d71df72a82be86a3e63abf7d69bbab5aac6fa68be6e077c4e19c3519ed8/index.js +312 -0
  131. package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/README.en.md +54 -0
  132. package/vendor/components/sha256/90415da5ad04e1944258e29c929c5de65c8152c829414e911ba55a84ac89f348/index.js +470 -0
  133. package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/README.en.md +24 -0
  134. package/vendor/components/sha256/91a1e0e48e20cac705cbe6e33e66a24a2851b1dc88c5164ed906bcecba4d943f/index.js +214 -0
  135. package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/README.en.md +33 -0
  136. package/vendor/components/sha256/91a9353a0c3b3744765944783aa1537b3f6ff1677c67caede643cdf2f52289cf/index.js +390 -0
  137. package/vendor/components/sha256/9289efef4a75afe011e54a17e34db08cfb16a450b2e0653e6a98525495cfba99/index.js +315 -0
  138. package/vendor/components/sha256/93256a923199ea51108cdb7491c3c96f376dbef15b64cbf1a1aa7cc5726b4970/index.js +429 -0
  139. package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/README.en.md +24 -0
  140. package/vendor/components/sha256/94f4891971b26f5bc157ef9f7f630b1528fc7e2a4c63e84e01951a5a3f94cedc/index.js +550 -0
  141. package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/README.en.md +28 -0
  142. package/vendor/components/sha256/94f4f798fdd070fc1693494e772ff479d3e694a07a0c97b6e97c3b3895cad478/index.js +213 -0
  143. package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/README.en.md +40 -0
  144. package/vendor/components/sha256/95583538da2982ec5f508217a8f2821796e6a34cf755baa66f2aaeb1c6dae814/index.js +348 -0
  145. package/vendor/components/sha256/97c074a5473618c65f4c23263f056870a0b7940e73475f2a1f32f68c08d8eb0f/index.js +198 -0
  146. package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/README.en.md +66 -0
  147. package/vendor/components/sha256/98e1957b1fac2d55d9bfa6a0990ead6a2730d571c988055ca280df05a0e9ea37/index.js +984 -0
  148. package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/README.en.md +34 -0
  149. package/vendor/components/sha256/99a26795f8b351ade4a4cbbea845aeb149c96b09fe96151edda57128082185fa/index.js +244 -0
  150. package/vendor/components/sha256/a18b2b15d00c76462a43823b5c270c7ddd7c31794da9c236f74f20f80ec2ffdb/index.js +354 -0
  151. package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/README.en.md +32 -0
  152. package/vendor/components/sha256/a744049fc56e0a5d5b1638bef597a4e65f99d0776a35d830a389f216f314f1bc/index.js +222 -0
  153. package/vendor/components/sha256/a979207c60fbd2a12cb557297eb0217eb098d660de684530a0f43d0d9c64e6ef/index.js +312 -0
  154. package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/README.en.md +34 -0
  155. package/vendor/components/sha256/aba898152e40ca44e1e7bea22242bd6897a31e0254cbfd70e426907b65379af2/index.js +244 -0
  156. package/vendor/components/sha256/af7ed69b8969f6da14784b6e9d26e4dfd20147772ea172a99bd936a71be10fcd/index.js +278 -0
  157. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ABCJS-ADAPTER.md +101 -0
  158. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/LICENSE-abcjs.txt +21 -0
  159. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/chords.json +89 -0
  160. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/doremi.json +261 -0
  161. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/extras.json +192 -0
  162. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/kaeru.json +521 -0
  163. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/rhythm.json +248 -0
  164. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/fixtures/ties.json +360 -0
  165. package/vendor/components/sha256/b08a536a07498629c026f8fc2962acda791c83a99268ac715db5e764087000e2/index.js +508 -0
  166. package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/README.en.md +66 -0
  167. package/vendor/components/sha256/b28d136dffb03a3e855b2ff959712a143da9a84c3a4fd13a1126d7711083a2d6/index.js +990 -0
  168. package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/README.en.md +24 -0
  169. package/vendor/components/sha256/b2d9c417f258745c56c04e05dc9463a412a4978d46c3ffff2556f0b0fafbbfc2/index.js +550 -0
  170. package/vendor/components/sha256/b8096d7a60609520981273673761a110e40e3bdf52a7ab5548363b20e16f6e93/index.js +404 -0
  171. package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/README.en.md +32 -0
  172. package/vendor/components/sha256/b9e27e84b2c534b87d6da5da30ee808d7863cbd1b818082b4c11d1f8b7129b1a/index.js +222 -0
  173. package/vendor/components/sha256/bd8e3893df02411deccc1d6d7b02292ca0d59dfeddfafcf99419430981572c82/index.js +351 -0
  174. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ABCJS-ADAPTER.md +101 -0
  175. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/LICENSE-abcjs.txt +21 -0
  176. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/chords.json +89 -0
  177. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/doremi.json +261 -0
  178. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/extras.json +192 -0
  179. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/kaeru.json +521 -0
  180. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/rhythm.json +248 -0
  181. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/fixtures/ties.json +360 -0
  182. package/vendor/components/sha256/c201dbc3f1f790c59cc010b3be3566daa9085754614402e9dc1296dba9e87769/index.js +508 -0
  183. package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/README.en.md +31 -0
  184. package/vendor/components/sha256/c5226220649a5854d56ceeaea16722fe54a79b4197f71c51c4e1523bf22bec32/index.js +267 -0
  185. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/LICENSE-strokesvg.txt +115 -0
  186. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/OFL.txt +93 -0
  187. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/index.js +749 -0
  188. package/vendor/components/sha256/c691f9c83d06502bf20f86df02ee5a516063d6af1e9ee8204aad8fd8c1a44a71/strokes-CHANGES.md +20 -0
  189. package/vendor/components/sha256/c791e69e722f64146242f97acb29a341160d0c327cfe1d76307954d80e70db85/index.js +268 -0
  190. package/vendor/components/sha256/c8c0de41d603b61c6ec4dc1da5b50559e213dd1f3693ee5019df858016fd6daf/index.js +747 -0
  191. package/vendor/components/sha256/c99d4f2ab443484b9f462e405c72ea4794838b88f8823f27c606d12cbbedb996/index.js +404 -0
  192. package/vendor/components/sha256/cbde046e30c35db60259911a88e2ae0bedaf545e29b1da8b8ce13bc602a33c19/index.js +465 -0
  193. package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/README.en.md +51 -0
  194. package/vendor/components/sha256/ccdd16ed76838ac9d6abb4ee695769bfecb802ae490ac91914ed68131ad04434/index.js +228 -0
  195. package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/README.en.md +35 -0
  196. package/vendor/components/sha256/ce0a52fa13ae579020d1172845647daee9ba78e070736e47740f2d2feabffe7e/index.js +179 -0
  197. package/vendor/components/sha256/cf0985ffcd8e7cbe2175ddb9a4342b2a4aa3f322794188fc99af8789b494460d/index.js +521 -0
  198. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/LICENSE-strokesvg.txt +115 -0
  199. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/OFL.txt +93 -0
  200. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/index.js +749 -0
  201. package/vendor/components/sha256/cff7ed8a0e0708bcef2e13105b28810bda867251a9f205ad9c2f1a5b4f759866/strokes-CHANGES.md +20 -0
  202. package/vendor/components/sha256/d01dc7fd78d08dd720ed86b39d7877dc0913d72e914036088a86af2df2faee52/index.js +484 -0
  203. package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/README.en.md +24 -0
  204. package/vendor/components/sha256/d448fec2aeb436f187875c493b1592b373c6a18274ffc64231dbe3f1b54f8cbc/index.js +214 -0
  205. package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/README.en.md +31 -0
  206. package/vendor/components/sha256/d4aa3ffb394d5db7f47081b1818958547fe164bb968df03131f9400c103b97c4/index.js +271 -0
  207. package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/README.en.md +25 -0
  208. package/vendor/components/sha256/d582d02ceeaf1ec4d94115b806852ddb66c009788e67728ae0e08cb8d29ca546/index.js +316 -0
  209. package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/README.en.md +23 -0
  210. package/vendor/components/sha256/d75ab2c8f6c01082bfcaeaba44290367d6b49654e2bf538422b7b3e499de9acf/index.js +120 -0
  211. package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/README.en.md +40 -0
  212. package/vendor/components/sha256/d8f5272dac33066a04ecefa9a828ca11d18dec581866899f55433573ba4472d6/index.js +405 -0
  213. package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/README.en.md +66 -0
  214. package/vendor/components/sha256/dd1ff8de877573e30635928e9abce0b1fba8dfc95a079eca86703a884d3c3d59/index.js +984 -0
  215. package/vendor/components/sha256/ddd4b9cbbc282cbb3117ff662e1a14ecdb3cc7c16072a574418ec6a6eecef4d8/index.js +107 -0
  216. package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/README.en.md +22 -0
  217. package/vendor/components/sha256/e24a4235a661bfda4049e1c72b6c376066fcc65e27a2bdfe77942a3394726c81/index.js +145 -0
  218. package/vendor/components/sha256/e2da948daac7bfac158857877b5a6932dbd2369e73901abcef118c92dd20b725/index.js +747 -0
  219. package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/README.en.md +42 -0
  220. package/vendor/components/sha256/e40201a655bf5c556d70fbf45b5052dd48c33fc8030b331a9d9cbc96913d02a6/index.js +268 -0
  221. package/vendor/components/sha256/e653a4da80f7761442dc5b504ea5b0700fd0acf1979beeff56122cfdb3d4654c/index.js +607 -0
  222. package/vendor/components/sha256/ea217c6821e931b2d8474bf56d38f2dcc89ec705fe1d276f313e1c7e8db2b98a/index.js +233 -0
  223. package/vendor/components/sha256/ea2e4e24838574f607879c7d05556281258c018331e4da3e6f3a5263173f2e99/index.js +75 -0
  224. package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/README.en.md +42 -0
  225. package/vendor/components/sha256/eb0b402dc4738b2dca2918c7f64a4d6fc3c27b4ba419270bbe8240a3c8a77f0c/index.js +549 -0
  226. package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/README.en.md +44 -0
  227. package/vendor/components/sha256/f219b47f32b0a78e8f8f5dac83596acfed24dd6e8bfe3f05f8ebfb9582d64485/index.js +203 -0
  228. package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/README.en.md +34 -0
  229. package/vendor/components/sha256/f4204773037ae296786e3614b5bfd7487b0f5ba6d5cf92ce20262bb7613e1b6b/index.js +244 -0
  230. package/vendor/components/sha256/fa1a09c10181456143d125d68dbbdcacde6bab2e4a2b3e573367103ce28ebf55/index.js +228 -0
  231. package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/README.en.md +51 -0
  232. package/vendor/components/sha256/fa9c9f63d74a514636961bcb8af75063e00e39bdf85655ecf5d4d7bbc05a831a/index.js +228 -0
  233. package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/README.en.md +23 -0
  234. package/vendor/components/sha256/facebe095849528396ee91d7d6856cb6945ba89ca8b1f34dce488dccb29e9d40/index.js +147 -0
  235. package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/README.en.md +20 -0
  236. package/vendor/components/sha256/fb0a77a344098c53cc90215685cee32b0d31362a1de5b5ac0eee422ed2c3c430/index.js +307 -0
  237. package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/README.en.md +26 -0
  238. package/vendor/components/sha256/fc48e703adab4715157f8dbb0e33c8b5c00099358ae522484290a7098fda2910/index.js +322 -0
  239. package/vendor/components-2/manifest-2.12.0.json +2348 -0
  240. package/vendor/components-2/manifest-2.13.0.json +2477 -0
  241. package/vendor/components-2/manifest-2.14.0.json +2460 -0
  242. package/vendor/components-2/manifest-2.14.1.json +2460 -0
  243. package/vendor/components-2/manifest-2.15.0.json +2460 -0
  244. package/vendor/egatari-spec/SOURCE.json +3 -3
  245. package/vendor/egatari-spec/schema/deck-meta.schema.json +15 -0
  246. package/vendor/egatari-spec/schema/egatari-metadata.schema.json +15 -0
@@ -0,0 +1,926 @@
1
+ // m-map-japan:日本の 47 都道府県の地図。地域の強調・塗り分け(階級)・点・矢印・作り手の重ね描きを段階ごとに出す
2
+ // <m-map-japan labels="focus" style="height:460px"><script type="application/json">
3
+ // {"regions": [{"id": "13", "tone": "emph", "step": 1}, {"group": "kinki", "tone": "series-2", "step": 2}],
4
+ // "values": {"01": 5.1, "13": 14.1}, "classes": [0, 5, 10, 15],
5
+ // "points": [{"lon": 139.69, "lat": 35.69, "label": "東京", "step": 3}], "flows": [{"from": "13", "to": "27", "via": [[137.5, 34.4]], "step": 4}],
6
+ // "shapes": [{"label": "例:古代の国の範囲", "polygon": [[135.1, 34.2], [136.0, 34.2], [136.0, 35.0]], "step": 5}]}
7
+ // (JSON の終わり)</m-map-japan>
8
+ // 地図のデータは Natural Earth 5.1.1(パブリックドメイン)を加工したもので、作り方は tools/map/build-japan.mjs(docs/map-design.md)。
9
+ // 領土は日本政府の立場のとおり(北方領土は北海道、竹島は島根県、尖閣諸島は沖縄県)。データに固定した性質で、切り替えはない。
10
+ // 島(docs/map-design.md §5.3):北方領土・竹島・尖閣諸島はいつも描く。沖ノ鳥島・南鳥島は小笠原諸島の枠(islands="all")か layout="true" のときに描き、
11
+ // そのときはいつも名前を書く。読める層には描いた島を挙げる
12
+ // 段階:地図そのもの(陸地・枠・枠の名前)は段階 0 から出ている(見出しや軸と同じ)。項目は step(既定 1)で出る
13
+ // 見せ方(docs/conventions.md §1):fade(フェードして現れる、既定)・sweep(同じ段階の中で西から東へ順に現れる)・
14
+ // draw(地域と重ね描きは輪郭を引いてから塗る)。どれも動かない(位置は変わらない)。段階の数・長さ・最後の中身は同じ
15
+ // 2.0(Egatari spec §6.1 の部品):base の MotionElement・el・prog・variant・previewOpacity を使い、プレイヤーのグローバルは使わない。
16
+ // 属性・データ・要素の大きさ・テーマの色の問題は ctx.report で知らせる(1.x の console.warn("m-map-japan: …") の代わり)
17
+ egatariParts.define({name: "map-japan", version: "2.2.0", requires: {base: "1.2.0"}, element: "m-map-japan"}, function(deps){
18
+ "use strict";
19
+ var base = deps.base;
20
+ // ---- BEGIN map-japan-data (generated by tools/map/build-japan.mjs from Natural Earth 5.1.1, public domain; do not edit by hand) ----
21
+ // Natural Earth ne_10m_admin_1_states_provinces + ne_10m_admin_0_countries_jpn (北方領土 → 01, 竹島 → 32), simplified (Visvalingam 1 km),
22
+ // projected (LCC 30°/42°, 136°E, 1 unit ≈ 1 km) and quantized to integers. arcs: zigzag varints (ALPH), per arc: count, then x, y deltas
23
+ var MAP = {
24
+ proj: {"lon0":136,"lat1":30,"lat2":42,"k":6371},
25
+ alph: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_",
26
+ bounds: {main: [-698,-5375,1715,1765], "true": [-1344,-5375,3191,2883]},
27
+ insets: [{"id":"ryukyu","name":"南西諸島","s":2,"box":[122,23.5,132,30.1],"cb":[-1336,-3597,864,584],"corner":{"s":1,"frame":[-690,-5367,924,644]}},{"id":"ogasawara","name":"小笠原諸島","s":0.5,"box":[135,19.5,155,31],"cb":[9,-3275,1830,775],"corner":{"s":0.25,"frame":[491,-3872,518,254]}}],
28
+ prefs: [["01","北海道",141.347,43.064],["02","青森県",140.74,40.824],["03","岩手県",141.153,39.704],["04","宮城県",140.872,38.269],["05","秋田県",140.102,39.719],["06","山形県",140.364,38.24],["07","福島県",140.468,37.75],["08","茨城県",140.447,36.342],["09","栃木県",139.884,36.566],["10","群馬県",139.061,36.391],["11","埼玉県",139.649,35.857],["12","千葉県",140.123,35.605],["13","東京都",139.692,35.69],["14","神奈川県",139.642,35.448],["15","新潟県",139.023,37.902],["16","富山県",137.211,36.695],["17","石川県",136.626,36.594],["18","福井県",136.222,36.065],["19","山梨県",138.568,35.664],["20","長野県",138.181,36.651],["21","岐阜県",136.722,35.391],["22","静岡県",138.383,34.977],["23","愛知県",136.907,35.18],["24","三重県",136.509,34.73],["25","滋賀県",135.868,35.004],["26","京都府",135.756,35.021],["27","大阪府",135.52,34.686],["28","兵庫県",135.183,34.691],["29","奈良県",135.833,34.685],["30","和歌山県",135.167,34.226],["31","鳥取県",134.238,35.504],["32","島根県",133.051,35.472],["33","岡山県",133.935,34.662],["34","広島県",132.459,34.397],["35","山口県",131.471,34.186],["36","徳島県",134.559,34.066],["37","香川県",134.043,34.34],["38","愛媛県",132.766,33.842],["39","高知県",133.531,33.56],["40","福岡県",130.418,33.607],["41","佐賀県",130.299,33.249],["42","長崎県",129.873,32.745],["43","熊本県",130.742,32.79],["44","大分県",131.612,33.238],["45","宮崎県",131.424,31.911],["46","鹿児島県",130.558,31.56],["47","沖縄県",127.681,26.212]],
29
+ groups: [["hokkaido","北海道地方",["01"],[550,-5085]],["tohoku","東北地方",["02","03","04","05","06","07"],[456,-4634]],["kanto","関東地方",["08","09","10","11","12","13","14"],[338,-4331]],["chubu","中部地方",["15","16","17","18","19","20","21","22","23"],[183,-4269]],["kinki","近畿地方",["24","25","26","27","28","29","30"],[-113,-4140]],["chugoku","中国地方",["31","32","33","34","35"],[-203,-4124]],["shikoku","四国地方",["36","37","38","39"],[-155,-4013]],["kyushu","九州地方",["40","41","42","43","44","45","46","47"],[-454,-3804]]],
30
+ fixed: [["竹島",131.868,37.241,"32"],["魚釣島",123.476,25.745,"47"],["沖ノ鳥島",136.082,20.425,"13"],["南鳥島",153.981,24.287,"13"],["父島",142.2,27.07,"13"],["硫黄島",141.32,24.78,"13"]],
31
+ anchors: {"10":[266,-4306,-1],"11":[296,-4250,-1],"12":[375,-4176,-1],"13":[331,-4213,-1],"14":[292,-4186,-1],"15":[248,-4381,-1],"16":[91,-4310,-1],"17":[50,-4277,-1],"18":[23,-4239,-1],"19":[245,-4204,-1],"20":[183,-4269,-1],"21":[97,-4246,-1],"22":[189,-4139,-1],"23":[115,-4137,-1],"24":[39,-4071,-1],"25":[11,-4144,-1],"26":[-36,-4150,-1],"27":[-44,-4073,-1],"28":[-94,-4130,-1],"29":[-9,-4038,-1],"30":[-59,-4016,-1],"31":[-157,-4175,-1],"32":[-277,-4170,-1],"33":[-203,-4124,-1],"34":[-274,-4101,-1],"35":[-408,-4058,-1],"36":[-155,-4013,-1],"37":[-185,-4048,-1],"38":[-283,-4002,-1],"39":[-247,-3981,-1],"40":[-485,-3996,-1],"41":[-550,-3959,-1],"42":[-533,-3905,-1],"43":[-474,-3901,-1],"44":[-411,-3923,-1],"45":[-435,-3860,-1],"46":[-519,-3803,-1],"47":[-777,-3244,0],"01":[550,-5085,-1],"02":[432,-4769,-1],"03":[456,-4634,-1],"04":[425,-4541,-1],"05":[373,-4696,-1],"06":[355,-4539,-1],"07":[396,-4406,-1],"08":[377,-4265,-1],"09":[338,-4331,-1]},
32
+ feats: [["01",-1,[[[199]],[[200]],[[201]],[[202]],[[203]],[[204]],[[205]],[[206]],[[207]],[[208]],[[209]],[[210]],[[211]]]],["02",-1,[[[-187,188,189]]]],["03",-1,[[[-189,-186,190,191]]]],["04",-1,[[[-191,-185,-182,192,193]]]],["05",-1,[[[-183,184,185,186,187]]]],["06",-1,[[[-32,180,181,182,183]]]],["07",-1,[[[-193,-181,-31,-6,194,195,196]]]],["08",-1,[[[-196,197,-4,-11,-12,198]]]],["09",-1,[[[-5,-198,-195]]]],["10",-1,[[[0,1,2,3,4,5]]]],["11",-1,[[[-3,6,7,8,9,10]]]],["12",-1,[[[11,-10,12,13]]]],["13",-1,[[[-13,-9,17,18,19]],[[20]],[[21]],[[22]],[[23]],[[24]]]],["13",1,[[[14]],[[15]],[[16]]]],["14",-1,[[[-19,25,26,27]]]],["15",-1,[[[28,29,-1,30,31,32]],[[33]]]],["16",-1,[[[34,35,36,-29,37]]]],["17",-1,[[[38,39,-35,40]],[[41]]]],["18",-1,[[[42,43,44,-39,45]]]],["19",-1,[[[46,47,-26,-18,-8]]]],["20",-1,[[[-30,-37,48,49,50,-47,-7,-2]]]],["21",-1,[[[-36,-40,-45,51,52,53,-49]]]],["22",-1,[[[-27,-48,-51,54,55]]]],["23",-1,[[[-55,-50,-54,56,57]],[[58]]]],["24",-1,[[[-57,-53,59,60,61,62,63]]]],["25",-1,[[[-44,64,-60,-52]]]],["26",-1,[[[65,66,67,-61,-65,-43,68]]]],["27",-1,[[[69,70,-67,71,72]],[[73]]]],["28",-1,[[[74,75,76,-72,-66,77]],[[78]]]],["29",-1,[[[-68,-71,79,-62]]]],["30",-1,[[[-63,-80,-70,80]]]],["31",-1,[[[81,82,83,-75,84]]]],["32",-1,[[[85]],[[86]],[[87,88,-82,89]],[[90]],[[91]]]],["33",-1,[[[-76,-84,92,93]]]],["34",-1,[[[-93,-83,-89,94,95]],[[96]],[[97]],[[98]],[[99]]]],["35",-1,[[[-95,-88,100]],[[101]],[[102]]]],["36",-1,[[[103,104,105,106]]]],["37",-1,[[[107,-104,108]],[[109]],[[110]],[[111]]]],["38",-1,[[[112,-105,-108,113]],[[114]],[[115]],[[116]]]],["39",-1,[[[-106,-113,117]],[[118]]]],["40",-1,[[[119,120,121,122,123]]]],["41",-1,[[[124,125,-120,126]]]],["42",-1,[[[-125,127]],[[128]],[[129]],[[130]],[[131]],[[132]],[[133]],[[134]],[[135]],[[136]],[[137]],[[138]]]],["43",-1,[[[139,140,141,-122,142]],[[143]],[[144]],[[145]],[[146]],[[147]]]],["44",-1,[[[-123,-142,148,149]]]],["45",-1,[[[-149,-141,150,151]]]],["46",-1,[[[161]],[[-151,-140,162]],[[163]],[[164]],[[165]],[[166]],[[167]]]],["46",0,[[[152]],[[153]],[[154]],[[155]],[[156]],[[157]],[[158]],[[159]],[[160]]]],["47",0,[[[168]],[[169]],[[170]],[[171]],[[172]],[[173]],[[174]],[[175]],[[176]],[[177]],[[178]],[[179]]]]],
33
+ arcs: "a1uH_l873377730383492140E740834B418747274q1wEjk8B6B2540434743C5O4688E1616062240G5A2I143224662I24EAi1aFbf8454761C7I7C523276D4560A462E4C062C8838082C64mKpg83Bk1iK_g81397F19277BD036B4D6B2533909509290969015505456oItl8P5016aFbf8042C8cFre8G8C4A0UiGfe863654086c18MC80E546C185A0A3K4CsLXe80F19359L7B8-KZg8535515c1eRXe8503097775591B5F0H43432N291TB53BFBD906sLXe84G3Gc4sLXd864853561A2EC2E309G74B82A1271360474C406440656184608261A62065054700440A40444E1670749C940430365I245C0054360232N5H6NAFKJA9A124E740664733GeY1by550521626676103Guc1lf6351077316E6663Goc1pi634466221073332CiGfe8446C4688EAY1mHXd860A686A4E242AC411725036540MA86G4CgLdc825374D6643M-Lvr7333404682484406933D5IWKZy72460434733505408AqIj-71C622D50IiJZX8910G04C6610B3731CwKzw75112266005GmHXd804081C38PG3814KgGbb8C142064E5A2A6C42C4i2mHhZ84784390B65A581O5A0446144EG32460880403747800523117113512F35216207734180C921A-8_l84662466Uy1o9pk8834189250763G4442E64A780C362412B63674583A1A0424I4886480C28u1uH_l8232H190B5B3235056B2D3D43A1A3A02543808162231B172589CH8De1gKbs8B733154J09252P45C061654915977053572HR9c2cJZx8185C3A181k138HKFCD89012LIBA58187S18569A5A5I56JCHKDC7252B17A94HCD6LAB4c2iDrt832276H4D2D13725E329C56167A1A0A26C3467E0A14920682I7KD2327AF0309507250Y1u5vl890545032583E3G582C3A4I3A1G4A1C26i1g4dh8802741C2420822C94567A94182A540286360A4C2E6Gs8xh8CB276B05892F1Ng1-8_l8J4D81624183A5434509070505371537537890323Oe1bh8CA2C66826280E064AA64A3CW4tf86509AF2579W4u5vl8230B0B13301A7055107207202511256BE843610589A3A2650710132B6160611527117172N87830JC503152F8584A5C123GA41C6E463C4418BW17Eb1q1DE743698Gu5bn81052319646I307Gz2Xc8562A08CE22S8A1Y1j1pa8A78140654H218463E32760253D0381G6e1k1tc8692B63C2A04465I3E2E36903373371150F4913e3e1bh8365270267E7C7I5616680CEC6C1C3C3235433DB82626142298335275148A942434133035322A42343092112B34367271055205c1cFre8787257B1923137B3347I5231125E4A5A2C24y1gCtc844284C0A16281A2E42C1444E26A68043251B07270B254186826640O3C3-1s8xh886481A9C283E0468069I9E92547E246244A44C8A0A4CAA24184A12522A3CIu8da8184824816161C2A0W1cAtZ86165C7C545A36325350567132F6527Ok1tc86A284660484A2E1G3C0846Ce2rZ8M54226C8A4k1w3dZ80L8B69436283A181C82488A46660C560E644428365A3ScAtZ81E3CBE143C581876B6321A1A2Cm4i8XW8E180G2K6I5E0E2QA820351032FEBAD354943QD275205634963A1A380C26624AA1252D13A2628023628184C56286614AA20C58764210727014720692763412717135115295103498w3dZ86A4846a3e4lY862A1214B200A9K0E0464283C26G8420951352B2769223A06408A4241E1424561E4461A3136HC74303534163AE380a1BG5808m4jX8284155Ue2rZ82448241G5O5A96B4B091302856D840rW86CW26fW8424A54260A44648046422216769436128I14481C0E3I261290541858B81852ARdw70428GI84g41bv7EZ18960456069314344402955133067214661053105858560A56249622344C5478138A041C02830712662A3251921354342070373379173D777B15327554JEH6D1747C940Uj1pa844AC0C2C083Q8G0A446066644408y1h6xc80K8C84C3420K165695121E04626266A461822668448066808626367448Op3dY8C26248A643434686CI0616Gr1pW866I820C540E643g2z2Xc801331356725446424108733831491332B561379A03AD2587397732D272049672320454B3Kd5jz74440C0M341M5E0E780I_1zz7432D395703494H6HEp3dY82848840O2E58Of3bW8182A0C5812069CBC78J634An4h-744631374Ob9lc864484O4828482A16763271QX9zZ81A2A569G781E0E0C644A0614-1p9hW8822541444189846140O184A862EA4244C2446161I3623961066005A08663Ih6xc85051R09273D8F612s1r5p_7327C943AB8DQ5058266A6204C165E5A15915310529AD43496557k1_1zz72A0A8C04705616565A16444846243E266285A4836268W3d5jz736628828404804B0025C408618D61KA06448446404606440EC22B214A82406AA82SAM21882172363A3638931474127UjFbc8726G844224341C0C36F6340A383C8dG_Y862C062y1lFxY863C343054380A327876D41O686464045A345A04206E2886G22E38061C7Y1b9lc8B2367492P233H6V0R592D65810B1B717EXGbg852140E892513QfGfg851DC34644115402661076113g1nOnW80C4A7G280424E4023606484280A1A449631305C9W2lM_-71745654529671723A58764E36263G2E5G3237501A9A3CD6961C4A364408060Y3jFbc823810372325192773450369016H0B4329226907016840A163832F40452HC3C9616965034FCBA1830587698521AD672B0ArGnf826837312MrEfh87933F8161CCCC2A92B33OlFxY88C0S266C0E2A480A6C2A08c2nEv-7A3421478I763I964864A601380E2236B41850333725835A5C066C3610783453361A2ElM_-7260GAQ24A682c3lLZz719GHE74164A166341868462683246085A14115618526C5K1616315A0647430361846638342210711874B4612840660EF2940MtJby765530D5034269842A044EpIXz7503264620511GnHnz734942680214B10CzKxz7525844A715u6nOnW83471101A5018567432067806F214529033437114243451075031723013315424E4F432501C3444482A3654344A6416243C34644565A747C44886142683A6A56769200814C0694484226115C083A1A644762641434166A648G48626343014246383253B278167051909850BCnLhw77104646035e1pLxw7A2256426602921806770543074577390164E41c1z8xy73A3251P0707414549252525153D2567098768jDlx72G043Aa1lDnw7I8C0C88265C0224C0GE24424166C8220A4i2v9bu7230560891363A3E921412560236021C5159005414319533912311723094507193354B134506vDrx7A224y1z8xy733355255B5259738501D3134365190739238H8DC52F51286462E1A3656W1f9d_7H25452311CA14606208944444B2517AXDd-734264315AZBt-764453356e2lJbq765030939035D0340864147832B63E7059D1923O2838925056B8B8B47A087C182G1I5G1u4vDrx7785450B39071B214L653593DFJ362416B214DA083406723K0C38DCH8BA58LC54B2723472BA04E3404363OBE046061414687484C108882452183233362662163A424C34263248422782A441KbHXz780473B327842560663AdJvx79A24612BEpGvy753521E40A901a4lJbq7C202787E0A65A188A485C184286240199B0B802719272763862767696540058527170723A52263A1831345O921C1C164G4C24846C4266C6406606C212D4D6J6943A_J_o732044103c1hY1ru7M2A18064GA4442C5602A08945C5076383408CtW1hs74006A8060GMfW1dr7A1430345A7C08782C884Y1zTvr74D3J4909056549CBA1C0A2408B132543m3pRhv7L5BP05077101652511671752341456513553B134915834F178111654042208363078729324A685243A527136990752720494366266H638QtZ1xt79A06AI64C4263824CC66C8K4IpX1Xr745337D3BGB658AA2k1hY1ru732507745333352501408443439301646A804561E1315u6tZ1xt703B3723107563255121C28323A2480444006661642612C62434404C3AC043806AG04J7145277492723579145331373361806360C64064A4226810446480260163152487C942483A5438523AB806383418280264204BA300A6626A341456083431347093F53B0967077G745y1jf1rp7772703510756529419303424162418503AA621E0684105334566618015o1Xe1vr72D30521A2432117402A4261A084229420B6540652313B411g1bb1lu7505A921A56045866523314626163A72787034509UtZ1zw7415329B3305A0612288A67804531c1bc1p-71533147227521I121C1608404460656J411BW2db1xW8600725337278903C0626345C160C5224A3066308502480875B430745858H53Gdf1rq755521A64424505Eze1Xr7127246422307Gle1br70353163006C609Erd1zt7741246404317AZb1Zv731548425GZX1pl76884I3E542AA86y1_U_k7I241A3A0618784402539138B055B5917054967604305458547656B63A1Y1bRxp7B9151H3F573933B930940A483A70D951Y2fW1dr72E428AEC485824467054D606U3605ADA04447622261632780A5316043436DE16IdY1zl753142E46406D1351Y1pW1_n75013B4543452146A81E008658J631172m1XY1fo731J6185C1838484696641A42C5656149614307030J1735CrX1pm73416614333GhW1no715323444168009UbRxp764C08166088483K08B6084222E60W4XOZp74980C523718733A5A371327110970745A023B1B18B5034534785036B30B49193147374B1531F2340448003810741848F1725175D357053B076149A92F13591a1_U_k736GO6AA6041A2624E6682A28C6C26A3C5As2rSng76460462842E1434D21076D85076N47513905In18N4729674BA55703824143333015696047038763420523Czb1l-60C43230350Gva1z_671120644C23515Aja1nW737362461Odj1pl69454B1301A2462C3678503Udh1zn6151D13B43E4E1842286063890555Y1bf1_p653571550146A06226244434461133330Epa1jr696DAA2606927y2nc1bs61930045A5147D6543853963114D0983074666036B15034A462800AA844276043A5774147648741696123K32333Czk1xi65556644225Sna1fj7383452583632246463456B631B-6ZX1pl738965772364406560448280A3624521828EA6A6A1A263E5A9816575192A86A144G6080U286222A22E1616F017115533D3B07296B2587296781A66064081A7A30312513D132542464C2243A2686484C1G1658243GB6341E40A78143G3A361456903A0GB70134105D5112745636380a1xVZZ77553537353520478902C8OA4I143A74927W2lTdc734381ABE080A3C9C5208281824424561831323150347476027430B470F417DInY1zZ75133506888406375EXa1pc7115422424113KrZ1tj730145530146AA02307a1Xk2fz5773C185231303622E4K840A9670531F530CZp2n-5B006A24313g1pg2d-5527C545A5050775A62485446628063492749EH01OrZ2x-550573950183I84G0E00397EzTnZ6305604826733Kpv1ze63553525204C6464523o4vl1bh613DH065E7256169408B670332553F11208082282460456D6725A3090120A2E5A303A3451062G08A04067426369901347CH20C4405735073563E22381A945C261156541806143GN25CZp1Xh67036624027Cvn1jj6BE226345058rTZa6482551Gva2j_571143026A24315Abs1pd631182449W1gKbs8G46180806842C286C5624165051F0Lq1eNft82H41A1658D2B072B4527674F371507390780232509055D5515SkOrz891533BD790D1537195553092D1IwKZ_81I7K5S3838FE387OCkOrz862C3878541e2qPd-82B27035515256733395357173B296B4F874917396D5513254160233B190L2509154785q1YQbd90B4F0933231353915236B8D491343077711350D8T091307672Y2wKde902EE1Q1A041ABQ5656309373022G446AE165618486462C48060i17e136523E1M14QYQbd9C641A9QHA3A2C561C24147EBm7-Txe9995313325133377F1B3J3P1L0J172L2B4B2119BA9650D5FF739131B91624385C3I141G0A120A64A7816065408265A5114762666C2638180G065I56525115F3055593380626187A7273593N37192H155371321632915951340A1A127014A2460842442651353Y11E58519A505330765E321630584660482Qe1qPd-8A2G6C642K0423868C6C765E6870B470B2580G4a4gUn-8278862072017C123A39523A4259781098503701543832305565087338581074333367405838B035505337811470D497J075925195199370365139503455D535FBDe1eNft8A4E1826862A1E44226062484424380430F43A0s3-Qzs83F09096P8H674103502765604A400985E340C68018622840642711193125501761134542073732558529703385436003770385251B8146213B17W1oItl88565C5UHC560CBA382O6GA48642C04OkNZm884MK84608B65194166G6G4c1mQrl82943A56165272J290J094F075x1372715399Jm1kNZm82Q0A4A7A2C2I085A1A367194745032781492343A747470UeRXe8537BRh1BV3P2367091B2F278H8V8HAmd1hZA5150C401yMin1x-9301270321652DI460475D09115912742A8617555375H39113935DD7D17234D13276FCJ2D238D29075B32147C5E545A98DKHO5472R0L171953731390531321E3632512B8593H0B8L2739B21C1Z19ND5535937751F9BB957953VV9D3135DNr1x155D7557B335750560876J6153316082A3608580A28Ok16G6Q4S0A3c1BQ186m10I3A185678545298383A6E046A582AAE460A1A7G9CBA94F570132750B6F43133B5BBLD321654705G2A66CA8A28683854DG5C360A725733345C525A74D07438184I0A3E5C1A4EA8628CG864AG46082608120C14501A7E1E18086E4CA681C44B65K763071H27C343A54F4380485662838082E88061A9638115BB31B1739DD77B159572929411DB53F953192B27298F6765C3C2E384SU4A66621250264083AFC98385QLK9E3E0E2C6828AE8I2AAAAUIG4a1IY1AQG864886432943232H293H0929EVIX1ADMNEJOJMDM5604622E44041C1O26155154567620664A2C1455782832361530543E1A9G1814260474D8981438125600371MeItq954B4386O2265232F8D31A-k1XWA31D1MA35SgQnfA9BB3325624164444A640634901MwOjhA523512480C4A46450N33AoHtl950086303Igp1ZWA5076CAA313451170c1qs1tYA533670DA94261AA46045A347404183293051-3aq1lcAF4309551775052365G360A340834525A08983A08385638DE3476385824282AC3640A242F1N23ABA163472BC7176BED434987A141808367498384454F10D6w6w-1rkA138703975050F80676347A18327E56b1A30731B573D9E164A084804F6587I76327554060A3C7658DA342636B75416646064087G54955246483853371428245638164640824D8DA762A58J658BEBA9498D310745634246444361E06941AH8BCFA7A3E343CB41A1E04085450377Cco1f_91334046003Aaq1zWA31348203"
34
+ };
35
+ // ---- END map-japan-data ----
36
+ // ---- 地図のデータを読む(作るときに投影を済ませた整数の座標。1 単位 ≈ 1 km、y は下向き)
37
+ var ALPH = MAP.alph;
38
+ function decode(s){
39
+ var out = [], v = 0, sh = 1;
40
+ for (var i = 0; i < s.length; i++){
41
+ var d = ALPH.indexOf(s[i]);
42
+ if (d >= 32){ v += (d - 32) * sh; sh *= 32; }
43
+ else { v += d * sh; out.push(v % 2 ? -(v + 1) / 2 : v / 2); v = 0; sh = 1; }
44
+ }
45
+ return out;
46
+ }
47
+ var ARCS = (function(){
48
+ var n = decode(MAP.arcs), arcs = [], i = 0;
49
+ while (i < n.length){
50
+ var c = n[i++], a = [], x = 0, y = 0;
51
+ for (var j = 0; j < c; j++){ x += n[i++]; y += n[i++]; a.push([x, y]); }
52
+ arcs.push(a);
53
+ }
54
+ return arcs;
55
+ })();
56
+ function ring(idx){
57
+ var r = [];
58
+ idx.forEach(function(i){
59
+ var a = i < 0 ? ARCS[~i].slice().reverse() : ARCS[i];
60
+ for (var j = r.length ? 1 : 0; j < a.length; j++) r.push(a[j]);
61
+ });
62
+ return r;
63
+ }
64
+ // feats:[{code, inset, polys: [[外の環, 穴…]…]}](座標は本当の位置。inset ≥ 0 の部分は枠の中へ動かして描く)
65
+ var FEATS = MAP.feats.map(function(f){ return {code: f[0], inset: f[1], polys: f[2].map(function(p){ return p.map(ring); })}; });
66
+ var NAME = {}, CAPITAL = {}, CODE_BY = {};
67
+ MAP.prefs.forEach(function(p){
68
+ NAME[p[0]] = p[1]; CAPITAL[p[0]] = [p[2], p[3]];
69
+ CODE_BY[p[0]] = CODE_BY["JP-" + p[0]] = CODE_BY[p[1]] = CODE_BY[+p[0]] = p[0];
70
+ if (p[1] !== "北海道") CODE_BY[p[1].replace(/[都府県]$/, "")] = p[0];
71
+ });
72
+ var GROUP = {};
73
+ MAP.groups.forEach(function(g){ GROUP[g[0]] = GROUP[g[1]] = GROUP[g[1].replace(/地方$/, "")] = {id: g[0], name: g[1], codes: g[2], anchor: g[3]}; });
74
+ // 正角円錐図法(標準緯線 30°・42°、中央経線 136°E、球)。作るときの d3-geo の geoConicConformal と同じ式(作る手順が確かめる)
75
+ var LCC = (function(P){
76
+ var r = Math.PI / 180, y0 = P.lat1 * r, y1 = P.lat2 * r, f = function(y){ return Math.tan((Math.PI / 2 + y) / 2); };
77
+ var n = Math.log(Math.cos(y0) / Math.cos(y1)) / Math.log(f(y1) / f(y0)), F = Math.cos(y0) * Math.pow(f(y0), n) / n;
78
+ return function(lon, lat){ var q = F / Math.pow(f(lat * r), n), a = n * (lon - P.lon0) * r; return [P.k * q * Math.sin(a), -P.k * (F - q * Math.cos(a))]; };
79
+ })(MAP.proj);
80
+ var TONES = /^(term|emph|muted|accent2|fg|series-[1-4])$/;
81
+ // 字の幅の見積もり(字の読み込みを待たない。base の textWidth:font の要素の字で測った幅)
82
+ // 組み込みの島の名前の英語(英語の教材で地図に書く。外務省・国土地理院の英語の表記)
83
+ // 都道府県と八地方区分の英語の名前(英語の教材で地図・凡例・読める層に書く。国土交通省・国土地理院のローマ字表記。データのキーは変えない)
84
+ var PREF_EN = ["", "Hokkaido", "Aomori", "Iwate", "Miyagi", "Akita", "Yamagata", "Fukushima", "Ibaraki", "Tochigi", "Gunma", "Saitama", "Chiba", "Tokyo", "Kanagawa",
85
+ "Niigata", "Toyama", "Ishikawa", "Fukui", "Yamanashi", "Nagano", "Gifu", "Shizuoka", "Aichi", "Mie", "Shiga", "Kyoto", "Osaka", "Hyogo", "Nara", "Wakayama",
86
+ "Tottori", "Shimane", "Okayama", "Hiroshima", "Yamaguchi", "Tokushima", "Kagawa", "Ehime", "Kochi", "Fukuoka", "Saga", "Nagasaki", "Kumamoto", "Oita",
87
+ "Miyazaki", "Kagoshima", "Okinawa"];
88
+ var GROUP_EN = {hokkaido: "Hokkaido", tohoku: "Tohoku", kanto: "Kanto", chubu: "Chubu", kinki: "Kinki", chugoku: "Chugoku", shikoku: "Shikoku", kyushu: "Kyushu"};
89
+ var ISLAND_EN = {"竹島": "Takeshima", "尖閣諸島": "Senkaku Islands", "沖ノ鳥島": "Okinotorishima", "南鳥島": "Minamitorishima", "父島": "Chichijima", "硫黄島": "Iwo To"};
90
+ function est(s, size, font){ return base.textWidth(s, size, {font: font}); }
91
+ function inRing(x, y, r){
92
+ var c = false;
93
+ for (var i = 0, j = r.length - 1; i < r.length; j = i++){
94
+ var a = r[i], b = r[j];
95
+ if ((a[1] > y) !== (b[1] > y) && x < (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1]) + a[0]) c = !c;
96
+ }
97
+ return c;
98
+ }
99
+ // 色を sRGB で読む(テーマの変数の値をキャンバスに 1 点塗って読む。読めなければ null)
100
+ function rgbOf(css){
101
+ try {
102
+ var cv = document.createElement("canvas"); cv.width = cv.height = 1;
103
+ var g = cv.getContext("2d", {willReadFrequently: true});
104
+ if (!g) return null;
105
+ g.fillStyle = "#010203"; g.fillStyle = css;
106
+ if (/^#010203$/i.test(g.fillStyle) && !/^#010203$/i.test(css)) return null;
107
+ g.fillRect(0, 0, 1, 1);
108
+ var d = g.getImageData(0, 0, 1, 1).data;
109
+ return [d[0], d[1], d[2]];
110
+ } catch (e) { return null; }
111
+ }
112
+ function lin(c){ c /= 255; return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); }
113
+ function lum(c){ return 0.2126 * lin(c[0]) + 0.7152 * lin(c[1]) + 0.0722 * lin(c[2]); }
114
+ function oklab(c){
115
+ var r = lin(c[0]), g = lin(c[1]), b = lin(c[2]);
116
+ var l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b), m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b), s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
117
+ return [0.2104542553 * l + 0.7936177850 * m - 0.0040720468 * s, 1.9779984951 * l - 2.4285922050 * m + 0.4505937099 * s, 0.0259040371 * l + 0.7827717662 * m - 0.8086757660 * s];
118
+ }
119
+ function fromOklab(o){
120
+ var l = Math.pow(o[0] + 0.3963377774 * o[1] + 0.2158037573 * o[2], 3), m = Math.pow(o[0] - 0.1055613458 * o[1] - 0.0638541728 * o[2], 3), s = Math.pow(o[0] - 0.0894841775 * o[1] - 1.2914855480 * o[2], 3);
121
+ var f = function(x){ x = Math.max(0, Math.min(1, x)); return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); };
122
+ return [f(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s), f(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s), f(-0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s)];
123
+ }
124
+ function contrast(a, b){ var x = lum(a), y = lum(b); return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05); }
125
+
126
+ return class extends base.MotionElement {
127
+ static partName = "map-japan"; // the registry name (define meta name), for report prefixes
128
+ // 組み込みの名前・見出し・目盛りの字(英語の名前を含む)。組み立てが字を絞り込むとき、教材の文にない字も残すように(形式 §6.2)
129
+ static glyphs = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()-.,×–−、。〜あいかがきくけさしすただつてでとなにのはばべまもりるれろをェオクジトノブ・三上下中丹九井京人以位佐例値児入八兵凡出分前動北区千南単原取口可号名和四図国土地城域埼塗大奈媛定宮富小尖尺山岐岡岩島崎川州広府度庫当形後徳愛手択捉描数新方既日書木未本東枠栃根桁梨森歌歯沖海満滋潟熊父玉田番異畿目県知石硫神福秋秒竹笠級経緯縄縮置群舞良色茨葉西見諸賀足近道部都重野釣長関閣阜阪限階青静項領香馬高魚鳥鹿黄():;";
130
+ static variants = ["fade", "sweep", "draw"];
131
+ // データの形(kit/shape.js)
132
+ static shape = {
133
+ schema: {type: "object", additionalProperties: false, properties: {
134
+ regions: {type: "array", items: {type: "object", additionalProperties: false, anyOf: [{required: ["id"]}, {required: ["group"]}], properties: {
135
+ id: {type: ["string", "integer"]}, group: {type: "string"}, label: {type: "string"}, tone: {type: "string"}, step: {type: "integer"}, at: {type: "number"}}}},
136
+ values: {type: "object"},
137
+ classes: {type: "array", minItems: 1, items: {type: "number"}},
138
+ valuesStep: {type: "integer"},
139
+ points: {type: "array", items: {type: "object", additionalProperties: false, anyOf: [{required: ["lon", "lat"]}, {required: ["code"]}], properties: {
140
+ lon: {type: "number"}, lat: {type: "number"}, code: {type: ["string", "integer"]}, label: {type: "string"}, tone: {type: "string"},
141
+ anchor: {enum: ["right", "left", "above", "below", "top", "bottom"]}, step: {type: "integer"}, at: {type: "number"}}}},
142
+ flows: {type: "array", items: {type: "object", additionalProperties: false, required: ["from", "to"], properties: {
143
+ from: {type: ["string", "integer", "array"]}, to: {type: ["string", "integer", "array"]}, label: {type: "string"}, tone: {type: "string"},
144
+ value: {type: "number"}, bend: {type: "number"}, via: {type: "array", items: {type: "array"}}, labelAt: {type: "array"}, step: {type: "integer"}, at: {type: "number"}}}},
145
+ shapes: {type: "array", items: {type: "object", additionalProperties: false, anyOf: [{required: ["polygon"]}, {required: ["line"]}], properties: {
146
+ polygon: {type: "array", minItems: 3, items: {type: "array"}}, line: {type: "array", minItems: 2, items: {type: "array"}},
147
+ label: {type: "string"}, labelAt: {type: "array"}, tone: {type: "string"}, dash: {type: "boolean"}, step: {type: "integer"}, at: {type: "number"}}}}}},
148
+ example: {regions: [{id: "13", tone: "emph", step: 1}, {group: "kinki", tone: "series-2", step: 2}],
149
+ points: [{lon: 135.50, lat: 34.69, label: "大阪", step: 3}], flows: [{from: "13", to: "27", step: 4}]},
150
+ note: {en: "prefectures by JIS code \"01\"–\"47\" (or \"JP-13\", \"東京都\") in regions[].id; the 8 regions (hokkaido, tohoku, kanto, chubu, kinki, chugoku, shikoku, kyushu) in regions[].group; values is an object {code: number}; classes are the lower bounds of the classes (default 4, at most 5); points, shapes and flows[].via use lon/lat in degrees",
151
+ ja: "都道府県は regions[].id に JIS の番号 \"01\"〜\"47\"(\"JP-13\"・\"東京都\" も可)、八地方区分は regions[].group(hokkaido・tohoku・kanto・chubu・kinki・chugoku・shikoku・kyushu)。values は {番号: 数} のオブジェクト、classes は階級の下限(既定は 4 階級、5 つまで)。points・shapes・flows[].via は経度・緯度(度)"},
152
+ };
153
+ static props = {
154
+ layout: {type: "string", default: "inset", doc: "inset(南西諸島を枠に入れて描く)か true(本当の位置。日本が小さくなる)"},
155
+ islands: {type: "string", default: "main", doc: "main か all(inset で小笠原諸島の枠も描く)"},
156
+ "territory-islands": {type: "string", default: "auto", doc: "島の名前:auto(必要なときだけ)・show・hide"},
157
+ labels: {type: "string", default: "focus", doc: "地域の名前:focus(regions に書いた地域だけ)・all(名前が中に入る都道府県すべて)・none"},
158
+ show: {type: "string", default: "none", doc: "塗り分けた地域の上に値を書くか:none(書かない、既定)・value(中に入る地域だけ値を書く)"},
159
+ unit: {type: "string", default: "", doc: "値の単位(凡例の見出しに書く)"},
160
+ digits: {type: "number", default: 0, doc: "値の小数桁"},
161
+ legend: {type: "string", default: "", doc: "凡例の見出し(例:人口)。unit があれば後ろに(単位)を足す"},
162
+ dur: {type: "number", default: 1.0, doc: "1 つの項目の動きの秒数"},
163
+ };
164
+ get steps(){
165
+ if (this.getAttribute("steps") !== null) return +this.getAttribute("steps");
166
+ return Math.max(1, this.plan().last);
167
+ }
168
+ // 項目と段階:{items: [{kind, o, step, at}], first, last}
169
+ plan(){
170
+ if (this._plan) return this._plan;
171
+ var d = this.data || {}, items = [];
172
+ var st = function(o){ return o && o.step !== undefined ? Math.max(1, o.step) : 1; };
173
+ (d.regions || []).forEach(function(o, i){ items.push({kind: "region", o: o, i: i, step: st(o), at: +o.at || 0}); });
174
+ if (d.values && Object.keys(d.values).length) items.push({kind: "values", o: d.values, step: d.valuesStep !== undefined ? Math.max(1, d.valuesStep) : 1, at: 0});
175
+ (d.shapes || []).forEach(function(o, i){ items.push({kind: "shape", o: o, i: i, step: st(o), at: +o.at || 0}); });
176
+ (d.flows || []).forEach(function(o, i){ items.push({kind: "flow", o: o, i: i, step: st(o), at: +o.at || 0}); });
177
+ (d.points || []).forEach(function(o, i){ items.push({kind: "point", o: o, i: i, step: st(o), at: +o.at || 0}); });
178
+ var last = items.length ? Math.max.apply(null, items.map(function(x){ return x.step; })) : 1;
179
+ return (this._plan = {items: items, last: last});
180
+ }
181
+ code(v, what){
182
+ var c = CODE_BY[String(v).trim()];
183
+ if (!c) throw new Error(what + ": " + JSON.stringify(v) + " is not a prefecture (write the JIS code \"01\"–\"47\", \"JP-13\" or the name)");
184
+ return c;
185
+ }
186
+ mount(ctx){ this.draw(ctx, false); }
187
+ // retry:小笠原諸島の枠の島の名前が入らなかったので、枠なしで描き直す(draw を 1 度だけ呼び直す。初めの知らせは繰り返さない)
188
+ draw(ctx, retry){
189
+ var P = this.props, D = base, self = this, d = this.data || {}, pl = this.plan();
190
+ // 英語の教材(ctx.lang が ja でない)では、組み込みの島の名前を英語で書く(漢字の字の幅が日本語の字と違い、札からはみ出すため)
191
+ var en = !!ctx.lang && !/^ja\b/i.test(ctx.lang);
192
+ // 名前を引く:都道府県(full:「東京都」、短く:「東京」)と八地方区分。英語の教材では英語の名前
193
+ var nm = function(cd){ return en ? PREF_EN[+cd] || NAME[cd] : NAME[cd]; };
194
+ var nmShort = function(cd){ return en ? PREF_EN[+cd] || NAME[cd] : NAME[cd].replace(/[都府県]$/, ""); };
195
+ var gname = function(g){ return en ? GROUP_EN[g.id] || g.name : g.name; };
196
+ this.variant = base.variant(this);
197
+ this.style.display = "block"; this.style.position = "relative";
198
+ var W = this.clientWidth, H = this.clientHeight, lay = P.layout === "true" ? "true" : "inset";
199
+ if (P.layout !== "inset" && P.layout !== "true" && !retry) ctx.report("attr", '[map-japan] layout="' + P.layout + '" is not inset or true (inset is used)');
200
+ if (P.islands !== "main" && P.islands !== "all" && !retry) ctx.report("attr", '[map-japan] islands="' + P.islands + '" is not main or all (main is used)');
201
+ if (["auto", "show", "hide"].indexOf(P["territory-islands"]) < 0 && !retry) ctx.report("attr", '[map-japan] territory-islands="' + P["territory-islands"] + '" is not auto, show or hide (auto is used)');
202
+ // 小笠原諸島の枠(沖ノ鳥島・南鳥島・父島・硫黄島・鳥島)は islands="all" のときだけ。南西諸島の枠(沖縄県・尖閣諸島)はいつも
203
+ var ogas = lay === "inset" && P.islands === "all" && !retry;
204
+ var svg = D.el("svg", {viewBox: "0 0 " + W + " " + H, width: W, height: H, style: "display:block;overflow:visible"}, this);
205
+ var tone = function(t, def){ return "var(--" + (TONES.test(t || "") ? t : def) + ")"; };
206
+ // 都道府県の名前を引く(values・regions)。知らない名前は知らせて(1 回だけ)飛ばす:地図ぜんぶを札にしない
207
+ var bad = {};
208
+ var codeOr = function(v, what){
209
+ var c = CODE_BY[String(v).trim()];
210
+ if (!c && !bad[String(v)]){ bad[String(v)] = 1; if (!retry) ctx.report("data", "[map-japan] " + what + ": " + JSON.stringify(v) + " is not a prefecture (write the JIS code \"01\"–\"47\", \"JP-13\" or the name); it is skipped"); }
211
+ return c || null;
212
+ };
213
+ // ---- 塗り分けの階級(classes は階級の下限。書かなければ 4 階級を値の 4 分位から。v < classes[0] は描かずに知らせる)
214
+ var classes = (d.classes || []).slice(), values = d.values || {}, vcodes = [];
215
+ var vals = Object.keys(values).map(function(k){ return +values[k]; }).filter(isFinite).sort(function(a, b){ return a - b; });
216
+ // 有効数字 2 桁に切り下げた下限
217
+ var nice = function(x){ if (!x) return 0; var e = Math.pow(10, Math.floor(Math.log10(Math.abs(x))) - 1); return Math.floor(x / e) * e; };
218
+ var quartiles = function(){ var out = []; for (var q = 0; q < 4; q++){ var b0 = nice(vals[Math.floor(q * vals.length / 4)]); if (!out.length || b0 > out[out.length - 1]) out.push(b0); } return out; };
219
+ if (vals.length && !classes.length) classes = quartiles();
220
+ for (var c = 1; c < classes.length; c++) if (!(classes[c] > classes[c - 1])){
221
+ // 増えていない階級:知らせて、classes を書かなかったときの 4 分位に
222
+ if (!retry) ctx.report("data", "[map-japan] classes must increase (" + JSON.stringify(d.classes) + "); 4 classes from the values' quartiles are used");
223
+ classes = vals.length ? quartiles() : [];
224
+ break;
225
+ }
226
+ if (classes.length > 5 && !retry) ctx.report("data", "[map-japan] " + classes.length + " classes are hard to tell apart (5 at most is recommended)");
227
+ Object.keys(values).forEach(function(k){
228
+ var code = codeOr(k, "values"), v = +values[k];
229
+ if (!code) return;
230
+ if (!isFinite(v)){ if (!retry) ctx.report("data", "[map-japan] values[" + JSON.stringify(k) + "] is not a number; it is skipped"); return; }
231
+ var ci = -1;
232
+ classes.forEach(function(b, j){ if (v >= b) ci = j; });
233
+ if (ci < 0 && !retry) ctx.report("data", "[map-japan] values[" + k + "] = " + v + " is below the first class (" + classes[0] + ") and is not drawn");
234
+ else vcodes.push({code: code, v: v, ci: ci});
235
+ });
236
+ vcodes.sort(function(a, b){ return a.code < b.code ? -1 : 1; });
237
+ // 色の段階(spec §8.4 --ramp-1…5):階級 i は段階の t = i/(n−1)。どの段も上の色(2.0 の色)に戻るので、段階のないテーマでは同じ色。
238
+ // 段階があるテーマでは階級の間の明るさはテーマが決めるので、明るさの差の知らせは出さない
239
+ var hasRamp = !!base.rampStops(this), classFill = this.classColors(classes.length, retry || hasRamp, ctx);
240
+ if (classFill.length > 1) classFill = classFill.map(function(c, i, a){ return base.ramp(i / (a.length - 1), c); });
241
+ // ---- 凡例の大きさ
242
+ var LS = 24, legendW = 0, legendH = 0, legendRows = [], title = "";
243
+ if (vcodes.length){
244
+ title = (P.legend || "") + (P.unit ? (en ? " (" + P.unit + ")" : "(" + P.unit + ")") : "");
245
+ legendRows = classes.map(function(b, j){
246
+ return j < classes.length - 1 ? (en ? self.fmt(b) + " to under " + self.fmt(classes[j + 1]) : self.fmt(b) + "〜" + self.fmt(classes[j + 1]) + " 未満") : self.fmt(b) + (en ? " and over" : " 以上");
247
+ });
248
+ legendW = Math.max(title ? est(title, LS, self) : 0, 40 + Math.max.apply(null, legendRows.map(function(t){ return est(t, LS, self); })));
249
+ legendH = (legendRows.length + (title ? 1 : 0)) * 36;
250
+ }
251
+ this.legendTitle = title;
252
+ // ---- 縮尺と位置。layout="inset" では、地図の高さいっぱいの本図の左に南西諸島、右に凡例と小笠原の枠を並べる(beside)。
253
+ // 要素が小さくてそれでは本図が小さくなるときは、本図の空いた隅(左上・右下の海)に枠を置く(corner)
254
+ var GAP = 20, PADI = 10, PADR = 6, CAPL = en ? 33 : 30; // 英語の字(Source Sans 3)は字の箱が高い
255
+ var capW = function(c){ return Math.max.apply(null, c.map(function(t){ return est(t, 24, self); }).concat([0])); };
256
+ var INSET_EN = {"南西諸島": "Nansei Islands", "小笠原諸島": "Ogasawara Islands"};
257
+ var capsOf = function(s, k){ var nm = en ? INSET_EN[s.name] || s.name : s.name; return Math.abs(k - 1) < 0.05 ? [nm] : [nm, en ? "(different scale)" : "(縮尺は本図と異なる)"]; };
258
+ // 並べ方(凡例の幅 legendW・高さ legendH を受け取る。0 なら凡例なし)。小さい要素でも縮尺は 0 未満にしない
259
+ var layout = function(legendW, legendH){
260
+ var M = MAP.bounds.main, frames = [], legendXY = null, sc, ox, oy, mode = lay;
261
+ if (lay === "true"){
262
+ var BT = MAP.bounds["true"], lw0 = legendW ? legendW + GAP : 0;
263
+ sc = Math.max(0, Math.min((W - lw0) / BT[2], H / BT[3])); ox = (W - BT[2] * sc - lw0) / 2; oy = (H - BT[3] * sc) / 2;
264
+ M = BT;
265
+ if (legendW) legendXY = [ox + BT[2] * sc + GAP, oy + BT[3] * sc - legendH];
266
+ } else {
267
+ var I = ogas ? MAP.insets : MAP.insets.slice(0, 1), R = I[0], O = I[1];
268
+ var beside = function(s, caps){
269
+ // 南西諸島:枠は島の範囲にぴったり(余白 PADR)。高さは本図の 0.42 倍で、島が枠を満たす縮尺にする。本図の左下に置く
270
+ var mh0 = M[3] * s, rk = (mh0 * 0.42 - 2 * PADR) / R.cb[3];
271
+ var rw = R.cb[2] * rk + 2 * PADR, rh = R.cb[3] * rk + 2 * PADR, ow = O ? O.cb[2] * O.s * s + 2 * PADI : 0, oh = O ? O.cb[3] * O.s * s + 2 * PADI : 0;
272
+ if (!(rk > 0)) return null;
273
+ var rc = caps ? capsOf(R, rk / s) : [], oc = caps && O ? capsOf(O, O.s) : [];
274
+ // 右の列(凡例と小笠原諸島の枠)。どちらもなければ列も間もない
275
+ var lw = Math.max(rw, capW(rc)), rg = Math.max(ow, capW(oc), legendW), mw = M[2] * s, mh = M[3] * s, tw = lw + GAP + mw + (rg ? GAP + rg : 0);
276
+ if (tw > W || mh > H || rh + rc.length * CAPL > H || (O ? oh + oc.length * CAPL : 0) + (legendH ? legendH + 16 : 0) > H) return null;
277
+ var x0 = (W - tw) / 2, xr = x0 + lw + GAP + mw + GAP, ry = (H + mh) / 2 - rh;
278
+ var fr = [{x: x0 + lw - rw, y: ry, w: rw, h: rh, k: rk, cx: x0 + lw - rw + PADR, cy: ry + PADR, cb: R.cb, cap: rc, capAbove: true}];
279
+ if (O) fr.push({x: xr, y: H - oh, w: ow, h: oh, k: O.s * s, cx: xr + PADI, cy: H - oh + PADI, cb: O.cb, cap: oc, capAbove: true});
280
+ return {sc: s, ox: x0 + lw + GAP, oy: (H - mh) / 2, legend: legendW ? [xr, 0] : null, frames: fr};
281
+ };
282
+ var find = function(caps){ for (var s = H / M[3]; s > 0.005; s *= 0.97){ var r = beside(s, caps); if (r) return r; } return null; };
283
+ var bc = find(true), bn = find(false), bs = bc && bn && bc.sc >= 0.85 * bn.sc ? bc : bn;
284
+ var lw1 = legendW ? legendW + GAP : 0, cs = Math.max(0, Math.min((W - lw1) / M[2], H / M[3]));
285
+ if (bs && bs.sc >= 0.95 * cs){
286
+ sc = bs.sc; ox = bs.ox; oy = bs.oy; frames = bs.frames; legendXY = bs.legend; mode = "beside";
287
+ // 南西諸島の枠を、本図の陸に掛からないところまで右へ(九州の左下の海へ)寄せ、空いた幅の分だけ全体を真ん中に戻す
288
+ var mv = [];
289
+ FEATS.forEach(function(f){ if (f.inset < 0) f.polys.forEach(function(pp){ pp[0].forEach(function(q){ mv.push([ox + (q[0] - M[0]) * sc, oy + (q[1] - M[1]) * sc]); }); }); });
290
+ var F0 = frames[0], top0 = F0.y - F0.cap.length * CAPL, w0 = Math.max(F0.w, capW(F0.cap));
291
+ var hit = function(dx){ return mv.some(function(q){ return q[0] > F0.x + dx - 12 && q[0] < F0.x + dx + w0 + 12 && q[1] > top0 - 6 && q[1] < F0.y + F0.h + 12; }); };
292
+ var dx = 0;
293
+ while (dx + 4 <= ox - F0.x && !hit(dx + 4)) dx += 4;
294
+ F0.x += dx; F0.cx += dx;
295
+ var left = Math.min(F0.x, ox), right = ox + M[2] * sc;
296
+ frames.forEach(function(f){ right = Math.max(right, f.x + Math.max(f.w, capW(f.cap))); });
297
+ if (legendXY) right = Math.max(right, legendXY[0] + legendW);
298
+ var sh = (W - (right - left)) / 2 - left;
299
+ ox += sh; frames.forEach(function(f){ f.x += sh; f.cx += sh; });
300
+ if (legendXY) legendXY[0] += sh;
301
+ }
302
+ else {
303
+ sc = cs; ox = (W - M[2] * sc - lw1) / 2; oy = (H - M[3] * sc) / 2; mode = "corner";
304
+ frames = I.map(function(s){
305
+ var f = s.corner.frame, x = ox + (f[0] - M[0]) * sc, y = oy + (f[1] - M[1]) * sc;
306
+ return {x: x, y: y, w: f[2] * sc, h: f[3] * sc, k: s.corner.s * sc, cx: x + 30 * sc, cy: y + 30 * sc, cb: s.cb, cap: capsOf(s, s.corner.s), capAbove: false};
307
+ });
308
+ if (legendW) legendXY = [ox + M[2] * sc + GAP, oy + M[3] * sc - legendH];
309
+ }
310
+ }
311
+ return {M: M, frames: frames, legendXY: legendXY, sc: sc, ox: ox, oy: oy, mode: mode};
312
+ };
313
+ // 凡例の幅は字の幅の見積もり(base の textWidth)で並べる。凡例の右に 4 px の余白をとって要素の右からはみ出すなら、
314
+ // その幅で並べ直す。それでも入らない(凡例が要素より高い、本図の幅が 120 px 未満になる)なら凡例は描かない
315
+ var small = H < 360 || W < 340, dropped = this.dropped = [];
316
+ var lay0 = layout(legendW, legendH);
317
+ if (legendW){
318
+ var legendWc = legendW + 4;
319
+ if (legendH > H || W - legendWc - GAP < 120){ legendW = legendH = 0; lay0 = layout(0, 0); dropped.push("the legend"); }
320
+ else if (lay0.legendXY && lay0.legendXY[0] + legendWc > W){ legendW = legendWc; lay0 = layout(legendW, legendH); }
321
+ }
322
+ var M = lay0.M, frames = lay0.frames, legendXY = lay0.legendXY, sc = lay0.sc, ox = lay0.ox, oy = lay0.oy, mode = lay0.mode;
323
+ this.sc = sc; this.mode = mode;
324
+ var scr = function(x, y, i){
325
+ if (i >= 0 && frames[i]){ var f = frames[i]; return [f.cx + (x - f.cb[0]) * f.k, f.cy + (y - f.cb[1]) * f.k]; }
326
+ return [ox + (x - M[0]) * sc, oy + (y - M[1]) * sc];
327
+ };
328
+ var insetOf = function(lon, lat){
329
+ if (lay !== "inset") return -1;
330
+ for (var i = 0; i < MAP.insets.length; i++){ var b = MAP.insets[i].box; if (lon >= b[0] && lon <= b[2] && lat >= b[1] && lat <= b[3]) return i; }
331
+ return -1;
332
+ };
333
+ // 描かない枠(islands="main" の小笠原諸島)の範囲に作り手の点があれば知らせる(本当の位置では要素の外になる)
334
+ var offInset = false;
335
+ var ll = this.ll = function(lon, lat){ var q = LCC(lon, lat), i = insetOf(lon, lat); if (i >= 0 && !frames[i]) offInset = true; return scr(q[0], q[1], i); };
336
+ // ---- 都道府県の形(画面の座標)
337
+ var parts = FEATS.filter(function(f){ return f.inset < 0 || lay === "true" || frames[f.inset]; }).map(function(f){
338
+ var polys = f.polys.map(function(p){ return p.map(function(r){ return r.map(function(q){ return scr(q[0], q[1], f.inset); }); }); });
339
+ var dstr = polys.map(function(p){ return p.map(function(r){ return "M" + r.map(function(q){ return q[0].toFixed(1) + "," + q[1].toFixed(1); }).join("L") + "Z"; }).join(""); }).join("");
340
+ return {code: f.code, inset: f.inset, polys: polys, d: dstr};
341
+ });
342
+ var byCode = {};
343
+ parts.forEach(function(p){ (byCode[p.code] = byCode[p.code] || []).push(p); });
344
+ var fixedPts = MAP.fixed.map(function(f){ var i = insetOf(f[1], f[2]), q = LCC(f[1], f[2]); return {name: f[0], code: f[3], p: scr(q[0], q[1], i), i: i}; })
345
+ .filter(function(f){ return f.i < 0 || frames[f.i]; });
346
+ var anchorOf = function(code){ var a = MAP.anchors[code]; return scr(a[0], a[1], a[2]); };
347
+ // ---- 陸の格子(字の置き場所を探すため。4 px ごとに、どの都道府県の上か)
348
+ var G = 4, gw = Math.ceil(W / G), gh = Math.ceil(H / G), grid = new Int8Array(gw * gh), codes = Object.keys(byCode).sort();
349
+ parts.forEach(function(p){
350
+ var ci = codes.indexOf(p.code) + 1;
351
+ p.polys.forEach(function(poly){
352
+ var bx = [Infinity, Infinity, -Infinity, -Infinity];
353
+ poly[0].forEach(function(q){ bx = [Math.min(bx[0], q[0]), Math.min(bx[1], q[1]), Math.max(bx[2], q[0]), Math.max(bx[3], q[1])]; });
354
+ for (var gy = Math.max(0, Math.floor(bx[1] / G)); gy <= Math.min(gh - 1, Math.floor(bx[3] / G)); gy++)
355
+ for (var gx = Math.max(0, Math.floor(bx[0] / G)); gx <= Math.min(gw - 1, Math.floor(bx[2] / G)); gx++){
356
+ var x = gx * G + G / 2, y = gy * G + G / 2;
357
+ if (inRing(x, y, poly[0]) && !poly.slice(1).some(function(h){ return inRing(x, y, h); })) grid[gy * gw + gx] = ci;
358
+ }
359
+ });
360
+ });
361
+ fixedPts.forEach(function(f){ var gx = Math.floor(f.p[0] / G), gy = Math.floor(f.p[1] / G); if (gx >= 0 && gy >= 0 && gx < gw && gy < gh) grid[gy * gw + gx] = codes.indexOf(f.code) + 1; });
362
+ var at = function(x, y){ var gx = Math.floor(x / G), gy = Math.floor(y / G); return gx < 0 || gy < 0 || gx >= gw || gy >= gh ? -1 : grid[gy * gw + gx]; };
363
+ // 箱の中の点(5×3)を見る。inOwn:own の上に入るか(真ん中が own の上、ほかの都道府県には掛からず、6 割以上が own の上。
364
+ // はみ出すのは海の上だけ)、land:陸の割合、hi:強調した地域(own を除く)の上の割合
365
+ var hiCodes = {};
366
+ var probe = function(b, own){
367
+ var n = 0, mine = 0, land = 0, hi = 0, other = 0, mid = false;
368
+ for (var a = 0; a < 5; a++) for (var e = 0; e < 3; e++){
369
+ // 字の形のある所(札の内側の 7 割)を見る
370
+ var x = b.x + b.w * (0.15 + 0.7 * a / 4), y = b.y + b.h * (0.15 + 0.7 * e / 2), v = at(x, y), isOwn = v > 0 && !!own && own.indexOf(codes[v - 1]) >= 0;
371
+ n++;
372
+ if (v > 0){ land++; if (isOwn) mine++; else { other++; if (hiCodes[codes[v - 1]]) hi++; } }
373
+ if (a === 2 && e === 1) mid = isOwn;
374
+ }
375
+ return {inOwn: !!own && mid && !other && mine >= n * 0.6, full: !!own && mine === n, land: land / n, hi: hi / n};
376
+ };
377
+ // ---- 描く層:陸 → 塗り分け → 強調 → 枠 → 重ね描き → 矢印 → 点 → 字
378
+ var gBase = D.el("g", {}, svg), gVal = D.el("g", {}, svg), gReg = D.el("g", {}, svg), gFrame = D.el("g", {}, svg);
379
+ var gShape = D.el("g", {}, svg), gFlow = D.el("g", {}, svg), gPt = D.el("g", {}, svg), gTxt = D.el("g", {}, svg);
380
+ this.base = gBase; this.frames = gFrame; this.fixedPts = fixedPts;
381
+ var LAND = "color-mix(in oklab, var(--line) 55%, var(--bg))";
382
+ parts.forEach(function(p){
383
+ var main = p.inset < 0 || !byCode[p.code].some(function(q){ return q.inset < 0; });
384
+ var a = {d: p.d, fill: LAND, stroke: "var(--bg)", "stroke-width": 1.2, "stroke-linejoin": "round", "fill-rule": "evenodd"};
385
+ if (main) a["data-mark"] = "JP-" + p.code;
386
+ D.el("path", a, gBase);
387
+ });
388
+ // 小さくて形が消える島(竹島・魚釣島・沖ノ鳥島・南鳥島・父島・硫黄島)は点で描く。領土の端の島には data-territory(名前)
389
+ var ISLAND = {"竹島": "竹島", "魚釣島": "尖閣諸島", "沖ノ鳥島": "沖ノ鳥島", "南鳥島": "南鳥島"};
390
+ // layout="true" では小笠原諸島の父島・硫黄島にも名前を書く(すべての島を本当の位置に、名前付きで)
391
+ if (lay === "true"){ ISLAND["父島"] = "父島"; ISLAND["硫黄島"] = "硫黄島"; }
392
+ fixedPts.forEach(function(f){
393
+ var a = {cx: f.p[0].toFixed(1), cy: f.p[1].toFixed(1), r: 3.5, fill: LAND, stroke: "var(--muted)", "stroke-width": 1.5};
394
+ if (ISLAND[f.name]) a["data-territory"] = ISLAND[f.name];
395
+ f.el = D.el("circle", a, gBase);
396
+ });
397
+ // 枠と枠の名前(beside:枠の上の外。corner:枠の中の左上に入って島に掛からなければ)
398
+ var frameNames = [];
399
+ var clear = function(q){
400
+ return q.x >= 0 && q.y >= 0 && q.x + q.w <= W && q.y + q.h <= H && !probe(q, null).land && !fixedPts.some(function(f){ return f.p[0] > q.x - 8 && f.p[0] < q.x + q.w + 8 && f.p[1] > q.y - 8 && f.p[1] < q.y + q.h + 8; });
401
+ };
402
+ frames.forEach(function(f){
403
+ D.el("rect", {x: f.x.toFixed(1), y: f.y.toFixed(1), width: Math.max(0, f.w).toFixed(1), height: Math.max(0, f.h).toFixed(1), fill: "none", stroke: "var(--muted)", "stroke-width": 2}, gFrame);
404
+ var n = f.cap.length, cb = f.capAbove ? {x: f.x, y: f.y - n * CAPL, w: capW(f.cap), h: n * CAPL} : {x: f.x + 6, y: f.y + 4, w: capW(f.cap), h: n * CAPL};
405
+ if (!n) return;
406
+ if ((!f.capAbove && !(cb.x + cb.w <= f.x + f.w - 6 && cb.y + cb.h <= f.y + f.h - 4)) || !clear(cb)){ if (small) dropped.push("the caption " + f.cap[0]); return; }
407
+ f.cap.forEach(function(t, j){ D.el("text", {x: cb.x.toFixed(1), y: (cb.y + j * CAPL + 25).toFixed(1), "font-size": 24, fill: "var(--muted)"}, gFrame).textContent = t; });
408
+ frameNames.push(cb);
409
+ });
410
+ var inFrame = function(b){ return frames.some(function(f){ return b.x >= f.x + 2 && b.y >= f.y + 2 && b.x + b.w <= f.x + f.w - 2 && b.y + b.h <= f.y + f.h - 2; }); };
411
+ // 地域ごとの塗り(path と、点で描く島)
412
+ var paint = function(code, parent, fill, extra){
413
+ var g = D.el("g", {}, parent);
414
+ (byCode[code] || []).forEach(function(p){ D.el("path", Object.assign({d: p.d, fill: fill, stroke: "var(--bg)", "stroke-width": 1.2, "stroke-linejoin": "round", "fill-rule": "evenodd"}, extra || {}), g); });
415
+ fixedPts.forEach(function(f){ if (f.code === code) D.el("circle", {cx: f.p[0].toFixed(1), cy: f.p[1].toFixed(1), r: 3.5, fill: fill, stroke: "var(--fg)", "stroke-width": 1.5}, g); });
416
+ return g;
417
+ };
418
+ var placed = frameNames.slice(); // 置いた字の箱(重ならないように)。凡例の場所も
419
+ if (legendXY) placed.push({x: legendXY[0] - 4, y: legendXY[1], w: legendW + 8, h: legendH});
420
+ var boxes = function(b){ return placed.some(function(q){ return b.x < q.x + q.w + 6 && b.x + b.w + 6 > q.x && b.y < q.y + q.h + 4 && b.y + b.h + 4 > q.y; }); };
421
+ var inside = function(b){ return b.x >= 2 && b.y >= 2 && b.x + b.w <= W - 2 && b.y + b.h <= H - 2; };
422
+ // 枠と枠の名前は、その枠の中のもの(home:字の元の点がある枠の番号。-1 は本図)の字のほかは避ける。
423
+ // crossFrame:箱が枠の線を横切るか、ほかの枠(本図の字なら、どの枠でも)に掛かる
424
+ var frameAt = function(p){ for (var i = 0; i < frames.length; i++){ var f = frames[i]; if (f && p[0] >= f.x && p[0] <= f.x + f.w && p[1] >= f.y && p[1] <= f.y + f.h) return i; } return -1; };
425
+ var crossFrame = function(b, home){
426
+ return frames.some(function(f, i){
427
+ var ov = b.x < f.x + f.w + 2 && b.x + b.w > f.x - 2 && b.y < f.y + f.h + 2 && b.y + b.h > f.y - 2;
428
+ var within = b.x >= f.x + 2 && b.x + b.w <= f.x + f.w - 2 && b.y >= f.y + 2 && b.y + b.h <= f.y + f.h - 2;
429
+ return ov && (i !== home || !within);
430
+ });
431
+ };
432
+ // 引いた引き出し線(ほかの引き出し線と交わる置き場所は遠いとみなす)
433
+ var leaders = [];
434
+ var segX = function(p1, p2, p3, p4){
435
+ var d = function(a, b, c){ return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); };
436
+ return d(p1, p2, p3) * d(p1, p2, p4) < 0 && d(p3, p4, p1) * d(p3, p4, p2) < 0;
437
+ };
438
+ // 引き出し線(from から箱のいちばん近い点まで)が、ほかの枠か枠の名前に入る
439
+ var leadCross = function(from, b, home){
440
+ var x = Math.max(b.x, Math.min(b.x + b.w, from[0])), y = Math.max(b.y, Math.min(b.y + b.h, from[1]));
441
+ for (var u = 0; u <= 20; u++){
442
+ var px = from[0] + (x - from[0]) * u / 20, py = from[1] + (y - from[1]) * u / 20;
443
+ if (frames.some(function(f, i){ return i !== home && px > f.x - 2 && px < f.x + f.w + 2 && py > f.y - 2 && py < f.y + f.h + 2; })) return true;
444
+ if (frameNames.some(function(q){ return px > q.x - 2 && px < q.x + q.w + 2 && py > q.y - 2 && py < q.y + q.h + 2; })) return true;
445
+ }
446
+ return false;
447
+ };
448
+ // 字の札(地の色の角丸の箱に --fg の字)。w, h は札の大きさ
449
+ // 英語の教材の字(Source Sans 3)は字の箱が高い(上 1.024・下 0.4 字):札をその箱が入る高さにし、基線を箱に合わせる
450
+ var tallFont = !!ctx.lang && !/^ja\b/i.test(ctx.lang);
451
+ var chipSize = function(t, size){ return {w: est(t, size, self) + 10, h: tallFont ? Math.ceil(size * 1.43) + 2 : size + 8}; };
452
+ var chip = function(parent, b, t, size, weight){
453
+ var g = D.el("g", {opacity: 0}, parent);
454
+ D.el("rect", {x: b.x.toFixed(1), y: b.y.toFixed(1), width: Math.max(0, b.w).toFixed(1), height: Math.max(0, b.h).toFixed(1), rx: 6, fill: "var(--bg)"}, g);
455
+ D.el("text", {x: (b.x + b.w / 2).toFixed(1), y: (tallFont ? b.y + 1 + size * 1.024 : b.y + b.h / 2 + size * 0.36).toFixed(1), "text-anchor": "middle", "font-size": size, "font-weight": weight || 400, fill: "var(--fg)"}, g).textContent = t;
456
+ return g;
457
+ };
458
+ // 名前の置き場所:中に入れば anchor に。入らなければまわりの海(陸と強調した地域を避ける)に置いて、引き出し線を引く
459
+ // strict:中に置くのは札がすべて own の上に入るときだけ(名前。値は 6 割でよい)
460
+ var placeLabel = function(t, size, anchor, own, mayOut, strict){
461
+ var s = chipSize(t, size), best = null, bc = Infinity, home = frameAt(anchor);
462
+ var ins = [[0, 0]];
463
+ [6, 12, 18].forEach(function(r){ ins.push([0, -r], [0, r], [-r, 0], [r, 0], [-r, -r], [r, -r], [-r, r], [r, r]); });
464
+ for (var n = 0; n < ins.length && own; n++){
465
+ var b0 = {x: anchor[0] + ins[n][0] - s.w / 2, y: anchor[1] + ins[n][1] - s.h / 2, w: s.w, h: s.h};
466
+ var pb = probe(b0, own);
467
+ if (inside(b0) && !boxes(b0) && !crossFrame(b0, home) && (strict ? pb.full : pb.inOwn)) return {b: b0, out: false};
468
+ }
469
+ if (!mayOut) return null;
470
+ for (var r = 30; r <= 260; r += 20) for (var k = 0; k < 24; k++){
471
+ var a = k / 24 * Math.PI * 2, cx = anchor[0] + Math.cos(a) * (r + s.w / 2 * Math.abs(Math.cos(a))), cy = anchor[1] + Math.sin(a) * (r * 0.8 + s.h / 2 * Math.abs(Math.sin(a)));
472
+ var b = {x: cx - s.w / 2, y: cy - s.h / 2, w: s.w, h: s.h};
473
+ if (!inside(b) || boxes(b) || crossFrame(b, home) || leadCross(anchor, b, home)) continue;
474
+ // 引き出し線がほかの強調した地域を横切るのも避ける
475
+ var lx = Math.max(b.x, Math.min(b.x + b.w, anchor[0])), ly = Math.max(b.y, Math.min(b.y + b.h, anchor[1])), cross = 0;
476
+ for (var u = 1; u < 10; u++){ var v = at(anchor[0] + (lx - anchor[0]) * u / 10, anchor[1] + (ly - anchor[1]) * u / 10); if (v > 0 && hiCodes[codes[v - 1]] && !(own && own.indexOf(codes[v - 1]) >= 0)) cross++; }
477
+ var lp = [lx, ly], lc = leaders.filter(function(l){ return segX(anchor, lp, l[0], l[1]); }).length;
478
+ var pr = probe(b, own), cost = r + 260 * pr.land + 900 * pr.hi + 120 * cross + 150 * lc;
479
+ if (cost < bc){ bc = cost; best = b; }
480
+ }
481
+ if (!best) ctx.report("size", "[map-japan] no room for the label \"" + t + "\"");
482
+ return best ? {b: best, out: true} : null;
483
+ };
484
+ var leader = function(parent, from, b){
485
+ var x = Math.max(b.x, Math.min(b.x + b.w, from[0])), y = Math.max(b.y, Math.min(b.y + b.h, from[1]));
486
+ leaders.push([from, [x, y]]);
487
+ var g = D.el("g", {opacity: 0}, parent);
488
+ D.el("path", {d: "M" + from[0].toFixed(1) + "," + from[1].toFixed(1) + "L" + x.toFixed(1) + "," + y.toFixed(1), fill: "none", stroke: "var(--fg)", "stroke-width": 1.5}, g);
489
+ D.el("circle", {cx: from[0].toFixed(1), cy: from[1].toFixed(1), r: 3, fill: "var(--fg)"}, g);
490
+ return g;
491
+ };
492
+ // 領土の端の島の名前(竹島・尖閣諸島・沖ノ鳥島・南鳥島)は地図と一緒に書く。点のまわりの入る所に(枠の中の島は枠の中に)。
493
+ // 入らなければ、小さい要素(small)と、いつも名前を書く島(layout="true" のすべてと小笠原諸島の枠の中)では少し離れた海に引き出し線を付けて書く。
494
+ // 小笠原諸島の枠の島の名前がそれでも入らなければ、枠ごと描かない(名前のない枠は出さない)
495
+ // 作り手の点(経度・緯度で書いたもの)の位置:島の名前を離して置くとき、それに掛けない
496
+ var userPts = (d.points || []).filter(function(o){ return o && isFinite(+o.lon) && isFinite(+o.lat); }).map(function(o, j){ return {p: ll(+o.lon, +o.lat), o: o}; });
497
+ // 名前のある作り手の点が島の点から 15 px 以内なら、その島は作り手の点と名前で示す:組み込みの点と名前は、作り手の点が現れるのと
498
+ // 入れ替わりに消える(render。最後の状態では点も名前も 1 つ)
499
+ var noOgas = false;
500
+ // 名前は必要なときだけ(主題図の上では書かない。layout="true" と小笠原諸島の枠の中、または territory-islands="show")。
501
+ // 書かないときも置き場所は決めて取っておく(ほかの名前の位置を変えない)
502
+ var TI = ["auto", "show", "hide"].indexOf(P["territory-islands"]) >= 0 ? P["territory-islands"] : "auto";
503
+ fixedPts.forEach(function(f){
504
+ var name = ISLAND[f.name];
505
+ if (!name) return;
506
+ var on = TI === "show" || TI === "auto" && (lay === "true" || f.i === 1);
507
+ if (en) name = ISLAND_EN[name] || name;
508
+ f.by = userPts.filter(function(u){ return u.o.label && Math.hypot(u.p[0] - f.p[0], u.p[1] - f.p[1]) <= 15; })[0];
509
+ var s = chipSize(name, 24), p = f.p, spots = [[p[0] + 7, p[1] - s.h / 2], [p[0] - 7 - s.w, p[1] - s.h / 2], [p[0] - s.w / 2, p[1] - 7 - s.h], [p[0] - s.w / 2, p[1] + 7],
510
+ [p[0] + 4, p[1] - 5 - s.h], [p[0] - 4 - s.w, p[1] - 5 - s.h], [p[0] + 4, p[1] + 5], [p[0] - 4 - s.w, p[1] + 5]];
511
+ for (var n = 0; n < spots.length; n++){
512
+ var b = {x: spots[n][0], y: spots[n][1], w: s.w, h: s.h};
513
+ var where = f.i >= 0 && frames[f.i] ? inFrame(b) : !crossFrame(b, -1);
514
+ if (inside(b) && !boxes(b) && where && !probe(b, null).land && !fixedPts.some(function(o){ return o !== f && o.p[0] > b.x - 5 && o.p[0] < b.x + b.w + 5 && o.p[1] > b.y - 5 && o.p[1] < b.y + b.h + 5; })){
515
+ // 作り手の点に替わる島の名前は、作り手の名前の置き場所を妨げない(入れ替わりに消えるので)
516
+ if (!f.by) placed.push(b);
517
+ if (on) (f.nameEl = chip(gFrame, b, name, 24, 400)).setAttribute("opacity", 1);
518
+ return;
519
+ }
520
+ }
521
+ // 小さい要素(small)と、いつも名前を書く島:点のまわりに入らなければ、少し離れた海(枠の外でもよい)に置いて引き出し線を引く。
522
+ // それでも入らなければ知らせる(小笠原諸島の枠の島なら枠ごと描き直す)
523
+ var must = lay === "true" || f.i === 1;
524
+ if (!small && !must) return;
525
+ var hitFrame = function(q){ return frames.some(function(fr){ return q.x < fr.x + fr.w + 3 && q.x + q.w > fr.x - 3 && q.y < fr.y + fr.h + 3 && q.y + q.h > fr.y - 3; }); };
526
+ // 近い所を先に。引き出し線が陸を横切るほど遠いとみなす
527
+ var best = null, bc = Infinity;
528
+ for (var r = 10; r <= 200; r += 6) for (var k = 0; k < 16; k++){
529
+ var a = k / 16 * Math.PI * 2, q = {x: p[0] + Math.cos(a) * (r + s.w / 2) - s.w / 2, y: p[1] + Math.sin(a) * (r + s.h / 2) - s.h / 2, w: s.w, h: s.h};
530
+ var ok = (f.i >= 0 && frames[f.i] && inFrame(q) || !hitFrame(q)) && !leadCross(p, q, f.i >= 0 && frames[f.i] ? f.i : -1);
531
+ if (ok && inside(q) && !boxes(q) && !probe(q, null).land && !fixedPts.some(function(o){ return o !== f && o.p[0] > q.x - 5 && o.p[0] < q.x + q.w + 5 && o.p[1] > q.y - 5 && o.p[1] < q.y + q.h + 5; })
532
+ && !userPts.some(function(u){ return u.p[0] > q.x - 10 && u.p[0] < q.x + q.w + 10 && u.p[1] > q.y - 10 && u.p[1] < q.y + q.h + 10; })){
533
+ var lx = Math.max(q.x, Math.min(q.x + q.w, p[0])), ly = Math.max(q.y, Math.min(q.y + q.h, p[1])), cross = 0;
534
+ for (var u = 1; u < 10; u++) if (at(p[0] + (lx - p[0]) * u / 10, p[1] + (ly - p[1]) * u / 10) > 0) cross++;
535
+ var cost = Math.hypot(lx - p[0], ly - p[1]) + 40 * cross;
536
+ if (cost < bc){ bc = cost; best = {q: q, lx: lx, ly: ly}; }
537
+ }
538
+ }
539
+ if (!best){ if (f.i === 1) noOgas = true; else if (on) dropped.push("the name " + name); return; }
540
+ var q = best.q, lx = best.lx, ly = best.ly, ld = Math.hypot(lx - p[0], ly - p[1]) || 1;
541
+ if (!f.by) placed.push(q);
542
+ if (!on) return;
543
+ var ng = f.nameEl = D.el("g", {}, gFrame);
544
+ if (ld > 6) D.el("path", {d: "M" + (p[0] + (lx - p[0]) * 5 / ld).toFixed(1) + "," + (p[1] + (ly - p[1]) * 5 / ld).toFixed(1) + "L" + lx.toFixed(1) + "," + ly.toFixed(1), fill: "none", stroke: "var(--muted)", "stroke-width": 1.5}, ng);
545
+ chip(ng, q, name, 24, 400).setAttribute("opacity", 1);
546
+ });
547
+ if (noOgas){
548
+ ctx.report("size", "[map-japan] the element (" + W + "×" + H + " px) has no room for the names of 沖ノ鳥島 and 南鳥島 in the 小笠原諸島 inset; the inset is not drawn");
549
+ svg.remove();
550
+ return this.draw(ctx, true);
551
+ }
552
+ // ほかの字は島の点に掛けない
553
+ fixedPts.forEach(function(f){ placed.push({x: f.p[0] - 5, y: f.p[1] - 5, w: 10, h: 10}); });
554
+ // ---- 項目
555
+ var items = this.items = [];
556
+ var lab = /^(focus|all|none)$/.test(P.labels) ? P.labels : "focus";
557
+ // 強調する地域を先に知っておく(名前の置き場所がそれを避ける)
558
+ var regs = pl.items.filter(function(x){ return x.kind === "region"; }).map(function(x){
559
+ var o = x.o, g = o.group !== undefined ? GROUP[o.group] : null;
560
+ if (o.group !== undefined && !g){ if (!retry) ctx.report("data", "[map-japan] regions[" + x.i + "]: group " + JSON.stringify(o.group) + " is not one of hokkaido, tohoku, kanto, chubu, kinki, chugoku, shikoku, kyushu; it is skipped"); return null; }
561
+ var cd0 = g ? null : codeOr(o.id, "regions[" + x.i + "].id");
562
+ if (!g && !cd0) return null;
563
+ var cs = g ? g.codes : [cd0];
564
+ cs.forEach(function(cd){ hiCodes[cd] = true; });
565
+ return {x: x, cs: cs, g: g};
566
+ }).filter(Boolean);
567
+ var valued = {};
568
+ vcodes.forEach(function(v){ valued[v.code] = v; });
569
+ // 点・矢印・重ね描きの座標を先に(その周りに名前を置かない)
570
+ var ptOf = function(o, what){
571
+ if (Array.isArray(o)){ if (o.length !== 2 || !isFinite(+o[0]) || !isFinite(+o[1])) throw new Error(what + ": write [lon, lat] or a prefecture"); return ll(+o[0], +o[1]); }
572
+ var cd = self.code(o, what), c = CAPITAL[cd];
573
+ return ll(c[0], c[1]);
574
+ };
575
+ pl.items.forEach(function(x){
576
+ if (x.kind === "point"){ x.p = x.o.code !== undefined && x.o.lon === undefined ? ptOf(x.o.code, "points[" + x.i + "].code") : ll(+x.o.lon, +x.o.lat); placed.push({x: x.p[0] - 9, y: x.p[1] - 9, w: 18, h: 18}); }
577
+ });
578
+ // 塗り分け
579
+ pl.items.forEach(function(x){
580
+ if (x.kind !== "values") return;
581
+ var it = {x: x, els: [], txt: []};
582
+ // 境界はいつも描く(どの階級の上でも見える --muted の細い線。いちばん薄い階級も縁取られる)
583
+ vcodes.forEach(function(v){ var g = paint(v.code, gVal, classFill[v.ci], {stroke: "var(--muted)", "stroke-width": 1}); g.setAttribute("data-class", v.ci); it.els.push({g: g, cx: anchorOf(v.code)[0]}); });
584
+ items.push(it);
585
+ });
586
+ // 強調
587
+ regs.forEach(function(r){
588
+ var o = r.x.o, col = tone(o.tone, "term"), it = {x: r.x, els: [], txt: []};
589
+ r.cs.forEach(function(cd){
590
+ // 塗り分けた地域は塗りつぶさず、太い縁で強調する
591
+ var g = valued[cd] ? paint(cd, gReg, "none", {stroke: col, "stroke-width": 4}) : paint(cd, gReg, col);
592
+ it.els.push({g: g, cx: anchorOf(cd)[0], outline: true});
593
+ });
594
+ items.push(it);
595
+ r.it = it;
596
+ });
597
+ // 重ね描き(経度・緯度の多角形・線)
598
+ pl.items.forEach(function(x){
599
+ if (x.kind !== "shape") return;
600
+ var o = x.o, pts = (o.polygon || o.line).map(function(q, j){
601
+ if (!Array.isArray(q) || q.length !== 2 || !isFinite(+q[0]) || !isFinite(+q[1])) throw new Error("shapes[" + x.i + "]: point " + j + " is not [lon, lat]");
602
+ return q;
603
+ });
604
+ // 枠に入れるかは最初の点で決める(多角形の全部を同じ所に)
605
+ var i0 = insetOf(+pts[0][0], +pts[0][1]);
606
+ var sp = pts.map(function(q){ var v = LCC(+q[0], +q[1]); return scr(v[0], v[1], i0); });
607
+ var dd = "M" + sp.map(function(q){ return q[0].toFixed(1) + "," + q[1].toFixed(1); }).join("L") + (o.polygon ? "Z" : "");
608
+ var col = tone(o.tone, "accent2");
609
+ var g = D.el("g", {opacity: 0}, gShape);
610
+ var fillEl = o.polygon ? D.el("path", {d: dd, fill: col, "fill-opacity": 0.22, stroke: "none"}, g) : null;
611
+ var line = D.el("path", {d: dd, fill: "none", stroke: col, "stroke-width": o.polygon ? 3 : 4, "stroke-linejoin": "round", "stroke-linecap": "round", "stroke-dasharray": o.dash ? "10 7" : ""}, g);
612
+ var c = [0, 0]; sp.forEach(function(q){ c[0] += q[0] / sp.length; c[1] += q[1] / sp.length; });
613
+ if (!o.polygon) c = sp[Math.floor(sp.length / 2)];
614
+ items.push({x: x, els: [{g: g, cx: c[0], line: line, fill: fillEl, len: line.getTotalLength ? line.getTotalLength() : 0}], txt: [], c: c});
615
+ });
616
+ // 矢印
617
+ var vmax = 0;
618
+ pl.items.forEach(function(x){ if (x.kind === "flow" && isFinite(+x.o.value)) vmax = Math.max(vmax, Math.abs(+x.o.value)); });
619
+ pl.items.forEach(function(x){
620
+ if (x.kind !== "flow") return;
621
+ var o = x.o, a = ptOf(o.from, "flows[" + x.i + "].from"), b = ptOf(o.to, "flows[" + x.i + "].to");
622
+ var sw = vmax && isFinite(+o.value) ? 3 + 7 * Math.abs(+o.value) / vmax : 4, col = tone(o.tone, "emph");
623
+ // 線の形:via があればその点を通るなめらかな曲線(Catmull-Rom)、なければ bend だけ横にふくらむ曲線。折れ線にして持つ
624
+ var poly = [];
625
+ if (o.via && o.via.length){
626
+ var ps = [a].concat(o.via.map(function(q, j){ return ptOf(q, "flows[" + x.i + "].via[" + j + "]"); }), [b]);
627
+ // 求心的な Catmull-Rom(点の間隔がそろっていなくても行き過ぎて輪にならない。Barry–Goldman の形)
628
+ var ext = function(a0, b0){ return [2 * a0[0] - b0[0], 2 * a0[1] - b0[1]]; };
629
+ for (var i = 0; i < ps.length - 1; i++){
630
+ var p0 = ps[i - 1] || ext(ps[i], ps[i + 1]), p1 = ps[i], p2 = ps[i + 1], p3 = ps[i + 2] || ext(ps[i + 1], ps[i]);
631
+ var kt = function(a0, b0){ return Math.max(1e-6, Math.sqrt(Math.hypot(b0[0] - a0[0], b0[1] - a0[1]))); };
632
+ var t0 = 0, t1 = t0 + kt(p0, p1), t2 = t1 + kt(p1, p2), t3 = t2 + kt(p2, p3);
633
+ var mixp = function(a0, b0, ta, tb, t){ var w = (t - ta) / (tb - ta); return [a0[0] + (b0[0] - a0[0]) * w, a0[1] + (b0[1] - a0[1]) * w]; };
634
+ for (var u = 0; u < 1; u += 1 / 16){
635
+ var t = t1 + (t2 - t1) * u;
636
+ var A1 = mixp(p0, p1, t0, t1, t), A2 = mixp(p1, p2, t1, t2, t), A3 = mixp(p2, p3, t2, t3, t);
637
+ var B1 = mixp(A1, A2, t0, t2, t), B2 = mixp(A2, A3, t1, t3, t);
638
+ poly.push(mixp(B1, B2, t1, t2, t));
639
+ }
640
+ }
641
+ poly.push(b);
642
+ } else {
643
+ var dx = b[0] - a[0], dy = b[1] - a[1], bend = o.bend !== undefined ? +o.bend : 0.18, m = [(a[0] + b[0]) / 2 - dy * bend, (a[1] + b[1]) / 2 + dx * bend];
644
+ for (var v = 0; v <= 1.0001; v += 1 / 32) poly.push([0, 1].map(function(j){ return (1 - v) * (1 - v) * a[j] + 2 * v * (1 - v) * m[j] + v * v * b[j]; }));
645
+ }
646
+ // 始めは点の外(11 px)から引く(点の下から線の端がのぞかないように)
647
+ var cut = 11;
648
+ while (poly.length > 2 && Math.hypot(poly[1][0] - poly[0][0], poly[1][1] - poly[0][1]) <= cut){ cut -= Math.hypot(poly[1][0] - poly[0][0], poly[1][1] - poly[0][1]); poly.shift(); }
649
+ if (poly.length > 1){ var l0 = Math.hypot(poly[1][0] - poly[0][0], poly[1][1] - poly[0][1]) || 1; poly[0] = [poly[0][0] + (poly[1][0] - poly[0][0]) * cut / l0, poly[0][1] + (poly[1][1] - poly[0][1]) * cut / l0]; }
650
+ // 終わりから d の所の点(折れ線に沿って)
651
+ var back = function(d){
652
+ for (var i = poly.length - 1; i > 0; i--){
653
+ var q = poly[i], r = poly[i - 1], l = Math.hypot(q[0] - r[0], q[1] - r[1]);
654
+ if (l >= d && l > 0) return {p: [q[0] + (r[0] - q[0]) * d / l, q[1] + (r[1] - q[1]) * d / l], i: i};
655
+ d -= l;
656
+ }
657
+ return {p: poly[0], i: 1};
658
+ };
659
+ // 矢じりの先は終わりの点の 4 px 手前(点の半径 8 +縁 + 4)。線は矢じりの中で止める
660
+ var hl = 10 + sw * 1.6, TIP = 13, tipB = back(TIP), endB = back(TIP + hl * 0.85), dirB = back(TIP + hl);
661
+ var tip = tipB.p, e = endB.p, ux = tip[0] - dirB.p[0], uy = tip[1] - dirB.p[1], ul = Math.hypot(ux, uy) || 1;
662
+ var line = poly.slice(0, endB.i).concat([e]);
663
+ var g = D.el("g", {}, gFlow);
664
+ var lineEl = D.el("path", {d: "M" + line.map(function(q){ return q[0].toFixed(1) + "," + q[1].toFixed(1); }).join("L"), fill: "none", stroke: col, "stroke-width": sw.toFixed(1), "stroke-linecap": "round", "stroke-linejoin": "round", opacity: 0}, g);
665
+ var nx = -uy / ul, ny = ux / ul, hw = 6 + sw * 0.9;
666
+ var head = D.el("path", {d: "M" + tip[0].toFixed(1) + "," + tip[1].toFixed(1) + "L" + (tip[0] - ux / ul * hl + nx * hw).toFixed(1) + "," + (tip[1] - uy / ul * hl + ny * hw).toFixed(1) + "L" + (tip[0] - ux / ul * hl - nx * hw).toFixed(1) + "," + (tip[1] - uy / ul * hl - ny * hw).toFixed(1) + "Z", fill: col, opacity: 0}, g);
667
+ // 線の長さの半ばの点(名前の目安)
668
+ var len = 0; for (var i2 = 1; i2 < line.length; i2++) len += Math.hypot(line[i2][0] - line[i2 - 1][0], line[i2][1] - line[i2 - 1][1]);
669
+ var half = len / 2, mid = line[0];
670
+ for (var i3 = 1; i3 < line.length; i3++){ var l3 = Math.hypot(line[i3][0] - line[i3 - 1][0], line[i3][1] - line[i3 - 1][1]); if (half <= l3){ mid = [line[i3 - 1][0] + (line[i3][0] - line[i3 - 1][0]) * half / l3, line[i3 - 1][1] + (line[i3][1] - line[i3 - 1][1]) * half / l3]; break; } half -= l3; }
671
+ // 名前の札を線と矢じりに掛けない
672
+ line.concat([tip]).forEach(function(q){ placed.push({x: q[0] - 1, y: q[1] - 1, w: 2, h: 2}); });
673
+ items.push({x: x, flow: true, line: lineEl, head: head, len: lineEl.getTotalLength ? lineEl.getTotalLength() : len, els: [], txt: [], c: mid, a: a});
674
+ });
675
+ // 点
676
+ pl.items.forEach(function(x){
677
+ if (x.kind !== "point") return;
678
+ var col = tone(x.o.tone, "fg"), g = D.el("g", {opacity: 0}, gPt);
679
+ var dot = D.el("circle", {cx: x.p[0].toFixed(1), cy: x.p[1].toFixed(1), r: 8, fill: col, stroke: "var(--bg)", "stroke-width": 2.5}, g);
680
+ var it = {x: x, els: [{g: g, cx: x.p[0]}], txt: [], c: x.p};
681
+ // 領土の端の島に置いた点は、その島の点の代わり(render が島の点を作り手の点と入れ替える)
682
+ fixedPts.forEach(function(f){ if (f.by && f.by.o === x.o){ dot.setAttribute("data-territory", ISLAND[f.name]); f.byIt = it; } });
683
+ items.push(it);
684
+ });
685
+ // ---- 字(強調の名前 → 点の名前 → 矢印・重ね描きの名前 → 値 → すべての名前)
686
+ var byItem = function(x){ return items.filter(function(it){ return it.x === x; })[0]; };
687
+ // 枠の近く(150 px 以内)の地域の名前を先に置く(枠を避けると置き場所が少ないので、ほかの名前に取られないように)
688
+ var nearFrame = function(p){ return frames.some(function(f, i){ return i !== frameAt(p) && p[0] > f.x - 150 && p[0] < f.x + f.w + 150 && p[1] > f.y - 150 && p[1] < f.y + f.h + 150; }); };
689
+ var ancOf = function(r){ return r.g ? scr(r.g.anchor[0], r.g.anchor[1], -1) : anchorOf(r.cs[0]); };
690
+ regs.filter(function(r){ return nearFrame(ancOf(r)); }).concat(regs.filter(function(r){ return !nearFrame(ancOf(r)); })).forEach(function(r){
691
+ var o = r.x.o, t = o.label !== undefined ? o.label : lab === "none" ? "" : r.g ? gname(r.g) : nm(r.cs[0]);
692
+ if (!t) return;
693
+ var anc = ancOf(r);
694
+ var pos = placeLabel(t, 24, anc, r.cs, true, true);
695
+ if (!pos) return;
696
+ placed.push(pos.b);
697
+ if (pos.out) r.it.txt.push(leader(gTxt, anc, pos.b));
698
+ r.it.txt.push(chip(gTxt, pos.b, t, 24, 400));
699
+ });
700
+ pl.items.forEach(function(x){
701
+ if (x.kind !== "point" || !x.o.label) return;
702
+ var it = byItem(x), s = chipSize(x.o.label, 24), p = x.p, order = ["right", "left", "above", "below"];
703
+ var want = {top: "above", bottom: "below"}[x.o.anchor] || x.o.anchor || "right"; // top / bottom は above / below の別名
704
+ order = [want].concat(order.filter(function(a){ return a !== want; }));
705
+ var spot = function(a, r){ return a === "right" ? {x: p[0] + r, y: p[1] - s.h / 2} : a === "left" ? {x: p[0] - r - s.w, y: p[1] - s.h / 2} : a === "above" ? {x: p[0] - s.w / 2, y: p[1] - r - s.h} : {x: p[0] - s.w / 2, y: p[1] + r}; };
706
+ // 書いた向きを先に、離す距離を少しずつ増やして、線・ほかの字に掛からない所。斜めも試す
707
+ var b = null, rs = [13, 22, 32], ph = frameAt(p);
708
+ for (var m = 0; m < rs.length && !b; m++) for (var n = 0; n < order.length && !b; n++){ var q = spot(order[n], rs[m]); q.w = s.w; q.h = s.h; if (inside(q) && !boxes(q) && !crossFrame(q, ph)) b = q; }
709
+ for (var dd = 0; dd < 4 && !b; dd++){ var q2 = {x: dd % 2 ? p[0] + 8 : p[0] - 8 - s.w, y: dd < 2 ? p[1] - 8 - s.h : p[1] + 8, w: s.w, h: s.h}; if (inside(q2) && !boxes(q2) && !crossFrame(q2, ph)) b = q2; }
710
+ // 点のそばに入らなければ(要素の縁の近く、枠の中の点)、少し離れた所に置いて引き出し線を引く
711
+ var lead = null;
712
+ if (!b){ var pos = placeLabel(x.o.label, 24, p, null, true); if (pos){ b = pos.b; lead = leader(gTxt, p, b); } }
713
+ if (!b){ b = spot(want, 13); b.w = s.w; b.h = s.h; ctx.report("size", "[map-japan] the label \"" + x.o.label + "\" overlaps another"); }
714
+ placed.push(b);
715
+ if (lead) it.txt.push(lead);
716
+ it.txt.push(chip(gTxt, b, x.o.label, 24, 400));
717
+ });
718
+ items.forEach(function(it){
719
+ if (!(it.x.kind === "flow" || it.x.kind === "shape") || !it.x.o.label) return;
720
+ // labelAt:名前を置く所(経度・緯度)。空いていればそこに、そうでなければまわりに
721
+ var pos = null;
722
+ if (it.x.o.labelAt){
723
+ var la = ptOf(it.x.o.labelAt, (it.x.kind === "flow" ? "flows[" : "shapes[") + it.x.i + "].labelAt"), s0 = chipSize(it.x.o.label, 24);
724
+ var b0 = {x: la[0] - s0.w / 2, y: la[1] - s0.h / 2, w: s0.w, h: s0.h};
725
+ pos = inside(b0) && !boxes(b0) && !crossFrame(b0, frameAt(la)) ? {b: b0} : placeLabel(it.x.o.label, 24, la, null, true);
726
+ } else pos = placeLabel(it.x.o.label, 24, it.c, null, true);
727
+ if (!pos) return;
728
+ placed.push(pos.b);
729
+ it.txt.push(chip(gTxt, pos.b, it.x.o.label, 24, 400));
730
+ });
731
+ // 値(中に入る地域だけ)
732
+ var show = P.show === "value" ? "value" : "none";
733
+ if (!/^(value|none)$/.test(P.show)) ctx.report("attr", '[map-japan] show="' + P.show + '" is not value or none (none is used)');
734
+ items.forEach(function(it){
735
+ if (it.x.kind !== "values" || show === "none") return;
736
+ vcodes.forEach(function(v){
737
+ var t = self.fmt(v.v);
738
+ var pos = placeLabel(t, 24, anchorOf(v.code), [v.code], false);
739
+ if (!pos) return;
740
+ placed.push(pos.b);
741
+ it.txt.push(chip(gTxt, pos.b, t, 24, 700));
742
+ });
743
+ });
744
+ // すべての名前(labels="all"):中に入る都道府県だけ、地図と一緒に
745
+ this.allNames = [];
746
+ if (lab === "all") codes.forEach(function(cd){
747
+ if (hiCodes[cd]) return;
748
+ var pos = placeLabel(nmShort(cd), 24, anchorOf(cd), [cd], false);
749
+ if (!pos) return;
750
+ placed.push(pos.b);
751
+ self.allNames.push(chip(gTxt, pos.b, nmShort(cd), 24, 400));
752
+ });
753
+ // ---- 凡例
754
+ this.legendG = null;
755
+ if (vcodes.length && legendXY){
756
+ var lg = this.legendG = D.el("g", {opacity: 0}, svg), lx = legendXY[0], ly = Math.max(0, legendXY[1]);
757
+ if (this.legendTitle){ D.el("text", {x: lx.toFixed(1), y: (ly + 24).toFixed(1), "font-size": LS, "font-weight": 700, fill: "var(--fg)"}, lg).textContent = this.legendTitle; ly += 36; }
758
+ // 濃い階級(大きい値)を上に
759
+ legendRows.slice().reverse().forEach(function(t, j){
760
+ var ci = classes.length - 1 - j;
761
+ D.el("rect", {x: lx.toFixed(1), y: (ly + j * 36 + 2).toFixed(1), width: 30, height: 26, rx: 3, fill: classFill[ci], stroke: "var(--muted)", "stroke-width": 1, "data-class": ci}, lg);
762
+ D.el("text", {x: (lx + 40).toFixed(1), y: (ly + j * 36 + 24).toFixed(1), "font-size": LS, fill: "var(--fg)"}, lg).textContent = t;
763
+ });
764
+ }
765
+ // 西から東への順(sweep):同じ段階の中の塗り・点の x の順位
766
+ var steps = {};
767
+ items.forEach(function(it){ it.els.forEach(function(e){ (steps[it.x.step] = steps[it.x.step] || []).push(e); }); });
768
+ Object.keys(steps).forEach(function(k){
769
+ var es = steps[k].slice().sort(function(a, b){ return a.cx - b.cx; });
770
+ es.forEach(function(e, j){ e.rank = es.length > 1 ? j / (es.length - 1) : 0; });
771
+ });
772
+ // draw:地域の輪郭を引く線(塗りの上に重ね、塗り終わったら消す)
773
+ if (this.variant === "draw") items.forEach(function(it){
774
+ if (it.x.kind !== "region" && it.x.kind !== "values") return;
775
+ var col = it.x.kind === "region" ? tone(it.x.o.tone, "term") : "var(--fg)";
776
+ it.els.forEach(function(e){
777
+ e.kids = [].slice.call(e.g.childNodes);
778
+ e.outlines = e.kids.filter(function(q){ return q.localName === "path"; }).map(function(q){
779
+ var o = D.el("path", {d: q.getAttribute("d"), fill: "none", stroke: col, "stroke-width": 2.5, "stroke-linejoin": "round"}, e.g);
780
+ return {p: o, len: o.getTotalLength ? o.getTotalLength() : 0};
781
+ });
782
+ });
783
+ });
784
+ if (dropped.length) ctx.report("size", "[map-japan] the element (" + W + "×" + H + " px) is too small for " + dropped.join(", ") + " (not drawn)");
785
+ // 読める層(最後の状態の字の等価物。画面にも印刷にも出ない):強調した地域、塗り分けのすべての値と階級、点・矢印・重ね描きの名前
786
+ var lines = [];
787
+ // 英語の教材では英語の名前と区切り(読み上げが言語を取り違えないように。WCAG 3.1.2)
788
+ var LP = en ? " (" : "(", RP = en ? ")" : ")", SEP = en ? ", " : "、", MID = en ? ", " : "・";
789
+ regs.forEach(function(r){ lines.push((r.x.o.label || (r.g ? gname(r.g) : nm(r.cs[0]))) + (r.g ? LP + r.g.codes.map(nm).join(MID) + RP : "")); });
790
+ if (vcodes.length){
791
+ lines.push((title || (en ? "Values" : "値")) + (en ? ": " : ":") + legendRows.join(SEP));
792
+ vcodes.forEach(function(v){ lines.push(nm(v.code) + " " + self.fmt(v.v) + (P.unit || "") + (en ? " (class " + (v.ci + 1) + ")" : "(" + (v.ci + 1) + ")")); });
793
+ }
794
+ pl.items.forEach(function(x){
795
+ if (x.kind === "point" && x.o.label) lines.push(x.o.label);
796
+ if ((x.kind === "flow" || x.kind === "shape") && x.o.label) lines.push(x.o.label);
797
+ });
798
+ // 描いた領土(北方領土はいつも。島の点は描いたものだけ。作り手の点を置いた島はその名前が上にある)
799
+ lines.push(en ? "Northern Territories (Etorofu, Kunashiri, Shikotan and the Habomai Islands; Hokkaido)" : "北方領土(択捉島・国後島・色丹島・歯舞群島、北海道)");
800
+ fixedPts.forEach(function(f){ if (ISLAND[f.name] && !f.by && f.nameEl) lines.push((en ? ISLAND_EN[ISLAND[f.name]] || ISLAND[f.name] : ISLAND[f.name]) + LP + nm(f.code) + RP); });
801
+ if (offInset) ctx.report("data", '[map-japan] a point, arrow or shape is in the 小笠原諸島 area, which is drawn only with islands="all" or layout="true"');
802
+ if (lines.length){
803
+ // 1 つの段落(項目ごとの要素にしない):Studio の配置の検査が、隠した子の箱まで測ってはみ出しと数えるため(v1.5.0)
804
+ var sr = document.createElement("p");
805
+ sr.className = "sr-only";
806
+ sr.setAttribute("style", "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0");
807
+ sr.textContent = lines.join(en ? "; " : ";");
808
+ this.appendChild(sr);
809
+ }
810
+ // 読み上げ用の名前
811
+ // 名前を出す役割:figure(中の読める段落 .sr-only がそのまま読める。img にすると段落が読まれない)
812
+ this.setAttribute("role", "figure");
813
+ if (!this.getAttribute("aria-label")) this.setAttribute("aria-label", (en ? "Map of Japan" : "日本の地図") + (regs.length ? (en ? ": " : ":") + regs.map(function(r){ return r.g ? gname(r.g) : nm(r.cs[0]); }).join(SEP) : ""));
814
+ }
815
+ // 塗り分けの色:var(--term) を var(--bg) と(濃い側は var(--fg) と)color-mix で混ぜる。OKLab の明るさ L を、いちばん薄い階級
816
+ // (L = 地の L − 0.08)から濃い階級(L = 0.32 か --fg の L + 0.06)まで等しい間隔に(暗い地では向きが逆)。割合はテーマの色から計算する
817
+ // (color-mix の oklab の混ぜは L について線形)。読めなければ決まった割合。n は 1 以上(6 以上は mount が知らせる)
818
+ classColors(n, quiet, ctx){
819
+ var cs = getComputedStyle(this), get = function(v){ return rgbOf(cs.getPropertyValue(v).trim()); };
820
+ var bg = get("--bg"), term = get("--term"), fg = get("--fg"), out = [];
821
+ if (n <= 1) return ["var(--term)"];
822
+ if (!bg || !term || !fg){
823
+ for (var j = 0; j < n; j++) out.push("color-mix(in oklab, var(--term) " + (12 + 88 * j / (n - 1)).toFixed(1) + "%, var(--bg))");
824
+ return out;
825
+ }
826
+ var Lb = oklab(bg)[0], Lt = oklab(term)[0], Lf = oklab(fg)[0];
827
+ // 明るい地:薄い階級は地より 0.08 暗く、濃い階級は 0.32 か --fg + 0.06。暗い地(地が字より暗い):向きを逆に、薄い階級は地より
828
+ // 0.08 明るく、値のない陸(--line 55% と地)よりも 0.06 明るく、濃い階級は 0.86 か --fg − 0.06(地から字の色へ。階級がつぶれない)
829
+ var light = Lb >= Lf, ln = get("--line"), Ll = ln ? Lb + 0.55 * (oklab(ln)[0] - Lb) : Lb;
830
+ var hi = light ? Lb - 0.08 : Math.max(Lb + 0.08, Ll + 0.06), lo = light ? Math.max(0.32, Lf + 0.06) : Math.min(0.86, Lf - 0.06);
831
+ if (Math.abs(hi - lo) / (n - 1) < 0.08 && !quiet) ctx.report("theme", "[map-japan] the theme's colours give less than 0.08 lightness between " + n + " classes");
832
+ for (var i = 0; i < n; i++){
833
+ var L = hi - (hi - lo) * i / (n - 1);
834
+ // L が地と --term の間なら --term を地に、--term を越えれば --fg を --term に混ぜる(明るい地では 2.0.0 と同じ式)
835
+ if ((L - Lt) * (Lb - Lt) >= 0) out.push("color-mix(in oklab, var(--term) " + (100 * Math.min(1, Math.max(0, (Lb - L) / (Lb - Lt || 1e-6)))).toFixed(1) + "%, var(--bg))");
836
+ else out.push("color-mix(in oklab, var(--fg) " + (100 * Math.min(1, (L - Lt) / ((Lf - Lt) || 1e-6))).toFixed(1) + "%, var(--term))");
837
+ }
838
+ return out;
839
+ }
840
+ // 数の書き方:3 桁ごとのカンマ、小数桁(m-bars と同じ)
841
+ fmt(v){
842
+ var s = Math.abs(v).toFixed(this.props.digits).split("."), i = s[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
843
+ return (v < 0 ? "−" : "") + i + (s[1] ? "." + s[1] : "");
844
+ }
845
+ // 段階の長さ:その段階の項目の at + dur の最大(地図そのものは段階 0 から出ていて動かない)
846
+ duration(k){
847
+ var dur = this.props.dur, m = 0;
848
+ this.plan().items.forEach(function(x){ if (x.step === k) m = Math.max(m, x.at + dur); });
849
+ return m;
850
+ }
851
+ render(k, t, ctx){
852
+ var P = this.props, D = base, dur = P.dur, vr = this.variant, lecture = !!ctx.preview, pl = this.plan(), FAINT = 0.45;
853
+ if (lecture) FAINT = base.previewOpacity(this); // 先の段階の薄さ:テーマの --preview-opacity(ないときは 0.45)
854
+ // 地図そのもの(陸・枠・枠の名前・すべての名前)は段階 0 から出ている(見出しや軸と同じ)
855
+ this.allNames.forEach(function(g){ g.setAttribute("opacity", 1); });
856
+ var legendO = 0;
857
+ this.items.forEach(function(it){
858
+ var x = it.x, faint = lecture && x.step > k;
859
+ var tt = x.step < k ? Infinity : x.step > k ? -1 : t - x.at;
860
+ if (faint) tt = Infinity;
861
+ var mul = faint ? FAINT : 1;
862
+ // 動きの区切り:fade は 0〜0.6 dur で現れ、字は 0.4〜1.0 dur。sweep は順位に応じて 0〜0.4 dur 遅らせ、0.6 dur で現れる
863
+ var lo = tt < 0 ? 0 : D.prog(tt, dur * 0.4, dur * 0.6) * mul;
864
+ if (it.flow){
865
+ // 矢印は線を引いていく(どの見せ方も同じ)。矢じりは引き終わりに
866
+ var e = tt < 0 ? 0 : D.prog(tt, 0, dur * 0.7), L = it.len;
867
+ it.line.setAttribute("opacity", tt < 0 ? 0 : mul);
868
+ it.line.setAttribute("stroke-dasharray", e >= 1 ? "" : L.toFixed(1) + " " + L.toFixed(1));
869
+ it.line.setAttribute("stroke-dashoffset", e >= 1 ? "" : (L * (1 - e)).toFixed(1));
870
+ it.head.setAttribute("opacity", ((tt < 0 ? 0 : D.prog(tt, dur * 0.65, dur * 0.15)) * mul).toFixed(3));
871
+ }
872
+ it.els.forEach(function(el){
873
+ var s0 = vr === "sweep" ? (el.rank || 0) * dur * 0.4 : 0, op;
874
+ if (vr === "draw" && (el.outlines || el.line) && tt < 0){
875
+ // まだの段階:mount の直後の属性に戻す(前の呼び出しの値を残さない。docs/contract.md §3)。g が見えないので見た目は同じ。
876
+ // 0 を書かずに属性を消すのは、v1.10.0 の段階 0 と同じ DOM にするため(見えない子の opacity="0" だけで、Chrome は
877
+ // 同じ地図の字を LCD の縁取りでなく灰色の縁取りで描く:Linux・Windows の CI で test-default-variant が違いを見つけた)
878
+ op = 0;
879
+ if (el.outlines){
880
+ el.kids.forEach(function(q){ q.removeAttribute("opacity"); });
881
+ el.outlines.forEach(function(q){ q.p.removeAttribute("opacity"); q.p.removeAttribute("stroke-dasharray"); q.p.removeAttribute("stroke-dashoffset"); });
882
+ }
883
+ if (el.line){
884
+ el.line.setAttribute("stroke-dasharray", it.x.o.dash ? "10 7" : "");
885
+ el.line.removeAttribute("stroke-dashoffset");
886
+ if (el.fill) el.fill.removeAttribute("opacity");
887
+ }
888
+ }
889
+ else if (vr === "draw" && (el.outlines || el.line)){
890
+ // 輪郭を 0〜0.6 dur で引き、塗りを 0.4〜1.0 dur で。輪郭は 0.8〜1.0 dur で消える
891
+ var de = D.prog(tt, 0, dur * 0.6), fe = D.prog(tt, dur * 0.4, dur * 0.6), oe = 1 - D.prog(tt, dur * 0.8, dur * 0.2);
892
+ op = mul;
893
+ if (el.outlines){
894
+ el.kids.forEach(function(q){ q.setAttribute("opacity", fe.toFixed(3)); });
895
+ el.outlines.forEach(function(q){
896
+ var L = q.len;
897
+ q.p.setAttribute("opacity", oe.toFixed(3));
898
+ q.p.setAttribute("stroke-dasharray", L.toFixed(1) + " " + L.toFixed(1));
899
+ q.p.setAttribute("stroke-dashoffset", (L * (1 - de)).toFixed(1));
900
+ });
901
+ }
902
+ if (el.line){
903
+ var L2 = el.len, done = de >= 1 || !L2;
904
+ el.line.setAttribute("stroke-dasharray", done ? (it.x.o.dash ? "10 7" : "") : L2.toFixed(1) + " " + L2.toFixed(1));
905
+ el.line.setAttribute("stroke-dashoffset", done ? "" : (L2 * (1 - de)).toFixed(1));
906
+ if (el.fill) el.fill.setAttribute("opacity", fe.toFixed(3));
907
+ }
908
+ }
909
+ else op = tt < 0 ? 0 : D.prog(tt, s0, dur * 0.6) * mul;
910
+ el.g.setAttribute("opacity", op.toFixed(3));
911
+ });
912
+ it.txt.forEach(function(g){ g.setAttribute("opacity", lo.toFixed(3)); });
913
+ if (x.kind === "values") legendO = lo;
914
+ });
915
+ if (this.legendG) this.legendG.setAttribute("opacity", legendO.toFixed(3));
916
+ // 作り手の点が置かれた島:島の点は作り手の点が現れるのと入れ替わりに消える(点は 1 つ)
917
+ this.fixedPts.forEach(function(f){
918
+ if (!f.byIt) return;
919
+ // 授業の表示で作り手の点が薄く見えているあいだは、島の点はそのまま(入れ替わるのはその段階になってから)
920
+ var o = (lecture && f.byIt.x.step > k ? 1 : 1 - (+f.byIt.els[0].g.getAttribute("opacity") || 0)).toFixed(3);
921
+ f.el.setAttribute("opacity", o);
922
+ if (f.nameEl) f.nameEl.setAttribute("opacity", o);
923
+ });
924
+ }
925
+ };
926
+ });