From 0f31ce6a1a0dbee94f0aa5949b7cd4668ff4dff4 Mon Sep 17 00:00:00 2001 From: martinfleis Date: Mon, 19 Feb 2024 13:11:19 +0000 Subject: [PATCH] deploy: 71cce2af433024ba18ba3774ac972b6b70c3f52d --- .../assets/{index-dc3fb28e.js => index-5090909b.js} | 4 ++-- .../assets/pyodide_worker-d616a3be.js} | 2 +- ...{pyodide_worker-c89af0e2.js => pyodide_worker-dcd3f9ec.js} | 2 +- dev/isle_of_wight/index.html | 2 +- .../assets/{index-02bf7658.js => index-e6ec8c7c.js} | 4 ++-- ...{pyodide_worker-c380b41a.js => pyodide_worker-506c147d.js} | 2 +- .../assets/pyodide_worker-d616a3be.js} | 2 +- dev/tyne_and_wear/index.html | 2 +- .../assets/{index-fdb90f48.js => index-db770d6d.js} | 4 ++-- ...{pyodide_worker-df5fef8a.js => pyodide_worker-6d63054d.js} | 2 +- ...{pyodide_worker-9534fa03.js => pyodide_worker-d616a3be.js} | 2 +- dev/tyne_and_wear_hex/index.html | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) rename dev/isle_of_wight/assets/{index-dc3fb28e.js => index-5090909b.js} (99%) rename dev/{tyne_and_wear/assets/pyodide_worker-9534fa03.js => isle_of_wight/assets/pyodide_worker-d616a3be.js} (97%) rename dev/isle_of_wight/assets/{pyodide_worker-c89af0e2.js => pyodide_worker-dcd3f9ec.js} (53%) rename dev/tyne_and_wear/assets/{index-02bf7658.js => index-e6ec8c7c.js} (99%) rename dev/tyne_and_wear/assets/{pyodide_worker-c380b41a.js => pyodide_worker-506c147d.js} (53%) rename dev/{isle_of_wight/assets/pyodide_worker-9534fa03.js => tyne_and_wear/assets/pyodide_worker-d616a3be.js} (97%) rename dev/tyne_and_wear_hex/assets/{index-fdb90f48.js => index-db770d6d.js} (99%) rename dev/tyne_and_wear_hex/assets/{pyodide_worker-df5fef8a.js => pyodide_worker-6d63054d.js} (54%) rename dev/tyne_and_wear_hex/assets/{pyodide_worker-9534fa03.js => pyodide_worker-d616a3be.js} (97%) diff --git a/dev/isle_of_wight/assets/index-dc3fb28e.js b/dev/isle_of_wight/assets/index-5090909b.js similarity index 99% rename from dev/isle_of_wight/assets/index-dc3fb28e.js rename to dev/isle_of_wight/assets/index-5090909b.js index f8bee3c..edf4ba7 100644 --- a/dev/isle_of_wight/assets/index-dc3fb28e.js +++ b/dev/isle_of_wight/assets/index-5090909b.js @@ -30,7 +30,7 @@ modelled development strategies on any of the four indicators. for your own modifications.`,t=le(),d5(r.$$.fragment),n=le();for(let d=0;dt(3,r=d)),m5(i,lt,d=>t(4,n=d)),m5(i,O9,d=>t(0,f=d));const p=Ft();p("changeScenario",{});function o(d){const x=document.querySelectorAll(".scenario-button");Array.from(x).forEach(P=>{P!==d.target&&(P.style.backgroundColor="#fff")});let w=d.target;w.style.backgroundColor="#eaeaea",q5(lt,n=w.value,n),q5(Pt,r=null,r),p("changeScenario")}function y(d){let x=d.target;const w="custom_in_progress";f.set(w,rb(f.get(x.value))),q5(lt,n=w,n),q5(Pt,r=null,r),p("changeScenarioAndProceed")}return[f,o,y]}class Ab extends W5{constructor(e){super(),$5(this,e,Mb,Ib,z5,{})}}function Xc(i,e,t){const r=i.slice();return r[45]=e[t][0],r[46]=e[t][1],r}function Yc(i,e,t){const r=i.slice();return r[45]=e[t][0],r[46]=e[t][1],r}function zb(i){let e;return{c(){e=S1("div"),e.textContent=`Click and move your mouse on the map to draw a region of interest. When you are done drawing, click again on the starting point to select all OAs within the region.`,e1(e,"class","smaller svelte-1392tz3")},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Db(i){let e;return{c(){e=S1("div"),e.textContent=`Click on the map to select an output area. You can shift-click to - select multiple, or click anywhere outside the map to deselect all.`,e1(e,"class","smaller svelte-1392tz3")},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Lb(i){let e,t=i[0].length+"",r,n,f=i[0].length===1?"":"s",p,o,y,d,x,w,P,q,C,S,T,A;x=new ju({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function z(K,J){return K[2]?Bb:Ob}let R=z(i),N=R(i),W=i[14]&&Qc(i);return{c(){e=S1("span"),r=Re(t),n=Re(" output area"),p=Re(f),o=Re(" selected."),y=le(),d=S1("div"),d5(x.$$.fragment),w=le(),P=S1("input"),q=le(),N.c(),C=le(),W&&W.c(),e1(P,"type","checkbox"),e1(P,"id","sig-modified"),e1(d,"id","changes-grid"),e1(d,"class","svelte-1392tz3")},m(K,J){te(K,e,J),p1(e,r),p1(e,n),p1(e,p),p1(e,o),te(K,y,J),te(K,d,J),p5(x,d,null),p1(d,w),p1(d,P),P.checked=i[2],p1(d,q),N.m(d,null),p1(d,C),W&&W.m(d,null),S=!0,T||(A=[Ge(P,"change",i[27]),Ge(P,"change",i[28])],T=!0)},p(K,J){(!S||J[0]&1)&&t!==(t=K[0].length+"")&&_0(r,t),(!S||J[0]&1)&&f!==(f=K[0].length===1?"":"s")&&_0(p,f),J[0]&4&&(P.checked=K[2]),R===(R=z(K))&&N?N.p(K,J):(N.d(1),N=R(K),N&&(N.c(),N.m(d,C))),K[14]?W?(W.p(K,J),J[0]&16384&&he(W,1)):(W=Qc(K),W.c(),he(W,1),W.m(d,null)):W&&(x0(),xe(W,1,1,()=>{W=null}),v0())},i(K){S||(he(x.$$.fragment,K),he(W),S=!0)},o(K){xe(x.$$.fragment,K),xe(W),S=!1},d(K){K&&J1(e),K&&J1(y),K&&J1(d),u5(x),N.d(),W&&W.d(),T=!1,p0(A)}}}function Rb(i){let e;return{c(){e=S1("span"),e.textContent="No output areas selected."},m(t,r){te(t,e,r)},p:t5,i:t5,o:t5,d(t){t&&J1(e)}}}function Ob(i){let e,t=[...Se.signatures.entries()],r=[];for(let n=0;ni[29].call(e))},m(p,o){te(p,e,o);for(let y=0;yO0(e,"modified",q)),H5.push(()=>O0(e,"value",C)),e.$on("change",i[19]);function T(K){i[33](K)}function A(K){i[34](K)}let z={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:i[10],max:i[11],defaultVal:i[10],step:.01};i[9]!==void 0&&(z.modified=i[9]),i[8]!==void 0&&(z.value=i[8]),f=new Ns({props:z}),H5.push(()=>O0(f,"modified",T)),H5.push(()=>O0(f,"value",A)),f.$on("change",i[19]);function R(K){i[35](K)}function N(K){i[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return i[13]!==void 0&&(W.modified=i[13]),i[12]!==void 0&&(W.value=i[12]),d=new Ns({props:W}),H5.push(()=>O0(d,"modified",R)),H5.push(()=>O0(d,"value",N)),d.$on("change",i[19]),{c(){d5(e.$$.fragment),n=le(),d5(f.$$.fragment),y=le(),d5(d.$$.fragment)},m(K,J){p5(e,K,J),te(K,n,J),p5(f,K,J),te(K,y,J),p5(d,K,J),P=!0},p(K,J){const s1={};J[0]&64&&(s1.min=K[6]),J[0]&128&&(s1.max=K[7]),J[0]&64&&(s1.defaultVal=K[6]),!t&&J[0]&32&&(t=!0,s1.modified=K[5],R0(()=>t=!1)),!r&&J[0]&16&&(r=!0,s1.value=K[4],R0(()=>r=!1)),e.$set(s1);const i1={};J[0]&1024&&(i1.min=K[10]),J[0]&2048&&(i1.max=K[11]),J[0]&1024&&(i1.defaultVal=K[10]),!p&&J[0]&512&&(p=!0,i1.modified=K[9],R0(()=>p=!1)),!o&&J[0]&256&&(o=!0,i1.value=K[8],R0(()=>o=!1)),f.$set(i1);const d1={};!x&&J[0]&8192&&(x=!0,d1.modified=K[13],R0(()=>x=!1)),!w&&J[0]&4096&&(w=!0,d1.value=K[12],R0(()=>w=!1)),d.$set(d1)},i(K){P||(he(e.$$.fragment,K),he(f.$$.fragment,K),he(d.$$.fragment,K),P=!0)},o(K){xe(e.$$.fragment,K),xe(f.$$.fragment,K),xe(d.$$.fragment,K),P=!1},d(K){u5(e,K),K&&J1(n),u5(f,K),K&&J1(y),u5(d,K)}}}function Nb(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T,A,z,R,N;e=new Fu({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",i[24]),e.$on("forwardClick",i[25]),r=new F7({});function W(_1,o1){if(_1[16]==="click")return Db;if(_1[16]==="draw")return zb}let K=W(i),J=K&&K(i);q=new F7({});const s1=[Rb,Lb],i1=[];function d1(_1,o1){return _1[0].length===0?0:1}return S=d1(i),T=i1[S]=s1[S](i),{c(){d5(e.$$.fragment),t=le(),d5(r.$$.fragment),n=le(),f=S1("div"),p=S1("i"),p.textContent="Selection method",o=le(),y=S1("select"),d=S1("option"),d.textContent="Click on map",x=S1("option"),x.textContent="Freehand draw",w=le(),J&&J.c(),P=le(),d5(q.$$.fragment),C=le(),T.c(),A=$t(),d.__value="click",d.value=d.__value,x.__value="draw",x.value=x.__value,e1(y,"id","oa-selection-method"),i[16]===void 0&&$0(()=>i[26].call(y)),e1(f,"id","selection-method-choice"),e1(f,"class","svelte-1392tz3")},m(_1,o1){p5(e,_1,o1),te(_1,t,o1),p5(r,_1,o1),te(_1,n,o1),te(_1,f,o1),p1(f,p),p1(f,o),p1(f,y),p1(y,d),p1(y,x),e9(y,i[16],!0),te(_1,w,o1),J&&J.m(_1,o1),te(_1,P,o1),p5(q,_1,o1),te(_1,C,o1),i1[S].m(_1,o1),te(_1,A,o1),z=!0,R||(N=Ge(y,"change",i[26]),R=!0)},p(_1,o1){o1[0]&65536&&e9(y,_1[16]),K!==(K=W(_1))&&(J&&J.d(1),J=K&&K(_1),J&&(J.c(),J.m(P.parentNode,P)));let P1=S;S=d1(_1),S===P1?i1[S].p(_1,o1):(x0(),xe(i1[P1],1,1,()=>{i1[P1]=null}),v0(),T=i1[S],T?T.p(_1,o1):(T=i1[S]=s1[S](_1),T.c()),he(T,1),T.m(A.parentNode,A))},i(_1){z||(he(e.$$.fragment,_1),he(r.$$.fragment,_1),he(q.$$.fragment,_1),he(T),z=!0)},o(_1){xe(e.$$.fragment,_1),xe(r.$$.fragment,_1),xe(q.$$.fragment,_1),xe(T),z=!1},d(_1){u5(e,_1),_1&&J1(t),u5(r,_1),_1&&J1(n),_1&&J1(f),_1&&J1(w),J&&J.d(_1),_1&&J1(P),u5(q,_1),_1&&J1(C),i1[S].d(_1),_1&&J1(A),R=!1,N()}}}function Vb(i){let e,t;return e=new ca({props:{title:"Step 2: Modify output areas",$$slots:{default:[Nb]},$$scope:{ctx:i}}}),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,n){const f={};n[0]&131071|n[1]&1048576&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function L6(i){return Math.round(i*100)/100}function Ub(i,e,t){let r,n,f,p,o;m5(i,nt,ue=>t(0,r=ue)),m5(i,O9,ue=>t(37,n=ue)),m5(i,c7,ue=>t(38,f=ue)),m5(i,lt,ue=>t(39,p=ue)),m5(i,Y4,ue=>t(16,o=ue));const y=Ft();let{changes:d=n.get(p).changes}=e,{userChangesPresent:x}=e,w=!1;R7(()=>{q5(c7,f=!0,f),t(23,w=!0)}),O7(()=>{q5(c7,f=!1,f)});let P=null,q,C,S=null,T,A,z,R=null,N,W,K,J=null,s1,i1=!1;function d1(ue){if(ue.length===0)return{kind:"None"};if(ue.length===1){const we=ue[0].name,U=P1(we).get("signature_type");return U===null?{kind:"SinglePassive",oaName:we,sigId:o1(we)}:{kind:"SingleActive",oaName:we,sigId:U}}else{const we=ue.map(c1=>c1.name),$1=ue.map(c1=>P1(c1.name)).map(c1=>c1.get("signature_type")),N1=we.map(c1=>o1(c1));if($1.every(c1=>c1===null))return N1.every(c1=>c1===N1[0])?{kind:"MultipleSamePassive",oaNames:we,sigId:N1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:N1};if($1.some(c1=>c1!==null)&&$1.some(c1=>c1===null)){const c1=$1.map((l1,F1)=>l1||N1[F1]);return c1.every(l1=>l1===c1[0])?{kind:"MultipleSamePassive",oaNames:we,sigId:c1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:c1}}else return $1.every(c1=>c1===$1[0])?{kind:"MultipleSameActive",oaNames:we,sigId:$1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:$1}}}let _1=d1(r);function o1(ue){return n.get(Se.referenceScenarioObject.metadata.name).values.get(ue).get("signature_type")}function P1(ue){const we=d.has(ue),U=d.get(ue);return new Map([["signature_type",we?U.get("signature_type"):null],["job_types",we?U.get("job_types"):null],["use",we?U.get("use"):null],["greenspace",we?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",P),!q&&!T&&!N&&!s1)r.forEach(ue=>{d.delete(ue.name)});else{const ue=new Map([["signature_type",q?P:null],["job_types",T?S:null],["use",N?R:null],["greenspace",s1?J:null]]);r.forEach(we=>{d.set(we.name,ue)})}y("changesUpdated"),t(21,x=!0)}function m1(ue,we){t(4,S=P1(ue).get("job_types")),t(8,R=P1(ue).get("use")),t(12,J=P1(ue).get("greenspace")),t(5,T=S!==null),t(9,N=R!==null),t(13,s1=J!==null),t(6,A=L6(Se.signatures[we].job_d1)),t(7,z=L6(Se.signatures[we].job_d9)),t(10,W=L6(Se.signatures[we].use_d1)),t(11,K=L6(Se.signatures[we].use_d9))}function g1(ue,we){const U=ue.map(N1=>P1(N1));function $1(N1){const c1=U.map(l1=>l1.get(N1));return c1.every(l1=>l1===c1[0]&&l1!==null)?c1[0]:null}t(4,S=$1("job_types")),t(5,T=S!==null),t(8,R=$1("use")),t(9,N=R!==null),t(12,J=$1("greenspace")),t(13,s1=J!==null),t(6,A=Se.signatures[we].job_d1),t(7,z=Se.signatures[we].job_d9),t(10,W=Se.signatures[we].use_d1),t(11,K=Se.signatures[we].use_d9)}function k1(){switch(_1.kind){case"None":return;case"SingleActive":t(1,P=_1.sigId),t(2,q=!0),t(3,C=_1.sigId);break;case"SinglePassive":t(1,P=null),t(2,q=!1),t(3,C=_1.sigId);break;case"MultipleDifferent":t(1,P=null),t(2,q=!1),t(3,C=null);break;case"MultipleSameActive":t(1,P=_1.sigId),t(2,q=!0),t(3,C=null);break;case"MultipleSamePassive":t(1,P=null),t(2,q=!1),t(3,C=_1.sigId);break}C1()}function C1(){function ue(we){t(6,A=L6(Se.signatures[we].job_d1)),t(7,z=L6(Se.signatures[we].job_d9)),t(10,W=L6(Se.signatures[we].use_d1)),t(11,K=L6(Se.signatures[we].use_d9))}switch(console.log(_1),_1.kind){case"None":t(14,i1=!1);break;case"SingleActive":t(14,i1=!0),m1(_1.oaName,_1.sigId),ue(_1.sigId);break;case"SinglePassive":t(14,i1=!0),m1(_1.oaName,_1.sigId),ue(_1.sigId);break;case"MultipleSameActive":t(14,i1=!0),g1(_1.oaNames,_1.sigId),ue(_1.sigId);break;case"MultipleSamePassive":t(14,i1=!0),g1(_1.oaNames,_1.sigId),ue(_1.sigId);break;case"MultipleDifferent":t(14,i1=!1),t(4,S=null),t(8,R=null),t(12,J=null),t(5,T=!1),t(9,N=!1),t(13,s1=!1),V();break}}const I1=()=>y("returnToSelection",{}),L1=()=>y("proceedToMetadata",{});function E1(){o=b7(this),Y4.set(o)}function M1(){q=this.checked,t(2,q)}const _e=()=>{q&&_1.kind!=="MultipleDifferent"?t(1,P=C):(q&&_1.kind,t(1,P=null)),V(),t(15,_1=d1(r)),C1()};function ce(){P=b7(this),t(1,P)}const se=()=>{V(),t(15,_1=d1(r)),C1()};function ke(ue){T=ue,t(5,T)}function Ue(ue){S=ue,t(4,S)}function Pe(ue){N=ue,t(9,N)}function Ae(ue){R=ue,t(8,R)}function Xe(ue){s1=ue,t(13,s1)}function Ye(ue){J=ue,t(12,J)}return i.$$set=ue=>{"changes"in ue&&t(22,d=ue.changes),"userChangesPresent"in ue&&t(21,x=ue.userChangesPresent)},i.$$.update=()=>{i.$$.dirty[0]&8388609&&(t(15,_1=d1(r)),w&&k1())},[r,P,q,C,S,T,A,z,R,N,W,K,J,s1,i1,_1,o,y,d1,V,C1,x,d,w,I1,L1,E1,M1,_e,ce,se,ke,Ue,Pe,Ae,Xe,Ye]}class $b extends W5{constructor(e){super(),$5(this,e,Ub,Vb,z5,{changes:22,userChangesPresent:21},null,[-1,-1])}}function Wb(i){let e;return{c(){e=S1("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Gb(i){let e,t,r;return{c(){e=Re("This uses the "),t=S1("a"),t.textContent="Pyodide library",r=Re(" to run the calculation entirely in your browser."),e1(t,"href","https://pyodide.org/en/stable/"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Zb(i){let e,t,r;return{c(){e=Re("To use this option, the API must be running on port 5178. See the "),t=S1("a"),t.textContent="developer notes",r=Re(" for details on how to set this up."),e1(t,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Hb(i){let e,t,r;return{c(){e=Re("This is an "),t=S1("a"),t.textContent="Azure Functions",r=Re(" instance, i.e. a web service hosted on the cloud."),e1(t,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Xb(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T,A,z,R,N,W;e=new Fu({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",i[7]),e.$on("forwardClick",i[8]),r=new F7({});let K=!i[6]&&Wb();function J(d1,_1){if(d1[2]==="azure")return Hb;if(d1[2]==="local")return Zb;if(d1[2]==="wasm")return Gb}let s1=J(i),i1=s1&&s1(i);return C=new F7({}),{c(){d5(e.$$.fragment),t=le(),d5(r.$$.fragment),n=le(),f=S1("div"),p=S1("i"),p.textContent="Calculation method",o=le(),y=S1("select"),d=S1("option"),d.textContent="Azure REST API",K&&K.c(),x=S1("option"),x.textContent="In-browser",w=le(),P=S1("div"),i1&&i1.c(),q=le(),d5(C.$$.fragment),S=le(),T=S1("input"),A=le(),z=S1("textarea"),d.__value="azure",d.value=d.__value,x.__value="wasm",x.value=x.__value,i[2]===void 0&&$0(()=>i[9].call(y)),e1(f,"id","calculation-method-choice"),e1(f,"class","svelte-ygj49d"),e1(P,"class","smaller svelte-ygj49d"),e1(T,"type","text"),e1(T,"placeholder","Scenario title..."),e1(T,"class","svelte-ygj49d"),e1(z,"placeholder","A longer textual description..."),e1(z,"spellcheck","false"),e1(z,"class","svelte-ygj49d")},m(d1,_1){p5(e,d1,_1),te(d1,t,_1),p5(r,d1,_1),te(d1,n,_1),te(d1,f,_1),p1(f,p),p1(f,o),p1(f,y),p1(y,d),K&&K.m(y,null),p1(y,x),e9(y,i[2],!0),te(d1,w,_1),te(d1,P,_1),i1&&i1.m(P,null),te(d1,q,_1),p5(C,d1,_1),te(d1,S,_1),te(d1,T,_1),i[10](T),It(T,i[0]),te(d1,A,_1),te(d1,z,_1),i[13](z),It(z,i[1]),R=!0,N||(W=[Ge(y,"change",i[9]),Ge(T,"input",i[11]),Ge(T,"input",i[12]),Ge(z,"input",i[14]),Ge(z,"input",i[15])],N=!0)},p(d1,_1){_1&4&&e9(y,d1[2]),s1!==(s1=J(d1))&&(i1&&i1.d(1),i1=s1&&s1(d1),i1&&(i1.c(),i1.m(P,null))),_1&1&&T.value!==d1[0]&&It(T,d1[0]),_1&2&&It(z,d1[1])},i(d1){R||(he(e.$$.fragment,d1),he(r.$$.fragment,d1),he(C.$$.fragment,d1),R=!0)},o(d1){xe(e.$$.fragment,d1),xe(r.$$.fragment,d1),xe(C.$$.fragment,d1),R=!1},d(d1){u5(e,d1),d1&&J1(t),u5(r,d1),d1&&J1(n),d1&&J1(f),K&&K.d(),d1&&J1(w),d1&&J1(P),i1&&i1.d(),d1&&J1(q),u5(C,d1),d1&&J1(S),d1&&J1(T),i[10](null),d1&&J1(A),d1&&J1(z),i[13](null),N=!1,p0(W)}}}function Yb(i){let e,t;return e=new ca({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[Xb]},$$scope:{ctx:i}}}),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,[n]){const f={};n&65567&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function ef(i){i.style.borderColor="#f26d88"}function Kb(i,e,t){let{scenarioShort:r=""}=e,{scenarioDescription:n=""}=e,{calculationMethod:f="azure"}=e;const p=Ft();let o,y;const d=window.location.href.toLowerCase().includes(Se.baseUrl.toLowerCase()),x=()=>p("returnToModify"),w=()=>{if(r===""){alert("Please enter a scenario title."),ef(o);return}if(n===""){alert("Please enter a scenario description."),ef(y);return}p("acceptChangesAndCalculate")};function P(){f=b7(this),t(2,f)}function q(R){H5[R?"unshift":"push"](()=>{o=R,t(3,o)})}function C(){r=this.value,t(0,r)}const S=()=>{t(3,o.style.borderColor=r===""?"#f26d88":"#999",o)};function T(R){H5[R?"unshift":"push"](()=>{y=R,t(4,y)})}function A(){n=this.value,t(1,n)}const z=()=>{t(4,y.style.borderColor=n===""?"#f26d88":"#999",y)};return i.$$set=R=>{"scenarioShort"in R&&t(0,r=R.scenarioShort),"scenarioDescription"in R&&t(1,n=R.scenarioDescription),"calculationMethod"in R&&t(2,f=R.calculationMethod)},[r,n,f,o,y,p,d,x,w,P,q,C,S,T,A,z]}class Jb extends W5{constructor(e){super(),$5(this,e,Kb,Yb,z5,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Qb="modulepreload",em=function(i){return"/demoland-web/dev/isle_of_wight/"+i},tf={},tm=function(e,t,r){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(f=>{if(f=em(f),f in tf)return;tf[f]=!0;const p=f.endsWith(".css"),o=p?'[rel="stylesheet"]':"";if(!!r)for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.href===f&&(!p||w.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${o}`))return;const d=document.createElement("link");if(d.rel=p?"stylesheet":Qb,p||(d.as="script",d.crossOrigin=""),d.href=f,document.head.appendChild(d),p)return new Promise((x,w)=>{d.addEventListener("load",x),d.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=f,window.dispatchEvent(p),!p.defaultPrevented)throw f})};let Zi;const D4={};let _4=0;async function im(){if(Zi)return Zi;const i=await tm(()=>import("./pyodide_worker-c89af0e2.js"),[]);return Zi=new i.default,Zi.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:t,...r}=e.data,n=D4[t];console.log(D4),delete D4[t],n(r)}},Zi}async function rm(i,e){const t=await im();return _4=(_4+1)%Number.MAX_SAFE_INTEGER,new Promise(r=>{D4[_4]=r,t.postMessage({...e,python:i,id:_4,pathname:window.location.pathname})})}async function sm(i){const t=await rm(` + select multiple, or click anywhere outside the map to deselect all.`,e1(e,"class","smaller svelte-1392tz3")},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Lb(i){let e,t=i[0].length+"",r,n,f=i[0].length===1?"":"s",p,o,y,d,x,w,P,q,C,S,T,A;x=new ju({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function z(K,J){return K[2]?Bb:Ob}let R=z(i),N=R(i),W=i[14]&&Qc(i);return{c(){e=S1("span"),r=Re(t),n=Re(" output area"),p=Re(f),o=Re(" selected."),y=le(),d=S1("div"),d5(x.$$.fragment),w=le(),P=S1("input"),q=le(),N.c(),C=le(),W&&W.c(),e1(P,"type","checkbox"),e1(P,"id","sig-modified"),e1(d,"id","changes-grid"),e1(d,"class","svelte-1392tz3")},m(K,J){te(K,e,J),p1(e,r),p1(e,n),p1(e,p),p1(e,o),te(K,y,J),te(K,d,J),p5(x,d,null),p1(d,w),p1(d,P),P.checked=i[2],p1(d,q),N.m(d,null),p1(d,C),W&&W.m(d,null),S=!0,T||(A=[Ge(P,"change",i[27]),Ge(P,"change",i[28])],T=!0)},p(K,J){(!S||J[0]&1)&&t!==(t=K[0].length+"")&&_0(r,t),(!S||J[0]&1)&&f!==(f=K[0].length===1?"":"s")&&_0(p,f),J[0]&4&&(P.checked=K[2]),R===(R=z(K))&&N?N.p(K,J):(N.d(1),N=R(K),N&&(N.c(),N.m(d,C))),K[14]?W?(W.p(K,J),J[0]&16384&&he(W,1)):(W=Qc(K),W.c(),he(W,1),W.m(d,null)):W&&(x0(),xe(W,1,1,()=>{W=null}),v0())},i(K){S||(he(x.$$.fragment,K),he(W),S=!0)},o(K){xe(x.$$.fragment,K),xe(W),S=!1},d(K){K&&J1(e),K&&J1(y),K&&J1(d),u5(x),N.d(),W&&W.d(),T=!1,p0(A)}}}function Rb(i){let e;return{c(){e=S1("span"),e.textContent="No output areas selected."},m(t,r){te(t,e,r)},p:t5,i:t5,o:t5,d(t){t&&J1(e)}}}function Ob(i){let e,t=[...Se.signatures.entries()],r=[];for(let n=0;ni[29].call(e))},m(p,o){te(p,e,o);for(let y=0;yO0(e,"modified",q)),H5.push(()=>O0(e,"value",C)),e.$on("change",i[19]);function T(K){i[33](K)}function A(K){i[34](K)}let z={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:i[10],max:i[11],defaultVal:i[10],step:.01};i[9]!==void 0&&(z.modified=i[9]),i[8]!==void 0&&(z.value=i[8]),f=new Ns({props:z}),H5.push(()=>O0(f,"modified",T)),H5.push(()=>O0(f,"value",A)),f.$on("change",i[19]);function R(K){i[35](K)}function N(K){i[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return i[13]!==void 0&&(W.modified=i[13]),i[12]!==void 0&&(W.value=i[12]),d=new Ns({props:W}),H5.push(()=>O0(d,"modified",R)),H5.push(()=>O0(d,"value",N)),d.$on("change",i[19]),{c(){d5(e.$$.fragment),n=le(),d5(f.$$.fragment),y=le(),d5(d.$$.fragment)},m(K,J){p5(e,K,J),te(K,n,J),p5(f,K,J),te(K,y,J),p5(d,K,J),P=!0},p(K,J){const s1={};J[0]&64&&(s1.min=K[6]),J[0]&128&&(s1.max=K[7]),J[0]&64&&(s1.defaultVal=K[6]),!t&&J[0]&32&&(t=!0,s1.modified=K[5],R0(()=>t=!1)),!r&&J[0]&16&&(r=!0,s1.value=K[4],R0(()=>r=!1)),e.$set(s1);const i1={};J[0]&1024&&(i1.min=K[10]),J[0]&2048&&(i1.max=K[11]),J[0]&1024&&(i1.defaultVal=K[10]),!p&&J[0]&512&&(p=!0,i1.modified=K[9],R0(()=>p=!1)),!o&&J[0]&256&&(o=!0,i1.value=K[8],R0(()=>o=!1)),f.$set(i1);const d1={};!x&&J[0]&8192&&(x=!0,d1.modified=K[13],R0(()=>x=!1)),!w&&J[0]&4096&&(w=!0,d1.value=K[12],R0(()=>w=!1)),d.$set(d1)},i(K){P||(he(e.$$.fragment,K),he(f.$$.fragment,K),he(d.$$.fragment,K),P=!0)},o(K){xe(e.$$.fragment,K),xe(f.$$.fragment,K),xe(d.$$.fragment,K),P=!1},d(K){u5(e,K),K&&J1(n),u5(f,K),K&&J1(y),u5(d,K)}}}function Nb(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T,A,z,R,N;e=new Fu({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",i[24]),e.$on("forwardClick",i[25]),r=new F7({});function W(_1,o1){if(_1[16]==="click")return Db;if(_1[16]==="draw")return zb}let K=W(i),J=K&&K(i);q=new F7({});const s1=[Rb,Lb],i1=[];function d1(_1,o1){return _1[0].length===0?0:1}return S=d1(i),T=i1[S]=s1[S](i),{c(){d5(e.$$.fragment),t=le(),d5(r.$$.fragment),n=le(),f=S1("div"),p=S1("i"),p.textContent="Selection method",o=le(),y=S1("select"),d=S1("option"),d.textContent="Click on map",x=S1("option"),x.textContent="Freehand draw",w=le(),J&&J.c(),P=le(),d5(q.$$.fragment),C=le(),T.c(),A=$t(),d.__value="click",d.value=d.__value,x.__value="draw",x.value=x.__value,e1(y,"id","oa-selection-method"),i[16]===void 0&&$0(()=>i[26].call(y)),e1(f,"id","selection-method-choice"),e1(f,"class","svelte-1392tz3")},m(_1,o1){p5(e,_1,o1),te(_1,t,o1),p5(r,_1,o1),te(_1,n,o1),te(_1,f,o1),p1(f,p),p1(f,o),p1(f,y),p1(y,d),p1(y,x),e9(y,i[16],!0),te(_1,w,o1),J&&J.m(_1,o1),te(_1,P,o1),p5(q,_1,o1),te(_1,C,o1),i1[S].m(_1,o1),te(_1,A,o1),z=!0,R||(N=Ge(y,"change",i[26]),R=!0)},p(_1,o1){o1[0]&65536&&e9(y,_1[16]),K!==(K=W(_1))&&(J&&J.d(1),J=K&&K(_1),J&&(J.c(),J.m(P.parentNode,P)));let P1=S;S=d1(_1),S===P1?i1[S].p(_1,o1):(x0(),xe(i1[P1],1,1,()=>{i1[P1]=null}),v0(),T=i1[S],T?T.p(_1,o1):(T=i1[S]=s1[S](_1),T.c()),he(T,1),T.m(A.parentNode,A))},i(_1){z||(he(e.$$.fragment,_1),he(r.$$.fragment,_1),he(q.$$.fragment,_1),he(T),z=!0)},o(_1){xe(e.$$.fragment,_1),xe(r.$$.fragment,_1),xe(q.$$.fragment,_1),xe(T),z=!1},d(_1){u5(e,_1),_1&&J1(t),u5(r,_1),_1&&J1(n),_1&&J1(f),_1&&J1(w),J&&J.d(_1),_1&&J1(P),u5(q,_1),_1&&J1(C),i1[S].d(_1),_1&&J1(A),R=!1,N()}}}function Vb(i){let e,t;return e=new ca({props:{title:"Step 2: Modify output areas",$$slots:{default:[Nb]},$$scope:{ctx:i}}}),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,n){const f={};n[0]&131071|n[1]&1048576&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function L6(i){return Math.round(i*100)/100}function Ub(i,e,t){let r,n,f,p,o;m5(i,nt,ue=>t(0,r=ue)),m5(i,O9,ue=>t(37,n=ue)),m5(i,c7,ue=>t(38,f=ue)),m5(i,lt,ue=>t(39,p=ue)),m5(i,Y4,ue=>t(16,o=ue));const y=Ft();let{changes:d=n.get(p).changes}=e,{userChangesPresent:x}=e,w=!1;R7(()=>{q5(c7,f=!0,f),t(23,w=!0)}),O7(()=>{q5(c7,f=!1,f)});let P=null,q,C,S=null,T,A,z,R=null,N,W,K,J=null,s1,i1=!1;function d1(ue){if(ue.length===0)return{kind:"None"};if(ue.length===1){const we=ue[0].name,U=P1(we).get("signature_type");return U===null?{kind:"SinglePassive",oaName:we,sigId:o1(we)}:{kind:"SingleActive",oaName:we,sigId:U}}else{const we=ue.map(c1=>c1.name),$1=ue.map(c1=>P1(c1.name)).map(c1=>c1.get("signature_type")),N1=we.map(c1=>o1(c1));if($1.every(c1=>c1===null))return N1.every(c1=>c1===N1[0])?{kind:"MultipleSamePassive",oaNames:we,sigId:N1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:N1};if($1.some(c1=>c1!==null)&&$1.some(c1=>c1===null)){const c1=$1.map((l1,F1)=>l1||N1[F1]);return c1.every(l1=>l1===c1[0])?{kind:"MultipleSamePassive",oaNames:we,sigId:c1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:c1}}else return $1.every(c1=>c1===$1[0])?{kind:"MultipleSameActive",oaNames:we,sigId:$1[0]}:{kind:"MultipleDifferent",oaNames:we,sigIds:$1}}}let _1=d1(r);function o1(ue){return n.get(Se.referenceScenarioObject.metadata.name).values.get(ue).get("signature_type")}function P1(ue){const we=d.has(ue),U=d.get(ue);return new Map([["signature_type",we?U.get("signature_type"):null],["job_types",we?U.get("job_types"):null],["use",we?U.get("use"):null],["greenspace",we?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",P),!q&&!T&&!N&&!s1)r.forEach(ue=>{d.delete(ue.name)});else{const ue=new Map([["signature_type",q?P:null],["job_types",T?S:null],["use",N?R:null],["greenspace",s1?J:null]]);r.forEach(we=>{d.set(we.name,ue)})}y("changesUpdated"),t(21,x=!0)}function m1(ue,we){t(4,S=P1(ue).get("job_types")),t(8,R=P1(ue).get("use")),t(12,J=P1(ue).get("greenspace")),t(5,T=S!==null),t(9,N=R!==null),t(13,s1=J!==null),t(6,A=L6(Se.signatures[we].job_d1)),t(7,z=L6(Se.signatures[we].job_d9)),t(10,W=L6(Se.signatures[we].use_d1)),t(11,K=L6(Se.signatures[we].use_d9))}function g1(ue,we){const U=ue.map(N1=>P1(N1));function $1(N1){const c1=U.map(l1=>l1.get(N1));return c1.every(l1=>l1===c1[0]&&l1!==null)?c1[0]:null}t(4,S=$1("job_types")),t(5,T=S!==null),t(8,R=$1("use")),t(9,N=R!==null),t(12,J=$1("greenspace")),t(13,s1=J!==null),t(6,A=Se.signatures[we].job_d1),t(7,z=Se.signatures[we].job_d9),t(10,W=Se.signatures[we].use_d1),t(11,K=Se.signatures[we].use_d9)}function k1(){switch(_1.kind){case"None":return;case"SingleActive":t(1,P=_1.sigId),t(2,q=!0),t(3,C=_1.sigId);break;case"SinglePassive":t(1,P=null),t(2,q=!1),t(3,C=_1.sigId);break;case"MultipleDifferent":t(1,P=null),t(2,q=!1),t(3,C=null);break;case"MultipleSameActive":t(1,P=_1.sigId),t(2,q=!0),t(3,C=null);break;case"MultipleSamePassive":t(1,P=null),t(2,q=!1),t(3,C=_1.sigId);break}C1()}function C1(){function ue(we){t(6,A=L6(Se.signatures[we].job_d1)),t(7,z=L6(Se.signatures[we].job_d9)),t(10,W=L6(Se.signatures[we].use_d1)),t(11,K=L6(Se.signatures[we].use_d9))}switch(console.log(_1),_1.kind){case"None":t(14,i1=!1);break;case"SingleActive":t(14,i1=!0),m1(_1.oaName,_1.sigId),ue(_1.sigId);break;case"SinglePassive":t(14,i1=!0),m1(_1.oaName,_1.sigId),ue(_1.sigId);break;case"MultipleSameActive":t(14,i1=!0),g1(_1.oaNames,_1.sigId),ue(_1.sigId);break;case"MultipleSamePassive":t(14,i1=!0),g1(_1.oaNames,_1.sigId),ue(_1.sigId);break;case"MultipleDifferent":t(14,i1=!1),t(4,S=null),t(8,R=null),t(12,J=null),t(5,T=!1),t(9,N=!1),t(13,s1=!1),V();break}}const I1=()=>y("returnToSelection",{}),L1=()=>y("proceedToMetadata",{});function E1(){o=b7(this),Y4.set(o)}function M1(){q=this.checked,t(2,q)}const _e=()=>{q&&_1.kind!=="MultipleDifferent"?t(1,P=C):(q&&_1.kind,t(1,P=null)),V(),t(15,_1=d1(r)),C1()};function ce(){P=b7(this),t(1,P)}const se=()=>{V(),t(15,_1=d1(r)),C1()};function ke(ue){T=ue,t(5,T)}function Ue(ue){S=ue,t(4,S)}function Pe(ue){N=ue,t(9,N)}function Ae(ue){R=ue,t(8,R)}function Xe(ue){s1=ue,t(13,s1)}function Ye(ue){J=ue,t(12,J)}return i.$$set=ue=>{"changes"in ue&&t(22,d=ue.changes),"userChangesPresent"in ue&&t(21,x=ue.userChangesPresent)},i.$$.update=()=>{i.$$.dirty[0]&8388609&&(t(15,_1=d1(r)),w&&k1())},[r,P,q,C,S,T,A,z,R,N,W,K,J,s1,i1,_1,o,y,d1,V,C1,x,d,w,I1,L1,E1,M1,_e,ce,se,ke,Ue,Pe,Ae,Xe,Ye]}class $b extends W5{constructor(e){super(),$5(this,e,Ub,Vb,z5,{changes:22,userChangesPresent:21},null,[-1,-1])}}function Wb(i){let e;return{c(){e=S1("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(t,r){te(t,e,r)},d(t){t&&J1(e)}}}function Gb(i){let e,t,r;return{c(){e=Re("This uses the "),t=S1("a"),t.textContent="Pyodide library",r=Re(" to run the calculation entirely in your browser."),e1(t,"href","https://pyodide.org/en/stable/"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Zb(i){let e,t,r;return{c(){e=Re("To use this option, the API must be running on port 5178. See the "),t=S1("a"),t.textContent="developer notes",r=Re(" for details on how to set this up."),e1(t,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Hb(i){let e,t,r;return{c(){e=Re("This is an "),t=S1("a"),t.textContent="Azure Functions",r=Re(" instance, i.e. a web service hosted on the cloud."),e1(t,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),e1(t,"target","_blank")},m(n,f){te(n,e,f),te(n,t,f),te(n,r,f)},d(n){n&&J1(e),n&&J1(t),n&&J1(r)}}}function Xb(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T,A,z,R,N,W;e=new Fu({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",i[7]),e.$on("forwardClick",i[8]),r=new F7({});let K=!i[6]&&Wb();function J(d1,_1){if(d1[2]==="azure")return Hb;if(d1[2]==="local")return Zb;if(d1[2]==="wasm")return Gb}let s1=J(i),i1=s1&&s1(i);return C=new F7({}),{c(){d5(e.$$.fragment),t=le(),d5(r.$$.fragment),n=le(),f=S1("div"),p=S1("i"),p.textContent="Calculation method",o=le(),y=S1("select"),d=S1("option"),d.textContent="Azure REST API",K&&K.c(),x=S1("option"),x.textContent="In-browser",w=le(),P=S1("div"),i1&&i1.c(),q=le(),d5(C.$$.fragment),S=le(),T=S1("input"),A=le(),z=S1("textarea"),d.__value="azure",d.value=d.__value,x.__value="wasm",x.value=x.__value,i[2]===void 0&&$0(()=>i[9].call(y)),e1(f,"id","calculation-method-choice"),e1(f,"class","svelte-ygj49d"),e1(P,"class","smaller svelte-ygj49d"),e1(T,"type","text"),e1(T,"placeholder","Scenario title..."),e1(T,"class","svelte-ygj49d"),e1(z,"placeholder","A longer textual description..."),e1(z,"spellcheck","false"),e1(z,"class","svelte-ygj49d")},m(d1,_1){p5(e,d1,_1),te(d1,t,_1),p5(r,d1,_1),te(d1,n,_1),te(d1,f,_1),p1(f,p),p1(f,o),p1(f,y),p1(y,d),K&&K.m(y,null),p1(y,x),e9(y,i[2],!0),te(d1,w,_1),te(d1,P,_1),i1&&i1.m(P,null),te(d1,q,_1),p5(C,d1,_1),te(d1,S,_1),te(d1,T,_1),i[10](T),It(T,i[0]),te(d1,A,_1),te(d1,z,_1),i[13](z),It(z,i[1]),R=!0,N||(W=[Ge(y,"change",i[9]),Ge(T,"input",i[11]),Ge(T,"input",i[12]),Ge(z,"input",i[14]),Ge(z,"input",i[15])],N=!0)},p(d1,_1){_1&4&&e9(y,d1[2]),s1!==(s1=J(d1))&&(i1&&i1.d(1),i1=s1&&s1(d1),i1&&(i1.c(),i1.m(P,null))),_1&1&&T.value!==d1[0]&&It(T,d1[0]),_1&2&&It(z,d1[1])},i(d1){R||(he(e.$$.fragment,d1),he(r.$$.fragment,d1),he(C.$$.fragment,d1),R=!0)},o(d1){xe(e.$$.fragment,d1),xe(r.$$.fragment,d1),xe(C.$$.fragment,d1),R=!1},d(d1){u5(e,d1),d1&&J1(t),u5(r,d1),d1&&J1(n),d1&&J1(f),K&&K.d(),d1&&J1(w),d1&&J1(P),i1&&i1.d(),d1&&J1(q),u5(C,d1),d1&&J1(S),d1&&J1(T),i[10](null),d1&&J1(A),d1&&J1(z),i[13](null),N=!1,p0(W)}}}function Yb(i){let e,t;return e=new ca({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[Xb]},$$scope:{ctx:i}}}),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,[n]){const f={};n&65567&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function ef(i){i.style.borderColor="#f26d88"}function Kb(i,e,t){let{scenarioShort:r=""}=e,{scenarioDescription:n=""}=e,{calculationMethod:f="azure"}=e;const p=Ft();let o,y;const d=window.location.href.toLowerCase().includes(Se.baseUrl.toLowerCase()),x=()=>p("returnToModify"),w=()=>{if(r===""){alert("Please enter a scenario title."),ef(o);return}if(n===""){alert("Please enter a scenario description."),ef(y);return}p("acceptChangesAndCalculate")};function P(){f=b7(this),t(2,f)}function q(R){H5[R?"unshift":"push"](()=>{o=R,t(3,o)})}function C(){r=this.value,t(0,r)}const S=()=>{t(3,o.style.borderColor=r===""?"#f26d88":"#999",o)};function T(R){H5[R?"unshift":"push"](()=>{y=R,t(4,y)})}function A(){n=this.value,t(1,n)}const z=()=>{t(4,y.style.borderColor=n===""?"#f26d88":"#999",y)};return i.$$set=R=>{"scenarioShort"in R&&t(0,r=R.scenarioShort),"scenarioDescription"in R&&t(1,n=R.scenarioDescription),"calculationMethod"in R&&t(2,f=R.calculationMethod)},[r,n,f,o,y,p,d,x,w,P,q,C,S,T,A,z]}class Jb extends W5{constructor(e){super(),$5(this,e,Kb,Yb,z5,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Qb="modulepreload",em=function(i){return"/demoland-web/dev/isle_of_wight/"+i},tf={},tm=function(e,t,r){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(f=>{if(f=em(f),f in tf)return;tf[f]=!0;const p=f.endsWith(".css"),o=p?'[rel="stylesheet"]':"";if(!!r)for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.href===f&&(!p||w.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${o}`))return;const d=document.createElement("link");if(d.rel=p?"stylesheet":Qb,p||(d.as="script",d.crossOrigin=""),d.href=f,document.head.appendChild(d),p)return new Promise((x,w)=>{d.addEventListener("load",x),d.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=f,window.dispatchEvent(p),!p.defaultPrevented)throw f})};let Zi;const D4={};let _4=0;async function im(){if(Zi)return Zi;const i=await tm(()=>import("./pyodide_worker-dcd3f9ec.js"),[]);return Zi=new i.default,Zi.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:t,...r}=e.data,n=D4[t];console.log(D4),delete D4[t],n(r)}},Zi}async function rm(i,e){const t=await im();return _4=(_4+1)%Number.MAX_SAFE_INTEGER,new Promise(r=>{D4[_4]=r,t.postMessage({...e,python:i,id:_4,pathname:window.location.pathname})})}async function sm(i){const t=await rm(` import pyodide_http import pyodide_js import os @@ -79,7 +79,7 @@ modelled development strategies on any of the four indicators. prediction = pred.to_dict("index") print(f"{time.time() - start}s to run") json.dumps(prediction) - `,{scenario_json:i,pathname:window.location.pathname,BASE_URL:window.location.origin+window.location.pathname});return t.error?(console.error(t.error),t):JSON.parse(t.results)}function rf(i){let e,t;return e=new Ab({}),e.$on("changeScenario",i[9]),e.$on("changeScenarioAndProceed",i[10]),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p:t5,i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function sf(i){let e,t,r;function n(p){i[12](p)}let f={};return i[6]!==void 0&&(f.userChangesPresent=i[6]),e=new $b({props:f}),H5.push(()=>O0(e,"userChangesPresent",n)),e.$on("returnToSelection",i[8]),e.$on("changesUpdated",i[13]),e.$on("proceedToMetadata",i[14]),{c(){d5(e.$$.fragment)},m(p,o){p5(e,p,o),r=!0},p(p,o){const y={};!t&&o&64&&(t=!0,y.userChangesPresent=p[6],R0(()=>t=!1)),e.$set(y)},i(p){r||(he(e.$$.fragment,p),r=!0)},o(p){xe(e.$$.fragment,p),r=!1},d(p){u5(e,p)}}}function of(i){let e,t,r,n,f;function p(x){i[15](x)}function o(x){i[16](x)}function y(x){i[17](x)}let d={};return i[4]!==void 0&&(d.scenarioShort=i[4]),i[5]!==void 0&&(d.scenarioDescription=i[5]),i[2]!==void 0&&(d.calculationMethod=i[2]),e=new Jb({props:d}),H5.push(()=>O0(e,"scenarioShort",p)),H5.push(()=>O0(e,"scenarioDescription",o)),H5.push(()=>O0(e,"calculationMethod",y)),e.$on("returnToModify",i[18]),e.$on("acceptChangesAndCalculate",i[11]),{c(){d5(e.$$.fragment)},m(x,w){p5(e,x,w),f=!0},p(x,w){const P={};!t&&w&16&&(t=!0,P.scenarioShort=x[4],R0(()=>t=!1)),!r&&w&32&&(r=!0,P.scenarioDescription=x[5],R0(()=>r=!1)),!n&&w&4&&(n=!0,P.calculationMethod=x[2],R0(()=>n=!1)),e.$set(P)},i(x){f||(he(e.$$.fragment,x),f=!0)},o(x){xe(e.$$.fragment,x),f=!1},d(x){u5(e,x)}}}function af(i){let e,t;return e=new gb({}),e.$on("abort",i[19]),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p:t5,i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function nf(i){let e,t;return e=new vb({props:{message:i[1]}}),e.$on("close",i[20]),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,n){const f={};n&2&&(f.message=r[1]),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function om(i){let e,t,r,n,f,p,o,y=i[0]==="choose"&&rf(i),d=i[0]==="modify"&&sf(i),x=i[0]==="metadata"&&of(i),w=i[0]==="calc"&&af(i),P=i[0]==="error"&&nf(i);return{c(){e=Re(`Create your own scenario by modifying an existing one. + `,{scenario_json:i,pathname:window.location.pathname,model_identifier:window.location.pathname.split("/").slice(-2,-1)[0]});return t.error?(console.error(t.error),t):JSON.parse(t.results)}function rf(i){let e,t;return e=new Ab({}),e.$on("changeScenario",i[9]),e.$on("changeScenarioAndProceed",i[10]),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p:t5,i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function sf(i){let e,t,r;function n(p){i[12](p)}let f={};return i[6]!==void 0&&(f.userChangesPresent=i[6]),e=new $b({props:f}),H5.push(()=>O0(e,"userChangesPresent",n)),e.$on("returnToSelection",i[8]),e.$on("changesUpdated",i[13]),e.$on("proceedToMetadata",i[14]),{c(){d5(e.$$.fragment)},m(p,o){p5(e,p,o),r=!0},p(p,o){const y={};!t&&o&64&&(t=!0,y.userChangesPresent=p[6],R0(()=>t=!1)),e.$set(y)},i(p){r||(he(e.$$.fragment,p),r=!0)},o(p){xe(e.$$.fragment,p),r=!1},d(p){u5(e,p)}}}function of(i){let e,t,r,n,f;function p(x){i[15](x)}function o(x){i[16](x)}function y(x){i[17](x)}let d={};return i[4]!==void 0&&(d.scenarioShort=i[4]),i[5]!==void 0&&(d.scenarioDescription=i[5]),i[2]!==void 0&&(d.calculationMethod=i[2]),e=new Jb({props:d}),H5.push(()=>O0(e,"scenarioShort",p)),H5.push(()=>O0(e,"scenarioDescription",o)),H5.push(()=>O0(e,"calculationMethod",y)),e.$on("returnToModify",i[18]),e.$on("acceptChangesAndCalculate",i[11]),{c(){d5(e.$$.fragment)},m(x,w){p5(e,x,w),f=!0},p(x,w){const P={};!t&&w&16&&(t=!0,P.scenarioShort=x[4],R0(()=>t=!1)),!r&&w&32&&(r=!0,P.scenarioDescription=x[5],R0(()=>r=!1)),!n&&w&4&&(n=!0,P.calculationMethod=x[2],R0(()=>n=!1)),e.$set(P)},i(x){f||(he(e.$$.fragment,x),f=!0)},o(x){xe(e.$$.fragment,x),f=!1},d(x){u5(e,x)}}}function af(i){let e,t;return e=new gb({}),e.$on("abort",i[19]),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p:t5,i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function nf(i){let e,t;return e=new vb({props:{message:i[1]}}),e.$on("close",i[20]),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,n){const f={};n&2&&(f.message=r[1]),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function om(i){let e,t,r,n,f,p,o,y=i[0]==="choose"&&rf(i),d=i[0]==="modify"&&sf(i),x=i[0]==="metadata"&&of(i),w=i[0]==="calc"&&af(i),P=i[0]==="error"&&nf(i);return{c(){e=Re(`Create your own scenario by modifying an existing one. `),y&&y.c(),t=le(),d&&d.c(),r=le(),x&&x.c(),n=le(),w&&w.c(),f=le(),P&&P.c(),p=$t()},m(q,C){te(q,e,C),y&&y.m(q,C),te(q,t,C),d&&d.m(q,C),te(q,r,C),x&&x.m(q,C),te(q,n,C),w&&w.m(q,C),te(q,f,C),P&&P.m(q,C),te(q,p,C),o=!0},p(q,[C]){q[0]==="choose"?y?(y.p(q,C),C&1&&he(y,1)):(y=rf(q),y.c(),he(y,1),y.m(t.parentNode,t)):y&&(x0(),xe(y,1,1,()=>{y=null}),v0()),q[0]==="modify"?d?(d.p(q,C),C&1&&he(d,1)):(d=sf(q),d.c(),he(d,1),d.m(r.parentNode,r)):d&&(x0(),xe(d,1,1,()=>{d=null}),v0()),q[0]==="metadata"?x?(x.p(q,C),C&1&&he(x,1)):(x=of(q),x.c(),he(x,1),x.m(n.parentNode,n)):x&&(x0(),xe(x,1,1,()=>{x=null}),v0()),q[0]==="calc"?w?(w.p(q,C),C&1&&he(w,1)):(w=af(q),w.c(),he(w,1),w.m(f.parentNode,f)):w&&(x0(),xe(w,1,1,()=>{w=null}),v0()),q[0]==="error"?P?(P.p(q,C),C&1&&he(P,1)):(P=nf(q),P.c(),he(P,1),P.m(p.parentNode,p)):P&&(x0(),xe(P,1,1,()=>{P=null}),v0())},i(q){o||(he(y),he(d),he(x),he(w),he(P),o=!0)},o(q){xe(y),xe(d),xe(x),xe(w),xe(P),o=!1},d(q){q&&J1(e),y&&y.d(q),q&&J1(t),d&&d.d(q),q&&J1(r),x&&x.d(q),q&&J1(n),w&&w.d(q),q&&J1(f),P&&P.d(q),q&&J1(p)}}}let am="Are you sure you want to go back? All changes will be lost.";function nm(i,e,t){let r,n,f,p,o;m5(i,nt,g1=>t(21,r=g1)),m5(i,lt,g1=>t(22,n=g1)),m5(i,O9,g1=>t(23,f=g1)),m5(i,X4,g1=>t(24,p=g1)),m5(i,$3,g1=>t(25,o=g1));const y=Ft();let d="choose",x="An error occurred.",w,P,q="",C="",S=!1;O7(()=>{q5(nt,r=[],r)});function T(){S?window.confirm(am)&&(t(6,S=!1),q5(nt,r=[],r),t(0,d="choose"),q5(lt,n=Se.referenceScenarioObject.metadata.name,n),y("changeScenario")):(q5(nt,r=[],r),t(0,d="choose"))}function A(){y("changeScenario",{}),q5(nt,r=[],r)}function z(){A(),t(0,d="modify")}function R(g1,k1){console.log("handleResult called");const C1={metadata:{name:q.replace(/\s/g,"_").toLowerCase(),short:q,long:"Custom: "+q,description:C},changes:JSON.parse(k1).scenario_json,values:g1};console.log("obj",C1);const I1=hr(C1,o,p,"custom scenario");if(console.log("newScenario",I1),f.has(I1.metadata.name)){let L1=1;for(;f.has(`${I1.metadata.name}_${L1})`);)L1++;I1.metadata.name=`${I1.metadata.name}_${L1}`}f.set(I1.metadata.name,I1),t(6,S=!1),y("import",{name:I1.metadata.name})}function N(g1,k1){if(g1.ok)g1.json().then(C1=>R(C1,k1));else throw t(0,d="error"),t(1,x=`HTTP request to custom scenario server failed: received ${g1.status} ${g1.statusText}.`),g1.status===500&&t(1,x+=" (If you are running locally, did you start the backend up?)"),new Error(x)}function W(g1){g1 instanceof DOMException&&g1.name==="AbortError"?(t(0,d="metadata"),console.log("Calculation aborted")):(t(0,d="error"),t(1,x=g1.message))}function K(){const g1=JSON.stringify({scenario_json:vu(f.get(n).changes),model_identifier:Se.modelIdentifier});if(console.log("changedJson",g1),t(0,d="calc"),q5(nt,r=[],r),t(3,P=new AbortController),console.log("Running with runner",w),w==="wasm")sm(g1).then(k1=>{console.log("result",k1),k1.error?W(new Error(k1.error)):(console.log(k1),R(k1,g1),console.log("scenario result is ",k1))}).catch(k1=>W(k1));else if(w==="azure"||w==="local"){const k1=w==="azure"?`${Se.webApiUrl}/api/scenario`:`${Se.localApiUrl}/api/scenario`;fetch(k1,{method:"POST",headers:{"Content-Type":"application/json"},body:g1,signal:P.signal}).then(C1=>N(C1,g1)).catch(C1=>W(C1))}}function J(g1){S=g1,t(6,S)}const s1=()=>{y("changesUpdated")},i1=()=>t(0,d="metadata");function d1(g1){q=g1,t(4,q)}function _1(g1){C=g1,t(5,C)}function o1(g1){w=g1,t(2,w)}return[d,x,w,P,q,C,S,y,T,A,z,K,J,s1,i1,d1,_1,o1,()=>t(0,d="modify"),()=>P.abort(),()=>t(0,d="metadata")]}class cm extends W5{constructor(e){super(),$5(this,e,nm,om,z5,{})}}function fm(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T,A;return{c(){e=S1("div"),t=S1("div"),r=S1("h3"),r.textContent="An error occurred :(",n=le(),f=S1("p"),p=Re(i[0]),o=le(),y=S1("p"),d=Re("Please try again, or "),x=S1("a"),w=Re("contact the developers"),P=Re(" if the problem persists."),q=le(),C=S1("p"),S=S1("button"),S.textContent="Close",e1(r,"class","svelte-1xb3nt3"),e1(f,"id","error-message"),e1(f,"class","svelte-1xb3nt3"),e1(x,"href",lm),e1(x,"class","svelte-1xb3nt3"),e1(y,"class","svelte-1xb3nt3"),e1(S,"id","error-close"),e1(S,"class","svelte-1xb3nt3"),e1(C,"class","svelte-1xb3nt3"),e1(t,"id","error"),e1(t,"class","svelte-1xb3nt3"),e1(e,"id","error-cover"),e1(e,"class","svelte-1xb3nt3")},m(z,R){te(z,e,R),p1(e,t),p1(t,r),p1(t,n),p1(t,f),p1(f,p),p1(t,o),p1(t,y),p1(y,d),p1(y,x),p1(x,w),p1(y,P),p1(t,q),p1(t,C),p1(C,S),T||(A=Ge(S,"click",i[1]),T=!0)},p(z,[R]){R&1&&_0(p,z[0])},i:t5,o:t5,d(z){z&&J1(e),T=!1,A()}}}const lm="https://github.com/Urban-Analytics-Technology-Platform/demoland-web/issues";function pm(i,e,t){const r=Ft();let{message:n}=e;function f(){r("close")}return i.$$set=p=>{"message"in p&&t(0,n=p.message)},[n,f]}class um extends W5{constructor(e){super(),$5(this,e,pm,fm,z5,{message:0})}}function cf(i){let e,t;return e=new um({props:{message:i[2]}}),e.$on("close",i[7]),{c(){d5(e.$$.fragment)},m(r,n){p5(e,r,n),t=!0},p(r,n){const f={};n&4&&(f.message=r[2]),e.$set(f)},i(r){t||(he(e.$$.fragment,r),t=!0)},o(r){xe(e.$$.fragment,r),t=!1},d(r){u5(e,r)}}}function ym(i){let e,t,r,n,f,p,o,y,d,x,w,P,q,C,S,T=i[1]&&cf(i);return{c(){e=S1("div"),t=Re(`If you have already modelled a custom scenario and saved the results, you can import it here to visualise the results. diff --git a/dev/tyne_and_wear/assets/pyodide_worker-9534fa03.js b/dev/isle_of_wight/assets/pyodide_worker-d616a3be.js similarity index 97% rename from dev/tyne_and_wear/assets/pyodide_worker-9534fa03.js rename to dev/isle_of_wight/assets/pyodide_worker-d616a3be.js index 524956b..8cfaeb5 100644 --- a/dev/tyne_and_wear/assets/pyodide_worker-9534fa03.js +++ b/dev/isle_of_wight/assets/pyodide_worker-d616a3be.js @@ -7,4 +7,4 @@ var oe=Object.create,L=Object.defineProperty,ae=Object.getOwnPropertyDescriptor, `),p=[],c=2,d=s.length;c/,"$2").replace(/\([^)]*\)/g,"")||void 0,y;d.match(/\(([^)]*)\)/)&&(y=d.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var g=y===void 0||y==="[arguments not available]"?void 0:y.split(",");return new o({functionName:m,args:g,fileName:c[0],lineNumber:c[1],columnNumber:c[2],source:s})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))}),me=pe(fe()),w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",x,E,F,$,D;async function I(){if(!w||(x=(await import("./__vite-browser-external-dfc062b5.js")).default,D=await import("./__vite-browser-external-dfc062b5.js"),globalThis.fetch?E=fetch:E=(await import("./fetch-npm-browserify-1ff37dca.js").then(function(i){return i.f})).default,$=(await import("./__vite-browser-external-dfc062b5.js")).default,F=await import("./__vite-browser-external-dfc062b5.js"),N=F.sep,typeof ce<"u"))return;let e=await import("./__vite-browser-external-dfc062b5.js"),t=await import("./__vite-browser-external-dfc062b5.js"),o=await import("./__vite-browser-external-dfc062b5.js"),a=await import("./__vite-browser-external-dfc062b5.js"),n={fs:e,crypto:t,ws:o,child_process:a};globalThis.require=function(i){return n[i]}}u(I,"initNodeModules");function T(e,t){return F.resolve(t||".",e)}u(T,"node_resolvePath");function A(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}u(A,"browser_resolvePath");var P;w?P=T:P=A;var N;w||(N="/");function M(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:E(e)}:{binary:D.readFile(e).then(o=>new Uint8Array(o.buffer,o.byteOffset,o.byteLength))}}u(M,"node_getBinaryResponse");function U(e,t){let o=new URL(e,location);return{response:fetch(o,t?{integrity:t}:{})}}u(U,"browser_getBinaryResponse");var k;w?k=M:k=U;async function H(e,t){let{response:o,binary:a}=k(e,t);if(a)return a;let n=await o;if(!n.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await n.arrayBuffer())}u(H,"loadBinaryFile");var b;if(globalThis.document)b=u(async e=>await import(e),"loadScript");else if(globalThis.importScripts)b=u(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(e);else throw t}},"loadScript");else if(w)b=C;else throw new Error("Cannot determine runtime environment");async function C(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?$.runInThisContext(await(await E(e)).text()):await import(x.pathToFileURL(e).href)}u(C,"nodeLoadScript");function q(e){let t=e.FS,o=e.FS.filesystems.MEMFS,a=e.PATH,n={DIR_MODE:16895,FILE_MODE:33279,mount:function(i){if(!i.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return o.mount.apply(null,arguments)},syncfs:async(i,r,l)=>{try{let s=n.getLocalSet(i),p=await n.getRemoteSet(i),c=r?p:s,d=r?s:p;await n.reconcile(i,c,d),l(null)}catch(s){l(s)}},getLocalSet:i=>{let r=Object.create(null);function l(c){return c!=="."&&c!==".."}u(l,"isRealDir");function s(c){return d=>a.join2(c,d)}u(s,"toAbsolute");let p=t.readdir(i.mountpoint).filter(l).map(s(i.mountpoint));for(;p.length;){let c=p.pop(),d=t.stat(c);t.isDir(d.mode)&&p.push.apply(p,t.readdir(c).filter(l).map(s(c))),r[c]={timestamp:d.mtime,mode:d.mode}}return{type:"local",entries:r}},getRemoteSet:async i=>{let r=Object.create(null),l=await ye(i.opts.fileSystemHandle);for(let[s,p]of l)s!=="."&&(r[a.join2(i.mountpoint,s)]={timestamp:p.kind==="file"?(await p.getFile()).lastModifiedDate:new Date,mode:p.kind==="file"?n.FILE_MODE:n.DIR_MODE});return{type:"remote",entries:r,handles:l}},loadLocalEntry:i=>{let r=t.lookupPath(i).node,l=t.stat(i);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return r.contents=o.getFileDataAsTypedArray(r),{timestamp:l.mtime,mode:l.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(i,r)=>{if(t.isDir(r.mode))t.mkdirTree(i,r.mode);else if(t.isFile(r.mode))t.writeFile(i,r.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(i,r.mode),t.utime(i,r.timestamp,r.timestamp)},removeLocalEntry:i=>{var r=t.stat(i);t.isDir(r.mode)?t.rmdir(i):t.isFile(r.mode)&&t.unlink(i)},loadRemoteEntry:async i=>{if(i.kind==="file"){let r=await i.getFile();return{contents:new Uint8Array(await r.arrayBuffer()),mode:n.FILE_MODE,timestamp:r.lastModifiedDate}}else{if(i.kind==="directory")return{mode:n.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+i.kind)}},storeRemoteEntry:async(i,r,l)=>{let s=i.get(a.dirname(r)),p=t.isFile(l.mode)?await s.getFileHandle(a.basename(r),{create:!0}):await s.getDirectoryHandle(a.basename(r),{create:!0});if(p.kind==="file"){let c=await p.createWritable();await c.write(l.contents),await c.close()}i.set(r,p)},removeRemoteEntry:async(i,r)=>{await i.get(a.dirname(r)).removeEntry(a.basename(r)),i.delete(r)},reconcile:async(i,r,l)=>{let s=0,p=[];Object.keys(r.entries).forEach(function(m){let y=r.entries[m],g=l.entries[m];(!g||t.isFile(y.mode)&&y.timestamp.getTime()>g.timestamp.getTime())&&(p.push(m),s++)}),p.sort();let c=[];if(Object.keys(l.entries).forEach(function(m){r.entries[m]||(c.push(m),s++)}),c.sort().reverse(),!s)return;let d=r.type==="remote"?r.handles:l.handles;for(let m of p){let y=a.normalize(m.replace(i.mountpoint,"/")).substring(1);if(l.type==="local"){let g=d.get(y),f=await n.loadRemoteEntry(g);n.storeLocalEntry(m,f)}else{let g=n.loadLocalEntry(m);await n.storeRemoteEntry(d,y,g)}}for(let m of c)if(l.type==="local")n.removeLocalEntry(m);else{let y=a.normalize(m.replace(i.mountpoint,"/")).substring(1);await n.removeRemoteEntry(d,y)}}};e.FS.filesystems.NATIVEFS_ASYNC=n}u(q,"initializeNativeFS");var ye=u(async e=>{let t=[];async function o(n){for await(let i of n.values())t.push(i),i.kind==="directory"&&await o(i)}u(o,"collect"),await o(e);let a=new Map;a.set(".",e);for(let n of t){let i=(await e.resolve(n)).join("/");a.set(i,n)}return a},"getFsHandles");function z(){let e={};return e.noImageDecoding=!0,e.noAudioDecoding=!0,e.noWasmDecoding=!1,e.preRun=[],e.quit=(t,o)=>{throw e.exited={status:t,toThrow:o},o},e}u(z,"createModule");function W(e,t){e.preRun.push(function(){let o="/";try{e.FS.mkdirTree(t)}catch(a){console.error(`Error occurred while making a home directory '${t}':`),console.error(a),console.error(`Using '${o}' for a home directory instead`),t=o}e.FS.chdir(t)})}u(W,"createHomeDirectory");function B(e,t){e.preRun.push(function(){Object.assign(e.ENV,t)})}u(B,"setEnvironment");function V(e,t){e.preRun.push(()=>{for(let o of t)e.FS.mkdirTree(o),e.FS.mount(e.FS.filesystems.NODEFS,{root:o},o)})}u(V,"mountLocalDirectories");function G(e,t){let o=H(t);e.preRun.push(()=>{let a=e._py_version_major(),n=e._py_version_minor();e.FS.mkdirTree("/lib"),e.FS.mkdirTree(`/lib/python${a}.${n}/site-packages`),e.addRunDependency("install-stdlib"),o.then(i=>{e.FS.writeFile(`/lib/python${a}${n}.zip`,i)}).catch(i=>{console.error("Error occurred while installing the standard library:"),console.error(i)}).finally(()=>{e.removeRunDependency("install-stdlib")})})}u(G,"installStdlib");function K(e,t){let o;t.stdLibURL!=null?o=t.stdLibURL:o=t.indexURL+"python_stdlib.zip",G(e,o),W(e,t.env.HOME),B(e,t.env),V(e,t._node_mounts),e.preRun.push(()=>q(e))}u(K,"initializeFileSystem");function Y(e,t){let{binary:o,response:a}=k(t+"pyodide.asm.wasm");e.instantiateWasm=function(n,i){return async function(){try{let r;a?r=await WebAssembly.instantiateStreaming(a,n):r=await WebAssembly.instantiate(await o,n);let{instance:l,module:s}=r;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,s)),i(l,s)}catch(r){console.warn("wasm instantiation failed!"),console.warn(r)}}(),{}}}u(Y,"preloadWasm");var S="0.24.1";function J(e,t){return new Proxy(e,{get(o,a){return a==="get"?n=>{let i=o.get(n);return i===void 0&&(i=t.get(n)),i}:a==="has"?n=>o.has(n)||t.has(n):Reflect.get(o,a)}})}u(J,"wrapPythonGlobals");function Q(e,t){e.runPythonInternal_dict=e._pyodide._base.eval_code("{}"),e.importlib=e.runPythonInternal("import importlib; importlib");let o=e.importlib.import_module;e.sys=o("sys"),e.sys.path.insert(0,t.env.HOME),e.os=o("os");let a=e.runPythonInternal("import __main__; __main__.__dict__"),n=e.runPythonInternal("import builtins; builtins.__dict__");e.globals=J(a,n);let i=e._pyodide._importhook;function r(s){"__all__"in s||Object.defineProperty(s,"__all__",{get:()=>l.toPy(Object.getOwnPropertyNames(s).filter(p=>p!=="__all__")),enumerable:!1,configurable:!0})}u(r,"jsFinderHook"),i.register_js_finder.callKwargs({hook:r}),i.register_js_module("js",t.jsglobals);let l=e.makePublicAPI();return i.register_js_module("pyodide_js",l),e.pyodide_py=o("pyodide"),e.pyodide_code=o("pyodide.code"),e.pyodide_ffi=o("pyodide.ffi"),e.package_loader=o("pyodide._package_loader"),e.sitepackages=e.package_loader.SITE_PACKAGES.__str__(),e.dsodir=e.package_loader.DSO_DIR.__str__(),e.defaultLdLibraryPath=[e.dsodir,e.sitepackages],e.os.environ.__setitem__("LD_LIBRARY_PATH",e.defaultLdLibraryPath.join(":")),l.pyodide_py=e.pyodide_py,l.globals=e.globals,l}u(Q,"finalizeBootstrap");function X(){if(typeof __dirname=="string")return __dirname;let e;try{throw new Error}catch(a){e=a}let t=me.default.parse(e)[0].fileName,o=t.lastIndexOf(N);if(o===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,o)}u(X,"calculateIndexURL");async function Z(e={}){await I();let t=e.indexURL||X();t=P(t),t.endsWith("/")||(t+="/"),e.indexURL=t;let o={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:t+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:t,packages:[]},a=Object.assign(o,e);if(e.homedir){if(console.warn("The homedir argument to loadPyodide is deprecated. Use 'env: { HOME: value }' instead of 'homedir: value'."),e.env&&e.env.HOME)throw new Error("Set both env.HOME and homedir arguments");a.env.HOME=a.homedir}a.env.HOME||(a.env.HOME="/home/pyodide");let n=z();n.print=a.stdout,n.printErr=a.stderr,n.arguments=a.args;let i={config:a};n.API=i,Y(n,t),K(n,a);let r=new Promise(d=>n.postRun=d),l;if(i.bootstrapFinalizedPromise=new Promise(d=>l=d),n.locateFile=d=>a.indexURL+d,typeof _createPyodideModule!="function"){let d=`${a.indexURL}pyodide.asm.js`;await b(d)}if(await _createPyodideModule(n),await r,n.exited)throw n.exited.toThrow;if(i.version!==S)throw new Error(`Pyodide version does not match: '${S}' <==> '${i.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);n.locateFile=d=>{throw new Error("Didn't expect to load any more file_packager files!")};let[s,p]=i.rawRun("import _pyodide_core");s&&n.API.fatal_loading_error(`Failed to import _pyodide_core -`,p);let c=Q(i,a);if(l(),c.version.includes("dev")||i.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),await i.packageIndexReady,i._pyodide._importhook.register_module_not_found_hook(i._import_name_to_package_name,i.lockfile_unvendored_stdlibs_and_test),i.lockfile_info.version!==S)throw new Error("Lock file version doesn't match Pyodide version");return i.package_loader.init_loaded_packages(),a.fullStdLib&&await c.loadPackage(i.lockfile_unvendored_stdlibs),i.initializeStreams(a.stdin,a.stdout,a.stderr),c}u(Z,"loadPyodide");async function he(e){self.pyodide=await Z({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.24.1/full/"}),await self.pyodide.loadPackage(["micropip"]);const t=self.pyodide.pyimport("micropip");await t.install("lzma"),await t.install("pyodide-http"),await t.install(e+"demoland_engine-0.1.dev1+g8333879-py3-none-any.whl")}self.onmessage=async e=>{const{id:t,python:o,pathname:a,scenario_json:n,BASE_URL:i}=e.data;try{await he(a)}catch(l){console.error(l),self.postMessage({error:l.message})}self.scenario_json=n;let r=i.split("/").slice(-2,-1)[0];self.pyodide.globals.set("DEMOLAND",r);try{await self.pyodide.loadPackagesFromImports(o);const l=await self.pyodide.runPythonAsync(o);self.postMessage({results:l,id:t})}catch(l){self.postMessage({error:l.message,id:t})}}; +`,p);let c=Q(i,a);if(l(),c.version.includes("dev")||i.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),await i.packageIndexReady,i._pyodide._importhook.register_module_not_found_hook(i._import_name_to_package_name,i.lockfile_unvendored_stdlibs_and_test),i.lockfile_info.version!==S)throw new Error("Lock file version doesn't match Pyodide version");return i.package_loader.init_loaded_packages(),a.fullStdLib&&await c.loadPackage(i.lockfile_unvendored_stdlibs),i.initializeStreams(a.stdin,a.stdout,a.stderr),c}u(Z,"loadPyodide");async function he(e){self.pyodide=await Z({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.24.1/full/"}),await self.pyodide.loadPackage(["micropip"]);const t=self.pyodide.pyimport("micropip");await t.install("lzma"),await t.install("pyodide-http"),await t.install(e+"demoland_engine-0.1.dev1+g8333879-py3-none-any.whl")}self.onmessage=async e=>{const{id:t,python:o,pathname:a,scenario_json:n,model_identifier:i}=e.data;try{await he(a)}catch(r){console.error(r),self.postMessage({error:r.message})}self.scenario_json=n,self.pyodide.globals.set("DEMOLAND",i);try{await self.pyodide.loadPackagesFromImports(o);const r=await self.pyodide.runPythonAsync(o);self.postMessage({results:r,id:t})}catch(r){self.postMessage({error:r.message,id:t})}}; diff --git a/dev/isle_of_wight/assets/pyodide_worker-c89af0e2.js b/dev/isle_of_wight/assets/pyodide_worker-dcd3f9ec.js similarity index 53% rename from dev/isle_of_wight/assets/pyodide_worker-c89af0e2.js rename to dev/isle_of_wight/assets/pyodide_worker-dcd3f9ec.js index 8552619..05f952e 100644 --- a/dev/isle_of_wight/assets/pyodide_worker-c89af0e2.js +++ b/dev/isle_of_wight/assets/pyodide_worker-dcd3f9ec.js @@ -1 +1 @@ -function e(){return new Worker("/demoland-web/dev/isle_of_wight/assets/pyodide_worker-9534fa03.js",{type:"module"})}export{e as default}; +function e(){return new Worker("/demoland-web/dev/isle_of_wight/assets/pyodide_worker-d616a3be.js",{type:"module"})}export{e as default}; diff --git a/dev/isle_of_wight/index.html b/dev/isle_of_wight/index.html index ad346a1..e946cc9 100644 --- a/dev/isle_of_wight/index.html +++ b/dev/isle_of_wight/index.html @@ -7,7 +7,7 @@ - + diff --git a/dev/tyne_and_wear/assets/index-02bf7658.js b/dev/tyne_and_wear/assets/index-e6ec8c7c.js similarity index 99% rename from dev/tyne_and_wear/assets/index-02bf7658.js rename to dev/tyne_and_wear/assets/index-e6ec8c7c.js index 513452f..5056ecd 100644 --- a/dev/tyne_and_wear/assets/index-02bf7658.js +++ b/dev/tyne_and_wear/assets/index-e6ec8c7c.js @@ -35,7 +35,7 @@ modelled development strategies on any of the four indicators. for your own modifications.`,i=l1(),g0(t.$$.fragment),_=l1();for(let g=0;gi(3,t=g)),q0(s,li,g=>i(4,_=g)),q0(s,R5,g=>i(0,o=g));const n=vi();n("changeScenario",{});function c(g){const d=document.querySelectorAll(".scenario-button");Array.from(d).forEach(m=>{m!==g.target&&(m.style.backgroundColor="#fff")});let x=g.target;x.style.backgroundColor="#eaeaea",A0(li,_=x.value,_),A0(mi,t=null,t),n("changeScenario")}function u(g){let d=g.target;const x="custom_in_progress";o.set(x,Oj(o.get(d.value))),A0(li,_=x,_),A0(mi,t=null,t),n("changeScenarioAndProceed")}return[o,c,u]}class _q extends W0{constructor(e){super(),$0(this,e,rq,cq,M0,{})}}function Hy(s,e,i){const t=s.slice();return t[45]=e[i][0],t[46]=e[i][1],t}function Xy(s,e,i){const t=s.slice();return t[45]=e[i][0],t[46]=e[i][1],t}function yq(s){let e;return{c(){e=Pe("div"),e.textContent=`Click and move your mouse on the map to draw a region of interest. When you are done drawing, click again on the starting point to select all OAs within the region.`,ee(e,"class","smaller svelte-1392tz3")},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function oq(s){let e;return{c(){e=Pe("div"),e.textContent=`Click on the map to select an output area. You can shift-click to - select multiple, or click anywhere outside the map to deselect all.`,ee(e,"class","smaller svelte-1392tz3")},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function lq(s){let e,i=s[0].length+"",t,_,o=s[0].length===1?"":"s",n,c,u,g,d,x,m,A,O,P,F,T;d=new Cp({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function M(K,J){return K[2]?uq:pq}let L=M(s),N=L(s),W=s[14]&&Jy(s);return{c(){e=Pe("span"),t=L1(i),_=L1(" output area"),n=L1(o),c=L1(" selected."),u=l1(),g=Pe("div"),g0(d.$$.fragment),x=l1(),m=Pe("input"),A=l1(),N.c(),O=l1(),W&&W.c(),ee(m,"type","checkbox"),ee(m,"id","sig-modified"),ee(g,"id","changes-grid"),ee(g,"class","svelte-1392tz3")},m(K,J){i1(K,e,J),ne(e,t),ne(e,_),ne(e,n),ne(e,c),i1(K,u,J),i1(K,g,J),n0(d,g,null),ne(g,x),ne(g,m),m.checked=s[2],ne(g,A),N.m(g,null),ne(g,O),W&&W.m(g,null),P=!0,F||(T=[G1(m,"change",s[27]),G1(m,"change",s[28])],F=!0)},p(K,J){(!P||J[0]&1)&&i!==(i=K[0].length+"")&&b4(t,i),(!P||J[0]&1)&&o!==(o=K[0].length===1?"":"s")&&b4(n,o),J[0]&4&&(m.checked=K[2]),L===(L=M(K))&&N?N.p(K,J):(N.d(1),N=L(K),N&&(N.c(),N.m(g,O))),K[14]?W?(W.p(K,J),J[0]&16384&&h1(W,1)):(W=Jy(K),W.c(),h1(W,1),W.m(g,null)):W&&(d4(),d1(W,1,1,()=>{W=null}),f4())},i(K){P||(h1(d.$$.fragment,K),h1(W),P=!0)},o(K){d1(d.$$.fragment,K),d1(W),P=!1},d(K){K&&Je(e),K&&Je(u),K&&Je(g),p0(d),N.d(),W&&W.d(),F=!1,n4(T)}}}function nq(s){let e;return{c(){e=Pe("span"),e.textContent="No output areas selected."},m(i,t){i1(i,e,t)},p:i0,i:i0,o:i0,d(i){i&&Je(e)}}}function pq(s){let e,i=[...P1.signatures.entries()],t=[];for(let _=0;_s[29].call(e))},m(n,c){i1(n,e,c);for(let u=0;uR4(e,"modified",A)),H0.push(()=>R4(e,"value",O)),e.$on("change",s[19]);function F(K){s[33](K)}function T(K){s[34](K)}let M={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:s[10],max:s[11],defaultVal:s[10],step:.01};s[9]!==void 0&&(M.modified=s[9]),s[8]!==void 0&&(M.value=s[8]),o=new Na({props:M}),H0.push(()=>R4(o,"modified",F)),H0.push(()=>R4(o,"value",T)),o.$on("change",s[19]);function L(K){s[35](K)}function N(K){s[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return s[13]!==void 0&&(W.modified=s[13]),s[12]!==void 0&&(W.value=s[12]),g=new Na({props:W}),H0.push(()=>R4(g,"modified",L)),H0.push(()=>R4(g,"value",N)),g.$on("change",s[19]),{c(){g0(e.$$.fragment),_=l1(),g0(o.$$.fragment),u=l1(),g0(g.$$.fragment)},m(K,J){n0(e,K,J),i1(K,_,J),n0(o,K,J),i1(K,u,J),n0(g,K,J),m=!0},p(K,J){const ae={};J[0]&64&&(ae.min=K[6]),J[0]&128&&(ae.max=K[7]),J[0]&64&&(ae.defaultVal=K[6]),!i&&J[0]&32&&(i=!0,ae.modified=K[5],L4(()=>i=!1)),!t&&J[0]&16&&(t=!0,ae.value=K[4],L4(()=>t=!1)),e.$set(ae);const se={};J[0]&1024&&(se.min=K[10]),J[0]&2048&&(se.max=K[11]),J[0]&1024&&(se.defaultVal=K[10]),!n&&J[0]&512&&(n=!0,se.modified=K[9],L4(()=>n=!1)),!c&&J[0]&256&&(c=!0,se.value=K[8],L4(()=>c=!1)),o.$set(se);const ge={};!d&&J[0]&8192&&(d=!0,ge.modified=K[13],L4(()=>d=!1)),!x&&J[0]&4096&&(x=!0,ge.value=K[12],L4(()=>x=!1)),g.$set(ge)},i(K){m||(h1(e.$$.fragment,K),h1(o.$$.fragment,K),h1(g.$$.fragment,K),m=!0)},o(K){d1(e.$$.fragment,K),d1(o.$$.fragment,K),d1(g.$$.fragment,K),m=!1},d(K){p0(e,K),K&&Je(_),p0(o,K),K&&Je(u),p0(g,K)}}}function bq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F,T,M,L,N;e=new vp({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",s[24]),e.$on("forwardClick",s[25]),t=new vs({});function W(be,ce){if(be[16]==="click")return oq;if(be[16]==="draw")return yq}let K=W(s),J=K&&K(s);A=new vs({});const ae=[nq,lq],se=[];function ge(be,ce){return be[0].length===0?0:1}return P=ge(s),F=se[P]=ae[P](s),{c(){g0(e.$$.fragment),i=l1(),g0(t.$$.fragment),_=l1(),o=Pe("div"),n=Pe("i"),n.textContent="Selection method",c=l1(),u=Pe("select"),g=Pe("option"),g.textContent="Click on map",d=Pe("option"),d.textContent="Freehand draw",x=l1(),J&&J.c(),m=l1(),g0(A.$$.fragment),O=l1(),F.c(),T=$i(),g.__value="click",g.value=g.__value,d.__value="draw",d.value=d.__value,ee(u,"id","oa-selection-method"),s[16]===void 0&&$4(()=>s[26].call(u)),ee(o,"id","selection-method-choice"),ee(o,"class","svelte-1392tz3")},m(be,ce){n0(e,be,ce),i1(be,i,ce),n0(t,be,ce),i1(be,_,ce),i1(be,o,ce),ne(o,n),ne(o,c),ne(o,u),ne(u,g),ne(u,d),e5(u,s[16],!0),i1(be,x,ce),J&&J.m(be,ce),i1(be,m,ce),n0(A,be,ce),i1(be,O,ce),se[P].m(be,ce),i1(be,T,ce),M=!0,L||(N=G1(u,"change",s[26]),L=!0)},p(be,ce){ce[0]&65536&&e5(u,be[16]),K!==(K=W(be))&&(J&&J.d(1),J=K&&K(be),J&&(J.c(),J.m(m.parentNode,m)));let me=P;P=ge(be),P===me?se[P].p(be,ce):(d4(),d1(se[me],1,1,()=>{se[me]=null}),f4(),F=se[P],F?F.p(be,ce):(F=se[P]=ae[P](be),F.c()),h1(F,1),F.m(T.parentNode,T))},i(be){M||(h1(e.$$.fragment,be),h1(t.$$.fragment,be),h1(A.$$.fragment,be),h1(F),M=!0)},o(be){d1(e.$$.fragment,be),d1(t.$$.fragment,be),d1(A.$$.fragment,be),d1(F),M=!1},d(be){p0(e,be),be&&Je(i),p0(t,be),be&&Je(_),be&&Je(o),be&&Je(x),J&&J.d(be),be&&Je(m),p0(A,be),be&&Je(O),se[P].d(be),be&&Je(T),L=!1,N()}}}function gq(s){let e,i;return e=new _r({props:{title:"Step 2: Modify output areas",$$slots:{default:[bq]},$$scope:{ctx:s}}}),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,_){const o={};_[0]&131071|_[1]&1048576&&(o.$$scope={dirty:_,ctx:t}),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function z9(s){return Math.round(s*100)/100}function hq(s,e,i){let t,_,o,n,c;q0(s,_i,p1=>i(0,t=p1)),q0(s,R5,p1=>i(37,_=p1)),q0(s,ys,p1=>i(38,o=p1)),q0(s,li,p1=>i(39,n=p1)),q0(s,Y8,p1=>i(16,c=p1));const u=vi();let{changes:g=_.get(n).changes}=e,{userChangesPresent:d}=e,x=!1;Ls(()=>{A0(ys,o=!0,o),i(23,x=!0)}),Rs(()=>{A0(ys,o=!1,o)});let m=null,A,O,P=null,F,T,M,L=null,N,W,K,J=null,ae,se=!1;function ge(p1){if(p1.length===0)return{kind:"None"};if(p1.length===1){const x1=p1[0].name,U=me(x1).get("signature_type");return U===null?{kind:"SinglePassive",oaName:x1,sigId:ce(x1)}:{kind:"SingleActive",oaName:x1,sigId:U}}else{const x1=p1.map(ye=>ye.name),$e=p1.map(ye=>me(ye.name)).map(ye=>ye.get("signature_type")),Ne=x1.map(ye=>ce(ye));if($e.every(ye=>ye===null))return Ne.every(ye=>ye===Ne[0])?{kind:"MultipleSamePassive",oaNames:x1,sigId:Ne[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:Ne};if($e.some(ye=>ye!==null)&&$e.some(ye=>ye===null)){const ye=$e.map((le,ve)=>le||Ne[ve]);return ye.every(le=>le===ye[0])?{kind:"MultipleSamePassive",oaNames:x1,sigId:ye[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:ye}}else return $e.every(ye=>ye===$e[0])?{kind:"MultipleSameActive",oaNames:x1,sigId:$e[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:$e}}}let be=ge(t);function ce(p1){return _.get(P1.referenceScenarioObject.metadata.name).values.get(p1).get("signature_type")}function me(p1){const x1=g.has(p1),U=g.get(p1);return new Map([["signature_type",x1?U.get("signature_type"):null],["job_types",x1?U.get("job_types"):null],["use",x1?U.get("use"):null],["greenspace",x1?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",m),!A&&!F&&!N&&!ae)t.forEach(p1=>{g.delete(p1.name)});else{const p1=new Map([["signature_type",A?m:null],["job_types",F?P:null],["use",N?L:null],["greenspace",ae?J:null]]);t.forEach(x1=>{g.set(x1.name,p1)})}u("changesUpdated"),i(21,d=!0)}function qe(p1,x1){i(4,P=me(p1).get("job_types")),i(8,L=me(p1).get("use")),i(12,J=me(p1).get("greenspace")),i(5,F=P!==null),i(9,N=L!==null),i(13,ae=J!==null),i(6,T=z9(P1.signatures[x1].job_d1)),i(7,M=z9(P1.signatures[x1].job_d9)),i(10,W=z9(P1.signatures[x1].use_d1)),i(11,K=z9(P1.signatures[x1].use_d9))}function Ee(p1,x1){const U=p1.map(Ne=>me(Ne));function $e(Ne){const ye=U.map(le=>le.get(Ne));return ye.every(le=>le===ye[0]&&le!==null)?ye[0]:null}i(4,P=$e("job_types")),i(5,F=P!==null),i(8,L=$e("use")),i(9,N=L!==null),i(12,J=$e("greenspace")),i(13,ae=J!==null),i(6,T=P1.signatures[x1].job_d1),i(7,M=P1.signatures[x1].job_d9),i(10,W=P1.signatures[x1].use_d1),i(11,K=P1.signatures[x1].use_d9)}function De(){switch(be.kind){case"None":return;case"SingleActive":i(1,m=be.sigId),i(2,A=!0),i(3,O=be.sigId);break;case"SinglePassive":i(1,m=null),i(2,A=!1),i(3,O=be.sigId);break;case"MultipleDifferent":i(1,m=null),i(2,A=!1),i(3,O=null);break;case"MultipleSameActive":i(1,m=be.sigId),i(2,A=!0),i(3,O=null);break;case"MultipleSamePassive":i(1,m=null),i(2,A=!1),i(3,O=be.sigId);break}Oe()}function Oe(){function p1(x1){i(6,T=z9(P1.signatures[x1].job_d1)),i(7,M=z9(P1.signatures[x1].job_d9)),i(10,W=z9(P1.signatures[x1].use_d1)),i(11,K=z9(P1.signatures[x1].use_d9))}switch(console.log(be),be.kind){case"None":i(14,se=!1);break;case"SingleActive":i(14,se=!0),qe(be.oaName,be.sigId),p1(be.sigId);break;case"SinglePassive":i(14,se=!0),qe(be.oaName,be.sigId),p1(be.sigId);break;case"MultipleSameActive":i(14,se=!0),Ee(be.oaNames,be.sigId),p1(be.sigId);break;case"MultipleSamePassive":i(14,se=!0),Ee(be.oaNames,be.sigId),p1(be.sigId);break;case"MultipleDifferent":i(14,se=!1),i(4,P=null),i(8,L=null),i(12,J=null),i(5,F=!1),i(9,N=!1),i(13,ae=!1),V();break}}const Se=()=>u("returnToSelection",{}),ze=()=>u("proceedToMetadata",{});function we(){c=js(this),Y8.set(c)}function ke(){A=this.checked,i(2,A)}const b1=()=>{A&&be.kind!=="MultipleDifferent"?i(1,m=O):(A&&be.kind,i(1,m=null)),V(),i(15,be=ge(t)),Oe()};function y1(){m=js(this),i(1,m)}const a1=()=>{V(),i(15,be=ge(t)),Oe()};function D1(p1){F=p1,i(5,F)}function U1(p1){P=p1,i(4,P)}function m1(p1){N=p1,i(9,N)}function T1(p1){L=p1,i(8,L)}function X1(p1){ae=p1,i(13,ae)}function Y1(p1){J=p1,i(12,J)}return s.$$set=p1=>{"changes"in p1&&i(22,g=p1.changes),"userChangesPresent"in p1&&i(21,d=p1.userChangesPresent)},s.$$.update=()=>{s.$$.dirty[0]&8388609&&(i(15,be=ge(t)),x&&De())},[t,m,A,O,P,F,T,M,L,N,W,K,J,ae,se,be,c,u,ge,V,Oe,d,g,x,Se,ze,we,ke,b1,y1,a1,D1,U1,m1,T1,X1,Y1]}class Eq extends W0{constructor(e){super(),$0(this,e,hq,gq,M0,{changes:22,userChangesPresent:21},null,[-1,-1])}}function jq(s){let e;return{c(){e=Pe("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function qq(s){let e,i,t;return{c(){e=L1("This uses the "),i=Pe("a"),i.textContent="Pyodide library",t=L1(" to run the calculation entirely in your browser."),ee(i,"href","https://pyodide.org/en/stable/"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function dq(s){let e,i,t;return{c(){e=L1("To use this option, the API must be running on port 5178. See the "),i=Pe("a"),i.textContent="developer notes",t=L1(" for details on how to set this up."),ee(i,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function fq(s){let e,i,t;return{c(){e=L1("This is an "),i=Pe("a"),i.textContent="Azure Functions",t=L1(" instance, i.e. a web service hosted on the cloud."),ee(i,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function mq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F,T,M,L,N,W;e=new vp({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",s[7]),e.$on("forwardClick",s[8]),t=new vs({});let K=!s[6]&&jq();function J(ge,be){if(ge[2]==="azure")return fq;if(ge[2]==="local")return dq;if(ge[2]==="wasm")return qq}let ae=J(s),se=ae&&ae(s);return O=new vs({}),{c(){g0(e.$$.fragment),i=l1(),g0(t.$$.fragment),_=l1(),o=Pe("div"),n=Pe("i"),n.textContent="Calculation method",c=l1(),u=Pe("select"),g=Pe("option"),g.textContent="Azure REST API",K&&K.c(),d=Pe("option"),d.textContent="In-browser",x=l1(),m=Pe("div"),se&&se.c(),A=l1(),g0(O.$$.fragment),P=l1(),F=Pe("input"),T=l1(),M=Pe("textarea"),g.__value="azure",g.value=g.__value,d.__value="wasm",d.value=d.__value,s[2]===void 0&&$4(()=>s[9].call(u)),ee(o,"id","calculation-method-choice"),ee(o,"class","svelte-ygj49d"),ee(m,"class","smaller svelte-ygj49d"),ee(F,"type","text"),ee(F,"placeholder","Scenario title..."),ee(F,"class","svelte-ygj49d"),ee(M,"placeholder","A longer textual description..."),ee(M,"spellcheck","false"),ee(M,"class","svelte-ygj49d")},m(ge,be){n0(e,ge,be),i1(ge,i,be),n0(t,ge,be),i1(ge,_,be),i1(ge,o,be),ne(o,n),ne(o,c),ne(o,u),ne(u,g),K&&K.m(u,null),ne(u,d),e5(u,s[2],!0),i1(ge,x,be),i1(ge,m,be),se&&se.m(m,null),i1(ge,A,be),n0(O,ge,be),i1(ge,P,be),i1(ge,F,be),s[10](F),Si(F,s[0]),i1(ge,T,be),i1(ge,M,be),s[13](M),Si(M,s[1]),L=!0,N||(W=[G1(u,"change",s[9]),G1(F,"input",s[11]),G1(F,"input",s[12]),G1(M,"input",s[14]),G1(M,"input",s[15])],N=!0)},p(ge,be){be&4&&e5(u,ge[2]),ae!==(ae=J(ge))&&(se&&se.d(1),se=ae&&ae(ge),se&&(se.c(),se.m(m,null))),be&1&&F.value!==ge[0]&&Si(F,ge[0]),be&2&&Si(M,ge[1])},i(ge){L||(h1(e.$$.fragment,ge),h1(t.$$.fragment,ge),h1(O.$$.fragment,ge),L=!0)},o(ge){d1(e.$$.fragment,ge),d1(t.$$.fragment,ge),d1(O.$$.fragment,ge),L=!1},d(ge){p0(e,ge),ge&&Je(i),p0(t,ge),ge&&Je(_),ge&&Je(o),K&&K.d(),ge&&Je(x),ge&&Je(m),se&&se.d(),ge&&Je(A),p0(O,ge),ge&&Je(P),ge&&Je(F),s[10](null),ge&&Je(T),ge&&Je(M),s[13](null),N=!1,n4(W)}}}function xq(s){let e,i;return e=new _r({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[mq]},$$scope:{ctx:s}}}),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,[_]){const o={};_&65567&&(o.$$scope={dirty:_,ctx:t}),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function Qy(s){s.style.borderColor="#f26d88"}function vq(s,e,i){let{scenarioShort:t=""}=e,{scenarioDescription:_=""}=e,{calculationMethod:o="azure"}=e;const n=vi();let c,u;const g=window.location.href.toLowerCase().includes(P1.baseUrl.toLowerCase()),d=()=>n("returnToModify"),x=()=>{if(t===""){alert("Please enter a scenario title."),Qy(c);return}if(_===""){alert("Please enter a scenario description."),Qy(u);return}n("acceptChangesAndCalculate")};function m(){o=js(this),i(2,o)}function A(L){H0[L?"unshift":"push"](()=>{c=L,i(3,c)})}function O(){t=this.value,i(0,t)}const P=()=>{i(3,c.style.borderColor=t===""?"#f26d88":"#999",c)};function F(L){H0[L?"unshift":"push"](()=>{u=L,i(4,u)})}function T(){_=this.value,i(1,_)}const M=()=>{i(4,u.style.borderColor=_===""?"#f26d88":"#999",u)};return s.$$set=L=>{"scenarioShort"in L&&i(0,t=L.scenarioShort),"scenarioDescription"in L&&i(1,_=L.scenarioDescription),"calculationMethod"in L&&i(2,o=L.calculationMethod)},[t,_,o,c,u,n,g,d,x,m,A,O,P,F,T,M]}class Cq extends W0{constructor(e){super(),$0(this,e,vq,xq,M0,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Aq="modulepreload",Pq=function(s){return"/demoland-web/dev/tyne_and_wear/"+s},eo={},Dq=function(e,i,t){if(!i||i.length===0)return e();const _=document.getElementsByTagName("link");return Promise.all(i.map(o=>{if(o=Pq(o),o in eo)return;eo[o]=!0;const n=o.endsWith(".css"),c=n?'[rel="stylesheet"]':"";if(!!t)for(let d=_.length-1;d>=0;d--){const x=_[d];if(x.href===o&&(!n||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${c}`))return;const g=document.createElement("link");if(g.rel=n?"stylesheet":Aq,n||(g.as="script",g.crossOrigin=""),g.href=o,document.head.appendChild(g),n)return new Promise((d,x)=>{g.addEventListener("load",d),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=o,window.dispatchEvent(n),!n.defaultPrevented)throw o})};let Z6;const I8={};let b8=0;async function wq(){if(Z6)return Z6;const s=await Dq(()=>import("./pyodide_worker-c380b41a.js"),[]);return Z6=new s.default,Z6.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:i,...t}=e.data,_=I8[i];console.log(I8),delete I8[i],_(t)}},Z6}async function Oq(s,e){const i=await wq();return b8=(b8+1)%Number.MAX_SAFE_INTEGER,new Promise(t=>{I8[b8]=t,i.postMessage({...e,python:s,id:b8,pathname:window.location.pathname})})}async function Fq(s){const i=await Oq(` + select multiple, or click anywhere outside the map to deselect all.`,ee(e,"class","smaller svelte-1392tz3")},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function lq(s){let e,i=s[0].length+"",t,_,o=s[0].length===1?"":"s",n,c,u,g,d,x,m,A,O,P,F,T;d=new Cp({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function M(K,J){return K[2]?uq:pq}let L=M(s),N=L(s),W=s[14]&&Jy(s);return{c(){e=Pe("span"),t=L1(i),_=L1(" output area"),n=L1(o),c=L1(" selected."),u=l1(),g=Pe("div"),g0(d.$$.fragment),x=l1(),m=Pe("input"),A=l1(),N.c(),O=l1(),W&&W.c(),ee(m,"type","checkbox"),ee(m,"id","sig-modified"),ee(g,"id","changes-grid"),ee(g,"class","svelte-1392tz3")},m(K,J){i1(K,e,J),ne(e,t),ne(e,_),ne(e,n),ne(e,c),i1(K,u,J),i1(K,g,J),n0(d,g,null),ne(g,x),ne(g,m),m.checked=s[2],ne(g,A),N.m(g,null),ne(g,O),W&&W.m(g,null),P=!0,F||(T=[G1(m,"change",s[27]),G1(m,"change",s[28])],F=!0)},p(K,J){(!P||J[0]&1)&&i!==(i=K[0].length+"")&&b4(t,i),(!P||J[0]&1)&&o!==(o=K[0].length===1?"":"s")&&b4(n,o),J[0]&4&&(m.checked=K[2]),L===(L=M(K))&&N?N.p(K,J):(N.d(1),N=L(K),N&&(N.c(),N.m(g,O))),K[14]?W?(W.p(K,J),J[0]&16384&&h1(W,1)):(W=Jy(K),W.c(),h1(W,1),W.m(g,null)):W&&(d4(),d1(W,1,1,()=>{W=null}),f4())},i(K){P||(h1(d.$$.fragment,K),h1(W),P=!0)},o(K){d1(d.$$.fragment,K),d1(W),P=!1},d(K){K&&Je(e),K&&Je(u),K&&Je(g),p0(d),N.d(),W&&W.d(),F=!1,n4(T)}}}function nq(s){let e;return{c(){e=Pe("span"),e.textContent="No output areas selected."},m(i,t){i1(i,e,t)},p:i0,i:i0,o:i0,d(i){i&&Je(e)}}}function pq(s){let e,i=[...P1.signatures.entries()],t=[];for(let _=0;_s[29].call(e))},m(n,c){i1(n,e,c);for(let u=0;uR4(e,"modified",A)),H0.push(()=>R4(e,"value",O)),e.$on("change",s[19]);function F(K){s[33](K)}function T(K){s[34](K)}let M={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:s[10],max:s[11],defaultVal:s[10],step:.01};s[9]!==void 0&&(M.modified=s[9]),s[8]!==void 0&&(M.value=s[8]),o=new Na({props:M}),H0.push(()=>R4(o,"modified",F)),H0.push(()=>R4(o,"value",T)),o.$on("change",s[19]);function L(K){s[35](K)}function N(K){s[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return s[13]!==void 0&&(W.modified=s[13]),s[12]!==void 0&&(W.value=s[12]),g=new Na({props:W}),H0.push(()=>R4(g,"modified",L)),H0.push(()=>R4(g,"value",N)),g.$on("change",s[19]),{c(){g0(e.$$.fragment),_=l1(),g0(o.$$.fragment),u=l1(),g0(g.$$.fragment)},m(K,J){n0(e,K,J),i1(K,_,J),n0(o,K,J),i1(K,u,J),n0(g,K,J),m=!0},p(K,J){const ae={};J[0]&64&&(ae.min=K[6]),J[0]&128&&(ae.max=K[7]),J[0]&64&&(ae.defaultVal=K[6]),!i&&J[0]&32&&(i=!0,ae.modified=K[5],L4(()=>i=!1)),!t&&J[0]&16&&(t=!0,ae.value=K[4],L4(()=>t=!1)),e.$set(ae);const se={};J[0]&1024&&(se.min=K[10]),J[0]&2048&&(se.max=K[11]),J[0]&1024&&(se.defaultVal=K[10]),!n&&J[0]&512&&(n=!0,se.modified=K[9],L4(()=>n=!1)),!c&&J[0]&256&&(c=!0,se.value=K[8],L4(()=>c=!1)),o.$set(se);const ge={};!d&&J[0]&8192&&(d=!0,ge.modified=K[13],L4(()=>d=!1)),!x&&J[0]&4096&&(x=!0,ge.value=K[12],L4(()=>x=!1)),g.$set(ge)},i(K){m||(h1(e.$$.fragment,K),h1(o.$$.fragment,K),h1(g.$$.fragment,K),m=!0)},o(K){d1(e.$$.fragment,K),d1(o.$$.fragment,K),d1(g.$$.fragment,K),m=!1},d(K){p0(e,K),K&&Je(_),p0(o,K),K&&Je(u),p0(g,K)}}}function bq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F,T,M,L,N;e=new vp({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",s[24]),e.$on("forwardClick",s[25]),t=new vs({});function W(be,ce){if(be[16]==="click")return oq;if(be[16]==="draw")return yq}let K=W(s),J=K&&K(s);A=new vs({});const ae=[nq,lq],se=[];function ge(be,ce){return be[0].length===0?0:1}return P=ge(s),F=se[P]=ae[P](s),{c(){g0(e.$$.fragment),i=l1(),g0(t.$$.fragment),_=l1(),o=Pe("div"),n=Pe("i"),n.textContent="Selection method",c=l1(),u=Pe("select"),g=Pe("option"),g.textContent="Click on map",d=Pe("option"),d.textContent="Freehand draw",x=l1(),J&&J.c(),m=l1(),g0(A.$$.fragment),O=l1(),F.c(),T=$i(),g.__value="click",g.value=g.__value,d.__value="draw",d.value=d.__value,ee(u,"id","oa-selection-method"),s[16]===void 0&&$4(()=>s[26].call(u)),ee(o,"id","selection-method-choice"),ee(o,"class","svelte-1392tz3")},m(be,ce){n0(e,be,ce),i1(be,i,ce),n0(t,be,ce),i1(be,_,ce),i1(be,o,ce),ne(o,n),ne(o,c),ne(o,u),ne(u,g),ne(u,d),e5(u,s[16],!0),i1(be,x,ce),J&&J.m(be,ce),i1(be,m,ce),n0(A,be,ce),i1(be,O,ce),se[P].m(be,ce),i1(be,T,ce),M=!0,L||(N=G1(u,"change",s[26]),L=!0)},p(be,ce){ce[0]&65536&&e5(u,be[16]),K!==(K=W(be))&&(J&&J.d(1),J=K&&K(be),J&&(J.c(),J.m(m.parentNode,m)));let me=P;P=ge(be),P===me?se[P].p(be,ce):(d4(),d1(se[me],1,1,()=>{se[me]=null}),f4(),F=se[P],F?F.p(be,ce):(F=se[P]=ae[P](be),F.c()),h1(F,1),F.m(T.parentNode,T))},i(be){M||(h1(e.$$.fragment,be),h1(t.$$.fragment,be),h1(A.$$.fragment,be),h1(F),M=!0)},o(be){d1(e.$$.fragment,be),d1(t.$$.fragment,be),d1(A.$$.fragment,be),d1(F),M=!1},d(be){p0(e,be),be&&Je(i),p0(t,be),be&&Je(_),be&&Je(o),be&&Je(x),J&&J.d(be),be&&Je(m),p0(A,be),be&&Je(O),se[P].d(be),be&&Je(T),L=!1,N()}}}function gq(s){let e,i;return e=new _r({props:{title:"Step 2: Modify output areas",$$slots:{default:[bq]},$$scope:{ctx:s}}}),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,_){const o={};_[0]&131071|_[1]&1048576&&(o.$$scope={dirty:_,ctx:t}),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function z9(s){return Math.round(s*100)/100}function hq(s,e,i){let t,_,o,n,c;q0(s,_i,p1=>i(0,t=p1)),q0(s,R5,p1=>i(37,_=p1)),q0(s,ys,p1=>i(38,o=p1)),q0(s,li,p1=>i(39,n=p1)),q0(s,Y8,p1=>i(16,c=p1));const u=vi();let{changes:g=_.get(n).changes}=e,{userChangesPresent:d}=e,x=!1;Ls(()=>{A0(ys,o=!0,o),i(23,x=!0)}),Rs(()=>{A0(ys,o=!1,o)});let m=null,A,O,P=null,F,T,M,L=null,N,W,K,J=null,ae,se=!1;function ge(p1){if(p1.length===0)return{kind:"None"};if(p1.length===1){const x1=p1[0].name,U=me(x1).get("signature_type");return U===null?{kind:"SinglePassive",oaName:x1,sigId:ce(x1)}:{kind:"SingleActive",oaName:x1,sigId:U}}else{const x1=p1.map(ye=>ye.name),$e=p1.map(ye=>me(ye.name)).map(ye=>ye.get("signature_type")),Ne=x1.map(ye=>ce(ye));if($e.every(ye=>ye===null))return Ne.every(ye=>ye===Ne[0])?{kind:"MultipleSamePassive",oaNames:x1,sigId:Ne[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:Ne};if($e.some(ye=>ye!==null)&&$e.some(ye=>ye===null)){const ye=$e.map((le,ve)=>le||Ne[ve]);return ye.every(le=>le===ye[0])?{kind:"MultipleSamePassive",oaNames:x1,sigId:ye[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:ye}}else return $e.every(ye=>ye===$e[0])?{kind:"MultipleSameActive",oaNames:x1,sigId:$e[0]}:{kind:"MultipleDifferent",oaNames:x1,sigIds:$e}}}let be=ge(t);function ce(p1){return _.get(P1.referenceScenarioObject.metadata.name).values.get(p1).get("signature_type")}function me(p1){const x1=g.has(p1),U=g.get(p1);return new Map([["signature_type",x1?U.get("signature_type"):null],["job_types",x1?U.get("job_types"):null],["use",x1?U.get("use"):null],["greenspace",x1?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",m),!A&&!F&&!N&&!ae)t.forEach(p1=>{g.delete(p1.name)});else{const p1=new Map([["signature_type",A?m:null],["job_types",F?P:null],["use",N?L:null],["greenspace",ae?J:null]]);t.forEach(x1=>{g.set(x1.name,p1)})}u("changesUpdated"),i(21,d=!0)}function qe(p1,x1){i(4,P=me(p1).get("job_types")),i(8,L=me(p1).get("use")),i(12,J=me(p1).get("greenspace")),i(5,F=P!==null),i(9,N=L!==null),i(13,ae=J!==null),i(6,T=z9(P1.signatures[x1].job_d1)),i(7,M=z9(P1.signatures[x1].job_d9)),i(10,W=z9(P1.signatures[x1].use_d1)),i(11,K=z9(P1.signatures[x1].use_d9))}function Ee(p1,x1){const U=p1.map(Ne=>me(Ne));function $e(Ne){const ye=U.map(le=>le.get(Ne));return ye.every(le=>le===ye[0]&&le!==null)?ye[0]:null}i(4,P=$e("job_types")),i(5,F=P!==null),i(8,L=$e("use")),i(9,N=L!==null),i(12,J=$e("greenspace")),i(13,ae=J!==null),i(6,T=P1.signatures[x1].job_d1),i(7,M=P1.signatures[x1].job_d9),i(10,W=P1.signatures[x1].use_d1),i(11,K=P1.signatures[x1].use_d9)}function De(){switch(be.kind){case"None":return;case"SingleActive":i(1,m=be.sigId),i(2,A=!0),i(3,O=be.sigId);break;case"SinglePassive":i(1,m=null),i(2,A=!1),i(3,O=be.sigId);break;case"MultipleDifferent":i(1,m=null),i(2,A=!1),i(3,O=null);break;case"MultipleSameActive":i(1,m=be.sigId),i(2,A=!0),i(3,O=null);break;case"MultipleSamePassive":i(1,m=null),i(2,A=!1),i(3,O=be.sigId);break}Oe()}function Oe(){function p1(x1){i(6,T=z9(P1.signatures[x1].job_d1)),i(7,M=z9(P1.signatures[x1].job_d9)),i(10,W=z9(P1.signatures[x1].use_d1)),i(11,K=z9(P1.signatures[x1].use_d9))}switch(console.log(be),be.kind){case"None":i(14,se=!1);break;case"SingleActive":i(14,se=!0),qe(be.oaName,be.sigId),p1(be.sigId);break;case"SinglePassive":i(14,se=!0),qe(be.oaName,be.sigId),p1(be.sigId);break;case"MultipleSameActive":i(14,se=!0),Ee(be.oaNames,be.sigId),p1(be.sigId);break;case"MultipleSamePassive":i(14,se=!0),Ee(be.oaNames,be.sigId),p1(be.sigId);break;case"MultipleDifferent":i(14,se=!1),i(4,P=null),i(8,L=null),i(12,J=null),i(5,F=!1),i(9,N=!1),i(13,ae=!1),V();break}}const Se=()=>u("returnToSelection",{}),ze=()=>u("proceedToMetadata",{});function we(){c=js(this),Y8.set(c)}function ke(){A=this.checked,i(2,A)}const b1=()=>{A&&be.kind!=="MultipleDifferent"?i(1,m=O):(A&&be.kind,i(1,m=null)),V(),i(15,be=ge(t)),Oe()};function y1(){m=js(this),i(1,m)}const a1=()=>{V(),i(15,be=ge(t)),Oe()};function D1(p1){F=p1,i(5,F)}function U1(p1){P=p1,i(4,P)}function m1(p1){N=p1,i(9,N)}function T1(p1){L=p1,i(8,L)}function X1(p1){ae=p1,i(13,ae)}function Y1(p1){J=p1,i(12,J)}return s.$$set=p1=>{"changes"in p1&&i(22,g=p1.changes),"userChangesPresent"in p1&&i(21,d=p1.userChangesPresent)},s.$$.update=()=>{s.$$.dirty[0]&8388609&&(i(15,be=ge(t)),x&&De())},[t,m,A,O,P,F,T,M,L,N,W,K,J,ae,se,be,c,u,ge,V,Oe,d,g,x,Se,ze,we,ke,b1,y1,a1,D1,U1,m1,T1,X1,Y1]}class Eq extends W0{constructor(e){super(),$0(this,e,hq,gq,M0,{changes:22,userChangesPresent:21},null,[-1,-1])}}function jq(s){let e;return{c(){e=Pe("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(i,t){i1(i,e,t)},d(i){i&&Je(e)}}}function qq(s){let e,i,t;return{c(){e=L1("This uses the "),i=Pe("a"),i.textContent="Pyodide library",t=L1(" to run the calculation entirely in your browser."),ee(i,"href","https://pyodide.org/en/stable/"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function dq(s){let e,i,t;return{c(){e=L1("To use this option, the API must be running on port 5178. See the "),i=Pe("a"),i.textContent="developer notes",t=L1(" for details on how to set this up."),ee(i,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function fq(s){let e,i,t;return{c(){e=L1("This is an "),i=Pe("a"),i.textContent="Azure Functions",t=L1(" instance, i.e. a web service hosted on the cloud."),ee(i,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),ee(i,"target","_blank")},m(_,o){i1(_,e,o),i1(_,i,o),i1(_,t,o)},d(_){_&&Je(e),_&&Je(i),_&&Je(t)}}}function mq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F,T,M,L,N,W;e=new vp({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",s[7]),e.$on("forwardClick",s[8]),t=new vs({});let K=!s[6]&&jq();function J(ge,be){if(ge[2]==="azure")return fq;if(ge[2]==="local")return dq;if(ge[2]==="wasm")return qq}let ae=J(s),se=ae&&ae(s);return O=new vs({}),{c(){g0(e.$$.fragment),i=l1(),g0(t.$$.fragment),_=l1(),o=Pe("div"),n=Pe("i"),n.textContent="Calculation method",c=l1(),u=Pe("select"),g=Pe("option"),g.textContent="Azure REST API",K&&K.c(),d=Pe("option"),d.textContent="In-browser",x=l1(),m=Pe("div"),se&&se.c(),A=l1(),g0(O.$$.fragment),P=l1(),F=Pe("input"),T=l1(),M=Pe("textarea"),g.__value="azure",g.value=g.__value,d.__value="wasm",d.value=d.__value,s[2]===void 0&&$4(()=>s[9].call(u)),ee(o,"id","calculation-method-choice"),ee(o,"class","svelte-ygj49d"),ee(m,"class","smaller svelte-ygj49d"),ee(F,"type","text"),ee(F,"placeholder","Scenario title..."),ee(F,"class","svelte-ygj49d"),ee(M,"placeholder","A longer textual description..."),ee(M,"spellcheck","false"),ee(M,"class","svelte-ygj49d")},m(ge,be){n0(e,ge,be),i1(ge,i,be),n0(t,ge,be),i1(ge,_,be),i1(ge,o,be),ne(o,n),ne(o,c),ne(o,u),ne(u,g),K&&K.m(u,null),ne(u,d),e5(u,s[2],!0),i1(ge,x,be),i1(ge,m,be),se&&se.m(m,null),i1(ge,A,be),n0(O,ge,be),i1(ge,P,be),i1(ge,F,be),s[10](F),Si(F,s[0]),i1(ge,T,be),i1(ge,M,be),s[13](M),Si(M,s[1]),L=!0,N||(W=[G1(u,"change",s[9]),G1(F,"input",s[11]),G1(F,"input",s[12]),G1(M,"input",s[14]),G1(M,"input",s[15])],N=!0)},p(ge,be){be&4&&e5(u,ge[2]),ae!==(ae=J(ge))&&(se&&se.d(1),se=ae&&ae(ge),se&&(se.c(),se.m(m,null))),be&1&&F.value!==ge[0]&&Si(F,ge[0]),be&2&&Si(M,ge[1])},i(ge){L||(h1(e.$$.fragment,ge),h1(t.$$.fragment,ge),h1(O.$$.fragment,ge),L=!0)},o(ge){d1(e.$$.fragment,ge),d1(t.$$.fragment,ge),d1(O.$$.fragment,ge),L=!1},d(ge){p0(e,ge),ge&&Je(i),p0(t,ge),ge&&Je(_),ge&&Je(o),K&&K.d(),ge&&Je(x),ge&&Je(m),se&&se.d(),ge&&Je(A),p0(O,ge),ge&&Je(P),ge&&Je(F),s[10](null),ge&&Je(T),ge&&Je(M),s[13](null),N=!1,n4(W)}}}function xq(s){let e,i;return e=new _r({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[mq]},$$scope:{ctx:s}}}),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,[_]){const o={};_&65567&&(o.$$scope={dirty:_,ctx:t}),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function Qy(s){s.style.borderColor="#f26d88"}function vq(s,e,i){let{scenarioShort:t=""}=e,{scenarioDescription:_=""}=e,{calculationMethod:o="azure"}=e;const n=vi();let c,u;const g=window.location.href.toLowerCase().includes(P1.baseUrl.toLowerCase()),d=()=>n("returnToModify"),x=()=>{if(t===""){alert("Please enter a scenario title."),Qy(c);return}if(_===""){alert("Please enter a scenario description."),Qy(u);return}n("acceptChangesAndCalculate")};function m(){o=js(this),i(2,o)}function A(L){H0[L?"unshift":"push"](()=>{c=L,i(3,c)})}function O(){t=this.value,i(0,t)}const P=()=>{i(3,c.style.borderColor=t===""?"#f26d88":"#999",c)};function F(L){H0[L?"unshift":"push"](()=>{u=L,i(4,u)})}function T(){_=this.value,i(1,_)}const M=()=>{i(4,u.style.borderColor=_===""?"#f26d88":"#999",u)};return s.$$set=L=>{"scenarioShort"in L&&i(0,t=L.scenarioShort),"scenarioDescription"in L&&i(1,_=L.scenarioDescription),"calculationMethod"in L&&i(2,o=L.calculationMethod)},[t,_,o,c,u,n,g,d,x,m,A,O,P,F,T,M]}class Cq extends W0{constructor(e){super(),$0(this,e,vq,xq,M0,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Aq="modulepreload",Pq=function(s){return"/demoland-web/dev/tyne_and_wear/"+s},eo={},Dq=function(e,i,t){if(!i||i.length===0)return e();const _=document.getElementsByTagName("link");return Promise.all(i.map(o=>{if(o=Pq(o),o in eo)return;eo[o]=!0;const n=o.endsWith(".css"),c=n?'[rel="stylesheet"]':"";if(!!t)for(let d=_.length-1;d>=0;d--){const x=_[d];if(x.href===o&&(!n||x.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${c}`))return;const g=document.createElement("link");if(g.rel=n?"stylesheet":Aq,n||(g.as="script",g.crossOrigin=""),g.href=o,document.head.appendChild(g),n)return new Promise((d,x)=>{g.addEventListener("load",d),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=o,window.dispatchEvent(n),!n.defaultPrevented)throw o})};let Z6;const I8={};let b8=0;async function wq(){if(Z6)return Z6;const s=await Dq(()=>import("./pyodide_worker-506c147d.js"),[]);return Z6=new s.default,Z6.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:i,...t}=e.data,_=I8[i];console.log(I8),delete I8[i],_(t)}},Z6}async function Oq(s,e){const i=await wq();return b8=(b8+1)%Number.MAX_SAFE_INTEGER,new Promise(t=>{I8[b8]=t,i.postMessage({...e,python:s,id:b8,pathname:window.location.pathname})})}async function Fq(s){const i=await Oq(` import pyodide_http import pyodide_js import os @@ -84,7 +84,7 @@ modelled development strategies on any of the four indicators. prediction = pred.to_dict("index") print(f"{time.time() - start}s to run") json.dumps(prediction) - `,{scenario_json:s,pathname:window.location.pathname,BASE_URL:window.location.origin+window.location.pathname});return i.error?(console.error(i.error),i):JSON.parse(i.results)}function io(s){let e,i;return e=new _q({}),e.$on("changeScenario",s[9]),e.$on("changeScenarioAndProceed",s[10]),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p:i0,i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function so(s){let e,i,t;function _(n){s[12](n)}let o={};return s[6]!==void 0&&(o.userChangesPresent=s[6]),e=new Eq({props:o}),H0.push(()=>R4(e,"userChangesPresent",_)),e.$on("returnToSelection",s[8]),e.$on("changesUpdated",s[13]),e.$on("proceedToMetadata",s[14]),{c(){g0(e.$$.fragment)},m(n,c){n0(e,n,c),t=!0},p(n,c){const u={};!i&&c&64&&(i=!0,u.userChangesPresent=n[6],L4(()=>i=!1)),e.$set(u)},i(n){t||(h1(e.$$.fragment,n),t=!0)},o(n){d1(e.$$.fragment,n),t=!1},d(n){p0(e,n)}}}function to(s){let e,i,t,_,o;function n(d){s[15](d)}function c(d){s[16](d)}function u(d){s[17](d)}let g={};return s[4]!==void 0&&(g.scenarioShort=s[4]),s[5]!==void 0&&(g.scenarioDescription=s[5]),s[2]!==void 0&&(g.calculationMethod=s[2]),e=new Cq({props:g}),H0.push(()=>R4(e,"scenarioShort",n)),H0.push(()=>R4(e,"scenarioDescription",c)),H0.push(()=>R4(e,"calculationMethod",u)),e.$on("returnToModify",s[18]),e.$on("acceptChangesAndCalculate",s[11]),{c(){g0(e.$$.fragment)},m(d,x){n0(e,d,x),o=!0},p(d,x){const m={};!i&&x&16&&(i=!0,m.scenarioShort=d[4],L4(()=>i=!1)),!t&&x&32&&(t=!0,m.scenarioDescription=d[5],L4(()=>t=!1)),!_&&x&4&&(_=!0,m.calculationMethod=d[2],L4(()=>_=!1)),e.$set(m)},i(d){o||(h1(e.$$.fragment,d),o=!0)},o(d){d1(e.$$.fragment,d),o=!1},d(d){p0(e,d)}}}function ao(s){let e,i;return e=new $j({}),e.$on("abort",s[19]),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p:i0,i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function co(s){let e,i;return e=new Hj({props:{message:s[1]}}),e.$on("close",s[20]),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,_){const o={};_&2&&(o.message=t[1]),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function Sq(s){let e,i,t,_,o,n,c,u=s[0]==="choose"&&io(s),g=s[0]==="modify"&&so(s),d=s[0]==="metadata"&&to(s),x=s[0]==="calc"&&ao(s),m=s[0]==="error"&&co(s);return{c(){e=L1(`Create your own scenario by modifying an existing one. + `,{scenario_json:s,pathname:window.location.pathname,model_identifier:window.location.pathname.split("/").slice(-2,-1)[0]});return i.error?(console.error(i.error),i):JSON.parse(i.results)}function io(s){let e,i;return e=new _q({}),e.$on("changeScenario",s[9]),e.$on("changeScenarioAndProceed",s[10]),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p:i0,i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function so(s){let e,i,t;function _(n){s[12](n)}let o={};return s[6]!==void 0&&(o.userChangesPresent=s[6]),e=new Eq({props:o}),H0.push(()=>R4(e,"userChangesPresent",_)),e.$on("returnToSelection",s[8]),e.$on("changesUpdated",s[13]),e.$on("proceedToMetadata",s[14]),{c(){g0(e.$$.fragment)},m(n,c){n0(e,n,c),t=!0},p(n,c){const u={};!i&&c&64&&(i=!0,u.userChangesPresent=n[6],L4(()=>i=!1)),e.$set(u)},i(n){t||(h1(e.$$.fragment,n),t=!0)},o(n){d1(e.$$.fragment,n),t=!1},d(n){p0(e,n)}}}function to(s){let e,i,t,_,o;function n(d){s[15](d)}function c(d){s[16](d)}function u(d){s[17](d)}let g={};return s[4]!==void 0&&(g.scenarioShort=s[4]),s[5]!==void 0&&(g.scenarioDescription=s[5]),s[2]!==void 0&&(g.calculationMethod=s[2]),e=new Cq({props:g}),H0.push(()=>R4(e,"scenarioShort",n)),H0.push(()=>R4(e,"scenarioDescription",c)),H0.push(()=>R4(e,"calculationMethod",u)),e.$on("returnToModify",s[18]),e.$on("acceptChangesAndCalculate",s[11]),{c(){g0(e.$$.fragment)},m(d,x){n0(e,d,x),o=!0},p(d,x){const m={};!i&&x&16&&(i=!0,m.scenarioShort=d[4],L4(()=>i=!1)),!t&&x&32&&(t=!0,m.scenarioDescription=d[5],L4(()=>t=!1)),!_&&x&4&&(_=!0,m.calculationMethod=d[2],L4(()=>_=!1)),e.$set(m)},i(d){o||(h1(e.$$.fragment,d),o=!0)},o(d){d1(e.$$.fragment,d),o=!1},d(d){p0(e,d)}}}function ao(s){let e,i;return e=new $j({}),e.$on("abort",s[19]),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p:i0,i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function co(s){let e,i;return e=new Hj({props:{message:s[1]}}),e.$on("close",s[20]),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,_){const o={};_&2&&(o.message=t[1]),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function Sq(s){let e,i,t,_,o,n,c,u=s[0]==="choose"&&io(s),g=s[0]==="modify"&&so(s),d=s[0]==="metadata"&&to(s),x=s[0]==="calc"&&ao(s),m=s[0]==="error"&&co(s);return{c(){e=L1(`Create your own scenario by modifying an existing one. `),u&&u.c(),i=l1(),g&&g.c(),t=l1(),d&&d.c(),_=l1(),x&&x.c(),o=l1(),m&&m.c(),n=$i()},m(A,O){i1(A,e,O),u&&u.m(A,O),i1(A,i,O),g&&g.m(A,O),i1(A,t,O),d&&d.m(A,O),i1(A,_,O),x&&x.m(A,O),i1(A,o,O),m&&m.m(A,O),i1(A,n,O),c=!0},p(A,[O]){A[0]==="choose"?u?(u.p(A,O),O&1&&h1(u,1)):(u=io(A),u.c(),h1(u,1),u.m(i.parentNode,i)):u&&(d4(),d1(u,1,1,()=>{u=null}),f4()),A[0]==="modify"?g?(g.p(A,O),O&1&&h1(g,1)):(g=so(A),g.c(),h1(g,1),g.m(t.parentNode,t)):g&&(d4(),d1(g,1,1,()=>{g=null}),f4()),A[0]==="metadata"?d?(d.p(A,O),O&1&&h1(d,1)):(d=to(A),d.c(),h1(d,1),d.m(_.parentNode,_)):d&&(d4(),d1(d,1,1,()=>{d=null}),f4()),A[0]==="calc"?x?(x.p(A,O),O&1&&h1(x,1)):(x=ao(A),x.c(),h1(x,1),x.m(o.parentNode,o)):x&&(d4(),d1(x,1,1,()=>{x=null}),f4()),A[0]==="error"?m?(m.p(A,O),O&1&&h1(m,1)):(m=co(A),m.c(),h1(m,1),m.m(n.parentNode,n)):m&&(d4(),d1(m,1,1,()=>{m=null}),f4())},i(A){c||(h1(u),h1(g),h1(d),h1(x),h1(m),c=!0)},o(A){d1(u),d1(g),d1(d),d1(x),d1(m),c=!1},d(A){A&&Je(e),u&&u.d(A),A&&Je(i),g&&g.d(A),A&&Je(t),d&&d.d(A),A&&Je(_),x&&x.d(A),A&&Je(o),m&&m.d(A),A&&Je(n)}}}let kq="Are you sure you want to go back? All changes will be lost.";function Tq(s,e,i){let t,_,o,n,c;q0(s,_i,Ee=>i(21,t=Ee)),q0(s,li,Ee=>i(22,_=Ee)),q0(s,R5,Ee=>i(23,o=Ee)),q0(s,X8,Ee=>i(24,n=Ee)),q0(s,$3,Ee=>i(25,c=Ee));const u=vi();let g="choose",d="An error occurred.",x,m,A="",O="",P=!1;Rs(()=>{A0(_i,t=[],t)});function F(){P?window.confirm(kq)&&(i(6,P=!1),A0(_i,t=[],t),i(0,g="choose"),A0(li,_=P1.referenceScenarioObject.metadata.name,_),u("changeScenario")):(A0(_i,t=[],t),i(0,g="choose"))}function T(){u("changeScenario",{}),A0(_i,t=[],t)}function M(){T(),i(0,g="modify")}function L(Ee,De){console.log("handleResult called");const Oe={metadata:{name:A.replace(/\s/g,"_").toLowerCase(),short:A,long:"Custom: "+A,description:O},changes:JSON.parse(De).scenario_json,values:Ee};console.log("obj",Oe);const Se=ht(Oe,c,n,"custom scenario");if(console.log("newScenario",Se),o.has(Se.metadata.name)){let ze=1;for(;o.has(`${Se.metadata.name}_${ze})`);)ze++;Se.metadata.name=`${Se.metadata.name}_${ze}`}o.set(Se.metadata.name,Se),i(6,P=!1),u("import",{name:Se.metadata.name})}function N(Ee,De){if(Ee.ok)Ee.json().then(Oe=>L(Oe,De));else throw i(0,g="error"),i(1,d=`HTTP request to custom scenario server failed: received ${Ee.status} ${Ee.statusText}.`),Ee.status===500&&i(1,d+=" (If you are running locally, did you start the backend up?)"),new Error(d)}function W(Ee){Ee instanceof DOMException&&Ee.name==="AbortError"?(i(0,g="metadata"),console.log("Calculation aborted")):(i(0,g="error"),i(1,d=Ee.message))}function K(){const Ee=JSON.stringify({scenario_json:fp(o.get(_).changes),model_identifier:P1.modelIdentifier});if(console.log("changedJson",Ee),i(0,g="calc"),A0(_i,t=[],t),i(3,m=new AbortController),console.log("Running with runner",x),x==="wasm")Fq(Ee).then(De=>{console.log("result",De),De.error?W(new Error(De.error)):(console.log(De),L(De,Ee),console.log("scenario result is ",De))}).catch(De=>W(De));else if(x==="azure"||x==="local"){const De=x==="azure"?`${P1.webApiUrl}/api/scenario`:`${P1.localApiUrl}/api/scenario`;fetch(De,{method:"POST",headers:{"Content-Type":"application/json"},body:Ee,signal:m.signal}).then(Oe=>N(Oe,Ee)).catch(Oe=>W(Oe))}}function J(Ee){P=Ee,i(6,P)}const ae=()=>{u("changesUpdated")},se=()=>i(0,g="metadata");function ge(Ee){A=Ee,i(4,A)}function be(Ee){O=Ee,i(5,O)}function ce(Ee){x=Ee,i(2,x)}return[g,d,x,m,A,O,P,u,F,T,M,K,J,ae,se,ge,be,ce,()=>i(0,g="modify"),()=>m.abort(),()=>i(0,g="metadata")]}class Mq extends W0{constructor(e){super(),$0(this,e,Tq,Sq,M0,{})}}function Iq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F,T;return{c(){e=Pe("div"),i=Pe("div"),t=Pe("h3"),t.textContent="An error occurred :(",_=l1(),o=Pe("p"),n=L1(s[0]),c=l1(),u=Pe("p"),g=L1("Please try again, or "),d=Pe("a"),x=L1("contact the developers"),m=L1(" if the problem persists."),A=l1(),O=Pe("p"),P=Pe("button"),P.textContent="Close",ee(t,"class","svelte-1xb3nt3"),ee(o,"id","error-message"),ee(o,"class","svelte-1xb3nt3"),ee(d,"href",zq),ee(d,"class","svelte-1xb3nt3"),ee(u,"class","svelte-1xb3nt3"),ee(P,"id","error-close"),ee(P,"class","svelte-1xb3nt3"),ee(O,"class","svelte-1xb3nt3"),ee(i,"id","error"),ee(i,"class","svelte-1xb3nt3"),ee(e,"id","error-cover"),ee(e,"class","svelte-1xb3nt3")},m(M,L){i1(M,e,L),ne(e,i),ne(i,t),ne(i,_),ne(i,o),ne(o,n),ne(i,c),ne(i,u),ne(u,g),ne(u,d),ne(d,x),ne(u,m),ne(i,A),ne(i,O),ne(O,P),F||(T=G1(P,"click",s[1]),F=!0)},p(M,[L]){L&1&&b4(n,M[0])},i:i0,o:i0,d(M){M&&Je(e),F=!1,T()}}}const zq="https://github.com/Urban-Analytics-Technology-Platform/demoland-web/issues";function Lq(s,e,i){const t=vi();let{message:_}=e;function o(){t("close")}return s.$$set=n=>{"message"in n&&i(0,_=n.message)},[_,o]}class Rq extends W0{constructor(e){super(),$0(this,e,Lq,Iq,M0,{message:0})}}function ro(s){let e,i;return e=new Rq({props:{message:s[2]}}),e.$on("close",s[7]),{c(){g0(e.$$.fragment)},m(t,_){n0(e,t,_),i=!0},p(t,_){const o={};_&4&&(o.message=t[2]),e.$set(o)},i(t){i||(h1(e.$$.fragment,t),i=!0)},o(t){d1(e.$$.fragment,t),i=!1},d(t){p0(e,t)}}}function Bq(s){let e,i,t,_,o,n,c,u,g,d,x,m,A,O,P,F=s[1]&&ro(s);return{c(){e=Pe("div"),i=L1(`If you have already modelled a custom scenario and saved the results, you can import it here to visualise the results. diff --git a/dev/tyne_and_wear/assets/pyodide_worker-c380b41a.js b/dev/tyne_and_wear/assets/pyodide_worker-506c147d.js similarity index 53% rename from dev/tyne_and_wear/assets/pyodide_worker-c380b41a.js rename to dev/tyne_and_wear/assets/pyodide_worker-506c147d.js index 1abefee..681ef1c 100644 --- a/dev/tyne_and_wear/assets/pyodide_worker-c380b41a.js +++ b/dev/tyne_and_wear/assets/pyodide_worker-506c147d.js @@ -1 +1 @@ -function e(){return new Worker("/demoland-web/dev/tyne_and_wear/assets/pyodide_worker-9534fa03.js",{type:"module"})}export{e as default}; +function e(){return new Worker("/demoland-web/dev/tyne_and_wear/assets/pyodide_worker-d616a3be.js",{type:"module"})}export{e as default}; diff --git a/dev/isle_of_wight/assets/pyodide_worker-9534fa03.js b/dev/tyne_and_wear/assets/pyodide_worker-d616a3be.js similarity index 97% rename from dev/isle_of_wight/assets/pyodide_worker-9534fa03.js rename to dev/tyne_and_wear/assets/pyodide_worker-d616a3be.js index 524956b..8cfaeb5 100644 --- a/dev/isle_of_wight/assets/pyodide_worker-9534fa03.js +++ b/dev/tyne_and_wear/assets/pyodide_worker-d616a3be.js @@ -7,4 +7,4 @@ var oe=Object.create,L=Object.defineProperty,ae=Object.getOwnPropertyDescriptor, `),p=[],c=2,d=s.length;c/,"$2").replace(/\([^)]*\)/g,"")||void 0,y;d.match(/\(([^)]*)\)/)&&(y=d.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var g=y===void 0||y==="[arguments not available]"?void 0:y.split(",");return new o({functionName:m,args:g,fileName:c[0],lineNumber:c[1],columnNumber:c[2],source:s})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))}),me=pe(fe()),w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",x,E,F,$,D;async function I(){if(!w||(x=(await import("./__vite-browser-external-dfc062b5.js")).default,D=await import("./__vite-browser-external-dfc062b5.js"),globalThis.fetch?E=fetch:E=(await import("./fetch-npm-browserify-1ff37dca.js").then(function(i){return i.f})).default,$=(await import("./__vite-browser-external-dfc062b5.js")).default,F=await import("./__vite-browser-external-dfc062b5.js"),N=F.sep,typeof ce<"u"))return;let e=await import("./__vite-browser-external-dfc062b5.js"),t=await import("./__vite-browser-external-dfc062b5.js"),o=await import("./__vite-browser-external-dfc062b5.js"),a=await import("./__vite-browser-external-dfc062b5.js"),n={fs:e,crypto:t,ws:o,child_process:a};globalThis.require=function(i){return n[i]}}u(I,"initNodeModules");function T(e,t){return F.resolve(t||".",e)}u(T,"node_resolvePath");function A(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}u(A,"browser_resolvePath");var P;w?P=T:P=A;var N;w||(N="/");function M(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:E(e)}:{binary:D.readFile(e).then(o=>new Uint8Array(o.buffer,o.byteOffset,o.byteLength))}}u(M,"node_getBinaryResponse");function U(e,t){let o=new URL(e,location);return{response:fetch(o,t?{integrity:t}:{})}}u(U,"browser_getBinaryResponse");var k;w?k=M:k=U;async function H(e,t){let{response:o,binary:a}=k(e,t);if(a)return a;let n=await o;if(!n.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await n.arrayBuffer())}u(H,"loadBinaryFile");var b;if(globalThis.document)b=u(async e=>await import(e),"loadScript");else if(globalThis.importScripts)b=u(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(e);else throw t}},"loadScript");else if(w)b=C;else throw new Error("Cannot determine runtime environment");async function C(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?$.runInThisContext(await(await E(e)).text()):await import(x.pathToFileURL(e).href)}u(C,"nodeLoadScript");function q(e){let t=e.FS,o=e.FS.filesystems.MEMFS,a=e.PATH,n={DIR_MODE:16895,FILE_MODE:33279,mount:function(i){if(!i.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return o.mount.apply(null,arguments)},syncfs:async(i,r,l)=>{try{let s=n.getLocalSet(i),p=await n.getRemoteSet(i),c=r?p:s,d=r?s:p;await n.reconcile(i,c,d),l(null)}catch(s){l(s)}},getLocalSet:i=>{let r=Object.create(null);function l(c){return c!=="."&&c!==".."}u(l,"isRealDir");function s(c){return d=>a.join2(c,d)}u(s,"toAbsolute");let p=t.readdir(i.mountpoint).filter(l).map(s(i.mountpoint));for(;p.length;){let c=p.pop(),d=t.stat(c);t.isDir(d.mode)&&p.push.apply(p,t.readdir(c).filter(l).map(s(c))),r[c]={timestamp:d.mtime,mode:d.mode}}return{type:"local",entries:r}},getRemoteSet:async i=>{let r=Object.create(null),l=await ye(i.opts.fileSystemHandle);for(let[s,p]of l)s!=="."&&(r[a.join2(i.mountpoint,s)]={timestamp:p.kind==="file"?(await p.getFile()).lastModifiedDate:new Date,mode:p.kind==="file"?n.FILE_MODE:n.DIR_MODE});return{type:"remote",entries:r,handles:l}},loadLocalEntry:i=>{let r=t.lookupPath(i).node,l=t.stat(i);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return r.contents=o.getFileDataAsTypedArray(r),{timestamp:l.mtime,mode:l.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(i,r)=>{if(t.isDir(r.mode))t.mkdirTree(i,r.mode);else if(t.isFile(r.mode))t.writeFile(i,r.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(i,r.mode),t.utime(i,r.timestamp,r.timestamp)},removeLocalEntry:i=>{var r=t.stat(i);t.isDir(r.mode)?t.rmdir(i):t.isFile(r.mode)&&t.unlink(i)},loadRemoteEntry:async i=>{if(i.kind==="file"){let r=await i.getFile();return{contents:new Uint8Array(await r.arrayBuffer()),mode:n.FILE_MODE,timestamp:r.lastModifiedDate}}else{if(i.kind==="directory")return{mode:n.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+i.kind)}},storeRemoteEntry:async(i,r,l)=>{let s=i.get(a.dirname(r)),p=t.isFile(l.mode)?await s.getFileHandle(a.basename(r),{create:!0}):await s.getDirectoryHandle(a.basename(r),{create:!0});if(p.kind==="file"){let c=await p.createWritable();await c.write(l.contents),await c.close()}i.set(r,p)},removeRemoteEntry:async(i,r)=>{await i.get(a.dirname(r)).removeEntry(a.basename(r)),i.delete(r)},reconcile:async(i,r,l)=>{let s=0,p=[];Object.keys(r.entries).forEach(function(m){let y=r.entries[m],g=l.entries[m];(!g||t.isFile(y.mode)&&y.timestamp.getTime()>g.timestamp.getTime())&&(p.push(m),s++)}),p.sort();let c=[];if(Object.keys(l.entries).forEach(function(m){r.entries[m]||(c.push(m),s++)}),c.sort().reverse(),!s)return;let d=r.type==="remote"?r.handles:l.handles;for(let m of p){let y=a.normalize(m.replace(i.mountpoint,"/")).substring(1);if(l.type==="local"){let g=d.get(y),f=await n.loadRemoteEntry(g);n.storeLocalEntry(m,f)}else{let g=n.loadLocalEntry(m);await n.storeRemoteEntry(d,y,g)}}for(let m of c)if(l.type==="local")n.removeLocalEntry(m);else{let y=a.normalize(m.replace(i.mountpoint,"/")).substring(1);await n.removeRemoteEntry(d,y)}}};e.FS.filesystems.NATIVEFS_ASYNC=n}u(q,"initializeNativeFS");var ye=u(async e=>{let t=[];async function o(n){for await(let i of n.values())t.push(i),i.kind==="directory"&&await o(i)}u(o,"collect"),await o(e);let a=new Map;a.set(".",e);for(let n of t){let i=(await e.resolve(n)).join("/");a.set(i,n)}return a},"getFsHandles");function z(){let e={};return e.noImageDecoding=!0,e.noAudioDecoding=!0,e.noWasmDecoding=!1,e.preRun=[],e.quit=(t,o)=>{throw e.exited={status:t,toThrow:o},o},e}u(z,"createModule");function W(e,t){e.preRun.push(function(){let o="/";try{e.FS.mkdirTree(t)}catch(a){console.error(`Error occurred while making a home directory '${t}':`),console.error(a),console.error(`Using '${o}' for a home directory instead`),t=o}e.FS.chdir(t)})}u(W,"createHomeDirectory");function B(e,t){e.preRun.push(function(){Object.assign(e.ENV,t)})}u(B,"setEnvironment");function V(e,t){e.preRun.push(()=>{for(let o of t)e.FS.mkdirTree(o),e.FS.mount(e.FS.filesystems.NODEFS,{root:o},o)})}u(V,"mountLocalDirectories");function G(e,t){let o=H(t);e.preRun.push(()=>{let a=e._py_version_major(),n=e._py_version_minor();e.FS.mkdirTree("/lib"),e.FS.mkdirTree(`/lib/python${a}.${n}/site-packages`),e.addRunDependency("install-stdlib"),o.then(i=>{e.FS.writeFile(`/lib/python${a}${n}.zip`,i)}).catch(i=>{console.error("Error occurred while installing the standard library:"),console.error(i)}).finally(()=>{e.removeRunDependency("install-stdlib")})})}u(G,"installStdlib");function K(e,t){let o;t.stdLibURL!=null?o=t.stdLibURL:o=t.indexURL+"python_stdlib.zip",G(e,o),W(e,t.env.HOME),B(e,t.env),V(e,t._node_mounts),e.preRun.push(()=>q(e))}u(K,"initializeFileSystem");function Y(e,t){let{binary:o,response:a}=k(t+"pyodide.asm.wasm");e.instantiateWasm=function(n,i){return async function(){try{let r;a?r=await WebAssembly.instantiateStreaming(a,n):r=await WebAssembly.instantiate(await o,n);let{instance:l,module:s}=r;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,s)),i(l,s)}catch(r){console.warn("wasm instantiation failed!"),console.warn(r)}}(),{}}}u(Y,"preloadWasm");var S="0.24.1";function J(e,t){return new Proxy(e,{get(o,a){return a==="get"?n=>{let i=o.get(n);return i===void 0&&(i=t.get(n)),i}:a==="has"?n=>o.has(n)||t.has(n):Reflect.get(o,a)}})}u(J,"wrapPythonGlobals");function Q(e,t){e.runPythonInternal_dict=e._pyodide._base.eval_code("{}"),e.importlib=e.runPythonInternal("import importlib; importlib");let o=e.importlib.import_module;e.sys=o("sys"),e.sys.path.insert(0,t.env.HOME),e.os=o("os");let a=e.runPythonInternal("import __main__; __main__.__dict__"),n=e.runPythonInternal("import builtins; builtins.__dict__");e.globals=J(a,n);let i=e._pyodide._importhook;function r(s){"__all__"in s||Object.defineProperty(s,"__all__",{get:()=>l.toPy(Object.getOwnPropertyNames(s).filter(p=>p!=="__all__")),enumerable:!1,configurable:!0})}u(r,"jsFinderHook"),i.register_js_finder.callKwargs({hook:r}),i.register_js_module("js",t.jsglobals);let l=e.makePublicAPI();return i.register_js_module("pyodide_js",l),e.pyodide_py=o("pyodide"),e.pyodide_code=o("pyodide.code"),e.pyodide_ffi=o("pyodide.ffi"),e.package_loader=o("pyodide._package_loader"),e.sitepackages=e.package_loader.SITE_PACKAGES.__str__(),e.dsodir=e.package_loader.DSO_DIR.__str__(),e.defaultLdLibraryPath=[e.dsodir,e.sitepackages],e.os.environ.__setitem__("LD_LIBRARY_PATH",e.defaultLdLibraryPath.join(":")),l.pyodide_py=e.pyodide_py,l.globals=e.globals,l}u(Q,"finalizeBootstrap");function X(){if(typeof __dirname=="string")return __dirname;let e;try{throw new Error}catch(a){e=a}let t=me.default.parse(e)[0].fileName,o=t.lastIndexOf(N);if(o===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,o)}u(X,"calculateIndexURL");async function Z(e={}){await I();let t=e.indexURL||X();t=P(t),t.endsWith("/")||(t+="/"),e.indexURL=t;let o={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:t+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:t,packages:[]},a=Object.assign(o,e);if(e.homedir){if(console.warn("The homedir argument to loadPyodide is deprecated. Use 'env: { HOME: value }' instead of 'homedir: value'."),e.env&&e.env.HOME)throw new Error("Set both env.HOME and homedir arguments");a.env.HOME=a.homedir}a.env.HOME||(a.env.HOME="/home/pyodide");let n=z();n.print=a.stdout,n.printErr=a.stderr,n.arguments=a.args;let i={config:a};n.API=i,Y(n,t),K(n,a);let r=new Promise(d=>n.postRun=d),l;if(i.bootstrapFinalizedPromise=new Promise(d=>l=d),n.locateFile=d=>a.indexURL+d,typeof _createPyodideModule!="function"){let d=`${a.indexURL}pyodide.asm.js`;await b(d)}if(await _createPyodideModule(n),await r,n.exited)throw n.exited.toThrow;if(i.version!==S)throw new Error(`Pyodide version does not match: '${S}' <==> '${i.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);n.locateFile=d=>{throw new Error("Didn't expect to load any more file_packager files!")};let[s,p]=i.rawRun("import _pyodide_core");s&&n.API.fatal_loading_error(`Failed to import _pyodide_core -`,p);let c=Q(i,a);if(l(),c.version.includes("dev")||i.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),await i.packageIndexReady,i._pyodide._importhook.register_module_not_found_hook(i._import_name_to_package_name,i.lockfile_unvendored_stdlibs_and_test),i.lockfile_info.version!==S)throw new Error("Lock file version doesn't match Pyodide version");return i.package_loader.init_loaded_packages(),a.fullStdLib&&await c.loadPackage(i.lockfile_unvendored_stdlibs),i.initializeStreams(a.stdin,a.stdout,a.stderr),c}u(Z,"loadPyodide");async function he(e){self.pyodide=await Z({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.24.1/full/"}),await self.pyodide.loadPackage(["micropip"]);const t=self.pyodide.pyimport("micropip");await t.install("lzma"),await t.install("pyodide-http"),await t.install(e+"demoland_engine-0.1.dev1+g8333879-py3-none-any.whl")}self.onmessage=async e=>{const{id:t,python:o,pathname:a,scenario_json:n,BASE_URL:i}=e.data;try{await he(a)}catch(l){console.error(l),self.postMessage({error:l.message})}self.scenario_json=n;let r=i.split("/").slice(-2,-1)[0];self.pyodide.globals.set("DEMOLAND",r);try{await self.pyodide.loadPackagesFromImports(o);const l=await self.pyodide.runPythonAsync(o);self.postMessage({results:l,id:t})}catch(l){self.postMessage({error:l.message,id:t})}}; +`,p);let c=Q(i,a);if(l(),c.version.includes("dev")||i.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),await i.packageIndexReady,i._pyodide._importhook.register_module_not_found_hook(i._import_name_to_package_name,i.lockfile_unvendored_stdlibs_and_test),i.lockfile_info.version!==S)throw new Error("Lock file version doesn't match Pyodide version");return i.package_loader.init_loaded_packages(),a.fullStdLib&&await c.loadPackage(i.lockfile_unvendored_stdlibs),i.initializeStreams(a.stdin,a.stdout,a.stderr),c}u(Z,"loadPyodide");async function he(e){self.pyodide=await Z({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.24.1/full/"}),await self.pyodide.loadPackage(["micropip"]);const t=self.pyodide.pyimport("micropip");await t.install("lzma"),await t.install("pyodide-http"),await t.install(e+"demoland_engine-0.1.dev1+g8333879-py3-none-any.whl")}self.onmessage=async e=>{const{id:t,python:o,pathname:a,scenario_json:n,model_identifier:i}=e.data;try{await he(a)}catch(r){console.error(r),self.postMessage({error:r.message})}self.scenario_json=n,self.pyodide.globals.set("DEMOLAND",i);try{await self.pyodide.loadPackagesFromImports(o);const r=await self.pyodide.runPythonAsync(o);self.postMessage({results:r,id:t})}catch(r){self.postMessage({error:r.message,id:t})}}; diff --git a/dev/tyne_and_wear/index.html b/dev/tyne_and_wear/index.html index c303098..072c8ad 100644 --- a/dev/tyne_and_wear/index.html +++ b/dev/tyne_and_wear/index.html @@ -7,7 +7,7 @@ - + diff --git a/dev/tyne_and_wear_hex/assets/index-fdb90f48.js b/dev/tyne_and_wear_hex/assets/index-db770d6d.js similarity index 99% rename from dev/tyne_and_wear_hex/assets/index-fdb90f48.js rename to dev/tyne_and_wear_hex/assets/index-db770d6d.js index be4929d..22e6a43 100644 --- a/dev/tyne_and_wear_hex/assets/index-fdb90f48.js +++ b/dev/tyne_and_wear_hex/assets/index-db770d6d.js @@ -30,7 +30,7 @@ modelled development strategies on any of the four indicators. for your own modifications.`,t=p1(),d4(r.$$.fragment),n=p1();for(let d=0;dt(3,r=d)),m4(i,pe,d=>t(4,n=d)),m4(i,O3,d=>t(0,f=d));const y=je();y("changeScenario",{});function o(d){const P=document.querySelectorAll(".scenario-button");Array.from(P).forEach(v=>{v!==d.target&&(v.style.backgroundColor="#fff")});let F=d.target;F.style.backgroundColor="#eaeaea",w4(pe,n=F.value,n),w4(ve,r=null,r),y("changeScenario")}function u(d){let P=d.target;const F="custom_in_progress";f.set(F,rh(f.get(P.value))),w4(pe,n=F,n),w4(ve,r=null,r),y("changeScenarioAndProceed")}return[f,o,u]}class Ah extends W4{constructor(e){super(),$4(this,e,Mh,Ih,z4,{})}}function Xc(i,e,t){const r=i.slice();return r[45]=e[t][0],r[46]=e[t][1],r}function Yc(i,e,t){const r=i.slice();return r[45]=e[t][0],r[46]=e[t][1],r}function zh(i){let e;return{c(){e=S5("div"),e.textContent=`Click and move your mouse on the map to draw a region of interest. When you are done drawing, click again on the starting point to select all OAs within the region.`,e5(e,"class","smaller svelte-1392tz3")},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Dh(i){let e;return{c(){e=S5("div"),e.textContent=`Click on the map to select an output area. You can shift-click to - select multiple, or click anywhere outside the map to deselect all.`,e5(e,"class","smaller svelte-1392tz3")},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Lh(i){let e,t=i[0].length+"",r,n,f=i[0].length===1?"":"s",y,o,u,d,P,F,v,w,C,S,T,A;P=new ql({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function z(K,J){return K[2]?Bh:Oh}let R=z(i),N=R(i),W=i[14]&&Qc(i);return{c(){e=S5("span"),r=R1(t),n=R1(" output area"),y=R1(f),o=R1(" selected."),u=p1(),d=S5("div"),d4(P.$$.fragment),F=p1(),v=S5("input"),w=p1(),N.c(),C=p1(),W&&W.c(),e5(v,"type","checkbox"),e5(v,"id","sig-modified"),e5(d,"id","changes-grid"),e5(d,"class","svelte-1392tz3")},m(K,J){t1(K,e,J),y5(e,r),y5(e,n),y5(e,y),y5(e,o),t1(K,u,J),t1(K,d,J),y4(P,d,null),y5(d,F),y5(d,v),v.checked=i[2],y5(d,w),N.m(d,null),y5(d,C),W&&W.m(d,null),S=!0,T||(A=[G1(v,"change",i[27]),G1(v,"change",i[28])],T=!0)},p(K,J){(!S||J[0]&1)&&t!==(t=K[0].length+"")&&_9(r,t),(!S||J[0]&1)&&f!==(f=K[0].length===1?"":"s")&&_9(y,f),J[0]&4&&(v.checked=K[2]),R===(R=z(K))&&N?N.p(K,J):(N.d(1),N=R(K),N&&(N.c(),N.m(d,C))),K[14]?W?(W.p(K,J),J[0]&16384&&g1(W,1)):(W=Qc(K),W.c(),g1(W,1),W.m(d,null)):W&&(P9(),P1(W,1,1,()=>{W=null}),x9())},i(K){S||(g1(P.$$.fragment,K),g1(W),S=!0)},o(K){P1(P.$$.fragment,K),P1(W),S=!1},d(K){K&&J5(e),K&&J5(u),K&&J5(d),l4(P),N.d(),W&&W.d(),T=!1,y9(A)}}}function Rh(i){let e;return{c(){e=S5("span"),e.textContent="No output areas selected."},m(t,r){t1(t,e,r)},p:t4,i:t4,o:t4,d(t){t&&J5(e)}}}function Oh(i){let e,t=[...S1.signatures.entries()],r=[];for(let n=0;ni[29].call(e))},m(y,o){t1(y,e,o);for(let u=0;uO9(e,"modified",w)),H4.push(()=>O9(e,"value",C)),e.$on("change",i[19]);function T(K){i[33](K)}function A(K){i[34](K)}let z={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:i[10],max:i[11],defaultVal:i[10],step:.01};i[9]!==void 0&&(z.modified=i[9]),i[8]!==void 0&&(z.value=i[8]),f=new Ns({props:z}),H4.push(()=>O9(f,"modified",T)),H4.push(()=>O9(f,"value",A)),f.$on("change",i[19]);function R(K){i[35](K)}function N(K){i[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return i[13]!==void 0&&(W.modified=i[13]),i[12]!==void 0&&(W.value=i[12]),d=new Ns({props:W}),H4.push(()=>O9(d,"modified",R)),H4.push(()=>O9(d,"value",N)),d.$on("change",i[19]),{c(){d4(e.$$.fragment),n=p1(),d4(f.$$.fragment),u=p1(),d4(d.$$.fragment)},m(K,J){y4(e,K,J),t1(K,n,J),y4(f,K,J),t1(K,u,J),y4(d,K,J),v=!0},p(K,J){const s5={};J[0]&64&&(s5.min=K[6]),J[0]&128&&(s5.max=K[7]),J[0]&64&&(s5.defaultVal=K[6]),!t&&J[0]&32&&(t=!0,s5.modified=K[5],R9(()=>t=!1)),!r&&J[0]&16&&(r=!0,s5.value=K[4],R9(()=>r=!1)),e.$set(s5);const i5={};J[0]&1024&&(i5.min=K[10]),J[0]&2048&&(i5.max=K[11]),J[0]&1024&&(i5.defaultVal=K[10]),!y&&J[0]&512&&(y=!0,i5.modified=K[9],R9(()=>y=!1)),!o&&J[0]&256&&(o=!0,i5.value=K[8],R9(()=>o=!1)),f.$set(i5);const d5={};!P&&J[0]&8192&&(P=!0,d5.modified=K[13],R9(()=>P=!1)),!F&&J[0]&4096&&(F=!0,d5.value=K[12],R9(()=>F=!1)),d.$set(d5)},i(K){v||(g1(e.$$.fragment,K),g1(f.$$.fragment,K),g1(d.$$.fragment,K),v=!0)},o(K){P1(e.$$.fragment,K),P1(f.$$.fragment,K),P1(d.$$.fragment,K),v=!1},d(K){l4(e,K),K&&J5(n),l4(f,K),K&&J5(u),l4(d,K)}}}function Nh(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T,A,z,R,N;e=new jl({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",i[24]),e.$on("forwardClick",i[25]),r=new j2({});function W(_5,o5){if(_5[16]==="click")return Dh;if(_5[16]==="draw")return zh}let K=W(i),J=K&&K(i);w=new j2({});const s5=[Rh,Lh],i5=[];function d5(_5,o5){return _5[0].length===0?0:1}return S=d5(i),T=i5[S]=s5[S](i),{c(){d4(e.$$.fragment),t=p1(),d4(r.$$.fragment),n=p1(),f=S5("div"),y=S5("i"),y.textContent="Selection method",o=p1(),u=S5("select"),d=S5("option"),d.textContent="Click on map",P=S5("option"),P.textContent="Freehand draw",F=p1(),J&&J.c(),v=p1(),d4(w.$$.fragment),C=p1(),T.c(),A=$e(),d.__value="click",d.value=d.__value,P.__value="draw",P.value=P.__value,e5(u,"id","oa-selection-method"),i[16]===void 0&&$9(()=>i[26].call(u)),e5(f,"id","selection-method-choice"),e5(f,"class","svelte-1392tz3")},m(_5,o5){y4(e,_5,o5),t1(_5,t,o5),y4(r,_5,o5),t1(_5,n,o5),t1(_5,f,o5),y5(f,y),y5(f,o),y5(f,u),y5(u,d),y5(u,P),e3(u,i[16],!0),t1(_5,F,o5),J&&J.m(_5,o5),t1(_5,v,o5),y4(w,_5,o5),t1(_5,C,o5),i5[S].m(_5,o5),t1(_5,A,o5),z=!0,R||(N=G1(u,"change",i[26]),R=!0)},p(_5,o5){o5[0]&65536&&e3(u,_5[16]),K!==(K=W(_5))&&(J&&J.d(1),J=K&&K(_5),J&&(J.c(),J.m(v.parentNode,v)));let v5=S;S=d5(_5),S===v5?i5[S].p(_5,o5):(P9(),P1(i5[v5],1,1,()=>{i5[v5]=null}),x9(),T=i5[S],T?T.p(_5,o5):(T=i5[S]=s5[S](_5),T.c()),g1(T,1),T.m(A.parentNode,A))},i(_5){z||(g1(e.$$.fragment,_5),g1(r.$$.fragment,_5),g1(w.$$.fragment,_5),g1(T),z=!0)},o(_5){P1(e.$$.fragment,_5),P1(r.$$.fragment,_5),P1(w.$$.fragment,_5),P1(T),z=!1},d(_5){l4(e,_5),_5&&J5(t),l4(r,_5),_5&&J5(n),_5&&J5(f),_5&&J5(F),J&&J.d(_5),_5&&J5(v),l4(w,_5),_5&&J5(C),i5[S].d(_5),_5&&J5(A),R=!1,N()}}}function Vh(i){let e,t;return e=new ca({props:{title:"Step 2: Modify output areas",$$slots:{default:[Nh]},$$scope:{ctx:i}}}),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,n){const f={};n[0]&131071|n[1]&1048576&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function L7(i){return Math.round(i*100)/100}function Uh(i,e,t){let r,n,f,y,o;m4(i,ne,l1=>t(0,r=l1)),m4(i,O3,l1=>t(37,n=l1)),m4(i,c2,l1=>t(38,f=l1)),m4(i,pe,l1=>t(39,y=l1)),m4(i,Yi,l1=>t(16,o=l1));const u=je();let{changes:d=n.get(y).changes}=e,{userChangesPresent:P}=e,F=!1;R2(()=>{w4(c2,f=!0,f),t(23,F=!0)}),O2(()=>{w4(c2,f=!1,f)});let v=null,w,C,S=null,T,A,z,R=null,N,W,K,J=null,s5,i5=!1;function d5(l1){if(l1.length===0)return{kind:"None"};if(l1.length===1){const F1=l1[0].name,U=v5(F1).get("signature_type");return U===null?{kind:"SinglePassive",oaName:F1,sigId:o5(F1)}:{kind:"SingleActive",oaName:F1,sigId:U}}else{const F1=l1.map(c5=>c5.name),$5=l1.map(c5=>v5(c5.name)).map(c5=>c5.get("signature_type")),N5=F1.map(c5=>o5(c5));if($5.every(c5=>c5===null))return N5.every(c5=>c5===N5[0])?{kind:"MultipleSamePassive",oaNames:F1,sigId:N5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:N5};if($5.some(c5=>c5!==null)&&$5.some(c5=>c5===null)){const c5=$5.map((p5,j5)=>p5||N5[j5]);return c5.every(p5=>p5===c5[0])?{kind:"MultipleSamePassive",oaNames:F1,sigId:c5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:c5}}else return $5.every(c5=>c5===$5[0])?{kind:"MultipleSameActive",oaNames:F1,sigId:$5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:$5}}}let _5=d5(r);function o5(l1){return n.get(S1.referenceScenarioObject.metadata.name).values.get(l1).get("signature_type")}function v5(l1){const F1=d.has(l1),U=d.get(l1);return new Map([["signature_type",F1?U.get("signature_type"):null],["job_types",F1?U.get("job_types"):null],["use",F1?U.get("use"):null],["greenspace",F1?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",v),!w&&!T&&!N&&!s5)r.forEach(l1=>{d.delete(l1.name)});else{const l1=new Map([["signature_type",w?v:null],["job_types",T?S:null],["use",N?R:null],["greenspace",s5?J:null]]);r.forEach(F1=>{d.set(F1.name,l1)})}u("changesUpdated"),t(21,P=!0)}function m5(l1,F1){t(4,S=v5(l1).get("job_types")),t(8,R=v5(l1).get("use")),t(12,J=v5(l1).get("greenspace")),t(5,T=S!==null),t(9,N=R!==null),t(13,s5=J!==null),t(6,A=L7(S1.signatures[F1].job_d1)),t(7,z=L7(S1.signatures[F1].job_d9)),t(10,W=L7(S1.signatures[F1].use_d1)),t(11,K=L7(S1.signatures[F1].use_d9))}function b5(l1,F1){const U=l1.map(N5=>v5(N5));function $5(N5){const c5=U.map(p5=>p5.get(N5));return c5.every(p5=>p5===c5[0]&&p5!==null)?c5[0]:null}t(4,S=$5("job_types")),t(5,T=S!==null),t(8,R=$5("use")),t(9,N=R!==null),t(12,J=$5("greenspace")),t(13,s5=J!==null),t(6,A=S1.signatures[F1].job_d1),t(7,z=S1.signatures[F1].job_d9),t(10,W=S1.signatures[F1].use_d1),t(11,K=S1.signatures[F1].use_d9)}function k5(){switch(_5.kind){case"None":return;case"SingleActive":t(1,v=_5.sigId),t(2,w=!0),t(3,C=_5.sigId);break;case"SinglePassive":t(1,v=null),t(2,w=!1),t(3,C=_5.sigId);break;case"MultipleDifferent":t(1,v=null),t(2,w=!1),t(3,C=null);break;case"MultipleSameActive":t(1,v=_5.sigId),t(2,w=!0),t(3,C=null);break;case"MultipleSamePassive":t(1,v=null),t(2,w=!1),t(3,C=_5.sigId);break}C5()}function C5(){function l1(F1){t(6,A=L7(S1.signatures[F1].job_d1)),t(7,z=L7(S1.signatures[F1].job_d9)),t(10,W=L7(S1.signatures[F1].use_d1)),t(11,K=L7(S1.signatures[F1].use_d9))}switch(console.log(_5),_5.kind){case"None":t(14,i5=!1);break;case"SingleActive":t(14,i5=!0),m5(_5.oaName,_5.sigId),l1(_5.sigId);break;case"SinglePassive":t(14,i5=!0),m5(_5.oaName,_5.sigId),l1(_5.sigId);break;case"MultipleSameActive":t(14,i5=!0),b5(_5.oaNames,_5.sigId),l1(_5.sigId);break;case"MultipleSamePassive":t(14,i5=!0),b5(_5.oaNames,_5.sigId),l1(_5.sigId);break;case"MultipleDifferent":t(14,i5=!1),t(4,S=null),t(8,R=null),t(12,J=null),t(5,T=!1),t(9,N=!1),t(13,s5=!1),V();break}}const I5=()=>u("returnToSelection",{}),L5=()=>u("proceedToMetadata",{});function E5(){o=h2(this),Yi.set(o)}function M5(){w=this.checked,t(2,w)}const _1=()=>{w&&_5.kind!=="MultipleDifferent"?t(1,v=C):(w&&_5.kind,t(1,v=null)),V(),t(15,_5=d5(r)),C5()};function c1(){v=h2(this),t(1,v)}const s1=()=>{V(),t(15,_5=d5(r)),C5()};function k1(l1){T=l1,t(5,T)}function U1(l1){S=l1,t(4,S)}function v1(l1){N=l1,t(9,N)}function A1(l1){R=l1,t(8,R)}function X1(l1){s5=l1,t(13,s5)}function Y1(l1){J=l1,t(12,J)}return i.$$set=l1=>{"changes"in l1&&t(22,d=l1.changes),"userChangesPresent"in l1&&t(21,P=l1.userChangesPresent)},i.$$.update=()=>{i.$$.dirty[0]&8388609&&(t(15,_5=d5(r)),F&&k5())},[r,v,w,C,S,T,A,z,R,N,W,K,J,s5,i5,_5,o,u,d5,V,C5,P,d,F,I5,L5,E5,M5,_1,c1,s1,k1,U1,v1,A1,X1,Y1]}class $h extends W4{constructor(e){super(),$4(this,e,Uh,Vh,z4,{changes:22,userChangesPresent:21},null,[-1,-1])}}function Wh(i){let e;return{c(){e=S5("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Gh(i){let e,t,r;return{c(){e=R1("This uses the "),t=S5("a"),t.textContent="Pyodide library",r=R1(" to run the calculation entirely in your browser."),e5(t,"href","https://pyodide.org/en/stable/"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Zh(i){let e,t,r;return{c(){e=R1("To use this option, the API must be running on port 5178. See the "),t=S5("a"),t.textContent="developer notes",r=R1(" for details on how to set this up."),e5(t,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Hh(i){let e,t,r;return{c(){e=R1("This is an "),t=S5("a"),t.textContent="Azure Functions",r=R1(" instance, i.e. a web service hosted on the cloud."),e5(t,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Xh(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T,A,z,R,N,W;e=new jl({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",i[7]),e.$on("forwardClick",i[8]),r=new j2({});let K=!i[6]&&Wh();function J(d5,_5){if(d5[2]==="azure")return Hh;if(d5[2]==="local")return Zh;if(d5[2]==="wasm")return Gh}let s5=J(i),i5=s5&&s5(i);return C=new j2({}),{c(){d4(e.$$.fragment),t=p1(),d4(r.$$.fragment),n=p1(),f=S5("div"),y=S5("i"),y.textContent="Calculation method",o=p1(),u=S5("select"),d=S5("option"),d.textContent="Azure REST API",K&&K.c(),P=S5("option"),P.textContent="In-browser",F=p1(),v=S5("div"),i5&&i5.c(),w=p1(),d4(C.$$.fragment),S=p1(),T=S5("input"),A=p1(),z=S5("textarea"),d.__value="azure",d.value=d.__value,P.__value="wasm",P.value=P.__value,i[2]===void 0&&$9(()=>i[9].call(u)),e5(f,"id","calculation-method-choice"),e5(f,"class","svelte-ygj49d"),e5(v,"class","smaller svelte-ygj49d"),e5(T,"type","text"),e5(T,"placeholder","Scenario title..."),e5(T,"class","svelte-ygj49d"),e5(z,"placeholder","A longer textual description..."),e5(z,"spellcheck","false"),e5(z,"class","svelte-ygj49d")},m(d5,_5){y4(e,d5,_5),t1(d5,t,_5),y4(r,d5,_5),t1(d5,n,_5),t1(d5,f,_5),y5(f,y),y5(f,o),y5(f,u),y5(u,d),K&&K.m(u,null),y5(u,P),e3(u,i[2],!0),t1(d5,F,_5),t1(d5,v,_5),i5&&i5.m(v,null),t1(d5,w,_5),y4(C,d5,_5),t1(d5,S,_5),t1(d5,T,_5),i[10](T),Ie(T,i[0]),t1(d5,A,_5),t1(d5,z,_5),i[13](z),Ie(z,i[1]),R=!0,N||(W=[G1(u,"change",i[9]),G1(T,"input",i[11]),G1(T,"input",i[12]),G1(z,"input",i[14]),G1(z,"input",i[15])],N=!0)},p(d5,_5){_5&4&&e3(u,d5[2]),s5!==(s5=J(d5))&&(i5&&i5.d(1),i5=s5&&s5(d5),i5&&(i5.c(),i5.m(v,null))),_5&1&&T.value!==d5[0]&&Ie(T,d5[0]),_5&2&&Ie(z,d5[1])},i(d5){R||(g1(e.$$.fragment,d5),g1(r.$$.fragment,d5),g1(C.$$.fragment,d5),R=!0)},o(d5){P1(e.$$.fragment,d5),P1(r.$$.fragment,d5),P1(C.$$.fragment,d5),R=!1},d(d5){l4(e,d5),d5&&J5(t),l4(r,d5),d5&&J5(n),d5&&J5(f),K&&K.d(),d5&&J5(F),d5&&J5(v),i5&&i5.d(),d5&&J5(w),l4(C,d5),d5&&J5(S),d5&&J5(T),i[10](null),d5&&J5(A),d5&&J5(z),i[13](null),N=!1,y9(W)}}}function Yh(i){let e,t;return e=new ca({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[Xh]},$$scope:{ctx:i}}}),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,[n]){const f={};n&65567&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function ef(i){i.style.borderColor="#f26d88"}function Kh(i,e,t){let{scenarioShort:r=""}=e,{scenarioDescription:n=""}=e,{calculationMethod:f="azure"}=e;const y=je();let o,u;const d=window.location.href.toLowerCase().includes(S1.baseUrl.toLowerCase()),P=()=>y("returnToModify"),F=()=>{if(r===""){alert("Please enter a scenario title."),ef(o);return}if(n===""){alert("Please enter a scenario description."),ef(u);return}y("acceptChangesAndCalculate")};function v(){f=h2(this),t(2,f)}function w(R){H4[R?"unshift":"push"](()=>{o=R,t(3,o)})}function C(){r=this.value,t(0,r)}const S=()=>{t(3,o.style.borderColor=r===""?"#f26d88":"#999",o)};function T(R){H4[R?"unshift":"push"](()=>{u=R,t(4,u)})}function A(){n=this.value,t(1,n)}const z=()=>{t(4,u.style.borderColor=n===""?"#f26d88":"#999",u)};return i.$$set=R=>{"scenarioShort"in R&&t(0,r=R.scenarioShort),"scenarioDescription"in R&&t(1,n=R.scenarioDescription),"calculationMethod"in R&&t(2,f=R.calculationMethod)},[r,n,f,o,u,y,d,P,F,v,w,C,S,T,A,z]}class Jh extends W4{constructor(e){super(),$4(this,e,Kh,Yh,z4,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Qh="modulepreload",em=function(i){return"/demoland-web/dev/tyne_and_wear_hex/"+i},tf={},tm=function(e,t,r){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(f=>{if(f=em(f),f in tf)return;tf[f]=!0;const y=f.endsWith(".css"),o=y?'[rel="stylesheet"]':"";if(!!r)for(let P=n.length-1;P>=0;P--){const F=n[P];if(F.href===f&&(!y||F.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${o}`))return;const d=document.createElement("link");if(d.rel=y?"stylesheet":Qh,y||(d.as="script",d.crossOrigin=""),d.href=f,document.head.appendChild(d),y)return new Promise((P,F)=>{d.addEventListener("load",P),d.addEventListener("error",()=>F(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=f,window.dispatchEvent(y),!y.defaultPrevented)throw f})};let Z0;const Di={};let _i=0;async function im(){if(Z0)return Z0;const i=await tm(()=>import("./pyodide_worker-df5fef8a.js"),[]);return Z0=new i.default,Z0.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:t,...r}=e.data,n=Di[t];console.log(Di),delete Di[t],n(r)}},Z0}async function rm(i,e){const t=await im();return _i=(_i+1)%Number.MAX_SAFE_INTEGER,new Promise(r=>{Di[_i]=r,t.postMessage({...e,python:i,id:_i,pathname:window.location.pathname})})}async function sm(i){const t=await rm(` + select multiple, or click anywhere outside the map to deselect all.`,e5(e,"class","smaller svelte-1392tz3")},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Lh(i){let e,t=i[0].length+"",r,n,f=i[0].length===1?"":"s",y,o,u,d,P,F,v,w,C,S,T,A;P=new ql({props:{forInputName:"sig-modified",labelText:"Signature",hoverText:"Signature types are used to describe different levels of urbanity, and also control the valid range of values for the other variables."}});function z(K,J){return K[2]?Bh:Oh}let R=z(i),N=R(i),W=i[14]&&Qc(i);return{c(){e=S5("span"),r=R1(t),n=R1(" output area"),y=R1(f),o=R1(" selected."),u=p1(),d=S5("div"),d4(P.$$.fragment),F=p1(),v=S5("input"),w=p1(),N.c(),C=p1(),W&&W.c(),e5(v,"type","checkbox"),e5(v,"id","sig-modified"),e5(d,"id","changes-grid"),e5(d,"class","svelte-1392tz3")},m(K,J){t1(K,e,J),y5(e,r),y5(e,n),y5(e,y),y5(e,o),t1(K,u,J),t1(K,d,J),y4(P,d,null),y5(d,F),y5(d,v),v.checked=i[2],y5(d,w),N.m(d,null),y5(d,C),W&&W.m(d,null),S=!0,T||(A=[G1(v,"change",i[27]),G1(v,"change",i[28])],T=!0)},p(K,J){(!S||J[0]&1)&&t!==(t=K[0].length+"")&&_9(r,t),(!S||J[0]&1)&&f!==(f=K[0].length===1?"":"s")&&_9(y,f),J[0]&4&&(v.checked=K[2]),R===(R=z(K))&&N?N.p(K,J):(N.d(1),N=R(K),N&&(N.c(),N.m(d,C))),K[14]?W?(W.p(K,J),J[0]&16384&&g1(W,1)):(W=Qc(K),W.c(),g1(W,1),W.m(d,null)):W&&(P9(),P1(W,1,1,()=>{W=null}),x9())},i(K){S||(g1(P.$$.fragment,K),g1(W),S=!0)},o(K){P1(P.$$.fragment,K),P1(W),S=!1},d(K){K&&J5(e),K&&J5(u),K&&J5(d),l4(P),N.d(),W&&W.d(),T=!1,y9(A)}}}function Rh(i){let e;return{c(){e=S5("span"),e.textContent="No output areas selected."},m(t,r){t1(t,e,r)},p:t4,i:t4,o:t4,d(t){t&&J5(e)}}}function Oh(i){let e,t=[...S1.signatures.entries()],r=[];for(let n=0;ni[29].call(e))},m(y,o){t1(y,e,o);for(let u=0;uO9(e,"modified",w)),H4.push(()=>O9(e,"value",C)),e.$on("change",i[19]);function T(K){i[33](K)}function A(K){i[34](K)}let z={title:"Building use",description:"The ratio of residential to commercial buildings in the area. A value of -1 indicates fully residential, and 1 fully commercial. The default value of 0 uses a standard value derived from the underlying signature type.",leftEdge:-1,rightEdge:1,min:i[10],max:i[11],defaultVal:i[10],step:.01};i[9]!==void 0&&(z.modified=i[9]),i[8]!==void 0&&(z.value=i[8]),f=new Ns({props:z}),H4.push(()=>O9(f,"modified",T)),H4.push(()=>O9(f,"value",A)),f.$on("change",i[19]);function R(K){i[35](K)}function N(K){i[36](K)}let W={title:"Greenspace",description:"The proportion of the area that is formally classified as greenspace.",leftEdge:0,rightEdge:1,min:0,max:1,defaultVal:0,step:.01};return i[13]!==void 0&&(W.modified=i[13]),i[12]!==void 0&&(W.value=i[12]),d=new Ns({props:W}),H4.push(()=>O9(d,"modified",R)),H4.push(()=>O9(d,"value",N)),d.$on("change",i[19]),{c(){d4(e.$$.fragment),n=p1(),d4(f.$$.fragment),u=p1(),d4(d.$$.fragment)},m(K,J){y4(e,K,J),t1(K,n,J),y4(f,K,J),t1(K,u,J),y4(d,K,J),v=!0},p(K,J){const s5={};J[0]&64&&(s5.min=K[6]),J[0]&128&&(s5.max=K[7]),J[0]&64&&(s5.defaultVal=K[6]),!t&&J[0]&32&&(t=!0,s5.modified=K[5],R9(()=>t=!1)),!r&&J[0]&16&&(r=!0,s5.value=K[4],R9(()=>r=!1)),e.$set(s5);const i5={};J[0]&1024&&(i5.min=K[10]),J[0]&2048&&(i5.max=K[11]),J[0]&1024&&(i5.defaultVal=K[10]),!y&&J[0]&512&&(y=!0,i5.modified=K[9],R9(()=>y=!1)),!o&&J[0]&256&&(o=!0,i5.value=K[8],R9(()=>o=!1)),f.$set(i5);const d5={};!P&&J[0]&8192&&(P=!0,d5.modified=K[13],R9(()=>P=!1)),!F&&J[0]&4096&&(F=!0,d5.value=K[12],R9(()=>F=!1)),d.$set(d5)},i(K){v||(g1(e.$$.fragment,K),g1(f.$$.fragment,K),g1(d.$$.fragment,K),v=!0)},o(K){P1(e.$$.fragment,K),P1(f.$$.fragment,K),P1(d.$$.fragment,K),v=!1},d(K){l4(e,K),K&&J5(n),l4(f,K),K&&J5(u),l4(d,K)}}}function Nh(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T,A,z,R,N;e=new jl({props:{backText:"Back to scenario selection",forwardText:"Continue to add metadata"}}),e.$on("backClick",i[24]),e.$on("forwardClick",i[25]),r=new j2({});function W(_5,o5){if(_5[16]==="click")return Dh;if(_5[16]==="draw")return zh}let K=W(i),J=K&&K(i);w=new j2({});const s5=[Rh,Lh],i5=[];function d5(_5,o5){return _5[0].length===0?0:1}return S=d5(i),T=i5[S]=s5[S](i),{c(){d4(e.$$.fragment),t=p1(),d4(r.$$.fragment),n=p1(),f=S5("div"),y=S5("i"),y.textContent="Selection method",o=p1(),u=S5("select"),d=S5("option"),d.textContent="Click on map",P=S5("option"),P.textContent="Freehand draw",F=p1(),J&&J.c(),v=p1(),d4(w.$$.fragment),C=p1(),T.c(),A=$e(),d.__value="click",d.value=d.__value,P.__value="draw",P.value=P.__value,e5(u,"id","oa-selection-method"),i[16]===void 0&&$9(()=>i[26].call(u)),e5(f,"id","selection-method-choice"),e5(f,"class","svelte-1392tz3")},m(_5,o5){y4(e,_5,o5),t1(_5,t,o5),y4(r,_5,o5),t1(_5,n,o5),t1(_5,f,o5),y5(f,y),y5(f,o),y5(f,u),y5(u,d),y5(u,P),e3(u,i[16],!0),t1(_5,F,o5),J&&J.m(_5,o5),t1(_5,v,o5),y4(w,_5,o5),t1(_5,C,o5),i5[S].m(_5,o5),t1(_5,A,o5),z=!0,R||(N=G1(u,"change",i[26]),R=!0)},p(_5,o5){o5[0]&65536&&e3(u,_5[16]),K!==(K=W(_5))&&(J&&J.d(1),J=K&&K(_5),J&&(J.c(),J.m(v.parentNode,v)));let v5=S;S=d5(_5),S===v5?i5[S].p(_5,o5):(P9(),P1(i5[v5],1,1,()=>{i5[v5]=null}),x9(),T=i5[S],T?T.p(_5,o5):(T=i5[S]=s5[S](_5),T.c()),g1(T,1),T.m(A.parentNode,A))},i(_5){z||(g1(e.$$.fragment,_5),g1(r.$$.fragment,_5),g1(w.$$.fragment,_5),g1(T),z=!0)},o(_5){P1(e.$$.fragment,_5),P1(r.$$.fragment,_5),P1(w.$$.fragment,_5),P1(T),z=!1},d(_5){l4(e,_5),_5&&J5(t),l4(r,_5),_5&&J5(n),_5&&J5(f),_5&&J5(F),J&&J.d(_5),_5&&J5(v),l4(w,_5),_5&&J5(C),i5[S].d(_5),_5&&J5(A),R=!1,N()}}}function Vh(i){let e,t;return e=new ca({props:{title:"Step 2: Modify output areas",$$slots:{default:[Nh]},$$scope:{ctx:i}}}),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,n){const f={};n[0]&131071|n[1]&1048576&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function L7(i){return Math.round(i*100)/100}function Uh(i,e,t){let r,n,f,y,o;m4(i,ne,l1=>t(0,r=l1)),m4(i,O3,l1=>t(37,n=l1)),m4(i,c2,l1=>t(38,f=l1)),m4(i,pe,l1=>t(39,y=l1)),m4(i,Yi,l1=>t(16,o=l1));const u=je();let{changes:d=n.get(y).changes}=e,{userChangesPresent:P}=e,F=!1;R2(()=>{w4(c2,f=!0,f),t(23,F=!0)}),O2(()=>{w4(c2,f=!1,f)});let v=null,w,C,S=null,T,A,z,R=null,N,W,K,J=null,s5,i5=!1;function d5(l1){if(l1.length===0)return{kind:"None"};if(l1.length===1){const F1=l1[0].name,U=v5(F1).get("signature_type");return U===null?{kind:"SinglePassive",oaName:F1,sigId:o5(F1)}:{kind:"SingleActive",oaName:F1,sigId:U}}else{const F1=l1.map(c5=>c5.name),$5=l1.map(c5=>v5(c5.name)).map(c5=>c5.get("signature_type")),N5=F1.map(c5=>o5(c5));if($5.every(c5=>c5===null))return N5.every(c5=>c5===N5[0])?{kind:"MultipleSamePassive",oaNames:F1,sigId:N5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:N5};if($5.some(c5=>c5!==null)&&$5.some(c5=>c5===null)){const c5=$5.map((p5,j5)=>p5||N5[j5]);return c5.every(p5=>p5===c5[0])?{kind:"MultipleSamePassive",oaNames:F1,sigId:c5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:c5}}else return $5.every(c5=>c5===$5[0])?{kind:"MultipleSameActive",oaNames:F1,sigId:$5[0]}:{kind:"MultipleDifferent",oaNames:F1,sigIds:$5}}}let _5=d5(r);function o5(l1){return n.get(S1.referenceScenarioObject.metadata.name).values.get(l1).get("signature_type")}function v5(l1){const F1=d.has(l1),U=d.get(l1);return new Map([["signature_type",F1?U.get("signature_type"):null],["job_types",F1?U.get("job_types"):null],["use",F1?U.get("use"):null],["greenspace",F1?U.get("greenspace"):null]])}function V(){if(console.log("setOAChanges()",v),!w&&!T&&!N&&!s5)r.forEach(l1=>{d.delete(l1.name)});else{const l1=new Map([["signature_type",w?v:null],["job_types",T?S:null],["use",N?R:null],["greenspace",s5?J:null]]);r.forEach(F1=>{d.set(F1.name,l1)})}u("changesUpdated"),t(21,P=!0)}function m5(l1,F1){t(4,S=v5(l1).get("job_types")),t(8,R=v5(l1).get("use")),t(12,J=v5(l1).get("greenspace")),t(5,T=S!==null),t(9,N=R!==null),t(13,s5=J!==null),t(6,A=L7(S1.signatures[F1].job_d1)),t(7,z=L7(S1.signatures[F1].job_d9)),t(10,W=L7(S1.signatures[F1].use_d1)),t(11,K=L7(S1.signatures[F1].use_d9))}function b5(l1,F1){const U=l1.map(N5=>v5(N5));function $5(N5){const c5=U.map(p5=>p5.get(N5));return c5.every(p5=>p5===c5[0]&&p5!==null)?c5[0]:null}t(4,S=$5("job_types")),t(5,T=S!==null),t(8,R=$5("use")),t(9,N=R!==null),t(12,J=$5("greenspace")),t(13,s5=J!==null),t(6,A=S1.signatures[F1].job_d1),t(7,z=S1.signatures[F1].job_d9),t(10,W=S1.signatures[F1].use_d1),t(11,K=S1.signatures[F1].use_d9)}function k5(){switch(_5.kind){case"None":return;case"SingleActive":t(1,v=_5.sigId),t(2,w=!0),t(3,C=_5.sigId);break;case"SinglePassive":t(1,v=null),t(2,w=!1),t(3,C=_5.sigId);break;case"MultipleDifferent":t(1,v=null),t(2,w=!1),t(3,C=null);break;case"MultipleSameActive":t(1,v=_5.sigId),t(2,w=!0),t(3,C=null);break;case"MultipleSamePassive":t(1,v=null),t(2,w=!1),t(3,C=_5.sigId);break}C5()}function C5(){function l1(F1){t(6,A=L7(S1.signatures[F1].job_d1)),t(7,z=L7(S1.signatures[F1].job_d9)),t(10,W=L7(S1.signatures[F1].use_d1)),t(11,K=L7(S1.signatures[F1].use_d9))}switch(console.log(_5),_5.kind){case"None":t(14,i5=!1);break;case"SingleActive":t(14,i5=!0),m5(_5.oaName,_5.sigId),l1(_5.sigId);break;case"SinglePassive":t(14,i5=!0),m5(_5.oaName,_5.sigId),l1(_5.sigId);break;case"MultipleSameActive":t(14,i5=!0),b5(_5.oaNames,_5.sigId),l1(_5.sigId);break;case"MultipleSamePassive":t(14,i5=!0),b5(_5.oaNames,_5.sigId),l1(_5.sigId);break;case"MultipleDifferent":t(14,i5=!1),t(4,S=null),t(8,R=null),t(12,J=null),t(5,T=!1),t(9,N=!1),t(13,s5=!1),V();break}}const I5=()=>u("returnToSelection",{}),L5=()=>u("proceedToMetadata",{});function E5(){o=h2(this),Yi.set(o)}function M5(){w=this.checked,t(2,w)}const _1=()=>{w&&_5.kind!=="MultipleDifferent"?t(1,v=C):(w&&_5.kind,t(1,v=null)),V(),t(15,_5=d5(r)),C5()};function c1(){v=h2(this),t(1,v)}const s1=()=>{V(),t(15,_5=d5(r)),C5()};function k1(l1){T=l1,t(5,T)}function U1(l1){S=l1,t(4,S)}function v1(l1){N=l1,t(9,N)}function A1(l1){R=l1,t(8,R)}function X1(l1){s5=l1,t(13,s5)}function Y1(l1){J=l1,t(12,J)}return i.$$set=l1=>{"changes"in l1&&t(22,d=l1.changes),"userChangesPresent"in l1&&t(21,P=l1.userChangesPresent)},i.$$.update=()=>{i.$$.dirty[0]&8388609&&(t(15,_5=d5(r)),F&&k5())},[r,v,w,C,S,T,A,z,R,N,W,K,J,s5,i5,_5,o,u,d5,V,C5,P,d,F,I5,L5,E5,M5,_1,c1,s1,k1,U1,v1,A1,X1,Y1]}class $h extends W4{constructor(e){super(),$4(this,e,Uh,Vh,z4,{changes:22,userChangesPresent:21},null,[-1,-1])}}function Wh(i){let e;return{c(){e=S5("option"),e.textContent="Local REST API",e.__value="local",e.value=e.__value},m(t,r){t1(t,e,r)},d(t){t&&J5(e)}}}function Gh(i){let e,t,r;return{c(){e=R1("This uses the "),t=S5("a"),t.textContent="Pyodide library",r=R1(" to run the calculation entirely in your browser."),e5(t,"href","https://pyodide.org/en/stable/"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Zh(i){let e,t,r;return{c(){e=R1("To use this option, the API must be running on port 5178. See the "),t=S5("a"),t.textContent="developer notes",r=R1(" for details on how to set this up."),e5(t,"href","https://urban-analytics-technology-platform.github.io/demoland-project/book/developer_notes.html#fastapi-local"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Hh(i){let e,t,r;return{c(){e=R1("This is an "),t=S5("a"),t.textContent="Azure Functions",r=R1(" instance, i.e. a web service hosted on the cloud."),e5(t,"href","https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview"),e5(t,"target","_blank")},m(n,f){t1(n,e,f),t1(n,t,f),t1(n,r,f)},d(n){n&&J5(e),n&&J5(t),n&&J5(r)}}}function Xh(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T,A,z,R,N,W;e=new jl({props:{backText:"Back to OA modification",forwardText:"Accept changes and calculate"}}),e.$on("backClick",i[7]),e.$on("forwardClick",i[8]),r=new j2({});let K=!i[6]&&Wh();function J(d5,_5){if(d5[2]==="azure")return Hh;if(d5[2]==="local")return Zh;if(d5[2]==="wasm")return Gh}let s5=J(i),i5=s5&&s5(i);return C=new j2({}),{c(){d4(e.$$.fragment),t=p1(),d4(r.$$.fragment),n=p1(),f=S5("div"),y=S5("i"),y.textContent="Calculation method",o=p1(),u=S5("select"),d=S5("option"),d.textContent="Azure REST API",K&&K.c(),P=S5("option"),P.textContent="In-browser",F=p1(),v=S5("div"),i5&&i5.c(),w=p1(),d4(C.$$.fragment),S=p1(),T=S5("input"),A=p1(),z=S5("textarea"),d.__value="azure",d.value=d.__value,P.__value="wasm",P.value=P.__value,i[2]===void 0&&$9(()=>i[9].call(u)),e5(f,"id","calculation-method-choice"),e5(f,"class","svelte-ygj49d"),e5(v,"class","smaller svelte-ygj49d"),e5(T,"type","text"),e5(T,"placeholder","Scenario title..."),e5(T,"class","svelte-ygj49d"),e5(z,"placeholder","A longer textual description..."),e5(z,"spellcheck","false"),e5(z,"class","svelte-ygj49d")},m(d5,_5){y4(e,d5,_5),t1(d5,t,_5),y4(r,d5,_5),t1(d5,n,_5),t1(d5,f,_5),y5(f,y),y5(f,o),y5(f,u),y5(u,d),K&&K.m(u,null),y5(u,P),e3(u,i[2],!0),t1(d5,F,_5),t1(d5,v,_5),i5&&i5.m(v,null),t1(d5,w,_5),y4(C,d5,_5),t1(d5,S,_5),t1(d5,T,_5),i[10](T),Ie(T,i[0]),t1(d5,A,_5),t1(d5,z,_5),i[13](z),Ie(z,i[1]),R=!0,N||(W=[G1(u,"change",i[9]),G1(T,"input",i[11]),G1(T,"input",i[12]),G1(z,"input",i[14]),G1(z,"input",i[15])],N=!0)},p(d5,_5){_5&4&&e3(u,d5[2]),s5!==(s5=J(d5))&&(i5&&i5.d(1),i5=s5&&s5(d5),i5&&(i5.c(),i5.m(v,null))),_5&1&&T.value!==d5[0]&&Ie(T,d5[0]),_5&2&&Ie(z,d5[1])},i(d5){R||(g1(e.$$.fragment,d5),g1(r.$$.fragment,d5),g1(C.$$.fragment,d5),R=!0)},o(d5){P1(e.$$.fragment,d5),P1(r.$$.fragment,d5),P1(C.$$.fragment,d5),R=!1},d(d5){l4(e,d5),d5&&J5(t),l4(r,d5),d5&&J5(n),d5&&J5(f),K&&K.d(),d5&&J5(F),d5&&J5(v),i5&&i5.d(),d5&&J5(w),l4(C,d5),d5&&J5(S),d5&&J5(T),i[10](null),d5&&J5(A),d5&&J5(z),i[13](null),N=!1,y9(W)}}}function Yh(i){let e,t;return e=new ca({props:{title:"Step 3: Input scenario metadata",$$slots:{default:[Xh]},$$scope:{ctx:i}}}),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,[n]){const f={};n&65567&&(f.$$scope={dirty:n,ctx:r}),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function ef(i){i.style.borderColor="#f26d88"}function Kh(i,e,t){let{scenarioShort:r=""}=e,{scenarioDescription:n=""}=e,{calculationMethod:f="azure"}=e;const y=je();let o,u;const d=window.location.href.toLowerCase().includes(S1.baseUrl.toLowerCase()),P=()=>y("returnToModify"),F=()=>{if(r===""){alert("Please enter a scenario title."),ef(o);return}if(n===""){alert("Please enter a scenario description."),ef(u);return}y("acceptChangesAndCalculate")};function v(){f=h2(this),t(2,f)}function w(R){H4[R?"unshift":"push"](()=>{o=R,t(3,o)})}function C(){r=this.value,t(0,r)}const S=()=>{t(3,o.style.borderColor=r===""?"#f26d88":"#999",o)};function T(R){H4[R?"unshift":"push"](()=>{u=R,t(4,u)})}function A(){n=this.value,t(1,n)}const z=()=>{t(4,u.style.borderColor=n===""?"#f26d88":"#999",u)};return i.$$set=R=>{"scenarioShort"in R&&t(0,r=R.scenarioShort),"scenarioDescription"in R&&t(1,n=R.scenarioDescription),"calculationMethod"in R&&t(2,f=R.calculationMethod)},[r,n,f,o,u,y,d,P,F,v,w,C,S,T,A,z]}class Jh extends W4{constructor(e){super(),$4(this,e,Kh,Yh,z4,{scenarioShort:0,scenarioDescription:1,calculationMethod:2})}}const Qh="modulepreload",em=function(i){return"/demoland-web/dev/tyne_and_wear_hex/"+i},tf={},tm=function(e,t,r){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(f=>{if(f=em(f),f in tf)return;tf[f]=!0;const y=f.endsWith(".css"),o=y?'[rel="stylesheet"]':"";if(!!r)for(let P=n.length-1;P>=0;P--){const F=n[P];if(F.href===f&&(!y||F.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${o}`))return;const d=document.createElement("link");if(d.rel=y?"stylesheet":Qh,y||(d.as="script",d.crossOrigin=""),d.href=f,document.head.appendChild(d),y)return new Promise((P,F)=>{d.addEventListener("load",P),d.addEventListener("error",()=>F(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=f,window.dispatchEvent(y),!y.defaultPrevented)throw f})};let Z0;const Di={};let _i=0;async function im(){if(Z0)return Z0;const i=await tm(()=>import("./pyodide_worker-6d63054d.js"),[]);return Z0=new i.default,Z0.onmessage=e=>{if(e.data.error)throw new Error(e.data.error);{const{id:t,...r}=e.data,n=Di[t];console.log(Di),delete Di[t],n(r)}},Z0}async function rm(i,e){const t=await im();return _i=(_i+1)%Number.MAX_SAFE_INTEGER,new Promise(r=>{Di[_i]=r,t.postMessage({...e,python:i,id:_i,pathname:window.location.pathname})})}async function sm(i){const t=await rm(` import pyodide_http import pyodide_js import os @@ -79,7 +79,7 @@ modelled development strategies on any of the four indicators. prediction = pred.to_dict("index") print(f"{time.time() - start}s to run") json.dumps(prediction) - `,{scenario_json:i,pathname:window.location.pathname,BASE_URL:window.location.origin+window.location.pathname});return t.error?(console.error(t.error),t):JSON.parse(t.results)}function rf(i){let e,t;return e=new Ah({}),e.$on("changeScenario",i[9]),e.$on("changeScenarioAndProceed",i[10]),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p:t4,i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function sf(i){let e,t,r;function n(y){i[12](y)}let f={};return i[6]!==void 0&&(f.userChangesPresent=i[6]),e=new $h({props:f}),H4.push(()=>O9(e,"userChangesPresent",n)),e.$on("returnToSelection",i[8]),e.$on("changesUpdated",i[13]),e.$on("proceedToMetadata",i[14]),{c(){d4(e.$$.fragment)},m(y,o){y4(e,y,o),r=!0},p(y,o){const u={};!t&&o&64&&(t=!0,u.userChangesPresent=y[6],R9(()=>t=!1)),e.$set(u)},i(y){r||(g1(e.$$.fragment,y),r=!0)},o(y){P1(e.$$.fragment,y),r=!1},d(y){l4(e,y)}}}function of(i){let e,t,r,n,f;function y(P){i[15](P)}function o(P){i[16](P)}function u(P){i[17](P)}let d={};return i[4]!==void 0&&(d.scenarioShort=i[4]),i[5]!==void 0&&(d.scenarioDescription=i[5]),i[2]!==void 0&&(d.calculationMethod=i[2]),e=new Jh({props:d}),H4.push(()=>O9(e,"scenarioShort",y)),H4.push(()=>O9(e,"scenarioDescription",o)),H4.push(()=>O9(e,"calculationMethod",u)),e.$on("returnToModify",i[18]),e.$on("acceptChangesAndCalculate",i[11]),{c(){d4(e.$$.fragment)},m(P,F){y4(e,P,F),f=!0},p(P,F){const v={};!t&&F&16&&(t=!0,v.scenarioShort=P[4],R9(()=>t=!1)),!r&&F&32&&(r=!0,v.scenarioDescription=P[5],R9(()=>r=!1)),!n&&F&4&&(n=!0,v.calculationMethod=P[2],R9(()=>n=!1)),e.$set(v)},i(P){f||(g1(e.$$.fragment,P),f=!0)},o(P){P1(e.$$.fragment,P),f=!1},d(P){l4(e,P)}}}function af(i){let e,t;return e=new bh({}),e.$on("abort",i[19]),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p:t4,i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function nf(i){let e,t;return e=new xh({props:{message:i[1]}}),e.$on("close",i[20]),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,n){const f={};n&2&&(f.message=r[1]),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function om(i){let e,t,r,n,f,y,o,u=i[0]==="choose"&&rf(i),d=i[0]==="modify"&&sf(i),P=i[0]==="metadata"&&of(i),F=i[0]==="calc"&&af(i),v=i[0]==="error"&&nf(i);return{c(){e=R1(`Create your own scenario by modifying an existing one. + `,{scenario_json:i,pathname:window.location.pathname,model_identifier:window.location.pathname.split("/").slice(-2,-1)[0]});return t.error?(console.error(t.error),t):JSON.parse(t.results)}function rf(i){let e,t;return e=new Ah({}),e.$on("changeScenario",i[9]),e.$on("changeScenarioAndProceed",i[10]),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p:t4,i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function sf(i){let e,t,r;function n(y){i[12](y)}let f={};return i[6]!==void 0&&(f.userChangesPresent=i[6]),e=new $h({props:f}),H4.push(()=>O9(e,"userChangesPresent",n)),e.$on("returnToSelection",i[8]),e.$on("changesUpdated",i[13]),e.$on("proceedToMetadata",i[14]),{c(){d4(e.$$.fragment)},m(y,o){y4(e,y,o),r=!0},p(y,o){const u={};!t&&o&64&&(t=!0,u.userChangesPresent=y[6],R9(()=>t=!1)),e.$set(u)},i(y){r||(g1(e.$$.fragment,y),r=!0)},o(y){P1(e.$$.fragment,y),r=!1},d(y){l4(e,y)}}}function of(i){let e,t,r,n,f;function y(P){i[15](P)}function o(P){i[16](P)}function u(P){i[17](P)}let d={};return i[4]!==void 0&&(d.scenarioShort=i[4]),i[5]!==void 0&&(d.scenarioDescription=i[5]),i[2]!==void 0&&(d.calculationMethod=i[2]),e=new Jh({props:d}),H4.push(()=>O9(e,"scenarioShort",y)),H4.push(()=>O9(e,"scenarioDescription",o)),H4.push(()=>O9(e,"calculationMethod",u)),e.$on("returnToModify",i[18]),e.$on("acceptChangesAndCalculate",i[11]),{c(){d4(e.$$.fragment)},m(P,F){y4(e,P,F),f=!0},p(P,F){const v={};!t&&F&16&&(t=!0,v.scenarioShort=P[4],R9(()=>t=!1)),!r&&F&32&&(r=!0,v.scenarioDescription=P[5],R9(()=>r=!1)),!n&&F&4&&(n=!0,v.calculationMethod=P[2],R9(()=>n=!1)),e.$set(v)},i(P){f||(g1(e.$$.fragment,P),f=!0)},o(P){P1(e.$$.fragment,P),f=!1},d(P){l4(e,P)}}}function af(i){let e,t;return e=new bh({}),e.$on("abort",i[19]),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p:t4,i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function nf(i){let e,t;return e=new xh({props:{message:i[1]}}),e.$on("close",i[20]),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,n){const f={};n&2&&(f.message=r[1]),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function om(i){let e,t,r,n,f,y,o,u=i[0]==="choose"&&rf(i),d=i[0]==="modify"&&sf(i),P=i[0]==="metadata"&&of(i),F=i[0]==="calc"&&af(i),v=i[0]==="error"&&nf(i);return{c(){e=R1(`Create your own scenario by modifying an existing one. `),u&&u.c(),t=p1(),d&&d.c(),r=p1(),P&&P.c(),n=p1(),F&&F.c(),f=p1(),v&&v.c(),y=$e()},m(w,C){t1(w,e,C),u&&u.m(w,C),t1(w,t,C),d&&d.m(w,C),t1(w,r,C),P&&P.m(w,C),t1(w,n,C),F&&F.m(w,C),t1(w,f,C),v&&v.m(w,C),t1(w,y,C),o=!0},p(w,[C]){w[0]==="choose"?u?(u.p(w,C),C&1&&g1(u,1)):(u=rf(w),u.c(),g1(u,1),u.m(t.parentNode,t)):u&&(P9(),P1(u,1,1,()=>{u=null}),x9()),w[0]==="modify"?d?(d.p(w,C),C&1&&g1(d,1)):(d=sf(w),d.c(),g1(d,1),d.m(r.parentNode,r)):d&&(P9(),P1(d,1,1,()=>{d=null}),x9()),w[0]==="metadata"?P?(P.p(w,C),C&1&&g1(P,1)):(P=of(w),P.c(),g1(P,1),P.m(n.parentNode,n)):P&&(P9(),P1(P,1,1,()=>{P=null}),x9()),w[0]==="calc"?F?(F.p(w,C),C&1&&g1(F,1)):(F=af(w),F.c(),g1(F,1),F.m(f.parentNode,f)):F&&(P9(),P1(F,1,1,()=>{F=null}),x9()),w[0]==="error"?v?(v.p(w,C),C&1&&g1(v,1)):(v=nf(w),v.c(),g1(v,1),v.m(y.parentNode,y)):v&&(P9(),P1(v,1,1,()=>{v=null}),x9())},i(w){o||(g1(u),g1(d),g1(P),g1(F),g1(v),o=!0)},o(w){P1(u),P1(d),P1(P),P1(F),P1(v),o=!1},d(w){w&&J5(e),u&&u.d(w),w&&J5(t),d&&d.d(w),w&&J5(r),P&&P.d(w),w&&J5(n),F&&F.d(w),w&&J5(f),v&&v.d(w),w&&J5(y)}}}let am="Are you sure you want to go back? All changes will be lost.";function nm(i,e,t){let r,n,f,y,o;m4(i,ne,b5=>t(21,r=b5)),m4(i,pe,b5=>t(22,n=b5)),m4(i,O3,b5=>t(23,f=b5)),m4(i,Xi,b5=>t(24,y=b5)),m4(i,$6,b5=>t(25,o=b5));const u=je();let d="choose",P="An error occurred.",F,v,w="",C="",S=!1;O2(()=>{w4(ne,r=[],r)});function T(){S?window.confirm(am)&&(t(6,S=!1),w4(ne,r=[],r),t(0,d="choose"),w4(pe,n=S1.referenceScenarioObject.metadata.name,n),u("changeScenario")):(w4(ne,r=[],r),t(0,d="choose"))}function A(){u("changeScenario",{}),w4(ne,r=[],r)}function z(){A(),t(0,d="modify")}function R(b5,k5){console.log("handleResult called");const C5={metadata:{name:w.replace(/\s/g,"_").toLowerCase(),short:w,long:"Custom: "+w,description:C},changes:JSON.parse(k5).scenario_json,values:b5};console.log("obj",C5);const I5=gr(C5,o,y,"custom scenario");if(console.log("newScenario",I5),f.has(I5.metadata.name)){let L5=1;for(;f.has(`${I5.metadata.name}_${L5})`);)L5++;I5.metadata.name=`${I5.metadata.name}_${L5}`}f.set(I5.metadata.name,I5),t(6,S=!1),u("import",{name:I5.metadata.name})}function N(b5,k5){if(b5.ok)b5.json().then(C5=>R(C5,k5));else throw t(0,d="error"),t(1,P=`HTTP request to custom scenario server failed: received ${b5.status} ${b5.statusText}.`),b5.status===500&&t(1,P+=" (If you are running locally, did you start the backend up?)"),new Error(P)}function W(b5){b5 instanceof DOMException&&b5.name==="AbortError"?(t(0,d="metadata"),console.log("Calculation aborted")):(t(0,d="error"),t(1,P=b5.message))}function K(){const b5=JSON.stringify({scenario_json:xl(f.get(n).changes),model_identifier:S1.modelIdentifier});if(console.log("changedJson",b5),t(0,d="calc"),w4(ne,r=[],r),t(3,v=new AbortController),console.log("Running with runner",F),F==="wasm")sm(b5).then(k5=>{console.log("result",k5),k5.error?W(new Error(k5.error)):(console.log(k5),R(k5,b5),console.log("scenario result is ",k5))}).catch(k5=>W(k5));else if(F==="azure"||F==="local"){const k5=F==="azure"?`${S1.webApiUrl}/api/scenario`:`${S1.localApiUrl}/api/scenario`;fetch(k5,{method:"POST",headers:{"Content-Type":"application/json"},body:b5,signal:v.signal}).then(C5=>N(C5,b5)).catch(C5=>W(C5))}}function J(b5){S=b5,t(6,S)}const s5=()=>{u("changesUpdated")},i5=()=>t(0,d="metadata");function d5(b5){w=b5,t(4,w)}function _5(b5){C=b5,t(5,C)}function o5(b5){F=b5,t(2,F)}return[d,P,F,v,w,C,S,u,T,A,z,K,J,s5,i5,d5,_5,o5,()=>t(0,d="modify"),()=>v.abort(),()=>t(0,d="metadata")]}class cm extends W4{constructor(e){super(),$4(this,e,nm,om,z4,{})}}function fm(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T,A;return{c(){e=S5("div"),t=S5("div"),r=S5("h3"),r.textContent="An error occurred :(",n=p1(),f=S5("p"),y=R1(i[0]),o=p1(),u=S5("p"),d=R1("Please try again, or "),P=S5("a"),F=R1("contact the developers"),v=R1(" if the problem persists."),w=p1(),C=S5("p"),S=S5("button"),S.textContent="Close",e5(r,"class","svelte-1xb3nt3"),e5(f,"id","error-message"),e5(f,"class","svelte-1xb3nt3"),e5(P,"href",pm),e5(P,"class","svelte-1xb3nt3"),e5(u,"class","svelte-1xb3nt3"),e5(S,"id","error-close"),e5(S,"class","svelte-1xb3nt3"),e5(C,"class","svelte-1xb3nt3"),e5(t,"id","error"),e5(t,"class","svelte-1xb3nt3"),e5(e,"id","error-cover"),e5(e,"class","svelte-1xb3nt3")},m(z,R){t1(z,e,R),y5(e,t),y5(t,r),y5(t,n),y5(t,f),y5(f,y),y5(t,o),y5(t,u),y5(u,d),y5(u,P),y5(P,F),y5(u,v),y5(t,w),y5(t,C),y5(C,S),T||(A=G1(S,"click",i[1]),T=!0)},p(z,[R]){R&1&&_9(y,z[0])},i:t4,o:t4,d(z){z&&J5(e),T=!1,A()}}}const pm="https://github.com/Urban-Analytics-Technology-Platform/demoland-web/issues";function ym(i,e,t){const r=je();let{message:n}=e;function f(){r("close")}return i.$$set=y=>{"message"in y&&t(0,n=y.message)},[n,f]}class lm extends W4{constructor(e){super(),$4(this,e,ym,fm,z4,{message:0})}}function cf(i){let e,t;return e=new lm({props:{message:i[2]}}),e.$on("close",i[7]),{c(){d4(e.$$.fragment)},m(r,n){y4(e,r,n),t=!0},p(r,n){const f={};n&4&&(f.message=r[2]),e.$set(f)},i(r){t||(g1(e.$$.fragment,r),t=!0)},o(r){P1(e.$$.fragment,r),t=!1},d(r){l4(e,r)}}}function um(i){let e,t,r,n,f,y,o,u,d,P,F,v,w,C,S,T=i[1]&&cf(i);return{c(){e=S5("div"),t=R1(`If you have already modelled a custom scenario and saved the results, you can import it here to visualise the results. diff --git a/dev/tyne_and_wear_hex/assets/pyodide_worker-df5fef8a.js b/dev/tyne_and_wear_hex/assets/pyodide_worker-6d63054d.js similarity index 54% rename from dev/tyne_and_wear_hex/assets/pyodide_worker-df5fef8a.js rename to dev/tyne_and_wear_hex/assets/pyodide_worker-6d63054d.js index b4dde79..279b2ad 100644 --- a/dev/tyne_and_wear_hex/assets/pyodide_worker-df5fef8a.js +++ b/dev/tyne_and_wear_hex/assets/pyodide_worker-6d63054d.js @@ -1 +1 @@ -function e(){return new Worker("/demoland-web/dev/tyne_and_wear_hex/assets/pyodide_worker-9534fa03.js",{type:"module"})}export{e as default}; +function e(){return new Worker("/demoland-web/dev/tyne_and_wear_hex/assets/pyodide_worker-d616a3be.js",{type:"module"})}export{e as default}; diff --git a/dev/tyne_and_wear_hex/assets/pyodide_worker-9534fa03.js b/dev/tyne_and_wear_hex/assets/pyodide_worker-d616a3be.js similarity index 97% rename from dev/tyne_and_wear_hex/assets/pyodide_worker-9534fa03.js rename to dev/tyne_and_wear_hex/assets/pyodide_worker-d616a3be.js index 524956b..8cfaeb5 100644 --- a/dev/tyne_and_wear_hex/assets/pyodide_worker-9534fa03.js +++ b/dev/tyne_and_wear_hex/assets/pyodide_worker-d616a3be.js @@ -7,4 +7,4 @@ var oe=Object.create,L=Object.defineProperty,ae=Object.getOwnPropertyDescriptor, `),p=[],c=2,d=s.length;c/,"$2").replace(/\([^)]*\)/g,"")||void 0,y;d.match(/\(([^)]*)\)/)&&(y=d.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var g=y===void 0||y==="[arguments not available]"?void 0:y.split(",");return new o({functionName:m,args:g,fileName:c[0],lineNumber:c[1],columnNumber:c[2],source:s})},this)},"ErrorStackParser$$parseOpera11")}},"ErrorStackParser"))}),me=pe(fe()),w=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&typeof process.browser>"u",x,E,F,$,D;async function I(){if(!w||(x=(await import("./__vite-browser-external-dfc062b5.js")).default,D=await import("./__vite-browser-external-dfc062b5.js"),globalThis.fetch?E=fetch:E=(await import("./fetch-npm-browserify-1ff37dca.js").then(function(i){return i.f})).default,$=(await import("./__vite-browser-external-dfc062b5.js")).default,F=await import("./__vite-browser-external-dfc062b5.js"),N=F.sep,typeof ce<"u"))return;let e=await import("./__vite-browser-external-dfc062b5.js"),t=await import("./__vite-browser-external-dfc062b5.js"),o=await import("./__vite-browser-external-dfc062b5.js"),a=await import("./__vite-browser-external-dfc062b5.js"),n={fs:e,crypto:t,ws:o,child_process:a};globalThis.require=function(i){return n[i]}}u(I,"initNodeModules");function T(e,t){return F.resolve(t||".",e)}u(T,"node_resolvePath");function A(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}u(A,"browser_resolvePath");var P;w?P=T:P=A;var N;w||(N="/");function M(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:E(e)}:{binary:D.readFile(e).then(o=>new Uint8Array(o.buffer,o.byteOffset,o.byteLength))}}u(M,"node_getBinaryResponse");function U(e,t){let o=new URL(e,location);return{response:fetch(o,t?{integrity:t}:{})}}u(U,"browser_getBinaryResponse");var k;w?k=M:k=U;async function H(e,t){let{response:o,binary:a}=k(e,t);if(a)return a;let n=await o;if(!n.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await n.arrayBuffer())}u(H,"loadBinaryFile");var b;if(globalThis.document)b=u(async e=>await import(e),"loadScript");else if(globalThis.importScripts)b=u(async e=>{try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)await import(e);else throw t}},"loadScript");else if(w)b=C;else throw new Error("Cannot determine runtime environment");async function C(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?$.runInThisContext(await(await E(e)).text()):await import(x.pathToFileURL(e).href)}u(C,"nodeLoadScript");function q(e){let t=e.FS,o=e.FS.filesystems.MEMFS,a=e.PATH,n={DIR_MODE:16895,FILE_MODE:33279,mount:function(i){if(!i.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return o.mount.apply(null,arguments)},syncfs:async(i,r,l)=>{try{let s=n.getLocalSet(i),p=await n.getRemoteSet(i),c=r?p:s,d=r?s:p;await n.reconcile(i,c,d),l(null)}catch(s){l(s)}},getLocalSet:i=>{let r=Object.create(null);function l(c){return c!=="."&&c!==".."}u(l,"isRealDir");function s(c){return d=>a.join2(c,d)}u(s,"toAbsolute");let p=t.readdir(i.mountpoint).filter(l).map(s(i.mountpoint));for(;p.length;){let c=p.pop(),d=t.stat(c);t.isDir(d.mode)&&p.push.apply(p,t.readdir(c).filter(l).map(s(c))),r[c]={timestamp:d.mtime,mode:d.mode}}return{type:"local",entries:r}},getRemoteSet:async i=>{let r=Object.create(null),l=await ye(i.opts.fileSystemHandle);for(let[s,p]of l)s!=="."&&(r[a.join2(i.mountpoint,s)]={timestamp:p.kind==="file"?(await p.getFile()).lastModifiedDate:new Date,mode:p.kind==="file"?n.FILE_MODE:n.DIR_MODE});return{type:"remote",entries:r,handles:l}},loadLocalEntry:i=>{let r=t.lookupPath(i).node,l=t.stat(i);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return r.contents=o.getFileDataAsTypedArray(r),{timestamp:l.mtime,mode:l.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(i,r)=>{if(t.isDir(r.mode))t.mkdirTree(i,r.mode);else if(t.isFile(r.mode))t.writeFile(i,r.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(i,r.mode),t.utime(i,r.timestamp,r.timestamp)},removeLocalEntry:i=>{var r=t.stat(i);t.isDir(r.mode)?t.rmdir(i):t.isFile(r.mode)&&t.unlink(i)},loadRemoteEntry:async i=>{if(i.kind==="file"){let r=await i.getFile();return{contents:new Uint8Array(await r.arrayBuffer()),mode:n.FILE_MODE,timestamp:r.lastModifiedDate}}else{if(i.kind==="directory")return{mode:n.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+i.kind)}},storeRemoteEntry:async(i,r,l)=>{let s=i.get(a.dirname(r)),p=t.isFile(l.mode)?await s.getFileHandle(a.basename(r),{create:!0}):await s.getDirectoryHandle(a.basename(r),{create:!0});if(p.kind==="file"){let c=await p.createWritable();await c.write(l.contents),await c.close()}i.set(r,p)},removeRemoteEntry:async(i,r)=>{await i.get(a.dirname(r)).removeEntry(a.basename(r)),i.delete(r)},reconcile:async(i,r,l)=>{let s=0,p=[];Object.keys(r.entries).forEach(function(m){let y=r.entries[m],g=l.entries[m];(!g||t.isFile(y.mode)&&y.timestamp.getTime()>g.timestamp.getTime())&&(p.push(m),s++)}),p.sort();let c=[];if(Object.keys(l.entries).forEach(function(m){r.entries[m]||(c.push(m),s++)}),c.sort().reverse(),!s)return;let d=r.type==="remote"?r.handles:l.handles;for(let m of p){let y=a.normalize(m.replace(i.mountpoint,"/")).substring(1);if(l.type==="local"){let g=d.get(y),f=await n.loadRemoteEntry(g);n.storeLocalEntry(m,f)}else{let g=n.loadLocalEntry(m);await n.storeRemoteEntry(d,y,g)}}for(let m of c)if(l.type==="local")n.removeLocalEntry(m);else{let y=a.normalize(m.replace(i.mountpoint,"/")).substring(1);await n.removeRemoteEntry(d,y)}}};e.FS.filesystems.NATIVEFS_ASYNC=n}u(q,"initializeNativeFS");var ye=u(async e=>{let t=[];async function o(n){for await(let i of n.values())t.push(i),i.kind==="directory"&&await o(i)}u(o,"collect"),await o(e);let a=new Map;a.set(".",e);for(let n of t){let i=(await e.resolve(n)).join("/");a.set(i,n)}return a},"getFsHandles");function z(){let e={};return e.noImageDecoding=!0,e.noAudioDecoding=!0,e.noWasmDecoding=!1,e.preRun=[],e.quit=(t,o)=>{throw e.exited={status:t,toThrow:o},o},e}u(z,"createModule");function W(e,t){e.preRun.push(function(){let o="/";try{e.FS.mkdirTree(t)}catch(a){console.error(`Error occurred while making a home directory '${t}':`),console.error(a),console.error(`Using '${o}' for a home directory instead`),t=o}e.FS.chdir(t)})}u(W,"createHomeDirectory");function B(e,t){e.preRun.push(function(){Object.assign(e.ENV,t)})}u(B,"setEnvironment");function V(e,t){e.preRun.push(()=>{for(let o of t)e.FS.mkdirTree(o),e.FS.mount(e.FS.filesystems.NODEFS,{root:o},o)})}u(V,"mountLocalDirectories");function G(e,t){let o=H(t);e.preRun.push(()=>{let a=e._py_version_major(),n=e._py_version_minor();e.FS.mkdirTree("/lib"),e.FS.mkdirTree(`/lib/python${a}.${n}/site-packages`),e.addRunDependency("install-stdlib"),o.then(i=>{e.FS.writeFile(`/lib/python${a}${n}.zip`,i)}).catch(i=>{console.error("Error occurred while installing the standard library:"),console.error(i)}).finally(()=>{e.removeRunDependency("install-stdlib")})})}u(G,"installStdlib");function K(e,t){let o;t.stdLibURL!=null?o=t.stdLibURL:o=t.indexURL+"python_stdlib.zip",G(e,o),W(e,t.env.HOME),B(e,t.env),V(e,t._node_mounts),e.preRun.push(()=>q(e))}u(K,"initializeFileSystem");function Y(e,t){let{binary:o,response:a}=k(t+"pyodide.asm.wasm");e.instantiateWasm=function(n,i){return async function(){try{let r;a?r=await WebAssembly.instantiateStreaming(a,n):r=await WebAssembly.instantiate(await o,n);let{instance:l,module:s}=r;typeof WasmOffsetConverter<"u"&&(wasmOffsetConverter=new WasmOffsetConverter(wasmBinary,s)),i(l,s)}catch(r){console.warn("wasm instantiation failed!"),console.warn(r)}}(),{}}}u(Y,"preloadWasm");var S="0.24.1";function J(e,t){return new Proxy(e,{get(o,a){return a==="get"?n=>{let i=o.get(n);return i===void 0&&(i=t.get(n)),i}:a==="has"?n=>o.has(n)||t.has(n):Reflect.get(o,a)}})}u(J,"wrapPythonGlobals");function Q(e,t){e.runPythonInternal_dict=e._pyodide._base.eval_code("{}"),e.importlib=e.runPythonInternal("import importlib; importlib");let o=e.importlib.import_module;e.sys=o("sys"),e.sys.path.insert(0,t.env.HOME),e.os=o("os");let a=e.runPythonInternal("import __main__; __main__.__dict__"),n=e.runPythonInternal("import builtins; builtins.__dict__");e.globals=J(a,n);let i=e._pyodide._importhook;function r(s){"__all__"in s||Object.defineProperty(s,"__all__",{get:()=>l.toPy(Object.getOwnPropertyNames(s).filter(p=>p!=="__all__")),enumerable:!1,configurable:!0})}u(r,"jsFinderHook"),i.register_js_finder.callKwargs({hook:r}),i.register_js_module("js",t.jsglobals);let l=e.makePublicAPI();return i.register_js_module("pyodide_js",l),e.pyodide_py=o("pyodide"),e.pyodide_code=o("pyodide.code"),e.pyodide_ffi=o("pyodide.ffi"),e.package_loader=o("pyodide._package_loader"),e.sitepackages=e.package_loader.SITE_PACKAGES.__str__(),e.dsodir=e.package_loader.DSO_DIR.__str__(),e.defaultLdLibraryPath=[e.dsodir,e.sitepackages],e.os.environ.__setitem__("LD_LIBRARY_PATH",e.defaultLdLibraryPath.join(":")),l.pyodide_py=e.pyodide_py,l.globals=e.globals,l}u(Q,"finalizeBootstrap");function X(){if(typeof __dirname=="string")return __dirname;let e;try{throw new Error}catch(a){e=a}let t=me.default.parse(e)[0].fileName,o=t.lastIndexOf(N);if(o===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,o)}u(X,"calculateIndexURL");async function Z(e={}){await I();let t=e.indexURL||X();t=P(t),t.endsWith("/")||(t+="/"),e.indexURL=t;let o={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:t+"pyodide-lock.json",args:[],_node_mounts:[],env:{},packageCacheDir:t,packages:[]},a=Object.assign(o,e);if(e.homedir){if(console.warn("The homedir argument to loadPyodide is deprecated. Use 'env: { HOME: value }' instead of 'homedir: value'."),e.env&&e.env.HOME)throw new Error("Set both env.HOME and homedir arguments");a.env.HOME=a.homedir}a.env.HOME||(a.env.HOME="/home/pyodide");let n=z();n.print=a.stdout,n.printErr=a.stderr,n.arguments=a.args;let i={config:a};n.API=i,Y(n,t),K(n,a);let r=new Promise(d=>n.postRun=d),l;if(i.bootstrapFinalizedPromise=new Promise(d=>l=d),n.locateFile=d=>a.indexURL+d,typeof _createPyodideModule!="function"){let d=`${a.indexURL}pyodide.asm.js`;await b(d)}if(await _createPyodideModule(n),await r,n.exited)throw n.exited.toThrow;if(i.version!==S)throw new Error(`Pyodide version does not match: '${S}' <==> '${i.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);n.locateFile=d=>{throw new Error("Didn't expect to load any more file_packager files!")};let[s,p]=i.rawRun("import _pyodide_core");s&&n.API.fatal_loading_error(`Failed to import _pyodide_core -`,p);let c=Q(i,a);if(l(),c.version.includes("dev")||i.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),await i.packageIndexReady,i._pyodide._importhook.register_module_not_found_hook(i._import_name_to_package_name,i.lockfile_unvendored_stdlibs_and_test),i.lockfile_info.version!==S)throw new Error("Lock file version doesn't match Pyodide version");return i.package_loader.init_loaded_packages(),a.fullStdLib&&await c.loadPackage(i.lockfile_unvendored_stdlibs),i.initializeStreams(a.stdin,a.stdout,a.stderr),c}u(Z,"loadPyodide");async function he(e){self.pyodide=await Z({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.24.1/full/"}),await self.pyodide.loadPackage(["micropip"]);const t=self.pyodide.pyimport("micropip");await t.install("lzma"),await t.install("pyodide-http"),await t.install(e+"demoland_engine-0.1.dev1+g8333879-py3-none-any.whl")}self.onmessage=async e=>{const{id:t,python:o,pathname:a,scenario_json:n,BASE_URL:i}=e.data;try{await he(a)}catch(l){console.error(l),self.postMessage({error:l.message})}self.scenario_json=n;let r=i.split("/").slice(-2,-1)[0];self.pyodide.globals.set("DEMOLAND",r);try{await self.pyodide.loadPackagesFromImports(o);const l=await self.pyodide.runPythonAsync(o);self.postMessage({results:l,id:t})}catch(l){self.postMessage({error:l.message,id:t})}}; +`,p);let c=Q(i,a);if(l(),c.version.includes("dev")||i.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${c.version}/full/`),await i.packageIndexReady,i._pyodide._importhook.register_module_not_found_hook(i._import_name_to_package_name,i.lockfile_unvendored_stdlibs_and_test),i.lockfile_info.version!==S)throw new Error("Lock file version doesn't match Pyodide version");return i.package_loader.init_loaded_packages(),a.fullStdLib&&await c.loadPackage(i.lockfile_unvendored_stdlibs),i.initializeStreams(a.stdin,a.stdout,a.stderr),c}u(Z,"loadPyodide");async function he(e){self.pyodide=await Z({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.24.1/full/"}),await self.pyodide.loadPackage(["micropip"]);const t=self.pyodide.pyimport("micropip");await t.install("lzma"),await t.install("pyodide-http"),await t.install(e+"demoland_engine-0.1.dev1+g8333879-py3-none-any.whl")}self.onmessage=async e=>{const{id:t,python:o,pathname:a,scenario_json:n,model_identifier:i}=e.data;try{await he(a)}catch(r){console.error(r),self.postMessage({error:r.message})}self.scenario_json=n,self.pyodide.globals.set("DEMOLAND",i);try{await self.pyodide.loadPackagesFromImports(o);const r=await self.pyodide.runPythonAsync(o);self.postMessage({results:r,id:t})}catch(r){self.postMessage({error:r.message,id:t})}}; diff --git a/dev/tyne_and_wear_hex/index.html b/dev/tyne_and_wear_hex/index.html index a92b31d..15ad25b 100644 --- a/dev/tyne_and_wear_hex/index.html +++ b/dev/tyne_and_wear_hex/index.html @@ -7,7 +7,7 @@ - +