455 lines
86 KiB
JavaScript
455 lines
86 KiB
JavaScript
import{M as j,G as Ot,C as se,P as re,V,a as dt,b as q,S as oe,B as ae,c as le,d as ce,e as he,f as ue,g as Pt,A as de,W as pe,h as bt}from"./threejs-881f862e.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function i(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(s){if(s.ep)return;s.ep=!0;const r=i(s);fetch(s.href,r)}})();function Dt(e){const t=e.length;for(let i=t-2;i>=0;i--)if(e[i]<e[i+1]){for(let n=t-1;n>=0;n--)if(e[i]<e[n]){const s=e[i];e[i]=e[n],e[n]=s;const r=e.slice(i+1);r.reverse();for(let o=0;o<r.length;o++)e[i+1+o]=r[o];return Math.floor(r.length/2)+1}console.log("Shouldn't get here"),process.exit()}return!1}function fe(e){e.sort();const t=[[...e]];for(;Dt(e)>0;)t.push([...e]);return t}function ge(e){e.sort();let t="even";const i=[[...e]];let n=!0;for(;n;){const s=Dt(e);s?(t==="even"?s%2===1&&(t="odd"):s%2===1&&(t="even"),t==="even"&&i.push([...e])):n=!1}return i}function me(e,t){const i=[],n=e.map(s=>s?[-s,s]:[0]);for(const s of n[0])for(const r of n[1])for(const o of n[2])for(const a of n[3])i.push({label:t,x:s,y:r,z:o,w:a});return i}function S(e,t,i=!1){const n=i?ge(e):fe(e),s=[];for(const r of n){const o=me(r,t);s.push(...o)}return s}const At={1:[27,38,48,49,61,68,74,87,95,98,105,120,126,131,140,149,156,165,174,179,185,200,207,210,218,223,226,231,234,239,241,248,252,253,258,263,265,272,274,279,284,285,289,296,300,301,306,311,313,320,324,325,331,334,339,342,347,350,356,357,362,367,369,376,378,383,388,389,393,400,403,406,413,414,419,420,425,427,438,440,444,448,449,453,458,460,469,471,473,474,487,488,490,494,499,503,511,512,513,514,525,527,530,532,539,543,546,550,555,558,563,566,572,573,580,581,585,592,593,600],2:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,28,30,31,34,35,37,40,41,44,46,47,50,51,53,56,57,60,62,63,66,67,69,72,73,76,78,79,82,83,85,88,90,91,93,96,97,100,102,103,106,107,109,112,113,116,118,119,122,123,125,128,129,132,134,135,138,139,141,144,145,148,150,151,154,155,157,160,161,164,166,167,170,171,173,176,177,180,182,183,186,187,189,192,193,196,198,199,202,203,205,208,209,212,214,215],3:[26,39,45,52,64,65,75,86,94,99,108,117,127,130,137,152,153,168,175,178,188,197,206,211,219,222,227,230,235,238,244,245,251,254,257,264,268,269,273,280,283,286,292,293,299,302,305,312,316,317,321,328,330,335,338,343,348,349,355,358,363,366,370,375,377,384,385,392,394,399,404,405,415,416,417,418,426,428,437,439,441,445,452,456,457,459,470,472,475,476,485,486,491,495,498,502,509,510,515,516,526,528,529,531,538,542,547,551,554,559,562,567,569,576,577,584,588,589,596,597],4:[32,33,43,54,58,71,77,84,92,101,110,115,121,136,143,146,159,162,169,184,190,195,204,213,220,221,228,229,236,237,242,247,249,256,260,261,266,271,276,277,281,288,290,295,297,304,308,309,315,318,322,327,329,336,340,341,346,351,354,359,361,368,371,374,379,382,387,390,396,397,401,408,409,410,423,424,430,432,433,435,443,447,450,454,461,463,466,468,477,478,483,484,489,493,500,504,507,508,517,518,522,524,533,535,540,544,545,549,553,560,561,568,570,575,578,583,587,590,595,598],5:[29,36,42,55,59,70,80,81,89,104,111,114,124,133,142,147,158,163,172,181,191,194,201,216,217,224,225,232,233,240,243,246,250,255,259,262,267,270,275,278,282,287,291,294,298,303,307,310,314,319,323,326,332,333,337,344,345,352,353,360,364,365,372,373,380,381,386,391,395,398,402,407,411,412,421,422,429,431,434,436,442,446,451,455,462,464,465,467,479,480,481,482,492,496,497,501,505,506,519,520,521,523,534,536,537,541,548,552,556,557,564,565,571,574,579,582,586,591,594,599]},be={tetras:{},cell5s:{1:[27,28,264,309,275],2:[223,76,238,84,225],3:[253,44,283,304,42],4:[419,112,197,578,521],5:[339,14,384,382,337],6:[331,4,335,390,386],7:[427,160,551,146,557],8:[265,60,64,295,246],9:[473,100,495,213,462],10:[393,6,328,397,326],11:[539,164,439,561,142],12:[511,122,456,595,181],13:[555,154,152,545,429],14:[95,202,486,500,465],15:[471,208,502,484,89],16:[347,21,348,374,373],17:[487,203,94,468,497],18:[165,139,542,568,434],19:[367,18,355,368,353],20:[231,78,86,236,217],21:[356,17,366,354,365],22:[503,205,470,92,481],23:[527,106,584,195,421],24:[239,73,222,228,81],25:[543,138,168,435,565],26:[48,46,302,281,255],27:[248,62,293,58,267],28:[440,141,562,540,163],29:[274,30,312,261,29],30:[179,128,597,450,505],31:[376,22,375,346,345],32:[320,11,405,401,319],33:[448,173,130,587,519],34:[460,102,211,489,479],35:[388,2,392,329,333],36:[512,182,596,121,455],37:[592,170,516,443,133],38:[120,189,529,570,411],39:[420,198,577,522,111],40:[272,69,65,290,243],41:[488,93,498,204,467],42:[156,150,547,553,431],43:[252,53,286,297,55],44:[532,192,117,410,571],45:[400,7,321,396,323],46:[580,199,417,110,523],47:[296,63,245,266,59],48:[600,125,178,508,451],49:[68,72,269,242,291],50:[324,8,399,322,395],51:[499,96,485,466,201],52:[406,12,317,318,402],53:[563,144,437,162,537],54:[234,88,219,229,80],55:[350,24,349,371,372],56:[444,134,515,169,591],57:[258,40,39,277,307],58:[285,56,251,54,298],59:[546,151,153,430,556],60:[98,215,475,493,464],61:[474,214,99,461,496],62:[357,20,363,359,364],63:[490,212,459,101,480],64:[185,116,415,533,574],65:[378,16,343,341,380],66:[218,85,235,77,232],67:[342,15,377,379,344],68:[458,209,491,477,104],69:[514,135,441,590,172],70:[226,83,75,237,224],71:[530,119,569,190,412],72:[38,37,257,308,278],73:[414,113,188,575,536],74:[362,19,358,361,360],75:[334,1,330,387,391],76:[438,161,538,143,564],77:[550,157,426,560,147],78:[566,167,137,544,436],79:[126,177,452,507,599],80:[284,41,254,43,303],81:[494,97,476,463,216],82:[200,109,418,524,579],83:[263,25,26,276,310],84:[300,50,52,249,287],85:[558,145,428,159,552],86:[403,9,316,315,407],87:[74,82,227,221,240],88:[289,66,244,271,70],89:[306,34,280,33,259],90:[572,118,531,409,191],91:[207,90,472,483,501],92:[369,23,370,351,352],93:[585,132,175,517,446],94:[105,196,528,583,422],95:[241,67,292,71,270],96:[425,148,559,549,158],97:[525,193,108,423,582],98:[174,129,588,447,520],99:[313,10,404,408,314],100:[413,187,576,535,114],101:[573,186,416,115,534],102:[49,51,299,288,250],103:[449,180,127,598,506],104:[469,91,206,504,482],105:[513,171,589,136,442],106:[279,35,305,260,36],107:[389,3,385,336,332],108:[593,183,509,454,124],109:[149,155,554,432,548],110:[325,5,394,327,398],111:[453,123,510,184,594],112:[383,13,338,340,381],113:[311,31,273,32,262],114:[581,107,526,424,194],115:[61,57,268,247,294],116:[87,79,230,220,233],117:[301,47,45,256,282],118:[131,176,445,518,586],119:[210,103,457,478,492],120:[140,166,567,433,541]}},ve={"2,0,0,0":1,"0,2,0,0":1,"0,0,2,0":1,"0,0,0,2":1,"1,1,1,1":1,"1,1,-1,-1":1,"1,-1,1,-1":1,"1,-1,-1,1":1,"1,-1,-1,-1":1,"1,-1,1,1":1,"1,1,-1,1":1,"1,1,1,-1":1,"k,0,-t,-1":2,"0,k,1,-t":2,"t,-1,k,0":2,"1,t,0,k":2,"t,k,0,-1":2,"1,0,k,t":2,"k,-t,-1,0":2,"0,1,-t,k":2,"1,k,t,0":2,"t,0,-1,k":2,"0,t,-k,-1":2,"k,-1,0,-t":2,"t,0,1,k":3,"0,t,-k,1":3,"1,-k,-t,0":3,"k,1,0,-t":3,"0,k,1,t":3,"t,1,-k,0":3,"k,0,t,-1":3,"1,-t,0,k":3,"t,-k,0,-1":3,"0,1,-t,-k":3,"1,0,-k,t":3,"k,t,1,0":3,"t,0,-1,-k":4,"0,t,k,-1":4,"1,-k,t,0":4,"k,1,0,t":4,"t,1,k,0":4,"0,k,-1,-t":4,"1,-t,0,-k":4,"k,0,-t,1":4,"0,1,t,k":4,"t,-k,0,1":4,"k,t,-1,0":4,"1,0,k,-t":4,"k,0,t,1":5,"0,k,-1,t":5,"t,-1,-k,0":5,"1,t,0,-k":5,"1,0,-k,-t":5,"t,k,0,1":5,"0,1,t,-k":5,"k,-t,1,0":5,"t,0,1,-k":5,"1,k,-t,0":5,"k,-1,0,t":5,"0,t,k,1":5};function Q(e,t){let i=1;for(const n of e)n.id=i,i++}function tt(e,t){for(const i of e)for(const n of["x","y","z","w"])i[n]=t*i[n]}function ye(e,t){return(e.x-t.x)**2+(e.y-t.y)**2+(e.z-t.z)**2+(e.w-t.w)**2}function T(e,t,i=!1){const n={};e.length;const s=[];let r=1;for(const o of e){const a=[];for(const u of e)a.push({d2:ye(o,u),id:u.id});a.sort((u,l)=>u.d2-l.d2);const c=a.slice(1,t+1);i&&(console.log(`closest = ${c.length}`),console.log(c));for(const u of c){const l=[o.id,u.id];l.sort();const h=l.join(",");n[h]||(n[h]=!0,s.push({id:r,label:0,source:o.id,target:u.id}),r++)}}return i&&console.log(`Found ${s.length} edges`),s}const we=()=>{const e=Math.sqrt(5)/4;return{name:"5-cell",nodes:[{id:1,label:1,x:e,y:e,z:e,w:-.25},{id:2,label:2,x:e,y:-e,z:-e,w:-.25},{id:3,label:3,x:-e,y:e,z:-e,w:-.25},{id:4,label:4,x:-e,y:-e,z:e,w:-.25},{id:5,label:5,x:0,y:0,z:0,w:1}],links:[{id:1,source:1,target:2},{id:2,source:1,target:3},{id:3,source:1,target:4},{id:4,source:1,target:5},{id:5,source:2,target:3},{id:6,source:2,target:4},{id:7,source:2,target:5},{id:8,source:3,target:4},{id:9,source:3,target:5},{id:10,source:4,target:5}],options:[{name:"--"}],description:`Five tetrahedra joined at ten faces with three
|
|
tetrahedra around each edge. The 5-cell is the simplest regular
|
|
four-D polytope and the four-dimensional analogue of the tetrahedron.
|
|
A corresponding polytope, or simplex, exists for every n-dimensional
|
|
space.`}},ke=()=>{let e=S([1,1,1,1],0);e=e.filter(i=>i.x*i.y*i.z*i.w>0),e[0].label=1,e[3].label=2,e[5].label=3,e[6].label=4,e[7].label=1,e[4].label=2,e[2].label=3,e[1].label=4,Q(e),tt(e,.5);const t=T(e,6);return{name:"16-cell",nodes:e,links:t,options:[{name:"--"}],description:`Sixteen tetrahedra joined at 32 faces with four
|
|
tetrahedra around each edge. The 16-cell is the four-dimensional
|
|
analogue of the octahedron and is dual to the tesseract. Every
|
|
n-dimensional space has a corresponding polytope in this family.`}},xe=()=>{const e=S([1,1,1,1],0);Q(e);for(const i of e)i.x*i.y*i.z*i.w>0?i.label=2:i.label=1;tt(e,.5);const t=T(e,4);t.map(i=>{i.label=0});for(const i of[1,2]){const n=e.filter(r=>r.label===i),s=T(n,6);s.map(r=>r.label=i),t.push(...s)}return{name:"Tesseract",nodes:e,links:t,options:[{name:"none",links:[0]},{name:"one 16-cell",links:[0,1]},{name:"both 16-cells",links:[0,1,2]}],description:`The most well-known four-dimensional shape, the
|
|
tesseract is analogous to the cube, and is constructed by placing two
|
|
cubes in parallel hyperplanes and joining their corresponding
|
|
vertices. It consists of eight cubes joined at 32 face with three
|
|
cubes around each edge, and is dual to the 16-cell. Every
|
|
n-dimensional space has a cube analogue or measure polytope.`}},_e={x:{y:1,z:3,w:2},y:{z:2,w:3},z:{w:1}},Ae=()=>{const e=S([0,0,1,1],0);for(const i of e){const n=["x","y","z","w"].filter(s=>i[s]!==0);i.label=_e[n[0]][n[1]]}tt(e,Math.sqrt(2)/2),Q(e);const t=T(e,8);t.map(i=>i.label=0);for(const i of[1,2,3]){const n=e.filter(r=>r.label===i),s=T(n,6);s.map(r=>r.label=i),t.push(...s)}return{name:"24-cell",nodes:e,links:t,base:{},options:[{name:"none",links:[0]},{name:"one 16-cell",links:[0,1]},{name:"three 16-cells",links:[0,1,2,3]}],description:`A unique object without an exact analogue in higher
|
|
or lower dimensions, the 24-cell is made of twenty-four octahedra
|
|
joined at 96 faces, with three around each edge. The 24-cell is
|
|
self-dual.`}};function Ee(){const e=.5*(1+Math.sqrt(5)),t=Math.sqrt(5),i=e*e,n=1/e,s=1/i,r=[S([0,0,2,2],0),S([1,1,1,t],0),S([e,e,e,s],0),S([n,n,n,i],0),S([i,s,1,0],0,!0),S([t,n,e,0],0,!0),S([2,1,e,n],0,!0)].flat();return Q(r),tt(r,.25*Math.sqrt(2)),r}function Ce(e,t,i){e.filter(n=>t.includes(n.id)).map(n=>n.label=i)}const Me=()=>{const e=Ee(),t=T(e,4);for(const n in At)Ce(e,At[n],Number(n));t.map(n=>n.label=0);for(const n of[1,2,3,4,5]){const s=e.filter(o=>o.label===n),r=T(s,12);r.map(o=>o.label=n),t.push(...r)}const i=be.cell5s;for(const n in i){const s=e.filter(o=>i[n].includes(o.id)),r=T(s,5);r.map(o=>o.label=8),t.push(...r)}return{name:"120-cell",nodes:e,links:t,options:[{name:"none",links:[0]},{name:"one inscribed 600-cell",links:[0,1]},{name:"five inscribed 600-cells",links:[0,1,2,3,4,5]},{name:"120 inscribed 5-cells",links:[0,8]}],description:`The 120-cell is the four-dimensional analogue of the
|
|
dodecahedron, and consists of 120 dodecahedra joined at 720 faces,
|
|
with three dodecahedra around each edge. It is dual to the 600-cell,
|
|
and five 600-cells can be inscribed in its vertices. The converse
|
|
of this allows 120 5-cells (each of which has one vertex in each
|
|
of the 5 600-cells) to be inscribed in the 120-cell.`}};function $e(e,t,i){const n=i?-e:e;return n>=0?t[n]:"-"+t[-n]}function Et(e,t,i){return["x","y","z","w"].map(r=>$e(e[r],t,i)).join(",")}function Se(e,t,i){const n=Et(e,t,!1);if(n in i)return i[n];{const s=Et(e,t,!0);return s in i?i[s]:(console.log(`Map for ${n} ${s} not found`),0)}}function Fe(e,t,i){return e>=0?i[t[e]]:-i[t[-e]]}function Le(){const e={0:"0",1:"1",2:"2",3:"t",4:"k"},t=.5*(1+Math.sqrt(5)),i={0:0,1:1,2:2,t,k:1/t},n=[S([0,0,0,2],0),S([1,1,1,1],0),S([3,1,4,0],0,!0)].flat();for(const s of n)s.label=Se(s,e,ve);for(const s of n)for(const r of["x","y","z","w"])s[r]=Fe(s[r],e,i);return Q(n),tt(n,.5),n}const ze=()=>{const e=Le(),t=T(e,12);t.map(i=>i.label=0);for(const i of[1,2,3,4,5]){const n=e.filter(r=>r.label===i),s=T(n,8);s.map(r=>r.label=i),t.push(...s)}return{name:"600-cell",nodes:e,links:t,options:[{name:"none",links:[0]},{name:"one 24-cell",links:[0,1]},{name:"five 24-cells",links:[0,1,2,3,4,5]}],description:`The 600-cell is the four-dimensional analogue of the
|
|
icosahedron, and consists of 600 tetrahedra joined at 1200 faces
|
|
with five tetrahedra around each edge. It is dual to the 120-cell.
|
|
Its 120 vertices can be partitioned into five sets which form the
|
|
vertices of five inscribed 24-cells.`}},Oe=()=>[we(),ke(),xe(),Ae(),ze(),Me()];function Pe(e){const t=Math.cos(e),i=Math.sin(e);return new j(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1)}function De(e){const t=Math.cos(e),i=Math.sin(e);return new j(t,0,-i,0,0,1,0,0,i,0,t,0,0,0,0,1)}function Te(e){const t=Math.cos(e),i=Math.sin(e);return new j(t,0,0,-i,0,1,0,0,0,0,1,0,i,0,0,t)}function Ie(e){const t=Math.cos(e),i=Math.sin(e);return new j(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1)}function Ve(e){const t=Math.cos(e),i=Math.sin(e);return new j(1,0,0,0,0,t,0,-i,0,0,1,0,0,i,0,t)}function Re(e){const t=Math.cos(e),i=Math.sin(e);return new j(1,0,0,0,0,1,0,0,0,0,t,-i,0,0,i,t)}const Ct={XY:Re,XZ:Ve,XW:Ie,YZ:Te,YW:De,ZW:Pe};/**
|
|
* lil-gui
|
|
* https://lil-gui.georgealways.com
|
|
* @version 0.19.0
|
|
* @author George Michael Brower
|
|
* @license MIT
|
|
*/class I{constructor(t,i,n,s,r="div"){this.parent=t,this.object=i,this.property=n,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(r),this.domElement.classList.add("controller"),this.domElement.classList.add(s),this.$name=document.createElement("div"),this.$name.classList.add("name"),I.nextNameID=I.nextNameID||0,this.$name.id=`lil-gui-name-${++I.nextNameID}`,this.$widget=document.createElement("div"),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.domElement.addEventListener("keydown",o=>o.stopPropagation()),this.domElement.addEventListener("keyup",o=>o.stopPropagation()),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(n)}name(t){return this._name=t,this.$name.innerHTML=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled?this:(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t),this)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(t){const i=this.parent.add(this.object,this.property,t);return i.name(this._name),this.destroy(),i}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.object[this.property]=t,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class He extends I{constructor(t,i,n){super(t,i,n,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function pt(e){let t,i;return(t=e.match(/(#|0x)?([a-f0-9]{6})/i))?i=t[2]:(t=e.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?i=parseInt(t[1]).toString(16).padStart(2,0)+parseInt(t[2]).toString(16).padStart(2,0)+parseInt(t[3]).toString(16).padStart(2,0):(t=e.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(i=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),i?"#"+i:!1}const Ne={isPrimitive:!0,match:e=>typeof e=="string",fromHexString:pt,toHexString:pt},K={isPrimitive:!0,match:e=>typeof e=="number",fromHexString:e=>parseInt(e.substring(1),16),toHexString:e=>"#"+e.toString(16).padStart(6,0)},Be={isPrimitive:!1,match:e=>Array.isArray(e),fromHexString(e,t,i=1){const n=K.fromHexString(e);t[0]=(n>>16&255)/255*i,t[1]=(n>>8&255)/255*i,t[2]=(n&255)/255*i},toHexString([e,t,i],n=1){n=255/n;const s=e*n<<16^t*n<<8^i*n<<0;return K.toHexString(s)}},Ye={isPrimitive:!1,match:e=>Object(e)===e,fromHexString(e,t,i=1){const n=K.fromHexString(e);t.r=(n>>16&255)/255*i,t.g=(n>>8&255)/255*i,t.b=(n&255)/255*i},toHexString({r:e,g:t,b:i},n=1){n=255/n;const s=e*n<<16^t*n<<8^i*n<<0;return K.toHexString(s)}},Ge=[Ne,K,Be,Ye];function je(e){return Ge.find(t=>t.match(e))}class Xe extends I{constructor(t,i,n,s){super(t,i,n,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=je(this.initialValue),this._rgbScale=s,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const r=pt(this.$text.value);r&&this._setValueFromHexString(r)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){const i=this._format.fromHexString(t);this.setValue(i)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class ht extends I{constructor(t,i,n){super(t,i,n,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",s=>{s.preventDefault(),this.getValue().call(this.object),this._callOnChange()}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class Ue extends I{constructor(t,i,n,s,r,o){super(t,i,n,"number"),this._initInput(),this.min(s),this.max(r);const a=o!==void 0;this.step(a?o:this._getImplicitStep(),a),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,i=!0){return this._step=t,this._stepExplicit=i,this}updateDisplay(){const t=this.getValue();if(this._hasSlider){let i=(t-this._min)/(this._max-this._min);i=Math.max(0,Math.min(i,1)),this.$fill.style.width=i*100+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;const i=()=>{let f=parseFloat(this.$input.value);isNaN(f)||(this._stepExplicit&&(f=this._snap(f)),this.setValue(this._clamp(f)))},n=f=>{const b=parseFloat(this.$input.value);isNaN(b)||(this._snapClampSetValue(b+f),this.$input.value=this.getValue())},s=f=>{f.key==="Enter"&&this.$input.blur(),f.code==="ArrowUp"&&(f.preventDefault(),n(this._step*this._arrowKeyMultiplier(f))),f.code==="ArrowDown"&&(f.preventDefault(),n(this._step*this._arrowKeyMultiplier(f)*-1))},r=f=>{this._inputFocused&&(f.preventDefault(),n(this._step*this._normalizeMouseWheel(f)))};let o=!1,a,c,u,l,h;const d=5,g=f=>{a=f.clientX,c=u=f.clientY,o=!0,l=this.getValue(),h=0,window.addEventListener("mousemove",v),window.addEventListener("mouseup",w)},v=f=>{if(o){const b=f.clientX-a,k=f.clientY-c;Math.abs(k)>d?(f.preventDefault(),this.$input.blur(),o=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(b)>d&&w()}if(!o){const b=f.clientY-u;h-=b*this._step*this._arrowKeyMultiplier(f),l+h>this._max?h=this._max-l:l+h<this._min&&(h=this._min-l),this._snapClampSetValue(l+h)}u=f.clientY},w=()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",w)},y=()=>{this._inputFocused=!0},p=()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()};this.$input.addEventListener("input",i),this.$input.addEventListener("keydown",s),this.$input.addEventListener("wheel",r,{passive:!1}),this.$input.addEventListener("mousedown",g),this.$input.addEventListener("focus",y),this.$input.addEventListener("blur",p)}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const t=(p,f,b,k,E)=>(p-f)/(b-f)*(E-k)+k,i=p=>{const f=this.$slider.getBoundingClientRect();let b=t(p,f.left,f.right,this._min,this._max);this._snapClampSetValue(b)},n=p=>{this._setDraggingStyle(!0),i(p.clientX),window.addEventListener("mousemove",s),window.addEventListener("mouseup",r)},s=p=>{i(p.clientX)},r=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",r)};let o=!1,a,c;const u=p=>{p.preventDefault(),this._setDraggingStyle(!0),i(p.touches[0].clientX),o=!1},l=p=>{p.touches.length>1||(this._hasScrollBar?(a=p.touches[0].clientX,c=p.touches[0].clientY,o=!0):u(p),window.addEventListener("touchmove",h,{passive:!1}),window.addEventListener("touchend",d))},h=p=>{if(o){const f=p.touches[0].clientX-a,b=p.touches[0].clientY-c;Math.abs(f)>Math.abs(b)?u(p):(window.removeEventListener("touchmove",h),window.removeEventListener("touchend",d))}else p.preventDefault(),i(p.touches[0].clientX)},d=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",h),window.removeEventListener("touchend",d)},g=this._callOnFinishChange.bind(this),v=400;let w;const y=p=>{if(Math.abs(p.deltaX)<Math.abs(p.deltaY)&&this._hasScrollBar)return;p.preventDefault();const b=this._normalizeMouseWheel(p)*this._step;this._snapClampSetValue(this.getValue()+b),this.$input.value=this.getValue(),clearTimeout(w),w=setTimeout(g,v)};this.$slider.addEventListener("mousedown",n),this.$slider.addEventListener("touchstart",l,{passive:!1}),this.$slider.addEventListener("wheel",y,{passive:!1})}_setDraggingStyle(t,i="horizontal"){this.$slider&&this.$slider.classList.toggle("active",t),document.body.classList.toggle("lil-gui-dragging",t),document.body.classList.toggle(`lil-gui-${i}`,t)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(t){let{deltaX:i,deltaY:n}=t;return Math.floor(t.deltaY)!==t.deltaY&&t.wheelDelta&&(i=0,n=-t.wheelDelta/120,n*=this._stepExplicit?1:10),i+-n}_arrowKeyMultiplier(t){let i=this._stepExplicit?1:10;return t.shiftKey?i*=10:t.altKey&&(i/=10),i}_snap(t){const i=Math.round(t/this._step)*this._step;return parseFloat(i.toPrecision(15))}_clamp(t){return t<this._min&&(t=this._min),t>this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){const t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}}class We extends I{constructor(t,i,n,s){super(t,i,n,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.options(s)}options(t){return this._values=Array.isArray(t)?t:Object.values(t),this._names=Array.isArray(t)?t:Object.keys(t),this.$select.replaceChildren(),this._names.forEach(i=>{const n=document.createElement("option");n.innerHTML=i,this.$select.appendChild(n)}),this.updateDisplay(),this}updateDisplay(){const t=this.getValue(),i=this._values.indexOf(t);return this.$select.selectedIndex=i,this.$display.innerHTML=i===-1?t:this._names[i],this}}class qe extends I{constructor(t,i,n){super(t,i,n,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",s=>{s.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}const Ke=`.lil-gui {
|
|
font-family: var(--font-family);
|
|
font-size: var(--font-size);
|
|
line-height: 1;
|
|
font-weight: normal;
|
|
font-style: normal;
|
|
text-align: left;
|
|
color: var(--text-color);
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
touch-action: manipulation;
|
|
--background-color: #1f1f1f;
|
|
--text-color: #ebebeb;
|
|
--title-background-color: #111111;
|
|
--title-text-color: #ebebeb;
|
|
--widget-color: #424242;
|
|
--hover-color: #4f4f4f;
|
|
--focus-color: #595959;
|
|
--number-color: #2cc9ff;
|
|
--string-color: #a2db3c;
|
|
--font-size: 11px;
|
|
--input-font-size: 11px;
|
|
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
|
|
--font-family-mono: Menlo, Monaco, Consolas, "Droid Sans Mono", monospace;
|
|
--padding: 4px;
|
|
--spacing: 4px;
|
|
--widget-height: 20px;
|
|
--title-height: calc(var(--widget-height) + var(--spacing) * 1.25);
|
|
--name-width: 45%;
|
|
--slider-knob-width: 2px;
|
|
--slider-input-width: 27%;
|
|
--color-input-width: 27%;
|
|
--slider-input-min-width: 45px;
|
|
--color-input-min-width: 45px;
|
|
--folder-indent: 7px;
|
|
--widget-padding: 0 0 0 3px;
|
|
--widget-border-radius: 2px;
|
|
--checkbox-size: calc(0.75 * var(--widget-height));
|
|
--scrollbar-width: 5px;
|
|
}
|
|
.lil-gui, .lil-gui * {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
.lil-gui.root {
|
|
width: var(--width, 245px);
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: var(--background-color);
|
|
}
|
|
.lil-gui.root > .title {
|
|
background: var(--title-background-color);
|
|
color: var(--title-text-color);
|
|
}
|
|
.lil-gui.root > .children {
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
}
|
|
.lil-gui.root > .children::-webkit-scrollbar {
|
|
width: var(--scrollbar-width);
|
|
height: var(--scrollbar-width);
|
|
background: var(--background-color);
|
|
}
|
|
.lil-gui.root > .children::-webkit-scrollbar-thumb {
|
|
border-radius: var(--scrollbar-width);
|
|
background: var(--focus-color);
|
|
}
|
|
@media (pointer: coarse) {
|
|
.lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {
|
|
--widget-height: 28px;
|
|
--padding: 6px;
|
|
--spacing: 6px;
|
|
--font-size: 13px;
|
|
--input-font-size: 16px;
|
|
--folder-indent: 10px;
|
|
--scrollbar-width: 7px;
|
|
--slider-input-min-width: 50px;
|
|
--color-input-min-width: 65px;
|
|
}
|
|
}
|
|
.lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {
|
|
--widget-height: 28px;
|
|
--padding: 6px;
|
|
--spacing: 6px;
|
|
--font-size: 13px;
|
|
--input-font-size: 16px;
|
|
--folder-indent: 10px;
|
|
--scrollbar-width: 7px;
|
|
--slider-input-min-width: 50px;
|
|
--color-input-min-width: 65px;
|
|
}
|
|
.lil-gui.autoPlace {
|
|
max-height: 100%;
|
|
position: fixed;
|
|
top: 0;
|
|
right: 15px;
|
|
z-index: 1001;
|
|
}
|
|
|
|
.lil-gui .controller {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 var(--padding);
|
|
margin: var(--spacing) 0;
|
|
}
|
|
.lil-gui .controller.disabled {
|
|
opacity: 0.5;
|
|
}
|
|
.lil-gui .controller.disabled, .lil-gui .controller.disabled * {
|
|
pointer-events: none !important;
|
|
}
|
|
.lil-gui .controller > .name {
|
|
min-width: var(--name-width);
|
|
flex-shrink: 0;
|
|
white-space: pre;
|
|
padding-right: var(--spacing);
|
|
line-height: var(--widget-height);
|
|
}
|
|
.lil-gui .controller .widget {
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
width: 100%;
|
|
min-height: var(--widget-height);
|
|
}
|
|
.lil-gui .controller.string input {
|
|
color: var(--string-color);
|
|
}
|
|
.lil-gui .controller.boolean {
|
|
cursor: pointer;
|
|
}
|
|
.lil-gui .controller.color .display {
|
|
width: 100%;
|
|
height: var(--widget-height);
|
|
border-radius: var(--widget-border-radius);
|
|
position: relative;
|
|
}
|
|
@media (hover: hover) {
|
|
.lil-gui .controller.color .display:hover:before {
|
|
content: " ";
|
|
display: block;
|
|
position: absolute;
|
|
border-radius: var(--widget-border-radius);
|
|
border: 1px solid #fff9;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
}
|
|
}
|
|
.lil-gui .controller.color input[type=color] {
|
|
opacity: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
cursor: pointer;
|
|
}
|
|
.lil-gui .controller.color input[type=text] {
|
|
margin-left: var(--spacing);
|
|
font-family: var(--font-family-mono);
|
|
min-width: var(--color-input-min-width);
|
|
width: var(--color-input-width);
|
|
flex-shrink: 0;
|
|
}
|
|
.lil-gui .controller.option select {
|
|
opacity: 0;
|
|
position: absolute;
|
|
width: 100%;
|
|
max-width: 100%;
|
|
}
|
|
.lil-gui .controller.option .display {
|
|
position: relative;
|
|
pointer-events: none;
|
|
border-radius: var(--widget-border-radius);
|
|
height: var(--widget-height);
|
|
line-height: var(--widget-height);
|
|
max-width: 100%;
|
|
overflow: hidden;
|
|
word-break: break-all;
|
|
padding-left: 0.55em;
|
|
padding-right: 1.75em;
|
|
background: var(--widget-color);
|
|
}
|
|
@media (hover: hover) {
|
|
.lil-gui .controller.option .display.focus {
|
|
background: var(--focus-color);
|
|
}
|
|
}
|
|
.lil-gui .controller.option .display.active {
|
|
background: var(--focus-color);
|
|
}
|
|
.lil-gui .controller.option .display:after {
|
|
font-family: "lil-gui";
|
|
content: "↕";
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
padding-right: 0.375em;
|
|
}
|
|
.lil-gui .controller.option .widget,
|
|
.lil-gui .controller.option select {
|
|
cursor: pointer;
|
|
}
|
|
@media (hover: hover) {
|
|
.lil-gui .controller.option .widget:hover .display {
|
|
background: var(--hover-color);
|
|
}
|
|
}
|
|
.lil-gui .controller.number input {
|
|
color: var(--number-color);
|
|
}
|
|
.lil-gui .controller.number.hasSlider input {
|
|
margin-left: var(--spacing);
|
|
width: var(--slider-input-width);
|
|
min-width: var(--slider-input-min-width);
|
|
flex-shrink: 0;
|
|
}
|
|
.lil-gui .controller.number .slider {
|
|
width: 100%;
|
|
height: var(--widget-height);
|
|
background: var(--widget-color);
|
|
border-radius: var(--widget-border-radius);
|
|
padding-right: var(--slider-knob-width);
|
|
overflow: hidden;
|
|
cursor: ew-resize;
|
|
touch-action: pan-y;
|
|
}
|
|
@media (hover: hover) {
|
|
.lil-gui .controller.number .slider:hover {
|
|
background: var(--hover-color);
|
|
}
|
|
}
|
|
.lil-gui .controller.number .slider.active {
|
|
background: var(--focus-color);
|
|
}
|
|
.lil-gui .controller.number .slider.active .fill {
|
|
opacity: 0.95;
|
|
}
|
|
.lil-gui .controller.number .fill {
|
|
height: 100%;
|
|
border-right: var(--slider-knob-width) solid var(--number-color);
|
|
box-sizing: content-box;
|
|
}
|
|
|
|
.lil-gui-dragging .lil-gui {
|
|
--hover-color: var(--widget-color);
|
|
}
|
|
.lil-gui-dragging * {
|
|
cursor: ew-resize !important;
|
|
}
|
|
|
|
.lil-gui-dragging.lil-gui-vertical * {
|
|
cursor: ns-resize !important;
|
|
}
|
|
|
|
.lil-gui .title {
|
|
height: var(--title-height);
|
|
line-height: calc(var(--title-height) - 4px);
|
|
font-weight: 600;
|
|
padding: 0 var(--padding);
|
|
-webkit-tap-highlight-color: transparent;
|
|
cursor: pointer;
|
|
outline: none;
|
|
text-decoration-skip: objects;
|
|
}
|
|
.lil-gui .title:before {
|
|
font-family: "lil-gui";
|
|
content: "▾";
|
|
padding-right: 2px;
|
|
display: inline-block;
|
|
}
|
|
.lil-gui .title:active {
|
|
background: var(--title-background-color);
|
|
opacity: 0.75;
|
|
}
|
|
@media (hover: hover) {
|
|
body:not(.lil-gui-dragging) .lil-gui .title:hover {
|
|
background: var(--title-background-color);
|
|
opacity: 0.85;
|
|
}
|
|
.lil-gui .title:focus {
|
|
text-decoration: underline var(--focus-color);
|
|
}
|
|
}
|
|
.lil-gui.root > .title:focus {
|
|
text-decoration: none !important;
|
|
}
|
|
.lil-gui.closed > .title:before {
|
|
content: "▸";
|
|
}
|
|
.lil-gui.closed > .children {
|
|
transform: translateY(-7px);
|
|
opacity: 0;
|
|
}
|
|
.lil-gui.closed:not(.transition) > .children {
|
|
display: none;
|
|
}
|
|
.lil-gui.transition > .children {
|
|
transition-duration: 300ms;
|
|
transition-property: height, opacity, transform;
|
|
transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);
|
|
overflow: hidden;
|
|
pointer-events: none;
|
|
}
|
|
.lil-gui .children:empty:before {
|
|
content: "Empty";
|
|
padding: 0 var(--padding);
|
|
margin: var(--spacing) 0;
|
|
display: block;
|
|
height: var(--widget-height);
|
|
font-style: italic;
|
|
line-height: var(--widget-height);
|
|
opacity: 0.5;
|
|
}
|
|
.lil-gui.root > .children > .lil-gui > .title {
|
|
border: 0 solid var(--widget-color);
|
|
border-width: 1px 0;
|
|
transition: border-color 300ms;
|
|
}
|
|
.lil-gui.root > .children > .lil-gui.closed > .title {
|
|
border-bottom-color: transparent;
|
|
}
|
|
.lil-gui + .controller {
|
|
border-top: 1px solid var(--widget-color);
|
|
margin-top: 0;
|
|
padding-top: var(--spacing);
|
|
}
|
|
.lil-gui .lil-gui .lil-gui > .title {
|
|
border: none;
|
|
}
|
|
.lil-gui .lil-gui .lil-gui > .children {
|
|
border: none;
|
|
margin-left: var(--folder-indent);
|
|
border-left: 2px solid var(--widget-color);
|
|
}
|
|
.lil-gui .lil-gui .controller {
|
|
border: none;
|
|
}
|
|
|
|
.lil-gui label, .lil-gui input, .lil-gui button {
|
|
-webkit-tap-highlight-color: transparent;
|
|
}
|
|
.lil-gui input {
|
|
border: 0;
|
|
outline: none;
|
|
font-family: var(--font-family);
|
|
font-size: var(--input-font-size);
|
|
border-radius: var(--widget-border-radius);
|
|
height: var(--widget-height);
|
|
background: var(--widget-color);
|
|
color: var(--text-color);
|
|
width: 100%;
|
|
}
|
|
@media (hover: hover) {
|
|
.lil-gui input:hover {
|
|
background: var(--hover-color);
|
|
}
|
|
.lil-gui input:active {
|
|
background: var(--focus-color);
|
|
}
|
|
}
|
|
.lil-gui input:disabled {
|
|
opacity: 1;
|
|
}
|
|
.lil-gui input[type=text],
|
|
.lil-gui input[type=number] {
|
|
padding: var(--widget-padding);
|
|
}
|
|
.lil-gui input[type=text]:focus,
|
|
.lil-gui input[type=number]:focus {
|
|
background: var(--focus-color);
|
|
}
|
|
.lil-gui input[type=checkbox] {
|
|
appearance: none;
|
|
width: var(--checkbox-size);
|
|
height: var(--checkbox-size);
|
|
border-radius: var(--widget-border-radius);
|
|
text-align: center;
|
|
cursor: pointer;
|
|
}
|
|
.lil-gui input[type=checkbox]:checked:before {
|
|
font-family: "lil-gui";
|
|
content: "✓";
|
|
font-size: var(--checkbox-size);
|
|
line-height: var(--checkbox-size);
|
|
}
|
|
@media (hover: hover) {
|
|
.lil-gui input[type=checkbox]:focus {
|
|
box-shadow: inset 0 0 0 1px var(--focus-color);
|
|
}
|
|
}
|
|
.lil-gui button {
|
|
outline: none;
|
|
cursor: pointer;
|
|
font-family: var(--font-family);
|
|
font-size: var(--font-size);
|
|
color: var(--text-color);
|
|
width: 100%;
|
|
height: var(--widget-height);
|
|
text-transform: none;
|
|
background: var(--widget-color);
|
|
border-radius: var(--widget-border-radius);
|
|
border: none;
|
|
}
|
|
@media (hover: hover) {
|
|
.lil-gui button:hover {
|
|
background: var(--hover-color);
|
|
}
|
|
.lil-gui button:focus {
|
|
box-shadow: inset 0 0 0 1px var(--focus-color);
|
|
}
|
|
}
|
|
.lil-gui button:active {
|
|
background: var(--focus-color);
|
|
}
|
|
|
|
@font-face {
|
|
font-family: "lil-gui";
|
|
src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff");
|
|
}`;function Je(e){const t=document.createElement("style");t.innerHTML=e;const i=document.querySelector("head link[rel=stylesheet], head style");i?document.head.insertBefore(t,i):document.head.appendChild(t)}let Mt=!1;class vt{constructor({parent:t,autoPlace:i=t===void 0,container:n,width:s,title:r="Controls",closeFolders:o=!1,injectStyles:a=!0,touchStyles:c=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",u=>{(u.code==="Enter"||u.code==="Space")&&(u.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(r),this.parent){this.parent.children.push(this),this.parent.folders.push(this),this.parent.$children.appendChild(this.domElement);return}this.domElement.classList.add("root"),c&&this.domElement.classList.add("allow-touch-styles"),!Mt&&a&&(Je(Ke),Mt=!0),n?n.appendChild(this.domElement):i&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),s&&this.domElement.style.setProperty("--width",s+"px"),this._closeFolders=o}add(t,i,n,s,r){if(Object(n)===n)return new We(this,t,i,n);const o=t[i];switch(typeof o){case"number":return new Ue(this,t,i,n,s,r);case"boolean":return new He(this,t,i);case"string":return new qe(this,t,i);case"function":return new ht(this,t,i)}console.error(`gui.add failed
|
|
property:`,i,`
|
|
object:`,t,`
|
|
value:`,o)}addColor(t,i,n=1){return new Xe(this,t,i,n)}addFolder(t){const i=new vt({parent:this,title:t});return this.root._closeFolders&&i.close(),i}load(t,i=!0){return t.controllers&&this.controllers.forEach(n=>{n instanceof ht||n._name in t.controllers&&n.load(t.controllers[n._name])}),i&&t.folders&&this.folders.forEach(n=>{n._title in t.folders&&n.load(t.folders[n._title])}),this}save(t=!0){const i={controllers:{},folders:{}};return this.controllers.forEach(n=>{if(!(n instanceof ht)){if(n._name in i.controllers)throw new Error(`Cannot save GUI with duplicate property "${n._name}"`);i.controllers[n._name]=n.save()}}),t&&this.folders.forEach(n=>{if(n._title in i.folders)throw new Error(`Cannot save GUI with duplicate folder "${n._title}"`);i.folders[n._title]=n.save()}),i}open(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(t){this._closed!==t&&(this._closed=t,this._callOnOpenClose(this))}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const i=this.$children.clientHeight;this.$children.style.height=i+"px",this.domElement.classList.add("transition");const n=r=>{r.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",n))};this.$children.addEventListener("transitionend",n);const s=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame(()=>{this.$children.style.height=s+"px"})}),this}title(t){return this._title=t,this.$title.innerHTML=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(n=>n.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),this._onChange!==void 0&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onOpenClose(t){return this._onOpenClose=t,this}_callOnOpenClose(t){this.parent&&this.parent._callOnOpenClose(t),this._onOpenClose!==void 0&&this._onOpenClose.call(this,t)}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(i=>{t=t.concat(i.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(i=>{t=t.concat(i.foldersRecursive())}),t}}const rt={nodesize:.6,nodeopacity:1,linksize:1,linkopacity:.75,shape:"120-cell",link2opacity:.75,option:"none",visibility:5,inscribed:!1,inscribe_all:!1,color:3314601,background:13948116,hyperplane:.93,zoom:1,xRotate:"YZ",yRotate:"XZ",dtheta:0,damping:!1,captions:!0,dpsi:0};class Ze{constructor(t){this.shapes=t.shapes,this.gui=new vt;const i=this.shapes.map(o=>o.name);this.parseLinkParams();const n=this;if(this.params={shape:this.link.shape,option:this.link.option,inscribed:this.link.inscribed,inscribe_all:this.link.inscribe_all,linksize:this.link.linksize,linkopacity:this.link.linkopacity,link2opacity:this.link.link2opacity,nodesize:this.link.nodesize,nodeopacity:this.link.nodeopacity,depth:this.link.depth,color:this.link.color,background:this.link.background,hyperplane:this.link.hyperplane,zoom:this.link.zoom,xRotate:this.link.xRotate,yRotate:this.link.yRotate,damping:!1,captions:!0,dtheta:this.link.dtheta,dpsi:this.link.dpsi,"copy link":function(){n.copyUrl()}},t.extras)for(const o in t.extras)console.log(o),console.log(t.extras[o]),this.params[o]=t.extras[o];let s;this.gui.add(this.params,"shape",i).onChange(o=>{const a=this.getShapeOptions(o);s=s.options(a).onChange(c=>{t.setVisibility(c)}),s.setValue(a[0]),t.changeShape(o)});const r=this.getShapeOptions(this.params.shape);if(s=this.gui.add(this.params,"option").options(r).onChange(o=>{t.setVisibility(o)}),this.gui.add(this.params,"hyperplane",.5,1/.8),this.gui.add(this.params,"zoom",.1,2),this.gui.add(this.params,"nodesize",0,1.5),this.gui.add(this.params,"nodeopacity",0,1).onChange(t.setNodeOpacity),this.gui.add(this.params,"linksize",0,2),console.log(t.setLinkOpacity),this.gui.add(this.params,"linkopacity",0,1).onChange(o=>t.setLinkOpacity(o,!0)),this.gui.add(this.params,"link2opacity",0,1).onChange(o=>t.setLinkOpacity(o,!1)),this.gui.addColor(this.params,"color").onChange(t.setColor),this.gui.addColor(this.params,"background").onChange(t.setBackground),this.gui.add(this.params,"xRotate",["YW","YZ","ZW"]),this.gui.add(this.params,"yRotate",["XZ","XY","XW"]),this.gui.add(this.params,"captions").onChange(this.showDocs),this.gui.add(this.params,"damping"),this.gui.add(this.params,"copy link"),t.extras)for(const o in t.extras)this.gui.add(this.params,o)}getShapeOptions(t){const i=this.shapes.filter(n=>n.name===t);return i&&i[0].options?i[0].options.map(n=>n.name):[]}numParam(t,i){const n=this.urlParams.get(t);if(n){const s=i(n);if(s!==NaN)return s}return rt[t]}stringToHex(t){return parseInt("0x"+t.substr(1))}hexToString(t){return"#"+t.toString(16)}parseLinkParams(){this.linkUrl=new URL(window.location.toLocaleString()),this.link={};const t=this;this.urlParams=this.linkUrl.searchParams;for(const i of["shape","xRotate","yRotate","option"]){const n=this.urlParams.get(i);n?this.link[i]=n:this.link[i]=rt[i]}for(const i of["inscribed","inscribe_all"])this.link[i]=this.urlParams.get(i)==="y";this.link.hyperplane=this.numParam("hyperplane",parseFloat),this.link.zoom=this.numParam("zoom",parseFloat),this.link.linksize=this.numParam("linksize",parseFloat),this.link.linkopacity=this.numParam("linkopacity",parseFloat),this.link.link2opacity=this.numParam("link2opacity",parseFloat),this.link.nodesize=this.numParam("nodesize",parseFloat),this.link.nodeopacity=this.numParam("nodeopacity",parseFloat),this.link.color=this.numParam("color",i=>t.stringToHex(i)),this.link.background=this.numParam("background",i=>t.stringToHex(i)),this.link.dpsi=this.numParam("dpsi",parseFloat),this.link.dtheta=this.numParam("dtheta",parseFloat)}copyUrl(){const t=new URL(this.linkUrl.origin+this.linkUrl.pathname);t.searchParams.append("shape",this.params.shape),t.searchParams.append("option",this.params.option),t.searchParams.append("inscribed",this.params.inscribed?"y":"n"),t.searchParams.append("inscribe_all",this.params.inscribe_all?"y":"n"),t.searchParams.append("linksize",this.params.linksize.toString()),t.searchParams.append("nodesize",this.params.nodesize.toString()),t.searchParams.append("nodeopacity",this.params.nodesize.toString()),t.searchParams.append("linkopacity",this.params.nodeopacity.toString()),t.searchParams.append("color",this.hexToString(this.params.color)),t.searchParams.append("background",this.hexToString(this.params.background)),t.searchParams.append("hyperplane",this.params.hyperplane.toString()),t.searchParams.append("zoom",this.params.zoom.toString()),t.searchParams.append("xRotate",this.params.xRotate),t.searchParams.append("yRotate",this.params.yRotate),t.searchParams.append("dtheta",this.params.dtheta.toString()),t.searchParams.append("dpsi",this.params.dpsi.toString()),this.copyTextToClipboard(t)}copyTextToClipboard(t){if(!navigator.clipboard){this.fallbackCopyTextToClipboard(t);return}navigator.clipboard.writeText(t).then(function(){console.log("Async: Copying to clipboard was successful!")},function(i){console.error("Async: Could not copy text: ",i)})}fallbackCopyTextToClipboard(t){var i=document.createElement("textarea");i.value=t,i.style.top="0",i.style.left="0",i.style.position="fixed",document.body.appendChild(i),i.focus(),i.select();try{var n=document.execCommand("copy"),s=n?"successful":"unsuccessful";console.log("Fallback: Copying text command was "+s)}catch(r){console.error("Fallback: Oops, unable to copy",r)}document.body.removeChild(i)}}const $t=.001;class Qe extends Ot{constructor(t,i,n,s,r,o){super();const a=new se(1,1,16,!0),c=new re(new V(0,-1,0),.5);this.color_i=i,this.material=t.clone(),this.material.clippingPlanes=[c],this.object=new dt(a,this.material),this.add(this.object),this.update(n,s,r,o)}update(t,i,n,s){const r=n-s;let o=Math.abs(r)<$t?$t:r,a=t.v3,c=i.v3,u=n,l=s;o<0&&(a=i.v3,c=t.v3,u=s,l=n,o=-o);const h=a.distanceTo(c),d=h*l/o,g=h+d;this.scale.copy(new V(u,u,g));const v=.5*g/h,w=new V;w.lerpVectors(a,c,v),this.position.copy(w),this.lookAt(a),this.children[0].rotation.x=3*Math.PI/2,this.visible=!0;const y=new V;y.copy(c),y.sub(a),y.negate(),y.normalize(),this.material.clippingPlanes[0].setFromNormalAndCoplanarPoint(y,c)}set_color(t){this.material.color=new q(t[this.color_i])}}const ti=2,ei=.04;class ii extends Ot{constructor(t,i,n,s){super(),this.node_ms=t,this.link_ms=i,this.face_ms=n,this.nodes4=s.nodes,this.nodes3={},this.links=s.links,this.faces="faces"in s?s.faces:[],this.node_scale=1,this.link_scale=1,this.hyperplane=ti,this.foreshortening=ei,this.initShapes()}getMaterialLabel(t){return"label"in t?t.label:0}makeNode(t,i,n){const s=new oe(this.node_size),r=new dt(s,t);return r.position.copy(i),this.add(r),r}makeLink(t,i){const n=this.nodes3[i.source],s=this.nodes3[i.target],r=this.link_scale*n.scale,o=this.link_scale*s.scale,a=this.link_ms[t],c=new Qe(a,t,n,s,r,o);return this.add(c),c}updateLink(t,i){const n=this.nodes3[t.source],s=this.nodes3[t.target],r=this.link_scale*n.scale,o=this.link_scale*s.scale;t.object.update(n,s,r,o),t.object.visible=!i||i.includes(t.label)}setFaceGeometry(t,i){const n=[];for(const o of t.nodes){const a=this.nodes3[o].v3;n.push(a.x),n.push(a.y),n.push(a.z)}const s=this.nodes3[t.nodes[0]].v3;n.push(s.x),n.push(s.y),n.push(s.z);const r=new Float32Array(n);i.setAttribute("position",new ae(r,3))}makeFace(t,i){const n=new le;this.setFaceGeometry(i,n);const s=new dt(n,t);return this.add(s),s}fourDscale(t){return this.hyperplane/(this.hyperplane+t)}fourDrotate(t,i,n,s,r){const o=new ce(t,i,n,s);for(const a of r)o.applyMatrix4(a);return o}fourDtoV3(t){const i=this.fourDscale(t.w);return new V(t.x*i,t.y*i,t.z*i)}initShapes(){for(const t of this.nodes4){const i=this.fourDscale(t.w),n=new V(t.x*i,t.y*i,t.z*i),s=this.node_ms[this.getMaterialLabel(t)];this.nodes3[t.id]={v3:n,scale:i,label:t.label,object:this.makeNode(s,n,i)}}for(const t of this.links){const i=this.getMaterialLabel(t);t.object=this.makeLink(i,t)}for(const t of this.faces){const i=this.face_ms(this.getMaterialLabel(t));t.object=this.makeFace(i,t)}}render3(t,i,n){this.scalev3=new V(this.node_scale,this.node_scale,this.node_scale);for(const s of this.nodes4){const r=this.fourDrotate(s.x,s.y,s.z,s.w,t),o=this.fourDscale(r.w),a=new V(r.x*o,r.y*o,r.z*o),c=o*this.node_scale*this.foreshortening,u=new V(c,c,c);this.nodes3[s.id].v3=a,this.nodes3[s.id].scale=o*this.foreshortening,this.nodes3[s.id].object.position.copy(a),this.nodes3[s.id].object.scale.copy(u),this.nodes3[s.id].object.visible=!i||i.includes(s.label)}for(const s of this.links)this.updateLink(s,n);for(const s of this.faces)this.setFaceGeometry(s,s.object.geometry)}}var ni=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yt={exports:{}};yt.exports;(function(e){(function(){var t,i=[].slice;t=function(){var n,s,r,o,a,c;for(a=Array.isArray||function(l){return{}.toString.call(l)==="[object Array]"},u.SCHEMES={},o="mono monochromatic contrast triade tetrade analogic".split(/\s+/),s=0,r=o.length;s<r;s++)c=o[s],u.SCHEMES[c]=!0;u.PRESETS={default:[-1,-1,1,-.7,.25,1,.5,1],pastel:[.5,-.9,.5,.5,.1,.9,.75,.75],soft:[.3,-.8,.3,.5,.1,.9,.5,.75],light:[.25,1,.5,.75,.1,1,.5,1],hard:[1,-1,1,-.6,.1,1,.6,1],pale:[.1,-.85,.1,.5,.1,1,.1,.75]},u.COLOR_WHEEL={0:[255,0,0,100],15:[255,51,0,100],30:[255,102,0,100],45:[255,128,0,100],60:[255,153,0,100],75:[255,178,0,100],90:[255,204,0,100],105:[255,229,0,100],120:[255,255,0,100],135:[204,255,0,100],150:[153,255,0,100],165:[51,255,0,100],180:[0,204,0,80],195:[0,178,102,70],210:[0,153,153,60],225:[0,102,178,70],240:[0,51,204,80],255:[25,25,178,70],270:[51,0,153,60],285:[64,0,153,60],300:[102,0,153,60],315:[153,0,153,60],330:[204,0,153,80],345:[229,0,102,90]};function u(){var l,h;for(l=[],h=1;h<=4;h++)l.push(new u.mutablecolor(60));this.col=l,this._scheme="mono",this._distance=.5,this._web_safe=!1,this._add_complement=!1}return u.prototype.colors=function(){var l,h,d,g,v,w,y,p,f;if(f=1,h=this.col[0].get_hue(),l={mono:function(b){return function(){}}(),contrast:function(b){return function(){return f=2,b.col[1].set_hue(h),b.col[1].rotate(180)}}(this),triade:function(b){return function(){var k;return f=3,k=60*b._distance,b.col[1].set_hue(h),b.col[1].rotate(180-k),b.col[2].set_hue(h),b.col[2].rotate(180+k)}}(this),tetrade:function(b){return function(){var k;return f=4,k=90*b._distance,b.col[1].set_hue(h),b.col[1].rotate(180),b.col[2].set_hue(h),b.col[2].rotate(180+k),b.col[3].set_hue(h),b.col[3].rotate(k)}}(this),analogic:function(b){return function(){var k;return f=b._add_complement?4:3,k=60*b._distance,b.col[1].set_hue(h),b.col[1].rotate(k),b.col[2].set_hue(h),b.col[2].rotate(360-k),b.col[3].set_hue(h),b.col[3].rotate(180)}}(this)},l.monochromatic=l.mono,l[this._scheme]!=null)l[this._scheme]();else throw"Unknown color scheme name: "+this._scheme;for(y=[],d=v=0,p=f-1;0<=p?v<=p:v>=p;d=0<=p?++v:--v)for(g=w=0;w<=3;g=++w)y[d*4+g]=this.col[d].get_hex(this._web_safe,g);return y},u.prototype.colorset=function(){var l,h;for(l=n(this.colors()),h=[];l.length>0;)h.push(l.splice(0,4));return h},u.prototype.from_hue=function(l){if(l==null)throw"from_hue needs an argument";return this.col[0].set_hue(l),this},u.prototype.rgb2ryb=function(){var l,h,d,g,v,w,y,p,f;return y=1<=arguments.length?i.call(arguments,0):[],y[0]!=null&&a(y[0])&&(y=y[0]),w=y[0],h=y[1],l=y[2],p=Math.min(w,h,l),w-=p,h-=p,l-=p,g=Math.max(w,h,l),f=Math.min(w,h),w-=f,h-=f,l>0&&h>0&&(l/=2,h/=2),f+=h,l+=h,v=Math.max(w,f,l),v>0&&(d=g/v,w*=d,f*=d,l*=d),w+=p,f+=p,l+=p,[Math.floor(w),Math.floor(f),Math.floor(l)]},u.prototype.rgb2hsv=function(){var l,h,d,g,v,w,y,p,f,b;if(p=1<=arguments.length?i.call(arguments,0):[],p[0]!=null&&a(p[0])&&(p=p[0]),y=p[0],d=p[1],l=p[2],y/=255,d/=255,l/=255,w=Math.min.apply(Math,[y,d,l]),v=Math.max.apply(Math,[y,d,l]),h=v-w,b=v,h>0)f=h/v;else return[0,0,b];return g=y===v?(d-l)/h:d===v?2+(l-y)/h:4+(y-d)/h,g*=60,g%=360,[g,f,b]},u.prototype.rgbToHsv=function(){var l,h,d,g,v,w,y,p,f,b;if(p=1<=arguments.length?i.call(arguments,0):[],p[0]!=null&&a(p[0])&&(p=p[0]),y=p[0],d=p[1],l=p[2],y/=255,d/=255,l/=255,v=Math.max(y,d,l),w=Math.min(y,d,l),g=void 0,f=void 0,b=v,h=v-w,f=v===0?0:h/v,v===w)g=0;else{switch(v){case y:g=(d-l)/h+(d<l?6:0);break;case d:g=(l-y)/h+2;break;case l:g=(y-d)/h+4}g/=6}return[g,f,b]},u.prototype.from_hex=function(l){var h,d,g,v,w,y,p,f,b,k,E;if(l==null)throw"from_hex needs an argument";if(!/^([0-9A-F]{2}){3}$/im.test(l))throw"from_hex("+l+") - argument must be in the form of RRGGBB";return b=/(..)(..)(..)/.exec(l).slice(1,4),p=function(){var P,D,$;for($=[],D=0,P=b.length;D<P;D++)w=b[D],$.push(parseInt(w,16));return $}(),y=p[0],d=p[1],h=p[2],f=this.rgb2ryb([y,d,h]),y=f[0],d=f[1],h=f[2],v=this.rgbToHsv(y,d,h),v[0],g=null,k=null,E=null,g=v[0],k=v[1],E=v[2],this.from_hue(g*360),this._set_variant_preset([k,E,k,E*.7,k*.25,1,k*.5,1]),this},u.prototype.add_complement=function(l){if(l==null)throw"add_complement needs an argument";return this._add_complement=l,this},u.prototype.web_safe=function(l){if(l==null)throw"web_safe needs an argument";return this._web_safe=l,this},u.prototype.distance=function(l){if(l==null)throw"distance needs an argument";if(l<0)throw"distance("+l+") - argument must be >= 0";if(l>1)throw"distance("+l+") - argument must be <= 1";return this._distance=l,this},u.prototype.scheme=function(l){if(l==null)return this._scheme;if(u.SCHEMES[l]==null)throw"'"+l+"' isn't a valid scheme name";return this._scheme=l,this},u.prototype.variation=function(l){if(l==null)throw"variation needs an argument";if(u.PRESETS[l]==null)throw"'$v' isn't a valid variation name";return this._set_variant_preset(u.PRESETS[l]),this},u.prototype._set_variant_preset=function(l){var h,d,g;for(g=[],h=d=0;d<=3;h=++d)g.push(this.col[h].set_variant_preset(l));return g},n=function(l){var h,d,g;if(l==null||typeof l!="object")return l;if(l instanceof Date)return new Date(l.getTime());if(l instanceof RegExp)return h="",l.global!=null&&(h+="g"),l.ignoreCase!=null&&(h+="i"),l.multiline!=null&&(h+="m"),l.sticky!=null&&(h+="y"),new RegExp(l.source,h);g=new l.constructor;for(d in l)g[d]=n(l[d]);return g},u.mutablecolor=function(){l.prototype.hue=0,l.prototype.saturation=[],l.prototype.value=[],l.prototype.base_red=0,l.prototype.base_green=0,l.prototype.base_saturation=0,l.prototype.base_value=0;function l(h){if(h==null)throw"No hue specified";this.saturation=[],this.value=[],this.base_red=0,this.base_green=0,this.base_blue=0,this.base_saturation=0,this.base_value=0,this.set_hue(h),this.set_variant_preset(u.PRESETS.default)}return l.prototype.get_hue=function(){return this.hue},l.prototype.set_hue=function(h){var d,g,v,w,y,p,f,b,k,E;d=function(P,D,$){return P+Math.round((D-P)*$)},this.hue=Math.round(h%360),y=this.hue%15+(this.hue-Math.floor(this.hue)),E=y/15,p=this.hue-Math.floor(y),f=(p+15)%360,p===360&&(p=0),f===360&&(f=0),v=u.COLOR_WHEEL[p],w=u.COLOR_WHEEL[f],b={red:0,green:1,blue:2,value:3};for(g in b)k=b[g],this["base_"+g]=d(v[k],w[k],E);return this.base_saturation=d(100,100,E)/100,this.base_value/=100},l.prototype.rotate=function(h){var d;return d=(this.hue+h)%360,this.set_hue(d)},l.prototype.get_saturation=function(h){var d,g;return g=this.saturation[h],d=g<0?-g*this.base_saturation:g,d>1&&(d=1),d<0&&(d=0),d},l.prototype.get_value=function(h){var d,g;return g=this.value[h],d=g<0?-g*this.base_value:g,d>1&&(d=1),d<0&&(d=0),d},l.prototype.set_variant=function(h,d,g){return this.saturation[h]=d,this.value[h]=g},l.prototype.set_variant_preset=function(h){var d,g,v;for(v=[],d=g=0;g<=3;d=++g)v.push(this.set_variant(d,h[2*d],h[2*d+1]));return v},l.prototype.get_hex=function(h,d){var g,v,w,y,p,f,b,k,E,P,D,$,xt,_t,X,nt;for(E=Math.max.apply(Math,(function(){var R,C,O,B;for(O=["red","green","blue"],B=[],C=0,R=O.length;C<R;C++)v=O[C],B.push(this["base_"+v]);return B}).call(this)),Math.min.apply(Math,(function(){var R,C,O,B;for(O=["red","green","blue"],B=[],C=0,R=O.length;C<R;C++)v=O[C],B.push(this["base_"+v]);return B}).call(this)),nt=(d<0?this.base_value:this.get_value(d))*255,_t=d<0?this.base_saturation:this.get_saturation(d),p=E>0?nt/E:0,$=[],D=["red","green","blue"],k=0,f=D.length;k<f;k++)v=D[k],xt=Math.min.apply(Math,[255,Math.round(nt-(nt-this["base_"+v]*p)*_t)]),$.push(xt);for(h&&($=function(){var R,C,O;for(O=[],C=0,R=$.length;C<R;C++)g=$[C],O.push(Math.round(g/51)*51);return O}()),w="",P=0,b=$.length;P<b;P++)y=$[P],X=y.toString(16),X.length<2&&(X="0"+X),w+=X;return w},l}(),u}(),e!==null&&e.exports!=null?e.exports=t:window.ColorScheme=t}).call(ni)})(yt);var si=yt.exports;const ri=Tt(si);var It={exports:{}},Vt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Rt={exports:{}},oi=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")},ai=oi,li=Array.prototype.concat,ci=Array.prototype.slice,St=Rt.exports=function(t){for(var i=[],n=0,s=t.length;n<s;n++){var r=t[n];ai(r)?i=li.call(i,ci.call(r)):i.push(r)}return i};St.wrap=function(e){return function(){return e(St(arguments))}};var hi=Rt.exports,U=Vt,et=hi,Ht=Object.hasOwnProperty,Nt=Object.create(null);for(var ut in U)Ht.call(U,ut)&&(Nt[U[ut]]=ut);var L=It.exports={to:{},get:{}};L.get=function(e){var t=e.substring(0,3).toLowerCase(),i,n;switch(t){case"hsl":i=L.get.hsl(e),n="hsl";break;case"hwb":i=L.get.hwb(e),n="hwb";break;default:i=L.get.rgb(e),n="rgb";break}return i?{model:n,value:i}:null};L.get.rgb=function(e){if(!e)return null;var t=/^#([a-f0-9]{3,4})$/i,i=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,s=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,r=/^(\w+)$/,o=[0,0,0,1],a,c,u;if(a=e.match(i)){for(u=a[2],a=a[1],c=0;c<3;c++){var l=c*2;o[c]=parseInt(a.slice(l,l+2),16)}u&&(o[3]=parseInt(u,16)/255)}else if(a=e.match(t)){for(a=a[1],u=a[3],c=0;c<3;c++)o[c]=parseInt(a[c]+a[c],16);u&&(o[3]=parseInt(u+u,16)/255)}else if(a=e.match(n)){for(c=0;c<3;c++)o[c]=parseInt(a[c+1],0);a[4]&&(a[5]?o[3]=parseFloat(a[4])*.01:o[3]=parseFloat(a[4]))}else if(a=e.match(s)){for(c=0;c<3;c++)o[c]=Math.round(parseFloat(a[c+1])*2.55);a[4]&&(a[5]?o[3]=parseFloat(a[4])*.01:o[3]=parseFloat(a[4]))}else return(a=e.match(r))?a[1]==="transparent"?[0,0,0,0]:Ht.call(U,a[1])?(o=U[a[1]],o[3]=1,o):null:null;for(c=0;c<3;c++)o[c]=H(o[c],0,255);return o[3]=H(o[3],0,1),o};L.get.hsl=function(e){if(!e)return null;var t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,i=e.match(t);if(i){var n=parseFloat(i[4]),s=(parseFloat(i[1])%360+360)%360,r=H(parseFloat(i[2]),0,100),o=H(parseFloat(i[3]),0,100),a=H(isNaN(n)?1:n,0,1);return[s,r,o,a]}return null};L.get.hwb=function(e){if(!e)return null;var t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,i=e.match(t);if(i){var n=parseFloat(i[4]),s=(parseFloat(i[1])%360+360)%360,r=H(parseFloat(i[2]),0,100),o=H(parseFloat(i[3]),0,100),a=H(isNaN(n)?1:n,0,1);return[s,r,o,a]}return null};L.to.hex=function(){var e=et(arguments);return"#"+st(e[0])+st(e[1])+st(e[2])+(e[3]<1?st(Math.round(e[3]*255)):"")};L.to.rgb=function(){var e=et(arguments);return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};L.to.rgb.percent=function(){var e=et(arguments),t=Math.round(e[0]/255*100),i=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+i+"%, "+n+"%)":"rgba("+t+"%, "+i+"%, "+n+"%, "+e[3]+")"};L.to.hsl=function(){var e=et(arguments);return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};L.to.hwb=function(){var e=et(arguments),t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};L.to.keyword=function(e){return Nt[e.slice(0,3)]};function H(e,t,i){return Math.min(Math.max(t,e),i)}function st(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var ui=It.exports;const J=Vt,Bt={};for(const e of Object.keys(J))Bt[J[e]]=e;const m={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Yt=m;for(const e of Object.keys(m)){if(!("channels"in m[e]))throw new Error("missing channels property: "+e);if(!("labels"in m[e]))throw new Error("missing channel labels property: "+e);if(m[e].labels.length!==m[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=m[e];delete m[e].channels,delete m[e].labels,Object.defineProperty(m[e],"channels",{value:t}),Object.defineProperty(m[e],"labels",{value:i})}m.rgb.hsl=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(t,i,n),r=Math.max(t,i,n),o=r-s;let a,c;r===s?a=0:t===r?a=(i-n)/o:i===r?a=2+(n-t)/o:n===r&&(a=4+(t-i)/o),a=Math.min(a*60,360),a<0&&(a+=360);const u=(s+r)/2;return r===s?c=0:u<=.5?c=o/(r+s):c=o/(2-r-s),[a,c*100,u*100]};m.rgb.hsv=function(e){let t,i,n,s,r;const o=e[0]/255,a=e[1]/255,c=e[2]/255,u=Math.max(o,a,c),l=u-Math.min(o,a,c),h=function(d){return(u-d)/6/l+1/2};return l===0?(s=0,r=0):(r=l/u,t=h(o),i=h(a),n=h(c),o===u?s=n-i:a===u?s=1/3+t-n:c===u&&(s=2/3+i-t),s<0?s+=1:s>1&&(s-=1)),[s*360,r*100,u*100]};m.rgb.hwb=function(e){const t=e[0],i=e[1];let n=e[2];const s=m.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(i,n));return n=1-1/255*Math.max(t,Math.max(i,n)),[s,r*100,n*100]};m.rgb.cmyk=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-i,1-n),r=(1-t-s)/(1-s)||0,o=(1-i-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function di(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}m.rgb.keyword=function(e){const t=Bt[e];if(t)return t;let i=1/0,n;for(const s of Object.keys(J)){const r=J[s],o=di(e,r);o<i&&(i=o,n=s)}return n};m.keyword.rgb=function(e){return J[e]};m.rgb.xyz=function(e){let t=e[0]/255,i=e[1]/255,n=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;const s=t*.4124+i*.3576+n*.1805,r=t*.2126+i*.7152+n*.0722,o=t*.0193+i*.1192+n*.9505;return[s*100,r*100,o*100]};m.rgb.lab=function(e){const t=m.rgb.xyz(e);let i=t[0],n=t[1],s=t[2];i/=95.047,n/=100,s/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const r=116*n-16,o=500*(i-n),a=200*(n-s);return[r,o,a]};m.hsl.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;let s,r,o;if(i===0)return o=n*255,[o,o,o];n<.5?s=n*(1+i):s=n+i-n*i;const a=2*n-s,c=[0,0,0];for(let u=0;u<3;u++)r=t+1/3*-(u-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(s-a)*6*r:2*r<1?o=s:3*r<2?o=a+(s-a)*(2/3-r)*6:o=a,c[u]=o*255;return c};m.hsl.hsv=function(e){const t=e[0];let i=e[1]/100,n=e[2]/100,s=i;const r=Math.max(n,.01);n*=2,i*=n<=1?n:2-n,s*=r<=1?r:2-r;const o=(n+i)/2,a=n===0?2*s/(r+s):2*i/(n+i);return[t,a*100,o*100]};m.hsv.rgb=function(e){const t=e[0]/60,i=e[1]/100;let n=e[2]/100;const s=Math.floor(t)%6,r=t-Math.floor(t),o=255*n*(1-i),a=255*n*(1-i*r),c=255*n*(1-i*(1-r));switch(n*=255,s){case 0:return[n,c,o];case 1:return[a,n,o];case 2:return[o,n,c];case 3:return[o,a,n];case 4:return[c,o,n];case 5:return[n,o,a]}};m.hsv.hsl=function(e){const t=e[0],i=e[1]/100,n=e[2]/100,s=Math.max(n,.01);let r,o;o=(2-i)*n;const a=(2-i)*s;return r=i*s,r/=a<=1?a:2-a,r=r||0,o/=2,[t,r*100,o*100]};m.hwb.rgb=function(e){const t=e[0]/360;let i=e[1]/100,n=e[2]/100;const s=i+n;let r;s>1&&(i/=s,n/=s);const o=Math.floor(6*t),a=1-n;r=6*t-o,o&1&&(r=1-r);const c=i+r*(a-i);let u,l,h;switch(o){default:case 6:case 0:u=a,l=c,h=i;break;case 1:u=c,l=a,h=i;break;case 2:u=i,l=a,h=c;break;case 3:u=i,l=c,h=a;break;case 4:u=c,l=i,h=a;break;case 5:u=a,l=i,h=c;break}return[u*255,l*255,h*255]};m.cmyk.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,s=e[3]/100,r=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,i*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[r*255,o*255,a*255]};m.xyz.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100;let s,r,o;return s=t*3.2406+i*-1.5372+n*-.4986,r=t*-.9689+i*1.8758+n*.0415,o=t*.0557+i*-.204+n*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[s*255,r*255,o*255]};m.xyz.lab=function(e){let t=e[0],i=e[1],n=e[2];t/=95.047,i/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;const s=116*i-16,r=500*(t-i),o=200*(i-n);return[s,r,o]};m.lab.xyz=function(e){const t=e[0],i=e[1],n=e[2];let s,r,o;r=(t+16)/116,s=i/500+r,o=r-n/200;const a=r**3,c=s**3,u=o**3;return r=a>.008856?a:(r-16/116)/7.787,s=c>.008856?c:(s-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,s*=95.047,r*=100,o*=108.883,[s,r,o]};m.lab.lch=function(e){const t=e[0],i=e[1],n=e[2];let s;s=Math.atan2(n,i)*360/2/Math.PI,s<0&&(s+=360);const o=Math.sqrt(i*i+n*n);return[t,o,s]};m.lch.lab=function(e){const t=e[0],i=e[1],s=e[2]/360*2*Math.PI,r=i*Math.cos(s),o=i*Math.sin(s);return[t,r,o]};m.rgb.ansi16=function(e,t=null){const[i,n,s]=e;let r=t===null?m.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(i/255));return r===2&&(o+=60),o};m.hsv.ansi16=function(e){return m.rgb.ansi16(m.hsv.rgb(e),e[2])};m.rgb.ansi256=function(e){const t=e[0],i=e[1],n=e[2];return t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)};m.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const i=(~~(e>50)+1)*.5,n=(t&1)*i*255,s=(t>>1&1)*i*255,r=(t>>2&1)*i*255;return[n,s,r]};m.ansi256.rgb=function(e){if(e>=232){const r=(e-232)*10+8;return[r,r,r]}e-=16;let t;const i=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[i,n,s]};m.rgb.hex=function(e){const i=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(i.length)+i};m.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let i=t[0];t[0].length===3&&(i=i.split("").map(a=>a+a).join(""));const n=parseInt(i,16),s=n>>16&255,r=n>>8&255,o=n&255;return[s,r,o]};m.rgb.hcg=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,i),n),r=Math.min(Math.min(t,i),n),o=s-r;let a,c;return o<1?a=r/(1-o):a=0,o<=0?c=0:s===t?c=(i-n)/o%6:s===i?c=2+(n-t)/o:c=4+(t-i)/o,c/=6,c%=1,[c*360,o*100,a*100]};m.hsl.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=i<.5?2*t*i:2*t*(1-i);let s=0;return n<1&&(s=(i-.5*n)/(1-n)),[e[0],n*100,s*100]};m.hsv.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=t*i;let s=0;return n<1&&(s=(i-n)/(1-n)),[e[0],n*100,s*100]};m.hcg.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;if(i===0)return[n*255,n*255,n*255];const s=[0,0,0],r=t%1*6,o=r%1,a=1-o;let c=0;switch(Math.floor(r)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return c=(1-i)*n,[(i*s[0]+c)*255,(i*s[1]+c)*255,(i*s[2]+c)*255]};m.hcg.hsv=function(e){const t=e[1]/100,i=e[2]/100,n=t+i*(1-t);let s=0;return n>0&&(s=t/n),[e[0],s*100,n*100]};m.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let s=0;return n>0&&n<.5?s=t/(2*n):n>=.5&&n<1&&(s=t/(2*(1-n))),[e[0],s*100,n*100]};m.hcg.hwb=function(e){const t=e[1]/100,i=e[2]/100,n=t+i*(1-t);return[e[0],(n-t)*100,(1-n)*100]};m.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,s=n-t;let r=0;return s<1&&(r=(n-s)/(1-s)),[e[0],s*100,r*100]};m.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};m.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};m.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};m.gray.hsl=function(e){return[0,0,e[0]]};m.gray.hsv=m.gray.hsl;m.gray.hwb=function(e){return[0,100,e[0]]};m.gray.cmyk=function(e){return[0,0,0,e[0]]};m.gray.lab=function(e){return[e[0],0,0]};m.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n};m.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const ot=Yt;function pi(){const e={},t=Object.keys(ot);for(let i=t.length,n=0;n<i;n++)e[t[n]]={distance:-1,parent:null};return e}function fi(e){const t=pi(),i=[e];for(t[e].distance=0;i.length;){const n=i.pop(),s=Object.keys(ot[n]);for(let r=s.length,o=0;o<r;o++){const a=s[o],c=t[a];c.distance===-1&&(c.distance=t[n].distance+1,c.parent=n,i.unshift(a))}}return t}function gi(e,t){return function(i){return t(e(i))}}function mi(e,t){const i=[t[e].parent,e];let n=ot[t[e].parent][e],s=t[e].parent;for(;t[s].parent;)i.unshift(t[s].parent),n=gi(ot[t[s].parent][s],n),s=t[s].parent;return n.conversion=i,n}var bi=function(e){const t=fi(e),i={},n=Object.keys(t);for(let s=n.length,r=0;r<s;r++){const o=n[r];t[o].parent!==null&&(i[o]=mi(o,t))}return i};const ft=Yt,vi=bi,Y={},yi=Object.keys(ft);function wi(e){const t=function(...i){const n=i[0];return n==null?n:(n.length>1&&(i=n),e(i))};return"conversion"in e&&(t.conversion=e.conversion),t}function ki(e){const t=function(...i){const n=i[0];if(n==null)return n;n.length>1&&(i=n);const s=e(i);if(typeof s=="object")for(let r=s.length,o=0;o<r;o++)s[o]=Math.round(s[o]);return s};return"conversion"in e&&(t.conversion=e.conversion),t}yi.forEach(e=>{Y[e]={},Object.defineProperty(Y[e],"channels",{value:ft[e].channels}),Object.defineProperty(Y[e],"labels",{value:ft[e].labels});const t=vi(e);Object.keys(t).forEach(n=>{const s=t[n];Y[e][n]=ki(s),Y[e][n].raw=wi(s)})});var xi=Y;const G=ui,F=xi,Gt=["keyword","gray","hex"],gt={};for(const e of Object.keys(F))gt[[...F[e].labels].sort().join("")]=e;const at={};function A(e,t){if(!(this instanceof A))return new A(e,t);if(t&&t in Gt&&(t=null),t&&!(t in F))throw new Error("Unknown model: "+t);let i,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof A)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const s=G.get(e);if(s===null)throw new Error("Unable to parse color from string: "+e);this.model=s.model,n=F[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]=="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=F[this.model].channels;const s=Array.prototype.slice.call(e,0,n);this.color=mt(s,n),this.valpha=typeof e[n]=="number"?e[n]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const s=Object.keys(e);"alpha"in e&&(s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const r=s.sort().join("");if(!(r in gt))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=gt[r];const{labels:o}=F[this.model],a=[];for(i=0;i<o.length;i++)a.push(e[o[i]]);this.color=mt(a)}if(at[this.model])for(n=F[this.model].channels,i=0;i<n;i++){const s=at[this.model][i];s&&(this.color[i]=s(this.color[i]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}A.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in G.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);const i=t.valpha===1?t.color:[...t.color,this.valpha];return G.to[t.model](i)},percentString(e){const t=this.rgb().round(typeof e=="number"?e:1),i=t.valpha===1?t.color:[...t.color,this.valpha];return G.to.rgb.percent(i)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=F[this.model],{labels:i}=F[this.model];for(let n=0;n<t;n++)e[i[n]]=this.color[n];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new A([...this.color.map(Ai(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new A([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:x("rgb",0,_(255)),green:x("rgb",1,_(255)),blue:x("rgb",2,_(255)),hue:x(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:x("hsl",1,_(100)),lightness:x("hsl",2,_(100)),saturationv:x("hsv",1,_(100)),value:x("hsv",2,_(100)),chroma:x("hcg",1,_(100)),gray:x("hcg",2,_(100)),white:x("hwb",1,_(100)),wblack:x("hwb",2,_(100)),cyan:x("cmyk",0,_(100)),magenta:x("cmyk",1,_(100)),yellow:x("cmyk",2,_(100)),black:x("cmyk",3,_(100)),x:x("xyz",0,_(95.047)),y:x("xyz",1,_(100)),z:x("xyz",2,_(108.833)),l:x("lab",0,_(100)),a:x("lab",1),b:x("lab",2),keyword(e){return e!==void 0?new A(e):F[this.model].keyword(this.color)},hex(e){return e!==void 0?new A(e):G.to.hex(this.rgb().round().color)},hexa(e){if(e!==void 0)return new A(e);const t=this.rgb().round().color;let i=Math.round(this.valpha*255).toString(16).toUpperCase();return i.length===1&&(i="0"+i),G.to.hex(t)+i},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,t=[];for(const[i,n]of e.entries()){const s=n/255;t[i]=s<=.04045?s/12.92:((s+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),i=e.luminosity();return t>i?(t+.05)/(i+.05):(i+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return A.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let i=t.color[0];return i=(i+e)%360,i=i<0?360+i:i,t.color[0]=i,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const i=e.rgb(),n=this.rgb(),s=t===void 0?.5:t,r=2*s-1,o=i.alpha()-n.alpha(),a=((r*o===-1?r:(r+o)/(1+r*o))+1)/2,c=1-a;return A.rgb(a*i.red()+c*n.red(),a*i.green()+c*n.green(),a*i.blue()+c*n.blue(),i.alpha()*s+n.alpha()*(1-s))}};for(const e of Object.keys(F)){if(Gt.includes(e))continue;const{channels:t}=F[e];A.prototype[e]=function(...i){return this.model===e?new A(this):i.length>0?new A(i,e):new A([...Ei(F[this.model][e].raw(this.color)),this.valpha],e)},A[e]=function(...i){let n=i[0];return typeof n=="number"&&(n=mt(i,t)),new A(n,e)}}function _i(e,t){return Number(e.toFixed(t))}function Ai(e){return function(t){return _i(t,e)}}function x(e,t,i){e=Array.isArray(e)?e:[e];for(const n of e)(at[n]||(at[n]=[]))[t]=i;return e=e[0],function(n){let s;return n!==void 0?(i&&(n=i(n)),s=this[e](),s.color[t]=n,s):(s=this[e]().color[t],i&&(s=i(s)),s)}}function _(e){return function(t){return Math.max(0,Math.min(e,t))}}function Ei(e){return Array.isArray(e)?e:[e]}function mt(e,t){for(let i=0;i<t;i++)typeof e[i]!="number"&&(e[i]=0);return e}var Ci=A;const Ft=Tt(Ci),jt=e=>{const i=Ft(e).hsl(),n=i.color[0],s=i.color[1];i.color[2];const r=new ri;r.from_hue(n).scheme("tetrade").distance(.75);const o=r.colors().slice(1,9);o.reverse();const c=o.map(u=>Ft("#"+u).hsl()).map(u=>u.saturationl(s).rgbNumber());return c.unshift(e),console.log(c),c},Mi=.3,Xt=5,N=new he,lt=new ue(75,1,.1,1e3),wt=new Pt(16777215,2);wt.position.set(10,10,10);N.add(wt);const $i=new Pt(16777215,2);$i.position.set(-10,5,10);N.add(wt);const Si=new de(16777215,.5);N.add(Si);lt.position.set(0,0,Xt/2);lt.lookAt(0,0,0);const kt=document.getElementById("canvas"),ct=new pe({antialias:!0,canvas:kt});ct.setSize(40,40);kt.style.width="400px";kt.style.height="400px";ct.localClippingEnabled=!0;ct.getContext();N.background=new q(rt.background);const Ut=jt(rt.color),Z=Ut.map(e=>new bt({color:e})),it=Ut.map(e=>new bt({color:e}));Z.map(e=>{e.transparent=!0,e.opacity=1});it.map(e=>{e.transparent=!0,e.opacity=.5});console.log("link_ms",it);const Wt=[new bt({color:4521796})];for(const e of Wt)e.transparent=!0,e.opacity=Mi;const qt=Oe(),Kt={};qt.map(e=>Kt[e.name]=e);let z=!1,W=!1,Jt=[],Zt=[];function Qt(e,t){z&&N.remove(z),W=Kt[e],z=new ii(Z,it,Wt,W),N.add(z),ie(t||W.options[0].name)}function te(e){const t=jt(e);for(let i=0;i<Z.length;i++)Z[i].color=new q(t[i]),it[i].color=new q(t[i]);z&&z.links.map(i=>i.object.set_color(t))}function ee(e){N.background=new q(e)}function Fi(e,t){it.map(i=>i.opacity=e),z&&z.links.map(i=>{(t&&i.label==0||!t&&i.label!==0)&&(i.object.material.opacity=e)})}function Li(e){Z.map(t=>t.opacity=e)}let M;function zi(){Qt(M.params.shape)}function ie(e){console.log("setVisibility",e),console.log(W.options);const t=W.options.filter(i=>i.name===e);t.length?(Jt=t[0].nodes,Zt=t[0].links):console.log(`Error: option '${e}' not found`)}M=new Ze({shapes:qt,changeShape:zi,setColors:te,setBackground:ee,setNodeOpacity:Li,setLinkOpacity:Fi,setVisibility:ie,showDocs:()=>{}});te(M.params.color);ee(M.params.background);const Oi=2*Math.PI/480,Pi=2*Math.PI/480;let Lt=0,zt=0;Qt(M.params.shape,M.params.option);function ne(){requestAnimationFrame(ne),Lt+=Oi,zt+=Pi;const e=[Ct[M.params.xRotate](Lt),Ct[M.params.yRotate](zt)];z.hyperplane=1/M.params.hyperplane,lt.position.set(0,0,M.params.zoom*Xt*M.params.hyperplane),z.node_scale=M.params.nodesize,z.link_scale=M.params.linksize*M.params.nodesize*.5,z.render3(e,Jt,Zt),ct.render(N,lt)}ne();
|