@holoscript/core 8.0.8 → 8.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/holoscript.cjs +5 -1
- package/dist/GLTFPipeline-L76YTXKA.js +15 -0
- package/dist/GLTFPipeline-ZWJN7GI6.cjs +36 -0
- package/dist/HoloCompositionParser-K76KTEEE.js +12 -0
- package/dist/HoloCompositionParser-UZH6Y4HO.cjs +45 -0
- package/dist/HoloScriptCodeParser-2D4ERFUZ.js +6 -0
- package/dist/HoloScriptCodeParser-UDRLDA7I.cjs +23 -0
- package/dist/HoloScriptPlusParser-FTMCGWXD.js +13 -0
- package/dist/HoloScriptPlusParser-LQR5GIKF.cjs +30 -0
- package/dist/HoloScriptRuntime-UTRLJI5L.js +12 -0
- package/dist/HoloScriptRuntime-YBYXJHJN.cjs +21 -0
- package/dist/SceneIRCompiler-63KA3M2F.js +17 -0
- package/dist/SceneIRCompiler-KWUFHZ4O.cjs +42 -0
- package/dist/{USDZExporter-AUHZODOF.cjs → USDZExporter-ML4UMIGC.cjs} +3 -3
- package/dist/{USDZExporter-GXB4AUSG.js → USDZExporter-ZFKLQ76G.js} +3 -3
- package/dist/agents/index.cjs +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/audit/AuditLogger.d.ts +106 -0
- package/dist/audit/AuditQueryBuilder.d.ts +79 -0
- package/dist/audit/ComplianceReporter.d.ts +90 -0
- package/dist/audit/index.d.ts +13 -0
- package/dist/{chunk-FGMDMJM7.js → chunk-2BYAUHBO.js} +3 -3
- package/dist/{chunk-EDPYCLRC.cjs → chunk-2E6PP5UE.cjs} +83 -59
- package/dist/{chunk-GASCWJK5.js → chunk-2EGGAZT3.js} +65 -287
- package/dist/{chunk-SIEXCILW.js → chunk-2I3XAGMF.js} +3 -3
- package/dist/{chunk-OS533P33.cjs → chunk-2KKOYZYI.cjs} +1074 -1655
- package/dist/chunk-2MQKNDNH.js +51 -0
- package/dist/{chunk-7DMMMBCY.cjs → chunk-2X3IPCBK.cjs} +10 -10
- package/dist/chunk-2ZOTBO25.cjs +202 -0
- package/dist/chunk-356N4NPM.cjs +152 -0
- package/dist/{chunk-X3GJPRVK.cjs → chunk-36NPLOI4.cjs} +92 -81
- package/dist/{chunk-SLU6UPJI.cjs → chunk-37HHY7RH.cjs} +5 -5
- package/dist/{chunk-YDPEHCCI.cjs → chunk-3CDDRUER.cjs} +3 -118
- package/dist/chunk-3F7ZZWIN.js +1651 -0
- package/dist/chunk-3ILD7TKP.cjs +187 -0
- package/dist/{chunk-X27QRG4C.cjs → chunk-3IUHTGDD.cjs} +153 -41
- package/dist/{chunk-PXNZ6TME.js → chunk-4376VHNJ.js} +60 -36
- package/dist/{chunk-YKGPCZEE.cjs → chunk-4FIBOJW6.cjs} +10 -10
- package/dist/chunk-4Q7RKQQI.cjs +14195 -0
- package/dist/{chunk-YCM6QQRT.cjs → chunk-566ZB4LZ.cjs} +180 -8
- package/dist/{chunk-2Y3V22SG.js → chunk-5CURIYGT.js} +3 -3
- package/dist/{chunk-QBWNJXNR.js → chunk-5FYMCVBY.js} +5 -5
- package/dist/{chunk-ZA34AN3R.js → chunk-5LVFTGKH.js} +841 -12
- package/dist/chunk-63AUAIL6.js +48 -0
- package/dist/chunk-655FATJU.js +110 -0
- package/dist/{chunk-TQ377OLB.cjs → chunk-65S62L4D.cjs} +28 -22
- package/dist/chunk-6NTAZN5Z.cjs +502 -0
- package/dist/chunk-6TRX6AR2.js +9376 -0
- package/dist/chunk-6ZCCLKS2.cjs +51 -0
- package/dist/{chunk-MDR235RZ.js → chunk-734OB5SK.js} +721 -8
- package/dist/{chunk-Q2Q34NF3.js → chunk-77QI552M.js} +6 -6
- package/dist/{chunk-WKX5AMOY.js → chunk-7I74JWPW.js} +3 -3
- package/dist/{chunk-5FSKKMR7.cjs → chunk-7IDJDMPU.cjs} +232 -4
- package/dist/chunk-7VBKRGIZ.cjs +847 -0
- package/dist/{chunk-KCPHASCO.js → chunk-AATYYLYK.js} +5 -5
- package/dist/{chunk-WFKVS2K4.cjs → chunk-AUZRKIHQ.cjs} +1101 -55
- package/dist/{chunk-DTGBOSEM.cjs → chunk-AWXFEAQL.cjs} +12 -12
- package/dist/{chunk-THCK6ECW.js → chunk-B3CWTCK2.js} +231 -3
- package/dist/chunk-BCP4E7MD.cjs +997 -0
- package/dist/chunk-BG7RPYJP.js +91 -0
- package/dist/{chunk-VF257YKO.js → chunk-BP4KTMLY.js} +117 -5
- package/dist/{chunk-YN6IETRZ.js → chunk-BQJ3YBF3.js} +6424 -987
- package/dist/{chunk-KOUAQL2B.cjs → chunk-CANAL6CT.cjs} +1569 -168
- package/dist/{chunk-FDSGHPAK.js → chunk-CBSDJF3B.js} +3 -3
- package/dist/{chunk-FEWUHQNM.cjs → chunk-CFVK26P4.cjs} +4 -4
- package/dist/{chunk-M7K4LE66.cjs → chunk-CI33NINL.cjs} +4 -4
- package/dist/{chunk-2OWDB4FB.js → chunk-CKV5NYAE.js} +6 -6
- package/dist/{chunk-LPS5AMQD.cjs → chunk-CM4NHXVO.cjs} +24 -24
- package/dist/chunk-D3HSRXYB.js +115 -0
- package/dist/{chunk-FNHJRI32.js → chunk-DBH3D2MU.js} +1561 -160
- package/dist/{chunk-GW3LKD5C.js → chunk-DJNH4HFW.js} +3 -3
- package/dist/{chunk-2GCNOI2U.cjs → chunk-DN6F4DHH.cjs} +9 -3
- package/dist/chunk-DQRJ5RJG.js +432 -0
- package/dist/{chunk-C7ZBSV2Q.js → chunk-DUG3OQAS.js} +106 -43
- package/dist/chunk-ECUYJOJ2.cjs +199 -0
- package/dist/chunk-EEMTCAK7.js +182 -0
- package/dist/{chunk-3SKLAUDD.cjs → chunk-EI3J6LTW.cjs} +359 -581
- package/dist/{chunk-SSSN7VAM.js → chunk-EM2OGPYE.js} +4 -4
- package/dist/{chunk-56VOWURB.cjs → chunk-ENZCIQZC.cjs} +522 -453
- package/dist/chunk-ESBXUYOC.cjs +836 -0
- package/dist/{chunk-L5U4W6JC.js → chunk-ESSEF6U2.js} +4 -4
- package/dist/chunk-ET3AN4W3.js +824 -0
- package/dist/chunk-EXKSFGSX.cjs +14 -14
- package/dist/{chunk-I76GIKN7.cjs → chunk-F3YT6GUF.cjs} +17 -17
- package/dist/{chunk-WRWEX5ZF.js → chunk-F75DZBBI.js} +3 -3
- package/dist/{chunk-4JGRWHZJ.js → chunk-FG6PYGIZ.js} +12 -6
- package/dist/chunk-FGGJQRLZ.js +14 -14
- package/dist/{chunk-SXOSDZD6.js → chunk-FWCHPCD4.js} +128 -10
- package/dist/{chunk-XW6IXEQH.cjs → chunk-G35CAQ7I.cjs} +5 -5
- package/dist/{chunk-7VMGP2FW.js → chunk-G6KACNMO.js} +132 -188
- package/dist/{chunk-FJPADH77.cjs → chunk-GAWJJAGT.cjs} +6 -6
- package/dist/chunk-GGR7QUKK.cjs +4724 -0
- package/dist/chunk-GIBF4BHH.js +14098 -0
- package/dist/{chunk-AWB7QYY6.cjs → chunk-GILYQ5VH.cjs} +6 -6
- package/dist/{chunk-FWVYAMNW.cjs → chunk-GKFCHGCM.cjs} +4 -4
- package/dist/{chunk-Y3ZFVUUU.js → chunk-GLEJ2TLS.js} +3 -3
- package/dist/{chunk-3GWWJT7L.js → chunk-GP3OKSKT.js} +13 -13
- package/dist/chunk-GTIPOEHN.js +196 -0
- package/dist/{chunk-LMJ5EBV7.cjs → chunk-GZPUA2TL.cjs} +16 -15
- package/dist/{chunk-IELX2OKI.js → chunk-H4LJ4HEA.js} +3 -115
- package/dist/{chunk-ACVWFGBI.cjs → chunk-HCX4SMFK.cjs} +3 -3
- package/dist/{chunk-HYNTS5CP.js → chunk-HHRZ6STP.js} +24 -2
- package/dist/chunk-HIDEIEFG.js +48 -0
- package/dist/{chunk-W6RW64BB.cjs → chunk-HSWBIDZM.cjs} +228 -5
- package/dist/{chunk-GSOUNWEL.js → chunk-HVX7QQYK.js} +1035 -1616
- package/dist/{chunk-TRCGG42I.cjs → chunk-IFW5IW4L.cjs} +6502 -1019
- package/dist/{chunk-F5LKJ6F5.cjs → chunk-IJU6AS67.cjs} +32 -28
- package/dist/{chunk-TVANHNJ7.js → chunk-IK6Z2HNC.js} +173 -3
- package/dist/{chunk-QGMUTVVH.cjs → chunk-IS7NTKY5.cjs} +20 -20
- package/dist/{chunk-YFVQWSNJ.js → chunk-IXWGYWH6.js} +3 -3
- package/dist/chunk-J2DAS2PL.js +148 -0
- package/dist/chunk-JBQXZIWB.js +148 -0
- package/dist/chunk-JBYBMBMW.js +261 -0
- package/dist/{chunk-LWUOUCYL.js → chunk-JEJ7TT54.js} +5 -5
- package/dist/{chunk-DUCB6LGL.js → chunk-JOTCTHN5.js} +211 -5
- package/dist/{chunk-47RUFYKR.js → chunk-K56UVEXV.js} +3 -3
- package/dist/{chunk-XSFNHP2E.js → chunk-KB26H447.js} +3 -3
- package/dist/{chunk-3NGDZZR4.js → chunk-KEYG7HGY.js} +430 -37
- package/dist/{chunk-DY72BMU5.js → chunk-KFVNCW4Q.js} +4 -4
- package/dist/chunk-KPGC7SK2.js +192 -0
- package/dist/chunk-KROXXBK5.cjs +53 -0
- package/dist/{chunk-ZPZAVHXL.cjs → chunk-LB3ZZMKT.cjs} +137 -19
- package/dist/chunk-LDYZWNJW.cjs +1654 -0
- package/dist/{chunk-ULMSSHCJ.cjs → chunk-LMB555QB.cjs} +405 -38
- package/dist/{chunk-CBJY23VL.js → chunk-MD4IVS42.js} +3 -3
- package/dist/{chunk-VMLKSV26.js → chunk-MDDWEBCX.js} +226 -3
- package/dist/chunk-MUWH4QK5.cjs +94 -0
- package/dist/{chunk-T6W3Z3SH.cjs → chunk-N2ILK7BF.cjs} +4 -4
- package/dist/{chunk-6EX3I5P4.cjs → chunk-N74QRJGP.cjs} +6 -6
- package/dist/chunk-NFFHLX37.cjs +132 -0
- package/dist/chunk-NJSYWX7H.js +190 -0
- package/dist/{chunk-SH5PPVK7.cjs → chunk-NQN5LFN4.cjs} +165 -221
- package/dist/chunk-NTQRFOPP.cjs +56 -0
- package/dist/{chunk-YFWRJW4B.js → chunk-NWMJPTVL.js} +51 -55
- package/dist/{chunk-63ZGNR2T.cjs → chunk-OC6GV5QH.cjs} +42 -42
- package/dist/{chunk-7E7GCQCK.js → chunk-OG3MBHM3.js} +9 -3
- package/dist/chunk-OMNHTCS4.cjs +264 -0
- package/dist/chunk-OQXB6NNC.cjs +117 -0
- package/dist/{chunk-Y57W2CT5.cjs → chunk-OV46CCA2.cjs} +51 -55
- package/dist/{chunk-6PRZIHGL.cjs → chunk-OV6HHKLE.cjs} +21 -266
- package/dist/{chunk-C37BHB7N.cjs → chunk-P26YYPOO.cjs} +5 -5
- package/dist/{chunk-2BZHWUSR.cjs → chunk-P7JEKJTZ.cjs} +16 -16
- package/dist/{chunk-NGBXXZLL.cjs → chunk-PDXX5UI4.cjs} +45 -45
- package/dist/{chunk-FHQFPYV4.js → chunk-PJFTTSKE.js} +8 -7
- package/dist/{chunk-GVFJ6T4S.cjs → chunk-PVODJEJ7.cjs} +721 -8
- package/dist/{chunk-ZZ7RO2UQ.js → chunk-Q265VZJ4.js} +3 -3
- package/dist/{chunk-E7JP3BS3.cjs → chunk-Q47JEE2C.cjs} +4 -4
- package/dist/chunk-QBY7LRN2.js +281 -0
- package/dist/{chunk-Z6PMDS4G.js → chunk-QDQWKSU3.js} +1090 -53
- package/dist/{chunk-GH6C2QGW.cjs → chunk-QEDMOGF3.cjs} +857 -16
- package/dist/{chunk-5WUNN6ZN.cjs → chunk-QHSAVOOL.cjs} +24 -2
- package/dist/chunk-QJNCDVYM.cjs +137 -0
- package/dist/chunk-QM7FJB5W.js +4717 -0
- package/dist/chunk-QQFB4RT2.cjs +448 -0
- package/dist/chunk-QSYBHQAD.cjs +196 -0
- package/dist/{chunk-UGXHYIWT.cjs → chunk-QUJ3ZB55.cjs} +28 -28
- package/dist/{chunk-2YSNA2F2.cjs → chunk-QVJMDVYZ.cjs} +5 -5
- package/dist/chunk-RAJMAX6D.js +131 -0
- package/dist/{chunk-VVKVQZI6.js → chunk-RAN3ECAS.js} +3 -3
- package/dist/chunk-RKGUZBOC.js +79 -0
- package/dist/{chunk-HLFDZ35S.cjs → chunk-RRQIAJLQ.cjs} +8 -8
- package/dist/{chunk-PABONWKI.js → chunk-RXQNRZ5F.js} +3 -3
- package/dist/{chunk-7ZHYEITD.cjs → chunk-S4O7CFHQ.cjs} +10 -11
- package/dist/chunk-SE7ANBGN.js +128 -0
- package/dist/{chunk-X2AVEAZM.cjs → chunk-SJIRCTIS.cjs} +176 -2
- package/dist/{chunk-WXQ57LAO.js → chunk-SQXAZHDG.js} +4 -4
- package/dist/chunk-SR73L5ZP.cjs +84 -0
- package/dist/{chunk-OABEO6HH.js → chunk-SZOLTWWD.js} +2349 -214
- package/dist/{chunk-5JEU52DW.js → chunk-TPZ3BN2D.js} +3 -3
- package/dist/{chunk-QFU53KRH.js → chunk-TSTFYGGX.js} +4 -5
- package/dist/{chunk-EBS32AJI.cjs → chunk-TZCFKZ6Z.cjs} +5 -5
- package/dist/chunk-UCVZXQ63.js +724 -0
- package/dist/chunk-UGQ3QNV6.js +992 -0
- package/dist/chunk-UNMVGZVW.js +142 -0
- package/dist/{chunk-TEVX443G.js → chunk-UTUD6GJI.js} +178 -6
- package/dist/chunk-UXBYA7DV.cjs +155 -0
- package/dist/chunk-V6GXFSK7.cjs +443 -0
- package/dist/chunk-VHORVGCG.cjs +761 -0
- package/dist/{chunk-B4EKV6HQ.js → chunk-VKCTYLDN.js} +500 -442
- package/dist/{chunk-O3MGZDCT.cjs → chunk-VTEXJOSD.cjs} +63 -63
- package/dist/chunk-VVAAZITA.cjs +287 -0
- package/dist/{chunk-V7AKE5VT.cjs → chunk-W2GA3EQB.cjs} +435 -42
- package/dist/chunk-W4GABFCR.js +37 -0
- package/dist/chunk-WKEK4NCA.js +490 -0
- package/dist/{chunk-5A4TCHOC.cjs → chunk-WNYXT4TE.cjs} +4 -4
- package/dist/{chunk-S762UEV5.js → chunk-WTH23ISI.js} +6 -6
- package/dist/{chunk-BTKZGHAV.js → chunk-WWNCM473.js} +10 -6
- package/dist/{chunk-7X5PNIQJ.js → chunk-X3YFRH6K.js} +27 -25
- package/dist/{chunk-4YNYPHH3.cjs → chunk-X75H75UY.cjs} +2351 -213
- package/dist/{chunk-LYJJI7ZK.cjs → chunk-XCUDDFKC.cjs} +216 -9
- package/dist/chunk-YAO4HPJL.cjs +120 -0
- package/dist/chunk-YKY2JBER.cjs +9443 -0
- package/dist/chunk-YP5CHEYU.cjs +154 -0
- package/dist/{chunk-WRNEH5MO.js → chunk-YW3I2FQL.js} +18 -7
- package/dist/{chunk-BRNUPDHJ.js → chunk-Z557DVYN.js} +386 -19
- package/dist/{chunk-VSACG2AR.js → chunk-Z6LZUYZF.js} +21 -264
- package/dist/chunk-ZHPMP447.cjs +43 -0
- package/dist/{chunk-LODTHGST.cjs → chunk-ZK7KX5CD.cjs} +133 -70
- package/dist/{chunk-CCPSNT6B.cjs → chunk-ZRPALBQB.cjs} +5 -5
- package/dist/chunk-ZVFHPMC5.js +824 -0
- package/dist/chunk-ZVQMKUGJ.js +443 -0
- package/dist/cli/holoscript-runner.cjs +86 -48
- package/dist/cli/holoscript-runner.js +54 -16
- package/dist/codebase/index.cjs +1 -1
- package/dist/codebase/index.js +1 -1
- package/dist/compiler/agent-inference.cjs +11 -11
- package/dist/compiler/agent-inference.js +9 -6
- package/dist/compiler/android-xr.cjs +13 -12
- package/dist/compiler/android-xr.js +11 -10
- package/dist/compiler/android.cjs +12 -12
- package/dist/compiler/android.js +10 -10
- package/dist/compiler/business-quest.cjs +10 -10
- package/dist/compiler/business-quest.js +2 -2
- package/dist/compiler/coco.cjs +1 -1
- package/dist/compiler/coco.js +1 -1
- package/dist/compiler/context.cjs +9 -9
- package/dist/compiler/context.js +6 -6
- package/dist/compiler/daimon-seed.cjs +36 -0
- package/dist/compiler/daimon-seed.js +12 -0
- package/dist/compiler/domain-block-utils.cjs +205 -156
- package/dist/compiler/domain-block-utils.js +8 -7
- package/dist/compiler/dtdl.cjs +10 -10
- package/dist/compiler/dtdl.js +7 -7
- package/dist/compiler/gltf-pipeline.cjs +9 -9
- package/dist/compiler/gltf-pipeline.js +2 -2
- package/dist/compiler/godot.cjs +10 -9
- package/dist/compiler/godot.js +9 -8
- package/dist/compiler/incremental.cjs +11 -11
- package/dist/compiler/incremental.js +6 -6
- package/dist/compiler/index.cjs +2585 -3273
- package/dist/compiler/index.d.ts +149 -35
- package/dist/compiler/index.js +2197 -3102
- package/dist/compiler/ios.cjs +11 -11
- package/dist/compiler/ios.js +9 -9
- package/dist/compiler/llm-provider-capabilities.cjs +9 -9
- package/dist/compiler/llm-provider-capabilities.js +6 -6
- package/dist/compiler/nodetoy.cjs +1 -1
- package/dist/compiler/nodetoy.js +1 -1
- package/dist/compiler/openxr.cjs +11 -10
- package/dist/compiler/openxr.js +10 -9
- package/dist/compiler/remotion.cjs +1 -1
- package/dist/compiler/remotion.js +1 -1
- package/dist/compiler/reproducibility.cjs +1 -1
- package/dist/compiler/reproducibility.js +1 -1
- package/dist/compiler/sdf.cjs +11 -10
- package/dist/compiler/sdf.js +9 -8
- package/dist/compiler/semantic-scene.cjs +7 -7
- package/dist/compiler/semantic-scene.js +2 -2
- package/dist/compiler/state.cjs +9 -9
- package/dist/compiler/state.js +7 -7
- package/dist/compiler/trait-composition.cjs +11 -11
- package/dist/compiler/trait-composition.js +7 -7
- package/dist/compiler/traits/ProvenanceSemiring.d.ts +167 -0
- package/dist/compiler/traits/Semiring.d.ts +26 -0
- package/dist/compiler/unity.cjs +11 -10
- package/dist/compiler/unity.js +10 -9
- package/dist/compiler/unreal.cjs +12 -11
- package/dist/compiler/unreal.js +10 -9
- package/dist/compiler/urdf.cjs +18 -17
- package/dist/compiler/urdf.js +9 -8
- package/dist/compiler/usd-physics.cjs +11 -10
- package/dist/compiler/usd-physics.js +8 -7
- package/dist/compiler/visionos.cjs +11 -10
- package/dist/compiler/visionos.js +10 -9
- package/dist/compiler/vrchat.cjs +11 -10
- package/dist/compiler/vrchat.js +9 -8
- package/dist/compiler/wasm.cjs +14 -13
- package/dist/compiler/wasm.js +9 -8
- package/dist/compiler/webgpu.cjs +10 -9
- package/dist/compiler/webgpu.js +9 -8
- package/dist/constants.cjs +398 -0
- package/dist/constants.js +9 -0
- package/dist/coordinators/index.cjs +4 -1
- package/dist/coordinators/index.js +4 -1
- package/dist/debugger.cjs +11 -9
- package/dist/debugger.js +9 -7
- package/dist/{dist-ACXG6IH5.cjs → dist-GRMOP2UL.cjs} +341 -65
- package/dist/{dist-VD4L6V7Q.js → dist-ZBUKU2JG.js} +333 -63
- package/dist/entries/interop.cjs +23 -23
- package/dist/entries/interop.js +3 -3
- package/dist/entries/scripting.cjs +12 -11
- package/dist/entries/scripting.js +8 -7
- package/dist/evolution/index.cjs +66 -0
- package/dist/evolution/index.d.ts +162 -0
- package/dist/evolution/index.js +17 -0
- package/dist/hololand/index.cjs +41 -37
- package/dist/hololand/index.js +3 -3
- package/dist/index.cjs +12394 -3224
- package/dist/index.d.ts +260 -18
- package/dist/index.js +10755 -2182
- package/dist/keyword-registry/PluginKeywordRegistry.d.ts +138 -0
- package/dist/keyword-registry/index.cjs +29 -0
- package/dist/keyword-registry/index.d.ts +1 -0
- package/dist/keyword-registry/index.js +4 -0
- package/dist/math/tropical-spmv.cjs +11 -11
- package/dist/math/tropical-spmv.d.ts +1 -0
- package/dist/math/tropical-spmv.js +2 -2
- package/dist/math/tropicalSpmv.d.ts +43 -0
- package/dist/math/vec3.cjs +1 -1
- package/dist/math/vec3.js +1 -1
- package/dist/matter/StagedMatter.d.ts +82 -0
- package/dist/matter/index.cjs +17 -0
- package/dist/matter/index.d.ts +1 -0
- package/dist/matter/index.js +4 -0
- package/dist/{ml-dsa-Z7JDKW4L.js → ml-dsa-J6VKVT4K.js} +3 -3
- package/dist/{ml-dsa-FSKBTE3W.cjs → ml-dsa-MTIK4ZUQ.cjs} +23 -23
- package/dist/paper-0c-spike/index.cjs +1 -1
- package/dist/paper-0c-spike/index.js +1 -1
- package/dist/parameter-envelope/ParameterEnvelope.d.ts +128 -0
- package/dist/parameter-envelope/index.cjs +17 -0
- package/dist/parameter-envelope/index.d.ts +2 -0
- package/dist/parameter-envelope/index.js +4 -0
- package/dist/parser/HoloCompositionTypes.d.ts +2013 -0
- package/dist/parser/PipelineParser.d.ts +162 -0
- package/dist/parser.cjs +36 -20
- package/dist/parser.js +13 -9
- package/dist/plugin-manifest/ManifestAutoLoader.d.ts +35 -0
- package/dist/plugin-manifest/PluginManifest.d.ts +156 -0
- package/dist/plugin-manifest/index.cjs +25 -0
- package/dist/plugin-manifest/index.d.ts +2 -0
- package/dist/plugin-manifest/index.js +4 -0
- package/dist/plugin-solver-contract/PluginSolverContract.d.ts +288 -0
- package/dist/plugin-solver-contract/index.cjs +41 -0
- package/dist/plugin-solver-contract/index.d.ts +1 -0
- package/dist/plugin-solver-contract/index.js +4 -0
- package/dist/policy/ContentPolicyGate.d.ts +51 -0
- package/dist/policy/PolicyPack.d.ts +120 -0
- package/dist/policy/blocklist.d.ts +32 -0
- package/dist/policy/defaults.d.ts +44 -0
- package/dist/policy/index.cjs +106 -0
- package/dist/policy/index.d.ts +17 -0
- package/dist/policy/index.js +5 -0
- package/dist/policy/jsonLogic.d.ts +31 -0
- package/dist/policy/types.d.ts +174 -0
- package/dist/proof-composition/ProofCompositionLaw.d.ts +93 -0
- package/dist/proof-composition/index.cjs +25 -0
- package/dist/proof-composition/index.d.ts +1 -0
- package/dist/proof-composition/index.js +4 -0
- package/dist/receipts/hash-policy.d.ts +85 -0
- package/dist/reconstruction/index.cjs +75 -47
- package/dist/reconstruction/index.js +5 -5
- package/dist/runtime/plugin-trait-registrar.d.ts +36 -0
- package/dist/runtime.cjs +81 -79
- package/dist/runtime.js +9 -7
- package/dist/scene-presets-EDKYZ5GW.js +4 -0
- package/dist/scene-presets-NCW2CFRS.cjs +17 -0
- package/dist/self-improvement/index.cjs +1 -1
- package/dist/self-improvement/index.js +1 -1
- package/dist/{src-PT2FERDV.cjs → src-G3D7ZATQ.cjs} +545 -21
- package/dist/{src-J6CM4AUR.js → src-UXYA7HM6.js} +539 -16
- package/dist/storage/index.cjs +10 -10
- package/dist/storage/index.js +3 -3
- package/dist/testing.cjs +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/index.cjs +3631 -0
- package/dist/tools/index.js +3581 -0
- package/dist/traitDocs/traitDocs.cjs +9 -9
- package/dist/traitDocs/traitDocs.d.ts +1 -0
- package/dist/traitDocs/traitDocs.js +3 -3
- package/dist/traits/ControlLoopTrait.d.ts +154 -0
- package/dist/traits/KinematicChainTrait.d.ts +116 -0
- package/dist/traits/SensorSamplingTrait.d.ts +154 -0
- package/dist/traits/TraitTypes.d.ts +270 -0
- package/dist/traits/TransactionTrait.d.ts +121 -0
- package/dist/traits/botanical-lotus.cjs +54 -50
- package/dist/traits/botanical-lotus.js +2 -5
- package/dist/traits/control-loop.cjs +21 -0
- package/dist/traits/control-loop.d.ts +1 -0
- package/dist/traits/control-loop.js +4 -0
- package/dist/traits/engines/cloth-verlet.d.ts +65 -0
- package/dist/traits/engines/index.cjs +19 -19
- package/dist/traits/engines/index.d.ts +15 -275
- package/dist/traits/engines/index.js +3 -3
- package/dist/traits/engines/motion-data-schema.d.ts +119 -0
- package/dist/traits/engines/motion-matching.d.ts +102 -0
- package/dist/traits/engines/noise.d.ts +25 -0
- package/dist/traits/engines/onnx-adapter.d.ts +173 -0
- package/dist/traits/engines/onnx-motion-matching.d.ts +163 -0
- package/dist/traits/engines/pfnn-network.d.ts +92 -0
- package/dist/traits/engines/synthetic-walk-cycle.d.ts +38 -0
- package/dist/traits/engines/tensor-ops.d.ts +15 -0
- package/dist/traits/index.cjs +2789 -1259
- package/dist/traits/index.d.ts +35 -0
- package/dist/traits/index.js +1692 -411
- package/dist/traits/kinematic-chain.cjs +25 -0
- package/dist/traits/kinematic-chain.d.ts +1 -0
- package/dist/traits/kinematic-chain.js +4 -0
- package/dist/traits/sensor-sampling.cjs +33 -0
- package/dist/traits/sensor-sampling.d.ts +1 -0
- package/dist/traits/sensor-sampling.js +4 -0
- package/dist/traits/simulation-solver-factory.cjs +1 -1
- package/dist/traits/simulation-solver-factory.js +1 -1
- package/dist/traits/transaction.cjs +29 -0
- package/dist/traits/transaction.d.ts +1 -0
- package/dist/traits/transaction.js +4 -0
- package/dist/traits/webcam-gaze.cjs +1 -1
- package/dist/traits/webcam-gaze.js +1 -1
- package/dist/type-checker.cjs +7 -6
- package/dist/type-checker.js +5 -4
- package/dist/types/AdvancedTypeSystem.d.ts +489 -0
- package/dist/types/HoloScriptPlus.d.ts +810 -0
- package/dist/types/base.d.ts +248 -0
- package/dist/types.d.ts +799 -0
- package/dist/world/index.cjs +3 -4
- package/dist/world/index.js +3 -4
- package/dist/world-model/index.cjs +1 -1
- package/dist/world-model/index.js +1 -1
- package/dist/wot/index.cjs +1 -1
- package/dist/wot/index.js +1 -1
- package/package.json +113 -46
- package/dist/GLTFPipeline-3EJLL3TS.cjs +0 -38
- package/dist/GLTFPipeline-3OWJV2VK.js +0 -17
- package/dist/HoloScriptPlusParser-ADWRY5OS.cjs +0 -698
- package/dist/HoloScriptPlusParser-JLJDXHSC.js +0 -693
- package/dist/HoloScriptPlusParser-QCGFPWIL.cjs +0 -27
- package/dist/HoloScriptPlusParser-WENAFEFV.js +0 -10
- package/dist/HoloScriptRuntime-GGRVEU4T.cjs +0 -19
- package/dist/HoloScriptRuntime-GJK6VJPH.js +0 -10
- package/dist/chunk-22Q5A6RV.js +0 -979
- package/dist/chunk-4C57PR42.js +0 -468
- package/dist/chunk-4W5G5QVL.cjs +0 -847
- package/dist/chunk-5ET6L4NS.js +0 -487
- package/dist/chunk-C4GSLCHE.cjs +0 -7153
- package/dist/chunk-F2G6CWFT.js +0 -7089
- package/dist/chunk-G6PNEASF.cjs +0 -814
- package/dist/chunk-GTA4Q3A3.js +0 -1491
- package/dist/chunk-HCCQLAA4.cjs +0 -74
- package/dist/chunk-HFSVMKM3.cjs +0 -72
- package/dist/chunk-KAIVDEIG.cjs +0 -4539
- package/dist/chunk-KQU64CIX.cjs +0 -1508
- package/dist/chunk-MSYSQ2AJ.js +0 -4533
- package/dist/chunk-NHJLP37F.js +0 -70
- package/dist/chunk-NHYRRAGI.cjs +0 -490
- package/dist/chunk-OIQYIIO3.cjs +0 -473
- package/dist/chunk-OL46QLBJ.js +0 -61
- package/dist/chunk-SKZPC5AG.cjs +0 -984
- package/dist/chunk-SLHLXUMO.js +0 -445
- package/dist/chunk-UOIGFQXC.cjs +0 -9750
- package/dist/chunk-UOL6Y5TD.cjs +0 -759
- package/dist/chunk-UVFI7XIR.cjs +0 -452
- package/dist/chunk-VEPGBETF.js +0 -844
- package/dist/chunk-XQ5MWMP2.js +0 -756
- package/dist/chunk-XT6JY5W5.js +0 -9684
- package/dist/chunk-YRRAUB35.js +0 -811
- package/dist/compiler/GasOptimizationAnalyzer.d.ts +0 -73
- package/dist/compiler/NFTMarketplaceCompiler.d.ts +0 -23
- package/dist/compiler/ar.cjs +0 -23
- package/dist/compiler/ar.js +0 -11
- package/dist/compiler/babylon.cjs +0 -21
- package/dist/compiler/babylon.js +0 -15
- package/dist/compiler/multi-layer.cjs +0 -24
- package/dist/compiler/multi-layer.js +0 -15
- package/dist/compiler/playcanvas.cjs +0 -19
- package/dist/compiler/playcanvas.js +0 -13
- package/dist/compiler/r3f.cjs +0 -39
- package/dist/compiler/r3f.d.ts +0 -22
- package/dist/compiler/r3f.js +0 -17
- package/dist/compiler/vrr.cjs +0 -24
- package/dist/compiler/vrr.js +0 -12
- package/dist/parser/NFTMarketplaceTypes.d.ts +0 -191
- package/dist/playwright-3AT3AKTV.cjs +0 -98673
- package/dist/playwright-VZPDVUEQ.js +0 -98660
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import { __esm } from './chunk-W4GABFCR.js';
|
|
2
|
+
|
|
3
|
+
// src/color/perceptualColor.ts
|
|
4
|
+
function srgbToLinearChannel(c) {
|
|
5
|
+
return c <= 0.04045 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
6
|
+
}
|
|
7
|
+
function linearToSrgbChannel(c) {
|
|
8
|
+
return c <= 31308e-7 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055;
|
|
9
|
+
}
|
|
10
|
+
function srgbToLinear([r, g, b]) {
|
|
11
|
+
return [srgbToLinearChannel(r), srgbToLinearChannel(g), srgbToLinearChannel(b)];
|
|
12
|
+
}
|
|
13
|
+
function linearToSrgb([r, g, b]) {
|
|
14
|
+
return [linearToSrgbChannel(r), linearToSrgbChannel(g), linearToSrgbChannel(b)];
|
|
15
|
+
}
|
|
16
|
+
function linearRgbToXyz([r, g, b]) {
|
|
17
|
+
const x = (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) * 100;
|
|
18
|
+
const y = (0.2126729 * r + 0.7151522 * g + 0.072175 * b) * 100;
|
|
19
|
+
const z = (0.0193339 * r + 0.119192 * g + 0.9503041 * b) * 100;
|
|
20
|
+
return [x, y, z];
|
|
21
|
+
}
|
|
22
|
+
function xyzToLinearRgb([x, y, z]) {
|
|
23
|
+
const xs = x / 100;
|
|
24
|
+
const ys = y / 100;
|
|
25
|
+
const zs = z / 100;
|
|
26
|
+
const r = 3.2404542 * xs - 1.5371385 * ys - 0.4985314 * zs;
|
|
27
|
+
const g = -0.969266 * xs + 1.8760108 * ys + 0.041556 * zs;
|
|
28
|
+
const b = 0.0556434 * xs - 0.2040259 * ys + 1.0572252 * zs;
|
|
29
|
+
return [r, g, b];
|
|
30
|
+
}
|
|
31
|
+
function labF(t) {
|
|
32
|
+
return t > LAB_EPS ? Math.cbrt(t) : (LAB_KAPPA * t + 16) / 116;
|
|
33
|
+
}
|
|
34
|
+
function labFInv(t) {
|
|
35
|
+
const t3 = t * t * t;
|
|
36
|
+
return t3 > LAB_EPS ? t3 : (116 * t - 16) / LAB_KAPPA;
|
|
37
|
+
}
|
|
38
|
+
function xyzToLab([x, y, z]) {
|
|
39
|
+
const fx = labF(x / Xn);
|
|
40
|
+
const fy = labF(y / Yn);
|
|
41
|
+
const fz = labF(z / Zn);
|
|
42
|
+
return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) };
|
|
43
|
+
}
|
|
44
|
+
function labToXyz({ L, a, b }) {
|
|
45
|
+
const fy = (L + 16) / 116;
|
|
46
|
+
const fx = fy + a / 500;
|
|
47
|
+
const fz = fy - b / 200;
|
|
48
|
+
return [Xn * labFInv(fx), Yn * labFInv(fy), Zn * labFInv(fz)];
|
|
49
|
+
}
|
|
50
|
+
function srgbToLab(rgb) {
|
|
51
|
+
return xyzToLab(linearRgbToXyz(srgbToLinear(rgb)));
|
|
52
|
+
}
|
|
53
|
+
function labToSrgb(lab) {
|
|
54
|
+
return linearToSrgb(xyzToLinearRgb(labToXyz(lab)));
|
|
55
|
+
}
|
|
56
|
+
function deltaE2000(lab1, lab2) {
|
|
57
|
+
const { L: L1, a: a1, b: b1 } = lab1;
|
|
58
|
+
const { L: L2, a: a2, b: b2 } = lab2;
|
|
59
|
+
const C1 = Math.hypot(a1, b1);
|
|
60
|
+
const C2 = Math.hypot(a2, b2);
|
|
61
|
+
const Cbar = (C1 + C2) / 2;
|
|
62
|
+
const Cbar7 = Math.pow(Cbar, 7);
|
|
63
|
+
const G = 0.5 * (1 - Math.sqrt(Cbar7 / (Cbar7 + 6103515625)));
|
|
64
|
+
const a1p = (1 + G) * a1;
|
|
65
|
+
const a2p = (1 + G) * a2;
|
|
66
|
+
const C1p = Math.hypot(a1p, b1);
|
|
67
|
+
const C2p = Math.hypot(a2p, b2);
|
|
68
|
+
const h1p = hueAngleDeg(a1p, b1);
|
|
69
|
+
const h2p = hueAngleDeg(a2p, b2);
|
|
70
|
+
const dLp = L2 - L1;
|
|
71
|
+
const dCp = C2p - C1p;
|
|
72
|
+
let dhp;
|
|
73
|
+
if (C1p * C2p === 0) {
|
|
74
|
+
dhp = 0;
|
|
75
|
+
} else if (Math.abs(h2p - h1p) <= 180) {
|
|
76
|
+
dhp = h2p - h1p;
|
|
77
|
+
} else if (h2p - h1p > 180) {
|
|
78
|
+
dhp = h2p - h1p - 360;
|
|
79
|
+
} else {
|
|
80
|
+
dhp = h2p - h1p + 360;
|
|
81
|
+
}
|
|
82
|
+
const dHp = 2 * Math.sqrt(C1p * C2p) * Math.sin(dhp * DEG2RAD / 2);
|
|
83
|
+
const Lbarp = (L1 + L2) / 2;
|
|
84
|
+
const Cbarp = (C1p + C2p) / 2;
|
|
85
|
+
let hbarp;
|
|
86
|
+
if (C1p * C2p === 0) {
|
|
87
|
+
hbarp = h1p + h2p;
|
|
88
|
+
} else if (Math.abs(h1p - h2p) <= 180) {
|
|
89
|
+
hbarp = (h1p + h2p) / 2;
|
|
90
|
+
} else if (h1p + h2p < 360) {
|
|
91
|
+
hbarp = (h1p + h2p + 360) / 2;
|
|
92
|
+
} else {
|
|
93
|
+
hbarp = (h1p + h2p - 360) / 2;
|
|
94
|
+
}
|
|
95
|
+
const T = 1 - 0.17 * Math.cos((hbarp - 30) * DEG2RAD) + 0.24 * Math.cos(2 * hbarp * DEG2RAD) + 0.32 * Math.cos((3 * hbarp + 6) * DEG2RAD) - 0.2 * Math.cos((4 * hbarp - 63) * DEG2RAD);
|
|
96
|
+
const dTheta = 30 * Math.exp(-(((hbarp - 275) / 25) ** 2));
|
|
97
|
+
const Cbarp7 = Math.pow(Cbarp, 7);
|
|
98
|
+
const Rc = 2 * Math.sqrt(Cbarp7 / (Cbarp7 + 6103515625));
|
|
99
|
+
const Lbarp50sq = (Lbarp - 50) ** 2;
|
|
100
|
+
const Sl = 1 + 0.015 * Lbarp50sq / Math.sqrt(20 + Lbarp50sq);
|
|
101
|
+
const Sc = 1 + 0.045 * Cbarp;
|
|
102
|
+
const Sh = 1 + 0.015 * Cbarp * T;
|
|
103
|
+
const Rt = -Math.sin(2 * dTheta * DEG2RAD) * Rc;
|
|
104
|
+
const dL = dLp / Sl;
|
|
105
|
+
const dC = dCp / Sc;
|
|
106
|
+
const dH = dHp / Sh;
|
|
107
|
+
return Math.sqrt(dL * dL + dC * dC + dH * dH + Rt * dC * dH);
|
|
108
|
+
}
|
|
109
|
+
function hueAngleDeg(a, b) {
|
|
110
|
+
if (a === 0 && b === 0) return 0;
|
|
111
|
+
const deg = Math.atan2(b, a) * RAD2DEG;
|
|
112
|
+
return deg >= 0 ? deg : deg + 360;
|
|
113
|
+
}
|
|
114
|
+
function dampen(x, tau = DEFAULT_DAMPENING) {
|
|
115
|
+
if (!isFinite(tau)) return x;
|
|
116
|
+
return tau * Math.log1p(x / tau);
|
|
117
|
+
}
|
|
118
|
+
function arcLengthDeltaE2000(A, B, steps = 24) {
|
|
119
|
+
const n = Math.max(1, Math.floor(steps));
|
|
120
|
+
let total = 0;
|
|
121
|
+
let prev = A;
|
|
122
|
+
for (let i = 1; i <= n; i++) {
|
|
123
|
+
const t = i / n;
|
|
124
|
+
const cur = {
|
|
125
|
+
L: A.L + (B.L - A.L) * t,
|
|
126
|
+
a: A.a + (B.a - A.a) * t,
|
|
127
|
+
b: A.b + (B.b - A.b) * t
|
|
128
|
+
};
|
|
129
|
+
total += deltaE2000(prev, cur);
|
|
130
|
+
prev = cur;
|
|
131
|
+
}
|
|
132
|
+
return total;
|
|
133
|
+
}
|
|
134
|
+
function offsetLab(c, offsets) {
|
|
135
|
+
return { L: c.L + offsets[0], a: c.a + offsets[1], b: c.b + offsets[2] };
|
|
136
|
+
}
|
|
137
|
+
function squaredDeltaAtOffset(center, offsets) {
|
|
138
|
+
const d = deltaE2000(center, offsetLab(center, offsets));
|
|
139
|
+
return d * d;
|
|
140
|
+
}
|
|
141
|
+
function clampLabPoint(c) {
|
|
142
|
+
return {
|
|
143
|
+
L: Math.min(100, Math.max(0, c.L)),
|
|
144
|
+
a: Math.min(200, Math.max(-200, c.a)),
|
|
145
|
+
b: Math.min(200, Math.max(-200, c.b))
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function interpolateLab(A, B, t) {
|
|
149
|
+
return {
|
|
150
|
+
L: A.L + (B.L - A.L) * t,
|
|
151
|
+
a: A.a + (B.a - A.a) * t,
|
|
152
|
+
b: A.b + (B.b - A.b) * t
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function labDelta(A, B) {
|
|
156
|
+
return [B.L - A.L, B.a - A.a, B.b - A.b];
|
|
157
|
+
}
|
|
158
|
+
function metricTensorDeltaE2000(center, options = {}) {
|
|
159
|
+
const epsilon = Math.max(Math.abs(options.epsilon ?? 1e-3), 1e-9);
|
|
160
|
+
const regularization = Math.max(0, options.regularization ?? 1e-12);
|
|
161
|
+
const epsilonSq = epsilon * epsilon;
|
|
162
|
+
const metric = [
|
|
163
|
+
[0, 0, 0],
|
|
164
|
+
[0, 0, 0],
|
|
165
|
+
[0, 0, 0]
|
|
166
|
+
];
|
|
167
|
+
for (let i = 0; i < 3; i++) {
|
|
168
|
+
const plus = [0, 0, 0];
|
|
169
|
+
const minus = [0, 0, 0];
|
|
170
|
+
plus[i] = epsilon;
|
|
171
|
+
minus[i] = -epsilon;
|
|
172
|
+
metric[i][i] = (squaredDeltaAtOffset(center, plus) + squaredDeltaAtOffset(center, minus)) / (2 * epsilonSq) + regularization;
|
|
173
|
+
}
|
|
174
|
+
for (let i = 0; i < 3; i++) {
|
|
175
|
+
for (let j = i + 1; j < 3; j++) {
|
|
176
|
+
const pp = [0, 0, 0];
|
|
177
|
+
const pm = [0, 0, 0];
|
|
178
|
+
const mp = [0, 0, 0];
|
|
179
|
+
const mm = [0, 0, 0];
|
|
180
|
+
pp[i] = epsilon;
|
|
181
|
+
pp[j] = epsilon;
|
|
182
|
+
pm[i] = epsilon;
|
|
183
|
+
pm[j] = -epsilon;
|
|
184
|
+
mp[i] = -epsilon;
|
|
185
|
+
mp[j] = epsilon;
|
|
186
|
+
mm[i] = -epsilon;
|
|
187
|
+
mm[j] = -epsilon;
|
|
188
|
+
const gij = (squaredDeltaAtOffset(center, pp) + squaredDeltaAtOffset(center, mm) - squaredDeltaAtOffset(center, pm) - squaredDeltaAtOffset(center, mp)) / (8 * epsilonSq);
|
|
189
|
+
metric[i][j] = gij;
|
|
190
|
+
metric[j][i] = gij;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return metric;
|
|
194
|
+
}
|
|
195
|
+
function labMetricQuadraticForm(vector, metric) {
|
|
196
|
+
let total = 0;
|
|
197
|
+
for (let i = 0; i < 3; i++) {
|
|
198
|
+
for (let j = 0; j < 3; j++) total += vector[i] * metric[i][j] * vector[j];
|
|
199
|
+
}
|
|
200
|
+
return total;
|
|
201
|
+
}
|
|
202
|
+
function metricTensorArcLengthDeltaE2000(A, B, steps = 24, options = {}) {
|
|
203
|
+
const n = Math.max(1, Math.floor(steps));
|
|
204
|
+
let total = 0;
|
|
205
|
+
let prev = A;
|
|
206
|
+
for (let i = 1; i <= n; i++) {
|
|
207
|
+
const cur = interpolateLab(A, B, i / n);
|
|
208
|
+
const mid = interpolateLab(prev, cur, 0.5);
|
|
209
|
+
const metric = metricTensorDeltaE2000(mid, options);
|
|
210
|
+
total += Math.sqrt(Math.max(0, labMetricQuadraticForm(labDelta(prev, cur), metric)));
|
|
211
|
+
prev = cur;
|
|
212
|
+
}
|
|
213
|
+
return total;
|
|
214
|
+
}
|
|
215
|
+
function metricSegmentEnergy(A, B, options = {}) {
|
|
216
|
+
const mid = interpolateLab(A, B, 0.5);
|
|
217
|
+
const metric = metricTensorDeltaE2000(mid, options);
|
|
218
|
+
return Math.max(0, labMetricQuadraticForm(labDelta(A, B), metric));
|
|
219
|
+
}
|
|
220
|
+
function metricPathEnergy(path, options) {
|
|
221
|
+
let total = 0;
|
|
222
|
+
for (let i = 1; i < path.length; i++) total += metricSegmentEnergy(path[i - 1], path[i], options);
|
|
223
|
+
return total;
|
|
224
|
+
}
|
|
225
|
+
function metricPathLength(path, options) {
|
|
226
|
+
let total = 0;
|
|
227
|
+
for (let i = 1; i < path.length; i++) {
|
|
228
|
+
total += Math.sqrt(metricSegmentEnergy(path[i - 1], path[i], options));
|
|
229
|
+
}
|
|
230
|
+
return total;
|
|
231
|
+
}
|
|
232
|
+
function withCoordinate(c, coordinate, value) {
|
|
233
|
+
return coordinate === "L" ? { ...c, L: value } : coordinate === "a" ? { ...c, a: value } : { ...c, b: value };
|
|
234
|
+
}
|
|
235
|
+
function perturbPathCoordinate(path, index, coordinate, delta, clamp) {
|
|
236
|
+
const next = path.slice();
|
|
237
|
+
const point = path[index];
|
|
238
|
+
const value = coordinate === "L" ? point.L : coordinate === "a" ? point.a : point.b;
|
|
239
|
+
const moved = withCoordinate(point, coordinate, value + delta);
|
|
240
|
+
next[index] = clamp ? clampLabPoint(moved) : moved;
|
|
241
|
+
return next;
|
|
242
|
+
}
|
|
243
|
+
function solveDeltaE2000Geodesic(A, B, options = {}) {
|
|
244
|
+
const segments = Math.max(1, Math.floor(options.segments ?? 12));
|
|
245
|
+
const iterations = Math.max(0, Math.floor(options.iterations ?? 40));
|
|
246
|
+
const stepSize = Math.max(0, options.stepSize ?? 0.02);
|
|
247
|
+
const gradientStep = Math.max(1e-6, options.gradientStep ?? 0.05);
|
|
248
|
+
const maxCoordinateStep = Math.max(0, options.maxCoordinateStep ?? 0.35);
|
|
249
|
+
const clamp = options.clampLab ?? true;
|
|
250
|
+
const metricOptions = {
|
|
251
|
+
epsilon: options.epsilon,
|
|
252
|
+
regularization: options.regularization
|
|
253
|
+
};
|
|
254
|
+
const path = [];
|
|
255
|
+
for (let i = 0; i <= segments; i++) path.push(interpolateLab(A, B, i / segments));
|
|
256
|
+
for (let iteration = 0; iteration < iterations; iteration++) {
|
|
257
|
+
let accepted = 0;
|
|
258
|
+
for (let i = 1; i < path.length - 1; i++) {
|
|
259
|
+
const before = metricPathEnergy(path, metricOptions);
|
|
260
|
+
let candidatePoint = path[i];
|
|
261
|
+
for (const coordinate of LAB_COORDINATES) {
|
|
262
|
+
const plus = perturbPathCoordinate(path, i, coordinate, gradientStep, clamp);
|
|
263
|
+
const minus = perturbPathCoordinate(path, i, coordinate, -gradientStep, clamp);
|
|
264
|
+
const gradient = (metricPathEnergy(plus, metricOptions) - metricPathEnergy(minus, metricOptions)) / (2 * gradientStep);
|
|
265
|
+
const rawMove = -stepSize * gradient;
|
|
266
|
+
const move = Math.min(maxCoordinateStep, Math.max(-maxCoordinateStep, rawMove));
|
|
267
|
+
const value = coordinate === "L" ? candidatePoint.L : coordinate === "a" ? candidatePoint.a : candidatePoint.b;
|
|
268
|
+
candidatePoint = withCoordinate(candidatePoint, coordinate, value + move);
|
|
269
|
+
if (clamp) candidatePoint = clampLabPoint(candidatePoint);
|
|
270
|
+
}
|
|
271
|
+
const candidate = path.slice();
|
|
272
|
+
candidate[i] = candidatePoint;
|
|
273
|
+
if (metricPathEnergy(candidate, metricOptions) <= before + 1e-12) {
|
|
274
|
+
path[i] = candidatePoint;
|
|
275
|
+
accepted++;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (accepted === 0) break;
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
path,
|
|
282
|
+
length: metricPathLength(path, metricOptions),
|
|
283
|
+
straightLength: metricTensorArcLengthDeltaE2000(A, B, segments, metricOptions),
|
|
284
|
+
energy: metricPathEnergy(path, metricOptions),
|
|
285
|
+
iterations
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function erfApprox(x) {
|
|
289
|
+
const sign = x < 0 ? -1 : 1;
|
|
290
|
+
const absX = Math.abs(x);
|
|
291
|
+
const a1 = 0.254829592;
|
|
292
|
+
const a2 = -0.284496736;
|
|
293
|
+
const a3 = 1.421413741;
|
|
294
|
+
const a4 = -1.453152027;
|
|
295
|
+
const a5 = 1.061405429;
|
|
296
|
+
const p = 0.3275911;
|
|
297
|
+
const t = 1 / (1 + p * absX);
|
|
298
|
+
const y = 1 - ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t * Math.exp(-absX * absX);
|
|
299
|
+
return sign * y;
|
|
300
|
+
}
|
|
301
|
+
function normalCdf(x) {
|
|
302
|
+
return 0.5 * (1 + erfApprox(x / Math.SQRT2));
|
|
303
|
+
}
|
|
304
|
+
function clampProbability(p) {
|
|
305
|
+
return Math.min(1 - 1e-12, Math.max(1e-12, p));
|
|
306
|
+
}
|
|
307
|
+
function lanlGrayChoiceProbability(row, options = {}) {
|
|
308
|
+
const dampening = options.dampening ?? DEFAULT_DAMPENING;
|
|
309
|
+
const noise = Math.max(1e-9, Math.abs(options.noise ?? DEFAULT_LANL_GRAY_NOISE));
|
|
310
|
+
const d1 = Math.abs(row.Ls - row.Lt1);
|
|
311
|
+
const d2 = Math.abs(row.Ls - row.Lt2);
|
|
312
|
+
return clampProbability(normalCdf((dampen(d2, dampening) - dampen(d1, dampening)) / noise));
|
|
313
|
+
}
|
|
314
|
+
function lanlGrayNegativeLogLikelihood(rows, options = {}) {
|
|
315
|
+
let total = 0;
|
|
316
|
+
for (const row of rows) {
|
|
317
|
+
if (row.count <= 0) continue;
|
|
318
|
+
const choseT2 = Math.min(row.count, Math.max(0, row.choseT2));
|
|
319
|
+
const p = lanlGrayChoiceProbability(row, options);
|
|
320
|
+
total -= choseT2 * Math.log(p) + (row.count - choseT2) * Math.log(1 - p);
|
|
321
|
+
}
|
|
322
|
+
return total;
|
|
323
|
+
}
|
|
324
|
+
function lanlGrayMeanAccuracy(rows, options = {}) {
|
|
325
|
+
let weightedAccuracy = 0;
|
|
326
|
+
let totalCount = 0;
|
|
327
|
+
for (const row of rows) {
|
|
328
|
+
if (row.count <= 0) continue;
|
|
329
|
+
const predictedT2 = lanlGrayChoiceProbability(row, options) * row.count;
|
|
330
|
+
weightedAccuracy += row.count * (1 - Math.abs(row.choseT2 - predictedT2) / row.count);
|
|
331
|
+
totalCount += row.count;
|
|
332
|
+
}
|
|
333
|
+
return totalCount > 0 ? weightedAccuracy / totalCount : 0;
|
|
334
|
+
}
|
|
335
|
+
function fitLanlGrayAchromaticModel(rows, options = {}) {
|
|
336
|
+
if (rows.length === 0) {
|
|
337
|
+
throw new Error("fitLanlGrayAchromaticModel requires at least one aggregate row");
|
|
338
|
+
}
|
|
339
|
+
const dampeningCandidates = options.dampeningCandidates ?? [
|
|
340
|
+
10,
|
|
341
|
+
15,
|
|
342
|
+
20,
|
|
343
|
+
30,
|
|
344
|
+
45,
|
|
345
|
+
60,
|
|
346
|
+
90,
|
|
347
|
+
DAMPENING_OFF
|
|
348
|
+
];
|
|
349
|
+
const noiseCandidates = options.noiseCandidates ?? [4, 6, 8, 10, 12, 15, 20];
|
|
350
|
+
let best;
|
|
351
|
+
for (const dampening of dampeningCandidates) {
|
|
352
|
+
for (const noise of noiseCandidates) {
|
|
353
|
+
const negativeLogLikelihood = lanlGrayNegativeLogLikelihood(rows, { dampening, noise });
|
|
354
|
+
if (!best || negativeLogLikelihood < best.negativeLogLikelihood) {
|
|
355
|
+
best = {
|
|
356
|
+
dampening,
|
|
357
|
+
noise,
|
|
358
|
+
negativeLogLikelihood,
|
|
359
|
+
meanAccuracy: lanlGrayMeanAccuracy(rows, { dampening, noise }),
|
|
360
|
+
rows: rows.length
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (!best) {
|
|
366
|
+
throw new Error("fitLanlGrayAchromaticModel requires at least one dampening and noise candidate");
|
|
367
|
+
}
|
|
368
|
+
return best;
|
|
369
|
+
}
|
|
370
|
+
function perceptualDistance(a, b, options = {}) {
|
|
371
|
+
const { dampening = DEFAULT_DAMPENING, steps = 24 } = options;
|
|
372
|
+
const g = arcLengthDeltaE2000(srgbToLab(a), srgbToLab(b), steps);
|
|
373
|
+
return dampen(g, dampening);
|
|
374
|
+
}
|
|
375
|
+
function nearestNeutral(c) {
|
|
376
|
+
const lab = srgbToLab(c);
|
|
377
|
+
return labToSrgb({ L: lab.L, a: 0, b: 0 });
|
|
378
|
+
}
|
|
379
|
+
function lightness(c) {
|
|
380
|
+
return srgbToLab(c).L;
|
|
381
|
+
}
|
|
382
|
+
function chroma(c) {
|
|
383
|
+
const lab = srgbToLab(c);
|
|
384
|
+
return Math.hypot(lab.a, lab.b);
|
|
385
|
+
}
|
|
386
|
+
function hue(c) {
|
|
387
|
+
const lab = srgbToLab(c);
|
|
388
|
+
return hueAngleDeg(lab.a, lab.b);
|
|
389
|
+
}
|
|
390
|
+
function perceptualLerp(a, b, t) {
|
|
391
|
+
const la = srgbToLab(a);
|
|
392
|
+
const lb = srgbToLab(b);
|
|
393
|
+
const u = Math.min(1, Math.max(0, t));
|
|
394
|
+
return labToSrgb({
|
|
395
|
+
L: la.L + (lb.L - la.L) * u,
|
|
396
|
+
a: la.a + (lb.a - la.a) * u,
|
|
397
|
+
b: la.b + (lb.b - la.b) * u
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
var DAMPENING_OFF, DEFAULT_DAMPENING, DEFAULT_LANL_GRAY_NOISE, Xn, Yn, Zn, LAB_EPS, LAB_KAPPA, DEG2RAD, RAD2DEG, LAB_COORDINATES;
|
|
401
|
+
var init_perceptualColor = __esm({
|
|
402
|
+
"src/color/perceptualColor.ts"() {
|
|
403
|
+
DAMPENING_OFF = Number.POSITIVE_INFINITY;
|
|
404
|
+
DEFAULT_DAMPENING = 30;
|
|
405
|
+
DEFAULT_LANL_GRAY_NOISE = 10;
|
|
406
|
+
Xn = 95.047;
|
|
407
|
+
Yn = 100;
|
|
408
|
+
Zn = 108.883;
|
|
409
|
+
LAB_EPS = 216 / 24389;
|
|
410
|
+
LAB_KAPPA = 24389 / 27;
|
|
411
|
+
DEG2RAD = Math.PI / 180;
|
|
412
|
+
RAD2DEG = 180 / Math.PI;
|
|
413
|
+
LAB_COORDINATES = ["L", "a", "b"];
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
// src/color/reference/lanlGrayAchromatic.ts
|
|
418
|
+
var LANL_GRAY_ACHROMATIC_SOURCE, LANL_GRAY_ACHROMATIC_AGGREGATES;
|
|
419
|
+
var init_lanlGrayAchromatic = __esm({
|
|
420
|
+
"src/color/reference/lanlGrayAchromatic.ts"() {
|
|
421
|
+
LANL_GRAY_ACHROMATIC_SOURCE = {
|
|
422
|
+
repo: "https://github.com/lanl/color",
|
|
423
|
+
dataUrl: "https://raw.githubusercontent.com/lanl/color/main/Gray_Experiment/data/gray_complete_data_release.csv",
|
|
424
|
+
path: "Gray_Experiment/data/gray_complete_data_release.csv",
|
|
425
|
+
sha: "37fe92222edd4e081ed142ce3d7ca7ed40b6e4dc",
|
|
426
|
+
columns: ["trial", "Ls", "Lt1", "Lt2", "R"],
|
|
427
|
+
license: "BSD-3-Clause",
|
|
428
|
+
deposited: "2022-01-28",
|
|
429
|
+
note: "Compact aggregate fixture sampled from the official LANL achromatic gray-axis response data; the full CSV stays upstream."
|
|
430
|
+
};
|
|
431
|
+
LANL_GRAY_ACHROMATIC_AGGREGATES = [
|
|
432
|
+
{ Ls: 30, Lt1: 15, Lt2: 35, count: 287, choseT2: 37 },
|
|
433
|
+
{ Ls: 30, Lt1: 25, Lt2: 45, count: 249, choseT2: 166 },
|
|
434
|
+
{ Ls: 30, Lt1: 12.5, Lt2: 37.5, count: 304, choseT2: 69 },
|
|
435
|
+
{ Ls: 30, Lt1: 22.5, Lt2: 47.5, count: 304, choseT2: 158 },
|
|
436
|
+
{ Ls: 30, Lt1: 10, Lt2: 40, count: 249, choseT2: 74 },
|
|
437
|
+
{ Ls: 30, Lt1: 20, Lt2: 50, count: 249, choseT2: 121 },
|
|
438
|
+
{ Ls: 30, Lt1: 7.5, Lt2: 42.5, count: 299, choseT2: 73 },
|
|
439
|
+
{ Ls: 30, Lt1: 17.5, Lt2: 52.5, count: 299, choseT2: 127 },
|
|
440
|
+
{ Ls: 30, Lt1: 5, Lt2: 45, count: 304, choseT2: 72 },
|
|
441
|
+
{ Ls: 30, Lt1: 15, Lt2: 55, count: 304, choseT2: 123 },
|
|
442
|
+
{ Ls: 30, Lt1: 2.5, Lt2: 47.5, count: 299, choseT2: 62 },
|
|
443
|
+
{ Ls: 30, Lt1: 12.5, Lt2: 57.5, count: 299, choseT2: 126 },
|
|
444
|
+
{ Ls: 30, Lt1: 0, Lt2: 50, count: 287, choseT2: 59 },
|
|
445
|
+
{ Ls: 30, Lt1: 10, Lt2: 60, count: 249, choseT2: 111 },
|
|
446
|
+
{ Ls: 50, Lt1: 35, Lt2: 55, count: 287, choseT2: 51 },
|
|
447
|
+
{ Ls: 50, Lt1: 45, Lt2: 65, count: 249, choseT2: 175 },
|
|
448
|
+
{ Ls: 50, Lt1: 32.5, Lt2: 57.5, count: 299, choseT2: 69 },
|
|
449
|
+
{ Ls: 50, Lt1: 42.5, Lt2: 67.5, count: 299, choseT2: 222 },
|
|
450
|
+
{ Ls: 50, Lt1: 30, Lt2: 60, count: 249, choseT2: 84 },
|
|
451
|
+
{ Ls: 50, Lt1: 40, Lt2: 70, count: 249, choseT2: 179 },
|
|
452
|
+
{ Ls: 50, Lt1: 27.5, Lt2: 62.5, count: 299, choseT2: 80 },
|
|
453
|
+
{ Ls: 50, Lt1: 37.5, Lt2: 72.5, count: 304, choseT2: 198 },
|
|
454
|
+
{ Ls: 50, Lt1: 25, Lt2: 65, count: 299, choseT2: 75 },
|
|
455
|
+
{ Ls: 50, Lt1: 35, Lt2: 75, count: 299, choseT2: 204 },
|
|
456
|
+
{ Ls: 50, Lt1: 22.5, Lt2: 67.5, count: 304, choseT2: 82 },
|
|
457
|
+
{ Ls: 50, Lt1: 32.5, Lt2: 77.5, count: 299, choseT2: 187 },
|
|
458
|
+
{ Ls: 50, Lt1: 20, Lt2: 70, count: 287, choseT2: 57 },
|
|
459
|
+
{ Ls: 50, Lt1: 30, Lt2: 80, count: 249, choseT2: 155 },
|
|
460
|
+
{ Ls: 70, Lt1: 55, Lt2: 75, count: 287, choseT2: 76 },
|
|
461
|
+
{ Ls: 70, Lt1: 65, Lt2: 85, count: 249, choseT2: 192 },
|
|
462
|
+
{ Ls: 70, Lt1: 52.5, Lt2: 77.5, count: 299, choseT2: 115 },
|
|
463
|
+
{ Ls: 70, Lt1: 62.5, Lt2: 87.5, count: 304, choseT2: 239 },
|
|
464
|
+
{ Ls: 70, Lt1: 50, Lt2: 80, count: 249, choseT2: 102 },
|
|
465
|
+
{ Ls: 70, Lt1: 60, Lt2: 90, count: 249, choseT2: 185 },
|
|
466
|
+
{ Ls: 70, Lt1: 47.5, Lt2: 82.5, count: 299, choseT2: 104 },
|
|
467
|
+
{ Ls: 70, Lt1: 57.5, Lt2: 92.5, count: 299, choseT2: 215 },
|
|
468
|
+
{ Ls: 70, Lt1: 45, Lt2: 85, count: 304, choseT2: 126 },
|
|
469
|
+
{ Ls: 70, Lt1: 55, Lt2: 95, count: 304, choseT2: 232 },
|
|
470
|
+
{ Ls: 70, Lt1: 42.5, Lt2: 87.5, count: 299, choseT2: 133 },
|
|
471
|
+
{ Ls: 70, Lt1: 52.5, Lt2: 97.5, count: 304, choseT2: 223 },
|
|
472
|
+
{ Ls: 70, Lt1: 40, Lt2: 90, count: 287, choseT2: 108 },
|
|
473
|
+
{ Ls: 70, Lt1: 50, Lt2: 100, count: 249, choseT2: 173 }
|
|
474
|
+
];
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
// src/color/index.ts
|
|
479
|
+
var init_color = __esm({
|
|
480
|
+
"src/color/index.ts"() {
|
|
481
|
+
init_perceptualColor();
|
|
482
|
+
init_lanlGrayAchromatic();
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
// src/compiler/PerceptualColorPass.ts
|
|
487
|
+
function clamp01(value) {
|
|
488
|
+
return Math.max(0, Math.min(1, value));
|
|
489
|
+
}
|
|
490
|
+
function clampByte(value) {
|
|
491
|
+
return Math.max(0, Math.min(255, Math.round(value)));
|
|
492
|
+
}
|
|
493
|
+
function normalizeHexColor(color) {
|
|
494
|
+
const trimmed = color.trim();
|
|
495
|
+
const match = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.exec(trimmed);
|
|
496
|
+
if (!match) {
|
|
497
|
+
throw new Error(`Unsupported color format: ${color}`);
|
|
498
|
+
}
|
|
499
|
+
const hex = match[1];
|
|
500
|
+
if (hex.length === 3) {
|
|
501
|
+
return `#${hex.split("").map((c) => c + c).join("")}`.toUpperCase();
|
|
502
|
+
}
|
|
503
|
+
return `#${hex}`.toUpperCase();
|
|
504
|
+
}
|
|
505
|
+
function hexToSrgb(color) {
|
|
506
|
+
const hex = normalizeHexColor(color).slice(1);
|
|
507
|
+
return [
|
|
508
|
+
Number.parseInt(hex.slice(0, 2), 16) / 255,
|
|
509
|
+
Number.parseInt(hex.slice(2, 4), 16) / 255,
|
|
510
|
+
Number.parseInt(hex.slice(4, 6), 16) / 255
|
|
511
|
+
];
|
|
512
|
+
}
|
|
513
|
+
function srgbToHex(rgb) {
|
|
514
|
+
const [r, g, b] = rgb.map((c) => clampByte(clamp01(c) * 255));
|
|
515
|
+
return `#${[r, g, b].map((c) => c.toString(16).padStart(2, "0")).join("")}`.toUpperCase();
|
|
516
|
+
}
|
|
517
|
+
function finiteNumber(value, fallback) {
|
|
518
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
519
|
+
}
|
|
520
|
+
function normalizedStops(stops, warnings) {
|
|
521
|
+
if (stops.length === 0) {
|
|
522
|
+
warnings.push("No colors supplied; using viridis fallback.");
|
|
523
|
+
return normalizedStops(SCIENTIFIC_COLOR_MAPS.viridis, warnings);
|
|
524
|
+
}
|
|
525
|
+
const rawStops = stops.map((stop, index) => {
|
|
526
|
+
if (typeof stop === "string") {
|
|
527
|
+
return {
|
|
528
|
+
t: stops.length === 1 ? 0 : index / (stops.length - 1),
|
|
529
|
+
color: stop
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
return stop;
|
|
533
|
+
});
|
|
534
|
+
const normalized = [];
|
|
535
|
+
for (const stop of rawStops) {
|
|
536
|
+
try {
|
|
537
|
+
normalized.push({
|
|
538
|
+
t: clamp01(finiteNumber(stop.t, 0)),
|
|
539
|
+
color: normalizeHexColor(stop.color)
|
|
540
|
+
});
|
|
541
|
+
} catch (error) {
|
|
542
|
+
warnings.push(error instanceof Error ? error.message : "Invalid color stop skipped.");
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (normalized.length === 0) {
|
|
546
|
+
warnings.push("All supplied colors were invalid; using viridis fallback.");
|
|
547
|
+
return normalizedStops(SCIENTIFIC_COLOR_MAPS.viridis, warnings);
|
|
548
|
+
}
|
|
549
|
+
if (normalized.length === 1) {
|
|
550
|
+
normalized.push({ t: 1, color: normalized[0].color });
|
|
551
|
+
}
|
|
552
|
+
normalized.sort((a, b) => a.t - b.t);
|
|
553
|
+
normalized[0] = { ...normalized[0], t: 0 };
|
|
554
|
+
normalized[normalized.length - 1] = { ...normalized[normalized.length - 1], t: 1 };
|
|
555
|
+
return normalized;
|
|
556
|
+
}
|
|
557
|
+
function findSegment(stops, t) {
|
|
558
|
+
for (let i = 0; i < stops.length - 1; i++) {
|
|
559
|
+
if (t >= stops[i].t && t <= stops[i + 1].t) {
|
|
560
|
+
return [stops[i], stops[i + 1]];
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return [stops[stops.length - 2], stops[stops.length - 1]];
|
|
564
|
+
}
|
|
565
|
+
function deltas(colors, options) {
|
|
566
|
+
const values = [];
|
|
567
|
+
for (let i = 1; i < colors.length; i++) {
|
|
568
|
+
values.push(perceptualDistance(hexToSrgb(colors[i - 1]), hexToSrgb(colors[i]), options));
|
|
569
|
+
}
|
|
570
|
+
return values;
|
|
571
|
+
}
|
|
572
|
+
function stats(values) {
|
|
573
|
+
if (values.length === 0) return { minDeltaE: 0, maxDeltaE: 0, meanDeltaE: 0 };
|
|
574
|
+
const minDeltaE = Math.min(...values);
|
|
575
|
+
const maxDeltaE = Math.max(...values);
|
|
576
|
+
const meanDeltaE = values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
577
|
+
return { minDeltaE, maxDeltaE, meanDeltaE };
|
|
578
|
+
}
|
|
579
|
+
function buildPerceptualGradient(stops, options = {}) {
|
|
580
|
+
const warnings = [];
|
|
581
|
+
const normalized = normalizedStops(stops, warnings);
|
|
582
|
+
const steps = Math.max(2, Math.floor(finiteNumber(options.steps, 7)));
|
|
583
|
+
const colors = [];
|
|
584
|
+
const sampledStops = [];
|
|
585
|
+
for (let i = 0; i < steps; i++) {
|
|
586
|
+
const t = steps === 1 ? 0 : i / (steps - 1);
|
|
587
|
+
const [a, b] = findSegment(normalized, t);
|
|
588
|
+
const localT = b.t === a.t ? 0 : (t - a.t) / (b.t - a.t);
|
|
589
|
+
const color = t <= 0 ? a.color : t >= 1 ? b.color : srgbToHex(perceptualLerp(hexToSrgb(a.color), hexToSrgb(b.color), localT));
|
|
590
|
+
colors.push(color);
|
|
591
|
+
sampledStops.push({ t, color });
|
|
592
|
+
}
|
|
593
|
+
const distanceOptions = {
|
|
594
|
+
dampening: options.dampening ?? DEFAULT_DAMPENING,
|
|
595
|
+
steps: options.arcSteps ?? 24
|
|
596
|
+
};
|
|
597
|
+
const deltaE = deltas(colors, distanceOptions);
|
|
598
|
+
return {
|
|
599
|
+
stops: sampledStops,
|
|
600
|
+
colors,
|
|
601
|
+
deltaE,
|
|
602
|
+
...stats(deltaE)
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
function buildPerceptualPalette(colors, options = {}) {
|
|
606
|
+
const warnings = [];
|
|
607
|
+
const normalized = normalizedStops(colors, warnings).map((stop) => stop.color);
|
|
608
|
+
const distanceOptions = {
|
|
609
|
+
dampening: options.dampening ?? DEFAULT_DAMPENING,
|
|
610
|
+
steps: options.arcSteps ?? 24
|
|
611
|
+
};
|
|
612
|
+
const pairwiseDeltaE = deltas(normalized, distanceOptions);
|
|
613
|
+
const neutral = options.neutralAxis === true ? normalized.map((color) => srgbToHex(nearestNeutral(hexToSrgb(color)))) : void 0;
|
|
614
|
+
return {
|
|
615
|
+
colors: normalized,
|
|
616
|
+
pairwiseDeltaE,
|
|
617
|
+
...stats(pairwiseDeltaE),
|
|
618
|
+
nearestNeutral: neutral
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
function resolveColorMap(colorMap, warnings) {
|
|
622
|
+
if (typeof colorMap === "string") {
|
|
623
|
+
const key = colorMap.trim().toLowerCase();
|
|
624
|
+
const stops = SCIENTIFIC_COLOR_MAPS[key];
|
|
625
|
+
if (stops) return { name: key, stops };
|
|
626
|
+
warnings.push(`Unknown color map "${colorMap}"; using viridis.`);
|
|
627
|
+
return { name: "viridis", stops: SCIENTIFIC_COLOR_MAPS.viridis };
|
|
628
|
+
}
|
|
629
|
+
if (Array.isArray(colorMap)) {
|
|
630
|
+
return { name: "custom", stops: colorMap };
|
|
631
|
+
}
|
|
632
|
+
return void 0;
|
|
633
|
+
}
|
|
634
|
+
function metricWarnings(result, targetDeltaE) {
|
|
635
|
+
if (targetDeltaE <= 0) return [];
|
|
636
|
+
const minDeltaE = result.minDeltaE;
|
|
637
|
+
if (minDeltaE === 0 || minDeltaE >= targetDeltaE) return [];
|
|
638
|
+
return [
|
|
639
|
+
`Minimum adjacent perceptual distance ${minDeltaE.toFixed(2)} is below target ${targetDeltaE}.`
|
|
640
|
+
];
|
|
641
|
+
}
|
|
642
|
+
function analyzePerceptualColor(color) {
|
|
643
|
+
const normalized = normalizeHexColor(color);
|
|
644
|
+
const rgb = hexToSrgb(normalized);
|
|
645
|
+
return {
|
|
646
|
+
color: normalized,
|
|
647
|
+
lightness: lightness(rgb),
|
|
648
|
+
chroma: chroma(rgb),
|
|
649
|
+
hue: hue(rgb),
|
|
650
|
+
nearestNeutral: srgbToHex(nearestNeutral(rgb))
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
function applyPerceptualColorPass(input) {
|
|
654
|
+
const warnings = [];
|
|
655
|
+
const targetDeltaE = finiteNumber(input.targetDeltaE, 8);
|
|
656
|
+
const options = {
|
|
657
|
+
steps: input.steps,
|
|
658
|
+
dampening: input.dampening ?? DEFAULT_DAMPENING,
|
|
659
|
+
arcSteps: input.arcSteps,
|
|
660
|
+
neutralAxis: input.neutralAxis
|
|
661
|
+
};
|
|
662
|
+
const resolvedMap = resolveColorMap(input.colorMap, warnings);
|
|
663
|
+
if (resolvedMap) {
|
|
664
|
+
const gradient2 = buildPerceptualGradient(resolvedMap.stops, options);
|
|
665
|
+
const colorMap = { name: resolvedMap.name, ...gradient2 };
|
|
666
|
+
warnings.push(...metricWarnings(gradient2, targetDeltaE));
|
|
667
|
+
return {
|
|
668
|
+
algorithm: "perceptual_lerp_delta_e2000",
|
|
669
|
+
source: "color_map",
|
|
670
|
+
scientific: input.scientific ?? true,
|
|
671
|
+
targetDeltaE,
|
|
672
|
+
dampening: options.dampening ?? DEFAULT_DAMPENING,
|
|
673
|
+
gradient: gradient2,
|
|
674
|
+
colorMap,
|
|
675
|
+
warnings
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
if (input.gradient) {
|
|
679
|
+
const gradient2 = buildPerceptualGradient(input.gradient, options);
|
|
680
|
+
warnings.push(...metricWarnings(gradient2, targetDeltaE));
|
|
681
|
+
return {
|
|
682
|
+
algorithm: "perceptual_lerp_delta_e2000",
|
|
683
|
+
source: "gradient",
|
|
684
|
+
scientific: input.scientific ?? false,
|
|
685
|
+
targetDeltaE,
|
|
686
|
+
dampening: options.dampening ?? DEFAULT_DAMPENING,
|
|
687
|
+
gradient: gradient2,
|
|
688
|
+
warnings
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
const palette = buildPerceptualPalette(input.palette ?? SCIENTIFIC_COLOR_MAPS.viridis, options);
|
|
692
|
+
const shouldSamplePalette = input.steps !== void 0 && input.steps > palette.colors.length;
|
|
693
|
+
const gradient = shouldSamplePalette ? buildPerceptualGradient(palette.colors, options) : void 0;
|
|
694
|
+
warnings.push(...metricWarnings(gradient ?? palette, targetDeltaE));
|
|
695
|
+
return {
|
|
696
|
+
algorithm: "perceptual_lerp_delta_e2000",
|
|
697
|
+
source: "palette",
|
|
698
|
+
scientific: input.scientific ?? false,
|
|
699
|
+
targetDeltaE,
|
|
700
|
+
dampening: options.dampening ?? DEFAULT_DAMPENING,
|
|
701
|
+
palette,
|
|
702
|
+
gradient,
|
|
703
|
+
warnings
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
var SCIENTIFIC_COLOR_MAPS;
|
|
707
|
+
var init_PerceptualColorPass = __esm({
|
|
708
|
+
"src/compiler/PerceptualColorPass.ts"() {
|
|
709
|
+
init_color();
|
|
710
|
+
SCIENTIFIC_COLOR_MAPS = {
|
|
711
|
+
viridis: ["#440154", "#3b528b", "#21918c", "#5ec962", "#fde725"],
|
|
712
|
+
plasma: ["#0d0887", "#7e03a8", "#cc4778", "#f89540", "#f0f921"],
|
|
713
|
+
magma: ["#000004", "#3b0f70", "#8c2981", "#de4968", "#fcfdbf"],
|
|
714
|
+
inferno: ["#000004", "#420a68", "#932667", "#dd513a", "#fcffa4"],
|
|
715
|
+
cividis: ["#00204c", "#31456b", "#666970", "#a69c75", "#ffe945"],
|
|
716
|
+
turbo: ["#30123b", "#466be3", "#1bcfd4", "#a4fc3c", "#faba39", "#7a0403"],
|
|
717
|
+
thermal: ["#102040", "#1f77b4", "#31a354", "#ffbf00", "#d62728"]
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
export { DAMPENING_OFF, DEFAULT_DAMPENING, DEFAULT_LANL_GRAY_NOISE, LANL_GRAY_ACHROMATIC_AGGREGATES, LANL_GRAY_ACHROMATIC_SOURCE, SCIENTIFIC_COLOR_MAPS, analyzePerceptualColor, applyPerceptualColorPass, arcLengthDeltaE2000, buildPerceptualGradient, buildPerceptualPalette, chroma, dampen, deltaE2000, fitLanlGrayAchromaticModel, hexToSrgb, hue, init_PerceptualColorPass, init_color, labMetricQuadraticForm, labToSrgb, labToXyz, lanlGrayChoiceProbability, lanlGrayMeanAccuracy, lanlGrayNegativeLogLikelihood, lightness, linearRgbToXyz, linearToSrgb, linearToSrgbChannel, metricTensorArcLengthDeltaE2000, metricTensorDeltaE2000, nearestNeutral, normalizeHexColor, perceptualDistance, perceptualLerp, solveDeltaE2000Geodesic, srgbToHex, srgbToLab, srgbToLinear, srgbToLinearChannel, xyzToLab, xyzToLinearRgb };
|
|
723
|
+
//# sourceMappingURL=chunk-UCVZXQ63.js.map
|
|
724
|
+
//# sourceMappingURL=chunk-UCVZXQ63.js.map
|